feat(editor): Redirect users to canvas if they don't have any workflows (#5629)

* feat(editor): Bring new users to empty canvas

* Fix failing e2e tests and revert CLI implementation

* Revert editor-ui Interface changes

* Try to mock /settings and /active

* Revert canvas test changes, reload after executions in 20-workflow-executions

* Make sure we include manual executiosn before running them in 20-workflow-executions

* Make sure to re-init node view when replacing empty workflows route, show phantom loader
This commit is contained in:
OlegIvaniv
2023-03-08 15:11:13 +01:00
committed by GitHub
parent 0b6fa6b20e
commit 354edf6886
23 changed files with 62 additions and 78 deletions

View File

@@ -3,11 +3,11 @@
ref="layout"
resource-key="workflows"
:resources="allWorkflows"
:initialize="initialize"
:filters="filters"
:additional-filters-handler="onFilter"
:show-aside="allWorkflows.length > 0"
:shareable="isShareable"
:initialize="initialize"
@click:add="addWorkflow"
@update:filters="filters = $event"
>
@@ -148,7 +148,7 @@ const StatusFilter = {
ALL: '',
};
export default mixins(showMessage, debounceHelper, newVersions).extend({
const WorkflowsView = mixins(showMessage, debounceHelper, newVersions).extend({
name: 'WorkflowsView',
components: {
ResourcesListLayout,
@@ -224,12 +224,20 @@ export default mixins(showMessage, debounceHelper, newVersions).extend({
}
},
async initialize() {
this.usersStore.fetchUsers(); // Can be loaded in the background, used for filtering
return await Promise.all([
await Promise.all([
this.usersStore.fetchUsers(),
this.workflowsStore.fetchAllWorkflows(),
this.workflowsStore.fetchActiveWorkflows(),
]);
// 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) {
if (!this.filters.tags.includes(tagId)) {
@@ -273,6 +281,8 @@ export default mixins(showMessage, debounceHelper, newVersions).extend({
this.usersStore.showPersonalizationSurvey();
},
});
export default WorkflowsView;
</script>
<style lang="scss" module>