diff --git a/src/components/Forms/CICDs/RepoSelect/GithubForm/index.jsx b/src/components/Forms/CICDs/RepoSelect/GithubForm/index.jsx index ebadb91fdf1..8b1f036c5d1 100644 --- a/src/components/Forms/CICDs/RepoSelect/GithubForm/index.jsx +++ b/src/components/Forms/CICDs/RepoSelect/GithubForm/index.jsx @@ -88,6 +88,9 @@ export default class GitHubForm extends React.Component { handlePasswordConfirm = async () => { const { name, cluster, project_id } = this.props const data = this.tokenFormRef.current.getData() + + if (isEmpty(data)) return false + this.setState({ isLoading: true }) this.props.store .putAccessToken({ token: data.token, name, cluster, project_id }) diff --git a/src/components/Forms/CICDs/RepoSelect/subForm.jsx b/src/components/Forms/CICDs/RepoSelect/subForm.jsx index e51bf809558..2aada5ba2cc 100644 --- a/src/components/Forms/CICDs/RepoSelect/subForm.jsx +++ b/src/components/Forms/CICDs/RepoSelect/subForm.jsx @@ -66,6 +66,7 @@ export default class RepoSelectForm extends React.Component { @observable source_type = 'github' + @observable showCredential = false diff --git a/src/components/Forms/CICDs/paramsModal.jsx b/src/components/Forms/CICDs/paramsModal.jsx index 3ac26f369cb..9b7dbc77041 100644 --- a/src/components/Forms/CICDs/paramsModal.jsx +++ b/src/components/Forms/CICDs/paramsModal.jsx @@ -97,7 +97,9 @@ export default class ParamsModal extends React.Component { } init = async () => { - const parameters = await this.getParametersFromBranch(this.branch) + const parameters = this.branch + ? await this.getParametersFromBranch(this.branch) + : this.props.parameters this.setState({ currentBranch: this.branch, parameters, @@ -114,19 +116,26 @@ export default class ParamsModal extends React.Component { } handleOk = () => { - const { branch, ...parameters } = this.formRef.current.getData() + const { branch, ...formParameters } = this.formRef.current.getData() + const { parameters } = this.state this.formRef.current.validate(() => { - const params = Object.keys(parameters).map(key => ({ - name: key, - value: parameters[key], - })) + const params = isEmpty(formParameters) + ? parameters.map(item => ({ + name: item.name, + value: '', + })) + : Object.keys(formParameters).map(key => ({ + name: key, + value: parameters[key], + })) + this.props.onOk(params, branch) }) } renderParamsItem(param) { const type = param.type.toLowerCase().split('parameterdefinition')[0] - + const defaultValue = get(param, 'defaultParameterValue.value') switch (type) { case 'string': return ( @@ -135,10 +144,7 @@ export default class ParamsModal extends React.Component { label={param.name} desc={param.description} > - + ) case 'text': @@ -148,10 +154,7 @@ export default class ParamsModal extends React.Component { label={param.name} desc={param.description} > -