fix: issue of uploading attachments to ungrouped group (#716)

#### What type of PR is this?

/kind bug
/milestone 2.0-rc.2

#### What this PR does / why we need it:

修复选择未分组的分组时,上传附件会将分组设置为 `ungrouped` 的问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2777

#### Special notes for your reviewer:

测试方式:

1. 新建若干附件分组。
2. 切换到未分组,然后打开上传弹框,上传若干附件。
3. 检查所上传附件是否归为未分组。
4. 切换到其他分组,上传若干附件,检查所上传附件是否归为正确分组。

#### Does this PR introduce a user-facing change?

```release-note
修复在 Console 端选择未分组的分组时,上传附件会将分组设置为 `ungrouped` 的问题。
```
pull/717/head^2
Ryan Wang 2 years ago committed by GitHub
parent 8fbef715ee
commit b604532a7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,6 +20,13 @@ const props = withDefaults(
}
);
const groupName = computed(() => {
if (props.group?.metadata.name === "ungrouped") {
return "";
}
return props.group?.metadata.name;
});
const emit = defineEmits<{
(event: "update:visible", visible: boolean): void;
(event: "close"): void;
@ -37,10 +44,13 @@ const uploadVisible = ref(false);
const policyEditingModal = ref(false);
const modalTitle = computed(() => {
if (props.group && props.group.metadata.name) {
if (
props.group?.metadata.name &&
props.group?.metadata.name !== "ungrouped"
) {
return `上传附件到分组:${props.group.spec.displayName}`;
}
return "上传附件";
return "上传附件到未分组";
});
watchEffect(() => {
@ -173,7 +183,7 @@ watch(
:disabled="!selectedPolicy"
:meta="{
policyName: selectedPolicy?.metadata.name as string,
groupName: props.group?.metadata.name as string
groupName: groupName
}"
:allowed-meta-fields="['policyName', 'groupName']"
:note="selectedPolicy ? '' : '请先选择存储策略'"

Loading…
Cancel
Save