From b73449f9ea8895ada3ca1638a53cf98fa0e6dc79 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Sat, 2 Sep 2023 19:19:14 -0500 Subject: [PATCH] Refactor usages for prettyBytes --- assets/vue/main.js | 6 ------ assets/vue/views/documents/DocumentForHtmlEditor.vue | 4 +++- assets/vue/views/documents/DocumentsList.vue | 3 ++- assets/vue/views/documents/ListQuasar.vue | 4 +++- assets/vue/views/personalfile/List.vue | 4 +++- assets/vue/views/personalfile/Shared.vue | 4 +++- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/assets/vue/main.js b/assets/vue/main.js index 269a47dccf..2fb69fde98 100644 --- a/assets/vue/main.js +++ b/assets/vue/main.js @@ -215,12 +215,6 @@ app.component("TinyEditor", Editor) app.config.globalProperties.axios = axios app.config.globalProperties.window = window -const prettyBytes = require("pretty-bytes") - -app.config.globalProperties.$filters = { - prettyBytes, -} - window.Alpine = Alpine Alpine.start() diff --git a/assets/vue/views/documents/DocumentForHtmlEditor.vue b/assets/vue/views/documents/DocumentForHtmlEditor.vue index a536ae4a83..822a15a8e6 100644 --- a/assets/vue/views/documents/DocumentForHtmlEditor.vue +++ b/assets/vue/views/documents/DocumentForHtmlEditor.vue @@ -84,7 +84,7 @@ @@ -157,6 +157,7 @@ import DocumentsFilterForm from "../../components/documents/Filter" import { RESOURCE_LINK_PUBLISHED } from "../../components/resource_links/visibility" import { useI18n } from "vue-i18n" import { useFormatDate } from "../../composables/formatDate" +import prettyBytes from "pretty-bytes" export default { name: "DocumentForHtmlEditor", @@ -196,6 +197,7 @@ export default { filters: {}, submitted: false, relativeDatetime, + prettyBytes, } return data diff --git a/assets/vue/views/documents/DocumentsList.vue b/assets/vue/views/documents/DocumentsList.vue index a686fc6025..b39ca7b3c2 100644 --- a/assets/vue/views/documents/DocumentsList.vue +++ b/assets/vue/views/documents/DocumentsList.vue @@ -112,7 +112,7 @@ @@ -305,6 +305,7 @@ import BaseChart from "../../components/basecomponents/BaseChart.vue" import DocumentAudioRecorder from "../../components/documents/DocumentAudioRecorder.vue" import { useNotification } from "../../composables/notification" import { useSecurityStore } from "../../store/securityStore" +import prettyBytes from "pretty-bytes" const store = useStore() const route = useRoute() diff --git a/assets/vue/views/documents/ListQuasar.vue b/assets/vue/views/documents/ListQuasar.vue index 2cdbe4c1fc..eeb3189d62 100644 --- a/assets/vue/views/documents/ListQuasar.vue +++ b/assets/vue/views/documents/ListQuasar.vue @@ -61,7 +61,7 @@ auto-width > - {{ $filters.prettyBytes(props.row.resourceNode.resourceFile.size) }} + {{ prettyBytes(props.row.resourceNode.resourceFile.size) }} @@ -89,6 +89,7 @@ import Toolbar from "../../components/Toolbar.vue" import ResourceIcon from "../../components/documents/ResourceIcon.vue" import { useRoute } from "vue-router" import moment from "moment" +import prettyBytes from "pretty-bytes" /*const servicePrefix = 'documents'; const { getters, actions } = list(servicePrefix);*/ @@ -120,6 +121,7 @@ export default { selected: [], selectMode: "multi", isBusy: false, + prettyBytes, } }, created() { diff --git a/assets/vue/views/personalfile/List.vue b/assets/vue/views/personalfile/List.vue index 475d59da1e..29f4867334 100644 --- a/assets/vue/views/personalfile/List.vue +++ b/assets/vue/views/personalfile/List.vue @@ -87,7 +87,7 @@ @@ -261,6 +261,7 @@ import isEmpty from "lodash/isEmpty" import { RESOURCE_LINK_PUBLISHED } from "../../components/resource_links/visibility" import { useI18n } from "vue-i18n" import { useFormatDate } from "../../composables/formatDate" +import prettyBytes from "pretty-bytes" export default { name: "PersonalFileList", @@ -316,6 +317,7 @@ export default { item: {}, filters: { shared: 0, loadNode: 1 }, submitted: false, + prettyBytes, relativeDatetime } diff --git a/assets/vue/views/personalfile/Shared.vue b/assets/vue/views/personalfile/Shared.vue index cc24f3d775..4412c2fe43 100644 --- a/assets/vue/views/personalfile/Shared.vue +++ b/assets/vue/views/personalfile/Shared.vue @@ -49,7 +49,7 @@ @@ -88,6 +88,7 @@ import ResourceFileLink from "../../components/documents/ResourceFileLink.vue" import DataFilter from "../../components/DataFilter" import isEmpty from "lodash/isEmpty" import { useFormatDate } from "../../composables/formatDate" +import prettyBytes from "pretty-bytes" export default { name: "PersonalFileShared", @@ -124,6 +125,7 @@ export default { filters: { shared: 1, loadNode: 0 }, submitted: false, relativeDatetime, + prettyBytes, } }, created() {