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

View File

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

View File

@ -53,3 +53,11 @@
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;
const list = document.cookie.split(';') || [];
for (const item of list) {
const [k, v] = item.split('=');
if (k === key) return v;
const [k = '', v = ''] = item.split('=');
if (k.trim() === key) return v;
}
return null;
}

View File

@ -49,11 +49,11 @@ export default {
* 检测属性是否正确
*/
validateProperties(str = '') {
let reg = /^[A-Za-z\d-_]+=.+$/;
const reg = /^[^=]+=[^=]+$/;
return str
.replace('\n\r', '\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/main/resources/static/**/*.js</exclude>
<exclude>src/main/resources/**/*.svg</exclude>
<exclude>src/main/resources/static/css/console1412.css</exclude>
<exclude>src/main/resources/static/js/vs/**/*</exclude>
<exclude>src/main/resources/static/css/*</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/js/vs/editor/editor.main.css</exclude>
<exclude>src/main/resources/static/console-fe/dist/js/vs/editor/editor.main.css</exclude>