From 92be4504ccb8f6d918013e5c33870858cd22376a Mon Sep 17 00:00:00 2001 From: Zephyrrus Date: Sat, 4 Jul 2020 03:26:35 +0300 Subject: feat: refactor most of the album components to use store for presentation and actions --- src/site/pages/dashboard/admin/file/_id.vue | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/site/pages/dashboard/admin/file') diff --git a/src/site/pages/dashboard/admin/file/_id.vue b/src/site/pages/dashboard/admin/file/_id.vue index 5821292..5853770 100644 --- a/src/site/pages/dashboard/admin/file/_id.vue +++ b/src/site/pages/dashboard/admin/file/_id.vue @@ -130,6 +130,7 @@ export default { methods: { promptDisableUser() { this.$buefy.dialog.confirm({ + type: 'is-danger', message: 'Are you sure you want to disable the account of the user that uploaded this file?', onConfirm: () => this.disableUser() }); @@ -142,6 +143,7 @@ export default { }, promptBanIP() { this.$buefy.dialog.confirm({ + type: 'is-danger', message: 'Are you sure you want to ban the IP this file was uploaded from?', onConfirm: () => this.banIP() }); -- cgit v1.2.3 From ad852de51a0d2dd5d29c08838d5a430c58849e74 Mon Sep 17 00:00:00 2001 From: Zephyrrus Date: Wed, 8 Jul 2020 04:00:12 +0300 Subject: chore: linter the entire project using the new rules --- src/site/pages/dashboard/admin/file/_id.vue | 82 ++++++++++++++++++----------- 1 file changed, 52 insertions(+), 30 deletions(-) (limited to 'src/site/pages/dashboard/admin/file') diff --git a/src/site/pages/dashboard/admin/file/_id.vue b/src/site/pages/dashboard/admin/file/_id.vue index 5853770..34fcd01 100644 --- a/src/site/pages/dashboard/admin/file/_id.vue +++ b/src/site/pages/dashboard/admin/file/_id.vue @@ -9,74 +9,90 @@
-

File details

+

+ File details +


- {{ file.id }} - {{ file.name }} - {{ file.original }} - {{ file.ip }} - - {{ file.url }} - {{ formatBytes(file.size) }} - {{ file.hash }} -
- {{ user.id }} - {{ user.username }} - {{ user.enabled }} - - {{ user.fileCount }} @@ -86,10 +102,16 @@
- - + +
@@ -102,14 +124,14 @@ import Sidebar from '~/components/sidebar/Sidebar.vue'; export default { components: { - Sidebar + Sidebar, }, middleware: ['auth', 'admin'], data() { return { options: {}, file: null, - user: null + user: null, }; }, async asyncData({ $axios, route }) { @@ -117,13 +139,13 @@ export default { const response = await $axios.$get(`file/${route.params.id}`); return { file: response.file ? response.file : null, - user: response.user ? response.user : null + user: response.user ? response.user : null, }; } catch (error) { console.error(error); return { file: null, - user: null + user: null, }; } }, @@ -132,12 +154,12 @@ export default { this.$buefy.dialog.confirm({ type: 'is-danger', message: 'Are you sure you want to disable the account of the user that uploaded this file?', - onConfirm: () => this.disableUser() + onConfirm: () => this.disableUser(), }); }, async disableUser() { const response = await this.$axios.$post('admin/users/disable', { - id: this.user.id + id: this.user.id, }); this.$buefy.toast.open(response.message); }, @@ -145,12 +167,12 @@ export default { this.$buefy.dialog.confirm({ type: 'is-danger', message: 'Are you sure you want to ban the IP this file was uploaded from?', - onConfirm: () => this.banIP() + onConfirm: () => this.banIP(), }); }, async banIP() { const response = await this.$axios.$post('admin/ban/ip', { - ip: this.file.ip + ip: this.file.ip, }); this.$buefy.toast.open(response.message); }, @@ -163,8 +185,8 @@ export default { const i = Math.floor(Math.log(bytes) / Math.log(k)); - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; - } - } + return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`; + }, + }, }; -- cgit v1.2.3 From 0f66d807035d3e32a66c7dc9bf55fb3be99aedac Mon Sep 17 00:00:00 2001 From: Zephyrrus Date: Fri, 10 Jul 2020 01:13:51 +0300 Subject: refactor: finish refactoring all the components to use vuex --- src/site/pages/dashboard/admin/file/_id.vue | 85 ++++++++++++----------------- 1 file changed, 34 insertions(+), 51 deletions(-) (limited to 'src/site/pages/dashboard/admin/file') diff --git a/src/site/pages/dashboard/admin/file/_id.vue b/src/site/pages/dashboard/admin/file/_id.vue index 34fcd01..89afa47 100644 --- a/src/site/pages/dashboard/admin/file/_id.vue +++ b/src/site/pages/dashboard/admin/file/_id.vue @@ -19,99 +19,101 @@ - {{ file.id }} + {{ admin.file.id }} - {{ file.name }} + {{ admin.file.name }} - {{ file.original }} + {{ admin.file.original }} - {{ file.ip }} + {{ admin.file.ip }} {{ file.url }} + :href="admin.file.url" + target="_blank">{{ admin.file.url }} - {{ formatBytes(file.size) }} + {{ formatBytes(admin.file.size) }} - {{ file.hash }} + {{ admin.file.hash }} - +
- {{ user.id }} + {{ admin.user.id }} - {{ user.username }} + {{ admin.user.username }} - {{ user.enabled }} + {{ admin.user.enabled }} - + - {{ user.fileCount }} + {{ admin.user.fileCount }}
- - +
@@ -120,35 +122,22 @@