Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: hide environment tag when not needed (#13211)

Liu Ji20ddc8104cdd
diff --git a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/TreeNode/DatabaseNode.vue b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/TreeNode/DatabaseNode.vue
index b0b1b01562..d55e9c3d00 100644
--- a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/TreeNode/DatabaseNode.vue
+++ b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/TreeNode/DatabaseNode.vue
@@ -6,10 +6,7 @@
/>
<EnvironmentV1Name
- v-if="
- !hasEnvironmentContext ||
- database.effectiveEnvironment !== database.instanceResource.environment
- "
+ v-if="showEnvironment"
:environment="database.effectiveEnvironmentEntity"
:link="false"
class="text-control-light"
@@ -59,6 +56,9 @@ const me = useCurrentUserV1();
const disallowRequestQuery = useAppFeature(
"bb.feature.sql-editor.disallow-request-query"
);
+const hideEnvironments = useAppFeature(
+ "bb.feature.sql-editor.hide-environments"
+);
const database = computed(
() => (props.node as TreeNode<"database">).meta.target
@@ -75,4 +75,23 @@ const hasInstanceContext = computed(() => {
const hasEnvironmentContext = computed(() => {
return props.factors.includes("environment");
});
+
+const showEnvironment = computed(() => {
+ // Don't show environment tag anyway if disabled via appFeature
+ if (hideEnvironments.value) {
+ return false;
+ }
+ // If we don't have "environment" factor in the custom tree structure
+ // we should indicate the database's environment
+ if (!hasEnvironmentContext.value) {
+ return true;
+ }
+ // If we have "environment" factor in the custom tree structure
+ // only show the environment tag when a database's effectiveEnvironment is
+ // not equal to it's physical instance's environment
+ return (
+ database.value.effectiveEnvironment !==
+ database.value.instanceResource.environment
+ );
+});
</script>