@@ -61,11 +61,14 @@ export default {
if(!e) this.temporaryData[index] = 0;
else this.temporaryData[index] = rule;
},
- // header:Funnel 刪除全部的 Funnel
+ /**
+ * header:Funnel 刪除全部的 Funnel
+ */
deleteRule(index) {
if(index === 'all') {
this.temporaryData = [];
this.isRuleData = [];
+ this.ruleData = [];
this.$toast.success('All deleted.');
}else{
this.$toast.success(`Delete ${this.ruleData[index].label}.`);
@@ -74,7 +77,9 @@ export default {
this.ruleData.splice(index, 1);
}
},
- // header:Funnel 發送暫存的選取資料
+ /**
+ * header:Funnel 發送暫存的選取資料
+ */
async submitAll() {
this.postRuleData = this.temporaryData.filter(item => item !== 0); // 取得 submit 的資料,有 toggle button 的話,找出並刪除陣列中為 0 的項目
if(!this.postRuleData?.length) return this.$toast.error('Not selected');
diff --git a/src/components/Discover/SidebarFilter.vue b/src/components/Discover/SidebarFilter.vue
index a48680d..686dd46 100644
--- a/src/components/Discover/SidebarFilter.vue
+++ b/src/components/Discover/SidebarFilter.vue
@@ -439,7 +439,7 @@ export default {
}else {
this.temporaryData.push(...postData);
this.isRuleData.push(...postData);
- this.ruleData.push(this.setRule(...postData));
+ this.ruleData.push(...postData.map(e => this.setRule(e)))
}
this.reset(false);
this.isLoading = true;
diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue
index 4e89653..35e33ea 100644
--- a/src/components/Navbar.vue
+++ b/src/components/Navbar.vue
@@ -36,7 +36,7 @@
-
+
@@ -79,9 +79,9 @@ export default {
setup() {
const store = filesStore();
const allMapDataStore = AllMapDataStore();
- const { tempFilterId, createfilterId, filterName, postRuleData, isUpdataFilter } = storeToRefs(allMapDataStore);
+ const { logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter } = storeToRefs(allMapDataStore);
- return { store, allMapDataStore, tempFilterId, createfilterId, filterName, postRuleData, isUpdataFilter}
+ return { store, allMapDataStore, logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter}
},
components: {
IconSearch,
@@ -90,33 +90,36 @@ export default {
savedSuccessfully
},
mounted() {
- this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false;
- this.getNavViewName();
let filterId = this.$route.params.filterId;
this.createfilterId = filterId;
+ this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false;
+ this.getNavViewName();
},
methods: {
+ /**
+ * switch navbar item
+ */
switchNavItem(event) {
this.store.filesTag = event.target.innerText;
},
getNavViewName() {
this.navViewName = this.$route.name.toUpperCase();
- if(this.navViewName === 'DISCOVERLOG' || this.navViewName === 'DISCOVERFILTER'){
- this.navViewName = 'DISCOVER';
- }
+ if(this.navViewName === 'DISCOVERLOG' || this.navViewName === 'DISCOVERFILTER') this.navViewName = 'DISCOVER';
+
},
- showAlert() {
+ /**
+ * Save button' modal
+ */
+ async saveModal() {
// 先判斷有沒有 filter Id,有就儲存 return,沒有就往下走
// 沒有 filter Id, 有暫存 tempFilterId Id 可以另存新檔
- console.log(this.createfilterId);
- if(this.createfilterId) {
- this.allMapDataStore.updataFilter();
- console.log(this.isUpdataFilter);
- if(this.isUpdataFilter) savedSuccessfully(this.filterName);
- this.tempFilterId = false
- }else{
+ if(this.createFilterId) {
+ await this.allMapDataStore.updataFilter();
+ if(this.isUpdataFilter) await savedSuccessfully(this.filterName);
+ this.tempFilterId = null;
+ }else if(this.logId){
saveFilter(this.allMapDataStore.addFilterId);
- }
+ };
}
},
}
diff --git a/src/stores/allMapData.js b/src/stores/allMapData.js
index 8527750..71fbbb0 100644
--- a/src/stores/allMapData.js
+++ b/src/stores/allMapData.js
@@ -294,7 +294,7 @@ export default defineStore('allMapDataStore', {
try {
const response = await this.$axios.put(api, data);
- this.isUpdataFilter = response.data.is_modified;
+ this.isUpdataFilter = response.status === 200;
}catch(error) {
this.httpStatus = error.request.status;
await delay();
diff --git a/src/stores/files.js b/src/stores/files.js
index 3d48fe6..741290b 100644
--- a/src/stores/files.js
+++ b/src/stores/files.js
@@ -69,7 +69,7 @@ export default defineStore('filesStore', {
o.parentLog = "-";
o.fileType = "Log";
o.ownerName = o.owner.name;
- o.updated_at = moment(o.updated_at).utcOffset('+08:00').format('YYYY-MM-DD HH:MM');
+ o.updated_at = moment(o.updated_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm');
o.accessed_at = o.accessed_at ? moment(o.accessed_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm') : null;
return this.allEventLog
})
@@ -102,7 +102,7 @@ export default defineStore('filesStore', {
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');
+ o.updated_at = moment(o.updated_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm');
o.accessed_at = o.accessed_at ? moment(o.accessed_at).utcOffset('+08:00').format('YYYY-MM-DD HH:mm') : null;
});
if(this.httpStatus < 300) loading.isLoading = false;