mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
refactor(files_external): adjust for files library interfaces
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
47c4e3bbe2
commit
a023b5b2d5
5 changed files with 19 additions and 20 deletions
|
|
@ -3,10 +3,10 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { View } from '@nextcloud/files'
|
||||
import type { IView } from '@nextcloud/files'
|
||||
import type { IStorage } from '../types.ts'
|
||||
|
||||
import { DefaultType, File, FileAction, Folder, Permission } from '@nextcloud/files'
|
||||
import { DefaultType, File, Folder, Permission } from '@nextcloud/files'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { StorageStatus } from '../types.ts'
|
||||
import { action } from './enterCredentialsAction.ts'
|
||||
|
|
@ -14,12 +14,12 @@ import { action } from './enterCredentialsAction.ts'
|
|||
const view = {
|
||||
id: 'files',
|
||||
name: 'Files',
|
||||
} as View
|
||||
} as IView
|
||||
|
||||
const externalStorageView = {
|
||||
id: 'extstoragemounts',
|
||||
name: 'External storage',
|
||||
} as View
|
||||
} as IView
|
||||
|
||||
describe('Enter credentials action conditions tests', () => {
|
||||
test('Default values', () => {
|
||||
|
|
@ -36,7 +36,6 @@ describe('Enter credentials action conditions tests', () => {
|
|||
},
|
||||
})
|
||||
|
||||
expect(action).toBeInstanceOf(FileAction)
|
||||
expect(action.id).toBe('credentials-external-storage')
|
||||
expect(action.displayName({
|
||||
view: externalStorageView,
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
*/
|
||||
|
||||
import type { AxiosResponse } from '@nextcloud/axios'
|
||||
import type { INode } from '@nextcloud/files'
|
||||
import type { IFileAction, INode } from '@nextcloud/files'
|
||||
import type { IStorage } from '../types.ts'
|
||||
|
||||
import LoginSvg from '@mdi/svg/svg/login.svg?raw'
|
||||
import axios from '@nextcloud/axios'
|
||||
import { showError, showSuccess } from '@nextcloud/dialogs'
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
import { DefaultType, FileAction } from '@nextcloud/files'
|
||||
import { DefaultType } from '@nextcloud/files'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import { addPasswordConfirmationInterceptors, PwdConfirmationMode } from '@nextcloud/password-confirmation'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
|
@ -60,7 +60,7 @@ async function setCredentials(node: INode, login: string, password: string): Pro
|
|||
|
||||
export const ACTION_CREDENTIALS_EXTERNAL_STORAGE = 'credentials-external-storage'
|
||||
|
||||
export const action = new FileAction({
|
||||
export const action: IFileAction = {
|
||||
id: ACTION_CREDENTIALS_EXTERNAL_STORAGE,
|
||||
displayName: () => t('files', 'Enter missing credentials'),
|
||||
iconSvgInline: () => LoginSvg,
|
||||
|
|
@ -104,4 +104,4 @@ export const action = new FileAction({
|
|||
order: -1000,
|
||||
default: DefaultType.DEFAULT,
|
||||
inline: () => true,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
*/
|
||||
|
||||
import type { AxiosError } from '@nextcloud/axios'
|
||||
import type { IFileAction } from '@nextcloud/files'
|
||||
import type { IStorage } from '../types.ts'
|
||||
|
||||
import AlertSvg from '@mdi/svg/svg/alert-circle.svg?raw'
|
||||
import { showWarning } from '@nextcloud/dialogs'
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
import { FileAction } from '@nextcloud/files'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import { getStatus } from '../services/externalStorage.ts'
|
||||
import { StorageStatus } from '../types.ts'
|
||||
|
|
@ -18,7 +18,7 @@ import { isNodeExternalStorage } from '../utils/externalStorageUtils.ts'
|
|||
|
||||
import '../css/fileEntryStatus.scss'
|
||||
|
||||
export const action = new FileAction({
|
||||
export const action: IFileAction = {
|
||||
id: 'check-external-storage',
|
||||
displayName: () => '',
|
||||
iconSvgInline: () => '',
|
||||
|
|
@ -88,4 +88,4 @@ export const action = new FileAction({
|
|||
},
|
||||
|
||||
order: 10,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { View } from '@nextcloud/files'
|
||||
import type { IView } from '@nextcloud/files'
|
||||
import type { IStorage } from '../types.ts'
|
||||
|
||||
import * as dialogs from '@nextcloud/dialogs'
|
||||
import { DefaultType, FileAction, Folder, Permission } from '@nextcloud/files'
|
||||
import { DefaultType, Folder, Permission } from '@nextcloud/files'
|
||||
import { describe, expect, test, vi } from 'vitest'
|
||||
import { StorageStatus } from '../types.ts'
|
||||
import { action } from './openInFilesAction.ts'
|
||||
|
|
@ -17,12 +17,12 @@ vi.mock('@nextcloud/dialogs', { spy: true })
|
|||
const view = {
|
||||
id: 'files',
|
||||
name: 'Files',
|
||||
} as View
|
||||
} as IView
|
||||
|
||||
const externalStorageView = {
|
||||
id: 'extstoragemounts',
|
||||
name: 'External storage',
|
||||
} as View
|
||||
} as IView
|
||||
|
||||
describe('Open in files action conditions tests', () => {
|
||||
test('Default values', () => {
|
||||
|
|
@ -39,7 +39,6 @@ describe('Open in files action conditions tests', () => {
|
|||
},
|
||||
})
|
||||
|
||||
expect(action).toBeInstanceOf(FileAction)
|
||||
expect(action.id).toBe('open-in-files-external-storage')
|
||||
expect(action.displayName({
|
||||
nodes: [storage],
|
||||
|
|
|
|||
|
|
@ -3,16 +3,17 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type { IFileAction } from '@nextcloud/files'
|
||||
import type { IStorage } from '../types.ts'
|
||||
|
||||
import { getCurrentUser } from '@nextcloud/auth'
|
||||
import { showConfirmation } from '@nextcloud/dialogs'
|
||||
import { DefaultType, FileAction } from '@nextcloud/files'
|
||||
import { DefaultType } from '@nextcloud/files'
|
||||
import { t } from '@nextcloud/l10n'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { StorageStatus } from '../types.ts'
|
||||
|
||||
export const action = new FileAction({
|
||||
export const action: IFileAction = {
|
||||
id: 'open-in-files-external-storage',
|
||||
displayName: ({ nodes }) => {
|
||||
const config = nodes?.[0]?.attributes?.config as IStorage || { status: StorageStatus.Indeterminate }
|
||||
|
|
@ -54,4 +55,4 @@ export const action = new FileAction({
|
|||
// Before openFolderAction
|
||||
order: -1000,
|
||||
default: DefaultType.HIDDEN,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue