Skip to content

Commit

Permalink
Reset pipeline name in URI when closing flyout
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Apr 28, 2020
1 parent 0f83eaf commit e6b8489
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ export const PipelinesList: React.FunctionComponent<RouteComponentProps> = ({
}
}, [pipelineNameFromLocation, data]);

const editPipeline = (name: string) => {
const goToEditPipeline = (name: string) => {
history.push(encodeURI(`${BASE_PATH}/edit/${encodeURIComponent(name)}`));
};

const clonePipeline = (name: string) => {
const goToClonePipeline = (name: string) => {
history.push(encodeURI(`${BASE_PATH}/create/${encodeURIComponent(name)}`));
};

const goHome = () => {
setShowFlyout(false);
history.push(encodeURI(BASE_PATH));
};

let content: React.ReactNode;

if (isLoading) {
Expand All @@ -90,9 +95,9 @@ export const PipelinesList: React.FunctionComponent<RouteComponentProps> = ({
content = (
<PipelineTable
onReloadClick={sendRequest}
onEditPipelineClick={editPipeline}
onEditPipelineClick={goToEditPipeline}
onDeletePipelineClick={setPipelinesToDelete}
onClonePipelineClick={clonePipeline}
onClonePipelineClick={goToClonePipeline}
pipelines={data}
/>
);
Expand All @@ -110,10 +115,10 @@ export const PipelinesList: React.FunctionComponent<RouteComponentProps> = ({
pipeline={selectedPipeline}
onClose={() => {
setSelectedPipeline(undefined);
setShowFlyout(false);
goHome();
}}
onEditClick={editPipeline}
onCloneClick={clonePipeline}
onEditClick={goToEditPipeline}
onCloneClick={goToClonePipeline}
onDeleteClick={setPipelinesToDelete}
/>
);
Expand All @@ -123,7 +128,7 @@ export const PipelinesList: React.FunctionComponent<RouteComponentProps> = ({
return (
<PipelineNotFoundFlyout
onClose={() => {
setShowFlyout(false);
goHome();
}}
pipelineName={pipelineNameFromLocation}
/>
Expand Down

0 comments on commit e6b8489

Please sign in to comment.