Skip to content

Commit

Permalink
fix: edit single_svn bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ymh1028 committed Feb 5, 2020
1 parent 70a944b commit 650fe76
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/Forms/CICDs/BaseInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class BaseInfo extends React.Component {

return (
<RepoSelectForm
sourceData={formTemplate['multi-branch-pipeline']}
sourceData={formTemplate['multi_branch_pipeline']}
project_id={formTemplate.project_id}
name={formTemplate.name}
onSave={this.handleRepoChange}
Expand Down
19 changes: 14 additions & 5 deletions src/components/Forms/CICDs/RepoSelect/subForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ export default class RepoSelectForm extends React.Component {
(value, key) => key && key.startsWith('discover') && isEmpty(value)
),
}
// initial single_svn type in edit
if (this.source_type === 'single_svn') {
this.store.formData = {
svn_source: {
type: 'single_svn',
...this.store.formData.single_svn_source,
},
}
}
}
}

Expand Down Expand Up @@ -157,23 +166,23 @@ export default class RepoSelectForm extends React.Component {

renderTypes() {
const { enableTypeChange } = this.props

const sourceType =
this.source_type === 'single_svn' ? 'svn' : this.source_type
return (
<ul className={styles.repoTypes}>
{REPO_TYPES.map(type => (
<li
className={classNames({
[styles.selectType]: type.value === this.source_type,
[styles.disabled]:
!enableTypeChange && this.source_type !== type.value,
[styles.selectType]: type.value === sourceType,
[styles.disabled]: !enableTypeChange && sourceType !== type.value,
})}
key={type.value}
data-type={type.value}
onClick={this.handleTypeChange}
>
<Icon
name={type.icon}
type={type.value === this.source_type ? 'light' : 'dark'}
type={type.value === sourceType ? 'light' : 'dark'}
size={32}
/>
<span>{type.name}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/devops.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const updatePipelineParams = data => {
const { multi_branch_pipeline, pipeline, type, ...rest } = data
if (multi_branch_pipeline) {
rest && Object.assign(data.multi_branch_pipeline, rest)
data.type = 'multi-branch-pipeline'
data.type = 'multi_branch_pipeline'
deleteUnenableAttrs(data.multi_branch_pipeline)
} else {
if (data.pipeline) {
Expand Down

0 comments on commit 650fe76

Please sign in to comment.