From 3b706681624c5f706ea00f715b4d480f341c77ef Mon Sep 17 00:00:00 2001 From: James George <25279263+jamesgeorge007@users.noreply.github.com> Date: Thu, 27 Jun 2024 06:47:56 -0700 Subject: [PATCH] feat: CLI collection runner command generation UI flow (#4141) Co-authored-by: nivedin --- packages/hoppscotch-common/locales/en.json | 20 ++- .../hoppscotch-common/src/components.d.ts | 2 + .../src/components/collections/Collection.vue | 59 +++++-- .../src/components/collections/Properties.vue | 116 +++++++++++--- .../src/components/collections/Runner.vue | 149 +++++++++++++++++ .../collections/TeamCollections.vue | 3 + .../src/components/collections/index.vue | 151 ++++++++++++------ .../components/environments/Properties.vue | 123 ++++++++++++++ .../environments/teams/Environment.vue | 43 +++-- .../components/environments/teams/index.vue | 18 +++ packages/hoppscotch-common/src/vite-envs.d.ts | 1 + 11 files changed, 586 insertions(+), 99 deletions(-) create mode 100644 packages/hoppscotch-common/src/components/collections/Runner.vue create mode 100644 packages/hoppscotch-common/src/components/environments/Properties.vue diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 020e26672..25fd77a60 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -191,7 +191,8 @@ "save_as": "Save as", "save_to_collection": "Save to Collection", "select": "Select a Collection", - "select_location": "Select location" + "select_location": "Select location", + "details": "Details" }, "confirm": { "close_unsaved_tab": "Are you sure you want to close this tab?", @@ -309,7 +310,9 @@ "value": "Value", "variable": "Variable", "variables": "Variables", - "variable_list": "Variable List" + "variable_list": "Variable List", + "properties": "Environment Properties", + "details": "Details" }, "error": { "authproviders_load_error": "Unable to load auth providers", @@ -1062,5 +1065,18 @@ "generate_new_token": "Generate new token", "generate_modal_title": "New Personal Access Token", "deletion_success": "The access token {label} has been deleted" + }, + "collection_runner": { + "collection_id": "Collection ID", + "environment_id": "Environment ID", + "cli_collection_id_description": "This collection ID will be used by the CLI collection runner for Hoppscotch.", + "cli_environment_id_description": "This environment ID will be used by the CLI collection runner for Hoppscotch.", + "include_active_environment": "Include active environment:", + "cli": "CLI", + "ui": "Runner (coming soon)", + "cli_command_generation_description_cloud": "Copy the below command and run it from the CLI. Please specify a personal access token.", + "cli_command_generation_description_sh": "Copy the below command and run it from the CLI. Please specify a personal access token and verify the generated SH instance server URL.", + "cli_command_generation_description_sh_with_server_url_placeholder": "Copy the below command and run it from the CLI. Please specify a personal access token and the SH instance server URL.", + "run_collection": "Run collection" } } diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.ts index 7a70939f2..95a157787 100644 --- a/packages/hoppscotch-common/src/components.d.ts +++ b/packages/hoppscotch-common/src/components.d.ts @@ -61,6 +61,7 @@ declare module 'vue' { CollectionsMyCollections: typeof import('./components/collections/MyCollections.vue')['default'] CollectionsProperties: typeof import('./components/collections/Properties.vue')['default'] CollectionsRequest: typeof import('./components/collections/Request.vue')['default'] + CollectionsRunner: typeof import('./components/collections/Runner.vue')['default'] CollectionsSaveRequest: typeof import('./components/collections/SaveRequest.vue')['default'] CollectionsTeamCollections: typeof import('./components/collections/TeamCollections.vue')['default'] CookiesAllModal: typeof import('./components/cookies/AllModal.vue')['default'] @@ -72,6 +73,7 @@ declare module 'vue' { EnvironmentsMy: typeof import('./components/environments/my/index.vue')['default'] EnvironmentsMyDetails: typeof import('./components/environments/my/Details.vue')['default'] EnvironmentsMyEnvironment: typeof import('./components/environments/my/Environment.vue')['default'] + EnvironmentsProperties: typeof import('./components/environments/Properties.vue')['default'] EnvironmentsSelector: typeof import('./components/environments/Selector.vue')['default'] EnvironmentsTeams: typeof import('./components/environments/teams/index.vue')['default'] EnvironmentsTeamsDetails: typeof import('./components/environments/teams/Details.vue')['default'] diff --git a/packages/hoppscotch-common/src/components/collections/Collection.vue b/packages/hoppscotch-common/src/components/collections/Collection.vue index 5847fec90..bb3cfca4f 100644 --- a/packages/hoppscotch-common/src/components/collections/Collection.vue +++ b/packages/hoppscotch-common/src/components/collections/Collection.vue @@ -33,7 +33,7 @@ dropItemID = '' } " - @contextmenu.prevent="options?.tippy.show()" + @contextmenu.prevent="options?.tippy?.show()" >
+
@@ -197,26 +219,27 @@ diff --git a/packages/hoppscotch-common/src/components/collections/Runner.vue b/packages/hoppscotch-common/src/components/collections/Runner.vue new file mode 100644 index 000000000..5ffcdffc0 --- /dev/null +++ b/packages/hoppscotch-common/src/components/collections/Runner.vue @@ -0,0 +1,149 @@ + + + diff --git a/packages/hoppscotch-common/src/components/collections/TeamCollections.vue b/packages/hoppscotch-common/src/components/collections/TeamCollections.vue index 6ed1d2067..c9abd2de4 100644 --- a/packages/hoppscotch-common/src/components/collections/TeamCollections.vue +++ b/packages/hoppscotch-common/src/components/collections/TeamCollections.vue @@ -129,6 +129,7 @@ }) } " + @run-collection="emit('run-collection', $event)" @click=" () => { handleCollectionClick({ @@ -218,6 +219,7 @@ }) } " + @run-collection="emit('run-collection', $event)" @click=" () => { handleCollectionClick({ @@ -586,6 +588,7 @@ const emit = defineEmits<{ (event: "expand-team-collection", payload: string): void (event: "display-modal-add"): void (event: "display-modal-import-export"): void + (event: "run-collection", collectionID: string): void }>() const getPath = (path: string) => { diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue index faf173ead..1a3db57d8 100644 --- a/packages/hoppscotch-common/src/components/collections/index.vue +++ b/packages/hoppscotch-common/src/components/collections/index.vue @@ -94,6 +94,7 @@ @display-modal-add="displayModalAdd(true)" @display-modal-import-export="displayModalImportExport(true)" @collection-click="handleCollectionClick" + @run-collection="runCollectionHandler" /> diff --git a/packages/hoppscotch-common/src/components/environments/teams/Environment.vue b/packages/hoppscotch-common/src/components/environments/teams/Environment.vue index 2271a997b..9ed169fa6 100644 --- a/packages/hoppscotch-common/src/components/environments/teams/Environment.vue +++ b/packages/hoppscotch-common/src/components/environments/teams/Environment.vue @@ -40,7 +40,8 @@ @keyup.d="duplicate!.$el.click()" @keyup.j="exportAsJsonEl!.$el.click()" @keyup.delete="deleteAction!.$el.click()" - @keyup.escape="options!.tippy().hide()" + @keyup.p="propertiesAction!.$el.click()" + @keyup.escape="options!.tippy?.hide()" > + @@ -108,26 +121,28 @@