From a8a991323e1cf033f61a29e8647d86e311caf0a0 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 18 Sep 2023 21:13:33 +0800 Subject: [PATCH] Add support for delete or revoke a personal access token Signed-off-by: Ryan Wang --- .../system/users/PersonalAccessTokens.vue | 35 ++----- .../PersonalAccessTokenListItem.vue | 98 +++++++++++++++++++ 2 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 console/src/modules/system/users/components/PersonalAccessTokenListItem.vue diff --git a/console/src/modules/system/users/PersonalAccessTokens.vue b/console/src/modules/system/users/PersonalAccessTokens.vue index 37cbad7b2a4..fb30b017261 100644 --- a/console/src/modules/system/users/PersonalAccessTokens.vue +++ b/console/src/modules/system/users/PersonalAccessTokens.vue @@ -2,10 +2,7 @@ import { IconAddCircle, VButton, - VDropdownItem, VEmpty, - VEntity, - VEntityField, VLoading, VSpace, } from "@halo-dev/components"; @@ -13,9 +10,9 @@ import { ref } from "vue"; import { apiClient } from "@/utils/api-client"; import type { PersonalAccessToken } from "@halo-dev/api-client"; import { useQuery } from "@tanstack/vue-query"; -import { formatDatetime, relativeTimeTo } from "@/utils/date"; import PersonalAccessTokenCreationModal from "./components/PersonalAccessTokenCreationModal.vue"; import { nextTick } from "vue"; +import PersonalAccessTokenListItem from "./components/PersonalAccessTokenListItem.vue"; const { data: pats, @@ -27,6 +24,12 @@ const { const { data } = await apiClient.pat.obtainPats(); return data; }, + refetchInterval(data) { + const deletingTokens = data?.filter( + (token) => !!token.metadata.deletionTimestamp + ); + return deletingTokens?.length ? 1000 : false; + }, }); // fixme: Refactor VModal component to simplify the code @@ -87,29 +90,7 @@ function onCreationModalClose() { role="list" >
  • - - - - - +
  • diff --git a/console/src/modules/system/users/components/PersonalAccessTokenListItem.vue b/console/src/modules/system/users/components/PersonalAccessTokenListItem.vue new file mode 100644 index 00000000000..d3033d1b048 --- /dev/null +++ b/console/src/modules/system/users/components/PersonalAccessTokenListItem.vue @@ -0,0 +1,98 @@ + + +