Skip to content

Commit c3c6a55

Browse files
committed
refactor: application add chat_background
1 parent 2fccb9d commit c3c6a55

File tree

2 files changed

+31
-15
lines changed

2 files changed

+31
-15
lines changed

apps/application/views/application_api_key.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from application.models import ApplicationApiKey
99
from application.serializers.application_api_key import ApplicationKeySerializer
1010
from common.auth import TokenAuth
11+
from common.auth.authentication import has_permissions
12+
from common.constants.permission_constants import PermissionConstants
1113
from common.log.log import log
1214
from common.result import result, success
1315

@@ -34,10 +36,11 @@ class ApplicationKey(APIView):
3436
)
3537
@log(menu='Application', operate="Add ApiKey",
3638
get_operation_object=lambda r, k: get_application_operation_object(k.get('application_api_key_id')))
37-
def post(self,request: Request, application_id: str, workspace_id: str):
39+
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
40+
def post(self, request: Request, application_id: str, workspace_id: str):
3841
return result.success(ApplicationKeySerializer(
39-
data={'application_id': application_id, 'user_id': request.user.id,
40-
'workspace_id':workspace_id}).generate())
42+
data={'application_id': application_id, 'user_id': request.user.id,
43+
'workspace_id': workspace_id}).generate())
4144

4245
@extend_schema(
4346
methods=['GET'],
@@ -47,11 +50,11 @@ def post(self,request: Request, application_id: str, workspace_id: str):
4750
parameters=ApplicationKeyCreateAPI.get_parameters(),
4851
tags=[_('Application Api Key')] # type: ignore
4952
)
50-
def get(self,request: Request, application_id: str, workspace_id: str):
51-
return result,success(ApplicationKeySerializer(
52-
data={'application_id':application_id, 'user_id':request.user.id,
53-
'workspace_id':workspace_id}).list())
54-
53+
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
54+
def get(self, request: Request, application_id: str, workspace_id: str):
55+
return result, success(ApplicationKeySerializer(
56+
data={'application_id': application_id, 'user_id': request.user.id,
57+
'workspace_id': workspace_id}).list())
5558

5659
class Operate(APIView):
5760
authentication_classes = [TokenAuth]
@@ -64,9 +67,6 @@ class Operate(APIView):
6467
parameters=ApplicationKeyCreateAPI.get_parameters(),
6568
tags=[_('Application Api Key')] # type: ignore
6669
)
70+
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
6771
def put(self, request: Request, application_id: str, workspace_id: str):
68-
return result.success(ApplicationKeySerializer.Operate(
69-
70-
)
71-
)
72-
72+
return result.success(ApplicationKeySerializer.Operate())

ui/src/views/application-overview/component/XPackDisplaySettingDialog.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ const defaultSetting = {
439439
show_history: true,
440440
draggable: true,
441441
show_guide: true,
442+
icon: '',
443+
icon_url: '',
444+
chat_background: '',
445+
chat_background_url: '',
442446
avatar: '',
443447
avatar_url: '',
444448
float_icon: '',
@@ -465,9 +469,13 @@ const xpackForm = ref<any>({
465469
show_source: false,
466470
show_exec: false,
467471
language: '',
472+
icon: '',
473+
icon_url: '',
468474
show_history: false,
469475
draggable: false,
470476
show_guide: false,
477+
chat_background: '',
478+
chat_background_url: '',
471479
avatar: '',
472480
avatar_url: '',
473481
float_icon: '',
@@ -491,7 +499,9 @@ const xpackForm = ref<any>({
491499
const imgUrl = ref<any>({
492500
avatar: '',
493501
float_icon: '',
494-
user_avatar: ''
502+
user_avatar: '',
503+
icon: '',
504+
chat_background: ''
495505
})
496506
497507
const dialogVisible = ref<boolean>(false)
@@ -511,7 +521,9 @@ function resetForm() {
511521
imgUrl.value = {
512522
avatar: '',
513523
float_icon: '',
514-
user_avatar: ''
524+
user_avatar: '',
525+
icon: '',
526+
chat_background: ''
515527
}
516528
}
517529
@@ -538,6 +550,8 @@ const open = (data: any, content: any) => {
538550
xpackForm.value.draggable = data.draggable
539551
xpackForm.value.show_guide = data.show_guide
540552
imgUrl.value.avatar = data.avatar
553+
imgUrl.value.icon = data.icon
554+
imgUrl.value.chat_background = data.chat_background
541555
imgUrl.value.float_icon = data.float_icon
542556
imgUrl.value.user_avatar = data.user_avatar
543557
xpackForm.value.disclaimer = data.disclaimer
@@ -551,6 +565,8 @@ const open = (data: any, content: any) => {
551565
)
552566
}
553567
xpackForm.value.avatar_url = data.avatar
568+
xpackForm.value.chat_background_url = data.chat_background
569+
xpackForm.value.icon_url = data.icon
554570
xpackForm.value.user_avatar_url = data.user_avatar
555571
xpackForm.value.float_icon_url = data.float_icon
556572
xpackForm.value.show_avatar = data.show_avatar

0 commit comments

Comments
 (0)