Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): add tips for redis create user example (#5083)
Liu Jia8f848c189eb
diff --git a/frontend/src/components/CreateDataSourceExample.vue b/frontend/src/components/CreateDataSourceExample.vueindex 1562de1e23..772303ae21 100644--- a/frontend/src/components/CreateDataSourceExample.vue+++ b/frontend/src/components/CreateDataSourceExample.vue@@ -1,14 +1,23 @@<template><div class="w-full flex flex-col justify-start" :class="props.className"><p class="w-full mt-1 text-sm text-gray-500">- {{- props.dataSourceType === "ADMIN"- ? $t("instance.sentence.create-admin-user")- : $t("instance.sentence.create-readonly-user")- }}+ <template v-if="isEngineUsingSQL">+ {{+ props.dataSourceType === "ADMIN"+ ? $t("instance.sentence.create-admin-user")+ : $t("instance.sentence.create-readonly-user")+ }}+ </template>+ <template v-else>+ {{+ props.dataSourceType === "ADMIN"+ ? $t("instance.sentence.create-admin-user-non-sql")+ : $t("instance.sentence.create-readonly-user-non-sql")+ }}+ </template><spanv-if="!props.createInstanceFlag"- class="normal-link select-none"+ class="normal-link select-none ml-1"@click="toggleCreateUserExample">{{ $t("instance.show-how-to-create") }}@@ -94,6 +103,22 @@</template></i18n-t></template>+ <template v-else-if="props.engineType === 'REDIS'">+ <i18n-t+ tag="p"+ keypath="instance.sentence.create-user-example.redis.template"+ >+ <template #user>{{+ $t("instance.sentence.create-user-example.redis.user")+ }}</template>+ <template #password>+ <span class="text-red-600">+ {{ $t("instance.sentence.create-user-example.redis.password") }}+ </span>+ </template>+ </i18n-t>+ <!-- TODO(xz): add a "detailed guide" link to docs here -->+ </template><div class="mt-2 flex flex-row"><spanclass="flex-1 min-w-0 w-full inline-flex items-center px-3 py-2 border border-r border-control-border bg-gray-50 sm:text-sm whitespace-pre"@@ -113,10 +138,15 @@</template><script lang="ts" setup>-import { reactive, PropType } from "vue";+import { reactive, PropType, computed } from "vue";import { toClipboard } from "@soerenmartius/vue3-clipboard";import { useI18n } from "vue-i18n";-import { DataSourceType, EngineType, engineName } from "../types";+import {+ DataSourceType,+ EngineType,+ engineName,+ languageOfEngine,+} from "../types";import { pushNotification } from "@/store";interface LocalState {@@ -148,6 +178,10 @@ const state = reactive<LocalState>({showCreateUserExample: props.createInstanceFlag,});+const isEngineUsingSQL = computed(() => {+ return languageOfEngine(props.engineType) === "sql";+});+const grantStatement = (engineType: EngineType,dataSourceType: DataSourceType@@ -192,10 +226,10 @@ const grantStatement = (case "SPANNER":return "";case "REDIS":- // TODO(xz)- return "";+ return "ACL SETUSER bytebase on >YOUR_DB_PWD +@read &*";}}+ return ""; // fallback};const toggleCreateUserExample = () => {diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex e74ef7f9d6..c59b5b2914 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -792,6 +792,8 @@},"create-admin-user": "This is the connection user used by Bytebase to perform DDL and DML (non-SELECT) operations.","create-readonly-user": "This is the connection used by Bytebase to perform read-only operations such as SELECT query.",+ "create-admin-user-non-sql": "This is the connection user used by Bytebase to perform write and admin operations.",+ "create-readonly-user-non-sql": "This is the connection used by Bytebase to perform read-only operations.","create-user-example": {"snowflake": {"user": "bytebase{'@'}%",@@ -810,6 +812,11 @@"postgresql": {"warn": "If the connecting instance is managed by the cloud provider, then SUPERUSER is not available and you should create the user via that provider's admin console. The created user will have provider specific semi-SUPERUSER privileges. You should grant Bytebase privileges with 'GRANT role_name TO bytebase;' for all existing roles, otherwise Bytebase may not access existing databases or tables.","template": "Below is an example to create user 'bytebase' with password {password} and grant the user with the needed privileges. If the connecting instance is self-hosted, then you can grant SUPERUSER."+ },+ "redis": {+ "password": "YOUR_DB_PWD",+ "user": "bytebase",+ "template": "Below is an example to create user {user} with password {password} and grant the user with the needed privileges."}}},diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex b74b5fb698..af53bca54e 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -788,7 +788,9 @@"snowflake": "\b管理该@:{'common.instance'}的外部控制台 URL(如 AWS RDS 控制台,您的@:{'common.database'}控制台)"},"create-admin-user": "这是 Bytebase 用于连接数据库,执行 DDL 和 DML (非 SELECT) 操作的用户。",- "create-readonly-user": "这是 Bytebase 用于连接数据库,执行诸如 SELECT 的只读操作。",+ "create-readonly-user": "这是 Bytebase 用于连接数据库,执行诸如 SELECT 的只读操作的用户。",+ "create-admin-user-non-sql": "这是 Bytebase 用于连接数据库,执行写和管理操作的用户。",+ "create-readonly-user-non-sql": "这是 Bytebase 用于连接数据库,执行只读操作的用户。","create-user-example": {"snowflake": {"user": "bytebase{'@'}%",@@ -807,6 +809,11 @@"postgresql": {"warn": "如果您将要连接到的实例是由云服务供应商管理的话,那么 SUPERUSER 是不可用的,您需要通过供应商的管理员控制台来创建用户。您所创建的用户会拥有供应商特定的 semi-SUPERUSER 的权限。 您应该对所有 role 用 'GRANT role_name TO bytebase;' 语句赋予 Bytebase 权限,否则 Bytebase 可能没有权限操作已有的数据库或者表导致操作失败。","template": "创建用户 bytebase,密码 {password},并授予必要权限的例子如下。如果您将要连接到的实例是自己托管的,那么您可以 grant SUPERUSER。"+ },+ "redis": {+ "user": "bytebase",+ "password": "YOUR_DB_PWD",+ "template": "创建用户 {user},密码 {password},并授予必要权限的例子如下。"}}},