mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(editor): Only redirect new users to blank canvas (no-changelog) (#5654)
* feat(editor): Bring new users to empty canvas * fix(editor): Revert empty /workflows redirect * Provide `COMMIT_INFO_BRANCH` and uncomment demo experiment * Only change redirect after set-up/sign-up to new canvas * Fix failing specs * Prevent redirect for demo experiment * Fix workflows cards spacing
This commit is contained in:
@@ -27,12 +27,13 @@ describe('Workflows', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
cy.signin({ email, password });
|
cy.signin({ email, password });
|
||||||
cy.visit('/');
|
cy.visit(WorkflowsPage.url);
|
||||||
cy.waitForLoad();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should land on empty canvas after registration', () => {
|
it('should create a new workflow using empty state card', () => {
|
||||||
cy.url().should('include', WorkflowPage.url);
|
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
||||||
|
WorkflowsPage.getters.newWorkflowButtonCard().click();
|
||||||
|
|
||||||
cy.createFixtureWorkflow('Test_workflow_1.json', `Empty State Card Workflow ${uuid()}`);
|
cy.createFixtureWorkflow('Test_workflow_1.json', `Empty State Card Workflow ${uuid()}`);
|
||||||
|
|
||||||
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-1');
|
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-1');
|
||||||
@@ -89,13 +90,5 @@ describe('Workflows', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
|
||||||
WorkflowsPage.getters.newWorkflowTemplateCard().should('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should redirect to new canvas if no workflows', () => {
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.visit(WorkflowsPage.url);
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.url().should('include', WorkflowPage.url);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { SettingsSidebar } from './sidebar/settings-sidebar';
|
import { SettingsSidebar } from './sidebar/settings-sidebar';
|
||||||
import { MainSidebar } from './sidebar/main-sidebar';
|
import { MainSidebar } from './sidebar/main-sidebar';
|
||||||
import { WorkflowPage } from './workflow';
|
import { WorkflowPage } from './workflow';
|
||||||
|
import { WorkflowsPage } from './workflows';
|
||||||
import { BasePage } from './base';
|
import { BasePage } from './base';
|
||||||
|
|
||||||
const workflowPage = new WorkflowPage();
|
const workflowPage = new WorkflowPage();
|
||||||
|
const workflowsPage = new WorkflowsPage();
|
||||||
const mainSidebar = new MainSidebar();
|
const mainSidebar = new MainSidebar();
|
||||||
const settingsSidebar = new SettingsSidebar();
|
const settingsSidebar = new SettingsSidebar();
|
||||||
|
|
||||||
@@ -39,7 +41,7 @@ export class SettingsUsersPage extends BasePage {
|
|||||||
settingsSidebar.getters.menuItem('Users').should('not.exist');
|
settingsSidebar.getters.menuItem('Users').should('not.exist');
|
||||||
// Should be redirected to workflows page if trying to access UM url
|
// Should be redirected to workflows page if trying to access UM url
|
||||||
cy.visit('/settings/users');
|
cy.visit('/settings/users');
|
||||||
cy.url().should('match', new RegExp(workflowPage.url));
|
cy.url().should('match', new RegExp(workflowsPage.url));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
opedDeleteDialog: (email: string) => {
|
opedDeleteDialog: (email: string) => {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ Cypress.Commands.add('waitForLoad', () => {
|
|||||||
|
|
||||||
Cypress.Commands.add('signin', ({ email, password }) => {
|
Cypress.Commands.add('signin', ({ email, password }) => {
|
||||||
const signinPage = new SigninPage();
|
const signinPage = new SigninPage();
|
||||||
const workflowPage = new WorkflowPage();
|
const workflowsPage = new WorkflowsPage();
|
||||||
|
|
||||||
cy.session(
|
cy.session(
|
||||||
[email, password],
|
[email, password],
|
||||||
@@ -74,10 +74,7 @@ Cypress.Commands.add('signin', ({ email, password }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// we should be redirected to /workflows
|
// we should be redirected to /workflows
|
||||||
cy.visit(workflowPage.url);
|
cy.url().should('include', workflowsPage.url);
|
||||||
cy.url().should('include', workflowPage.url);
|
|
||||||
cy.intercept('GET', '/rest/workflows/new').as('loading');
|
|
||||||
cy.wait('@loading');
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validate() {
|
validate() {
|
||||||
|
|||||||
@@ -14,13 +14,14 @@ import { showMessage } from '@/mixins/showMessage';
|
|||||||
|
|
||||||
import mixins from 'vue-typed-mixins';
|
import mixins from 'vue-typed-mixins';
|
||||||
import { IFormBoxConfig } from '@/Interface';
|
import { IFormBoxConfig } from '@/Interface';
|
||||||
import { VIEWS } from '@/constants';
|
import { VIEWS, ASSUMPTION_EXPERIMENT } from '@/constants';
|
||||||
import { restApi } from '@/mixins/restApi';
|
import { restApi } from '@/mixins/restApi';
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
import { useUIStore } from '@/stores/ui';
|
import { useUIStore } from '@/stores/ui';
|
||||||
import { useSettingsStore } from '@/stores/settings';
|
import { useSettingsStore } from '@/stores/settings';
|
||||||
import { useUsersStore } from '@/stores/users';
|
import { useUsersStore } from '@/stores/users';
|
||||||
import { useCredentialsStore } from '@/stores/credentials';
|
import { useCredentialsStore } from '@/stores/credentials';
|
||||||
|
import { usePostHog } from '@/stores/posthog';
|
||||||
|
|
||||||
export default mixins(showMessage, restApi).extend({
|
export default mixins(showMessage, restApi).extend({
|
||||||
name: 'SetupView',
|
name: 'SetupView',
|
||||||
@@ -100,6 +101,9 @@ export default mixins(showMessage, restApi).extend({
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useCredentialsStore, useSettingsStore, useUIStore, useUsersStore),
|
...mapStores(useCredentialsStore, useSettingsStore, useUIStore, useUsersStore),
|
||||||
|
isDemoTest(): boolean {
|
||||||
|
return usePostHog().isVariantEnabled(ASSUMPTION_EXPERIMENT.name, ASSUMPTION_EXPERIMENT.demo);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async confirmSetupOrGoBack(): Promise<boolean> {
|
async confirmSetupOrGoBack(): Promise<boolean> {
|
||||||
@@ -159,7 +163,7 @@ export default mixins(showMessage, restApi).extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (forceRedirectedHere) {
|
if (forceRedirectedHere) {
|
||||||
await this.$router.push({ name: VIEWS.HOMEPAGE });
|
await this.$router.push({ name: this.isDemoTest ? VIEWS.HOMEPAGE : VIEWS.NEW_WORKFLOW });
|
||||||
} else {
|
} else {
|
||||||
await this.$router.push({ name: VIEWS.USERS_SETTINGS });
|
await this.$router.push({ name: VIEWS.USERS_SETTINGS });
|
||||||
}
|
}
|
||||||
@@ -183,7 +187,7 @@ export default mixins(showMessage, restApi).extend({
|
|||||||
onSkip() {
|
onSkip() {
|
||||||
this.usersStore.skipOwnerSetup();
|
this.usersStore.skipOwnerSetup();
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: VIEWS.HOMEPAGE,
|
name: this.isDemoTest ? VIEWS.HOMEPAGE : VIEWS.NEW_WORKFLOW,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export default mixins(showMessage).extend({
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.$router.push({ name: VIEWS.HOMEPAGE });
|
await this.$router.push({ name: VIEWS.NEW_WORKFLOW });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$showError(error, this.$locale.baseText('auth.signup.setupYourAccountError'));
|
this.$showError(error, this.$locale.baseText('auth.signup.setupYourAccountError'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div :class="['text-center', 'mt-2xl', $style.actionsContainer]">
|
<div :class="['text-center', 'mt-2xl', $style.actionsContainer]">
|
||||||
<n8n-card
|
<n8n-card
|
||||||
:class="[$style.emptyStateCard, 'mr-s']"
|
:class="$style.emptyStateCard"
|
||||||
hoverable
|
hoverable
|
||||||
@click="addWorkflow"
|
@click="addWorkflow"
|
||||||
data-test-id="new-workflow-card"
|
data-test-id="new-workflow-card"
|
||||||
@@ -60,21 +60,15 @@
|
|||||||
</n8n-text>
|
</n8n-text>
|
||||||
</n8n-card>
|
</n8n-card>
|
||||||
<n8n-card
|
<n8n-card
|
||||||
|
v-if="isDemoTest"
|
||||||
:class="$style.emptyStateCard"
|
:class="$style.emptyStateCard"
|
||||||
hoverable
|
hoverable
|
||||||
@click="goToTemplates"
|
@click="goToTemplates"
|
||||||
data-test-id="new-workflow-template-card"
|
data-test-id="new-workflow-template-card"
|
||||||
>
|
>
|
||||||
<n8n-icon
|
<n8n-icon :class="$style.emptyStateCardIcon" icon="graduation-cap" />
|
||||||
:class="$style.emptyStateCardIcon"
|
|
||||||
:icon="isDemoTest ? 'graduation-cap' : 'box-open'"
|
|
||||||
/>
|
|
||||||
<n8n-text size="large" class="mt-xs" color="text-base">
|
<n8n-text size="large" class="mt-xs" color="text-base">
|
||||||
{{
|
{{ $locale.baseText('workflows.empty.viewDemo') }}
|
||||||
$locale.baseText(
|
|
||||||
isDemoTest ? 'workflows.empty.viewDemo' : 'workflows.empty.browseTemplates',
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</n8n-text>
|
</n8n-text>
|
||||||
</n8n-card>
|
</n8n-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -237,15 +231,6 @@ const WorkflowsView = mixins(showMessage, debounceHelper).extend({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
this.credentialsStore.fetchAllCredentials();
|
this.credentialsStore.fetchAllCredentials();
|
||||||
|
|
||||||
// If the user has no workflows and is not participating in the demo experiment,
|
|
||||||
// redirect to the new workflow view
|
|
||||||
if (!this.isDemoTest && this.allWorkflows.length === 0) {
|
|
||||||
this.uiStore.nodeViewInitialized = false;
|
|
||||||
this.$router.replace({ name: VIEWS.NEW_WORKFLOW });
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve();
|
|
||||||
},
|
},
|
||||||
onClickTag(tagId: string, event: PointerEvent) {
|
onClickTag(tagId: string, event: PointerEvent) {
|
||||||
if (!this.filters.tags.includes(tagId)) {
|
if (!this.filters.tags.includes(tagId)) {
|
||||||
@@ -304,6 +289,10 @@ export default WorkflowsView;
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
height: 230px;
|
height: 230px;
|
||||||
|
|
||||||
|
& + & {
|
||||||
|
margin-left: var(--spacing-s);
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
svg {
|
svg {
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
|
|||||||
Reference in New Issue
Block a user