diff --git a/src/locales/de.json b/src/locales/de.json index d70a7c9d..3cdb982c 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/en.json b/src/locales/en.json index 583a591d..9e730e81 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/es.json b/src/locales/es.json index 8be088ca..efc6dfdf 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/fr.json b/src/locales/fr.json index 94d90cd0..c9047bda 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/it.json b/src/locales/it.json index 753632fd..b8ce2231 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/ja.json b/src/locales/ja.json index 53410f9d..38fd2537 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/kn.json b/src/locales/kn.json index 1670ce27..11c0acc0 100644 --- a/src/locales/kn.json +++ b/src/locales/kn.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/ko.json b/src/locales/ko.json index 626edefc..d36c3757 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/nl.json b/src/locales/nl.json index f223820d..708c82e0 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json index 8c6778eb..254efb22 100644 --- a/src/locales/pt_BR.json +++ b/src/locales/pt_BR.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/ru.json b/src/locales/ru.json index 3f23c4ab..ab9dd8e3 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/sl.json b/src/locales/sl.json index b4f88c3c..b4afffab 100644 --- a/src/locales/sl.json +++ b/src/locales/sl.json @@ -1745,6 +1745,8 @@ "Editor": "Urednik", "Expression": "Izraz", "Failed to generate expression": "Izraza ni bilo mogoče ustvariti", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Os / Kategorija", "Series": "Serije", "Transaction Date": "Datum transakcije", diff --git a/src/locales/th.json b/src/locales/th.json index 357e85c2..47c45ea9 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/tr.json b/src/locales/tr.json index 2f933375..55e3fd9a 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/uk.json b/src/locales/uk.json index 073a4f77..fdc5e58b 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/vi.json b/src/locales/vi.json index 2cce813a..270562f7 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -1745,6 +1745,8 @@ "Editor": "Editor", "Expression": "Expression", "Failed to generate expression": "Failed to generate expression", + "Data Source": "Data Source", + "All Queries": "All Queries", "Axis / Category": "Axis / Category", "Series": "Series", "Transaction Date": "Transaction Date", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index ab3de67f..bc9d7408 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1745,6 +1745,8 @@ "Editor": "编辑器", "Expression": "表达式", "Failed to generate expression": "生成表达式失败", + "Data Source": "数据源", + "All Queries": "所有查询", "Axis / Category": "轴 / 分类", "Series": "系列", "Transaction Date": "交易日期", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index a86ce30d..fd68e02d 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -1745,6 +1745,8 @@ "Editor": "編輯器", "Expression": "表達式", "Failed to generate expression": "產生表達式失敗", + "Data Source": "資料來源", + "All Queries": "所有查詢", "Axis / Category": "軸 / 類別", "Series": "系列", "Transaction Date": "交易日期", diff --git a/src/models/explorer.ts b/src/models/explorer.ts index 4c77180b..ae3d83c7 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 datatableQuerySource: string; public countPerPage: number; public chartType: TransactionExplorerChartTypeValue; public categoryDimension: TransactionExplorerDataDimensionType; @@ -78,6 +79,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { false, [], TimezoneTypeForStatistics.Default.type, + '', 15, TransactionExplorerChartType.Default.value, TransactionExplorerDataDimension.CategoryDimensionDefault.value, @@ -86,13 +88,14 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { ChartSortingType.Default.type ); - 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) { + private constructor(id: string, name: string, displayOrder: number, hidden: boolean, queries: TransactionExplorerQuery[], timezoneUsedForDateRange: number, datatableQuerySource: string, 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.datatableQuerySource = datatableQuerySource; this.countPerPage = countPerPage; this.chartType = chartType; this.categoryDimension = categoryDimension; @@ -105,6 +108,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { return { queries: this.queries.map(q => q.toJsonObject()), timezoneUsedForDateRange: this.timezoneUsedForDateRange, + datatableQuerySource: this.datatableQuerySource, countPerPage: this.countPerPage, chartType: this.chartType, categoryDimension: this.categoryDimension, @@ -135,30 +139,24 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { const data = explorerResponse.data; const queries: TransactionExplorerQuery[] = []; let timezoneUsedForDateRange = InsightsExplorer.Default.timezoneUsedForDateRange; + let datatableQuerySource = InsightsExplorer.Default.datatableQuerySource; let countPerPage = InsightsExplorer.Default.countPerPage; let chartType = InsightsExplorer.Default.chartType; let categoryDimension = InsightsExplorer.Default.categoryDimension; let seriesDimension = InsightsExplorer.Default.seriesDimension; let valueMetric = InsightsExplorer.Default.valueMetric; let chartSortingType = InsightsExplorer.Default.chartSortingType; + let hasDatatableQuerySource = false; if (data) { - if (Array.isArray(data['queries'])) { - const queryItems = data['queries'] as object[]; - - for (const queryItem of queryItems) { - const query = TransactionExplorerQuery.parse(queryItem); - - if (query) { - queries.push(query); - } - } - } - if (typeof data['timezoneUsedForDateRange'] === 'number') { timezoneUsedForDateRange = data['timezoneUsedForDateRange'] as number; } + if (typeof data['datatableQuerySource'] === 'string') { + datatableQuerySource = data['datatableQuerySource'] as string; + } + if (typeof data['countPerPage'] === 'number') { countPerPage = data['countPerPage'] as number; } @@ -182,6 +180,26 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { if (typeof data['chartSortingType'] === 'number') { chartSortingType = data['chartSortingType'] as number; } + + if (Array.isArray(data['queries'])) { + const queryItems = data['queries'] as object[]; + + for (const queryItem of queryItems) { + const query = TransactionExplorerQuery.parse(queryItem); + + if (query) { + queries.push(query); + } + + if (query && query.id === datatableQuerySource) { + hasDatatableQuerySource = true; + } + } + } + + if (!hasDatatableQuerySource) { + datatableQuerySource = ''; + } } return new InsightsExplorer( @@ -191,6 +209,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { explorerResponse.hidden, queries, timezoneUsedForDateRange, + datatableQuerySource, countPerPage, chartType, categoryDimension, @@ -208,6 +227,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse { false, [TransactionExplorerQuery.create(newQueryId)], InsightsExplorer.Default.timezoneUsedForDateRange, + InsightsExplorer.Default.datatableQuerySource, InsightsExplorer.Default.countPerPage, InsightsExplorer.Default.chartType, InsightsExplorer.Default.categoryDimension, diff --git a/src/stores/explorer.ts b/src/stores/explorer.ts index adde0390..0350f9fd 100644 --- a/src/stores/explorer.ts +++ b/src/stores/explorer.ts @@ -551,7 +551,7 @@ export const useExplorersStore = defineStore('explorers', () => { return result; }); - const filteredTransactions = computed(() => { + const filteredTransactionsInDataTable = computed(() => { if (!allTransactions.value || allTransactions.value.length < 1) { return []; } @@ -564,6 +564,10 @@ export const useExplorersStore = defineStore('explorers', () => { for (const transaction of allTransactions.value) { for (const query of currentInsightsExplorer.value.queries) { + if (currentInsightsExplorer.value.datatableQuerySource && currentInsightsExplorer.value.datatableQuerySource !== query.id) { + continue; + } + if (query.match(transaction)) { result.push(transaction); break; @@ -1165,7 +1169,7 @@ export const useExplorersStore = defineStore('explorers', () => { currentInsightsExplorer, insightsExplorerListStateInvalid, // computed - filteredTransactions, + filteredTransactionsInDataTable, categoriedTransactionExplorerData, // functions updateTransactionExplorerInvalidState, diff --git a/src/views/desktop/insights/ExplorerPage.vue b/src/views/desktop/insights/ExplorerPage.vue index 828808f9..a13219d7 100644 --- a/src/views/desktop/insights/ExplorerPage.vue +++ b/src/views/desktop/insights/ExplorerPage.vue @@ -103,7 +103,7 @@ @@ -309,7 +309,7 @@ const allExplorers = computed(() => { }); const currentFilter = computed(() => explorersStore.transactionExplorerFilter); const currentExplorer = computed(() => explorersStore.currentInsightsExplorer); -const filteredTransactions = computed(() => explorersStore.filteredTransactions); +const filteredTransactionsInDataTable = computed(() => explorersStore.filteredTransactionsInDataTable); const allDateRanges = computed(() => getAllDateRanges(DateRangeScene.InsightsExplorer, true)); const allTimezoneTypesUsedForDateRange = computed(() => getAllTimezoneTypesUsedForStatistics()); @@ -539,7 +539,7 @@ function removeExplorer(): void { } function exportResults(): void { - if (activeTab.value === 'table' && filteredTransactions.value) { + if (activeTab.value === 'table' && filteredTransactionsInDataTable.value) { const results = explorerDataTableTab.value?.buildExportResults(); if (results) { diff --git a/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue b/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue index 5b6e5899..b99b6df2 100644 --- a/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue +++ b/src/views/desktop/insights/tabs/ExplorerDataTableTab.vue @@ -3,6 +3,17 @@
+ (() => userStore.currentUserDefaultCurre const currentExplorer = computed(() => explorersStore.currentInsightsExplorer); -const filteredTransactions = computed(() => explorersStore.filteredTransactions); +const filteredTransactions = computed(() => explorersStore.filteredTransactionsInDataTable); + +const allDataTableQuerySources = computed(() => { + const sources: NameValue[] = []; + + sources.push({ + name: tt('All Queries'), + value: '' + }); + + for (const [query, index] of itemAndIndex(currentExplorer.value.queries)) { + if (query.name) { + sources.push({ + name: query.name, + value: query.id + }); + } else { + sources.push({ + name: tt('format.misc.queryIndex', { index: index + 1 }), + value: query.id + }); + } + } + + return sources; +}); const allPageCounts = computed(() => { const pageCounts: NameNumeralValue[] = []; diff --git a/src/views/desktop/insights/tabs/ExplorerQueryTab.vue b/src/views/desktop/insights/tabs/ExplorerQueryTab.vue index 0e9f6616..8a61dc1f 100644 --- a/src/views/desktop/insights/tabs/ExplorerQueryTab.vue +++ b/src/views/desktop/insights/tabs/ExplorerQueryTab.vue @@ -72,7 +72,7 @@ + @click="removeQuery(element, index)"> {{ tt('Remove Query') }} @@ -388,7 +388,7 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.ts'; import { useTransactionTagsStore } from '@/stores/transactionTag.ts'; import { useExplorersStore } from '@/stores/explorer.ts'; -import { type NameValue, entries, values } from '@/core/base.ts'; +import { type NameValue, values } from '@/core/base.ts'; import { AccountType } from '@/core/account.ts'; import { TransactionType } from '@/core/transaction.ts'; import { @@ -576,25 +576,15 @@ function duplicateQuery(query: TransactionExplorerQuery): void { queries.value.push(query.clone(generateRandomUUID())); } -function removeQuery(queryIndex: number): void { +function removeQuery(query: TransactionExplorerQuery, queryIndex: number): void { if (queries.value.length > 0) { queries.value.splice(queryIndex, 1); } - const newShowExpression: Record = {}; - - for (const [key, state] of entries(showExpression.value)) { - const index = parseInt(key); - - if (queryIndex > index) { - newShowExpression[index] = state; - } else if (queryIndex < index) { - newShowExpression[index - 1] = state; - } + if (explorersStore.currentInsightsExplorer.datatableQuerySource === query.id) { + explorersStore.currentInsightsExplorer.datatableQuerySource = ''; } - showExpression.value = newShowExpression; - if (queries.value.length < 1) { queries.value.push(TransactionExplorerQuery.create(generateRandomUUID())); }