From 9b4dd5600a03edf7cc846f06ad92c009c17d2810 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 11 Jan 2026 14:24:38 +0800 Subject: [PATCH] show insights explorer count on data management page --- pkg/api/data_managements.go | 8 +++++++ pkg/models/data_management.go | 1 + pkg/services/explorer.go | 11 ++++++++++ src/locales/de.json | 1 + src/locales/en.json | 1 + src/locales/es.json | 1 + src/locales/fr.json | 1 + src/locales/it.json | 1 + src/locales/ja.json | 1 + src/locales/kn.json | 1 + src/locales/ko.json | 1 + src/locales/nl.json | 1 + src/locales/pt_BR.json | 1 + src/locales/ru.json | 1 + src/locales/sl.json | 1 + src/locales/th.json | 1 + src/locales/tr.json | 1 + src/locales/uk.json | 1 + src/locales/vi.json | 1 + src/locales/zh_Hans.json | 1 + src/locales/zh_Hant.json | 1 + src/models/data_management.ts | 2 ++ .../base/users/DataManagementPageBase.ts | 1 + .../tabs/UserDataManagementSettingTab.vue | 21 ++++++++++++------- src/views/mobile/users/DataManagementPage.vue | 6 ++++-- 25 files changed, 59 insertions(+), 9 deletions(-) diff --git a/pkg/api/data_managements.go b/pkg/api/data_managements.go index 95b57944..4556af9f 100644 --- a/pkg/api/data_managements.go +++ b/pkg/api/data_managements.go @@ -101,6 +101,13 @@ func (a *DataManagementsApi) DataStatisticsHandler(c *core.WebContext) (any, *er return nil, errs.ErrOperationFailed } + totalInsightsExplorerCount, err := a.insightsExploreres.GetTotalInsightsExplorersCountByUid(c, uid) + + if err != nil { + log.Errorf(c, "[data_managements.DataStatisticsHandler] failed to get total insights explorer count for user \"uid:%d\", because %s", uid, err.Error()) + return nil, errs.ErrOperationFailed + } + totalTransactionTemplateCount, err := a.templates.GetTotalNormalTemplateCountByUid(c, uid) if err != nil { @@ -121,6 +128,7 @@ func (a *DataManagementsApi) DataStatisticsHandler(c *core.WebContext) (any, *er TotalTransactionTagCount: totalTransactionTagCount, TotalTransactionCount: totalTransactionCount, TotalTransactionPictureCount: totalTransactionPictureCount, + TotalInsightsExplorerCount: totalInsightsExplorerCount, TotalTransactionTemplateCount: totalTransactionTemplateCount, TotalScheduledTransactionCount: totalScheduledTransactionCount, } diff --git a/pkg/models/data_management.go b/pkg/models/data_management.go index 02dc643d..16d4d6ad 100644 --- a/pkg/models/data_management.go +++ b/pkg/models/data_management.go @@ -18,6 +18,7 @@ type DataStatisticsResponse struct { TotalTransactionTagCount int64 `json:"totalTransactionTagCount,string"` TotalTransactionCount int64 `json:"totalTransactionCount,string"` TotalTransactionPictureCount int64 `json:"totalTransactionPictureCount,string"` + TotalInsightsExplorerCount int64 `json:"totalInsightsExplorerCount,string"` TotalTransactionTemplateCount int64 `json:"totalTransactionTemplateCount,string"` TotalScheduledTransactionCount int64 `json:"totalScheduledTransactionCount,string"` } diff --git a/pkg/services/explorer.go b/pkg/services/explorer.go index a045338b..25c294de 100644 --- a/pkg/services/explorer.go +++ b/pkg/services/explorer.go @@ -30,6 +30,17 @@ var ( } ) +// GetTotalInsightsExplorersCountByUid returns total insights explorers count of user +func (s *InsightsExplorerService) GetTotalInsightsExplorersCountByUid(c core.Context, uid int64) (int64, error) { + if uid <= 0 { + return 0, errs.ErrUserIdInvalid + } + + count, err := s.UserDataDB(uid).NewSession(c).Where("uid=? AND deleted=?", uid, false).Count(&models.InsightsExplorer{}) + + return count, err +} + // GetAllInsightsExplorerNamesByUid returns all insights explorer models of user without data func (s *InsightsExplorerService) GetAllInsightsExplorerNamesByUid(c core.Context, uid int64) ([]*models.InsightsExplorer, error) { if uid <= 0 { diff --git a/src/locales/de.json b/src/locales/de.json index 642ec1b1..8bb0aafd 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Transaktionsdetails", "Statistics & Analysis": "Statistiken & Analysen", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/en.json b/src/locales/en.json index ccccc582..3a5b7845 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Transaction Details", "Statistics & Analysis": "Statistics & Analysis", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/es.json b/src/locales/es.json index f4d43fff..b2cc6c16 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Detalles", "Statistics & Analysis": "Estadísticas y Análisis", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/fr.json b/src/locales/fr.json index 2a145372..376a8630 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Détails de la transaction", "Statistics & Analysis": "Statistiques et analyse", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/it.json b/src/locales/it.json index 76bc9c4a..d1448001 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Dettagli transazione", "Statistics & Analysis": "Statistiche e analisi", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/ja.json b/src/locales/ja.json index a58922c4..d70b23b5 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -1709,6 +1709,7 @@ "Transaction Details": "取引の詳細", "Statistics & Analysis": "統計と分析", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/kn.json b/src/locales/kn.json index 0ee7931e..9de95eb5 100644 --- a/src/locales/kn.json +++ b/src/locales/kn.json @@ -1709,6 +1709,7 @@ "Transaction Details": "ವಹಿವಾಟಿನ ವಿವರಗಳು", "Statistics & Analysis": "ಸಂಖ್ಯಾಶಾಸ್ತ್ರ ಮತ್ತು ವಿಶ್ಲೇಷಣೆ", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/ko.json b/src/locales/ko.json index 66478e5d..bd3a584e 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1709,6 +1709,7 @@ "Transaction Details": "거래 세부사항", "Statistics & Analysis": "통계 및 분석", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/nl.json b/src/locales/nl.json index 64009a88..62dc3ef3 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Transactiedetails", "Statistics & Analysis": "Statistieken & Analyse", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json index 462d49f9..ec6b662e 100644 --- a/src/locales/pt_BR.json +++ b/src/locales/pt_BR.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Detalhes da Transação", "Statistics & Analysis": "Estatísticas e Análise", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/ru.json b/src/locales/ru.json index 52909601..58017524 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Детали транзакции", "Statistics & Analysis": "Статистика и анализ", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/sl.json b/src/locales/sl.json index a1b91b10..c50a9cd0 100644 --- a/src/locales/sl.json +++ b/src/locales/sl.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Podrobnosti transakcije", "Statistics & Analysis": "Statistika in analiza", "Insights Explorer": "Vpogledi in raziskovanje", + "Insights Explorers": "Insights Explorers", "Query": "Poizvedba", "Data Table": "Podatkovna tabela", "Chart": "Grafikon", diff --git a/src/locales/th.json b/src/locales/th.json index e210ac03..71c2bad1 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -1709,6 +1709,7 @@ "Transaction Details": "รายละเอียดธุรกรรม", "Statistics & Analysis": "สถิติ & การวิเคราะห์", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/tr.json b/src/locales/tr.json index 5f49688e..51677760 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -1709,6 +1709,7 @@ "Transaction Details": "İşlem Detayları", "Statistics & Analysis": "İstatistik & Analiz", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/uk.json b/src/locales/uk.json index 2d77ee84..34f6519d 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Деталі по транзакціях", "Statistics & Analysis": "Статистика та аналіз", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/vi.json b/src/locales/vi.json index fa4d946e..0bfe74b8 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -1709,6 +1709,7 @@ "Transaction Details": "Chi tiết giao dịch", "Statistics & Analysis": "Thống kê & Phân tích", "Insights Explorer": "Insights Explorer", + "Insights Explorers": "Insights Explorers", "Query": "Query", "Data Table": "Data Table", "Chart": "Chart", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 4eb7dec6..a320967f 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1709,6 +1709,7 @@ "Transaction Details": "交易详情", "Statistics & Analysis": "统计分析", "Insights Explorer": "洞察探索", + "Insights Explorers": "洞察探索", "Query": "查询", "Data Table": "数据表格", "Chart": "图表", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index f4bde73a..ab8bd197 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -1709,6 +1709,7 @@ "Transaction Details": "交易詳情", "Statistics & Analysis": "統計分析", "Insights Explorer": "洞察探索", + "Insights Explorers": "洞察探索", "Query": "查詢", "Data Table": "資料表格", "Chart": "圖表", diff --git a/src/models/data_management.ts b/src/models/data_management.ts index c204ea12..592d0eb7 100644 --- a/src/models/data_management.ts +++ b/src/models/data_management.ts @@ -24,6 +24,7 @@ export interface DataStatisticsResponse { readonly totalTransactionTagCount: string; readonly totalTransactionCount: string; readonly totalTransactionPictureCount: string; + readonly totalInsightsExplorerCount: string; readonly totalTransactionTemplateCount: string; readonly totalScheduledTransactionCount: string; } @@ -34,6 +35,7 @@ export interface DisplayDataStatistics { readonly totalTransactionTagCount: string; readonly totalTransactionCount: string; readonly totalTransactionPictureCount: string; + readonly totalInsightsExplorerCount: string; readonly totalTransactionTemplateCount: string; readonly totalScheduledTransactionCount: string; } diff --git a/src/views/base/users/DataManagementPageBase.ts b/src/views/base/users/DataManagementPageBase.ts index 42cb994e..145144d4 100644 --- a/src/views/base/users/DataManagementPageBase.ts +++ b/src/views/base/users/DataManagementPageBase.ts @@ -24,6 +24,7 @@ export function useDataManagementPageBase() { totalTransactionCategoryCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionCategoryCount)), totalTransactionTagCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionTagCount)), totalTransactionPictureCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionPictureCount)), + totalInsightsExplorerCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalInsightsExplorerCount)), totalTransactionTemplateCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionTemplateCount)), totalScheduledTransactionCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalScheduledTransactionCount)) }; diff --git a/src/views/desktop/user/settings/tabs/UserDataManagementSettingTab.vue b/src/views/desktop/user/settings/tabs/UserDataManagementSettingTab.vue index de4fb912..e9a440c0 100644 --- a/src/views/desktop/user/settings/tabs/UserDataManagementSettingTab.vue +++ b/src/views/desktop/user/settings/tabs/UserDataManagementSettingTab.vue @@ -25,6 +25,18 @@ icon: mdiListBoxOutline, color: 'info-darken-1' }, + { + title: 'Transaction Pictures', + count: displayDataStatistics ? displayDataStatistics.totalTransactionPictureCount : '-', + icon: mdiImage, + color: 'error-darken-1' + }, + { + title: 'Insights Explorers', + count: displayDataStatistics ? displayDataStatistics.totalInsightsExplorerCount : '-', + icon: mdiCompassOutline, + color: 'warning' + }, { title: 'Accounts', count: displayDataStatistics ? displayDataStatistics.totalAccountCount : '-', @@ -43,12 +55,6 @@ icon: mdiTagOutline, color: 'grey' }, - { - title: 'Transaction Pictures', - count: displayDataStatistics ? displayDataStatistics.totalTransactionPictureCount : '-', - icon: mdiImage, - color: 'error-darken-1' - }, { title: 'Transaction Templates', count: displayDataStatistics ? displayDataStatistics.totalTransactionTemplateCount : '-', @@ -182,10 +188,11 @@ import { mdiRefresh, mdiListBoxOutline, mdiCreditCardOutline, + mdiImage, + mdiCompassOutline, mdiViewDashboardOutline, mdiTagOutline, mdiClipboardTextOutline, - mdiImage, mdiClipboardTextClockOutline, mdiAlert } from '@mdi/js'; diff --git a/src/views/mobile/users/DataManagementPage.vue b/src/views/mobile/users/DataManagementPage.vue index 86d8d24b..4fa6dd9e 100644 --- a/src/views/mobile/users/DataManagementPage.vue +++ b/src/views/mobile/users/DataManagementPage.vue @@ -4,20 +4,22 @@ + + - + + -