Skip to content

Commit

Permalink
Merge pull request #1136 from harrisonliu5/fix-issues
Browse files Browse the repository at this point in the history
fix: Fix the name's length limitation and the description don't displayed in pipeline.
  • Loading branch information
ks-ci-bot authored Aug 10, 2020
2 parents b9d299c + f06b8e2 commit 8ed527e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions src/components/Forms/CICDs/BaseInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export default class BaseInfo extends React.Component {
{ validator: this.validator },
]}
>
<Input name="name" />
<Input name="name" maxLength={63} />
</Form.Item>
<Form.Item label={t('Description')}>
<TextArea name="desc" />
<Form.Item label={t('Description')} desc={t('DESCRIPTION_DESC')}>
<TextArea name="desc" maxLength={256} />
</Form.Item>
</Column>
<Column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React from 'react'
import { toJS } from 'mobx'
import { observer, inject } from 'mobx-react'
import moment from 'moment-mini'
import { get, isEmpty } from 'lodash'
import { get, isEmpty, has } from 'lodash'
import { Loading } from '@pitrix/lego-ui'

import { ICON_TYPES } from 'utils/constants'
Expand Down Expand Up @@ -124,6 +124,16 @@ export default class PipelineDetail extends Base {
} else {
this.sonarqubeStore.fetchDetail(params)
}

this.getPipeLineConfig()
}

getPipeLineConfig = async () => {
const { params } = this.props.match
const pipeLineConfig = await this.store.getPipeLineConfig()
pipeLineConfig.devops = params.devops
pipeLineConfig.cluster = params.cluster
this.setState({ formTemplate: pipeLineConfig })
}

getSonarqube = () => {
Expand Down Expand Up @@ -222,12 +232,8 @@ export default class PipelineDetail extends Base {
}

showEditModal = async type => {
const { params } = this.props.match

const pipeLineConfig = await this.store.getPipeLineConfig()

pipeLineConfig.devops = params.devops
this.setState({ [type]: true, formTemplate: pipeLineConfig })
this.getPipeLineConfig()
this.setState({ [type]: true })
}

hideEditModal = () => {
Expand Down Expand Up @@ -306,9 +312,14 @@ export default class PipelineDetail extends Base {

renderSider() {
const { detail } = toJS(this.store)
const { formTemplate } = this.state
const operations = this.getOperations().filter(item =>
this.enabledActions.includes(item.action)
)
const keyPath = has(formTemplate, 'pipeline')
? 'pipeline.description'
: 'multi_branch_pipeline.description'
const desc = get(formTemplate, keyPath, '-')

return (
<BaseInfo
Expand All @@ -318,6 +329,7 @@ export default class PipelineDetail extends Base {
operations={operations}
labels={detail.labels}
attrs={this.getAttrs()}
desc={desc}
/>
)
}
Expand All @@ -333,7 +345,6 @@ export default class PipelineDetail extends Base {
showEditConfig,
deleteLoading,
} = this.state

return (
<div>
<BaseInfoModal
Expand Down
29 changes: 10 additions & 19 deletions src/pages/devops/containers/Pipelines/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import { Link } from 'react-router-dom'
import { toJS } from 'mobx'
import { parse } from 'qs'
import { get, omit } from 'lodash'
import { Button } from 'components/Base'

import { Menu, Dropdown, Column, Icon } from '@pitrix/lego-ui'
import { trigger } from 'utils/action'

import { JOB_STATUS } from 'utils/constants'
import { updatePipelineParams, updatePipelineParamsInSpec } from 'utils/devops'
import { Button } from 'components/Base'

import Health from 'projects/components/Health'
import EmptyTable from 'components/Cards/EmptyTable'
import DeleteModal from 'components/Modals/Delete'
Expand Down Expand Up @@ -265,6 +267,7 @@ class CICDs extends React.Component {

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

this.setState({
showEditConfig: true,
Expand Down Expand Up @@ -390,25 +393,13 @@ class CICDs extends React.Component {
dataIndex: 'name',
width: '20%',
render: (name, record) => {
if (record.numberOfFailingBranches !== undefined) {
return (
<Link
className="item-name"
to={`/${this.workspace}/clusters/${this.cluster}/devops/${
this.devops
}/pipelines/${encodeURIComponent(record.name)}/activity`}
>
{name}
</Link>
)
}
const url = `/${this.workspace}/clusters/${this.cluster}/devops/${
this.devops
}/pipelines/${encodeURIComponent(record.name)}${
record.numberOfFailingBranches !== undefined ? '/activity' : ''
}`
return (
<Link
className="item-name"
to={`/${this.workspace}/clusters/${this.cluster}/devops/${
this.devops
}/pipelines/${encodeURIComponent(record.name)}`}
>
<Link className="item-name" to={url}>
{name}
</Link>
)
Expand Down
4 changes: 1 addition & 3 deletions src/stores/devops.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ export default class DevOpsStore extends Base {

const result = await request.get(
this.getBaseUrlV3({ cluster, workspace }),
params,
null,
() => {}
params
)

const items = Array.isArray(get(result, 'items'))
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 @@ -16,7 +16,7 @@
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/

import { omit, isArray, get, set, isEmpty } from 'lodash'
import { omit, isArray, get, set, isEmpty, cloneDeep } from 'lodash'
import { saveAs } from 'file-saver'
import { action, observable, toJS } from 'mobx'
import BaseStore from './base'
Expand Down Expand Up @@ -414,7 +414,7 @@ export default class PipelineStore extends BaseStore {

@action
getPipeLineConfig() {
let detail = JSON.parse(JSON.stringify(this.pipelineConfig))
let detail = cloneDeep(this.pipelineConfig)
detail = { ...toJS(detail.spec), ...toJS(detail) }

delete detail.spec
Expand Down

0 comments on commit 8ed527e

Please sign in to comment.