Skip to content

Commit 8b31444

Browse files
fix: add missing openDocument imports and fix incorrect parameters
- Add missing import { openDocument } from '../../utils/viewer.js' to: - EnvelopeFilesList.vue (openFile method) - RequestSignatureTab.vue (openFile method) - EnvelopeValidation.vue (viewFile method) - IdDocsValidation.vue (openFile method) - FileEntryActions.vue (openFile method) - CertificatePolicy.vue (view method) - Fix DocumentValidationDetails.vue to make viewDocument async - Fix Validation.vue viewDocument method to use correct reference this.document.uuid instead of undefined file.file parameter Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b9b9c56 commit 8b31444

File tree

8 files changed

+42
-80
lines changed

8 files changed

+42
-80
lines changed

src/components/RightSidebar/EnvelopeFilesList.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ import NcTextField from '@nextcloud/vue/components/NcTextField'
140140
import UploadProgress from '../UploadProgress.vue'
141141
142142
import { FILE_STATUS, ENVELOPE_NAME_MIN_LENGTH, ENVELOPE_NAME_MAX_LENGTH } from '../../constants.js'
143+
import { openDocument } from '../../utils/viewer.js'
143144
import { useFilesStore } from '../../store/files.js'
144145
145146
export default {
@@ -357,20 +358,11 @@ export default {
357358
},
358359
openFile(file) {
359360
const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid })
360-
if (OCA?.Viewer !== undefined) {
361-
const fileInfo = {
362-
source: fileUrl,
363-
basename: file.name,
364-
mime: 'application/pdf',
365-
fileid: file.id,
366-
}
367-
OCA.Viewer.open({
368-
fileInfo,
369-
list: [fileInfo],
370-
})
371-
} else {
372-
window.open(`${fileUrl}?_t=${Date.now()}`)
373-
}
361+
openDocument({
362+
fileUrl,
363+
filename: file.name,
364+
nodeId: file.id,
365+
})
374366
},
375367
isSelected(fileId) {
376368
return this.selectedFiles.includes(fileId)

src/components/RightSidebar/RequestSignatureTab.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ import VisibleElements from '../Request/VisibleElements.vue'
305305
import svgSignal from '../../../img/logo-signal-app.svg?raw'
306306
import svgTelegram from '../../../img/logo-telegram-app.svg?raw'
307307
import { FILE_STATUS } from '../../constants.js'
308+
import { openDocument } from '../../utils/viewer.js'
308309
import router from '../../router/router.js'
309310
import { useFilesStore } from '../../store/files.js'
310311
import { useSidebarStore } from '../../store/sidebar.js'
@@ -1033,20 +1034,11 @@ export default {
10331034
return
10341035
}
10351036
1036-
if (OCA?.Viewer !== undefined) {
1037-
const fileInfo = {
1038-
source: fileUrl,
1039-
basename: file.name,
1040-
mime: 'application/pdf',
1041-
fileid: file.nodeId,
1042-
}
1043-
OCA.Viewer.open({
1044-
fileInfo,
1045-
list: [fileInfo],
1046-
})
1047-
} else {
1048-
window.open(`${fileUrl}?_t=${Date.now()}`)
1049-
}
1037+
openDocument({
1038+
fileUrl,
1039+
filename: file.name,
1040+
nodeId: file.nodeId,
1041+
})
10501042
},
10511043
startSigningProgressPolling() {
10521044
const file = this.filesStore.getFile()

src/components/validation/DocumentValidationDetails.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ export default {
9797
},
9898
},
9999
methods: {
100-
viewDocument() {
100+
async viewDocument() {
101101
const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: this.document.uuid })
102-
openDocument({
102+
await openDocument({
103103
fileUrl,
104104
filename: this.document.name,
105105
nodeId: this.document.nodeId,

src/components/validation/EnvelopeValidation.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ import {
177177
} from '@mdi/js'
178178
import Moment from '@nextcloud/moment'
179179
import { getStatusLabel } from '../../utils/fileStatus.js'
180+
import { openDocument } from '../../utils/viewer.js'
180181
import SignerDetails from './SignerDetails.vue'
181182
import DocumentValidationDetails from './DocumentValidationDetails.vue'
182183
@@ -243,20 +244,11 @@ export default {
243244
},
244245
viewFile(file) {
245246
const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid })
246-
if (OCA?.Viewer !== undefined) {
247-
const fileInfo = {
248-
source: fileUrl,
249-
basename: file.name,
250-
mime: 'application/pdf',
251-
fileid: file.nodeId,
252-
}
253-
OCA.Viewer.open({
254-
fileInfo,
255-
list: [fileInfo],
256-
})
257-
} else {
258-
window.open(`${fileUrl}?_t=${Date.now()}`)
259-
}
247+
openDocument({
248+
fileUrl,
249+
filename: file.name,
250+
nodeId: file.nodeId,
251+
})
260252
},
261253
},
262254
}

src/views/Documents/IdDocsValidation.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ import axios from '@nextcloud/axios'
165165
import { showError } from '@nextcloud/dialogs'
166166
import { generateOcsUrl } from '@nextcloud/router'
167167
168+
import { openDocument } from '../../utils/viewer.js'
168169
import { useUserConfigStore } from '../../store/userconfig.js'
169170
170171
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
@@ -352,20 +353,11 @@ export default {
352353
return
353354
}
354355
355-
if (OCA?.Viewer !== undefined) {
356-
const fileInfo = {
357-
source: fileUrl,
358-
basename: doc.file.name,
359-
mime: 'application/pdf',
360-
fileid: doc.nodeId,
361-
}
362-
OCA.Viewer.open({
363-
fileInfo,
364-
list: [fileInfo],
365-
})
366-
} else {
367-
window.open(`${fileUrl}?_t=${Date.now()}`)
368-
}
356+
openDocument({
357+
fileUrl,
358+
filename: doc.file.name,
359+
nodeId: doc.nodeId,
360+
})
369361
},
370362
371363
openValidationURL(doc) {

src/views/FilesList/FileEntry/FileEntryActions.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import svgTextBoxCheck from '@mdi/svg/svg/text-box-check.svg?raw'
6868
import { loadState } from '@nextcloud/initial-state'
6969
import { generateUrl } from '@nextcloud/router'
7070
71+
import { openDocument } from '../../../utils/viewer.js'
7172
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
7273
import NcActions from '@nextcloud/vue/components/NcActions'
7374
import NcButton from '@nextcloud/vue/components/NcButton'
@@ -248,20 +249,11 @@ export default {
248249
const fileUrl = this.source.file
249250
|| generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: this.source.uuid })
250251
251-
if (OCA?.Viewer !== undefined) {
252-
const fileInfo = {
253-
source: fileUrl,
254-
basename: this.source.name,
255-
mime: 'application/pdf',
256-
fileid: this.source.nodeId,
257-
}
258-
OCA.Viewer.open({
259-
fileInfo,
260-
list: [fileInfo],
261-
})
262-
} else {
263-
window.open(`${fileUrl}?_t=${Date.now()}`)
264-
}
252+
openDocument({
253+
fileUrl,
254+
filename: this.source.name,
255+
nodeId: this.source.nodeId,
256+
})
265257
},
266258
doRename(newName) {
267259
return this.filesStore.rename(this.source.uuid, newName)

src/views/Settings/CertificatePolicy.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import axios from '@nextcloud/axios'
6969
import { loadState } from '@nextcloud/initial-state'
7070
import { generateOcsUrl } from '@nextcloud/router'
7171
72+
import { openDocument } from '../../utils/viewer.js'
7273
import NcButton from '@nextcloud/vue/components/NcButton'
7374
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
7475
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
@@ -112,11 +113,11 @@ export default {
112113
},
113114
methods: {
114115
view() {
115-
if (OCA?.Viewer !== undefined) {
116-
OCA.Viewer.open({ path: this.CPS })
117-
} else {
118-
window.open(`${this.CPS}?_t=${Date.now()}`)
119-
}
116+
openDocument({
117+
fileUrl: this.CPS,
118+
filename: 'Certificate Policy',
119+
nodeId: null,
120+
})
120121
},
121122
activateLocalFilePicker() {
122123
// Set to null so that selecting the same file will trigger the change event

src/views/Validation.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,10 @@ export default {
406406
}
407407
return mdiAlertCircle
408408
},
409-
viewDocument() {
410-
openDocument({
411-
fileUrl: file.file,
409+
async viewDocument() {
410+
const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: this.document.uuid })
411+
await openDocument({
412+
fileUrl,
412413
filename: this.document.name,
413414
nodeId: this.document.nodeId,
414415
})

0 commit comments

Comments
 (0)