filter out REST fields

This commit is contained in:
Gerard Burns 2023-06-26 14:27:09 +01:00
parent 88582b871e
commit 601a855f13
1 changed files with 30 additions and 26 deletions

View File

@ -71,8 +71,13 @@ export const createValidatedConfigStore = (integration, config) => {
const combined = derived( const combined = derived(
[configStore, errorsStore, selectedValidatorsStore], [configStore, errorsStore, selectedValidatorsStore],
([$configStore, $errorsStore, $selectedValidatorsStore]) => { ([$configStore, $errorsStore, $selectedValidatorsStore]) => {
const validatedConfig = Object.entries(integration.datasource).map( const validatedConfig = []
([key, properties]) => {
Object.entries(integration.datasource).forEach(([key, properties]) => {
if (integration.name === "REST" && key !== "rejectUnauthorized") {
return
}
const getValue = () => { const getValue = () => {
if (properties.type === "fieldGroup") { if (properties.type === "fieldGroup") {
return Object.entries(properties.fields).map( return Object.entries(properties.fields).map(
@ -90,15 +95,14 @@ export const createValidatedConfigStore = (integration, config) => {
return $configStore[key] return $configStore[key]
} }
return { validatedConfig.push({
key, key,
value: getValue(), value: getValue(),
error: $errorsStore[key], error: $errorsStore[key],
name: capitalise(properties.display || key), name: capitalise(properties.display || key),
type: properties.type, type: properties.type,
} })
} })
)
const allFieldsActive = const allFieldsActive =
Object.keys($selectedValidatorsStore).length === Object.keys($selectedValidatorsStore).length ===