From 4644591326e23d466f1364d097635610f69d10a6 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 2 Apr 2025 18:00:59 +0100 Subject: [PATCH 1/6] Improving the performance of the public configs endpoint on the worker, it was doing a lot of work in sync that could be done in parallel. --- .../src/api/controllers/global/configs.ts | 60 +++++++++++++------ 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/packages/worker/src/api/controllers/global/configs.ts b/packages/worker/src/api/controllers/global/configs.ts index 2433e0a82e..a43044537c 100644 --- a/packages/worker/src/api/controllers/global/configs.ts +++ b/packages/worker/src/api/controllers/global/configs.ts @@ -1,6 +1,6 @@ import * as email from "../../../utilities/email" import env from "../../../environment" -import { googleCallbackUrl, oidcCallbackUrl } from "./auth" +import * as auth from "./auth" import { cache, configs, @@ -420,13 +420,17 @@ export async function publicSettings( ) { try { // settings - const configDoc = await configs.getSettingsConfigDoc() + const [configDoc, googleConfig] = await Promise.all([ + configs.getSettingsConfigDoc(), + configs.getGoogleConfig(), + ]) const config = configDoc.config - const branding = await pro.branding.getBrandingConfig(config) + const brandingPromise = pro.branding.getBrandingConfig(config) // enrich the logo url - empty url means deleted if (config.logoUrl && config.logoUrl !== "") { + // pre-signed URLs are promises, but evaluate locally with nominal performance config.logoUrl = await objectStore.getGlobalFileUrl( "settings", "logoUrl", @@ -434,6 +438,37 @@ export async function publicSettings( ) } + // google + const googleDatasourcePromise = configs.getGoogleDatasourceConfig() + const preActivated = googleConfig && googleConfig.activated == null + const google = preActivated || !!googleConfig?.activated + const googleCallbackUrlPromise = auth.googleCallbackUrl(googleConfig) + + // oidc + const oidcConfigPromise = configs.getOIDCConfig() + const oidcCallbackUrlPromise = auth.oidcCallbackUrl() + + // sso enforced + const isSSOEnforcedPromise = pro.features.isSSOEnforced({ config }) + + // performance all async work at same time, there is no need for all of these + // operations to occur in sync, slowing the endpoint down significantly + const [ + branding, + googleDatasource, + googleCallbackUrl, + oidcConfig, + oidcCallbackUrl, + isSSOEnforced, + ] = await Promise.all([ + brandingPromise, + googleDatasourcePromise, + googleCallbackUrlPromise, + oidcConfigPromise, + oidcCallbackUrlPromise, + isSSOEnforcedPromise, + ]) + // enrich the favicon url - empty url means deleted const faviconUrl = branding.faviconUrl && branding.faviconUrl !== "" @@ -444,21 +479,8 @@ export async function publicSettings( ) : undefined - // google - const googleConfig = await configs.getGoogleConfig() - const googleDatasourceConfigured = - !!(await configs.getGoogleDatasourceConfig()) - const preActivated = googleConfig && googleConfig.activated == null - const google = preActivated || !!googleConfig?.activated - const _googleCallbackUrl = await googleCallbackUrl(googleConfig) - - // oidc - const oidcConfig = await configs.getOIDCConfig() const oidc = oidcConfig?.activated || false - const _oidcCallbackUrl = await oidcCallbackUrl() - - // sso enforced - const isSSOEnforced = await pro.features.isSSOEnforced({ config }) + const googleDatasourceConfigured = !!googleDatasource ctx.body = { type: ConfigType.SETTINGS, @@ -472,8 +494,8 @@ export async function publicSettings( googleDatasourceConfigured, oidc, isSSOEnforced, - oidcCallbackUrl: _oidcCallbackUrl, - googleCallbackUrl: _googleCallbackUrl, + oidcCallbackUrl, + googleCallbackUrl, }, } } catch (err: any) { From c7097adb9f65cc48c391784430ec36302abe6979 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 2 Apr 2025 18:12:39 +0100 Subject: [PATCH 2/6] Handle logo URL as well. --- .../src/api/controllers/global/configs.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/worker/src/api/controllers/global/configs.ts b/packages/worker/src/api/controllers/global/configs.ts index a43044537c..9255b8edb1 100644 --- a/packages/worker/src/api/controllers/global/configs.ts +++ b/packages/worker/src/api/controllers/global/configs.ts @@ -428,14 +428,15 @@ export async function publicSettings( const brandingPromise = pro.branding.getBrandingConfig(config) - // enrich the logo url - empty url means deleted - if (config.logoUrl && config.logoUrl !== "") { - // pre-signed URLs are promises, but evaluate locally with nominal performance - config.logoUrl = await objectStore.getGlobalFileUrl( - "settings", - "logoUrl", - config.logoUrlEtag - ) + const getLogoUrl = () => { + // enrich the logo url - empty url means deleted + if (config.logoUrl && config.logoUrl !== "") { + return objectStore.getGlobalFileUrl( + "settings", + "logoUrl", + config.logoUrlEtag + ) + } } // google @@ -460,6 +461,7 @@ export async function publicSettings( oidcConfig, oidcCallbackUrl, isSSOEnforced, + logoUrl, ] = await Promise.all([ brandingPromise, googleDatasourcePromise, @@ -467,6 +469,7 @@ export async function publicSettings( oidcConfigPromise, oidcCallbackUrlPromise, isSSOEnforcedPromise, + getLogoUrl(), ]) // enrich the favicon url - empty url means deleted @@ -481,6 +484,9 @@ export async function publicSettings( const oidc = oidcConfig?.activated || false const googleDatasourceConfigured = !!googleDatasource + if (logoUrl) { + config.logoUrl = logoUrl + } ctx.body = { type: ConfigType.SETTINGS, From 47f24d42ddd361f3fe9960fb5dc7329c9265959f Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 4 Apr 2025 09:31:40 +0100 Subject: [PATCH 3/6] External data connector picker readded and the layout adjusted. --- .../SetupPanel/AutomationSchemaLayout.svelte | 6 +++- .../SetupPanel/QueryParamSelector.svelte | 31 +++++++++---------- packages/builder/src/types/automations.ts | 1 + 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationSchemaLayout.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationSchemaLayout.svelte index 6011e2753d..762a416cf6 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationSchemaLayout.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationSchemaLayout.svelte @@ -184,6 +184,8 @@ }, [SchemaFieldTypes.QUERY_PARAMS]: { comp: QueryParamSelector, + fullWidth: true, + title: "Query*", }, [SchemaFieldTypes.CODE]: { comp: ExecuteScript, @@ -281,7 +283,9 @@ } const type = getFieldType(field, block) const config = type ? SchemaTypes[type] : null - const title = getFieldLabel(key, field, requiredProperties?.includes(key)) + const title = + config?.title || + getFieldLabel(key, field, requiredProperties?.includes(key)) const value = getInputValue(inputData, key) const meta = getInputValue(inputData, "meta") diff --git a/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte b/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte index eb97f9b02f..f05d3941bd 100644 --- a/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte @@ -1,9 +1,10 @@
-