feat: show global envs on hover
This commit is contained in:
@@ -358,6 +358,7 @@ input[type="checkbox"] {
|
|||||||
@apply px-4;
|
@apply px-4;
|
||||||
@apply bg-opacity-10;
|
@apply bg-opacity-10;
|
||||||
@apply ml-auto;
|
@apply ml-auto;
|
||||||
|
@apply last:ml-4;
|
||||||
@apply sm:ml-8;
|
@apply sm:ml-8;
|
||||||
@apply transition;
|
@apply transition;
|
||||||
@apply rounded;
|
@apply rounded;
|
||||||
|
|||||||
@@ -115,6 +115,19 @@ export default defineComponent({
|
|||||||
icon: "cookie",
|
icon: "cookie",
|
||||||
duration: 0,
|
duration: 0,
|
||||||
action: [
|
action: [
|
||||||
|
{
|
||||||
|
text: this.$t("action.learn_more").toString(),
|
||||||
|
onClick: (_, toastObject) => {
|
||||||
|
setLocalConfig("cookiesAllowed", "yes")
|
||||||
|
toastObject.goAway(0)
|
||||||
|
window
|
||||||
|
.open(
|
||||||
|
"https://github.com/hoppscotch/hoppscotch/wiki/Privacy-Policy",
|
||||||
|
"_blank"
|
||||||
|
)
|
||||||
|
.focus()
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: this.$t("action.dismiss").toString(),
|
text: this.$t("action.dismiss").toString(),
|
||||||
onClick: (_, toastObject) => {
|
onClick: (_, toastObject) => {
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ export default {
|
|||||||
text: this.$t("yes"),
|
text: this.$t("yes"),
|
||||||
onClick: async (_, toastObject) => {
|
onClick: async (_, toastObject) => {
|
||||||
const { user } = await signInWithGithub()
|
const { user } = await signInWithGithub()
|
||||||
await user.linkAndRetrieveDataWithCredential(pendingCred)
|
await user.linkWithCredential(pendingCred)
|
||||||
|
|
||||||
this.showLoginSuccess()
|
this.showLoginSuccess()
|
||||||
|
|
||||||
@@ -236,6 +236,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||||
|
icon: "error",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,8 +308,7 @@ export default {
|
|||||||
text: this.$t("yes"),
|
text: this.$t("yes"),
|
||||||
onClick: async (_, toastObject) => {
|
onClick: async (_, toastObject) => {
|
||||||
const { user } = await signInUserWithGoogle()
|
const { user } = await signInUserWithGoogle()
|
||||||
// TODO: handle deprecation
|
await user.linkWithCredential(pendingCred)
|
||||||
await user.linkAndRetrieveDataWithCredential(pendingCred)
|
|
||||||
|
|
||||||
this.showLoginSuccess()
|
this.showLoginSuccess()
|
||||||
|
|
||||||
@@ -313,6 +316,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||||
|
icon: "error",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,7 @@ 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 {
|
import { aggregateEnvs$ } from "~/newstore/environments"
|
||||||
currentEnvironment$,
|
|
||||||
getCurrentEnvironment,
|
|
||||||
} from "~/newstore/environments"
|
|
||||||
import { useReadonlyStream } from "~/helpers/utils/composables"
|
import { useReadonlyStream } from "~/helpers/utils/composables"
|
||||||
|
|
||||||
const tagsToReplace = {
|
const tagsToReplace = {
|
||||||
@@ -53,13 +50,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const currentEnvironment = useReadonlyStream(
|
const aggregateEnvs = useReadonlyStream(aggregateEnvs$)
|
||||||
currentEnvironment$,
|
|
||||||
getCurrentEnvironment()
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentEnvironment,
|
aggregateEnvs,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -83,7 +76,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
currentEnvironment() {
|
aggregateEnvs() {
|
||||||
this.processHighlights()
|
this.processHighlights()
|
||||||
},
|
},
|
||||||
highlightStyle() {
|
highlightStyle() {
|
||||||
@@ -201,15 +194,14 @@ export default defineComponent({
|
|||||||
.substring(position.start, position.end + 1)
|
.substring(position.start, position.end + 1)
|
||||||
.slice(2, -2)
|
.slice(2, -2)
|
||||||
result += `<span class="${highlightPositions[k].style} ${
|
result += `<span class="${highlightPositions[k].style} ${
|
||||||
this.currentEnvironment.variables.find((k) => k.key === envVar)
|
this.aggregateEnvs.find((k) => k.key === envVar)?.value === undefined
|
||||||
?.value === undefined
|
|
||||||
? "bg-red-400 text-red-50 hover:bg-red-600"
|
? "bg-red-400 text-red-50 hover:bg-red-600"
|
||||||
: "bg-accentDark text-accentContrast hover:bg-accent"
|
: "bg-accentDark text-accentContrast hover:bg-accent"
|
||||||
}" v-tippy data-tippy-content="environment: ${
|
}" v-tippy data-tippy-content="${this.getEnvName(
|
||||||
this.currentEnvironment.name
|
this.aggregateEnvs.find((k) => k.key === envVar)?.sourceEnv
|
||||||
} • value: ${
|
)} <kbd>${this.getEnvValue(
|
||||||
this.currentEnvironment.variables.find((k) => k.key === envVar)?.value
|
this.aggregateEnvs.find((k) => k.key === envVar)?.value
|
||||||
}">${this.safe_tags_replace(
|
)}</kbd>">${this.safe_tags_replace(
|
||||||
this.internalValue.substring(position.start, position.end + 1)
|
this.internalValue.substring(position.start, position.end + 1)
|
||||||
)}</span>`
|
)}</span>`
|
||||||
startingPosition = position.end + 1
|
startingPosition = position.end + 1
|
||||||
@@ -459,6 +451,14 @@ export default defineComponent({
|
|||||||
textRange.select()
|
textRange.select()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getEnvName(name) {
|
||||||
|
if (name) return name
|
||||||
|
return "choose an environment"
|
||||||
|
},
|
||||||
|
getEnvValue(value) {
|
||||||
|
if (value) return value
|
||||||
|
return "not found"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// nextTIck shouldn't really ever throw but still
|
// nextTIck shouldn't really ever throw but still
|
||||||
this.initalized = true
|
this.initialized = true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user