From f0a74a6108a85f514e8af5cfbfd094c3a38a9a19 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 7 Jan 2026 23:56:31 +0800 Subject: [PATCH] save the number of transactions per page in database --- src/models/explorer.ts | 13 ++++++++++++- .../insights/tabs/ExplorerDataTableTab.vue | 16 ++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/models/explorer.ts b/src/models/explorer.ts index 45405b5c..4c77180b 100644 --- a/src/models/explorer.ts +++ b/src/models/explorer.ts @@ -64,6 +64,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { public hidden: boolean; public queries: TransactionExplorerQuery[]; public timezoneUsedForDateRange: number; + public countPerPage: number; public chartType: TransactionExplorerChartTypeValue; public categoryDimension: TransactionExplorerDataDimensionType; public seriesDimension: TransactionExplorerDataDimensionType; @@ -77,6 +78,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { false, [], TimezoneTypeForStatistics.Default.type, + 15, TransactionExplorerChartType.Default.value, TransactionExplorerDataDimension.CategoryDimensionDefault.value, TransactionExplorerDataDimension.SeriesDimensionDefault.value, @@ -84,13 +86,14 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { ChartSortingType.Default.type ); - private constructor(id: string, name: string, displayOrder: number, hidden: boolean, queries: TransactionExplorerQuery[], timezoneUsedForDateRange: number, chartType: TransactionExplorerChartTypeValue, categoryDimension: TransactionExplorerDataDimensionType, seriesDimension: TransactionExplorerDataDimensionType, valueMetric: TransactionExplorerValueMetricType, chartSortingType: number) { + private constructor(id: string, name: string, displayOrder: number, hidden: boolean, queries: TransactionExplorerQuery[], timezoneUsedForDateRange: number, countPerPage: number, chartType: TransactionExplorerChartTypeValue, categoryDimension: TransactionExplorerDataDimensionType, seriesDimension: TransactionExplorerDataDimensionType, valueMetric: TransactionExplorerValueMetricType, chartSortingType: number) { this.id = id; this.name = name; this.displayOrder = displayOrder; this.hidden = hidden; this.queries = queries; this.timezoneUsedForDateRange = timezoneUsedForDateRange; + this.countPerPage = countPerPage; this.chartType = chartType; this.categoryDimension = categoryDimension; this.seriesDimension = seriesDimension; @@ -102,6 +105,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { return { queries: this.queries.map(q => q.toJsonObject()), timezoneUsedForDateRange: this.timezoneUsedForDateRange, + countPerPage: this.countPerPage, chartType: this.chartType, categoryDimension: this.categoryDimension, seriesDimension: this.seriesDimension, @@ -131,6 +135,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { const data = explorerResponse.data; const queries: TransactionExplorerQuery[] = []; let timezoneUsedForDateRange = InsightsExplorer.Default.timezoneUsedForDateRange; + let countPerPage = InsightsExplorer.Default.countPerPage; let chartType = InsightsExplorer.Default.chartType; let categoryDimension = InsightsExplorer.Default.categoryDimension; let seriesDimension = InsightsExplorer.Default.seriesDimension; @@ -154,6 +159,10 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { timezoneUsedForDateRange = data['timezoneUsedForDateRange'] as number; } + if (typeof data['countPerPage'] === 'number') { + countPerPage = data['countPerPage'] as number; + } + if (typeof data['chartType'] === 'string') { chartType = data['chartType'] as TransactionExplorerChartTypeValue; } @@ -182,6 +191,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { explorerResponse.hidden, queries, timezoneUsedForDateRange, + countPerPage, chartType, categoryDimension, seriesDimension, @@ -198,6 +208,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { false, [TransactionExplorerQuery.create(newQueryId)], InsightsExplorer.Default.timezoneUsedForDateRange, + InsightsExplorer.Default.countPerPage, InsightsExplorer.Default.chartType, InsightsExplorer.Default.categoryDimension, InsightsExplorer.Default.seriesDimension, diff --git a/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue b/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue index 99e09f52..5b6e5899 100644 --- a/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue +++ b/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue @@ -12,7 +12,7 @@ :disabled="loading || disabled" :label="tt('Transactions Per Page')" :items="allPageCounts" - v-model="countPerPage" + v-model="currentExplorer.countPerPage" /> @@ -27,7 +27,7 @@ :headers="dataTableHeaders" :items="filteredTransactions" :hover="true" - v-model:items-per-page="countPerPage" + v-model:items-per-page="currentExplorer.countPerPage" v-model:page="currentPage" >