From 0dc2825e5da4c0c25aa20efc5b672ef537c8ca03 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Wed, 24 Dec 2025 01:30:18 +0800 Subject: [PATCH] support renaming queries, duplicating queries, and displaying query expressions separately for each query --- src/models/explore.ts | 16 +++ .../desktop/insights/tabs/ExploreQueryTab.vue | 134 ++++++++++++++---- 2 files changed, 125 insertions(+), 25 deletions(-) diff --git a/src/models/explore.ts b/src/models/explore.ts index 9ad73fe4..83c34abe 100644 --- a/src/models/explore.ts +++ b/src/models/explore.ts @@ -212,6 +212,22 @@ export class TransactionExploreQuery { return finalTokens; } + public clone(): TransactionExploreQuery { + const clonedConditions: TransactionExploreConditionWithRelation[] = []; + + for (const condition of this.conditions) { + const clonedCondition = TransactionExploreConditionWithRelation.parse(condition.toJsonObject()); + + if (!clonedCondition) { + continue; + } + + clonedConditions.push(clonedCondition); + } + + return new TransactionExploreQuery(this.name, clonedConditions); + } + public toJson(): string { return JSON.stringify({ name: this.name, diff --git a/src/views/desktop/insights/tabs/ExploreQueryTab.vue b/src/views/desktop/insights/tabs/ExploreQueryTab.vue index f4cfa6bf..6775b584 100644 --- a/src/views/desktop/insights/tabs/ExploreQueryTab.vue +++ b/src/views/desktop/insights/tabs/ExploreQueryTab.vue @@ -1,31 +1,66 @@