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){ getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100; 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 * Convert seconds to days

View File

@@ -161,7 +161,7 @@ export default {
*/ */
getPercentLabel(val){ getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100; 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 * set progress bar width

View File

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

View File

@@ -204,7 +204,7 @@ export default {
*/ */
getPercentLabel(val){ getPercentLabel(val){
if((val * 100).toFixed(1) >= 100) return 100; 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 * set progress bar width

View File

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

View File

@@ -20,9 +20,9 @@ export default {
const loadingStore = LoadingStore(); const loadingStore = LoadingStore();
const conformanceStore = ConformanceStore(); const conformanceStore = ConformanceStore();
const { isLoading } = storeToRefs(loadingStore); 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: { components: {
StatusBar, StatusBar,
@@ -33,8 +33,9 @@ export default {
// let logId; // let logId;
this.isLoading = true; this.isLoading = true;
if(this.$route.params.type === 'log') this.conformanceLogId = this.$route.params.fileId; 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; this.isLoading = false;
}, },

View File

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