From 84992cf407b1fe772025ddb6010757970b20fbc3 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Wed, 29 Jan 2025 00:10:54 +0100 Subject: [PATCH] Fix: show Sidebar toggle in Results view and cleanup unused code Signed-off-by: Christian Hartmann --- src/Forms.vue | 9 +++++---- src/components/TopBar.vue | 16 ---------------- src/mixins/ViewsMixin.js | 4 ---- src/router.js | 4 ---- src/views/Results.vue | 26 +++++++++----------------- 5 files changed, 14 insertions(+), 45 deletions(-) diff --git a/src/Forms.vue b/src/Forms.vue index ef7b109ad..ec98b713d 100644 --- a/src/Forms.vue +++ b/src/Forms.vue @@ -122,12 +122,11 @@ :form.sync="selectedForm" :sidebar-opened.sync="sidebarOpened" @open-sharing="openSharing" /> - + :active.sync="sidebarActive" /> @@ -162,8 +161,9 @@ import IconPlus from 'vue-material-design-icons/Plus.vue' import ArchivedFormsModal from './components/ArchivedFormsModal.vue' import AppNavigationForm from './components/AppNavigationForm.vue' import FormsIcon from './components/Icons/FormsIcon.vue' -import PermissionTypes from './mixins/PermissionTypes.js' import OcsResponse2Data from './utils/OcsResponse2Data.js' +import PermissionTypes from './mixins/PermissionTypes.js' +import Sidebar from './views/Sidebar.vue' import logger from './utils/Logger.js' import { FormState } from './models/FormStates.ts' @@ -184,6 +184,7 @@ export default { NcContent, NcEmptyContent, NcLoadingIcon, + Sidebar, }, mixins: [PermissionTypes], diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue index 4bc97f907..ad8630fa4 100644 --- a/src/components/TopBar.vue +++ b/src/components/TopBar.vue @@ -27,18 +27,6 @@ {{ t('forms', 'Share') }} - - - @@ -204,8 +192,4 @@ export default { margin-inline-end: 0; } } - -.icon--flipped { - transform: scaleX(-1); -} diff --git a/src/mixins/ViewsMixin.js b/src/mixins/ViewsMixin.js index d2b1dcd0c..018dec407 100644 --- a/src/mixins/ViewsMixin.js +++ b/src/mixins/ViewsMixin.js @@ -99,10 +99,6 @@ export default { this.$emit('open-sharing', this.form.hash) }, - onSidebarChange(newState) { - this.$emit('update:sidebarOpened', newState) - }, - /** * Focus title after form load */ diff --git a/src/router.js b/src/router.js index d5cf76f8c..2eee43dc5 100644 --- a/src/router.js +++ b/src/router.js @@ -9,7 +9,6 @@ import { generateUrl } from '@nextcloud/router' import Create from './views/Create.vue' import Results from './views/Results.vue' -import Sidebar from './views/Sidebar.vue' import Submit from './views/Submit.vue' Vue.use(Router) @@ -37,7 +36,6 @@ export default new Router({ path: '/:hash/edit', components: { default: Create, - sidebar: Sidebar, }, name: 'edit', props: { default: true }, @@ -46,7 +44,6 @@ export default new Router({ path: '/:hash/results', components: { default: Results, - sidebar: Sidebar, }, name: 'results', props: { default: true }, @@ -55,7 +52,6 @@ export default new Router({ path: '/:hash/submit', components: { default: Submit, - sidebar: Sidebar, }, name: 'submit', props: { default: true }, diff --git a/src/views/Results.vue b/src/views/Results.vue index 9054e5d26..32aabc9d2 100644 --- a/src/views/Results.vue +++ b/src/views/Results.vue @@ -344,7 +344,6 @@ export default { picker: null, showConfirmDeleteDialog: false, - showLinkedFileNotAvailableDialog: false, linkedFileNotAvailableButtons: [ { @@ -419,19 +418,26 @@ export default { } return window.location.href }, + + showLinkedFileNotAvailableDialog() { + if (this.form.partial) { + return false + } + return this.canEditForm && this.form.fileId && !this.form.filePath + }, }, watch: { // Reload results, when form changes async hash() { + await this.fetchFullForm(this.form.id) this.loadFormResults() - await this.fetchLinkedFileInfo() }, }, async beforeMount() { + await this.fetchFullForm(this.form.id) this.loadFormResults() - await this.fetchLinkedFileInfo() SetWindowTitle(this.formTitle) }, @@ -586,20 +592,6 @@ export default { } }, - async fetchLinkedFileInfo() { - const response = await axios.get( - generateOcsUrl('apps/forms/api/v3/forms/{id}', { - id: this.form.id, - }), - ) - const form = OcsResponse2Data(response) - this.$set(this.form, 'fileFormat', form.fileFormat) - this.$set(this.form, 'fileId', form.fileId) - this.$set(this.form, 'filePath', form.filePath) - this.showLinkedFileNotAvailableDialog = - this.canEditForm && form.fileId && !form.filePath - }, - async onReExport() { if (!this.form.fileId) { // Theoretically this will never fire