From af97ec3a1d7b89a9c30e3e90391e80a0363b35f2 Mon Sep 17 00:00:00 2001 From: Vasily Malykhin Date: Wed, 31 Jul 2024 21:44:08 +0200 Subject: [PATCH] fix #1746: reuse contextual menu for all files --- .../filebrowser/components/ActionButton.vue | 149 +----------------- .../filebrowser/components/GirdView.vue | 11 +- .../filebrowser/components/ListView.vue | 5 +- main/src/mixins/mixin.js | 55 ------- 4 files changed, 8 insertions(+), 212 deletions(-) diff --git a/main/src/components/filebrowser/components/ActionButton.vue b/main/src/components/filebrowser/components/ActionButton.vue index 93256c1d..eed9184d 100644 --- a/main/src/components/filebrowser/components/ActionButton.vue +++ b/main/src/components/filebrowser/components/ActionButton.vue @@ -17,152 +17,15 @@ * @FilePath: /CasaOS-UI/src/components/filebrowser/components/ActionButton.vue --> - - \ No newline at end of file + \ No newline at end of file diff --git a/main/src/components/filebrowser/components/GirdView.vue b/main/src/components/filebrowser/components/GirdView.vue index 2901204c..1282cdf5 100644 --- a/main/src/components/filebrowser/components/GirdView.vue +++ b/main/src/components/filebrowser/components/GirdView.vue @@ -55,16 +55,7 @@ - - - + diff --git a/main/src/components/filebrowser/components/ListView.vue b/main/src/components/filebrowser/components/ListView.vue index d4de758c..924a9417 100644 --- a/main/src/components/filebrowser/components/ListView.vue +++ b/main/src/components/filebrowser/components/ListView.vue @@ -56,10 +56,7 @@ dateFmt }}
- - - +
diff --git a/main/src/mixins/mixin.js b/main/src/mixins/mixin.js index 2b8834f2..c5221ba2 100644 --- a/main/src/mixins/mixin.js +++ b/main/src/mixins/mixin.js @@ -162,10 +162,6 @@ export const mixin = { this.$refs.dropDown?.toggle() this.downloadFile(this.item) }, - playVideo(item, player) { - let url = player + this.getFileUrl(item) - window.open(url, '_self'); - }, // Get File Download URL getFileUrl(items) { @@ -227,22 +223,6 @@ export const mixin = { type: 'is-success' }) }, - /** - * @description: Download File - * @param {Object,Object} event item - * @return {void} - */ - clickItem(event, item) { - let bounced = event.target.getAttribute('class').includes('mdi-dots') - if (bounced) { - return false - } - if (item.is_dir) { - this.$emit('gotoFolder', item.path) - } else { - this.$emit('showDetailModal', item) - } - }, /** * @description: Open Context Menu * @param {Object,Object} event item @@ -399,36 +379,12 @@ export const mixin = { filters: { - /** - * @description: Format size output - * @param {int} value size value - * @return {String} - */ - renderBps(value) { - if (null == value || value == '' || value == 0) { - return "0 bps"; - } - const unitArr = ["bps", "Kbps", "Mbps", "Gbps", "TB", "PB", "EB", "ZB", "YB"]; - let index = 0, - srcsize = parseFloat(value); - index = Math.floor(Math.log(srcsize) / Math.log(1024)); - let size = srcsize / Math.pow(1024, index); - size = size.toFixed(2); - return size + unitArr[index]; - }, - renderSize, toFahrenheit: function (value) { return (32 + value * 1.8).toFixed(1); }, - - formatNum(number) { - return new Intl.NumberFormat().format(number) - }, - - getProgressType(per) { if (per >= 0 && per < 80) { return "is-primary" @@ -439,17 +395,6 @@ export const mixin = { } }, - - getTextType(per) { - if (per >= 0 && per < 80) { - return "has-text-success" - } else if (per >= 80 && per < 90) { - return "has-text-warning" - } else { - return "has-text-danger" - } - }, - dateFmt: function (value) { if (dayjs().isSame(value, 'year')) { return dayjs(value).format('DD/MM hh:mm')