refactor(core): Centralize module management (#16464)

Co-authored-by: Danny Martini <danny@n8n.io>
This commit is contained in:
Iván Ovejero
2025-06-19 14:32:31 +02:00
committed by GitHub
parent d0eb7a45ad
commit bb7c68f6bf
24 changed files with 328 additions and 134 deletions

View File

@@ -148,5 +148,5 @@ export const defaultSettings: FrontendSettings = {
evaluation: {
quota: 0,
},
loadedModules: [],
activeModules: [],
};

View File

@@ -112,7 +112,7 @@ const mainMenuItems = computed(() => [
position: 'bottom',
route: { to: { name: VIEWS.INSIGHTS } },
available:
settingsStore.settings.loadedModules.includes('insights') &&
settingsStore.settings.activeModules.includes('insights') &&
hasPermission(['rbac'], { rbac: { scope: 'insights:list' } }),
},
{

View File

@@ -19,7 +19,7 @@ export const useInsightsStore = defineStore('insights', () => {
);
const isInsightsEnabled = computed(() =>
settingsStore.settings.loadedModules.includes('insights'),
settingsStore.settings.activeModules.includes('insights'),
);
const isDashboardEnabled = computed(

View File

@@ -185,7 +185,7 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, () => {
const isDevRelease = computed(() => settings.value.releaseChannel === 'dev');
const loadedModules = computed(() => settings.value.loadedModules);
const activeModules = computed(() => settings.value.activeModules);
const setSettings = (newSettings: FrontendSettings) => {
settings.value = newSettings;
@@ -426,7 +426,7 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, () => {
getSettings,
setSettings,
initialize,
loadedModules,
activeModules,
getModuleSettings,
moduleSettings,
};

View File

@@ -46,7 +46,7 @@ let telemetry: ReturnType<typeof useTelemetry>;
describe('SigninView', () => {
const signInWithValidUser = async () => {
settingsStore.isCloudDeployment = false;
settingsStore.loadedModules = [];
settingsStore.activeModules = [];
usersStore.loginWithCreds.mockResolvedValueOnce();
const { getByRole, queryByTestId, container } = renderComponent();

View File

@@ -145,7 +145,7 @@ const login = async (form: LoginRequestDto) => {
}
await settingsStore.getSettings();
if (settingsStore.loadedModules.length > 0) {
if (settingsStore.activeModules.length > 0) {
await settingsStore.getModuleSettings();
}