Conformance Filter: fetch filter doning 50%.

This commit is contained in:
chiayin
2023-10-19 10:12:18 +08:00
parent 830f4d30a9
commit 06531d0acf
4 changed files with 64 additions and 31 deletions

View File

@@ -304,9 +304,9 @@ export default {
async openMore(no) { async openMore(no) {
// async await 解決非同步資料延遲傳遞導致未讀取到而出錯的問題 // async await 解決非同步資料延遲傳遞導致未讀取到而出錯的問題
this.issuesNo = no; this.issuesNo = no;
await this.conformanceStore.getLogConformanceIssue(no); await this.conformanceStore.getConformanceIssue(no);
this.traceId = await this.issueTraces[0].id; this.traceId = await this.issueTraces[0].id;
this.firstCases = await this.conformanceStore.getLogConformanceTraceDetail(no, this.issueTraces[0].id, 0); this.firstCases = await this.conformanceStore.getConformanceTraceDetail(no, this.issueTraces[0].id, 0);
this.issuesModal = await true; this.issuesModal = await true;
}, },
/** /**
@@ -316,9 +316,9 @@ export default {
async openLoopMore(no) { async openLoopMore(no) {
// async await 解決非同步資料延遲傳遞導致未讀取到而出錯的問題 // async await 解決非同步資料延遲傳遞導致未讀取到而出錯的問題
this.loopNo = no; this.loopNo = no;
await this.conformanceStore.getLogConformanceLoop(no); await this.conformanceStore.getConformanceLoop(no);
this.looptraceId = await this.loopTraces[0].id; this.looptraceId = await this.loopTraces[0].id;
this.loopFirstCases = await this.conformanceStore.getLogConformanceLoopsTraceDetail(no, this.loopTraces[0].id, 0); this.loopFirstCases = await this.conformanceStore.getConformanceLoopsTraceDetail(no, this.loopTraces[0].id, 0);
this.loopModal = await true; this.loopModal = await true;
}, },
/** /**

View File

@@ -907,8 +907,8 @@ export default {
this.isLoading = true; this.isLoading = true;
this.isSubmit = true; this.isSubmit = true;
this.isSubmitData = data; // 已 Apply 後,沒有重新改變規則的 Data this.isSubmitData = data; // 已 Apply 後,沒有重新改變規則的 Data
await this.conformanceStore.addLogConformanceTempCheckId(data); await this.conformanceStore.addConformanceCheckId(data);
await this.conformanceStore.getLogConformanceTempReport(); await this.conformanceStore.getConformanceReport();
this.isShowBar = false; this.isShowBar = false;
this.isLoading = false; this.isLoading = false;
// Results page Cover Plate // Results page Cover Plate

View File

@@ -182,8 +182,8 @@ export default {
this.startNum = 0; this.startNum = 0;
let result; let result;
if(this.category === 'issue') result = await this.conformanceStore.getLogConformanceTraceDetail(this.listNo, id, 0); if(this.category === 'issue') result = await this.conformanceStore.getConformanceTraceDetail(this.listNo, id, 0);
else if(this.category === 'loop') result = await this.conformanceStore.getLogConformanceLoopsTraceDetail(this.listNo, id, 0); else if(this.category === 'loop') result = await this.conformanceStore.getConformanceLoopsTraceDetail(this.listNo, id, 0);
this.infiniteData = await result; this.infiniteData = await result;
}, },
/** /**
@@ -248,7 +248,7 @@ export default {
try { try {
this.loading = true; this.loading = true;
this.startNum += 20 this.startNum += 20
const result = await this.conformanceStore.getLogConformanceTraceDetail(this.listNo, this.showTraceId, this.startNum); const result = await this.conformanceStore.getConformanceTraceDetail(this.listNo, this.showTraceId, this.startNum);
this.infiniteData = [...this.infiniteData, ...result]; this.infiniteData = [...this.infiniteData, ...result];
} catch(error) { } catch(error) {
// console.error('Failed to load data:', error); // console.error('Failed to load data:', error);

View File

@@ -9,6 +9,7 @@ export default defineStore('conformanceStore', {
conformanceLogId: null, // log 檔 conformanceLogId: null, // log 檔
conformanceFilterId: null, // filter 檔 conformanceFilterId: null, // filter 檔
conformanceLogTempCheckId: null, // log 檔存檔前的 check Id conformanceLogTempCheckId: null, // log 檔存檔前的 check Id
conformanceFilterTempCheckId: null, // Filter 檔存檔前的 check Id
allConformanceTask: [], allConformanceTask: [],
allCfmSeqStart: [], allCfmSeqStart: [],
allCfmSeqEnd: [], allCfmSeqEnd: [],
@@ -178,13 +179,14 @@ export default defineStore('conformanceStore', {
* fetch Log Conformance Parameters api for Rule Settings. * fetch Log Conformance Parameters api for Rule Settings.
*/ */
async getConformanceParams() { async getConformanceParams() {
let logId = this.conformanceLogId; const logId = this.conformanceLogId;
let filterId = this.conformanceFilterId; const filterId = this.conformanceFilterId;
let api = ''; let api = '';
// 先判斷 filter 檔,再判斷 log 檔。 // 先判斷 filter 檔,再判斷 log 檔。
if(filterId !== null) api = `/api/filter-checks/params?filter_id=${filterId}`; if(filterId !== null) api = `/api/filter-checks/params?filter_id=${filterId}`;
else api = `/api/log-checks/params?log_id=${logId}`; else api = `/api/log-checks/params?log_id=${logId}`;
console.log('getConformanceParams', api);
try { try {
const response = await this.$axios.get(api); const response = await this.$axios.get(api);
@@ -201,23 +203,34 @@ export default defineStore('conformanceStore', {
/** /**
* Creates a new temporary check for a log. * Creates a new temporary check for a log.
*/ */
async addLogConformanceTempCheckId(data) { async addConformanceCheckId(data) {
let logId = this.conformanceLogId; const logId = this.conformanceLogId;
const api = `/api/temp-log-checks?log_id=${logId}`; const filterId = this.conformanceFilterId;
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterId !== null) api = `/api/temp-filter-checks?filter_id=${filterId}`;
else api = `/api/temp-log-checks?log_id=${logId}`;
try { try {
const response = await this.$axios.post(api, data); const response = await this.$axios.post(api, data);
this.conformanceLogTempCheckId = response.data.id; if(filterId !== null) this.conformanceFilterTempCheckId = response.data.id;
else 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 file.');
} }
}, },
/** /**
* Get the Temporary Log Conformance Report * Get the Temporary Log Conformance Report
*/ */
async getLogConformanceTempReport() { async getConformanceReport() {
let checkId = this.conformanceLogTempCheckId; const logTempCheckId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}`; const filterTempCheckId = this.conformanceFilterTempCheckId;
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterTempCheckId !== null) api = `/api/temp-filter-checks/${filterTempCheckId}`;
else api = `/api/temp-log-checks/${logTempCheckId}`;
try { try {
const response = await this.$axios.get(api); const response = await this.$axios.get(api);
@@ -229,9 +242,14 @@ 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 getConformanceIssue(issueNo) {
let checkId = this.conformanceLogTempCheckId; const logTempCheckId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}/issues/${issueNo}`; const filterTempCheckId = this.conformanceFilterTempCheckId
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterTempCheckId !== null) api = `/api/temp-filter-checks/${filterTempCheckId}/issues/${issueNo}`;
else api = `/api/temp-log-checks/${logTempCheckId}/issues/${issueNo}`;
try { try {
const response = await this.$axios.get(api); const response = await this.$axios.get(api);
@@ -243,9 +261,14 @@ 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 getConformanceTraceDetail(issueNo, traceId, start) {
let checkId = this.conformanceLogTempCheckId; const logTempCheckId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}/issues/${issueNo}/traces/${traceId}?start=${start}&page_size=20`; const filterTempCheckId = this.conformanceFilterTempCheckId
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterTempCheckId !== null) api = `/api/temp-filter-checks/${filterTempCheckId}/issues/${issueNo}/traces/${traceId}?start=${start}&page_size=20`;
else api = `/api/temp-log-checks/${logTempCheckId}/issues/${issueNo}/traces/${traceId}?start=${start}&page_size=20`;
try { try {
const response = await this.$axios.get(api); const response = await this.$axios.get(api);
@@ -260,9 +283,14 @@ 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 getConformanceLoop(loopNo) {
let checkId = this.conformanceLogTempCheckId; const logTempCheckId = this.conformanceLogTempCheckId;
let api = `/api/temp-log-checks/${checkId}/loops/${loopNo}`; const filterTempCheckId = this.conformanceFilterTempCheckId
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterTempCheckId !== null) api = `/api/temp-filter-checks/${filterTempCheckId}/loops/${loopNo}`;
else api = `/api/temp-log-checks/${logTempCheckId}/loops/${loopNo}`;
try { try {
const response = await this.$axios.get(api); const response = await this.$axios.get(api);
@@ -274,9 +302,14 @@ 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 getConformanceLoopsTraceDetail(loopNo, traceId, start) {
let checkId = this.conformanceLogTempCheckId; const logTempCheckId = this.conformanceLogTempCheckId;
const api = `/api/temp-log-checks/${checkId}/loops/${loopNo}/traces/${traceId}?start=${start}&page_size=20`; const filterTempCheckId = this.conformanceFilterTempCheckId
let api = '';
// 先判斷 filter 檔,再判斷 log 檔。
if(filterTempCheckId !== null) api = `/api/temp-filter-checks/${filterTempCheckId}/loops/${loopNo}/traces/${traceId}?start=${start}&page_size=20`;
else api = `/api/temp-log-checks/${logTempCheckId}/loops/${loopNo}/traces/${traceId}?start=${start}&page_size=20`;
try { try {
const response = await this.$axios.get(api); const response = await this.$axios.get(api);