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

View file

@ -809,16 +809,22 @@ export default defineComponent({
this.clipboard.onPaste.value = this.onClipboardPasteEvent;
this.canvasStore.startLoading();
const loadPromises =
this.settingsStore.isPreviewMode && this.isDemo
? []
: [
const loadPromises = (() => {
if (this.settingsStore.isPreviewMode && this.isDemo) return [];
const promises = [
this.loadActiveWorkflows(),
this.loadCredentials(),
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) {
loadPromises.push(this.loadNodeTypes());

View file

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

View file

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

View file

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