From 7952dbf34d9bce149f7fb81a7e570d5ce4c5c59d Mon Sep 17 00:00:00 2001 From: Nivedin <53208152+nivedin@users.noreply.github.com> Date: Wed, 25 Jun 2025 14:12:51 +0530 Subject: [PATCH] feat: ability to copy initial and current env value to eachother (#5195) --- packages/hoppscotch-common/locales/en.json | 6 +- .../components/environments/my/Details.vue | 126 +++++++++++++--- .../components/environments/teams/Details.vue | 140 ++++++++++++++---- .../spotlight/searchers/tab.searcher.ts | 30 +++- 4 files changed, 249 insertions(+), 53 deletions(-) diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 0e40de01..885357ad 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -414,8 +414,8 @@ "empty_variables": "No variables", "global": "Global", "global_variables": "Global variables", - "initial_value": "Initial value", "import_or_create": "Import or create a environment", + "initial_value": "Initial value", "invalid_name": "Please provide a name for the environment", "list": "Environment variables", "my_environments": "Personal Environments", @@ -426,6 +426,10 @@ "no_environment": "No environment", "no_environment_description": "No environments were selected. Choose what to do with the following variables.", "quick_peek": "Environment Quick Peek", + "replace_all_current_with_initial": "Replace all current with initial", + "replace_all_initial_with_current": "Replace all initial with current", + "replace_current_with_initial": "Replace with initial", + "replace_initial_with_current": "Replace with current", "replace_with_variable": "Replace with variable", "scope": "Scope", "secrets": "Secrets", diff --git a/packages/hoppscotch-common/src/components/environments/my/Details.vue b/packages/hoppscotch-common/src/components/environments/my/Details.vue index 44b7a947..8042e6eb 100644 --- a/packages/hoppscotch-common/src/components/environments/my/Details.vue +++ b/packages/hoppscotch-common/src/components/environments/my/Details.vue @@ -46,6 +46,59 @@ :title="t('add.new')" @click="addEnvironmentVariable" /> + + + + @@ -87,26 +140,52 @@ })}`" :name="'variable' + index" /> - - +
+ + +
+ +
+ + +
+
(null) +const tippyActions = ref(null) + const editingName = ref(null) const editingID = ref("") const vars = ref([ diff --git a/packages/hoppscotch-common/src/components/environments/teams/Details.vue b/packages/hoppscotch-common/src/components/environments/teams/Details.vue index cc32205e..6b294908 100644 --- a/packages/hoppscotch-common/src/components/environments/teams/Details.vue +++ b/packages/hoppscotch-common/src/components/environments/teams/Details.vue @@ -48,6 +48,60 @@ :title="t('add.new')" @click="addEnvironmentVariable" /> + + + +
@@ -94,27 +148,54 @@ :name="'variable' + index" :disabled="isViewer" /> - - +
+ + +
+ +
+ + +
+
(null) +const tippyActions = ref(null) + const editingName = ref(null) const editingID = ref(null) const vars = ref([ diff --git a/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts b/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts index e7042aa4..a8938d6a 100644 --- a/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts +++ b/packages/hoppscotch-common/src/services/spotlight/searchers/tab.searcher.ts @@ -101,7 +101,10 @@ export class TabSpotlightSearcherService extends StaticSpotlightSearcherService< alternates: ["tab", "previous", "prev", "switch"], icon: markRaw(IconArrowLeft), excludeFromSearch: computed( - () => !this.showAction.value || !this.isDesktopMode.value || this.isOnlyTab.value + () => + !this.showAction.value || + !this.isDesktopMode.value || + this.isOnlyTab.value ), }, tab_next: { @@ -109,23 +112,38 @@ export class TabSpotlightSearcherService extends StaticSpotlightSearcherService< alternates: ["tab", "next", "switch"], icon: markRaw(IconArrowRight), excludeFromSearch: computed( - () => !this.showAction.value || !this.isDesktopMode.value || this.isOnlyTab.value + () => + !this.showAction.value || + !this.isDesktopMode.value || + this.isOnlyTab.value ), }, tab_switch_to_first: { - text: [this.t("spotlight.tab.title"), this.t("spotlight.tab.switch_to_first")], + text: [ + this.t("spotlight.tab.title"), + this.t("spotlight.tab.switch_to_first"), + ], alternates: ["tab", "first", "switch", "go to first"], icon: markRaw(IconChevronsLeft), excludeFromSearch: computed( - () => !this.showAction.value || !this.isDesktopMode.value || this.isOnlyTab.value + () => + !this.showAction.value || + !this.isDesktopMode.value || + this.isOnlyTab.value ), }, tab_switch_to_last: { - text: [this.t("spotlight.tab.title"), this.t("spotlight.tab.switch_to_last")], + text: [ + this.t("spotlight.tab.title"), + this.t("spotlight.tab.switch_to_last"), + ], alternates: ["tab", "last", "switch", "go to last"], icon: markRaw(IconChevronsRight), excludeFromSearch: computed( - () => !this.showAction.value || !this.isDesktopMode.value || this.isOnlyTab.value + () => + !this.showAction.value || + !this.isDesktopMode.value || + this.isOnlyTab.value ), }, })