Skip to content

Commit

Permalink
fix: Fix the bug when editing the pipeline and add sortBy in the cred…
Browse files Browse the repository at this point in the history
…ential

Signed-off-by: harrisonliu5 harrisonliu_5@163.com
  • Loading branch information
harrisonliu5 committed Aug 2, 2020
1 parent 4975ca8 commit 4e1968d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/components/Forms/CICDs/AdvanceSettings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export default class AdvanceSettings extends React.Component {
}

componentDidMount() {
const { project_name, cluster } = this.props.formTemplate

const { project_name, cluster, devops } = this.props.formTemplate
this.pipelineStore.fetchList({
project_name,
devopsName: project_name,
devops,
cluster,
filter: 'no-multi-branch-job',
})
Expand Down Expand Up @@ -152,16 +152,17 @@ export default class AdvanceSettings extends React.Component {
}

handleScrollToBottom = () => {
const { project_name, cluster } = this.props.formTemplate
const { project_name, cluster, devops } = this.props.formTemplate
const { total, page, limit } = this.pipelineStore.list

if (total <= limit * page) {
return
}

this.pipelineStore.fetchList({
project_name,
devopsName: project_name,
cluster,
devops,
filter: 'no-multi-branch-job',
page: page + 1,
})
Expand Down
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 @@ -73,7 +73,7 @@ export default class BaseInfo extends React.Component {
.checkPipelineName({
name: value,
cluster: this.props.cluster,
project_name: this.props.formTemplate.project_name,
devops: this.props.devops,
})
.then(resp => {
if (resp.exist) {
Expand Down
4 changes: 4 additions & 0 deletions src/components/Forms/CICDs/RepoSelect/BitBucketForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import styles from './index.scss'

@observer
export default class BitBucketForm extends GitHubForm {
state = {
isLoading: false,
}

get scmType() {
return 'bitbucket_server'
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/devops/containers/Credential/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Credential extends React.Component {
: null

const isEmptyList = isLoading === false && total === 0 && data.length <= 0
const omitFilters = omit(filters, ['page', 'limit'])
const omitFilters = omit(filters, ['page', 'limit', 'sortBy'])

if (isEmptyList) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default class EditPipelineConfig extends React.Component {
type="edit"
formRef={this.formRef}
formTemplate={this.state.formTemplate}
devops={this.props.devops}
/>
</Modal>
)
Expand Down
8 changes: 7 additions & 1 deletion src/pages/devops/containers/Pipelines/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class CICDs extends React.Component {
this.formTemplate = {
project_name: this.props.devopsStore.devopsName,
cluster: this.cluster,
devops: this.devops,
enable_timer_trigger: true,
enable_discarder: true,
}
Expand Down Expand Up @@ -256,7 +257,12 @@ class CICDs extends React.Component {
}

showEditConfig = async name => {
await this.store.fetchDetail({ cluster: this.cluster, name })
await this.store.fetchDetail({
cluster: this.cluster,
name,
devops: this.devops,
})

const formData = this.store.getPipeLineConfig()
formData.devops = this.devops

Expand Down
2 changes: 2 additions & 0 deletions src/stores/devops/credential.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export default class CredentialStore extends BaseStore {
filters.limit = filters.limit || 10
}

filters.sortBy = filters.sortBy || 'createTime'

const result = await this.request.get(
this.getResourceUrl({ devops, cluster }),
{
Expand Down
4 changes: 2 additions & 2 deletions src/stores/devops/pipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ export default class PipelineStore extends BaseStore {
}

@action
async checkPipelineName({ name, cluster, project_name }) {
async checkPipelineName({ name, cluster, devops }) {
return await this.request.get(
`${this.getDevOpsUrl({ cluster })}/${project_name}/pipelines/${name}`,
`${this.getDevOpsUrl({ cluster })}/${devops}/pipelines/${name}`,
{},
{
headers: { 'x-check-exist': true },
Expand Down

0 comments on commit 4e1968d

Please sign in to comment.