refactor(editor): Do not make rest api calls for disabled features (no-changelog) (#9046)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-04-04 15:53:34 +02:00 committed by GitHub
parent 217b07d735
commit 637b6c4d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 17 deletions

View file

@ -24,6 +24,7 @@ export async function initializeCore() {
const versionsStore = useVersionsStore(); const versionsStore = useVersionsStore();
await settingsStore.initialize(); await settingsStore.initialize();
if (!settingsStore.isPreviewMode) {
await usersStore.initialize(); await usersStore.initialize();
void versionsStore.checkForNewVersions(); void versionsStore.checkForNewVersions();
@ -35,6 +36,7 @@ export async function initializeCore() {
console.error('Failed to initialize cloud hooks:', e); console.error('Failed to initialize cloud hooks:', e);
} }
} }
}
coreInitialized = true; coreInitialized = true;
} }

View file

@ -809,16 +809,22 @@ export default defineComponent({
this.clipboard.onPaste.value = this.onClipboardPasteEvent; this.clipboard.onPaste.value = this.onClipboardPasteEvent;
this.canvasStore.startLoading(); this.canvasStore.startLoading();
const loadPromises =
this.settingsStore.isPreviewMode && this.isDemo const loadPromises = (() => {
? [] if (this.settingsStore.isPreviewMode && this.isDemo) return [];
: [ const promises = [
this.loadActiveWorkflows(), this.loadActiveWorkflows(),
this.loadCredentials(), this.loadCredentials(),
this.loadCredentialTypes(), this.loadCredentialTypes(),
this.loadVariables(),
this.loadSecrets(),
]; ];
if (this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.Variables)) {
promises.push(this.loadVariables());
}
if (this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.ExternalSecrets)) {
promises.push(this.loadSecrets());
}
return promises;
})();
if (this.nodeTypesStore.allNodeTypes.length === 0) { if (this.nodeTypesStore.allNodeTypes.length === 0) {
loadPromises.push(this.loadNodeTypes()); loadPromises.push(this.loadNodeTypes());

View file

@ -19,6 +19,7 @@ const sortedProviders = computed(() => {
}); });
onMounted(() => { onMounted(() => {
if (!externalSecretsStore.isEnterpriseExternalSecretsEnabled) return;
try { try {
void externalSecretsStore.fetchAllSecrets(); void externalSecretsStore.fetchAllSecrets();
void externalSecretsStore.getProviders(); void externalSecretsStore.getProviders();

View file

@ -112,6 +112,7 @@ const initialize = async () => {
}; };
onMounted(async () => { onMounted(async () => {
if (!sourceControlStore.isEnterpriseSourceControlEnabled) return;
await initialize(); await initialize();
}); });

View file

@ -116,6 +116,7 @@ function resetNewVariablesList() {
} }
async function initialize() { async function initialize() {
if (!isFeatureEnabled.value) return;
await environmentsStore.fetchAllVariables(); await environmentsStore.fetchAllVariables();
allVariables.value = [...environmentsStore.variables]; allVariables.value = [...environmentsStore.variables];