From ec7f5b787b219cbf233910c305790d9bfc1158e7 Mon Sep 17 00:00:00 2001 From: CzBiX Date: Sat, 13 Apr 2019 00:59:57 +0800 Subject: [PATCH] Add logs dialog --- src/Api.ts | 4 ++ src/App.vue | 8 +++- src/components/Drawer.vue | 37 ++++++++------- src/components/LogsDialog.vue | 87 +++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 18 deletions(-) create mode 100644 src/components/LogsDialog.vue diff --git a/src/Api.ts b/src/Api.ts index 6926ebf..d2b719d 100644 --- a/src/Api.ts +++ b/src/Api.ts @@ -62,6 +62,10 @@ class Api { return this.axios.post('/app/setPreferences', data); } + public getLogs() { + return this.axios.get('/log/main').then(this.handleResponse); + } + private handleResponse(resp: AxiosResponse) { return resp.data; } diff --git a/src/App.vue b/src/App.vue index 6c420f7..2f9a742 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,7 +5,7 @@ :clipped="$vuetify.breakpoint.lgAndUp" v-model="drawer" > - + + - + {{ item.icon }} @@ -66,16 +66,6 @@ - - - mdi-history - - - - Switch to old UI - - - @@ -92,6 +82,10 @@ export default { FilterGroup, }, + props: { + value: Object, + }, + data() { return { filter: { @@ -99,8 +93,7 @@ export default { category: null, site: null, }, - basicItems: [ - { icon: 'mdi-settings', text: 'Settings' }, + basicItems: null, // { // 'icon': 'mdi-menu-up', // 'icon-alt': 'mdi-menu-down', @@ -118,13 +111,20 @@ export default { // { icon: 'mdi-alert', text: 'Errored' }, // ], // }, - ], - endItems: [ - { icon: 'mdi-help', text: 'Help' }, - ], + endItems: null, }; }, + created() { + this.basicItems = [ + { icon: 'mdi-settings', text: 'Settings', click: () => alert('TODO') }, + ]; + this.endItems = [ + { icon: 'mdi-delta', text: 'Logs', click: () => this.updateOptions('showLogs', true) }, + { icon: 'mdi-history', text: 'Switch to old UI', click: this.switchUi }, + ]; + }, + computed: { ...mapGetters([ 'isDataReady', @@ -184,6 +184,9 @@ export default { location.reload(true); }, + updateOptions(key: string, value: any) { + this.$emit('input', Object.assign({}, this.value, {[key]: value})); + }, }, watch: { diff --git a/src/components/LogsDialog.vue b/src/components/LogsDialog.vue new file mode 100644 index 0000000..c06fdf6 --- /dev/null +++ b/src/components/LogsDialog.vue @@ -0,0 +1,87 @@ + + + + +