Resolved issue with breadcrumb

This commit is contained in:
Shubham Takode 2024-03-04 16:49:06 +05:30
parent 11ff442447
commit 7f88d69882
4 changed files with 70 additions and 20 deletions

View File

@ -1,6 +1,6 @@
<div class="d-flex justify-content-end align-items-center header-container">
<div class="pipeline-name">
Editing {{pipelineData?.name}}
<!-- Editing {{pipelineData?.name}} -->
</div>
<!-- <sm-clear-filters-button
*ngIf="!minimizedView"

View File

@ -13,12 +13,11 @@ import {
updatePipeline,
compilePipeline,
runPipeline,
setSelectedPipeline,
updatePipelineStep,
deletePipelineStep,
} from "../pipelines.actions";
import { selectRouterParams } from "@common/core/reducers/router-reducer";
import { Observable, Subscription, map } from "rxjs";
import { Observable, Subscription, combineLatest, map } from "rxjs";
import { Params } from "@angular/router";
import { selectSelectedPipeline } from "../pipelines.reducer";
import {
@ -28,6 +27,14 @@ import {
} from "~/business-logic/model/pipelines/models";
import { cloneDeep } from "lodash-es";
import { ArtifactModeEnum } from "~/business-logic/model/tasks/models";
import {
selectSelectedProject,
} from "@common/core/reducers/projects.reducer";
import {
setBreadcrumbsOptions,
setTags,
} from "@common/core/actions/projects.actions";
import { Project } from "~/business-logic/model/projects/project";
@Component({
selector: "sm-edit-pipeline-page",
@ -45,6 +52,9 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
public selectedStepInputOutputOptions: Array<PipelinesStepInputOutputMappingOptions>;
pipelineId: string;
// for breadcrumb
public selectedProject$: Observable<Project>;
//// nodes and edges state should be managed here for local use
// changes will be propagated to store only after clicking on save.
private reactFlowState = { nodes: [], edges: [] };
@ -80,7 +90,7 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
});
}
if(node.data?.experimentDetails?.models?.output?.length) {
if (node.data?.experimentDetails?.models?.output?.length) {
// models i/o mapping.
node.data.experimentDetails.models.output.forEach((model) => {
options.push({
@ -88,22 +98,22 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
stepName: node.data.name,
id: model.model.id,
type: "model",
key: model.name
key: model.name,
});
});
}
});
// add pipeline parameters
if(this.selectedPipeline?.parameters?.length) {
if (this.selectedPipeline?.parameters?.length) {
this.selectedPipeline.parameters.forEach((param) => {
options.push({
...param,
stepName: this.selectedPipeline.name,
type: "pipeline_parameter",
key: param.name
key: param.name,
});
});
})
}
this.selectedStepInputOutputOptions = options;
@ -135,12 +145,50 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
console.log(pipelineData);
})
);
this.selectedProject$ = this.store.select(selectSelectedProject);
this.setupBreadcrumbsOptions();
}
setupBreadcrumbsOptions() {
this.subs.add(
combineLatest([this.selectedPipeline$, this.selectedProject$]).subscribe(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
([selectedPipeline, selectedProject]) => {
this.store.dispatch(
setBreadcrumbsOptions({
breadcrumbOptions: {
showProjects: false,
featureBreadcrumb: {
name: "PIPELINES",
url: "pipelines",
},
subFeatureBreadcrumb: {
name: "Edit",
},
projectsOptions: {
basePath: "pipelines",
filterBaseNameWith: [".pipelines"],
compareModule: null,
showSelectedProject: true,
selectedProjectBreadcrumb: {
name: selectedPipeline.name,
},
},
},
})
);
}
)
);
}
ngOnDestroy() {
this.subs.unsubscribe();
this.store.dispatch(resetPipelines());
this.store.dispatch(resetPipelinesSearchQuery());
this.store.dispatch(setTags({ tags: [] }));
}
savePipeline() {
@ -253,7 +301,7 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
this.reactFlowState.nodes = cloneDeep(filteredNodes);
this.reactFlowState.edges = cloneDeep(filteredEdges);
console.log(this.reactFlowState);
setTimeout(() => this.savePipeline(), 1000)
setTimeout(() => this.savePipeline(), 1000);
this.selectedStep = null;
}

View File

@ -139,12 +139,12 @@ if __name__ == '__main__':
this.router.navigate([pipeline.id, /* pipeline.basename, */ "edit"], {
relativeTo: this.projectId ? this.route.parent.parent.parent : this.route,
});
this.store.dispatch(
/* this.store.dispatch(
setSelectedProjectId({
projectId: pipeline.id,
example: isExample(pipeline),
})
);
); */
}
protected override getName() {

View File

@ -123,6 +123,8 @@ export const pipelinesReducers = [
scrollId: null,
noMorePipelines: pipelinesInitState.noMorePipelines,
pipelines: pipelinesInitState.pipelines,
selectedProjectId: pipelinesInitState.selectedProjectId,
selectedPipeline: pipelinesInitState.selectedPipeline
})),
on(setPipelinesOrderBy, (state, action) => ({
...state,