mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
support configuring the data source of the data table in insights explorer
This commit is contained in:
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Urednik",
|
"Editor": "Urednik",
|
||||||
"Expression": "Izraz",
|
"Expression": "Izraz",
|
||||||
"Failed to generate expression": "Izraza ni bilo mogoče ustvariti",
|
"Failed to generate expression": "Izraza ni bilo mogoče ustvariti",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Os / Kategorija",
|
"Axis / Category": "Os / Kategorija",
|
||||||
"Series": "Serije",
|
"Series": "Serije",
|
||||||
"Transaction Date": "Datum transakcije",
|
"Transaction Date": "Datum transakcije",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "Editor",
|
"Editor": "Editor",
|
||||||
"Expression": "Expression",
|
"Expression": "Expression",
|
||||||
"Failed to generate expression": "Failed to generate expression",
|
"Failed to generate expression": "Failed to generate expression",
|
||||||
|
"Data Source": "Data Source",
|
||||||
|
"All Queries": "All Queries",
|
||||||
"Axis / Category": "Axis / Category",
|
"Axis / Category": "Axis / Category",
|
||||||
"Series": "Series",
|
"Series": "Series",
|
||||||
"Transaction Date": "Transaction Date",
|
"Transaction Date": "Transaction Date",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "编辑器",
|
"Editor": "编辑器",
|
||||||
"Expression": "表达式",
|
"Expression": "表达式",
|
||||||
"Failed to generate expression": "生成表达式失败",
|
"Failed to generate expression": "生成表达式失败",
|
||||||
|
"Data Source": "数据源",
|
||||||
|
"All Queries": "所有查询",
|
||||||
"Axis / Category": "轴 / 分类",
|
"Axis / Category": "轴 / 分类",
|
||||||
"Series": "系列",
|
"Series": "系列",
|
||||||
"Transaction Date": "交易日期",
|
"Transaction Date": "交易日期",
|
||||||
|
|||||||
@@ -1745,6 +1745,8 @@
|
|||||||
"Editor": "編輯器",
|
"Editor": "編輯器",
|
||||||
"Expression": "表達式",
|
"Expression": "表達式",
|
||||||
"Failed to generate expression": "產生表達式失敗",
|
"Failed to generate expression": "產生表達式失敗",
|
||||||
|
"Data Source": "資料來源",
|
||||||
|
"All Queries": "所有查詢",
|
||||||
"Axis / Category": "軸 / 類別",
|
"Axis / Category": "軸 / 類別",
|
||||||
"Series": "系列",
|
"Series": "系列",
|
||||||
"Transaction Date": "交易日期",
|
"Transaction Date": "交易日期",
|
||||||
|
|||||||
+33
-13
@@ -64,6 +64,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
public hidden: boolean;
|
public hidden: boolean;
|
||||||
public queries: TransactionExplorerQuery[];
|
public queries: TransactionExplorerQuery[];
|
||||||
public timezoneUsedForDateRange: number;
|
public timezoneUsedForDateRange: number;
|
||||||
|
public datatableQuerySource: string;
|
||||||
public countPerPage: number;
|
public countPerPage: number;
|
||||||
public chartType: TransactionExplorerChartTypeValue;
|
public chartType: TransactionExplorerChartTypeValue;
|
||||||
public categoryDimension: TransactionExplorerDataDimensionType;
|
public categoryDimension: TransactionExplorerDataDimensionType;
|
||||||
@@ -78,6 +79,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
false,
|
false,
|
||||||
[],
|
[],
|
||||||
TimezoneTypeForStatistics.Default.type,
|
TimezoneTypeForStatistics.Default.type,
|
||||||
|
'',
|
||||||
15,
|
15,
|
||||||
TransactionExplorerChartType.Default.value,
|
TransactionExplorerChartType.Default.value,
|
||||||
TransactionExplorerDataDimension.CategoryDimensionDefault.value,
|
TransactionExplorerDataDimension.CategoryDimensionDefault.value,
|
||||||
@@ -86,13 +88,14 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
ChartSortingType.Default.type
|
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.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.displayOrder = displayOrder;
|
this.displayOrder = displayOrder;
|
||||||
this.hidden = hidden;
|
this.hidden = hidden;
|
||||||
this.queries = queries;
|
this.queries = queries;
|
||||||
this.timezoneUsedForDateRange = timezoneUsedForDateRange;
|
this.timezoneUsedForDateRange = timezoneUsedForDateRange;
|
||||||
|
this.datatableQuerySource = datatableQuerySource;
|
||||||
this.countPerPage = countPerPage;
|
this.countPerPage = countPerPage;
|
||||||
this.chartType = chartType;
|
this.chartType = chartType;
|
||||||
this.categoryDimension = categoryDimension;
|
this.categoryDimension = categoryDimension;
|
||||||
@@ -105,6 +108,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
return {
|
return {
|
||||||
queries: this.queries.map(q => q.toJsonObject()),
|
queries: this.queries.map(q => q.toJsonObject()),
|
||||||
timezoneUsedForDateRange: this.timezoneUsedForDateRange,
|
timezoneUsedForDateRange: this.timezoneUsedForDateRange,
|
||||||
|
datatableQuerySource: this.datatableQuerySource,
|
||||||
countPerPage: this.countPerPage,
|
countPerPage: this.countPerPage,
|
||||||
chartType: this.chartType,
|
chartType: this.chartType,
|
||||||
categoryDimension: this.categoryDimension,
|
categoryDimension: this.categoryDimension,
|
||||||
@@ -135,30 +139,24 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
const data = explorerResponse.data;
|
const data = explorerResponse.data;
|
||||||
const queries: TransactionExplorerQuery[] = [];
|
const queries: TransactionExplorerQuery[] = [];
|
||||||
let timezoneUsedForDateRange = InsightsExplorer.Default.timezoneUsedForDateRange;
|
let timezoneUsedForDateRange = InsightsExplorer.Default.timezoneUsedForDateRange;
|
||||||
|
let datatableQuerySource = InsightsExplorer.Default.datatableQuerySource;
|
||||||
let countPerPage = InsightsExplorer.Default.countPerPage;
|
let countPerPage = InsightsExplorer.Default.countPerPage;
|
||||||
let chartType = InsightsExplorer.Default.chartType;
|
let chartType = InsightsExplorer.Default.chartType;
|
||||||
let categoryDimension = InsightsExplorer.Default.categoryDimension;
|
let categoryDimension = InsightsExplorer.Default.categoryDimension;
|
||||||
let seriesDimension = InsightsExplorer.Default.seriesDimension;
|
let seriesDimension = InsightsExplorer.Default.seriesDimension;
|
||||||
let valueMetric = InsightsExplorer.Default.valueMetric;
|
let valueMetric = InsightsExplorer.Default.valueMetric;
|
||||||
let chartSortingType = InsightsExplorer.Default.chartSortingType;
|
let chartSortingType = InsightsExplorer.Default.chartSortingType;
|
||||||
|
let hasDatatableQuerySource = false;
|
||||||
|
|
||||||
if (data) {
|
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') {
|
if (typeof data['timezoneUsedForDateRange'] === 'number') {
|
||||||
timezoneUsedForDateRange = data['timezoneUsedForDateRange'] as number;
|
timezoneUsedForDateRange = data['timezoneUsedForDateRange'] as number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof data['datatableQuerySource'] === 'string') {
|
||||||
|
datatableQuerySource = data['datatableQuerySource'] as string;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof data['countPerPage'] === 'number') {
|
if (typeof data['countPerPage'] === 'number') {
|
||||||
countPerPage = data['countPerPage'] as number;
|
countPerPage = data['countPerPage'] as number;
|
||||||
}
|
}
|
||||||
@@ -182,6 +180,26 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
if (typeof data['chartSortingType'] === 'number') {
|
if (typeof data['chartSortingType'] === 'number') {
|
||||||
chartSortingType = data['chartSortingType'] as 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(
|
return new InsightsExplorer(
|
||||||
@@ -191,6 +209,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
explorerResponse.hidden,
|
explorerResponse.hidden,
|
||||||
queries,
|
queries,
|
||||||
timezoneUsedForDateRange,
|
timezoneUsedForDateRange,
|
||||||
|
datatableQuerySource,
|
||||||
countPerPage,
|
countPerPage,
|
||||||
chartType,
|
chartType,
|
||||||
categoryDimension,
|
categoryDimension,
|
||||||
@@ -208,6 +227,7 @@ export class InsightsExplorer implements InsightsExplorerInfoResponse {
|
|||||||
false,
|
false,
|
||||||
[TransactionExplorerQuery.create(newQueryId)],
|
[TransactionExplorerQuery.create(newQueryId)],
|
||||||
InsightsExplorer.Default.timezoneUsedForDateRange,
|
InsightsExplorer.Default.timezoneUsedForDateRange,
|
||||||
|
InsightsExplorer.Default.datatableQuerySource,
|
||||||
InsightsExplorer.Default.countPerPage,
|
InsightsExplorer.Default.countPerPage,
|
||||||
InsightsExplorer.Default.chartType,
|
InsightsExplorer.Default.chartType,
|
||||||
InsightsExplorer.Default.categoryDimension,
|
InsightsExplorer.Default.categoryDimension,
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ export const useExplorersStore = defineStore('explorers', () => {
|
|||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredTransactions = computed<TransactionInsightDataItem[]>(() => {
|
const filteredTransactionsInDataTable = computed<TransactionInsightDataItem[]>(() => {
|
||||||
if (!allTransactions.value || allTransactions.value.length < 1) {
|
if (!allTransactions.value || allTransactions.value.length < 1) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -564,6 +564,10 @@ export const useExplorersStore = defineStore('explorers', () => {
|
|||||||
|
|
||||||
for (const transaction of allTransactions.value) {
|
for (const transaction of allTransactions.value) {
|
||||||
for (const query of currentInsightsExplorer.value.queries) {
|
for (const query of currentInsightsExplorer.value.queries) {
|
||||||
|
if (currentInsightsExplorer.value.datatableQuerySource && currentInsightsExplorer.value.datatableQuerySource !== query.id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (query.match(transaction)) {
|
if (query.match(transaction)) {
|
||||||
result.push(transaction);
|
result.push(transaction);
|
||||||
break;
|
break;
|
||||||
@@ -1165,7 +1169,7 @@ export const useExplorersStore = defineStore('explorers', () => {
|
|||||||
currentInsightsExplorer,
|
currentInsightsExplorer,
|
||||||
insightsExplorerListStateInvalid,
|
insightsExplorerListStateInvalid,
|
||||||
// computed
|
// computed
|
||||||
filteredTransactions,
|
filteredTransactionsInDataTable,
|
||||||
categoriedTransactionExplorerData,
|
categoriedTransactionExplorerData,
|
||||||
// functions
|
// functions
|
||||||
updateTransactionExplorerInvalidState,
|
updateTransactionExplorerInvalidState,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<v-list-item :prepend-icon="mdiExport"
|
<v-list-item :prepend-icon="mdiExport"
|
||||||
:title="tt('Export Results')"
|
:title="tt('Export Results')"
|
||||||
:disabled="loading || updating || !filteredTransactions || filteredTransactions.length < 1"
|
:disabled="loading || updating || (activeTab === 'table' && (!filteredTransactionsInDataTable || filteredTransactionsInDataTable.length < 1))"
|
||||||
@click="exportResults"
|
@click="exportResults"
|
||||||
v-if="activeTab === 'table' || activeTab === 'chart'"></v-list-item>
|
v-if="activeTab === 'table' || activeTab === 'chart'"></v-list-item>
|
||||||
<v-divider class="my-2" v-if="currentExplorer.id" />
|
<v-divider class="my-2" v-if="currentExplorer.id" />
|
||||||
@@ -309,7 +309,7 @@ const allExplorers = computed<InsightsExplorerBasicInfo[]>(() => {
|
|||||||
});
|
});
|
||||||
const currentFilter = computed<TransactionExplorerFilter>(() => explorersStore.transactionExplorerFilter);
|
const currentFilter = computed<TransactionExplorerFilter>(() => explorersStore.transactionExplorerFilter);
|
||||||
const currentExplorer = computed<InsightsExplorer>(() => explorersStore.currentInsightsExplorer);
|
const currentExplorer = computed<InsightsExplorer>(() => explorersStore.currentInsightsExplorer);
|
||||||
const filteredTransactions = computed<TransactionInsightDataItem[]>(() => explorersStore.filteredTransactions);
|
const filteredTransactionsInDataTable = computed<TransactionInsightDataItem[]>(() => explorersStore.filteredTransactionsInDataTable);
|
||||||
|
|
||||||
const allDateRanges = computed<LocalizedDateRange[]>(() => getAllDateRanges(DateRangeScene.InsightsExplorer, true));
|
const allDateRanges = computed<LocalizedDateRange[]>(() => getAllDateRanges(DateRangeScene.InsightsExplorer, true));
|
||||||
const allTimezoneTypesUsedForDateRange = computed<TypeAndDisplayName[]>(() => getAllTimezoneTypesUsedForStatistics());
|
const allTimezoneTypesUsedForDateRange = computed<TypeAndDisplayName[]>(() => getAllTimezoneTypesUsedForStatistics());
|
||||||
@@ -539,7 +539,7 @@ function removeExplorer(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exportResults(): void {
|
function exportResults(): void {
|
||||||
if (activeTab.value === 'table' && filteredTransactions.value) {
|
if (activeTab.value === 'table' && filteredTransactionsInDataTable.value) {
|
||||||
const results = explorerDataTableTab.value?.buildExportResults();
|
const results = explorerDataTableTab.value?.buildExportResults();
|
||||||
|
|
||||||
if (results) {
|
if (results) {
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
<v-row>
|
<v-row>
|
||||||
<v-col cols="12">
|
<v-col cols="12">
|
||||||
<div class="d-flex overflow-x-auto align-center gap-2 pt-2">
|
<div class="d-flex overflow-x-auto align-center gap-2 pt-2">
|
||||||
|
<v-select
|
||||||
|
class="flex-0-0"
|
||||||
|
min-width="150"
|
||||||
|
item-title="name"
|
||||||
|
item-value="value"
|
||||||
|
density="compact"
|
||||||
|
:disabled="loading || disabled"
|
||||||
|
:label="tt('Data Source')"
|
||||||
|
:items="allDataTableQuerySources"
|
||||||
|
v-model="currentExplorer.datatableQuerySource"
|
||||||
|
/>
|
||||||
<v-select
|
<v-select
|
||||||
class="flex-0-0"
|
class="flex-0-0"
|
||||||
min-width="150"
|
min-width="150"
|
||||||
@@ -117,7 +128,7 @@ import { useSettingsStore } from '@/stores/setting.ts';
|
|||||||
import { useUserStore } from '@/stores/user.ts';
|
import { useUserStore } from '@/stores/user.ts';
|
||||||
import { useExplorersStore } from '@/stores/explorer.ts';
|
import { useExplorersStore } from '@/stores/explorer.ts';
|
||||||
|
|
||||||
import type { NameNumeralValue } from '@/core/base.ts';
|
import { type NameValue, type NameNumeralValue, itemAndIndex } from '@/core/base.ts';
|
||||||
import type { NumeralSystem } from '@/core/numeral.ts';
|
import type { NumeralSystem } from '@/core/numeral.ts';
|
||||||
import { TransactionType } from '@/core/transaction.ts';
|
import { TransactionType } from '@/core/transaction.ts';
|
||||||
|
|
||||||
@@ -169,7 +180,32 @@ const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurre
|
|||||||
|
|
||||||
const currentExplorer = computed<InsightsExplorer>(() => explorersStore.currentInsightsExplorer);
|
const currentExplorer = computed<InsightsExplorer>(() => explorersStore.currentInsightsExplorer);
|
||||||
|
|
||||||
const filteredTransactions = computed<TransactionInsightDataItem[]>(() => explorersStore.filteredTransactions);
|
const filteredTransactions = computed<TransactionInsightDataItem[]>(() => explorersStore.filteredTransactionsInDataTable);
|
||||||
|
|
||||||
|
const allDataTableQuerySources = computed<NameValue[]>(() => {
|
||||||
|
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<NameNumeralValue[]>(() => {
|
const allPageCounts = computed<NameNumeralValue[]>(() => {
|
||||||
const pageCounts: NameNumeralValue[] = [];
|
const pageCounts: NameNumeralValue[] = [];
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
</v-switch>
|
</v-switch>
|
||||||
<v-btn class="ms-2" density="compact" color="default" variant="text" size="small"
|
<v-btn class="ms-2" density="compact" color="default" variant="text" size="small"
|
||||||
:icon="true" :disabled="loading || disabled || !!editingQuery || queries.length < 1 || (queries.length === 1 && (!element.conditions || element.conditions.length < 1))"
|
:icon="true" :disabled="loading || disabled || !!editingQuery || queries.length < 1 || (queries.length === 1 && (!element.conditions || element.conditions.length < 1))"
|
||||||
@click="removeQuery(index)">
|
@click="removeQuery(element, index)">
|
||||||
<v-icon :icon="mdiClose" size="18" />
|
<v-icon :icon="mdiClose" size="18" />
|
||||||
<v-tooltip activator="parent">{{ tt('Remove Query') }}</v-tooltip>
|
<v-tooltip activator="parent">{{ tt('Remove Query') }}</v-tooltip>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -388,7 +388,7 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.ts';
|
|||||||
import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
|
import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
|
||||||
import { useExplorersStore } from '@/stores/explorer.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 { AccountType } from '@/core/account.ts';
|
||||||
import { TransactionType } from '@/core/transaction.ts';
|
import { TransactionType } from '@/core/transaction.ts';
|
||||||
import {
|
import {
|
||||||
@@ -576,25 +576,15 @@ function duplicateQuery(query: TransactionExplorerQuery): void {
|
|||||||
queries.value.push(query.clone(generateRandomUUID()));
|
queries.value.push(query.clone(generateRandomUUID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeQuery(queryIndex: number): void {
|
function removeQuery(query: TransactionExplorerQuery, queryIndex: number): void {
|
||||||
if (queries.value.length > 0) {
|
if (queries.value.length > 0) {
|
||||||
queries.value.splice(queryIndex, 1);
|
queries.value.splice(queryIndex, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const newShowExpression: Record<number, boolean> = {};
|
if (explorersStore.currentInsightsExplorer.datatableQuerySource === query.id) {
|
||||||
|
explorersStore.currentInsightsExplorer.datatableQuerySource = '';
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showExpression.value = newShowExpression;
|
|
||||||
|
|
||||||
if (queries.value.length < 1) {
|
if (queries.value.length < 1) {
|
||||||
queries.value.push(TransactionExplorerQuery.create(generateRandomUUID()));
|
queries.value.push(TransactionExplorerQuery.create(generateRandomUUID()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user