Skip to content

feat(workspace): bug fix #3297

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

Merged
merged 1 commit into from
Jun 18, 2025
Merged
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
25 changes: 14 additions & 11 deletions ui/src/views/shared/AuthorizedWorkspaceDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<el-checkbox-group v-model="checkedWorkspace" @change="handleCheckedWorkspaceChange">
<el-checkbox
v-for="space in workspaceWithKeywords"
:key="space"
:label="space"
:key="space.id"
:label="space.name"
:value="space"
>
<el-icon size="20">
<momentsCategories></momentsCategories>
</el-icon>
{{ space }}
{{ space.name }}
</el-checkbox>
</el-checkbox-group>
</div>
Expand All @@ -58,7 +58,7 @@
<el-icon size="20">
<momentsCategories></momentsCategories>
</el-icon>
<div class="label">{{ ele }}</div>
<div class="label">{{ ele.name }}</div>
<el-icon @click="clearWorkspace(ele)" class="close" size="16">
<closeIcon></closeIcon>
</el-icon>
Expand Down Expand Up @@ -98,7 +98,7 @@ const closeIcon = iconMap['close-outlined'].iconReader()
const momentsCategories = iconMap['moments-categories'].iconReader()

const workspaceWithKeywords = computed(() => {
return workspace.value.filter((ele) => (ele as string).includes(search.value))
return workspace.value.filter((ele) => (ele.name as string).includes(search.value))
})
const handleCheckAllChange = (val: CheckboxValueType) => {
checkedWorkspace.value = val ? workspace.value : []
Expand All @@ -117,7 +117,7 @@ const handleCheckedWorkspaceChange = (value: CheckboxValueType[]) => {
checkAll.value = checkedCount === workspace.value.length
isIndeterminate.value = checkedCount > 0 && checkedCount < workspace.value.length
auth_list = [
...value.map((ele) => ({ authentication_type: listType.value, workspace_id: ele })),
...value.map((ele) => ({ authentication_type: listType.value, workspace_id: ele.id, name: ele.name })),
...auth_list.filter((ele) => ele.authentication_type !== listType.value),
]
}
Expand All @@ -133,7 +133,10 @@ const open = ({ id }: any, type = 'Knowledge') => {
.then((res: any) => {
auth_list = (res.data || {}).auth_list || []
un_auth_list = (res.data || {}).un_auth_list || []
workspace.value = [...un_auth_list, ...auth_list.map((ele) => ele.workspace_id)] as any
workspace.value = [
...un_auth_list,
...auth_list.map((ele) => ({ id: ele.workspace_id, name: ele.name })),
] as any
handleListTypeChange(listType.value)
})
.finally(() => {
Expand All @@ -144,16 +147,16 @@ const open = ({ id }: any, type = 'Knowledge') => {

const handleConfirm = () => {
authorizationApi[`postSharedAuthorization${currentType}`](knowledge_id, {
workspace_id_list: checkedWorkspace.value,
workspace_id_list: checkedWorkspace.value.map(ele => ele.id),
authentication_type: listType.value,
}).then(() => {
centerDialogVisible.value = false
})
}

const clearWorkspace = (val: any) => {
checkedWorkspace.value = checkedWorkspace.value.filter((ele) => ele !== val)
auth_list = auth_list.filter((ele) => ele.workspace_id !== val)
checkedWorkspace.value = checkedWorkspace.value.filter((ele) => ele.id !== val.id)
auth_list = auth_list.filter((ele) => ele.workspace_id !== val.id)
}

const clearWorkspaceAll = () => {
Expand All @@ -165,7 +168,7 @@ const clearWorkspaceAll = () => {
const handleListTypeChange = (val: any) => {
checkedWorkspace.value = auth_list
.filter((ele) => ele.authentication_type === val)
.map((ele) => ele.workspace_id) as any
.map((ele) => ({ id: ele.workspace_id, name: ele.name })) as any
handleCheckedWorkspaceChange(checkedWorkspace.value)
}
defineExpose({
Expand Down
Loading