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="d-flex justify-content-end align-items-center header-container">
<div class="pipeline-name"> <div class="pipeline-name">
Editing {{pipelineData?.name}} <!-- Editing {{pipelineData?.name}} -->
</div> </div>
<!-- <sm-clear-filters-button <!-- <sm-clear-filters-button
*ngIf="!minimizedView" *ngIf="!minimizedView"

View File

@ -13,12 +13,11 @@ import {
updatePipeline, updatePipeline,
compilePipeline, compilePipeline,
runPipeline, runPipeline,
setSelectedPipeline,
updatePipelineStep, updatePipelineStep,
deletePipelineStep, deletePipelineStep,
} from "../pipelines.actions"; } from "../pipelines.actions";
import { selectRouterParams } from "@common/core/reducers/router-reducer"; 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 { Params } from "@angular/router";
import { selectSelectedPipeline } from "../pipelines.reducer"; import { selectSelectedPipeline } from "../pipelines.reducer";
import { import {
@ -28,6 +27,14 @@ import {
} from "~/business-logic/model/pipelines/models"; } from "~/business-logic/model/pipelines/models";
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import { ArtifactModeEnum } from "~/business-logic/model/tasks/models"; 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({ @Component({
selector: "sm-edit-pipeline-page", selector: "sm-edit-pipeline-page",
@ -45,6 +52,9 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
public selectedStepInputOutputOptions: Array<PipelinesStepInputOutputMappingOptions>; public selectedStepInputOutputOptions: Array<PipelinesStepInputOutputMappingOptions>;
pipelineId: string; pipelineId: string;
// for breadcrumb
public selectedProject$: Observable<Project>;
//// nodes and edges state should be managed here for local use //// nodes and edges state should be managed here for local use
// changes will be propagated to store only after clicking on save. // changes will be propagated to store only after clicking on save.
private reactFlowState = { nodes: [], edges: [] }; private reactFlowState = { nodes: [], edges: [] };
@ -80,30 +90,30 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
}); });
} }
if(node.data?.experimentDetails?.models?.output?.length) { if (node.data?.experimentDetails?.models?.output?.length) {
// models i/o mapping. // models i/o mapping.
node.data.experimentDetails.models.output.forEach((model) => { node.data.experimentDetails.models.output.forEach((model) => {
options.push({ options.push({
...model, ...model,
stepName: node.data.name, stepName: node.data.name,
id: model.model.id, id: model.model.id,
type: "model", type: "model",
key: model.name key: model.name,
});
}); });
});
} }
}); });
// add pipeline parameters // add pipeline parameters
if(this.selectedPipeline?.parameters?.length) { if (this.selectedPipeline?.parameters?.length) {
this.selectedPipeline.parameters.forEach((param) => { this.selectedPipeline.parameters.forEach((param) => {
options.push({ options.push({
...param, ...param,
stepName: this.selectedPipeline.name, stepName: this.selectedPipeline.name,
type: "pipeline_parameter", type: "pipeline_parameter",
key: param.name key: param.name,
}); });
}) });
} }
this.selectedStepInputOutputOptions = options; this.selectedStepInputOutputOptions = options;
@ -135,12 +145,50 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
console.log(pipelineData); 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() { ngOnDestroy() {
this.subs.unsubscribe(); this.subs.unsubscribe();
this.store.dispatch(resetPipelines()); this.store.dispatch(resetPipelines());
this.store.dispatch(resetPipelinesSearchQuery()); this.store.dispatch(resetPipelinesSearchQuery());
this.store.dispatch(setTags({ tags: [] }));
} }
savePipeline() { savePipeline() {
@ -253,7 +301,7 @@ export class EditPipelinePageComponent implements OnInit, OnDestroy {
this.reactFlowState.nodes = cloneDeep(filteredNodes); this.reactFlowState.nodes = cloneDeep(filteredNodes);
this.reactFlowState.edges = cloneDeep(filteredEdges); this.reactFlowState.edges = cloneDeep(filteredEdges);
console.log(this.reactFlowState); console.log(this.reactFlowState);
setTimeout(() => this.savePipeline(), 1000) setTimeout(() => this.savePipeline(), 1000);
this.selectedStep = null; this.selectedStep = null;
} }

View File

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

View File

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