Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ const isSubmitting = ref(false);

const handleSave = async (data: {
displayName: string;
[key: string]: unknown;
config: Record<string, unknown>;
}) => {
console.log(data);
try {
isSubmitting.value = true;
if (isUpdateMode.value) {
Expand All @@ -125,18 +124,18 @@ const handleSave = async (data: {
await consoleApiClient.storage.policy.updatePolicyConfigByGroup({
name: policy.value.metadata.name,
group: CONFIG_MAP_GROUP,
body: data,
body: data.config,
});

await coreApiClient.storage.policy.updatePolicy({
await coreApiClient.storage.policy.patchPolicy({
name: policy.value.metadata.name,
policy: {
...policy.value,
spec: {
...policy.value.spec,
displayName: data.displayName,
jsonPatchInner: [
{
op: "add",
path: "/spec/displayName",
value: data.displayName,
},
},
],
});
} else {
const { data: policies } =
Expand All @@ -157,7 +156,7 @@ const handleSave = async (data: {
await coreApiClient.configMap.createConfigMap({
configMap: {
data: {
[CONFIG_MAP_GROUP]: JSON.stringify(data),
[CONFIG_MAP_GROUP]: JSON.stringify(data.config || {}),
},
apiVersion: "v1alpha1",
kind: "ConfigMap",
Expand Down Expand Up @@ -207,16 +206,14 @@ const modalTitle = props.policy
ref="modal"
mount-to-body
:title="modalTitle"
:width="600"
:width="650"
@close="emit('close')"
>
<div>
<VLoading v-if="isLoading" />
<template v-else>
<FormKit
v-if="formSchema && configMapGroupData"
id="attachment-policy-form"
:value="toRaw(configMapGroupData) || {}"
name="attachment-policy-form"
:preserve="true"
type="form"
Expand All @@ -235,10 +232,20 @@ const modalTitle = props.policy
name="displayName"
validation="required|length:0,50"
></FormKit>
<FormKitSchema
:schema="toRaw(formSchema)"
:data="toRaw(configMapGroupData) || {}"
/>
<FormKit
v-if="formSchema && configMapGroupData"
:value="toRaw(configMapGroupData) || {}"
type="group"
name="config"
:label="
$t('core.attachment.policy_editing_modal.fields.config.label')
"
>
<FormKitSchema
:schema="toRaw(formSchema)"
:data="toRaw(configMapGroupData) || {}"
/>
</FormKit>
</FormKit>
</template>
</div>
Expand Down
3 changes: 3 additions & 0 deletions ui/src/locales/_missing_translations_es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ core:
toast:
group_name_exists: Group name already exists
policy_editing_modal:
fields:
config:
label: Policy configuration
toast:
policy_name_exists: Storage policy name already exists
upload_modal:
Expand Down
2 changes: 2 additions & 0 deletions ui/src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ core:
fields:
display_name:
label: Display name
config:
label: Policy configuration
toast:
policy_name_exists: Storage policy name already exists
upload_modal:
Expand Down
2 changes: 2 additions & 0 deletions ui/src/locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ core:
fields:
display_name:
label: 名称
config:
label: 策略配置
toast:
policy_name_exists: 存储策略名称已存在
upload_modal:
Expand Down
2 changes: 2 additions & 0 deletions ui/src/locales/zh-TW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ core:
fields:
display_name:
label: 名稱
config:
label: 策略配置
toast:
policy_name_exists: 儲存策略名稱已存在
upload_modal:
Expand Down
Loading