mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Improve instance owner setup and add unit tests (no-changelog) (#5499)
* refactor(core): Avoid fetching all workflows and credentials for the owner setup screen * refactor(core): Add unit tests for the owner controller
This commit is contained in:
committed by
GitHub
parent
12104bc4a3
commit
561882f599
@@ -28,9 +28,9 @@ export default mixins(showMessage, restApi).extend({
|
||||
AuthView,
|
||||
},
|
||||
async mounted() {
|
||||
const getAllCredentialsPromise = this.getAllCredentials();
|
||||
const getAllWorkflowsPromise = this.getAllWorkflows();
|
||||
await Promise.all([getAllCredentialsPromise, getAllWorkflowsPromise]);
|
||||
const { credentials, workflows } = await this.usersStore.preOwnerSetup();
|
||||
this.credentialsCount = credentials;
|
||||
this.workflowsCount = workflows;
|
||||
},
|
||||
data() {
|
||||
const FORM_CONFIG: IFormBoxConfig = {
|
||||
@@ -102,14 +102,6 @@ export default mixins(showMessage, restApi).extend({
|
||||
...mapStores(useCredentialsStore, useSettingsStore, useUIStore, useUsersStore),
|
||||
},
|
||||
methods: {
|
||||
async getAllCredentials() {
|
||||
const credentials = await this.credentialsStore.fetchAllCredentials();
|
||||
this.credentialsCount = credentials.length;
|
||||
},
|
||||
async getAllWorkflows() {
|
||||
const workflows = await this.restApi().getWorkflows();
|
||||
this.workflowsCount = workflows.length;
|
||||
},
|
||||
async confirmSetupOrGoBack(): Promise<boolean> {
|
||||
if (this.workflowsCount === 0 && this.credentialsCount === 0) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user