feat(claim): add log section
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-03-01 15:15:58 +01:00
parent cb21a51065
commit 44318903e7
13 changed files with 106 additions and 7 deletions

View File

@ -0,0 +1,3 @@
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('ClaimLog', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager');

View File

@ -1 +0,0 @@
delete file

View File

@ -729,6 +729,10 @@ export default {
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]'
},
claimLog: {
anyLineCreated: 'vn-claim-log > vn-log vn-tbody > vn-tr',
firstLineCreatedProperty: 'vn-claim-log > vn-log vn-tbody > vn-tr:nth-child(1) > vn-td > vn-one:nth-child(3) > div span:nth-child(2)',
},
ordersIndex: {
secondSearchResultTotal: 'vn-order-index vn-card > vn-table > div > vn-tbody .vn-tr:nth-child(2) vn-td:nth-child(9)',
advancedSearchButton: 'vn-order-search-panel vn-submit[label="Search"]',

View File

@ -0,0 +1,52 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
fdescribe('Claim log path', () => {
let browser;
let page;
const claimId = '1';
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('claimManager', 'claim');
});
afterAll(async() => {
await browser.close();
});
it('should now navigate to the target claim basicData section', async() => {
await page.loginAndModule('claimManager', 'claim');
await page.accessToSearchResult(claimId);
await page.accessToSection('claim.card.basicData');
});
it(`should edit claim state and observation fields`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Faltas');
await page.waitToClick(selectors.claimBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should edit claim state and observation fields`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Faltas');
await page.waitToClick(selectors.claimBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it(`should search for the created item and navigate to it's log section`, async() => {
await page.waitForState('claim.card.detail');
await page.accessToSection('claim.card.log');
});
it(`should confirm the log is showing 5 entries`, async() => {
await page.waitForSelector(selectors.claimLog.anyLineCreated);
const anyLineCreatedCount = await page.countElement(selectors.claimLog.anyLineCreated);
expect(anyLineCreatedCount).toEqual(5);
});
});

View File

@ -1,6 +1,11 @@
{
"name": "ClaimBeginning",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "ClaimLog",
"relation": "claim",
"showField": "quantity"
},
"options": {
"mysql": {
"table": "claimBeginning"

View File

@ -1,6 +1,10 @@
{
"name": "ClaimDevelopment",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "ClaimLog",
"relation": "claim"
},
"options": {
"mysql": {
"table": "claimDevelopment"

View File

@ -1,6 +1,10 @@
{
"name": "ClaimEnd",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "ClaimLog",
"relation": "claim"
},
"options": {
"mysql": {
"table": "claimEnd"

View File

@ -1,6 +1,11 @@
{
"name": "ClaimState",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "ClaimLog",
"relation": "claim",
"showField": "description"
},
"options": {
"mysql": {
"table": "claimState"

View File

@ -1,6 +1,10 @@
{
"name": "Claim",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "ClaimLog",
"showField": "id"
},
"options": {
"mysql": {
"table": "claim"

View File

@ -11,3 +11,4 @@ import './development';
import './search-panel';
import './summary';
import './photos';
import './log';

View File

@ -0,0 +1,4 @@
<vn-log
url="ClaimLogs"
origin-id="$ctrl.$params.id">
</vn-log>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnClaimLog', {
template: require('./index.html'),
controller: Section,
});

View File

@ -13,7 +13,8 @@
{"state": "claim.card.detail", "icon": "icon-details"},
{"state": "claim.card.photos", "icon": "image"},
{"state": "claim.card.development", "icon": "icon-traceability"},
{"state": "claim.card.action", "icon": "icon-actions"}
{"state": "claim.card.action", "icon": "icon-actions"},
{"state": "claim.card.log", "icon": "history"}
]
},
"keybindings": [
@ -88,6 +89,12 @@
"params": {
"claim": "$ctrl.claim"
}
}, {
"url" : "/log",
"state": "claim.card.log",
"component": "vn-claim-log",
"description": "Log",
"acl": ["claimManager"]
}
]
}