Skip to content

Commit

Permalink
[Fix] Fixed #107.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoneyan committed May 27, 2022
1 parent b5a60e8 commit c503531
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
6 changes: 4 additions & 2 deletions src/pages/Add/ConnectionAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function ConnectionAdd() {
const [ipv6BGPRoute, setIPv6BGPRoute] = React.useState(false);
const [isComment, setIsComment] = React.useState(false);
const [isInternet, setIsInternet] = React.useState(false);
const [isGlobalAs, setIsGlobalAs] = React.useState(false);
let groupID: string | undefined;
({id: groupID} = useParams());

Expand Down Expand Up @@ -204,6 +205,7 @@ export default function ConnectionAdd() {
checkBgpRoute(Number(event.target.value));
const tmpService = group.services?.filter(data => data.ID === Number(event.target.value));
if (tmpService != null) {
setIsGlobalAs(tmpService[0].service_template.need_global_as);
setServiceCode(getServiceCode(groupID, tmpService[0]));
}
setServiceID(Number(event.target.value));
Expand All @@ -224,7 +226,7 @@ export default function ConnectionAdd() {
<FormLabel component="legend">1.1. BGPで当団体から広報する経路種類を選択してください。</FormLabel>

{
ipBGPRoute && ipv4BGPRoute &&
((ipBGPRoute && ipv4BGPRoute)||(ipBGPRoute && isGlobalAs)) &&
<StyledFormControlFormSelect>
<FormLabel component="legend">IPv4 BGP広報経路</FormLabel>
<FormHelperText>
Expand Down Expand Up @@ -257,7 +259,7 @@ export default function ConnectionAdd() {
</StyledFormControlFormSelect>
}
{
ipBGPRoute && ipv6BGPRoute &&
((ipBGPRoute && ipv6BGPRoute)||(ipBGPRoute && isGlobalAs)) &&
<StyledFormControlFormSelect>
<FormLabel component="legend">IPv6 BGP広報経路</FormLabel>
<FormHelperText>
Expand Down
36 changes: 18 additions & 18 deletions src/pages/Add/ServiceAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,6 @@ export default function ServiceAdd() {
.moreThan(0, 'サービスを選択してください'),
acceptTerms: Yup.bool().oneOf([true], '利用の規約に同意しないと次へ進めません。'),
hidden: Yup.bool(),
org: Yup.string()
.required('Org is required')
.max(255, 'Org must not exceed 255 characters'),
org_en: Yup.string()
.required('Org(English) is required')
.max(255, 'Org(English) must not exceed 255 characters'),
postcode: Yup.string()
.required('PostCode is required')
.min(8, 'PostCode must be at least 8 characters')
.max(8, 'PostCode must not exceed 8 characters'),
address: Yup.string()
.required('Address is required')
.min(6, 'Address must be at least 6 characters')
.max(255, 'Address must not exceed 255 characters'),
address_en: Yup.string()
.required('Address(English) is required')
.min(6, 'Address(English) must be at least 6 characters')
.max(255, 'Address(English) must not exceed 255 characters'),
start_date: Yup.date()
.required("利用開始日を入力してください"),
end_date: Yup.date(),
Expand All @@ -115,6 +97,24 @@ export default function ServiceAdd() {

// L2, L3 Static, L3 BGP, CoLocation
if ((0 < values.service_template_id && values.service_template_id <= 3) || (5 <= values.service_template_id && values.service_template_id <= 7)) {
obj["org"] = Yup.string()
.required('Org is required')
.max(255, 'Org must not exceed 255 characters')
obj["org_en"] = Yup.string()
.required('Org(English) is required')
.max(255, 'Org(English) must not exceed 255 characters')
obj["postcode"] = Yup.string()
.required('PostCode is required')
.min(8, 'PostCode must be at least 8 characters')
.max(8, 'PostCode must not exceed 8 characters')
obj["address"] = Yup.string()
.required('Address is required')
.min(6, 'Address must be at least 6 characters')
.max(255, 'Address must not exceed 255 characters')
obj["address_en"] = Yup.string()
.required('Address(English) is required')
.min(6, 'Address(English) must be at least 6 characters')
.max(255, 'Address(English) must not exceed 255 characters')
obj["jpnic_admin"] = Yup.object().shape({
hidden: Yup.bool(),
is_group: Yup.bool(),
Expand Down

0 comments on commit c503531

Please sign in to comment.