diff --git a/ui/src/api/system-api-key.ts b/ui/src/api/system-api-key.ts new file mode 100644 index 000000000..9d66bc7cb --- /dev/null +++ b/ui/src/api/system-api-key.ts @@ -0,0 +1,58 @@ +import {Result} from '@/request/Result' +import {get, post, del, put} from '@/request/index' + +import {type Ref} from 'vue' + +const prefix = '/system/api_key' + +/** + * API_KEY列表 + */ +const getAPIKey: (loading?: Ref) => Promise> = () => { + return get(`${prefix}/`) +} + +/** + * 新增API_KEY + */ +const postAPIKey: (loading?: Ref) => Promise> = ( + loading +) => { + return post(`${prefix}/`, {}, undefined, loading) +} + +/** + * 删除API_KEY + * @param 参数 application_id api_key_id + */ +const delAPIKey: ( + api_key_id: String, + loading?: Ref +) => Promise> = (api_key_id, loading) => { + return del(`${prefix}/${api_key_id}/`, undefined, undefined, loading) +} + +/** + * 修改API_KEY + * data { + * is_active: boolean + * } + * @param api_key_id + * @param data + * @param loading + */ +const putAPIKey: ( + api_key_id: String, + data: any, + loading?: Ref +) => Promise> = (api_key_id, data, loading) => { + return put(`${prefix}/${api_key_id}/`, data, undefined, loading) +} + + +export default { + getAPIKey, + postAPIKey, + delAPIKey, + putAPIKey +} diff --git a/ui/src/layout/components/top-bar/avatar/APIKeyDialog.vue b/ui/src/layout/components/top-bar/avatar/APIKeyDialog.vue new file mode 100644 index 000000000..6451eed4b --- /dev/null +++ b/ui/src/layout/components/top-bar/avatar/APIKeyDialog.vue @@ -0,0 +1,185 @@ + + + diff --git a/ui/src/layout/components/top-bar/avatar/SettingAPIKeyDialog.vue b/ui/src/layout/components/top-bar/avatar/SettingAPIKeyDialog.vue new file mode 100644 index 000000000..2a48a95ee --- /dev/null +++ b/ui/src/layout/components/top-bar/avatar/SettingAPIKeyDialog.vue @@ -0,0 +1,98 @@ + + + diff --git a/ui/src/layout/components/top-bar/avatar/index.vue b/ui/src/layout/components/top-bar/avatar/index.vue index 8042bd2a7..a225ca9b8 100644 --- a/ui/src/layout/components/top-bar/avatar/index.vue +++ b/ui/src/layout/components/top-bar/avatar/index.vue @@ -22,6 +22,9 @@ {{ $t("layout.topbar.avatar.resetPassword") }} + + + {{ $t("layout.topbar.avatar.apiKey") }} {{ $t("layout.topbar.avatar.about") }} {{ $t("layout.topbar.avatar.logout") }} @@ -30,6 +33,7 @@ +