Files: Filter files can enter Discover.
This commit is contained in:
@@ -83,7 +83,13 @@ export default defineStore('allMapDataStore', {
|
|||||||
async getAllMapData() {
|
async getAllMapData() {
|
||||||
let logId = this.logId;
|
let logId = this.logId;
|
||||||
let tempFilterId = this.tempFilterId;
|
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 {
|
try {
|
||||||
const response = await this.$axios.get(api);
|
const response = await this.$axios.get(api);
|
||||||
@@ -230,6 +236,7 @@ export default defineStore('allMapDataStore', {
|
|||||||
const response = await this.$axios.post(api, createFilterObj)
|
const response = await this.$axios.post(api, createFilterObj)
|
||||||
this.createFilterId = response.data.id;
|
this.createFilterId = response.data.id;
|
||||||
this.tempFilterId = null;
|
this.tempFilterId = null;
|
||||||
|
console.log('this.createFilterId', this.createFilterId);
|
||||||
}catch(error) {
|
}catch(error) {
|
||||||
this.httpStatus = error.request.status;
|
this.httpStatus = error.request.status;
|
||||||
await delay();
|
await delay();
|
||||||
|
|||||||
@@ -43,9 +43,7 @@ export default defineStore('filesStore', {
|
|||||||
allFiles: state => {
|
allFiles: state => {
|
||||||
let result = [
|
let result = [
|
||||||
...state.allEventLog,
|
...state.allEventLog,
|
||||||
...state.allFilter.map(itemFilter => {
|
...state.allFilter
|
||||||
return { ...itemFilter, parentLog: itemFilter.log.name }
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
let data = state.switchFilesTagData;
|
let data = state.switchFilesTagData;
|
||||||
let filesTag = state.filesTag;
|
let filesTag = state.filesTag;
|
||||||
@@ -101,6 +99,7 @@ export default defineStore('filesStore', {
|
|||||||
this.allFilter = response.data;
|
this.allFilter = response.data;
|
||||||
this.allFilter.map(o => {
|
this.allFilter.map(o => {
|
||||||
o.icon = 'tornado';
|
o.icon = 'tornado';
|
||||||
|
o.parentLog = o.log.name;
|
||||||
o.fileType = "Filter";
|
o.fileType = "Filter";
|
||||||
o.ownerName = o.owner.name;
|
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');
|
||||||
|
|||||||
@@ -72,7 +72,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import filesStore from '@/stores/files.js';
|
import filesStore from '@/stores/files.js';
|
||||||
|
import AllMapDataStore from '@/stores/allMapData.js';
|
||||||
import IconDataFormat from '@/components/icons/IconDataFormat.vue';
|
import IconDataFormat from '@/components/icons/IconDataFormat.vue';
|
||||||
import IconRule from '@/components/icons/IconRule.vue';
|
import IconRule from '@/components/icons/IconRule.vue';
|
||||||
import IconsFilter from '@/components/icons/IconsFilter.vue';
|
import IconsFilter from '@/components/icons/IconsFilter.vue';
|
||||||
@@ -85,15 +87,14 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
switchListOrGrid: false,
|
switchListOrGrid: false,
|
||||||
filesTag: 'all',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const store = filesStore();
|
const store = filesStore();
|
||||||
|
const allMapDataStore = AllMapDataStore();
|
||||||
|
const { createFilterId } = storeToRefs(allMapDataStore);
|
||||||
|
|
||||||
return {
|
return { store, allMapDataStore, createFilterId }
|
||||||
store,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
IconDataFormat,
|
IconDataFormat,
|
||||||
@@ -131,7 +132,13 @@
|
|||||||
* @param {object} file
|
* @param {object} file
|
||||||
*/
|
*/
|
||||||
enterDiscover(file){
|
enterDiscover(file){
|
||||||
this.$router.push({ name: 'Discover', params: { logId: file.id }});
|
let logId;
|
||||||
|
if(file.fileType === 'Log') logId = file.id;
|
||||||
|
else if(file.fileType === 'Filter') {
|
||||||
|
this.createFilterId = file.id;
|
||||||
|
logId = file.log.id;
|
||||||
|
}
|
||||||
|
this.$router.push({ name: 'Discover', params: { logId: logId }});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
Reference in New Issue
Block a user