Merge branch 'develop' into 0.7.0

This commit is contained in:
nkorange 2018-12-14 20:02:37 +08:00
commit ffa9f92812
8 changed files with 42 additions and 36 deletions

View File

@ -51,7 +51,7 @@ class EditServiceDialog extends React.Component {
const { name, protectThreshold, healthCheckMode, metadataText, selector } = editService; const { name, protectThreshold, healthCheckMode, metadataText, selector } = editService;
request({ request({
method: isCreate ? 'PUT' : 'POST', method: isCreate ? 'PUT' : 'POST',
url: `v1/ns/service/${isCreate ? 'create' : 'update'}`, url: 'v1/ns/service',
data: { data: {
serviceName: name, serviceName: name,
protectThreshold, protectThreshold,
@ -85,6 +85,13 @@ class EditServiceDialog extends React.Component {
}); });
} }
getFormItemLayout = () => {
return {
labelCol: { span: 6 },
wrapperCol: { span: 14 },
};
};
render() { render() {
const { locale = {} } = this.props; const { locale = {} } = this.props;
const { isCreate, editService, editServiceDialogVisible } = this.state; const { isCreate, editService, editServiceDialogVisible } = this.state;
@ -95,6 +102,7 @@ class EditServiceDialog extends React.Component {
metadataText, metadataText,
selector = { type: 'none' }, selector = { type: 'none' },
} = editService; } = editService;
const formItemLayout = this.getFormItemLayout();
return ( return (
<Dialog <Dialog
className="service-detail-edit-dialog" className="service-detail-edit-dialog"
@ -105,27 +113,22 @@ class EditServiceDialog extends React.Component {
onClose={() => this.hide()} onClose={() => this.hide()}
> >
<Form {...DIALOG_FORM_LAYOUT}> <Form {...DIALOG_FORM_LAYOUT}>
<Form.Item label={`${locale.serviceName}:`}> <Form.Item label={`${locale.serviceName}:`} {...formItemLayout}>
{!isCreate ? ( {!isCreate ? (
<p>{name}</p> <p>{name}</p>
) : ( ) : (
<Input <Input value={name} onChange={name => this.onChangeCluster({ name })} />
className="in-text"
value={name}
onChange={name => this.onChangeCluster({ name })}
/>
)} )}
</Form.Item> </Form.Item>
<Form.Item label={`${locale.protectThreshold}:`}> <Form.Item label={`${locale.protectThreshold}:`} {...formItemLayout}>
<Input <Input
className="in-text"
value={protectThreshold} value={protectThreshold}
onChange={protectThreshold => this.onChangeCluster({ protectThreshold })} onChange={protectThreshold => this.onChangeCluster({ protectThreshold })}
/> />
</Form.Item> </Form.Item>
<Form.Item label={`${locale.healthCheckPattern}:`}> <Form.Item label={`${locale.healthCheckPattern}:`} {...formItemLayout}>
<Select <Select
className="in-select" className="full-width"
defaultValue={healthCheckMode} defaultValue={healthCheckMode}
onChange={healthCheckMode => this.onChangeCluster({ healthCheckMode })} onChange={healthCheckMode => this.onChangeCluster({ healthCheckMode })}
> >
@ -134,16 +137,15 @@ class EditServiceDialog extends React.Component {
<Select.Option value="none">{locale.healthCheckPatternNone}</Select.Option> <Select.Option value="none">{locale.healthCheckPatternNone}</Select.Option>
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label={`${locale.metadata}:`}> <Form.Item label={`${locale.metadata}:`} {...formItemLayout}>
<Input <Input.TextArea
className="in-text"
value={metadataText} value={metadataText}
onChange={metadataText => this.onChangeCluster({ metadataText })} onChange={metadataText => this.onChangeCluster({ metadataText })}
/> />
</Form.Item> </Form.Item>
<Form.Item label={`${locale.type}:`}> <Form.Item label={`${locale.type}:`} {...formItemLayout}>
<Select <Select
className="in-select" className="full-width"
defaultValue={selector.type} defaultValue={selector.type}
onChange={type => this.onChangeCluster({ selector: { ...selector, type } })} onChange={type => this.onChangeCluster({ selector: { ...selector, type } })}
> >
@ -152,9 +154,8 @@ class EditServiceDialog extends React.Component {
</Select> </Select>
</Form.Item> </Form.Item>
{selector.type === 'label' && ( {selector.type === 'label' && (
<Form.Item label={`${locale.selector}:`}> <Form.Item label={`${locale.selector}:`} {...formItemLayout}>
<Input.TextArea <Input.TextArea
className="in-text"
value={selector.expression} value={selector.expression}
onChange={expression => onChange={expression =>
this.onChangeCluster({ selector: { ...selector, expression } }) this.onChangeCluster({ selector: { ...selector, expression } })

View File

@ -132,9 +132,6 @@ class ServiceDetail extends React.Component {
<FormItem label={`${locale.metadata}:`}> <FormItem label={`${locale.metadata}:`}>
<p>{metadataText}</p> <p>{metadataText}</p>
</FormItem> </FormItem>
<FormItem label={`${locale.metadata}:`}>
<p>{metadataText}</p>
</FormItem>
<FormItem label={`${locale.type}:`}> <FormItem label={`${locale.type}:`}>
<p>{selector.type}</p> <p>{selector.type}</p>
</FormItem> </FormItem>

View File

@ -53,3 +53,11 @@
width: 120px; width: 120px;
} }
} }
.service-detail-edit-dialog {
width: 600px;
}
.full-width {
width: 100%;
}

View File

@ -2,8 +2,8 @@ function getValue(key) {
if (!document.cookie) return null; if (!document.cookie) return null;
const list = document.cookie.split(';') || []; const list = document.cookie.split(';') || [];
for (const item of list) { for (const item of list) {
const [k, v] = item.split('='); const [k = '', v = ''] = item.split('=');
if (k === key) return v; if (k.trim() === key) return v;
} }
return null; return null;
} }

View File

@ -49,11 +49,11 @@ export default {
* 检测属性是否正确 * 检测属性是否正确
*/ */
validateProperties(str = '') { validateProperties(str = '') {
let reg = /^[A-Za-z\d-_]+=.+$/; const reg = /^[^=]+=[^=]+$/;
return str return str
.replace('\n\r', '\n') .replace('\n\r', '\n')
.split('\n') .split('\n')
.every(_str => reg.test(_str)); .every(_str => reg.test(_str.trim()));
}, },
/** /**

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -241,8 +241,8 @@
<exclude>src/test/resources/*</exclude> <exclude>src/test/resources/*</exclude>
<exclude>src/main/resources/static/**/*.js</exclude> <exclude>src/main/resources/static/**/*.js</exclude>
<exclude>src/main/resources/**/*.svg</exclude> <exclude>src/main/resources/**/*.svg</exclude>
<exclude>src/main/resources/static/css/console1412.css</exclude> <exclude>src/main/resources/static/css/*</exclude>
<exclude>src/main/resources/static/js/vs/**/*</exclude> <exclude>src/main/resources/static/js/*</exclude>
<exclude>src/main/resources/static/console-fe/public/css/console1412.css</exclude> <exclude>src/main/resources/static/console-fe/public/css/console1412.css</exclude>
<exclude>src/main/resources/static/console-fe/public/js/vs/editor/editor.main.css</exclude> <exclude>src/main/resources/static/console-fe/public/js/vs/editor/editor.main.css</exclude>
<exclude>src/main/resources/static/console-fe/dist/js/vs/editor/editor.main.css</exclude> <exclude>src/main/resources/static/console-fe/dist/js/vs/editor/editor.main.css</exclude>