Conformance: Activity sequence Short loop(s) done.

This commit is contained in:
chiayin
2023-08-15 10:31:55 +08:00
parent 8f1711de99
commit 82f18ee5e4
4 changed files with 193 additions and 58 deletions

View File

@@ -24,6 +24,9 @@ export default defineStore('conformanceStore', {
allIssueTraces: null,
allTaskSeq: null,
allCases: null,
allLoopTraces: null,
allLoopTaskSeq: null,
allLoopCases: null,
selectedRuleType: 'Have activity', // radio
selectedActivitySequence: 'Start & End', // radio
selectedMode: 'Directly follows', // radio
@@ -78,6 +81,35 @@ export default defineStore('conformanceStore', {
};
return state.allCases;
},
loopTraces: state => {
return state.allLoopTraces;
},
loopTaskSeq: state => {
return state.allLoopTaskSeq;
},
loopCases: state => {
if(state.allLoopCases !== null){
state.allLoopCases.map(c => {
c.started_at = moment(c.started_at).format('YYYY/MM/DD HH:MM');
c.completed_at = moment(c.completed_at).format('YYYY/MM/DD HH:MM');
c.attributes.map(att => {
switch (att.type) {
case 'date':
att.value = att.value !== null ? moment(att.value).format('YYYY/MM/DD HH:MM:ss') : null;
break;
case 'float':
att.value = att.value !== null ? new Decimal(att.value).toFixed(2) : null;
break
default:
break;
}
return att;
})
return c;
});
};
return state.allLoopCases;
},
},
actions: {
/**
@@ -157,8 +189,7 @@ export default defineStore('conformanceStore', {
loading.isLoading = false;
await delay(500);
$toast.default('Failed to Get the detail of a temporary log conformance issue.',{position: 'bottom'});
}
};
},
/**
* Get the Trace Details of a Temporary Log Conformance lssue.
@@ -182,7 +213,50 @@ export default defineStore('conformanceStore', {
await delay(500);
$toast.default('Failed to Get the detail of a temporary log conformance issue.',{position: 'bottom'});
};
}
};
},
/**
* Get the Details of a Temporary Log Conformance Loop.
*/
async getLogConformanceLoop(loopNo) {
let checkerId = this.conformanceTempCheckerId;
let api = `/api/temp-log-checkers/${checkerId}/loops/${loopNo}`;
try {
const response = await this.$axios.get(api);
this.allLoopTraces = response.data.traces;
} catch(error) {
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to Get the detail of a temporary log conformance loop.',{position: 'bottom'});
};
},
/**
* Get the Trace Details of a Temporary Log Conformance Loops.
*/
async getLogConformanceLoopsTraceDetail(loopNo, traceId, start) {
let checkerId = this.conformanceTempCheckerId;
const api = `/api/temp-log-checkers/${checkerId}/loops/${loopNo}/traces/${traceId}?start=${start}&page_size=20`;
try {
const response = await this.$axios.get(api);
this.allLoopTaskSeq = response.data.task_seq;
this.allLoopCases = response.data.cases;
return response.data.cases;
} catch(error) {
if(error.response.status === 404) this.infinite404 = 404;
else {
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to Get the detail of a temporary log conformance loop.',{position: 'bottom'});
};
};
},
},
})