feat: display nested env variable value in tooltip

This commit is contained in:
liyasthomas
2022-01-29 18:04:08 +05:30
parent c8234f37d1
commit 2346349eef

View File

@@ -28,8 +28,10 @@ import IntervalTree from "node-interval-tree"
import debounce from "lodash/debounce" import debounce from "lodash/debounce"
import isUndefined from "lodash/isUndefined" import isUndefined from "lodash/isUndefined"
import { tippy } from "vue-tippy" import { tippy } from "vue-tippy"
import * as E from "fp-ts/Either"
import { aggregateEnvs$ } from "~/newstore/environments" import { aggregateEnvs$ } from "~/newstore/environments"
import { useReadonlyStream } from "~/helpers/utils/composables" import { useReadonlyStream } from "~/helpers/utils/composables"
import { parseTemplateStringE } from "~/helpers/templating"
const tagsToReplace = { const tagsToReplace = {
"&": "&", "&": "&",
@@ -217,7 +219,7 @@ export default defineComponent({
}" v-tippy data-tippy-content="${this.getEnvName( }" v-tippy data-tippy-content="${this.getEnvName(
this.aggregateEnvs.find((k) => k.key === envVar)?.sourceEnv this.aggregateEnvs.find((k) => k.key === envVar)?.sourceEnv
)}<xmp>${this.getEnvValue( )}<xmp>${this.getEnvValue(
this.aggregateEnvs.find((k) => k.key === envVar)?.value this.constructEnv(envVar)
)}</xmp>">${this.safe_tags_replace( )}</xmp>">${this.safe_tags_replace(
this.internalValue.substring(position.start, position.end + 1) this.internalValue.substring(position.start, position.end + 1)
)}</span>` )}</span>`
@@ -480,6 +482,21 @@ export default defineComponent({
// it does not filter special characters before adding them to HTML. // it does not filter special characters before adding them to HTML.
return "not found" return "not found"
}, },
constructEnv(envVar) {
const result = parseTemplateStringE(
this.getEnvValue(
this.aggregateEnvs.find((k) => k.key === envVar)?.value
),
this.aggregateEnvs
)
if (E.isLeft(result)) {
console.error("error", result.left)
return ""
} else {
return result.right
}
},
}, },
}) })
</script> </script>