diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 301448130..45b5420c8 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -24,6 +24,7 @@ "go_back": "Go back", "go_forward": "Go forward", "group_by": "Group by", + "hide_secret": "Hide secret", "label": "Label", "learn_more": "Learn more", "less": "Less", @@ -43,6 +44,7 @@ "search": "Search", "send": "Send", "share": "Share", + "show_secret": "Show secret", "start": "Start", "starting": "Starting", "stop": "Stop", @@ -238,6 +240,7 @@ "profile": "Login to view your profile", "protocols": "Protocols are empty", "schema": "Connect to a GraphQL endpoint to view schema", + "secret_environments": "Secret environments are not synced to Hoppscotch hence user has to provide it's value during run-time.", "shared_requests": "Shared requests are empty", "shared_requests_logout": "Login to view your shared requests or create a new one", "subscription": "Subscriptions are empty", @@ -269,6 +272,8 @@ "quick_peek": "Environment Quick Peek", "replace_with_variable": "Replace with variable", "scope": "Scope", + "secret": "Secret", + "secret_value": "Secret value", "select": "Select environment", "set": "Set environment", "set_as_environment": "Set as environment", @@ -277,6 +282,7 @@ "updated": "Environment updated", "value": "Value", "variable": "Variable", + "variables":"Variables", "variable_list": "Variable List" }, "error": { @@ -413,6 +419,8 @@ "description": "Inspect possible errors", "environment": { "add_environment": "Add to Environment", + "add_environment_value": "Add value", + "empty_value": "Environment value is empty for the variable '{variable}' ", "not_found": "Environment variable “{environment}” not found." }, "header": { diff --git a/packages/hoppscotch-common/src/components/environments/Add.vue b/packages/hoppscotch-common/src/components/environments/Add.vue index 3d81d1116..3446d2349 100644 --- a/packages/hoppscotch-common/src/components/environments/Add.vue +++ b/packages/hoppscotch-common/src/components/environments/Add.vue @@ -21,7 +21,7 @@ - { addGlobalEnvVariable({ key: editingName.value, value: editingValue.value, + secret: false, }) toast.success(`${t("environment.updated")}`) } else if (scope.value.type === "my-environment") { addEnvironmentVariable(scope.value.index, { key: editingName.value, value: editingValue.value, + secret: false, }) toast.success(`${t("environment.updated")}`) } else { diff --git a/packages/hoppscotch-common/src/components/environments/ImportExport.vue b/packages/hoppscotch-common/src/components/environments/ImportExport.vue index d092aedbd..56c2f3869 100644 --- a/packages/hoppscotch-common/src/components/environments/ImportExport.vue +++ b/packages/hoppscotch-common/src/components/environments/ImportExport.vue @@ -9,7 +9,7 @@ diff --git a/packages/hoppscotch-common/src/components/environments/my/Environment.vue b/packages/hoppscotch-common/src/components/environments/my/Environment.vue index 04a272442..e5f8a80ea 100644 --- a/packages/hoppscotch-common/src/components/environments/my/Environment.vue +++ b/packages/hoppscotch-common/src/components/environments/my/Environment.vue @@ -135,6 +135,8 @@ import { useToast } from "@composables/toast" import { TippyComponent } from "vue-tippy" import { HoppSmartItem } from "@hoppscotch/ui" import { exportAsJSON } from "~/helpers/import-export/export/environment" +import { useService } from "dioc/vue" +import { SecretEnvironmentService } from "~/services/secret-environment.service" const t = useI18n() const toast = useToast() @@ -150,6 +152,8 @@ const emit = defineEmits<{ const confirmRemove = ref(false) +const secretEnvironmentService = useService(SecretEnvironmentService) + const exportEnvironmentAsJSON = () => { const { environment, environmentIndex } = props exportAsJSON(environment, environmentIndex) @@ -168,6 +172,7 @@ const removeEnvironment = () => { if (props.environmentIndex === null) return if (props.environmentIndex !== "Global") { deleteEnvironment(props.environmentIndex, props.environment.id) + secretEnvironmentService.deleteSecretEnvironment(props.environment.id) } toast.success(`${t("state.deleted")}`) } diff --git a/packages/hoppscotch-common/src/components/environments/my/index.vue b/packages/hoppscotch-common/src/components/environments/my/index.vue index f066df1e4..9eaa2f00c 100644 --- a/packages/hoppscotch-common/src/components/environments/my/index.vue +++ b/packages/hoppscotch-common/src/components/environments/my/index.vue @@ -67,6 +67,7 @@ :action="action" :editing-environment-index="editingEnvironmentIndex" :editing-variable-name="editingVariableName" + :is-secret-option-selected="secretOptionSelected" @hide-modal="displayModalEdit(false)" /> ("edit") const editingEnvironmentIndex = ref(null) const editingVariableName = ref("") +const secretOptionSelected = ref(false) const displayModalAdd = (shouldDisplay: boolean) => { action.value = "new" @@ -120,18 +122,23 @@ const editEnvironment = (environmentIndex: number) => { } const resetSelectedData = () => { editingEnvironmentIndex.value = null + editingVariableName.value = "" + secretOptionSelected.value = false } defineActionHandler( "modals.my.environment.edit", - ({ envName, variableName }) => { + ({ envName, variableName, isSecret }) => { if (variableName) editingVariableName.value = variableName const envIndex: number = environments.value.findIndex( (environment: Environment) => { return environment.name === envName } ) - if (envName !== "Global") editEnvironment(envIndex) + if (envName !== "Global") { + editEnvironment(envIndex) + secretOptionSelected.value = isSecret ?? false + } } ) diff --git a/packages/hoppscotch-common/src/components/environments/teams/Details.vue b/packages/hoppscotch-common/src/components/environments/teams/Details.vue index d54d18034..906a7a608 100644 --- a/packages/hoppscotch-common/src/components/environments/teams/Details.vue +++ b/packages/hoppscotch-common/src/components/environments/teams/Details.vue @@ -16,90 +16,112 @@ @submit="saveEnvironment" /> -
- -
- - -
-
-
- {{ t("environment.nested_overflow") }} -
-
+
- - -
- -
+ {{ t("environment.nested_overflow") }}
- - -