diff --git a/packages/frontend-2/lib/projects/composables/automationManagement.ts b/packages/frontend-2/lib/projects/composables/automationManagement.ts index 95807aae0d..9d9a522a81 100644 --- a/packages/frontend-2/lib/projects/composables/automationManagement.ts +++ b/packages/frontend-2/lib/projects/composables/automationManagement.ts @@ -190,7 +190,12 @@ export const useProjectTriggeredAutomationsStatusUpdateTracking = (params: { () => `useProjectTriggeredAutomationsStatusUpdateTracking-${unref(projectId)}` ) ) - const isEnabled = computed(() => !!(hasLock.value || handler)) + // const isEnabled = computed(() => !!(hasLock.value || handler)) + + const isAutomateModuleEnabled = useIsAutomateModuleEnabled() + const isEnabled = computed( + () => isAutomateModuleEnabled.value && !!(hasLock.value || handler) + ) const { onResult } = useSubscription( onProjectTriggeredAutomationsStatusUpdatedSubscription, @@ -276,7 +281,12 @@ export const useProjectAutomationsUpdateTracking = (params: { const { hasLock } = useLock( computed(() => `useProjectAutomationsUpdateTracking-${unref(projectId)}`) ) - const isEnabled = computed(() => !!(hasLock.value || handler)) + // const isEnabled = computed(() => !!(hasLock.value || handler)) + + const isAutomateModuleEnabled = useIsAutomateModuleEnabled() + const isEnabled = computed( + () => isAutomateModuleEnabled.value && !!(hasLock.value || handler) + ) const { onResult } = useSubscription( onProjectAutomationsUpdatedSubscription, diff --git a/packages/server/modules/index.js b/packages/server/modules/index.js index cf0ddfeaaf..ef6178efe7 100644 --- a/packages/server/modules/index.js +++ b/packages/server/modules/index.js @@ -8,6 +8,7 @@ const { scalarResolvers } = require('./core/graph/scalars') const { makeExecutableSchema } = require('@graphql-tools/schema') const { moduleLogger } = require('@/logging/logging') const { addMocksToSchema } = require('@graphql-tools/mock') +const { Environment } = require('@speckle/shared') /** * Cached speckle module requires @@ -40,31 +41,39 @@ function autoloadFromDirectory(dirPath) { return results } +const getEnabledModuleNames = () => { + const { FF_AUTOMATE_MODULE_ENABLED } = Environment.getFeatureFlags() + const moduleNames = [ + 'accessrequests', + 'activitystream', + 'apiexplorer', + 'auth', + 'betaAutomations', + 'blobstorage', + 'comments', + 'core', + 'cross-server-sync', + 'emails', + 'fileuploads', + 'notifications', + 'previews', + 'pwdreset', + 'serverinvites', + 'stats', + 'webhooks' + ] + + if (FF_AUTOMATE_MODULE_ENABLED) moduleNames.push('automate') + return moduleNames +} + async function getSpeckleModules() { if (loadedModules.length) return loadedModules - const moduleDirs = [ - './core', - './auth', - './apiexplorer', - './emails', - './pwdreset', - './serverinvites', - './previews', - './fileuploads', - './comments', - './blobstorage', - './notifications', - './activitystream', - './accessrequests', - './webhooks', - './cross-server-sync', - './betaAutomations', - './automate' - ] + const moduleNames = getEnabledModuleNames() - for (const dir of moduleDirs) { - loadedModules.push(require(dir)) + for (const dir of moduleNames) { + loadedModules.push(require(`./${dir}`)) } return loadedModules @@ -107,9 +116,13 @@ const graphComponents = () => { let resolverObjs = [] let directiveBuilders = {} + const enabledModules = getEnabledModuleNames() + // load typedefs from /assets const assetModuleDirs = fs.readdirSync(`${packageRoot}/assets`) assetModuleDirs.forEach((dir) => { + // if module is not in the enabled modules list, skip loading the gql schema + // if (!enabledModules.includes(dir)) return const typeDefDirPath = path.join(`${packageRoot}/assets`, dir, 'typedefs') if (fs.existsSync(typeDefDirPath)) { const moduleSchemas = fs.readdirSync(typeDefDirPath) @@ -122,6 +135,8 @@ const graphComponents = () => { // load code modules from /modules const codeModuleDirs = fs.readdirSync(`${appRoot}/modules`) codeModuleDirs.forEach((file) => { + // if module is not in the enabled modules list, skip loading the gql resolvers + if (!enabledModules.includes(file)) return const fullPath = path.join(`${appRoot}/modules`, file) // first pass load of resolvers diff --git a/utils/helm/speckle-server/templates/frontend_2/deployment.yml b/utils/helm/speckle-server/templates/frontend_2/deployment.yml index e961dc7bdc..8150300c1c 100644 --- a/utils/helm/speckle-server/templates/frontend_2/deployment.yml +++ b/utils/helm/speckle-server/templates/frontend_2/deployment.yml @@ -125,7 +125,7 @@ spec: - name: NUXT_PUBLIC_DATADOG_ENV value: {{ .Values.analytics.datadog_env | quote }} {{- end }} - - name: FF_AUTOMATE_MODULE_ENABLED + - name: NUXT_PUBLIC_FF_AUTOMATE_MODULE_ENABLED value: {{ .Values.featureFlags.automateModuleEnabled | quote }} {{- if .Values.analytics.survicate_workspace_key }} - name: NUXT_PUBLIC_SURVICATE_WORKSPACE_KEY