From 2063adc6c0d9b3951bef6b0aa4b34348a742e1c6 Mon Sep 17 00:00:00 2001 From: ajnart Date: Sat, 18 Mar 2023 18:29:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20Add=20console=20warn=20if=20app?= =?UTF-8?q?s=20are=20missing=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/config/getFrontendConfig.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tools/config/getFrontendConfig.ts b/src/tools/config/getFrontendConfig.ts index c968c9b28..c208e81e7 100644 --- a/src/tools/config/getFrontendConfig.ts +++ b/src/tools/config/getFrontendConfig.ts @@ -7,6 +7,22 @@ export const getFrontendConfig = (name: string): ConfigType => { const config = getConfig(name); Consola.info(`Requested frontend content of configuration '${name}'`); + // Find out if config as apps with integrations that have a property with no value or undefined + // If so, remove print an error using consola + // If not, return the config + const appsWithIntegrationsWithUndefinedProperties = config.apps.filter( + (app) => + app.integration?.properties.some( + (property) => property.value === null || property.value === undefined + ) ?? false + ); + if (appsWithIntegrationsWithUndefinedProperties.length > 0) { + Consola.warn( + `The following apps have integrations with errored properties: [${appsWithIntegrationsWithUndefinedProperties + .map((app) => app.name) + .join(', ')}] please input the correct secrets once again for the concerned app(s), save them, exit edit mode and reload the page.` + ); + } return { ...config, From f1e39ba91159af20c753396381bd66f6ff65b98e Mon Sep 17 00:00:00 2001 From: ajnart Date: Mon, 3 Apr 2023 15:57:11 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=92=A1=20Address=20PR=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/config/getFrontendConfig.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/tools/config/getFrontendConfig.ts b/src/tools/config/getFrontendConfig.ts index c208e81e7..1a910c065 100644 --- a/src/tools/config/getFrontendConfig.ts +++ b/src/tools/config/getFrontendConfig.ts @@ -7,18 +7,16 @@ export const getFrontendConfig = (name: string): ConfigType => { const config = getConfig(name); Consola.info(`Requested frontend content of configuration '${name}'`); - // Find out if config as apps with integrations that have a property with no value or undefined - // If so, remove print an error using consola // If not, return the config - const appsWithIntegrationsWithUndefinedProperties = config.apps.filter( + const someAppsWithoutProps = config.apps.filter( (app) => app.integration?.properties.some( (property) => property.value === null || property.value === undefined ) ?? false ); - if (appsWithIntegrationsWithUndefinedProperties.length > 0) { + if (someAppsWithoutProps.length > 0) { Consola.warn( - `The following apps have integrations with errored properties: [${appsWithIntegrationsWithUndefinedProperties + `There are apps that have missing configuration options: [${someAppsWithoutProps .map((app) => app.name) .join(', ')}] please input the correct secrets once again for the concerned app(s), save them, exit edit mode and reload the page.` ); From 217e5b861f2f8265437f223bc4efc74aaf0b0872 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 06:57:28 +0000 Subject: [PATCH 3/3] style: Format code with prettier --- src/tools/config/getFrontendConfig.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/config/getFrontendConfig.ts b/src/tools/config/getFrontendConfig.ts index 1a910c065..376522d4c 100644 --- a/src/tools/config/getFrontendConfig.ts +++ b/src/tools/config/getFrontendConfig.ts @@ -18,7 +18,9 @@ export const getFrontendConfig = (name: string): ConfigType => { Consola.warn( `There are apps that have missing configuration options: [${someAppsWithoutProps .map((app) => app.name) - .join(', ')}] please input the correct secrets once again for the concerned app(s), save them, exit edit mode and reload the page.` + .join( + ', ' + )}] please input the correct secrets once again for the concerned app(s), save them, exit edit mode and reload the page.` ); }