Discover: Filters Save done.
This commit is contained in:
@@ -16,6 +16,7 @@ export default defineStore('allMapDataStore', {
|
||||
traceId: 1,
|
||||
tempFilterId: null,
|
||||
createFilterId: null,
|
||||
filterName: null,
|
||||
allProcessMap: {},
|
||||
allBpmn: {},
|
||||
allStats: {},
|
||||
@@ -35,6 +36,7 @@ export default defineStore('allMapDataStore', {
|
||||
ruleData: [], // Funnle view's data
|
||||
isRuleData: [], // toggle button data
|
||||
allFunnelData: [],
|
||||
isUpdataFilter: false, // 是否成功儲存 Filter 檔
|
||||
}),
|
||||
getters: {
|
||||
processMap: state => {
|
||||
@@ -190,6 +192,9 @@ export default defineStore('allMapDataStore', {
|
||||
$toast.default('Failed to load the Filter Parameters.',{position: 'bottom'});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Test if the Filter Rules Result in Any Data
|
||||
*/
|
||||
async checkHasResult() {
|
||||
let logId = this.logId;
|
||||
const api = `/api/filters/has-result?log_id=${logId}`;
|
||||
@@ -209,6 +214,9 @@ export default defineStore('allMapDataStore', {
|
||||
$toast.default('Failed to load the Has Result.',{position: 'bottom'});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Add a New Temporary Filter
|
||||
*/
|
||||
async addTempFilterId() {
|
||||
let logId = this.logId;
|
||||
const api = `/api/temp-filters?log_id=${logId}`;
|
||||
@@ -228,6 +236,9 @@ export default defineStore('allMapDataStore', {
|
||||
$toast.default('Failed to add the Temporary Filters.',{position: 'bottom'});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Add a New Filter
|
||||
*/
|
||||
async addFilterId(value) {
|
||||
let logId = this.logId;
|
||||
const api = `/api/filters?log_id=${logId}`;
|
||||
@@ -251,7 +262,7 @@ export default defineStore('allMapDataStore', {
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Fetch event logs api
|
||||
* Get Filter Detail
|
||||
*/
|
||||
async fetchFunnel(createfilterId) {
|
||||
const api = `/api/filters/${createfilterId}`;
|
||||
@@ -260,6 +271,8 @@ export default defineStore('allMapDataStore', {
|
||||
try {
|
||||
const response = await this.$axios.get(api);
|
||||
this.temporaryData = response.data.rules;
|
||||
this.logId = response.data.log.id;
|
||||
this.filterName = response.data.name;
|
||||
}catch(error) {
|
||||
this.httpStatus = error.request.status;
|
||||
await delay();
|
||||
@@ -267,9 +280,30 @@ export default defineStore('allMapDataStore', {
|
||||
await delay(1000);
|
||||
loading.isLoading = false;
|
||||
await delay(500);
|
||||
$toast.default('Failed to load the Filters.',{position: 'bottom'});
|
||||
$toast.default('Failed to get Filter Detail.',{position: 'bottom'});
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Updata an Existing Filter
|
||||
*/
|
||||
async updataFilter() {
|
||||
let createFilterId = this.createFilterId
|
||||
const api = `/api/filters/${createFilterId}`;
|
||||
const data = this.postRuleData;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.put(api, data);
|
||||
this.isUpdataFilter = response.data.is_modified;
|
||||
}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 updata an Existing Filter.',{position: 'bottom'});
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user