Skip to content

Commit db5df1e

Browse files
committed
fix: improve formatting and consistency in APIKeyDialog and SettingAPIKeyDrawer components
1 parent 2f0e4b3 commit db5df1e

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

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

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<template #default="{ row }">
4040
<div v-if="row.is_active" class="flex align-center">
4141
<el-icon class="color-success mr-8" style="font-size: 16px">
42-
<SuccessFilled />
42+
<SuccessFilled/>
4343
</el-icon>
4444
<span class="color-text-primary">
4545
{{ $t('common.status.enabled') }}
@@ -89,9 +89,9 @@
8989
<el-table-column :label="$t('common.operation')" align="left" width="130">
9090
<template #default="{ row }">
9191
<span @click.stop>
92-
<el-switch size="small" v-model="row.is_active" @change="changeState(row)" />
92+
<el-switch size="small" v-model="row.is_active" @change="changeState($event, row)"/>
9393
</span>
94-
<el-divider direction="vertical" />
94+
<el-divider direction="vertical"/>
9595
<span class="mr-4">
9696
<el-tooltip effect="dark" :content="$t('common.setting')" placement="top">
9797
<el-button type="primary" text @click.stop="settingApiKey(row)">
@@ -107,23 +107,23 @@
107107
</template>
108108
</el-table-column>
109109
</app-table>
110-
<SettingAPIKeyDialog ref="SettingAPIKeyDialogRef" @refresh="refresh" />
110+
<SettingAPIKeyDialog ref="SettingAPIKeyDialogRef" @refresh="refresh"/>
111111
</el-dialog>
112112
</template>
113113
<script setup lang="ts">
114-
import { ref, watch, computed, reactive } from 'vue'
115-
import { useRoute } from 'vue-router'
116-
import { copyClick } from '@/utils/clipboard'
114+
import {ref, watch, computed, reactive} from 'vue'
115+
import {useRoute} from 'vue-router'
116+
import {copyClick} from '@/utils/clipboard'
117117
import SettingAPIKeyDialog from './SettingAPIKeyDrawer.vue'
118-
import { datetimeFormat, fromNowDate } from '@/utils/time'
119-
import { MsgSuccess, MsgConfirm } from '@/utils/message'
120-
import { t } from '@/locales'
121-
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
118+
import {datetimeFormat, fromNowDate} from '@/utils/time'
119+
import {MsgSuccess, MsgConfirm} from '@/utils/message'
120+
import {t} from '@/locales'
121+
import {loadSharedApi} from '@/utils/dynamics-api/shared-api'
122122
123123
const orderBy = ref<string>('')
124124
const route = useRoute()
125125
const {
126-
params: { id },
126+
params: {id},
127127
} = route
128128
129129
const apiType = computed(() => {
@@ -173,22 +173,23 @@ function deleteApiKey(row: any) {
173173
},
174174
)
175175
.then(() => {
176-
loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
176+
loadSharedApi({type: 'applicationKey', systemType: apiType.value})
177177
.delAPIKey(id as string, row.id, loading)
178178
.then(() => {
179179
MsgSuccess(t('common.deleteSuccess'))
180180
getApiKeyList()
181181
})
182182
})
183-
.catch(() => {})
183+
.catch(() => {
184+
})
184185
}
185186
186-
async function changeState(row: any) {
187+
async function changeState(bool: boolean, row: any) {
187188
const obj = {
188-
is_active: !row.is_active,
189+
is_active: bool,
189190
}
190191
const str = obj.is_active ? t('common.status.enabled') : t('common.status.disabled')
191-
await loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
192+
await loadSharedApi({type: 'applicationKey', systemType: apiType.value})
192193
.putAPIKey(id as string, row.id, obj, loading)
193194
.then(() => {
194195
MsgSuccess(str)
@@ -201,7 +202,7 @@ async function changeState(row: any) {
201202
}
202203
203204
function createApiKey() {
204-
loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
205+
loadSharedApi({type: 'applicationKey', systemType: apiType.value})
205206
.postAPIKey(id as string, loading)
206207
.then(() => {
207208
getApiKeyList()
@@ -217,7 +218,7 @@ function getApiKeyList() {
217218
const param = {
218219
order_by: orderBy.value,
219220
}
220-
loadSharedApi({ type: 'applicationKey', systemType: apiType.value })
221+
loadSharedApi({type: 'applicationKey', systemType: apiType.value})
221222
.getAPIKey(
222223
id as string,
223224
paginationConfig.current_page,
@@ -231,7 +232,7 @@ function getApiKeyList() {
231232
})
232233
}
233234
234-
function handleSortChange({ prop, order }: { prop: string; order: string }) {
235+
function handleSortChange({prop, order}: { prop: string; order: string }) {
235236
orderBy.value = order === 'ascending' ? prop : `-${prop}`
236237
getApiKeyList()
237238
}
@@ -249,7 +250,7 @@ function refresh() {
249250
getApiKeyList()
250251
}
251252
252-
defineExpose({ open })
253+
defineExpose({open})
253254
</script>
254255
<style lang="scss" scoped>
255256
.api-key-container {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
>
1010
<el-form label-position="top" ref="settingFormRef" :model="form">
1111
<el-form-item label="API KEY">
12-
<div class="complex-input flex align-center w-full" style="background-color: var(--el-disabled-bg-color);">
13-
<el-input class="complex-input__left" v-model="form.secret_key" :disabled="true"></el-input>
12+
<div class="complex-input flex align-center w-full"
13+
style="background-color: var(--el-disabled-bg-color);">
14+
<el-input class="complex-input__left" v-model="form.secret_key"
15+
:disabled="true"></el-input>
1416
<el-tooltip :content="$t('common.copy')" placement="top">
1517
<el-button text>
16-
<AppIcon iconName="app-copy" class="color-secondary"></AppIcon>
18+
<AppIcon iconName="app-copy" class="color-secondary"
19+
@click="copyClick(form.secret_key)"></AppIcon>
1720
</el-button>
1821
</el-tooltip>
1922
</div>
@@ -85,6 +88,7 @@ import {MsgSuccess} from '@/utils/message'
8588
import {t} from '@/locales'
8689
import {loadSharedApi} from '@/utils/dynamics-api/shared-api'
8790
import {expiredTimeList, AfterTimestamp} from '@/utils/time'
91+
import {copyClick} from "@/utils/clipboard.ts";
8892
8993
const route = useRoute()
9094
const {
@@ -158,6 +162,7 @@ const submit = async (formEl: FormInstance | undefined) => {
158162
: [],
159163
expire_time: form.value.expire_time,
160164
is_permanent: form.value.expiredTimeType === 'never',
165+
is_active: form.value.is_active,
161166
}
162167
163168
const apiCall =

0 commit comments

Comments
 (0)