Skip to content

Commit

Permalink
fix: fix custom label require error (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
laojun committed Jul 29, 2021
1 parent c1720c0 commit 5b1e771
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 6 additions & 0 deletions shell/app/common/components/render-formItem.tsx
Expand Up @@ -207,6 +207,11 @@ export const RenderFormItem = ({
required,
message: `${i18n.t('common:please')}${action}${hasColon ? label.slice(0, label.length - 1) : label}`,
});
} else {
rules.push({
required,
message: i18n.t('can not be empty'),
});
}
}
if (pattern && !rules.some((r) => r.pattern && r.pattern.source === pattern.source)) {
Expand Down Expand Up @@ -240,6 +245,7 @@ export const RenderFormItem = ({
) : (
label
);

return (
<FormItem
label={_label}
Expand Down
2 changes: 1 addition & 1 deletion shell/app/modules/cmp/pages/networks/common/config.tsx
Expand Up @@ -56,7 +56,7 @@ export const formConfig = {
},
label: {
Zone: (
<div className="label-with-required">
<div>
{i18n.t('dcos:availability zone')}
&nbsp;&nbsp;
<Tooltip
Expand Down
10 changes: 0 additions & 10 deletions shell/app/styles/util.scss
Expand Up @@ -626,16 +626,6 @@
align-items: flex-start;
}

.label-with-required::before {
content: '*';
display: inline-block;
margin-right: 4px;
color: $red;
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
}

.no-prevent {
.pk-select-arrow {
pointer-events: all;
Expand Down

0 comments on commit 5b1e771

Please sign in to comment.