Issue #165: Done.

This commit is contained in:
chiayin
2023-10-11 18:50:46 +08:00
parent 6e0d5b15fe
commit 1cfbddf510
6 changed files with 137 additions and 50 deletions

View File

@@ -38,6 +38,8 @@ export default defineStore('allMapDataStore', {
allFunnelData: [],
isUpdataFilter: false, // 是否成功儲存 Filter 檔
selectTimeFrame: [], // user select time start and end
infinite404: null, // 無限滾動式是否到底要換頁
infiniteStart: 0, // 無限滾動 case 開始的數字
}),
getters: {
processMap: state => {
@@ -58,6 +60,9 @@ export default defineStore('allMapDataStore', {
cases: state => {
return state.allCase;
},
infiniteFirstCases: state => {
if(state.infiniteStart === 0) return state.allCase;
},
traceTaskSeq: state => {
return state.allTraceTaskSeq;
},
@@ -153,12 +158,14 @@ export default defineStore('allMapDataStore', {
let traceId = this.traceId;
let tempFilterId = this.tempFilterId;
let createfilterId = this.createFilterId;
let start = this.infiniteStart;
let api = '';
// 先判斷暫存 再判斷 filter 最後 log
if(tempFilterId != null) api = `/api/temp-filters/${tempFilterId}/traces/${traceId}`;
else if(createfilterId!= null) api = `/api/filters/${createfilterId}/traces/${traceId}`;
else api = `/api/logs/${logId}/traces/${traceId}`;
if(tempFilterId != null) api = `/api/temp-filters/${tempFilterId}/traces/${traceId}?start=${start}&page_size=20`;
else if(createfilterId!= null) api = `/api/filters/${createfilterId}/traces/${traceId}?start=${start}&page_size=20`;
else api = `/api/logs/${logId}/traces/${traceId}?start=${start}&page_size=20`;
try {
const response = await this.$axios.get(api);
@@ -169,16 +176,20 @@ export default defineStore('allMapDataStore', {
c.completed_at = moment(c.completed_at).format('YYYY-MM-DD HH:MM');
return this.allCase;
});
return this.allCase;
// if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
this.httpStatus = error.request.status;
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to load the Trace Detail.',{position: 'bottom'});
if(error.response.status === 404) this.infinite404 = 404;
else {
this.httpStatus = error.request.status;
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to load the Trace Detail.',{position: 'bottom'});
}
};
},
/**