Merge pull request #10144 from Budibase/BUDI-6791/fix_config_frontend
BUDI-6791 - Fix config frontend
This commit is contained in:
commit
1db9d4d23c
|
@ -24,7 +24,9 @@
|
||||||
try {
|
try {
|
||||||
await API.saveConfig({
|
await API.saveConfig({
|
||||||
type: configType,
|
type: configType,
|
||||||
enabled: scimEnabled,
|
config: {
|
||||||
|
enabled: scimEnabled,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
notifications.success(`Settings saved`)
|
notifications.success(`Settings saved`)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -36,7 +38,7 @@
|
||||||
async function fetchConfig() {
|
async function fetchConfig() {
|
||||||
try {
|
try {
|
||||||
const scimConfig = await API.getConfig(configType)
|
const scimConfig = await API.getConfig(configType)
|
||||||
scimEnabled = scimConfig?.enabled
|
scimEnabled = scimConfig?.config?.enabled
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
notifications.error("Error fetching SCIM config")
|
notifications.error("Error fetching SCIM config")
|
||||||
|
|
|
@ -39,7 +39,7 @@ export const createFeatureStore = () => {
|
||||||
...state,
|
...state,
|
||||||
scim: {
|
scim: {
|
||||||
...state.scim,
|
...state.scim,
|
||||||
isConfigFlagEnabled: scimConfig.enabled,
|
isConfigFlagEnabled: scimConfig?.config?.enabled,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,6 +58,13 @@ function oidcValidation() {
|
||||||
}).unknown(true)
|
}).unknown(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scimValidation() {
|
||||||
|
// prettier-ignore
|
||||||
|
return Joi.object({
|
||||||
|
enabled: Joi.boolean().required(),
|
||||||
|
}).unknown(true)
|
||||||
|
}
|
||||||
|
|
||||||
function buildConfigSaveValidation() {
|
function buildConfigSaveValidation() {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
return auth.joiValidator.body(Joi.object({
|
return auth.joiValidator.body(Joi.object({
|
||||||
|
@ -74,7 +81,8 @@ function buildConfigSaveValidation() {
|
||||||
{ is: ConfigType.SETTINGS, then: settingValidation() },
|
{ is: ConfigType.SETTINGS, then: settingValidation() },
|
||||||
{ is: ConfigType.ACCOUNT, then: Joi.object().unknown(true) },
|
{ is: ConfigType.ACCOUNT, then: Joi.object().unknown(true) },
|
||||||
{ is: ConfigType.GOOGLE, then: googleValidation() },
|
{ is: ConfigType.GOOGLE, then: googleValidation() },
|
||||||
{ is: ConfigType.OIDC, then: oidcValidation() }
|
{ is: ConfigType.OIDC, then: oidcValidation() },
|
||||||
|
{ is: ConfigType.SCIM, then: scimValidation() }
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
}).required().unknown(true),
|
}).required().unknown(true),
|
||||||
|
|
Loading…
Reference in New Issue