From 03321921c8140d36144ae0350b9c624e11a365b3 Mon Sep 17 00:00:00 2001 From: chiayin Date: Mon, 13 Feb 2023 17:10:57 +0800 Subject: [PATCH] Get allFiles and switch files tag, done. --- src/components/Navbar.vue | 23 +++++++++++---- src/components/icons/IconGrid.vue | 4 +-- src/components/icons/IconList.vue | 4 +-- src/views/Files/index.vue | 49 +++++++++++++++++++++---------- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index 4b647de..f5c8a9a 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -4,11 +4,11 @@

FILES

-
    -
  • ALL
  • -
  • DISCOVER
  • -
  • COMPARE
  • -
  • DESIGN
  • +
      +
    • ALL
    • +
    • DISCOVER
    • +
    • COMPARE
    • +
    • DESIGN
@@ -42,6 +42,14 @@ export default { data() { return { showNavbarBreadcrumb: false, + // 之後優化要模組化 + // viewType:[ + // { + // typeName: '', + // typeCategory: [], + // } + // ] + viewType: '' }; }, components: { @@ -51,6 +59,11 @@ export default { mounted() { this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false; }, + methods: { + changeViewType(type) { + this.viewType = type; + } + } } diff --git a/src/components/icons/IconGrid.vue b/src/components/icons/IconGrid.vue index 44eddda..39e5a6d 100644 --- a/src/components/icons/IconGrid.vue +++ b/src/components/icons/IconGrid.vue @@ -1,5 +1,5 @@ diff --git a/src/components/icons/IconList.vue b/src/components/icons/IconList.vue index 22ab357..19bdea7 100644 --- a/src/components/icons/IconList.vue +++ b/src/components/icons/IconList.vue @@ -1,5 +1,5 @@ diff --git a/src/views/Files/index.vue b/src/views/Files/index.vue index f9f62bd..b259dee 100644 --- a/src/views/Files/index.vue +++ b/src/views/Files/index.vue @@ -28,18 +28,18 @@
-

All Files

+

All Files

    -
  • - +
  • +
  • -
  • - +
  • +
-
+
@@ -88,26 +88,27 @@
- +
@@ -136,6 +137,14 @@ fileType: '', } ], + switchListOrGrid: false, + switchFilesTagData: { + all: ['Log', 'Filter', 'Rule', 'Design'], + discover: ['Log', 'Filter', 'Rule'], + compare: ['Filter'], + design: ['Log', 'Design'], + }, + filesTag: 'all', } }, setup() {}, @@ -149,19 +158,27 @@ IconGrid }, computed: { + /** + * Get allFiles and switch files tag + */ allFiles: function() { - return [ + let result = [ ...this.allEventLog, ...this.allFilter.map(itemFilter => { return { ...itemFilter, parentLog: itemFilter.log.name } }) - ] - }, + ]; + let data = this.switchFilesTagData; + let filesTag = this.filesTag; + + result = result.filter(file => data[filesTag].includes(file.fileType)); + return result; + }, // 時間排序,如果沒有 accessed_at 就不加入 data recentlyUsedFiles: function() { let recentlyUsedFiles = this.allFiles.filter(item => item.accessed_at !== null); return recentlyUsedFiles.sort((n, o) => o - n); - } + }, }, methods: { /**