Skip to content

Commit 65cdf14

Browse files
authored
Merge pull request #55726 from nextcloud/chore/update-dialog-v7
chore: Update `@nextcloud/dialogs` to v7.0.0
2 parents d5220d6 + cc4f830 commit 65cdf14

File tree

377 files changed

+36396
-1879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+36396
-1879
lines changed

apps/federatedfilesharing/src/components/AdminSettings.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
<script>
7676
import axios from '@nextcloud/axios'
77-
import { DialogBuilder, DialogSeverity, showError } from '@nextcloud/dialogs'
77+
import { DialogBuilder, showError } from '@nextcloud/dialogs'
7878
import { loadState } from '@nextcloud/initial-state'
7979
import { confirmPassword } from '@nextcloud/password-confirmation'
8080
import { generateOcsUrl } from '@nextcloud/router'
@@ -124,7 +124,7 @@ export default {
124124
125125
const dialog = new DialogBuilder(t('federatedfilesharing', 'Confirm data upload to lookup server'))
126126
await dialog
127-
.setSeverity(DialogSeverity.Warning)
127+
.setSeverity('warning')
128128
.setText(t('federatedfilesharing', 'When enabled, all account properties (e.g. email address) with scope visibility set to "published", will be automatically synced and transmitted to an external system and made available in a public, global address book.'))
129129
.addButton({
130130
callback: () => this.setLookupServerUploadEnabled(false),
@@ -155,7 +155,7 @@ export default {
155155
156156
const dialog = new DialogBuilder(t('federatedfilesharing', 'Confirm querying lookup server'))
157157
await dialog
158-
.setSeverity(DialogSeverity.Warning)
158+
.setSeverity('warning')
159159
.setText(t('federatedfilesharing', 'When enabled, the search input when creating shares will be sent to an external system that provides a public and global address book.')
160160
+ t('federatedfilesharing', 'This is used to retrieve the federated cloud ID to make federated sharing easier.')
161161
+ t('federatedfilesharing', 'Moreover, email addresses of users might be sent to that system in order to verify them.'))

apps/federatedfilesharing/src/services/dialogService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { spawnDialog } from '@nextcloud/dialogs'
6+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
77
import RemoteShareDialog from '../components/RemoteShareDialog.vue'
88

99
/**

apps/files/src/utils/newNodeDialog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import type { Node } from '@nextcloud/files'
77

8-
import { spawnDialog } from '@nextcloud/dialogs'
8+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
99
import NewNodeDialog from '../components/NewNodeDialog.vue'
1010

1111
interface ILabels {

apps/files/src/views/FileReferencePickerElement.vue

Lines changed: 60 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,88 +4,79 @@
44
-->
55

66
<template>
7-
<div :id="containerId">
8-
<FilePicker v-bind="filepickerOptions" @close="onClose" />
9-
</div>
7+
<div :id="containerId" />
108
</template>
119

12-
<script lang="ts">
10+
<script setup lang="ts">
1311
import type { IFilePickerButton } from '@nextcloud/dialogs'
1412
import type { Node as NcNode } from '@nextcloud/files'
1513
16-
import { FilePickerVue as FilePicker } from '@nextcloud/dialogs/filepicker.js'
17-
import { translate as t } from '@nextcloud/l10n'
14+
import { FilePickerBuilder } from '@nextcloud/dialogs'
15+
import { t } from '@nextcloud/l10n'
1816
import { generateUrl } from '@nextcloud/router'
19-
import { defineComponent } from 'vue'
17+
import { onMounted } from 'vue'
18+
import logger from '../logger.ts'
2019
21-
export default defineComponent({
22-
name: 'FileReferencePickerElement',
23-
components: {
24-
FilePicker,
25-
},
20+
defineProps<{
21+
providerId: string
22+
accessible: boolean
23+
}>()
2624
27-
props: {
28-
providerId: {
29-
type: String,
30-
required: true,
31-
},
25+
const emit = defineEmits<{
26+
(e: 'submit', url: string): void
27+
(e: 'cancel'): void
28+
}>()
3229
33-
accessible: {
34-
type: Boolean,
35-
default: false,
36-
},
37-
},
30+
const containerId = `filepicker-${Math.random().toString(36).slice(7)}`
3831
39-
computed: {
40-
containerId() {
41-
return `filepicker-${Math.random().toString(36).slice(7)}`
42-
},
32+
const filePicker = new FilePickerBuilder(t('files', 'Select file or folder to link to'))
33+
.allowDirectories(true)
34+
.setButtonFactory(buttonFactory)
35+
.setContainer(`#${containerId}`)
36+
.setMultiSelect(false)
37+
.build()
4338
44-
filepickerOptions() {
45-
return {
46-
allowPickDirectory: true,
47-
buttons: this.buttonFactory,
48-
container: `#${this.containerId}`,
49-
multiselect: false,
50-
name: t('files', 'Select file or folder to link to'),
51-
}
52-
},
53-
},
39+
onMounted(async () => {
40+
try {
41+
const [node] = await filePicker.pickNodes()
42+
onSubmit(node)
43+
} catch (error) {
44+
logger.debug('Aborted picking nodes:', { error })
45+
emit('cancel')
46+
}
47+
})
5448
55-
methods: {
56-
t,
49+
/**
50+
* Get buttons for the file picker dialog
51+
*
52+
* @param selected - currently selected nodes
53+
*/
54+
function buttonFactory(selected: NcNode[]): IFilePickerButton[] {
55+
const buttons = [] as IFilePickerButton[]
56+
const node = selected[0]
57+
if (node === undefined) {
58+
return []
59+
}
5760
58-
buttonFactory(selected: NcNode[]): IFilePickerButton[] {
59-
const buttons = [] as IFilePickerButton[]
60-
if (selected.length === 0) {
61-
return []
62-
}
63-
const node = selected.at(0)
64-
if (node.path === '/') {
65-
return [] // Do not allow selecting the users root folder
66-
}
67-
buttons.push({
68-
label: t('files', 'Choose {file}', { file: node.displayname }),
69-
type: 'primary',
70-
callback: this.onClose,
71-
})
72-
return buttons
73-
},
61+
if (node.path === '/') {
62+
return [] // Do not allow selecting the users root folder
63+
}
7464
75-
onClose(nodes?: NcNode[]) {
76-
if (nodes === undefined || nodes.length === 0) {
77-
this.$emit('cancel')
78-
} else {
79-
this.onSubmit(nodes[0])
80-
}
81-
},
65+
buttons.push({
66+
label: t('files', 'Choose {file}', { file: node.displayname }),
67+
variant: 'primary',
68+
callback: () => {}, // handled by the pickNodes method
69+
})
70+
return buttons
71+
}
8272
83-
onSubmit(node: NcNode) {
84-
const url = new URL(window.location.href)
85-
url.pathname = generateUrl('/f/{fileId}', { fileId: node.fileid! })
86-
url.search = ''
87-
this.$emit('submit', url.href)
88-
},
89-
},
90-
})
73+
/**
74+
* @param node - selected node
75+
*/
76+
function onSubmit(node: NcNode) {
77+
const url = new URL(window.location.href)
78+
url.pathname = generateUrl('/f/{fileId}', { fileId: node.fileid! })
79+
url.search = ''
80+
emit('submit', url.href)
81+
}
9182
</script>

apps/files/src/views/TemplatePicker.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
5757
import type { TemplateFile } from '../types.ts'
5858
5959
import { getCurrentUser } from '@nextcloud/auth'
60-
import { showError, spawnDialog } from '@nextcloud/dialogs'
60+
import { showError } from '@nextcloud/dialogs'
6161
import { emit } from '@nextcloud/event-bus'
6262
import { File } from '@nextcloud/files'
6363
import { getClient, getDefaultPropfind, getRootPath, resultToNode } from '@nextcloud/files/dav'
6464
import { translate as t } from '@nextcloud/l10n'
6565
import { generateRemoteUrl } from '@nextcloud/router'
66+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
6667
import { extname, join, normalize } from 'path'
6768
import { defineComponent } from 'vue'
6869
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'

apps/files_external/src/actions/enterCredentialsAction.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ import type { StorageConfig } from '../services/externalStorage.ts'
99

1010
import LoginSvg from '@mdi/svg/svg/login.svg?raw'
1111
import axios from '@nextcloud/axios'
12-
import { showError, showSuccess, spawnDialog } from '@nextcloud/dialogs'
12+
import { showError, showSuccess } from '@nextcloud/dialogs'
1313
import { DefaultType, FileAction } from '@nextcloud/files'
14-
import { translate as t } from '@nextcloud/l10n'
14+
import { t } from '@nextcloud/l10n'
1515
import { addPasswordConfirmationInterceptors, PwdConfirmationMode } from '@nextcloud/password-confirmation'
1616
import { generateUrl } from '@nextcloud/router'
17+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
1718
import Vue, { defineAsyncComponent } from 'vue'
1819
import { isMissingAuthConfig, STORAGE_STATUS } from '../utils/credentialsUtils.ts'
1920
import { isNodeExternalStorage } from '../utils/externalStorageUtils.ts'

apps/files_sharing/src/files_newMenu/newFileRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import type { Folder, NewMenuEntry, Node } from '@nextcloud/files'
77

88
import FileUploadSvg from '@mdi/svg/svg/file-upload-outline.svg?raw'
9-
import { spawnDialog } from '@nextcloud/dialogs'
109
import { t } from '@nextcloud/l10n'
1110
import { isPublicShare } from '@nextcloud/sharing/public'
11+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
1212
import { defineAsyncComponent } from 'vue'
1313
import Config from '../services/ConfigService.ts'
1414

apps/files_trashbin/src/files_listActions/emptyTrashAction.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5+
56
import type { Folder, Node, View } from '@nextcloud/files'
67

7-
import {
8-
DialogSeverity,
9-
getDialogBuilder,
10-
} from '@nextcloud/dialogs'
8+
import { getDialogBuilder } from '@nextcloud/dialogs'
119
import { emit } from '@nextcloud/event-bus'
1210
import { FileListAction } from '@nextcloud/files'
1311
import { loadState } from '@nextcloud/initial-state'
@@ -41,18 +39,18 @@ export const emptyTrashAction = new FileListAction({
4139
async exec(view: View, nodes: Node[]): Promise<null> {
4240
const askConfirmation = new Promise<boolean>((resolve) => {
4341
const dialog = getDialogBuilder(t('files_trashbin', 'Confirm permanent deletion'))
44-
.setSeverity(DialogSeverity.Warning)
42+
.setSeverity('warning')
4543
// TODO Add note for groupfolders
4644
.setText(t('files_trashbin', 'Are you sure you want to permanently delete all files and folders in the trash? This cannot be undone.'))
4745
.setButtons([
4846
{
4947
label: t('files_trashbin', 'Cancel'),
50-
type: 'secondary',
48+
variant: 'secondary',
5149
callback: () => resolve(false),
5250
},
5351
{
5452
label: t('files_trashbin', 'Empty deleted files'),
55-
type: 'error',
53+
variant: 'error',
5654
callback: () => resolve(true),
5755
},
5856
])

apps/settings/src/components/Encryption/EncryptionSettings.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
import type { OCSResponse } from '@nextcloud/typings/ocs'
88
99
import axios from '@nextcloud/axios'
10-
import { showError, spawnDialog } from '@nextcloud/dialogs'
10+
import { showError } from '@nextcloud/dialogs'
1111
import { loadState } from '@nextcloud/initial-state'
1212
import { t } from '@nextcloud/l10n'
1313
import { confirmPassword } from '@nextcloud/password-confirmation'
1414
import { generateOcsUrl } from '@nextcloud/router'
15+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
1516
import { ref } from 'vue'
1617
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
1718
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'

apps/systemtags/src/files_actions/bulkSystemTagsAction.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import TagMultipleSvg from '@mdi/svg/svg/tag-multiple-outline.svg?raw'
2-
import { spawnDialog } from '@nextcloud/dialogs'
31
/**
42
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
53
* SPDX-License-Identifier: AGPL-3.0-or-later
64
*/
7-
import {
8-
type Node,
95

10-
Permission,
11-
} from '@nextcloud/files'
12-
import { FileAction } from '@nextcloud/files'
6+
import type { Node } from '@nextcloud/files'
7+
8+
import TagMultipleSvg from '@mdi/svg/svg/tag-multiple-outline.svg?raw'
9+
import { FileAction, Permission } from '@nextcloud/files'
1310
import { t } from '@nextcloud/l10n'
1411
import { isPublicShare } from '@nextcloud/sharing/public'
12+
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
1513
import { defineAsyncComponent } from 'vue'
1614

1715
/**

0 commit comments

Comments
 (0)