将DeveloperSettings.vue中三元表达式改为计算属性
This commit is contained in:
parent
2a6698db89
commit
65768b7a4c
@ -7,9 +7,7 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="text-xl font-semibold">{{ $t('API Access') }}</div>
|
||||
<Button @click="showCreateSecretDialog = true">{{
|
||||
$team.pg?.user_info?.api_key
|
||||
? $t('Regenerate API Key')
|
||||
: $t('Create New API Key')
|
||||
apiKeyButtonLabel
|
||||
}}</Button>
|
||||
</div>
|
||||
<div v-if="$team.pg?.user_info?.api_key">
|
||||
@ -23,23 +21,7 @@
|
||||
</div>
|
||||
<Dialog
|
||||
v-model="showCreateSecretDialog"
|
||||
:options="{
|
||||
title: $t('API Access'),
|
||||
size: 'xl',
|
||||
actions: [
|
||||
{
|
||||
label: $team.pg.user_info.api_key
|
||||
? $t('Regenerate API Key')
|
||||
: $t('Create New API Key'),
|
||||
variant: 'solid',
|
||||
disabled: createSecret.data,
|
||||
loading: createSecret.loading,
|
||||
onClick() {
|
||||
createSecret.submit();
|
||||
}
|
||||
}
|
||||
]
|
||||
}"
|
||||
:options="apiKeyDialogOptions"
|
||||
>
|
||||
<template #body-content>
|
||||
<div v-if="createSecret.data">
|
||||
@ -468,6 +450,30 @@ webhookListResource.reload();
|
||||
}
|
||||
};
|
||||
|
||||
const apiKeyButtonLabel = computed(() => {
|
||||
return $team.pg?.user_info?.api_key
|
||||
? $t('Regenerate API Key')
|
||||
: $t('Create New API Key');
|
||||
});
|
||||
|
||||
const apiKeyDialogOptions = computed(() => ({
|
||||
title: $t('API Access'),
|
||||
size: 'xl',
|
||||
actions: [
|
||||
{
|
||||
label: $team.pg.user_info.api_key
|
||||
? $t('Regenerate API Key')
|
||||
: $t('Create New API Key'),
|
||||
variant: 'solid',
|
||||
disabled: createSecret.data,
|
||||
loading: createSecret.loading,
|
||||
onClick() {
|
||||
createSecret.submit();
|
||||
}
|
||||
}
|
||||
]
|
||||
}));
|
||||
|
||||
onMounted(() => {
|
||||
if (session.hasWebhookConfigurationAccess) {
|
||||
webhookListResource.fetch();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user