Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions apps/federatedfilesharing/src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

<script>
import axios from '@nextcloud/axios'
import { DialogBuilder, DialogSeverity, showError } from '@nextcloud/dialogs'
import { DialogBuilder, showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import { confirmPassword } from '@nextcloud/password-confirmation'
import { generateOcsUrl } from '@nextcloud/router'
Expand Down Expand Up @@ -124,7 +124,7 @@ export default {

const dialog = new DialogBuilder(t('federatedfilesharing', 'Confirm data upload to lookup server'))
await dialog
.setSeverity(DialogSeverity.Warning)
.setSeverity('warning')
.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.'))
.addButton({
callback: () => this.setLookupServerUploadEnabled(false),
Expand Down Expand Up @@ -155,7 +155,7 @@ export default {

const dialog = new DialogBuilder(t('federatedfilesharing', 'Confirm querying lookup server'))
await dialog
.setSeverity(DialogSeverity.Warning)
.setSeverity('warning')
.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.')
+ t('federatedfilesharing', 'This is used to retrieve the federated cloud ID to make federated sharing easier.')
+ t('federatedfilesharing', 'Moreover, email addresses of users might be sent to that system in order to verify them.'))
Expand Down
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/src/services/dialogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { spawnDialog } from '@nextcloud/dialogs'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import RemoteShareDialog from '../components/RemoteShareDialog.vue'

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/utils/newNodeDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

import { spawnDialog } from '@nextcloud/dialogs'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import NewNodeDialog from '../components/NewNodeDialog.vue'

interface ILabels {
Expand Down
129 changes: 60 additions & 69 deletions apps/files/src/views/FileReferencePickerElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,88 +4,79 @@
-->

<template>
<div :id="containerId">
<FilePicker v-bind="filepickerOptions" @close="onClose" />
</div>
<div :id="containerId" />
</template>

<script lang="ts">
<script setup lang="ts">
import type { IFilePickerButton } from '@nextcloud/dialogs'
import type { Node as NcNode } from '@nextcloud/files'

import { FilePickerVue as FilePicker } from '@nextcloud/dialogs/filepicker.js'
import { translate as t } from '@nextcloud/l10n'
import { FilePickerBuilder } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import { defineComponent } from 'vue'
import { onMounted } from 'vue'
import logger from '../logger.ts'

export default defineComponent({
name: 'FileReferencePickerElement',
components: {
FilePicker,
},
defineProps<{
providerId: string
accessible: boolean
}>()

props: {
providerId: {
type: String,
required: true,
},
const emit = defineEmits<{
(e: 'submit', url: string): void
(e: 'cancel'): void
}>()

accessible: {
type: Boolean,
default: false,
},
},
const containerId = `filepicker-${Math.random().toString(36).slice(7)}`

computed: {
containerId() {
return `filepicker-${Math.random().toString(36).slice(7)}`
},
const filePicker = new FilePickerBuilder(t('files', 'Select file or folder to link to'))
.allowDirectories(true)
.setButtonFactory(buttonFactory)
.setContainer(`#${containerId}`)
.setMultiSelect(false)
.build()

filepickerOptions() {
return {
allowPickDirectory: true,
buttons: this.buttonFactory,
container: `#${this.containerId}`,
multiselect: false,
name: t('files', 'Select file or folder to link to'),
}
},
},
onMounted(async () => {
try {
const [node] = await filePicker.pickNodes()
onSubmit(node)
} catch (error) {
logger.debug('Aborted picking nodes:', { error })
emit('cancel')
}
})

methods: {
t,
/**
* Get buttons for the file picker dialog
*
* @param selected - currently selected nodes
*/
function buttonFactory(selected: NcNode[]): IFilePickerButton[] {
const buttons = [] as IFilePickerButton[]
const node = selected[0]
if (node === undefined) {
return []
}

buttonFactory(selected: NcNode[]): IFilePickerButton[] {
const buttons = [] as IFilePickerButton[]
if (selected.length === 0) {
return []
}
const node = selected.at(0)
if (node.path === '/') {
return [] // Do not allow selecting the users root folder
}
buttons.push({
label: t('files', 'Choose {file}', { file: node.displayname }),
type: 'primary',
callback: this.onClose,
})
return buttons
},
if (node.path === '/') {
return [] // Do not allow selecting the users root folder
}

onClose(nodes?: NcNode[]) {
if (nodes === undefined || nodes.length === 0) {
this.$emit('cancel')
} else {
this.onSubmit(nodes[0])
}
},
buttons.push({
label: t('files', 'Choose {file}', { file: node.displayname }),
variant: 'primary',
callback: () => {}, // handled by the pickNodes method
})
return buttons
}

onSubmit(node: NcNode) {
const url = new URL(window.location.href)
url.pathname = generateUrl('/f/{fileId}', { fileId: node.fileid! })
url.search = ''
this.$emit('submit', url.href)
},
},
})
/**
* @param node - selected node
*/
function onSubmit(node: NcNode) {
const url = new URL(window.location.href)
url.pathname = generateUrl('/f/{fileId}', { fileId: node.fileid! })
url.search = ''
emit('submit', url.href)
}
</script>
3 changes: 2 additions & 1 deletion apps/files/src/views/TemplatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
import type { TemplateFile } from '../types.ts'

import { getCurrentUser } from '@nextcloud/auth'
import { showError, spawnDialog } from '@nextcloud/dialogs'
import { showError } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { File } from '@nextcloud/files'
import { getClient, getDefaultPropfind, getRootPath, resultToNode } from '@nextcloud/files/dav'
import { translate as t } from '@nextcloud/l10n'
import { generateRemoteUrl } from '@nextcloud/router'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import { extname, join, normalize } from 'path'
import { defineComponent } from 'vue'
import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
Expand Down
5 changes: 3 additions & 2 deletions apps/files_external/src/actions/enterCredentialsAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import type { StorageConfig } from '../services/externalStorage.ts'

import LoginSvg from '@mdi/svg/svg/login.svg?raw'
import axios from '@nextcloud/axios'
import { showError, showSuccess, spawnDialog } from '@nextcloud/dialogs'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { DefaultType, FileAction } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import { t } from '@nextcloud/l10n'
import { addPasswordConfirmationInterceptors, PwdConfirmationMode } from '@nextcloud/password-confirmation'
import { generateUrl } from '@nextcloud/router'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import Vue, { defineAsyncComponent } from 'vue'
import { isMissingAuthConfig, STORAGE_STATUS } from '../utils/credentialsUtils.ts'
import { isNodeExternalStorage } from '../utils/externalStorageUtils.ts'
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/src/files_newMenu/newFileRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import type { Folder, NewMenuEntry, Node } from '@nextcloud/files'

import FileUploadSvg from '@mdi/svg/svg/file-upload-outline.svg?raw'
import { spawnDialog } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import { isPublicShare } from '@nextcloud/sharing/public'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import { defineAsyncComponent } from 'vue'
import Config from '../services/ConfigService.ts'

Expand Down
12 changes: 5 additions & 7 deletions apps/files_trashbin/src/files_listActions/emptyTrashAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import type { Folder, Node, View } from '@nextcloud/files'

import {
DialogSeverity,
getDialogBuilder,
} from '@nextcloud/dialogs'
import { getDialogBuilder } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { FileListAction } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
Expand Down Expand Up @@ -41,18 +39,18 @@ export const emptyTrashAction = new FileListAction({
async exec(view: View, nodes: Node[]): Promise<null> {
const askConfirmation = new Promise<boolean>((resolve) => {
const dialog = getDialogBuilder(t('files_trashbin', 'Confirm permanent deletion'))
.setSeverity(DialogSeverity.Warning)
.setSeverity('warning')
// TODO Add note for groupfolders
.setText(t('files_trashbin', 'Are you sure you want to permanently delete all files and folders in the trash? This cannot be undone.'))
.setButtons([
{
label: t('files_trashbin', 'Cancel'),
type: 'secondary',
variant: 'secondary',
callback: () => resolve(false),
},
{
label: t('files_trashbin', 'Empty deleted files'),
type: 'error',
variant: 'error',
callback: () => resolve(true),
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import type { OCSResponse } from '@nextcloud/typings/ocs'

import axios from '@nextcloud/axios'
import { showError, spawnDialog } from '@nextcloud/dialogs'
import { showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import { t } from '@nextcloud/l10n'
import { confirmPassword } from '@nextcloud/password-confirmation'
import { generateOcsUrl } from '@nextcloud/router'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import { ref } from 'vue'
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
Expand Down
12 changes: 5 additions & 7 deletions apps/systemtags/src/files_actions/bulkSystemTagsAction.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import TagMultipleSvg from '@mdi/svg/svg/tag-multiple-outline.svg?raw'
import { spawnDialog } from '@nextcloud/dialogs'
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import {
type Node,

Permission,
} from '@nextcloud/files'
import { FileAction } from '@nextcloud/files'
import type { Node } from '@nextcloud/files'

import TagMultipleSvg from '@mdi/svg/svg/tag-multiple-outline.svg?raw'
import { FileAction, Permission } from '@nextcloud/files'
import { t } from '@nextcloud/l10n'
import { isPublicShare } from '@nextcloud/sharing/public'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import { defineAsyncComponent } from 'vue'

/**
Expand Down
46 changes: 22 additions & 24 deletions apps/user_ldap/src/services/ldapConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
*/

import type { AxiosError } from '@nextcloud/axios'
import type { AxiosResponse } from '@nextcloud/axios'
import type { OCSResponse } from '@nextcloud/typings/ocs'
import type { LDAPConfig } from '../models/index.ts'

import axios, { type AxiosResponse } from '@nextcloud/axios'
import { DialogSeverity, getDialogBuilder, showError, showSuccess } from '@nextcloud/dialogs'
import axios from '@nextcloud/axios'
import { getDialogBuilder, showError, showSuccess } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import { generateOcsUrl, generateUrl } from '@nextcloud/router'
import path from 'path'
Expand Down Expand Up @@ -206,26 +207,23 @@ export async function showEnableAutomaticFilterInfo() {
* @param text
*/
export async function confirmOperation(name: string, text: string): Promise<boolean> {
return new Promise((resolve) => {
const dialog = getDialogBuilder(name)
.setText(text)
.setSeverity(DialogSeverity.Warning)
.addButton({
label: t('user_ldap', 'Cancel'),
callback() {
dialog.hide()
resolve(false)
},
})
.addButton({
label: t('user_ldap', 'Confirm'),
variant: 'error',
callback() {
resolve(true)
},
})
.build()

dialog.show()
})
let result = false
const dialog = getDialogBuilder(name)
.setText(text)
.setSeverity('warning')
.addButton({
label: t('user_ldap', 'Cancel'),
callback() {},
})
.addButton({
label: t('user_ldap', 'Confirm'),
variant: 'error',
callback() {
result = true
},
})
.build()

await dialog.show()
return result
}
Loading
Loading