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

[Backport release-1.8] Fix: Show policy type when editing the policy #804

Merged
merged 1 commit into from
Apr 28, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/velaux-ui/src/locals/Zh/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"Policies": "策略",
"Policy": "策略",
"New Policy": "新增策略",
"Policy Type": "策略类型",
"Update Policy": "编辑策略",
"Warning": "部署异常",
"EnvironmentPlan": "环境规划",
"BasisConfig": "基准配置",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ class PolicyDialog extends React.Component<Props, State> {
this.uiSchemaRef.current?.validate(callback);
};
const init = this.field.init;
const span = selectedPolicyItem && selectedPolicyItem?.name == 'custom' ? 8 : 12;
const showType = (selectedPolicyItem && selectedPolicyItem?.name == 'custom') || policy != undefined;
const span = showType ? 8 : 12;
return (
<DrawerWithFooter
title={policy ? i18n.t('Update Policy') : i18n.t('New Policy')}
Expand All @@ -478,7 +479,7 @@ class PolicyDialog extends React.Component<Props, State> {
>
<Form field={this.field}>
<Card contentHeight="auto" title={i18n.t('Select a policy type').toString()}>
<If condition={!policy}>
{!policy && (
<Row wrap={true}>
{items.map((item) => {
return (
Expand All @@ -496,12 +497,12 @@ class PolicyDialog extends React.Component<Props, State> {
);
})}
</Row>
</If>
<If condition={selectedPolicyItem}>
)}
{selectedPolicyItem && (
<Row wrap={true}>
{selectedPolicyItem && selectedPolicyItem?.name == 'custom' && (
{showType && (
<Col span={span} style={{ padding: '0 8px' }}>
<Form.Item label="Policy Type" required>
<Form.Item label={i18n.t('Policy Type')} required>
<Select
{...init('type', {
rules: [
Expand Down Expand Up @@ -569,7 +570,7 @@ class PolicyDialog extends React.Component<Props, State> {
</Form.Item>
</Col>
</Row>
</If>
)}
<If condition={selectedPolicyItem?.properties}>
<Message style={{ marginTop: '8px' }} type="success">
<Translation>This policy already have the default properties</Translation>
Expand Down