Discover: sidebarFilter Funnel button ApplyAll done.

This commit is contained in:
chiayin
2023-04-19 16:18:20 +08:00
parent 8f68e47c25
commit 3d5dba4c42
6 changed files with 119 additions and 81 deletions

View File

@@ -28,6 +28,8 @@ export default defineStore('allMapDataStore', {
allFilterTimeframe: {},
allFilterTrace: [],
httpStatus: 200,
hasResultRule: null, // click Apply 後檢查是否有 Data
postRuleData: [],
}),
getters: {
processMap: state => {
@@ -78,7 +80,7 @@ export default defineStore('allMapDataStore', {
let logId = this.logId;
let tempFilterId = this.tempFilterId;
let api = tempFilterId !== null ? `/api/temp-filters/${tempFilterId}/discover` : `/api/logs/${logId}/discover`;
// console.log(tempFilterId);
console.log(tempFilterId);
// console.log(logId);
// const api = `/api/logs/${logId}/discover`;
@@ -89,18 +91,15 @@ export default defineStore('allMapDataStore', {
this.allStats = response.data.stats;
this.allInsights = response.data.insights;
if(this.httpStatus < 300) loading.isLoading = false;
// if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
this.httpStatus = error.request.status;
delay().then(() =>{
loading.isLoading = true;
return delay(1000);
}).then(()=>{
loading.isLoading = false;
return delay(500);
}).then(() => {
$toast.default('Failed to load the Map.');
})
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to load the Map.',{position: 'bottom'});
};
},
/**
@@ -114,18 +113,15 @@ export default defineStore('allMapDataStore', {
const response = await this.$axios.get(api);
this.allTrace = response.data;
if(this.httpStatus < 300) loading.isLoading = false;
// if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
this.httpStatus = error.request.status;
delay().then(() =>{
loading.isLoading = true;
return delay(1000);
}).then(()=>{
loading.isLoading = false;
return delay(500);
}).then(() => {
$toast.default('Failed to load the Trace.');
})
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to load the Trace.',{position: 'bottom'});
}
},
/**
@@ -146,18 +142,15 @@ export default defineStore('allMapDataStore', {
return this.allCase;
});
if(this.httpStatus < 300) loading.isLoading = false;
// if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
this.httpStatus = error.request.status;
delay().then(() =>{
loading.isLoading = true;
return delay(1000);
}).then(()=>{
loading.isLoading = false;
return delay(500);
}).then(() => {
$toast.default('Failed to load the Trace Detail.');
});
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to load the Trace Detail.',{position: 'bottom'});
};
},
/**
@@ -175,19 +168,54 @@ export default defineStore('allMapDataStore', {
this.allFilterTimeframe = response.data.timeframe;
this.allFilterTrace = response.data.trace;
if(this.httpStatus < 300) loading.isLoading = false;
// if(this.httpStatus < 300) loading.isLoading = false;
} catch(error) {
this.httpStatus = error.request.status;
delay().then(() =>{
loading.isLoading = true;
return delay(1000);
}).then(()=>{
loading.isLoading = false;
return delay(500);
}).then(() => {
$toast.default('Failed to load the Filter Parameters.');
});
await delay();
loading.isLoading = true;
await delay(1000);
loading.isLoading = false;
await delay(500);
$toast.default('Failed to load the Filter Parameters.',{position: 'bottom'});
};
},
async checkHasResult() {
let logId = this.logId;
const api = `/api/filters/has-result?log_id=${logId}`;
try {
const response = await this.$axios.post(api, this.postRuleData)
this.hasResultRule = response.data.result;
// 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 Has Result.',{position: 'bottom'});
};
},
async addTempFilterId() {
let logId = this.logId;
const api = `/api/temp-filters?log_id=${logId}`;
try {
const response = await this.$axios.post(api, this.postRuleData)
this.tempFilterId = response.data.id;
// 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 add the Temporary Filters.',{position: 'bottom'});
};
}
},
})

View File

@@ -84,7 +84,7 @@ export default defineStore('filesStore', {
loading.isLoading = false;
return delay(500);
}).then(() => {
$toast.default('Failed to load the logs.');
$toast.default('Failed to load the logs.',{position: 'bottom'});
})
};
},
@@ -114,7 +114,7 @@ export default defineStore('filesStore', {
loading.isLoading = false;
return delay(500);
}).then(() => {
$toast.default('Failed to load the filters.');
$toast.default('Failed to load the filters.',{position: 'bottom'});
})
};
},