Skip to content

Commit

Permalink
feat(workflows): fix navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
cocotime committed Sep 27, 2023
1 parent 741ac8f commit cb10884
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const routes: Routes = [
canDeactivate: [CanDeactivateGuard],
data: {
kanban: true,
reuseComponent: true,
reuseComponent: false,
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) => {
Expand All @@ -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) {
Expand Down

0 comments on commit cb10884

Please sign in to comment.