Skip to content

Commit 9e1f6c3

Browse files
committed
fix: allow null and blank values for application name and description fields
1 parent 2997b5f commit 9e1f6c3

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

apps/application/serializers/application.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def to_application_model(user_id: str, workspace_id: str, application: Dict):
335335

336336
class ApplicationQueryRequest(serializers.Serializer):
337337
folder_id = serializers.CharField(required=False, label=_("folder id"))
338-
name = serializers.CharField(required=False, label=_('Application Name'))
339-
desc = serializers.CharField(required=False, label=_("Application Description"))
338+
name = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_('Application Name'))
339+
desc = serializers.CharField(required=False, allow_null=True, allow_blank=True, label=_("Application Description"))
340340
publish_status = serializers.ChoiceField(required=False, label=_("Publish status"),
341341
choices=[('published', _("Published")),
342342
('unpublished', _("Unpublished"))])
@@ -413,10 +413,11 @@ def list(self, instance: Dict):
413413
self.is_valid(raise_exception=True)
414414
workspace_id = self.data.get('workspace_id')
415415
user_id = self.data.get("user_id")
416-
ApplicationQueryRequest(data=instance).is_valid(raise_exception=True)
416+
req_dict = ApplicationQueryRequest(data=instance)
417+
req_dict.is_valid(raise_exception=True)
417418
workspace_manage = is_workspace_manage(user_id, workspace_id)
418419
is_x_pack_ee = self.is_x_pack_ee()
419-
return native_search(self.get_query_set(instance, workspace_manage, is_x_pack_ee),
420+
return native_search(self.get_query_set(req_dict.data, workspace_manage, is_x_pack_ee),
420421
select_string=get_file_content(
421422
os.path.join(PROJECT_DIR, "apps", "application", 'sql',
422423
'list_application.sql' if workspace_manage else (
@@ -425,13 +426,14 @@ def list(self, instance: Dict):
425426

426427
def page(self, current_page: int, page_size: int, instance: Dict):
427428
self.is_valid(raise_exception=True)
428-
ApplicationQueryRequest(data=instance).is_valid(raise_exception=True)
429+
req_dict = ApplicationQueryRequest(data=instance)
430+
req_dict.is_valid(raise_exception=True)
429431
workspace_id = self.data.get('workspace_id')
430432
user_id = self.data.get("user_id")
431433
workspace_manage = is_workspace_manage(user_id, workspace_id)
432434
is_x_pack_ee = self.is_x_pack_ee()
433435
result = native_page_search(current_page, page_size,
434-
self.get_query_set(instance, workspace_manage, is_x_pack_ee),
436+
self.get_query_set(req_dict.data, workspace_manage, is_x_pack_ee),
435437
get_file_content(
436438
os.path.join(PROJECT_DIR, "apps", "application", 'sql',
437439
'list_application.sql' if workspace_manage else (

ui/src/components/folder-tree/index.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ import { TreeToFlatten } from '@/utils/array'
178178
import { MsgConfirm, MsgError, MsgSuccess } from '@/utils/message'
179179
import permissionMap from '@/permission'
180180
import bus from '@/bus'
181+
import { v } from "vue-router/dist/router-CWoNjPRp";
181182
const { folder, user } = useStore()
182183
183184
defineOptions({ name: 'FolderTree' })
@@ -621,7 +622,11 @@ const title = ref('')
621622
const loading = ref(false)
622623
623624
watch(filterText, (val) => {
624-
treeRef.value!.filter(val)
625+
let v = val
626+
if (val) {
627+
v = val.trim()
628+
}
629+
treeRef.value!.filter(v)
625630
})
626631
const filterNode = (value: string, data: Tree) => {
627632
if (!value) return true

0 commit comments

Comments
 (0)