Skip to content

Commit f93b644

Browse files
authored
Merge pull request #44 from aws-samples/fix/team-members-show-deleted-tokens
fix: team members list shows deleted tokens
2 parents 310701b + 1dac014 commit f93b644

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

backend/app/api/admin/endpoints/teams.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ async def get_team_dashboard(
293293
& (UsageRecord.created_at >= monthly_boundary),
294294
)
295295
.where(TeamMember.team_id == team_uuid)
296+
.where(APIToken.is_deleted.is_(False))
296297
.group_by(
297298
TeamMember.token_id,
298299
TeamMember.allocated_usd,

frontend/src/pages/TeamsPage.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,9 @@ async function handleBatchCreate() {
854854
855855
onMounted(async () => {
856856
await teamsStore.fetchTeams();
857+
if (teamsStore.currentTeam) {
858+
await teamsStore.fetchTeamDashboard(teamsStore.currentTeam.id);
859+
}
857860
void modelsStore.fetchAvailableModels();
858861
});
859862
</script>

frontend/src/pages/TokensPage.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,14 @@
553553
<script setup lang="ts">
554554
import { ref, computed, onMounted } from 'vue';
555555
import { useTokensStore } from 'src/stores/tokens';
556+
import { useTeamsStore } from 'src/stores/teams';
556557
import { useModelsStore } from 'src/stores/models';
557558
import { Notify, Dialog, copyToClipboard } from 'quasar';
558559
import { getApiBaseUrl } from 'src/utils/api';
559560
import type { APIToken, APITokenWithKey, CreateTokenRequest, TokenMetadata, BatchCreateTokenRequest } from 'src/stores/tokens';
560561
561562
const tokensStore = useTokensStore();
563+
const teamsStore = useTeamsStore();
562564
const modelsStore = useModelsStore();
563565
564566
const searchQuery = ref('');
@@ -896,7 +898,11 @@ function deleteToken(token: APIToken) {
896898
class: 'flat-dialog',
897899
}).onOk(() => {
898900
deletingTokenId.value = token.id;
899-
void tokensStore.deleteToken(token.id).finally(() => {
901+
void tokensStore.deleteToken(token.id).then(() => {
902+
if (token.team_id) {
903+
void teamsStore.fetchTeams();
904+
}
905+
}).finally(() => {
900906
deletingTokenId.value = null;
901907
});
902908
});

0 commit comments

Comments
 (0)