Skip to content

Commit 28724fe

Browse files
authored
Merge pull request #59365 from nextcloud/fix/default-values
fix(files_external): properly set default values for backend options
2 parents f637e1c + b3fa62f commit 28724fe

5 files changed

Lines changed: 13 additions & 4 deletions

File tree

apps/files_external/src/components/AddExternalStorageDialog/BackendConfiguration.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ const props = defineProps<{
2020
watch(() => props.configuration, () => {
2121
for (const key in props.configuration) {
2222
if (!(key in modelValue.value)) {
23-
modelValue.value[key] = props.configuration[key]?.type === ConfigurationType.Boolean
23+
modelValue.value[key] = props.configuration[key]?.defaultValue ?? (props.configuration[key]?.type === ConfigurationType.Boolean
2424
? false
2525
: ''
26+
)
2627
}
2728
}
2829
}, { immediate: true })

apps/files_external/src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export const ConfigurationType = Object.freeze({
2121

2222
export const ConfigurationFlag = Object.freeze({
2323
None: 0,
24+
/**
25+
* Indicates that the configuration option is optional and can be left empty ("not required")
26+
*/
2427
Optional: 1,
2528
UserProvided: 2,
2629
Hidden: 4,
@@ -94,6 +97,11 @@ export interface IConfigurationOption {
9497
* Optional tooltip for the configuration option
9598
*/
9699
tooltip?: string
100+
101+
/**
102+
* Default value for the configuration option.
103+
*/
104+
defaultValue?: string | boolean
97105
}
98106

99107
export interface IAuthMechanism {

dist/files_external-settings.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/files_external-settings.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types-DFCYS_Od.chunk.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)