Browse Source

fix: default value

pull/6420/head
sreehari jayaraj 1 year ago
parent
commit
7ffa1a4350
  1. 50
      packages/nc-gui/components/account/Token.vue

50
packages/nc-gui/components/account/Token.vue

@ -29,7 +29,9 @@ const showNewTokenModal = ref(false)
const currentLimit = ref(10) const currentLimit = ref(10)
const selectedTokenData = ref<ApiTokenType>({}) const selectedTokenData = ref<ApiTokenType>({
description: 'untitled token',
})
const searchText = ref<string>('') const searchText = ref<string>('')
@ -103,6 +105,7 @@ const generateToken = async () => {
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} finally { } finally {
selectedTokenData.value.description = 'untitled token'
$e('a:api-token:generate') $e('a:api-token:generate')
} }
} }
@ -180,6 +183,7 @@ const handleCancel = () => {
<a-input <a-input
:ref="descriptionInput" :ref="descriptionInput"
v-model:value="selectedTokenData.description" v-model:value="selectedTokenData.description"
default-value="untitled token"
type="text" type="text"
class="!rounded-lg !py-1" class="!rounded-lg !py-1"
placeholder="Token Name" placeholder="Token Name"
@ -204,7 +208,7 @@ const handleCancel = () => {
</div> </div>
<NcDivider /> <NcDivider />
</div> </div>
<div v-if="!tokens.length"> <div v-if="!tokens.length" class="h-118 justify-center flex items-center">
<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>
@ -227,26 +231,28 @@ const handleCancel = () => {
</span> </span>
<!-- ACTIONS --> <!-- ACTIONS -->
<span class="text-gray-500 font-medium text-3.5 w-2/9"> <span class="text-gray-500 font-medium text-3.5 w-2/9">
<div class="flex justify-end gap-3 pr-5"> <div class="flex justify-end items-center gap-3 pr-5">
<component <NcTooltip placement="top">
:is="iconMap.eyeSlash" <template #title>show or hide</template>
v-if="el.token === selectedToken.id && selectedToken.isShow" <component
class="hover::cursor-pointer" :is="iconMap.eye"
@click="hideOrShowToken(el.token as string)" class="nc-toggle-token-visibility hover::cursor-pointer"
/> @click="hideOrShowToken(el.token as string)"
<component />
:is="iconMap.eye" </NcTooltip>
v-else <NcTooltip placement="top" class="h-4">
class="nc-toggle-token-visibility hover::cursor-pointer" <template #title>copy</template>
@click="hideOrShowToken(el.token as string)" <component :is="iconMap.copy" class="hover::cursor-pointer" @click="copyToken(el.token)" />
/> </NcTooltip>
<component :is="iconMap.copy" class="hover::cursor-pointer" @click="copyToken(el.token)" /> <NcTooltip placement="top" class="mb-0.5">
<component <template #title>delete</template>
:is="iconMap.delete" <component
data-testid="nc-token-row-action-icon" :is="iconMap.delete"
class="nc-delete-icon hover::cursor-pointer" data-testid="nc-token-row-action-icon"
@click="triggerDeleteModal(el.token as string, el.description as string)" class="nc-delete-icon hover::cursor-pointer"
/> @click="triggerDeleteModal(el.token as string, el.description as string)"
/>
</NcTooltip>
</div> </div>
</span> </span>
</div> </div>

Loading…
Cancel
Save