Browse Source

feat: table

pull/6420/head
sreehari jayaraj 1 year ago
parent
commit
67ac64b96c
  1. 66
      packages/nc-gui/components/account/Token.vue

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

@ -12,7 +12,11 @@ const { copy } = useCopy()
const { t } = useI18n() const { t } = useI18n()
const tokens = ref<ApiTokenType[]>([]) interface IApiTokenInfo extends ApiTokenType {
created_by: string
}
const tokens = ref<IApiTokenInfo[]>([])
const currentPage = ref(1) const currentPage = ref(1)
@ -42,7 +46,7 @@ const loadTokens = async (page = currentPage.value, limit = currentLimit.value)
pagination.total = response.pageInfo.totalRows ?? 0 pagination.total = response.pageInfo.totalRows ?? 0
pagination.pageSize = 10 pagination.pageSize = 10
tokens.value = response.list as ApiTokenType[] tokens.value = response.list as IApiTokenInfo[]
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
@ -115,19 +119,15 @@ const descriptionInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</NcButton> </NcButton>
</div> </div>
<span>Create personal API tokens to use in automation or external apps.</span> <span>Create personal API tokens to use in automation or external apps.</span>
<table class="w-full mt-5 border-1 rounded-md"> <div class="w-full mt-5 border-1 rounded-md">
<thead class="bg-gray-50"> <div class="flex w-full px-4 bg-gray-50 border-b-1">
<tr> <span class="px-3 py-3.5 text-gray-500 font-medium text-3.5 w-1/6">Token name</span>
<th class="px-3 py-3.5 text-gray-500 font-medium text-3.5">Token name</th> <span class="px-3 py-3.5 text-gray-500 font-medium text-3.5 w-1/4 text-center">Creator</span>
<th class="px-3 py-3.5 text-gray-500 font-medium text-3.5">Creator</th> <span class="px-3 py-3.5 text-gray-500 font-medium text-3.5 w-1/6 ml-12 text-center">Token</span>
<th class="px-3 py-3.5 text-gray-500 font-medium text-3.5">Token</th> <span class="px-3 py-3.5 text-gray-500 font-medium text-3.5 w-1/4 ml-20 text-center">Actions</span>
<th class="px-3 py-3.5 text-gray-500 font-medium text-3.5">Actions</th> </div>
</tr> <main>
</thead> <div v-if="showNewTokenModal" class="flex gap-5 px-3 py-3.5 text-gray-500 font-medium text-3.5 w-full">
<tbody>
<tr v-if="showNewTokenModal">
<td class="px-3 py-3.5 text-gray-500 font-medium text-3.5 text-center" colspan="3">
<div class="p-5 ml-4">
<a-input <a-input
:ref="descriptionInput" :ref="descriptionInput"
v-model:value="selectedTokenData.description" v-model:value="selectedTokenData.description"
@ -136,23 +136,29 @@ const descriptionInput: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
placeholder="Token Name" placeholder="Token Name"
data-testid="nc-token-modal-description" data-testid="nc-token-modal-description"
/> />
</div> <div class="flex gap-2 justify-start mr-10">
</td> <NcButton v-if="!isLoading" type="secondary" size="small" @click="showNewTokenModal = false"> Cancel </NcButton>
<td class="text-gray-500 font-medium text-3.5 text-center">
<div class="flex gap-2 justify-center">
<NcButton v-if="!isLoading" type="secondary" size="sm" @click="showNewTokenModal = false"> Cancel </NcButton>
<NcButton type="primary" size="sm" :is-loading="isLoading" @click="generateToken"> Save </NcButton> <NcButton type="primary" size="sm" :is-loading="isLoading" @click="generateToken"> Save </NcButton>
</div> </div>
</td> </div>
</tr> <div v-for="el of tokens" :key="el.id" class="flex border-b-1 px-7 py-3 justify-between">
<tr v-for="el of tokens" :key="el.id"> <span class="text-gray-500 font-medium text-3.5 text-start w-1/8 ml-3">{{ el.description }}</span>
<td class="px-3 py-3.5 text-gray-500 font-medium text-3.5 text-center">{{ el.description }}</td> <span class="text-gray-500 font-medium text-3.5 text-start w-1/4">{{ el.created_by }}</span>
<td class="px-3 py-3.5 text-gray-500 font-medium text-3.5 text-center">{{ el.fk_user_id }}</td> <span class="text-gray-500 font-medium text-3.5 text-start w-1/4">
<td class="px-3 py-3.5 text-gray-500 font-medium text-3.5 text-center">{{ el.token }}</td> <GeneralTruncateText placement="top" length="22">
<td class="px-3 py-3.5 text-gray-500 font-medium text-3.5 text-center">Tljghdfjghdfj</td> {{ el.token }}
</tr> </GeneralTruncateText>
</tbody> </span>
</table> <span class="text-gray-500 font-medium text-3.5 text-start w-1/4 text-center">
<div class="flex justify-center gap-3">
<component :is="iconMap.eyeSlash" class="hover::cursor-pointer" />
<component :is="iconMap.copy" class="hover::cursor-pointer" />
<component :is="iconMap.delete" class="hover::cursor-pointer" />
</div>
</span>
</div>
</main>
</div>
</div> </div>
<GeneralDeleteModal v-model:visible="isModalOpen" entity-name="Token" :on-delete="() => deleteToken(tokenToCopy)"> <GeneralDeleteModal v-model:visible="isModalOpen" entity-name="Token" :on-delete="() => deleteToken(tokenToCopy)">

Loading…
Cancel
Save