|
|
@ -73,6 +73,7 @@ loadTokens() |
|
|
|
const isModalOpen = ref(false) |
|
|
|
const isModalOpen = ref(false) |
|
|
|
const tokenDesc = ref('') |
|
|
|
const tokenDesc = ref('') |
|
|
|
const tokenToCopy = ref('') |
|
|
|
const tokenToCopy = ref('') |
|
|
|
|
|
|
|
const isTextEmpty = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const deleteToken = async (token: string): Promise<void> => { |
|
|
|
const deleteToken = async (token: string): Promise<void> => { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -89,6 +90,12 @@ const deleteToken = async (token: string): Promise<void> => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const generateToken = async () => { |
|
|
|
const generateToken = async () => { |
|
|
|
|
|
|
|
if (!selectedTokenData.value.description?.length) { |
|
|
|
|
|
|
|
isTextEmpty.value = true |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
isTextEmpty.value = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isTextEmpty.value) return |
|
|
|
try { |
|
|
|
try { |
|
|
|
await api.orgTokens.create(selectedTokenData.value) |
|
|
|
await api.orgTokens.create(selectedTokenData.value) |
|
|
|
showNewTokenModal.value = false |
|
|
|
showNewTokenModal.value = false |
|
|
@ -158,6 +165,7 @@ const descriptionInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus() |
|
|
|
v-if="showNewTokenModal" |
|
|
|
v-if="showNewTokenModal" |
|
|
|
class="flex gap-5 px-3 py-3.5 text-gray-500 font-medium text-3.5 w-full nc-token-generate" |
|
|
|
class="flex gap-5 px-3 py-3.5 text-gray-500 font-medium text-3.5 w-full nc-token-generate" |
|
|
|
> |
|
|
|
> |
|
|
|
|
|
|
|
<div class="flex flex-col w-full"> |
|
|
|
<a-input |
|
|
|
<a-input |
|
|
|
:ref="descriptionInput" |
|
|
|
:ref="descriptionInput" |
|
|
|
v-model:value="selectedTokenData.description" |
|
|
|
v-model:value="selectedTokenData.description" |
|
|
@ -166,14 +174,28 @@ const descriptionInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus() |
|
|
|
placeholder="Token Name" |
|
|
|
placeholder="Token Name" |
|
|
|
data-testid="nc-token-input" |
|
|
|
data-testid="nc-token-input" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
<span v-if="isTextEmpty" class="text-red-500 text-xs font-light mt-1.5 ml-1">token name should not be empty</span> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div class="flex gap-2 justify-start"> |
|
|
|
<div class="flex gap-2 justify-start"> |
|
|
|
<NcButton v-if="!isLoading" type="secondary" size="small" @click="showNewTokenModal = false"> Cancel </NcButton> |
|
|
|
<NcButton |
|
|
|
|
|
|
|
v-if="!isLoading" |
|
|
|
|
|
|
|
type="secondary" |
|
|
|
|
|
|
|
size="small" |
|
|
|
|
|
|
|
@click=" |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
showNewTokenModal = false |
|
|
|
|
|
|
|
isTextEmpty = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
Cancel |
|
|
|
|
|
|
|
</NcButton> |
|
|
|
<NcButton type="primary" size="sm" :is-loading="isLoading" data-testid="nc-token-save-btn" @click="generateToken"> |
|
|
|
<NcButton type="primary" size="sm" :is-loading="isLoading" data-testid="nc-token-save-btn" @click="generateToken"> |
|
|
|
Save |
|
|
|
Save |
|
|
|
</NcButton> |
|
|
|
</NcButton> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="!tokens"> |
|
|
|
<div v-if="!tokens.length"> |
|
|
|
<a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="`${$t('general.no')} ${$t('labels.token')}`" /> |
|
|
|
<a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="`${$t('general.no')} ${$t('labels.token')}`" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|