Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix form custom label require error #778

Merged
merged 1 commit into from Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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