Files: Filter files can enter Discover.

This commit is contained in:
chiayin
2023-04-28 11:29:21 +08:00
parent e142787832
commit bf63d0aca4
3 changed files with 22 additions and 9 deletions

View File

@@ -83,7 +83,13 @@ export default defineStore('allMapDataStore', {
async getAllMapData() {
let logId = this.logId;
let tempFilterId = this.tempFilterId;
let api = tempFilterId != null ? `/api/temp-filters/${tempFilterId}/discover` : `/api/logs/${logId}/discover`;
let filterId = this.createFilterId
let api = '';
// 先判斷暫存 再判斷 filter 最後 log
if(tempFilterId != null) api = `/api/temp-filters/${tempFilterId}/discover`;
else if(filterId!= null) api = `/api/filters/${filterId}/discover`;
else api = `/api/logs/${logId}/discover`;
try {
const response = await this.$axios.get(api);
@@ -230,6 +236,7 @@ export default defineStore('allMapDataStore', {
const response = await this.$axios.post(api, createFilterObj)
this.createFilterId = response.data.id;
this.tempFilterId = null;
console.log('this.createFilterId', this.createFilterId);
}catch(error) {
this.httpStatus = error.request.status;
await delay();

View File

@@ -43,9 +43,7 @@ export default defineStore('filesStore', {
allFiles: state => {
let result = [
...state.allEventLog,
...state.allFilter.map(itemFilter => {
return { ...itemFilter, parentLog: itemFilter.log.name }
})
...state.allFilter
];
let data = state.switchFilesTagData;
let filesTag = state.filesTag;
@@ -101,6 +99,7 @@ export default defineStore('filesStore', {
this.allFilter = response.data;
this.allFilter.map(o => {
o.icon = 'tornado';
o.parentLog = o.log.name;
o.fileType = "Filter";
o.ownerName = o.owner.name;
o.updated_at = moment(o.updated_at).utcOffset('+08:00').format('YYYY-MM-DD HH:MM');