refactor: application add chat_background
This commit is contained in:
parent
2fccb9db67
commit
c3c6a551ae
@ -8,6 +8,8 @@ from application.api.application_api_key import ApplicationKeyCreateAPI
|
|||||||
from application.models import ApplicationApiKey
|
from application.models import ApplicationApiKey
|
||||||
from application.serializers.application_api_key import ApplicationKeySerializer
|
from application.serializers.application_api_key import ApplicationKeySerializer
|
||||||
from common.auth import TokenAuth
|
from common.auth import TokenAuth
|
||||||
|
from common.auth.authentication import has_permissions
|
||||||
|
from common.constants.permission_constants import PermissionConstants
|
||||||
from common.log.log import log
|
from common.log.log import log
|
||||||
from common.result import result, success
|
from common.result import result, success
|
||||||
|
|
||||||
@ -34,10 +36,11 @@ class ApplicationKey(APIView):
|
|||||||
)
|
)
|
||||||
@log(menu='Application', operate="Add ApiKey",
|
@log(menu='Application', operate="Add ApiKey",
|
||||||
get_operation_object=lambda r, k: get_application_operation_object(k.get('application_api_key_id')))
|
get_operation_object=lambda r, k: get_application_operation_object(k.get('application_api_key_id')))
|
||||||
def post(self,request: Request, application_id: str, workspace_id: str):
|
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
|
||||||
|
def post(self, request: Request, application_id: str, workspace_id: str):
|
||||||
return result.success(ApplicationKeySerializer(
|
return result.success(ApplicationKeySerializer(
|
||||||
data={'application_id': application_id, 'user_id': request.user.id,
|
data={'application_id': application_id, 'user_id': request.user.id,
|
||||||
'workspace_id':workspace_id}).generate())
|
'workspace_id': workspace_id}).generate())
|
||||||
|
|
||||||
@extend_schema(
|
@extend_schema(
|
||||||
methods=['GET'],
|
methods=['GET'],
|
||||||
@ -47,11 +50,11 @@ class ApplicationKey(APIView):
|
|||||||
parameters=ApplicationKeyCreateAPI.get_parameters(),
|
parameters=ApplicationKeyCreateAPI.get_parameters(),
|
||||||
tags=[_('Application Api Key')] # type: ignore
|
tags=[_('Application Api Key')] # type: ignore
|
||||||
)
|
)
|
||||||
def get(self,request: Request, application_id: str, workspace_id: str):
|
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
|
||||||
return result,success(ApplicationKeySerializer(
|
def get(self, request: Request, application_id: str, workspace_id: str):
|
||||||
data={'application_id':application_id, 'user_id':request.user.id,
|
return result, success(ApplicationKeySerializer(
|
||||||
'workspace_id':workspace_id}).list())
|
data={'application_id': application_id, 'user_id': request.user.id,
|
||||||
|
'workspace_id': workspace_id}).list())
|
||||||
|
|
||||||
class Operate(APIView):
|
class Operate(APIView):
|
||||||
authentication_classes = [TokenAuth]
|
authentication_classes = [TokenAuth]
|
||||||
@ -64,9 +67,6 @@ class ApplicationKey(APIView):
|
|||||||
parameters=ApplicationKeyCreateAPI.get_parameters(),
|
parameters=ApplicationKeyCreateAPI.get_parameters(),
|
||||||
tags=[_('Application Api Key')] # type: ignore
|
tags=[_('Application Api Key')] # type: ignore
|
||||||
)
|
)
|
||||||
|
@has_permissions(PermissionConstants.APPLICATION_OVERVIEW_API_KEY.get_workspace_application_permission())
|
||||||
def put(self, request: Request, application_id: str, workspace_id: str):
|
def put(self, request: Request, application_id: str, workspace_id: str):
|
||||||
return result.success(ApplicationKeySerializer.Operate(
|
return result.success(ApplicationKeySerializer.Operate())
|
||||||
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|||||||
@ -439,6 +439,10 @@ const defaultSetting = {
|
|||||||
show_history: true,
|
show_history: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
show_guide: true,
|
show_guide: true,
|
||||||
|
icon: '',
|
||||||
|
icon_url: '',
|
||||||
|
chat_background: '',
|
||||||
|
chat_background_url: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
avatar_url: '',
|
avatar_url: '',
|
||||||
float_icon: '',
|
float_icon: '',
|
||||||
@ -465,9 +469,13 @@ const xpackForm = ref<any>({
|
|||||||
show_source: false,
|
show_source: false,
|
||||||
show_exec: false,
|
show_exec: false,
|
||||||
language: '',
|
language: '',
|
||||||
|
icon: '',
|
||||||
|
icon_url: '',
|
||||||
show_history: false,
|
show_history: false,
|
||||||
draggable: false,
|
draggable: false,
|
||||||
show_guide: false,
|
show_guide: false,
|
||||||
|
chat_background: '',
|
||||||
|
chat_background_url: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
avatar_url: '',
|
avatar_url: '',
|
||||||
float_icon: '',
|
float_icon: '',
|
||||||
@ -491,7 +499,9 @@ const xpackForm = ref<any>({
|
|||||||
const imgUrl = ref<any>({
|
const imgUrl = ref<any>({
|
||||||
avatar: '',
|
avatar: '',
|
||||||
float_icon: '',
|
float_icon: '',
|
||||||
user_avatar: ''
|
user_avatar: '',
|
||||||
|
icon: '',
|
||||||
|
chat_background: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
@ -511,7 +521,9 @@ function resetForm() {
|
|||||||
imgUrl.value = {
|
imgUrl.value = {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
float_icon: '',
|
float_icon: '',
|
||||||
user_avatar: ''
|
user_avatar: '',
|
||||||
|
icon: '',
|
||||||
|
chat_background: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,6 +550,8 @@ const open = (data: any, content: any) => {
|
|||||||
xpackForm.value.draggable = data.draggable
|
xpackForm.value.draggable = data.draggable
|
||||||
xpackForm.value.show_guide = data.show_guide
|
xpackForm.value.show_guide = data.show_guide
|
||||||
imgUrl.value.avatar = data.avatar
|
imgUrl.value.avatar = data.avatar
|
||||||
|
imgUrl.value.icon = data.icon
|
||||||
|
imgUrl.value.chat_background = data.chat_background
|
||||||
imgUrl.value.float_icon = data.float_icon
|
imgUrl.value.float_icon = data.float_icon
|
||||||
imgUrl.value.user_avatar = data.user_avatar
|
imgUrl.value.user_avatar = data.user_avatar
|
||||||
xpackForm.value.disclaimer = data.disclaimer
|
xpackForm.value.disclaimer = data.disclaimer
|
||||||
@ -551,6 +565,8 @@ const open = (data: any, content: any) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
xpackForm.value.avatar_url = data.avatar
|
xpackForm.value.avatar_url = data.avatar
|
||||||
|
xpackForm.value.chat_background_url = data.chat_background
|
||||||
|
xpackForm.value.icon_url = data.icon
|
||||||
xpackForm.value.user_avatar_url = data.user_avatar
|
xpackForm.value.user_avatar_url = data.user_avatar
|
||||||
xpackForm.value.float_icon_url = data.float_icon
|
xpackForm.value.float_icon_url = data.float_icon
|
||||||
xpackForm.value.show_avatar = data.show_avatar
|
xpackForm.value.show_avatar = data.show_avatar
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user