Skip to content

Commit 5bbed91

Browse files
jtydhr88github-actions
andauthored
usage log table (#4288)
Co-authored-by: github-actions <[email protected]>
1 parent eb8b67d commit 5bbed91

File tree

12 files changed

+1294
-3
lines changed

12 files changed

+1294
-3
lines changed

src/components/dialog/content/setting/CreditsPanel.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
</div>
4242
</div>
4343

44-
<div class="flex justify-between items-center mt-8">
44+
<div class="flex justify-between items-center">
45+
<h3>{{ $t('credits.activity') }}</h3>
4546
<Button
4647
:label="$t('credits.invoiceHistory')"
4748
text
@@ -81,6 +82,8 @@
8182

8283
<Divider />
8384

85+
<UsageLogsTable ref="usageLogsTableRef" />
86+
8487
<div class="flex flex-row gap-2">
8588
<Button
8689
:label="$t('credits.faqs')"
@@ -108,10 +111,11 @@ import DataTable from 'primevue/datatable'
108111
import Divider from 'primevue/divider'
109112
import Skeleton from 'primevue/skeleton'
110113
import TabPanel from 'primevue/tabpanel'
111-
import { computed, ref } from 'vue'
114+
import { computed, ref, watch } from 'vue'
112115
import { useI18n } from 'vue-i18n'
113116
114117
import UserCredit from '@/components/common/UserCredit.vue'
118+
import UsageLogsTable from '@/components/dialog/content/setting/UsageLogsTable.vue'
115119
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
116120
import { useDialogService } from '@/services/dialogService'
117121
import { useFirebaseAuthStore } from '@/stores/firebaseAuthStore'
@@ -131,12 +135,23 @@ const authActions = useFirebaseAuthActions()
131135
const loading = computed(() => authStore.loading)
132136
const balanceLoading = computed(() => authStore.isFetchingBalance)
133137
138+
const usageLogsTableRef = ref<InstanceType<typeof UsageLogsTable> | null>(null)
139+
134140
const formattedLastUpdateTime = computed(() =>
135141
authStore.lastBalanceUpdateTime
136142
? authStore.lastBalanceUpdateTime.toLocaleString()
137143
: ''
138144
)
139145
146+
watch(
147+
() => authStore.lastBalanceUpdateTime,
148+
(newTime, oldTime) => {
149+
if (newTime && newTime !== oldTime && usageLogsTableRef.value) {
150+
usageLogsTableRef.value.refresh()
151+
}
152+
}
153+
)
154+
140155
const handlePurchaseCreditsClick = () => {
141156
dialogService.showTopUpCreditsDialog()
142157
}

0 commit comments

Comments
 (0)