Skip to content

Commit f7623dc

Browse files
authored
feat: Application list search criteria support querying by status (#3803)
1 parent b5fe64d commit f7623dc

File tree

9 files changed

+68
-3
lines changed

9 files changed

+68
-3
lines changed

apps/application/api/application_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ def get_parameters():
8888
type=OpenApiTypes.STR,
8989
location='query',
9090
required=False,
91+
),
92+
OpenApiParameter(
93+
name="publish_status",
94+
description=_("Publish status") + '(published|unpublished)',
95+
type=OpenApiTypes.STR,
96+
location='query',
97+
required=False,
9198
)
9299
]
93100

apps/application/serializers/application.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ class ApplicationQueryRequest(serializers.Serializer):
284284
folder_id = serializers.CharField(required=False, label=_("folder id"))
285285
name = serializers.CharField(required=False, label=_('Application Name'))
286286
desc = serializers.CharField(required=False, label=_("Application Description"))
287+
publish_status = serializers.ChoiceField(required=False, label=_("Publish status"),
288+
choices=[('published', _("Published")),
289+
('unpublished', _("Unpublished"))])
287290
user_id = serializers.UUIDField(required=False, label=_("User ID"))
288291

289292

@@ -311,7 +314,11 @@ def get_query_set(self, instance: Dict, workspace_manage: bool, is_x_pack_ee: bo
311314
user_id = self.data.get('user_id')
312315
desc = instance.get('desc')
313316
name = instance.get('name')
317+
publish_status = instance.get("publish_status")
314318
create_user = instance.get('create_user')
319+
if publish_status is not None:
320+
is_publish = True if publish_status == "published" else False
321+
application_query_set = application_query_set.filter(is_publish=is_publish)
315322
if workspace_id is not None:
316323
folder_query_set = folder_query_set.filter(workspace_id=workspace_id)
317324
application_query_set = application_query_set.filter(workspace_id=workspace_id)

apps/locales/en_US/LC_MESSAGES/django.po

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8549,4 +8549,13 @@ msgid "Failed to get WeCom department users"
85498549
msgstr ""
85508550

85518551
msgid "Failed to get WeCom user info"
8552+
msgstr ""
8553+
8554+
msgid "Publish status"
8555+
msgstr ""
8556+
8557+
msgid "Unpublished"
8558+
msgstr ""
8559+
8560+
msgid "Published"
85528561
msgstr ""

apps/locales/zh_CN/LC_MESSAGES/django.po

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8675,4 +8675,13 @@ msgid "Failed to get WeCom department users"
86758675
msgstr "获取企业微信部门用户失败"
86768676

86778677
msgid "Failed to get WeCom user info"
8678-
msgstr "获取企业微信用户信息失败"
8678+
msgstr "获取企业微信用户信息失败"
8679+
8680+
msgid "Publish status"
8681+
msgstr "发布状态"
8682+
8683+
msgid "Unpublished"
8684+
msgstr "未发布"
8685+
8686+
msgid "Published"
8687+
msgstr "已发布"

apps/locales/zh_Hant/LC_MESSAGES/django.po

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8676,3 +8676,12 @@ msgstr "獲取 WeCom 部門用戶失敗"
86768676

86778677
msgid "Failed to get WeCom user info"
86788678
msgstr "獲取 WeCom 用戶詳情失敗"
8679+
8680+
msgid "Publish status"
8681+
msgstr "發佈狀態"
8682+
8683+
msgid "Unpublished"
8684+
msgstr "未發佈"
8685+
8686+
msgid "Published"
8687+
msgstr "已發佈"

ui/src/locales/lang/en-US/common.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export default {
44
createSuccess: 'Successful',
55
copy: 'Copy',
66
copySuccess: 'Successful',
7+
publishStatus: 'Publish Status',
8+
published: 'Published',
9+
unpublished: 'Unpublished',
710
copyError: 'Copy Failed',
811
save: 'Save',
912
saveSuccess: 'Successful',
@@ -93,7 +96,8 @@ export default {
9396
notFound: {
9497
title: '404',
9598
NoService: 'Currently unable to access services',
96-
NoPermission: 'The current user does not have permission to access, please contact the administrator',
99+
NoPermission:
100+
'The current user does not have permission to access, please contact the administrator',
97101
operate: 'Back to Home',
98102
},
99103
custom: 'Custom',

ui/src/locales/lang/zh-CN/common.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export default {
44
createSuccess: '创建成功',
55
copy: '复制',
66
copySuccess: '复制成功',
7+
publishStatus: '发布状态',
8+
published: '已发布',
9+
unpublished: '未发布',
710
copyError: '复制失败',
811
save: '保存',
912
saveSuccess: '保存成功',
@@ -97,7 +100,7 @@ export default {
97100
notFound: {
98101
title: '404',
99102
NoService: '暂时无法访问服务',
100-
NoPermission:'当前用户暂无权限访问,请联系管理员',
103+
NoPermission: '当前用户暂无权限访问,请联系管理员',
101104
operate: '返回首页',
102105
},
103106
custom: '自定义',

ui/src/locales/lang/zh-Hant/common.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export default {
44
createSuccess: '創建成功',
55
copy: '複製',
66
copySuccess: '複製成功',
7+
publishStatus: '發佈狀態',
8+
published: '已發佈',
9+
unpublished: '未發佈',
710
copyError: '複製失敗',
811
save: '儲存',
912
saveSuccess: '儲存成功',

ui/src/views/application/index.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<el-option :label="$t('common.creator')" value="create_user" />
2929

3030
<el-option :label="$t('common.name')" value="name" />
31+
32+
<el-option :label="$t('common.publishStatus')" value="publish_status" />
3133
</el-select>
3234
<el-input
3335
v-if="search_type === 'name'"
@@ -47,6 +49,17 @@
4749
>
4850
<el-option v-for="u in user_options" :key="u.id" :value="u.id" :label="u.nick_name" />
4951
</el-select>
52+
<el-select
53+
v-else-if="search_type === 'publish_status'"
54+
v-model="search_form.publish_status"
55+
@change="searchHandle"
56+
filterable
57+
clearable
58+
style="width: 220px"
59+
>
60+
<el-option :label="$t('common.published')" value="published" />
61+
<el-option :label="$t('common.unpublished')" value="unpublished" />
62+
</el-select>
5063
</div>
5164
<el-dropdown trigger="click" v-if="permissionPrecise.create()">
5265
<el-button type="primary" class="ml-8">
@@ -333,6 +346,7 @@ const search_type = ref('name')
333346
const search_form = ref<any>({
334347
name: '',
335348
create_user: '',
349+
publish_status: undefined,
336350
})
337351
338352
const user_options = ref<any[]>([])

0 commit comments

Comments
 (0)