Renaming variables and parameters

This commit is contained in:
Jason Casareno
2022-08-01 13:15:01 -07:00
parent 11b8bb4571
commit f515ac4f52
2 changed files with 14 additions and 14 deletions

View File

@@ -3,7 +3,7 @@
<div <div
class="sticky z-10 flex items-center justify-between pl-4 border-b bg-primary border-dividerLight top-upperMobileSecondaryStickyFold sm:top-upperSecondaryStickyFold" class="sticky z-10 flex items-center justify-between pl-4 border-b bg-primary border-dividerLight top-upperMobileSecondaryStickyFold sm:top-upperSecondaryStickyFold"
> >
<label class="font-semibold text-secondaryLight"> Variables </label> <label class="font-semibold text-secondaryLight"> My Variables </label>
<div class="flex"> <div class="flex">
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
@@ -15,28 +15,28 @@
</div> </div>
<div> <div>
<div <div
v-for="(vari, index) in workingVars" v-for="(variable, index) in workingVars"
:key="`vari-${vari.id}-${index}`" :key="`vari-${variable.id}-${index}`"
class="flex border-b divide-x divide-dividerLight border-dividerLight draggable-content group" class="flex border-b divide-x divide-dividerLight border-dividerLight draggable-content group"
> >
<SmartEnvInput <SmartEnvInput
v-model="vari.key" v-model="variable.key"
:placeholder="`${t('count.parameter', { count: index + 1 })}`" :placeholder="`${t('count.parameter', { count: index + 1 })}`"
@change=" @change="
updateVar(index, { updateVar(index, {
id: vari.id, id: variable.id,
key: $event, key: $event,
value: vari.value, value: variable.value,
}) })
" "
/> />
<SmartEnvInput <SmartEnvInput
v-model="vari.value" v-model="variable.value"
:placeholder="`${t('count.value', { count: index + 1 })}`" :placeholder="`${t('count.value', { count: index + 1 })}`"
@change=" @change="
updateVar(index, { updateVar(index, {
id: vari.id, id: variable.id,
key: vari.key, key: variable.key,
value: $event, value: $event,
}) })
" "

View File

@@ -32,9 +32,9 @@ const ENV_EXPAND_LOOP = "ENV_EXPAND_LOOP" as const
export function parseTemplateStringEV( export function parseTemplateStringEV(
str: string, str: string,
variables: Environment["variables"], variables: Environment["variables"],
pathVariables: Variables myVariables: Variables
) { ) {
if (!variables || !str || !pathVariables) { if (!variables || !str || !myVariables) {
return E.right(str) return E.right(str)
} }
@@ -55,7 +55,7 @@ export function parseTemplateStringEV(
while (result.match(REGEX_MY_VAR) != null && depth <= ENV_MAX_EXPAND_LIMIT) { while (result.match(REGEX_MY_VAR) != null && depth <= ENV_MAX_EXPAND_LIMIT) {
result = decodeURI(encodeURI(result)).replace( result = decodeURI(encodeURI(result)).replace(
REGEX_MY_VAR, REGEX_MY_VAR,
(_, p1) => pathVariables.find((x) => x.key === p1)?.value || "" (_, p1) => myVariables.find((x) => x.key === p1)?.value || ""
) )
} }
@@ -70,9 +70,9 @@ export function parseTemplateStringEV(
export const parseTemplateStringV = ( export const parseTemplateStringV = (
str: string, str: string,
variables: Environment["variables"], variables: Environment["variables"],
pathVariables: Variables myVariables: Variables
) => ) =>
pipe( pipe(
parseTemplateStringEV(str, variables, pathVariables), parseTemplateStringEV(str, variables, myVariables),
E.getOrElse(() => str) E.getOrElse(() => str)
) )