Skip to content

Commit

Permalink
Fix: Show policy type when editing the policy (#804)
Browse files Browse the repository at this point in the history
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
(cherry picked from commit c3d817f)

Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
  • Loading branch information
github-actions[bot] and barnettZQG committed Apr 28, 2023
1 parent 1080695 commit 74695e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
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

0 comments on commit 74695e5

Please sign in to comment.