From 2177c0a24ac3feb97752b2c920fc29dbf56b3961 Mon Sep 17 00:00:00 2001 From: "toyamagu2021@gmail.com" Date: Sat, 20 May 2023 15:07:21 +0900 Subject: [PATCH] feat: add override checkbox and some minor changes Signed-off-by: toyamagu2021@gmail.com --- .../archived-workflow-details.tsx | 2 +- .../components/resubmit-workflow-panel.tsx | 72 ++++++++++++------- .../workflow-details/workflow-details.tsx | 2 +- ui/src/models/index.ts | 1 + 4 files changed, 50 insertions(+), 27 deletions(-) diff --git a/ui/src/app/archived-workflows/components/archived-workflow-details/archived-workflow-details.tsx b/ui/src/app/archived-workflows/components/archived-workflow-details/archived-workflow-details.tsx index 34dc897911d6..5f53ca43ce1e 100644 --- a/ui/src/app/archived-workflows/components/archived-workflow-details/archived-workflow-details.tsx +++ b/ui/src/app/archived-workflows/components/archived-workflow-details/archived-workflow-details.tsx @@ -171,7 +171,7 @@ export const ArchivedWorkflowDetails = ({history, location, match}: RouteCompone setSidePanel(null)}> {sidePanel === 'yaml' && } {sidePanel === 'logs' && } - {sidePanel === 'resubmit' && } + {sidePanel === 'resubmit' && } ); diff --git a/ui/src/app/workflows/components/resubmit-workflow-panel.tsx b/ui/src/app/workflows/components/resubmit-workflow-panel.tsx index 7ed921a176a0..3508ada91e93 100644 --- a/ui/src/app/workflows/components/resubmit-workflow-panel.tsx +++ b/ui/src/app/workflows/components/resubmit-workflow-panel.tsx @@ -1,6 +1,6 @@ import {Checkbox} from 'argo-ui'; import * as React from 'react'; -import {Parameter, Workflow} from '../../../models'; +import {Parameter, ResubmitOpts, Workflow} from '../../../models'; import {uiUrl} from '../../shared/base'; import {ErrorNotice} from '../../shared/components/error-notice'; import {ParametersInput} from '../../shared/components/parameters-input/parameters-input'; @@ -9,11 +9,11 @@ import {Utils} from '../../shared/utils'; interface Props { workflow: Workflow; - workflowParameters: Parameter[]; - isArchived?: boolean; + archived?: boolean; } interface State { + overrideParameters: boolean; workflowParameters: Parameter[]; memoized: boolean; error?: Error; @@ -24,9 +24,10 @@ export class ResubmitWorkflowPanel extends React.Component { constructor(props: any) { super(props); const state: State = { - workflowParameters: JSON.parse(JSON.stringify(this.props.workflowParameters)), + workflowParameters: JSON.parse(JSON.stringify(this.props.workflow.spec.arguments.parameters || [])), memoized: false, - isSubmitting: false + isSubmitting: false, + overrideParameters: false }; this.state = state; } @@ -34,34 +35,50 @@ export class ResubmitWorkflowPanel extends React.Component { public render() { return ( <> -

Submit Workflow

+

Resubmit Workflow

{this.props.workflow.metadata.namespace}/{this.props.workflow.metadata.name}
{this.state.error && }
-
- - {this.state.workflowParameters.length > 0 && ( - this.setState({workflowParameters})} /> - )} - {this.state.workflowParameters.length === 0 ? ( - <> -
- - - ) : ( - <> - )} +
+ +
+ this.setState({overrideParameters})} /> +
+ {this.state.overrideParameters && ( +
+ + {this.state.workflowParameters.length > 0 && ( + this.setState({workflowParameters})} /> + )} + {this.state.workflowParameters.length === 0 ? ( + <> +
+ + + ) : ( + <> + )} +
+ )} +
- +
this.setState({memoized})} />
+ {this.state.overrideParameters && this.state.memoized && ( +
+ + Overriding parameters on memoized submitted workflows may have unexpected results. +
+ )} +