From e255c46455e7338b47e84b55202042a159ed89ca Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Tue, 15 Aug 2023 19:30:37 +0530 Subject: [PATCH] feat: environment quick peek (#3119) --- packages/hoppscotch-common/locales/en.json | 5 + .../hoppscotch-common/src/components.d.ts | 37 +- .../src/components/app/Header.vue | 4 +- .../src/components/environments/Selector.vue | 647 +++++++++--------- .../src/components/environments/index.vue | 6 +- .../src/components/environments/my/index.vue | 2 +- .../components/environments/teams/index.vue | 2 +- .../hoppscotch-common/src/helpers/actions.ts | 4 +- .../src/components/smart/Windows.vue | 4 +- 9 files changed, 329 insertions(+), 382 deletions(-) diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 3b38789b1..cf5c4af79 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -204,13 +204,18 @@ "deleted": "Environment deletion", "edit": "Edit Environment", "global": "Global", + "empty_variables": "No variables", + "global_variables": "Global variables", "invalid_name": "Please provide a name for the environment", + "list": "Environment variables", "my_environments": "My Environments", "name": "Name", "nested_overflow": "nested environment variables are limited to 10 levels", "new": "New Environment", + "no_active_environment": "No active environment", "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_with_variable": "Replace with variable", "scope": "Scope", "select": "Select environment", diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.ts index 54b8070ad..bee636598 100644 --- a/packages/hoppscotch-common/src/components.d.ts +++ b/packages/hoppscotch-common/src/components.d.ts @@ -77,29 +77,6 @@ declare module '@vue/runtime-core' { History: typeof import('./components/history/index.vue')['default'] HistoryGraphqlCard: typeof import('./components/history/graphql/Card.vue')['default'] HistoryRestCard: typeof import('./components/history/rest/Card.vue')['default'] - HoppButtonPrimary: typeof import('@hoppscotch/ui')['HoppButtonPrimary'] - HoppButtonSecondary: typeof import('@hoppscotch/ui')['HoppButtonSecondary'] - HoppSmartAnchor: typeof import('@hoppscotch/ui')['HoppSmartAnchor'] - HoppSmartAutoComplete: typeof import('@hoppscotch/ui')['HoppSmartAutoComplete'] - HoppSmartCheckbox: typeof import('@hoppscotch/ui')['HoppSmartCheckbox'] - HoppSmartConfirmModal: typeof import('@hoppscotch/ui')['HoppSmartConfirmModal'] - HoppSmartExpand: typeof import('@hoppscotch/ui')['HoppSmartExpand'] - HoppSmartFileChip: typeof import('@hoppscotch/ui')['HoppSmartFileChip'] - HoppSmartInput: typeof import('@hoppscotch/ui')['HoppSmartInput'] - HoppSmartItem: typeof import('@hoppscotch/ui')['HoppSmartItem'] - HoppSmartLink: typeof import('@hoppscotch/ui')['HoppSmartLink'] - HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal'] - HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture'] - HoppSmartPlaceholder: typeof import('@hoppscotch/ui')['HoppSmartPlaceholder'] - HoppSmartProgressRing: typeof import('@hoppscotch/ui')['HoppSmartProgressRing'] - HoppSmartRadioGroup: typeof import('@hoppscotch/ui')['HoppSmartRadioGroup'] - HoppSmartSlideOver: typeof import('@hoppscotch/ui')['HoppSmartSlideOver'] - HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner'] - HoppSmartTab: typeof import('@hoppscotch/ui')['HoppSmartTab'] - HoppSmartTabs: typeof import('@hoppscotch/ui')['HoppSmartTabs'] - HoppSmartToggle: typeof import('@hoppscotch/ui')['HoppSmartToggle'] - HoppSmartWindow: typeof import('@hoppscotch/ui')['HoppSmartWindow'] - HoppSmartWindows: typeof import('@hoppscotch/ui')['HoppSmartWindows'] HttpAuthorization: typeof import('./components/http/Authorization.vue')['default'] HttpAuthorizationApiKey: typeof import('./components/http/authorization/ApiKey.vue')['default'] HttpAuthorizationBasic: typeof import('./components/http/authorization/Basic.vue')['default'] @@ -119,25 +96,13 @@ declare module '@vue/runtime-core' { HttpResponse: typeof import('./components/http/Response.vue')['default'] HttpResponseMeta: typeof import('./components/http/ResponseMeta.vue')['default'] HttpSidebar: typeof import('./components/http/Sidebar.vue')['default'] + HttpTabHead: typeof import('./components/http/TabHead.vue')['default'] HttpTestResult: typeof import('./components/http/TestResult.vue')['default'] HttpTestResultEntry: typeof import('./components/http/TestResultEntry.vue')['default'] HttpTestResultEnv: typeof import('./components/http/TestResultEnv.vue')['default'] HttpTestResultReport: typeof import('./components/http/TestResultReport.vue')['default'] HttpTests: typeof import('./components/http/Tests.vue')['default'] HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default'] - IconLucideAlertTriangle: typeof import('~icons/lucide/alert-triangle')['default'] - IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default'] - IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default'] - IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default'] - IconLucideGlobe: typeof import('~icons/lucide/globe')['default'] - IconLucideHelpCircle: typeof import('~icons/lucide/help-circle')['default'] - IconLucideInbox: typeof import('~icons/lucide/inbox')['default'] - IconLucideInfo: typeof import('~icons/lucide/info')['default'] - IconLucideLayers: typeof import('~icons/lucide/layers')['default'] - IconLucideListEnd: typeof import('~icons/lucide/list-end')['default'] - IconLucideMinus: typeof import('~icons/lucide/minus')['default'] - IconLucideSearch: typeof import('~icons/lucide/search')['default'] - IconLucideUsers: typeof import('~icons/lucide/users')['default'] LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default'] LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default'] LensesRenderersAudioLensRenderer: typeof import('./components/lenses/renderers/AudioLensRenderer.vue')['default'] diff --git a/packages/hoppscotch-common/src/components/app/Header.vue b/packages/hoppscotch-common/src/components/app/Header.vue index 90c567d9a..bcb434827 100644 --- a/packages/hoppscotch-common/src/components/app/Header.vue +++ b/packages/hoppscotch-common/src/components/app/Header.vue @@ -18,14 +18,14 @@
- + { defineActionHandler( "modals.my.environment.edit", ({ envName, variableName }) => { - editingVariableName.value = variableName + if (variableName) editingVariableName.value = variableName envName === "Global" && editEnvironment("Global") } ) diff --git a/packages/hoppscotch-common/src/components/environments/my/index.vue b/packages/hoppscotch-common/src/components/environments/my/index.vue index 1ba79a606..4b89d8401 100644 --- a/packages/hoppscotch-common/src/components/environments/my/index.vue +++ b/packages/hoppscotch-common/src/components/environments/my/index.vue @@ -109,7 +109,7 @@ const resetSelectedData = () => { defineActionHandler( "modals.my.environment.edit", ({ envName, variableName }) => { - editingVariableName.value = variableName + if (variableName) editingVariableName.value = variableName const envIndex: number = environments.value.findIndex( (environment: Environment) => { return environment.name === envName diff --git a/packages/hoppscotch-common/src/components/environments/teams/index.vue b/packages/hoppscotch-common/src/components/environments/teams/index.vue index c18a049b5..8e1bd7330 100644 --- a/packages/hoppscotch-common/src/components/environments/teams/index.vue +++ b/packages/hoppscotch-common/src/components/environments/teams/index.vue @@ -178,7 +178,7 @@ const getErrorMessage = (err: GQLError) => { defineActionHandler( "modals.team.environment.edit", ({ envName, variableName }) => { - editingVariableName.value = variableName + if (variableName) editingVariableName.value = variableName const teamEnvToEdit = props.teamEnvironments.find( (environment) => environment.environment.name === envName ) diff --git a/packages/hoppscotch-common/src/helpers/actions.ts b/packages/hoppscotch-common/src/helpers/actions.ts index 2c85347fc..b3eb87e72 100644 --- a/packages/hoppscotch-common/src/helpers/actions.ts +++ b/packages/hoppscotch-common/src/helpers/actions.ts @@ -67,11 +67,11 @@ type HoppActionArgsMap = { } "modals.my.environment.edit": { envName: string - variableName: string + variableName?: string } "modals.team.environment.edit": { envName: string - variableName: string + variableName?: string } "rest.request.open": { doc: HoppRESTDocument diff --git a/packages/hoppscotch-ui/src/components/smart/Windows.vue b/packages/hoppscotch-ui/src/components/smart/Windows.vue index af7dc2a6e..82ac92ee1 100644 --- a/packages/hoppscotch-ui/src/components/smart/Windows.vue +++ b/packages/hoppscotch-ui/src/components/smart/Windows.vue @@ -100,7 +100,7 @@ -
+
@@ -116,7 +116,7 @@ :style="[ `--thumb-width: ${scrollThumb.width}px`, `width: calc(100% - ${ - hasActions ? (mdAndLarger ? '19rem' : '7rem') : '3rem' + hasActions ? (mdAndLarger ? '19rem' : '10rem') : '3rem' })`, ]" id="myRange"