From eb0ad1f7833a3d4e98758121308f5aed86c8614d Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Tue, 2 Apr 2024 19:36:13 -0300 Subject: [PATCH 01/35] feat: implement sign tab Signed-off-by: Vitor Mattos --- src/Components/RightSidebar/RightSidebar.vue | 14 ++- src/Components/RightSidebar/SignTab.vue | 92 ++++++++++++++++++++ src/store/files.js | 5 ++ src/store/sign.js | 31 ++++--- 4 files changed, 128 insertions(+), 14 deletions(-) create mode 100644 src/Components/RightSidebar/SignTab.vue diff --git a/src/Components/RightSidebar/RightSidebar.vue b/src/Components/RightSidebar/RightSidebar.vue index 4165289dee..54737e6654 100644 --- a/src/Components/RightSidebar/RightSidebar.vue +++ b/src/Components/RightSidebar/RightSidebar.vue @@ -4,7 +4,12 @@ :subtitle="subTitle" :active="fileName" @close="closeSidebar"> - + + + @@ -16,6 +21,7 @@ import NcAppSidebar from '@nextcloud/vue/dist/Components/NcAppSidebar.js' import NcAppSidebarTab from '@nextcloud/vue/dist/Components/NcAppSidebarTab.js' import RequestSignatureTab from '../RightSidebar/RequestSignatureTab.vue' +import SignTab from '../RightSidebar/SignTab.vue' import { useFilesStore } from '../../store/files.js' import { useSignStore } from '../../store/sign.js' @@ -25,6 +31,7 @@ export default { NcAppSidebar, NcAppSidebarTab, RequestSignatureTab, + SignTab, }, setup() { const filesStore = useFilesStore() @@ -48,9 +55,14 @@ export default { methods: { showListSigners() { return !!this.filesStore.getFile()?.name + && !this.showSign() + }, + showSign() { + return this.signStore.document.uuid.length > 0 }, closeSidebar() { this.filesStore.selectFile() + this.signStore.reset() this.$emit('close') }, }, diff --git a/src/Components/RightSidebar/SignTab.vue b/src/Components/RightSidebar/SignTab.vue new file mode 100644 index 0000000000..363f1565a5 --- /dev/null +++ b/src/Components/RightSidebar/SignTab.vue @@ -0,0 +1,92 @@ + + + diff --git a/src/store/files.js b/src/store/files.js index 6e7c7eca17..45349541ab 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -24,6 +24,7 @@ import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' import { set } from 'vue' import Moment from '@nextcloud/moment' +import { useSignStore } from './sign.js' export const useFilesStore = defineStore('files', { state: () => { @@ -42,6 +43,10 @@ export const useFilesStore = defineStore('files', { }, selectFile(nodeId) { this.selectedNodeId = nodeId ?? 0 + if (this.selectedNodeId === 0) { + const signStore = useSignStore() + signStore.reset() + } }, getFile() { return this.files[this.selectedNodeId] ?? {} diff --git a/src/store/sign.js b/src/store/sign.js index 8675beecd8..91d99f6b82 100644 --- a/src/store/sign.js +++ b/src/store/sign.js @@ -22,20 +22,22 @@ import { defineStore } from 'pinia' import { loadState } from '@nextcloud/initial-state' +const defaultState = { + errors: [], + document: { + name: '', + description: '', + status: '', + statusText: '', + url: '', + uuid: '', + signers: [], + visibleElements: [], + }, +} + export const useSignStore = defineStore('sign', { - state: () => ({ - errors: [], - document: { - name: '', - description: '', - status: '', - statusText: '', - url: '', - uuid: '', - signers: [], - visibleElements: [], - }, - }), + state: () => ({ ...defaultState }), actions: { initFromState() { @@ -52,5 +54,8 @@ export const useSignStore = defineStore('sign', { visibleElements: loadState('libresign', 'visibleElements', []), } }, + reset() { + Object.assign(this, defaultState); + } }, }) From 24548a883fea0060fc91434f01253eda509a4d63 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Wed, 3 Apr 2024 08:48:32 -0300 Subject: [PATCH 02/35] fix: Lint Signed-off-by: Vitor Mattos --- src/store/sign.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/sign.js b/src/store/sign.js index 91d99f6b82..89f4930fc4 100644 --- a/src/store/sign.js +++ b/src/store/sign.js @@ -55,7 +55,7 @@ export const useSignStore = defineStore('sign', { } }, reset() { - Object.assign(this, defaultState); - } + Object.assign(this, defaultState) + }, }, }) From 8eb10431feec5c554ea04d4f0c8f17f21bc263ec Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 8 Apr 2024 19:11:24 -0300 Subject: [PATCH 03/35] chore: rewrite SignPDF to load as internal and external page Signed-off-by: Vitor Mattos --- src/App.vue | 14 +- src/Components/LeftSidebar/LeftSidebar.vue | 8 +- .../RightSidebar/RequestSignatureTab.vue | 12 +- src/Components/RightSidebar/RightSidebar.vue | 42 +++-- src/Components/RightSidebar/SignTab.vue | 59 +++--- src/external.js | 4 +- src/helpers/SelectAction.js | 2 + src/router/router.js | 6 + src/store/files.js | 22 ++- src/store/sidebar.js | 15 +- src/store/sign.js | 26 ++- src/views/SignPDF/SignPDF.vue | 178 ++++-------------- src/views/SignPDF/_partials/Sign.vue | 12 +- 13 files changed, 179 insertions(+), 221 deletions(-) diff --git a/src/App.vue b/src/App.vue index fdb755f021..57e931fb94 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,7 +22,7 @@ -->