Conformance Filter: fetch filter params API done.

This commit is contained in:
chiayin
2023-10-18 12:40:51 +08:00
parent 85d1f9a487
commit 830f4d30a9
7 changed files with 26 additions and 20 deletions

View File

@@ -287,7 +287,7 @@ export default {
*/
getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100;
else return (val * 100).toFixed(1);
else return parseFloat((val * 100).toFixed(1));
},
/**
* Convert seconds to days

View File

@@ -161,7 +161,7 @@ export default {
*/
getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100;
else return (val * 100).toFixed(1);
else return parseFloat((val * 100).toFixed(1));
},
/**
* set progress bar width

View File

@@ -109,7 +109,7 @@ export default {
*/
getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100;
else return (val * 100).toFixed(1);
else return parseFloat((val * 100).toFixed(1));
},
/**
* setting stats data

View File

@@ -204,7 +204,7 @@ export default {
*/
getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100;
else return (val * 100).toFixed(1);
else return parseFloat((val * 100).toFixed(1));
},
/**
* set progress bar width

View File

@@ -6,9 +6,9 @@ import apiError from '@/module/apiError.js';
export default defineStore('conformanceStore', {
state: () => ({
conformanceLogId: null,
conformanceFilterId: null,
conformanceTempCheckId: null,
conformanceLogId: null, // log 檔
conformanceFilterId: null, // filter 檔
conformanceLogTempCheckId: null, // log 檔存檔前的 check Id
allConformanceTask: [],
allCfmSeqStart: [],
allCfmSeqEnd: [],
@@ -177,9 +177,14 @@ export default defineStore('conformanceStore', {
/**
* fetch Log Conformance Parameters api for Rule Settings.
*/
async getLogConformanceParams() {
async getConformanceParams() {
let logId = this.conformanceLogId;
const api = `/api/log-checks/params?log_id=${logId}`;
let filterId = this.conformanceFilterId;
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterId !== null) api = `/api/filter-checks/params?filter_id=${filterId}`;
else api = `/api/log-checks/params?log_id=${logId}`;
try {
const response = await this.$axios.get(api);
@@ -202,7 +207,7 @@ export default defineStore('conformanceStore', {
try {
const response = await this.$axios.post(api, data);
this.conformanceTempCheckId = response.data.id;
this.conformanceLogTempCheckId = response.data.id;
} catch(error) {
apiError(error, 'Failed to add the Temporary Check for a log.');
}
@@ -211,7 +216,7 @@ export default defineStore('conformanceStore', {
* Get the Temporary Log Conformance Report
*/
async getLogConformanceTempReport() {
let checkId = this.conformanceTempCheckId;
let checkId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}`;
try {
@@ -225,7 +230,7 @@ export default defineStore('conformanceStore', {
* Get the detail of a temporary log conformance issue.
*/
async getLogConformanceIssue(issueNo) {
let checkId = this.conformanceTempCheckId;
let checkId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}/issues/${issueNo}`;
try {
@@ -239,7 +244,7 @@ export default defineStore('conformanceStore', {
* Get the Trace Details of a Temporary Log Conformance lssue.
*/
async getLogConformanceTraceDetail(issueNo, traceId, start) {
let checkId = this.conformanceTempCheckId;
let checkId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}/issues/${issueNo}/traces/${traceId}?start=${start}&page_size=20`;
try {
@@ -256,7 +261,7 @@ export default defineStore('conformanceStore', {
* Get the Details of a Temporary Log Conformance Loop.
*/
async getLogConformanceLoop(loopNo) {
let checkId = this.conformanceTempCheckId;
let checkId = this.conformanceLogTempCheckId;
let api = `/api/temp-log-checks/${checkId}/loops/${loopNo}`;
try {
@@ -270,7 +275,7 @@ export default defineStore('conformanceStore', {
* Get the Trace Details of a Temporary Log Conformance Loops.
*/
async getLogConformanceLoopsTraceDetail(loopNo, traceId, start) {
let checkId = this.conformanceTempCheckId;
let checkId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}/loops/${loopNo}/traces/${traceId}?start=${start}&page_size=20`;
try {

View File

@@ -20,9 +20,9 @@ export default {
const loadingStore = LoadingStore();
const conformanceStore = ConformanceStore();
const { isLoading } = storeToRefs(loadingStore);
const { conformanceLogId, selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo } = storeToRefs(conformanceStore);
const { conformanceLogId, conformanceFilterId, selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo } = storeToRefs(conformanceStore);
return { isLoading, conformanceLogId, conformanceStore, selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo, }
return { isLoading, conformanceLogId, conformanceFilterId, conformanceStore, selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo, }
},
components: {
StatusBar,
@@ -33,8 +33,9 @@ export default {
// let logId;
this.isLoading = true;
if(this.$route.params.type === 'log') this.conformanceLogId = this.$route.params.fileId;
else if(this.$route.params.type === 'filter') this.conformanceFilterId = this.$route.params.fileId;
await this.conformanceStore.getLogConformanceParams();
await this.conformanceStore.getConformanceParams();
this.isLoading = false;
},

View File

@@ -142,14 +142,14 @@
fileId = file.id;
type = 'log';
params = { type: type, fileId: fileId };
this.$router.push({name: 'Map', params: { type: type, fileId: fileId, state: params }});
this.$router.push({name: 'Map', params: params, query: params});
break;
case 'Filter':
this.createFilterId = file.id;
fileId = file.id;
type = 'filter';
params = { type: type, fileId: fileId };
this.$router.push({name: 'Map', params: params, state: params});
this.$router.push({name: 'Map', params: params, query: params});
break;
default:
break;