chore: bump dependencies (#3258)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
t("environment.name")
|
||||
}}</label>
|
||||
<input
|
||||
v-model="name"
|
||||
v-model="editingName"
|
||||
type="text"
|
||||
:placeholder="t('environment.variable')"
|
||||
class="input"
|
||||
@@ -88,7 +88,6 @@ const props = defineProps<{
|
||||
position: { top: number; left: number }
|
||||
name: string
|
||||
value: string
|
||||
replaceWithVariable: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -106,7 +105,7 @@ watch(
|
||||
scope.value = {
|
||||
type: "global",
|
||||
}
|
||||
name.value = ""
|
||||
editingName.value = ""
|
||||
replaceWithVariable.value = false
|
||||
}
|
||||
}
|
||||
@@ -132,22 +131,22 @@ const scope = ref<Scope>({
|
||||
|
||||
const replaceWithVariable = ref(false)
|
||||
|
||||
const name = ref("")
|
||||
const editingName = ref(props.name)
|
||||
|
||||
const addEnvironment = async () => {
|
||||
if (!name.value) {
|
||||
if (!editingName.value) {
|
||||
toast.error(`${t("environment.invalid_name")}`)
|
||||
return
|
||||
}
|
||||
if (scope.value.type === "global") {
|
||||
addGlobalEnvVariable({
|
||||
key: name.value,
|
||||
key: editingName.value,
|
||||
value: props.value,
|
||||
})
|
||||
toast.success(`${t("environment.updated")}`)
|
||||
} else if (scope.value.type === "my-environment") {
|
||||
addEnvironmentVariable(scope.value.index, {
|
||||
key: name.value,
|
||||
key: editingName.value,
|
||||
value: props.value,
|
||||
})
|
||||
toast.success(`${t("environment.updated")}`)
|
||||
@@ -155,7 +154,7 @@ const addEnvironment = async () => {
|
||||
const newVariables = [
|
||||
...scope.value.environment.environment.variables,
|
||||
{
|
||||
key: name.value,
|
||||
key: editingName.value,
|
||||
value: props.value,
|
||||
},
|
||||
]
|
||||
@@ -179,7 +178,7 @@ const addEnvironment = async () => {
|
||||
}
|
||||
if (replaceWithVariable.value) {
|
||||
//replace the current tab endpoint with the variable name with << and >>
|
||||
const variableName = `<<${name.value}>>`
|
||||
const variableName = `<<${editingName.value}>>`
|
||||
//replace the currenttab endpoint containing the value in the text with variablename
|
||||
currentActiveTab.value.document.request.endpoint =
|
||||
currentActiveTab.value.document.request.endpoint.replace(
|
||||
|
||||
@@ -171,7 +171,7 @@ const emit = defineEmits<{
|
||||
|
||||
const idTicker = ref(0)
|
||||
|
||||
const name = ref<string | null>(null)
|
||||
const editingName = ref<string | null>(null)
|
||||
const vars = ref<EnvironmentVariable[]>([
|
||||
{ id: idTicker.value++, env: { key: "", value: "" } },
|
||||
])
|
||||
@@ -224,10 +224,12 @@ const liveEnvs = computed(() => {
|
||||
}
|
||||
|
||||
if (props.editingEnvironmentIndex === "Global") {
|
||||
return [...vars.value.map((x) => ({ ...x.env, source: name.value! }))]
|
||||
return [
|
||||
...vars.value.map((x) => ({ ...x.env, source: editingName.value! })),
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
...vars.value.map((x) => ({ ...x.env, source: name.value! })),
|
||||
...vars.value.map((x) => ({ ...x.env, source: editingName.value! })),
|
||||
...globalVars.value.map((x) => ({ ...x, source: "Global" })),
|
||||
]
|
||||
}
|
||||
@@ -237,7 +239,7 @@ watch(
|
||||
() => props.show,
|
||||
(show) => {
|
||||
if (show) {
|
||||
name.value = workingEnv.value?.name ?? null
|
||||
editingName.value = workingEnv.value?.name ?? null
|
||||
vars.value = pipe(
|
||||
workingEnv.value?.variables ?? [],
|
||||
A.map((e) => ({
|
||||
@@ -270,7 +272,7 @@ const removeEnvironmentVariable = (index: number) => {
|
||||
}
|
||||
|
||||
const saveEnvironment = () => {
|
||||
if (!name.value) {
|
||||
if (!editingName.value) {
|
||||
toast.error(`${t("environment.invalid_name")}`)
|
||||
return
|
||||
}
|
||||
@@ -286,13 +288,13 @@ const saveEnvironment = () => {
|
||||
)
|
||||
|
||||
const environmentUpdated: Environment = {
|
||||
name: name.value,
|
||||
name: editingName.value,
|
||||
variables: filterdVariables,
|
||||
}
|
||||
|
||||
if (props.action === "new") {
|
||||
// Creating a new environment
|
||||
createEnvironment(name.value, environmentUpdated.variables)
|
||||
createEnvironment(editingName.value, environmentUpdated.variables)
|
||||
setSelectedEnvironmentIndex({
|
||||
type: "MY_ENV",
|
||||
index: envList.value.length - 1,
|
||||
@@ -330,7 +332,7 @@ const saveEnvironment = () => {
|
||||
}
|
||||
|
||||
const hideModal = () => {
|
||||
name.value = null
|
||||
editingName.value = null
|
||||
emit("hide-modal")
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -182,7 +182,7 @@ const emit = defineEmits<{
|
||||
|
||||
const idTicker = ref(0)
|
||||
|
||||
const name = ref<string | null>(null)
|
||||
const editingName = ref<string | null>(null)
|
||||
const vars = ref<EnvironmentVariable[]>([
|
||||
{ id: idTicker.value++, env: { key: "", value: "" } },
|
||||
])
|
||||
@@ -208,7 +208,9 @@ const liveEnvs = computed(() => {
|
||||
if (evnExpandError.value) {
|
||||
return []
|
||||
} else {
|
||||
return [...vars.value.map((x) => ({ ...x.env, source: name.value! }))]
|
||||
return [
|
||||
...vars.value.map((x) => ({ ...x.env, source: editingName.value! })),
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -217,7 +219,7 @@ watch(
|
||||
(show) => {
|
||||
if (show) {
|
||||
if (props.action === "new") {
|
||||
name.value = null
|
||||
editingName.value = null
|
||||
vars.value = pipe(
|
||||
props.envVars() ?? [],
|
||||
A.map((e: { key: string; value: string }) => ({
|
||||
@@ -226,7 +228,7 @@ watch(
|
||||
}))
|
||||
)
|
||||
} else if (props.editingEnvironment !== null) {
|
||||
name.value = props.editingEnvironment.environment.name ?? null
|
||||
editingName.value = props.editingEnvironment.environment.name ?? null
|
||||
vars.value = pipe(
|
||||
props.editingEnvironment.environment.variables ?? [],
|
||||
A.map((e: { key: string; value: string }) => ({
|
||||
@@ -264,7 +266,7 @@ const isLoading = ref(false)
|
||||
const saveEnvironment = async () => {
|
||||
isLoading.value = true
|
||||
|
||||
if (!name.value) {
|
||||
if (!editingName.value) {
|
||||
toast.error(`${t("environment.invalid_name")}`)
|
||||
return
|
||||
}
|
||||
@@ -289,7 +291,7 @@ const saveEnvironment = async () => {
|
||||
createTeamEnvironment(
|
||||
JSON.stringify(filterdVariables),
|
||||
props.editingTeamId,
|
||||
name.value
|
||||
editingName.value
|
||||
),
|
||||
TE.match(
|
||||
(err: GQLError<string>) => {
|
||||
@@ -312,7 +314,7 @@ const saveEnvironment = async () => {
|
||||
updateTeamEnvironment(
|
||||
JSON.stringify(filterdVariables),
|
||||
props.editingEnvironment.id,
|
||||
name.value
|
||||
editingName.value
|
||||
),
|
||||
TE.match(
|
||||
(err: GQLError<string>) => {
|
||||
@@ -331,7 +333,7 @@ const saveEnvironment = async () => {
|
||||
}
|
||||
|
||||
const hideModal = () => {
|
||||
name.value = null
|
||||
editingName.value = null
|
||||
emit("hide-modal")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user