Skip to content

Commit

Permalink
chore: Convert to ncdialog
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 12, 2024
1 parent b138475 commit 438ce11
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 32 deletions.
49 changes: 20 additions & 29 deletions src/Components/Request/VisibleElements.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<template>
<NcModal v-if="modal"
class="view-sign-detail"
app-name="libresign"
@close="closeModal">
<div class="sign-details">
<NcDialog v-if="modal"
:name="document.name"
size="normal"
@closing="closeModal">
<div v-if="filesStore.loading">
<NcLoadingIcon :size="64" :name="t('libresign', 'Loading file')" />
</div>
<div v-else class="sign-details">
<h2>
{{ document.name }}
<br>
<Chip :state="isDraft ? 'warning' : 'default'">
{{ statusLabel }}
</Chip>
Expand Down Expand Up @@ -39,21 +40,16 @@
{{ t('libresign', 'Sign') }}
</NcButton>
</div>
<div v-if="filesStore.loading"
class="image-page">
<NcLoadingIcon :size="64" name="Loading" />
<p>{{ t('libresign', 'Loading file') }}</p>
</div>
<div v-else class="image-page">
<div class="image-page">
<PdfEditor ref="pdfEditor"
width="100%"
height="100%"
:file-src="document.file"
@pdf-editor:end-init="updateSigners"
@pdf-editor:on-delete-signer="onDeleteSigner" />
</div>
<NcDialog :open.sync="showConfirm"
v-if="showConfirm"
<NcDialog v-if="showConfirm"
:open.sync="showConfirm"
:name="t('libresign', 'Confirm')"
:can-close="!loading"
:message="t('libresign', 'Request signatures?')">
Expand All @@ -73,15 +69,14 @@
</NcButton>
</template>
</NcDialog>
</NcModal>
</NcDialog>
</template>

<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import { subscribe, unsubscribe, emit } from '@nextcloud/event-bus'
Expand All @@ -97,7 +92,6 @@ import { useFilesStore } from '../../store/files.js'
export default {
name: 'VisibleElements',
components: {
NcModal,
NcDialog,
Signer,
Chip,
Expand Down Expand Up @@ -176,9 +170,11 @@ export default {
return
}
this.modal = true
this.filesStore.loading = true
},
closeModal() {
this.modal = false
this.filesStore.loading = true
},
onError(err) {
if (err.response) {
Expand All @@ -201,6 +197,7 @@ export default {
})
}
})
this.filesStore.loading = false
},
onSelectSigner(signer) {
signer.element = {
Expand Down Expand Up @@ -278,22 +275,16 @@ export default {
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.image-page {
.py-12,.p-5 {
::v-deep .py-12{
all: unset;
}
}
.modal-container {
.dialog {
height: unset;
::v-deep .p-5 {
all: unset;
}
}
</style>
<style lang="scss" scoped>
.view-sign-detail {
.modal-container {
&--sidebar {
width: 300px;
}
Expand Down
1 change: 0 additions & 1 deletion src/Components/RightSidebar/RequestSignatureTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export default {
this.modalSrc = ''
},
validationFile() {
console.log('validationFile')
if (this.useModal) {
const route = router.resolve({ name: 'ValidationFileExternal', params: { uuid: this.filesStore.getFile().uuid } })
this.modalSrc = route.href
Expand Down
2 changes: 0 additions & 2 deletions src/store/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export const useFilesStore = defineStore('files', {
if (Object.hasOwn(this.files[nodeId], 'uuid')) {
return
}
this.loading = true
await axios.get(generateOcsUrl('/apps/libresign/api/v1/file/validate/file_id/{fileId}', {
fileId: nodeId,
}))
Expand All @@ -120,7 +119,6 @@ export const useFilesStore = defineStore('files', {
.catch(() => {
set(this.files[nodeId], 'signers', [])
})
this.loading = false
},
addUniqueIdentifierToAllSigners(signers) {
if (signers === undefined) {
Expand Down

0 comments on commit 438ce11

Please sign in to comment.