Skip to content

Commit

Permalink
fix: fix some issues there are 436,438,444,445,449
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisonliu5 committed Jun 19, 2020
1 parent d7c8427 commit 89f7c34
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 8 deletions.
17 changes: 15 additions & 2 deletions src/components/Modals/DevOpsCreate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import PropTypes from 'prop-types'
import { Columns, Column, Select, Input, TextArea } from '@pitrix/lego-ui'
import { Modal, Form } from 'components/Base'
import ClusterTitle from 'components/Clusters/ClusterTitle'
import { PATTERN_SERVICE_NAME, PATTERN_LENGTH_63 } from 'utils/constants'
import {
PATTERN_SERVICE_NAME,
PATTERN_LENGTH_63,
PATTERN_LENGTH_1000,
} from 'utils/constants'

import WorkspaceStore from 'stores/workspace'

Expand Down Expand Up @@ -172,7 +176,16 @@ export default class ProjectCreateModal extends React.Component {
</Column>
)}
<Column>
<Form.Item label={t('Description')}>
<Form.Item
label={t('Description')}
desc={t('DESCRIPTION_DESC')}
rules={[
{
pattern: PATTERN_LENGTH_1000,
message: t('LONG_DESC_TOO_LONG'),
},
]}
>
<TextArea name="metadata.annotations['kubesphere.io/description']" />
</Form.Item>
</Column>
Expand Down
10 changes: 8 additions & 2 deletions src/components/Modals/DevOpsEdit/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { toJS } from 'mobx'
import { observer } from 'mobx-react'
import { Input, Select, TextArea } from '@pitrix/lego-ui'
import { Modal, Form } from 'components/Base'
import { PATTERN_NAME } from 'utils/constants'
import { PATTERN_NAME, PATTERN_LENGTH_1000 } from 'utils/constants'

import UserStore from 'stores/user'

Expand Down Expand Up @@ -112,7 +112,13 @@ export default class DevOpsEditModal extends React.Component {
<Form.Item label={t('Creator')} desc={t('DEVOPS_ADMIN_DESC')}>
<Select name="creator" options={this.getMembersOptions()} disabled />
</Form.Item>
<Form.Item label={t('Description')} desc={t('DESCRIPTION_DESC')}>
<Form.Item
label={t('Description')}
desc={t('DESCRIPTION_DESC')}
rules={[
{ pattern: PATTERN_LENGTH_1000, message: t('LONG_DESC_TOO_LONG') },
]}
>
<TextArea name="description" />
</Form.Item>
</Modal.Form>
Expand Down
4 changes: 3 additions & 1 deletion src/components/Modals/ProjectSelect/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ export default class ProjectSelectModal extends React.Component {
} else if (this.state.type === 'federatedprojects') {
onChange(`/${workspace}/federatedprojects/${item.name}`)
} else {
onChange(`/${workspace}/clusters/${cluster}/devops/${item.namespace}`)
item.namespace && cluster
? onChange(`/${workspace}/clusters/${cluster}/devops/${item.namespace}`)
: null
}
}

Expand Down
1 change: 1 addition & 0 deletions src/locales/en/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
'It can only contain lowercase letters, numbers and hyphens("-"), and must begin with a lowercase letter, ending with a number or lowercase letter. The maximum length of characters is set to 253.',
NAME_TOO_LONG: 'The maximum length of characters is set to 63.',
LONG_NAME_TOO_LONG: 'The maximum length of characters is set to 253.',
LONG_DESC_TOO_LONG: 'The maximum length of characters is set to 1000.',
DESCRIPTION_DESC:
'The description will be added to the item as a comment and displayed in the details of the application. The description is limited to 1000 characters.',
SHORT_DESCRIPTION_DESC: 'Description is limited to 1000 characters.',
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export default {
LONG_NAME_DESC:
'最长 253 个字符,只能包含小写字母、数字及分隔符("-"),且必须以小写字母或数字开头及结尾',
LONG_NAME_TOO_LONG: '最长 253 个字符',
LONG_DESC_TOO_LONG: '最长 1000 个字符',
ALIAS_DESC: '别名可以由任意字符组成,帮助您更好的区分资源,并支持中文名称',
LABEL_FORMAT_DESC:
'标签的 key 和 value 最长 63 个字符,key 如果包含域名, 则最长 253 字符。只能包含大小写字母、数字, 分隔符("-"),下划线(_)及点(.),且必须以数字或大小写开头和结尾',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { get } from 'lodash'

import { action } from 'mobx'
import { action, toJS } from 'mobx'
import { observer } from 'mobx-react'
import { Form, Modal } from 'components/Base'
import { Input, Select } from '@pitrix/lego-ui'
Expand Down Expand Up @@ -192,7 +192,7 @@ export default class WithCredentials extends React.Component {
>
<Select
name="credentialsId"
options={credentials}
options={toJS(credentials)}
onChange={this.handleCredentialChange}
/>
</Form.Item>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/devops/components/Pipeline/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { Message } from '@pitrix/lego-ui'
import CredentialStore from 'stores/devops/credential'
import BaseStore from 'stores/devops/base'

import { generateId } from 'utils'

const formatPipeLineJson = json => {
if (!get(json, 'pipeline.stages')) return
json.pipeline.stages = json.pipeline.stages.map(stage => {
Expand Down Expand Up @@ -60,6 +62,7 @@ export default class Store extends BaseStore {
steps: [],
},
],
name: `stage-${generateId(5)}`,
}
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/devops/containers/Pipelines/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ class CICDs extends React.Component {
project_name,
cluster,
enable_timer_trigger: true,
enable_discarder: true,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/devops/containers/Roles/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default class Secrets extends React.Component {
render() {
const { bannerProps, tableProps } = this.props
return (
<ListPage {...this.props} getData={this.getData}>
<ListPage {...this.props} getData={this.getData} noWatch>
<Banner
{...bannerProps}
tabs={this.tabs}
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ export const PATTERN_IMAGE = /^\S+$/
export const PATTERN_LENGTH_52 = /^.{0,52}$/
export const PATTERN_LENGTH_63 = /^.{0,63}$/
export const PATTERN_LENGTH_253 = /^.{0,253}$/
export const PATTERN_LENGTH_1000 = /^.{0,1000}$/
export const PATTERN_PORT_NAME = /^[a-z]([-a-z0-9]*[a-z0-9])?$/
export const PATTERN_COMPONENT_VERSION = /^[a-z0-9]+$/
export const PATTERN_PIPELINE_NAME = /^[a-zA-Z0-9]([-a-zA-Z0-9_]*)?$/
Expand Down

0 comments on commit 89f7c34

Please sign in to comment.