From bc5c400a1eee0ed3efe2fb0320920de3dbeaa6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Wed, 27 Sep 2023 13:05:02 +0200 Subject: [PATCH] feat(workflows): fix navigation --- .../project-feature-new-workflow.component.ts | 1 - .../project-feature-view-setter.component.ts | 23 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts b/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts index a1550d55a..4c7b80486 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts @@ -67,7 +67,6 @@ export class ProjectFeatureNewWorkflowComponent { public get getPreviousUrl(): string[] { const previousUrl = this.routeHistoryService.getPreviousUrl(); const project = this.state.get('project'); - console.log({ previousUrl }); return previousUrl ? [previousUrl] : [`/project/${project.id}${project.slug}/overview`]; diff --git a/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts b/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts index 2cf1d00e4..6e7eb1839 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts @@ -41,7 +41,7 @@ import { } from '@angular/router'; import { RxState } from '@rx-angular/state'; import { CommonModule } from '@angular/common'; -import { StoryDetail, StoryView, Project, Story } from '@taiga/data'; +import { StoryDetail, StoryView, Project, Story, Workflow } from '@taiga/data'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; interface ProjectFeatureViewSetterComponentState { @@ -99,11 +99,6 @@ export class ProjectFeatureViewSetterComponent implements OnDestroy { ) ); - this.state.connect( - 'isKanban', - this.state.select('url').pipe(map((url) => url.endsWith('/kanban'))) - ); - this.state.hold( this.state.select('kanbanHost').pipe(distinctUntilChanged(), filterNil()), (host) => { @@ -128,7 +123,21 @@ export class ProjectFeatureViewSetterComponent implements OnDestroy { ]) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(([url, data, params]) => { - if (!url.endsWith('/kanban') && !!data.stories) { + this.state.connect( + 'isKanban', + this.state + .select('url') + .pipe( + map((url) => + url.endsWith(`/kanban/${params.workflow as Workflow['slug']}`) + ) + ) + ); + + if ( + !url.endsWith(`/kanban/${params.workflow as Workflow['slug']}`) && + !!data.stories + ) { const storyParams = params as StoryParams; const needRedirect = params.slug !== (data.project as Project).slug; if (needRedirect) {