Compare commits

..

1 Commits

Author SHA1 Message Date
amk-dev
7e2dd6af30 chore: update env variable for websocket api to use ws protocol instead of wss 2023-05-29 20:22:50 -04:00
3 changed files with 12 additions and 37 deletions

View File

@@ -165,8 +165,8 @@ const props = withDefaults(
defineProps<{ defineProps<{
show: boolean show: boolean
action: "edit" | "new" action: "edit" | "new"
editingEnvironmentIndex?: number | "Global" | null editingEnvironmentIndex: number | "Global" | null
editingVariableName?: string | null editingVariableName: string | null
envVars?: () => Environment["variables"] envVars?: () => Environment["variables"]
}>(), }>(),
{ {

View File

@@ -140,7 +140,7 @@ import * as A from "fp-ts/Array"
import * as O from "fp-ts/Option" import * as O from "fp-ts/Option"
import * as TE from "fp-ts/TaskEither" import * as TE from "fp-ts/TaskEither"
import { flow, pipe } from "fp-ts/function" import { flow, pipe } from "fp-ts/function"
import { Environment, parseTemplateStringE } from "@hoppscotch/data" import { parseTemplateStringE } from "@hoppscotch/data"
import { refAutoReset } from "@vueuse/core" import { refAutoReset } from "@vueuse/core"
import { clone } from "lodash-es" import { clone } from "lodash-es"
import { useToast } from "@composables/toast" import { useToast } from "@composables/toast"
@@ -173,20 +173,16 @@ const props = withDefaults(
defineProps<{ defineProps<{
show: boolean show: boolean
action: "edit" | "new" action: "edit" | "new"
editingEnvironment?: TeamEnvironment | null editingEnvironment: TeamEnvironment | null
editingTeamId: string | undefined editingTeamId: string | undefined
editingVariableName?: string | null editingVariableName: string | null
isViewer?: boolean isViewer: boolean
envVars?: () => Environment["variables"]
}>(), }>(),
{ {
show: false, show: false,
action: "edit", action: "edit",
editingEnvironment: null, editingEnvironment: null,
editingTeamId: "", editingTeamId: "",
editingVariableName: null,
isViewer: false,
envVars: () => [],
} }
) )
@@ -230,16 +226,10 @@ watch(
() => props.show, () => props.show,
(show) => { (show) => {
if (show) { if (show) {
if (props.action === "new") { if (props.editingEnvironment === null) {
name.value = null name.value = null
vars.value = pipe( vars.value = []
props.envVars() ?? [], } else {
A.map((e: { key: string; value: string }) => ({
id: idTicker.value++,
env: clone(e),
}))
)
} else if (props.editingEnvironment !== null) {
name.value = props.editingEnvironment.environment.name ?? null name.value = props.editingEnvironment.environment.name ?? null
vars.value = pipe( vars.value = pipe(
props.editingEnvironment.environment.variables ?? [], props.editingEnvironment.environment.variables ?? [],

View File

@@ -197,20 +197,11 @@
/> />
</div> </div>
<EnvironmentsMyDetails <EnvironmentsMyDetails
:show="showMyEnvironmentDetailsModal" :show="showModalDetails"
action="new" action="new"
:env-vars="getAdditionVars" :env-vars="getAdditionVars"
@hide-modal="displayModalAdd(false)" @hide-modal="displayModalAdd(false)"
/> />
<EnvironmentsTeamsDetails
:show="showTeamEnvironmentDetailsModal"
action="new"
:env-vars="getAdditionVars"
:editing-team-id="
workspace.type === 'team' ? workspace.teamID : undefined
"
@hide-modal="displayModalAdd(false)"
/>
</div> </div>
</template> </template>
@@ -234,7 +225,6 @@ import IconClose from "~icons/lucide/x"
import { useColorMode } from "~/composables/theming" import { useColorMode } from "~/composables/theming"
import { useVModel } from "@vueuse/core" import { useVModel } from "@vueuse/core"
import { workspaceStatus$ } from "~/newstore/workspace"
const props = defineProps<{ const props = defineProps<{
modelValue: HoppTestResult | null | undefined modelValue: HoppTestResult | null | undefined
@@ -249,15 +239,10 @@ const testResults = useVModel(props, "modelValue", emit)
const t = useI18n() const t = useI18n()
const colorMode = useColorMode() const colorMode = useColorMode()
const workspace = useReadonlyStream(workspaceStatus$, { type: "personal" }) const showModalDetails = ref(false)
const showMyEnvironmentDetailsModal = ref(false)
const showTeamEnvironmentDetailsModal = ref(false)
const displayModalAdd = (shouldDisplay: boolean) => { const displayModalAdd = (shouldDisplay: boolean) => {
if (workspace.value.type === "personal") showModalDetails.value = shouldDisplay
showMyEnvironmentDetailsModal.value = shouldDisplay
else showTeamEnvironmentDetailsModal.value = shouldDisplay
} }
/** /**