fix: protectThreshold validator

This commit is contained in:
LoadChange 2019-01-22 21:31:47 +08:00 committed by Asa
parent d850ceefb0
commit b213be7fe9
3 changed files with 13 additions and 9 deletions

View File

@ -12,6 +12,7 @@
"no-template-curly-in-string": "off",
"no-unused-vars": "off",
"no-tabs": "off",
"no-param-reassign": "off",
"react/no-string-refs": "off",
"react/no-unused-state": "off",
"no-return-assign": "off",
@ -29,6 +30,6 @@
"generator-star-spacing": "off",
"wrap-iife": "off",
"arrow-parens": "off",
"indent": "off",
"indent": "off"
}
}

View File

@ -61,6 +61,9 @@ class EditServiceDialog extends React.Component {
protectThreshold: locale.protectThresholdRequired,
healthCheckMode: locale.healthCheckModeRequired,
};
if (field.protectThreshold === 0) {
field.protectThreshold = '0';
}
for (const key in field) {
if (!field[key]) {
errors[key] = { validateState: 'error', help: helpMap[key] };

View File

@ -14,7 +14,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { request } from '@/globalLib';
import { Button, Card, ConfigProvider, Form, Loading } from '@alifd/next';
import { Input, Button, Card, ConfigProvider, Form, Loading } from '@alifd/next';
import EditServiceDialog from './EditServiceDialog';
import EditClusterDialog from './EditClusterDialog';
import InstanceTable from './InstanceTable';
@ -126,25 +126,25 @@ class ServiceDetail extends React.Component {
</Button>
</h1>
<Form style={{ width: '60%' }} {...pageFormLayout}>
<Form {...pageFormLayout}>
<FormItem label={`${locale.serviceName}:`}>
<p>{service.name}</p>
<Input value={service.name} readOnly />
</FormItem>
<FormItem label={`${locale.protectThreshold}:`}>
<p>{service.protectThreshold}</p>
<Input value={service.protectThreshold} readOnly />
</FormItem>
<FormItem label={`${locale.healthCheckPattern}:`}>
<p>{service.healthCheckMode}</p>
<Input value={service.healthCheckMode} readOnly />
</FormItem>
<FormItem label={`${locale.metadata}:`}>
<p>{metadataText}</p>
<Input value={metadataText} readOnly />
</FormItem>
<FormItem label={`${locale.type}:`}>
<p>{selector.type}</p>
<Input value={selector.type} readOnly />
</FormItem>
{service.type === 'label' && (
<FormItem label={`${locale.selector}:`}>
<p>{selector.selector}</p>
<Input value={selector.selector} readOnly />
</FormItem>
)}
</Form>