Skip to content

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

feat(i18n): DataSource (#204)

p0nyeb27fcb21262
diff --git a/frontend/src/components/DataSourceConnectionPanel.vue b/frontend/src/components/DataSourceConnectionPanel.vue
index c6bc8c999d..df64aaa703 100644
--- a/frontend/src/components/DataSourceConnectionPanel.vue
+++ b/frontend/src/components/DataSourceConnectionPanel.vue
@@ -4,7 +4,7 @@
<dl class="sm:col-span-2">
<dt class="flex items-center space-x-1">
<div class="text-sm font-medium text-control-light">
- Connection string
+ {{ $t("common.connection-string") }}
</div>
<button
class="btn-icon"
@@ -25,51 +25,17 @@
class="flex"
>
<span
- class="
- whitespace-nowrap
- inline-flex
- items-center
- px-3
- rounded-l-md
- border border-l border-r-0 border-control-border
- bg-gray-50
- text-control-light
- sm:text-sm
- "
+ class="whitespace-nowrap inline-flex items-center px-3 rounded-l-md border border-l border-r-0 border-control-border bg-gray-50 text-control-light sm:text-sm"
>
{{ connection.name }}
</span>
<span
- class="
- 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
- "
+ class="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"
>
{{ connection.value }}
</span>
<button
- class="
- -ml-px
- px-2
- py-2
- border border-gray-300
- text-sm
- font-medium
- text-control-light
- bg-gray-50
- hover:bg-gray-100
- focus:ring-control focus:outline-none
- focus-visible:ring-2
- focus:ring-offset-1
- "
+ class="-ml-px px-2 py-2 border border-gray-300 text-sm font-medium text-control-light bg-gray-50 hover:bg-gray-100 focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-1"
@click.prevent="copyText(connection)"
>
<heroicons-outline:clipboard class="w-6 h-6" />
@@ -80,7 +46,9 @@
</dl>
<dl class="sm:col-span-1">
- <dt class="text-sm font-medium text-control-light">Username</dt>
+ <dt class="text-sm font-medium text-control-light">
+ {{ $t("common.username") }}
+ </dt>
<dd class="mt-1 text-sm text-main">
<input
v-if="editing"
@@ -97,7 +65,9 @@
</dl>
<dl class="sm:col-span-1">
- <dt class="text-sm font-medium text-control-light">Password</dt>
+ <dt class="text-sm font-medium text-control-light">
+ {{ $t("common.password") }}
+ </dt>
<dd class="mt-1 text-sm text-main">
<input
v-if="editing"
@@ -118,14 +88,18 @@
</dl>
<dl class="sm:col-span-1">
- <dt class="text-sm font-medium text-control-light">Updated</dt>
+ <dt class="text-sm font-medium text-control-light">
+ {{ $t("common.updated-at") }}
+ </dt>
<dd class="mt-1 text-sm text-main">
{{ humanizeTs(dataSource.updatedTs) }}
</dd>
</dl>
<dl class="sm:col-span-1">
- <dt class="text-sm font-medium text-control-light">Created</dt>
+ <dt class="text-sm font-medium text-control-light">
+ {{ $t("common.created-at") }}
+ </dt>
<dd class="mt-1 text-sm text-main">
{{ humanizeTs(dataSource.createdTs) }}
</dd>
@@ -138,6 +112,7 @@ import { computed, reactive, PropType } from "vue";
import { useStore } from "vuex";
import { toClipboard } from "@soerenmartius/vue3-clipboard";
import { DataSource } from "../types";
+import { useI18n } from "vue-i18n";
type Connection = {
name: string;
@@ -168,6 +143,8 @@ export default {
showPassword: false,
});
+ const { t } = useI18n();
+
const database = computed(() => {
return store.getters["database/databaseById"](
props.dataSource.database.id,
@@ -198,7 +175,10 @@ export default {
}
}
- let jdbcString = `JDBC can't connect to socket ${database.value.instance.host} `;
+ let jdbcString = t(
+ "datasource.jdbc-cant-connect-to-socket-database-value-instance-host",
+ [database.value.instance.host]
+ );
if (!isSocket) {
jdbcString = `jdbc:mysql://${database.value.instance.host}`;
if (database.value.instance.port) {
@@ -234,7 +214,9 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "INFO",
- title: `${connection.name} string copied to clipboard.`,
+ title: t("datasource.connection-name-string-copied-to-clipboard", [
+ connection.name,
+ ]),
});
});
};
diff --git a/frontend/src/components/DataSourceCreateForm.vue b/frontend/src/components/DataSourceCreateForm.vue
index 145382332b..20bcc5ea8c 100644
--- a/frontend/src/components/DataSourceCreateForm.vue
+++ b/frontend/src/components/DataSourceCreateForm.vue
@@ -7,7 +7,7 @@
<div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-3">
<div class="sm:col-span-2">
<label for="name" class="textlabel">
- Name <span class="text-red-600">*</span>
+ {{ $t("common.name") }} <span class="text-red-600">*</span>
</label>
<input
id="name"
@@ -24,12 +24,12 @@
<div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-3 items-center">
<div class="sm:col-span-2">
<label for="database" class="textlabel">
- Database <span class="text-red-600">*</span>
+ {{ $t("common.database") }} <span class="text-red-600">*</span>
</label>
<div v-if="database" class="flex flex-row justify-between space-x-2">
{{ database.name }}
<BBSwitch
- :label="'Read-only'"
+ :label="$t('common.read-only')"
:value="state.dataSource.type == 'RO'"
@toggle="
(on) => {
@@ -52,7 +52,7 @@
"
/>
<BBSwitch
- :label="'Read-only'"
+ :label="$t('common.read-only')"
:value="state.dataSource.type == 'RO'"
@toggle="
(on) => {
@@ -66,7 +66,9 @@
<div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-3">
<div class="sm:col-span-2">
- <label for="username" class="textlabel"> Username </label>
+ <label for="username" class="textlabel">
+ {{ $t("common.username") }}
+ </label>
<input
id="username"
name="username"
@@ -81,7 +83,9 @@
<div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-3">
<div class="sm:col-span-2">
<div class="flex flex-row items-center space-x-1">
- <label for="username" class="textlabel"> Password </label>
+ <label for="username" class="textlabel">
+ {{ $t("common.password") }}
+ </label>
<button
class="btn-icon"
@click.prevent="state.showPassword = !state.showPassword"
@@ -112,14 +116,14 @@
class="btn-normal py-2 px-4"
@click.prevent="$emit('cancel')"
>
- Cancel
+ {{ $t("common.cancel") }}
</button>
<button
type="submit"
class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
:disabled="!allowCreate"
>
- Create
+ {{ $t("common.create") }}
</button>
</div>
</form>
@@ -129,6 +133,7 @@
import { computed, PropType, reactive } from "vue";
import DatabaseSelect from "./DatabaseSelect.vue";
import { DataSourceCreate, Database, UNKNOWN_ID } from "../types";
+import { useI18n } from "vue-i18n";
interface LocalState {
dataSource: DataSourceCreate;
@@ -155,10 +160,10 @@ export default {
// const currentUser: ComputedRef<Principal> = computed(() =>
// store.getters["auth/currentUser"]()
// );
-
+ const { t } = useI18n();
const state = reactive<LocalState>({
dataSource: {
- name: "New data source",
+ name: t("datasource.new-data-source"),
type: "RO",
databaseId: props.database ? props.database.id : UNKNOWN_ID,
instanceId: props.instanceId,
diff --git a/frontend/src/components/DataSourceMemberForm.vue b/frontend/src/components/DataSourceMemberForm.vue
index 343ce6b39a..697625e3e0 100644
--- a/frontend/src/components/DataSourceMemberForm.vue
+++ b/frontend/src/components/DataSourceMemberForm.vue
@@ -5,7 +5,7 @@
<div class="grid gap-y-6 gap-x-4 grid-cols-4">
<div class="col-span-2 col-start-2 w-64">
<label for="environment" class="textlabel">
- Environment <span style="color: red">*</span>
+ {{ $t("common.environment") }} <span style="color: red">*</span>
</label>
<!-- eslint-disable vue/attribute-hyphenation -->
<EnvironmentSelect
@@ -24,7 +24,7 @@
<div class="col-span-2 col-start-2 w-64">
<label for="instance" class="textlabel">
- Instance <span class="text-red-600">*</span>
+ {{ $t("common.instance") }} <span class="text-red-600">*</span>
</label>
<!-- eslint-disable vue/attribute-hyphenation -->
<InstanceSelect
@@ -43,7 +43,7 @@
<div class="col-span-2 col-start-2 w-64">
<label for="database" class="textlabel">
- Database <span class="text-red-600">*</span>
+ {{ $t("common.database") }} <span class="text-red-600">*</span>
</label>
<!-- eslint-disable vue/attribute-hyphenation -->
<DatabaseSelect
@@ -64,7 +64,7 @@
<div class="col-span-2 col-start-2 w-64">
<label for="datasource" class="textlabel">
- Data Source <span class="text-red-600">*</span>
+ {{ $t("common.data-source") }} <span class="text-red-600">*</span>
</label>
<!-- eslint-disable vue/attribute-hyphenation -->
<DataSourceSelect
@@ -84,7 +84,7 @@
<div class="col-span-2 col-start-2 w-64">
<label for="user" class="textlabel">
- User <span class="text-red-600">*</span>
+ {{ $t("common.user") }} <span class="text-red-600">*</span>
<span class="ml-2 text-error text-xs">
{{ state.granteeError }}
</span>
@@ -107,20 +107,16 @@
</div>
<div class="col-span-2 col-start-2 w-64">
- <label for="issue" class="textlabel"> Issue </label>
+ <label for="issue" class="textlabel">
+ {{ $t("common.issue") }}
+ </label>
<div class="mt-1 relative rounded-md shadow-sm">
<div
- class="
- absolute
- inset-y-0
- left-0
- pl-3
- flex
- items-center
- pointer-events-none
- "
+ class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"
>
- <span class="text-accent font-semibold sm:text-sm">issue/</span>
+ <span class="text-accent font-semibold sm:text-sm"
+ >{{ $t("intro.issue") }}/</span
+ >
</div>
<div class="flex flex-row space-x-2 items-center">
<input
@@ -128,7 +124,7 @@
class="textfield w-full pl-12"
name="issue"
type="number"
- placeholder="Your issue id (e.g. 1234)"
+ placeholder="$t('datasource.your-issue-id-e-g-1234')"
:disabled="!allowUpdateIssueId"
:value="state.issueId"
@input="updateState('issueId', $event.target.value)"
@@ -139,7 +135,7 @@
target="_blank"
class="ml-2 normal-link text-sm"
>
- View
+ {{ $t("common.view") }}
</router-link>
</template>
</div>
@@ -154,7 +150,7 @@
class="btn-normal py-2 px-4"
@click.prevent="cancel"
>
- Cancel
+ {{ $t("common.cancel") }}
</button>
<button
type="button"
@@ -162,7 +158,7 @@
:disabled="!allowCreate"
@click.prevent="doGrant"
>
- Grant
+ {{ $t("common.grant") }}
</button>
</div>
</form>
@@ -189,6 +185,7 @@ import {
IssueId,
} from "../types";
import { issueSlug } from "../utils";
+import { useI18n } from "vue-i18n";
interface LocalState {
environmentId?: EnvironmentId;
@@ -236,6 +233,8 @@ export default {
issueId: props.issueId,
});
+ const { t } = useI18n();
+
const database = computed(() => {
return state.databaseId
? store.getters["database/databaseById"](state.databaseId)
@@ -295,7 +294,10 @@ export default {
(item: DataSourceMember) => item.principal.id == state.granteeId
);
if (member) {
- state.granteeError = `${member.principal.name} already exists`;
+ state.granteeError = t(
+ "datasource.member-principal-name-already-exists",
+ [member.principal.name]
+ );
} else {
state.granteeError = "";
}
@@ -359,11 +361,15 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "SUCCESS",
- title: `Successfully granted '${dataSource.name}' to '${
- addedMember!.principal.name
- }'.`,
+ title: t(
+ "datasource.successfully-granted-datasource-name-to-addedmember-principal-name",
+ [dataSource.name, addedMember!.principal.name]
+ ),
description: linkedIssue
- ? `We also linked the granted database to the requested issue '${linkedIssue.name}'.`
+ ? t(
+ "datasource.we-also-linked-the-granted-database-to-the-requested-issue-linkedissue-name",
+ [linkedIssue.name]
+ )
: "",
link: linkedIssue
? `/issue/${issueSlug(linkedIssue.name, linkedIssue.id)}`
diff --git a/frontend/src/components/DataSourceMemberTable.vue b/frontend/src/components/DataSourceMemberTable.vue
index e97f8be4e6..e3a263f084 100644
--- a/frontend/src/components/DataSourceMemberTable.vue
+++ b/frontend/src/components/DataSourceMemberTable.vue
@@ -2,12 +2,14 @@
<div>
<div class="flex justify-between items-center">
<div class="inline-flex items-center space-x-2">
- <h2 class="text-lg leading-7 font-medium text-main">User list</h2>
+ <h2 class="text-lg leading-7 font-medium text-main">
+ {{ $t("datasource.user-list") }}
+ </h2>
<BBButtonAdd v-if="allowEdit" @add="state.showCreateModal = true" />
</div>
<BBTableSearch
ref="searchField"
- :placeholder="'Search user'"
+ :placeholder="$t('datasource.search-user')"
@change-text="(text) => changeSearchText(text)"
/>
</div>
@@ -51,19 +53,9 @@
</router-link>
<span
v-if="currentUser.id == member.principal.id"
- class="
- inline-flex
- items-center
- px-2
- py-0.5
- rounded-lg
- text-xs
- font-semibold
- bg-green-100
- text-green-800
- "
+ class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-green-100 text-green-800"
>
- You
+ {{ $t("settings.members.yourself") }}
</span>
</div>
<span class="textlabel">
@@ -88,7 +80,12 @@
v-if="allowEdit"
:require-confirm="true"
:ok-text="'Revoke'"
- :confirm-title="`Are you sure to revoke '${member.principal.name}' access from '${dataSource.name}'?`"
+ :confirm-title="
+ $t('datasource.revoke-access', [
+ member.principal.name,
+ dataSource.name,
+ ])
+ "
@confirm="deleteMember(member)"
/>
</BBTableCell>
@@ -96,7 +93,7 @@
</BBTable>
<BBModal
v-if="state.showCreateModal"
- :title="'Grant data source'"
+ :title="$t('datasource.grant-data-source')"
@close="state.showCreateModal = false"
>
<DataSourceMemberForm
@@ -114,19 +111,7 @@ import { useStore } from "vuex";
import DataSourceMemberForm from "../components/DataSourceMemberForm.vue";
import PrincipalAvatar from "../components/PrincipalAvatar.vue";
import { DataSource, DataSourceMember } from "../types";
-
-const columnList = [
- {
- title: "User",
- },
- {
- title: "Requested issue",
- },
- {
- title: "Added time",
- },
- {},
-];
+import { useI18n } from "vue-i18n";
interface LocalState {
searchText: string;
@@ -154,8 +139,23 @@ export default {
showCreateModal: false,
});
+ const { t } = useI18n();
+
const currentUser = computed(() => store.getters["auth/currentUser"]());
+ const columnList = [
+ {
+ title: t("common.user"),
+ },
+ {
+ title: t("datasource.requested-issue"),
+ },
+ {
+ title: t("common.added-time"),
+ },
+ {},
+ ];
+
const deleteMember = (member: DataSourceMember) => {
store
.dispatch("dataSource/deleteDataSourceMemberByMemberId", {
@@ -167,7 +167,10 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "INFO",
- title: `Successfully revoked '${member.principal.name}' access from '${props.dataSource.name}'.`,
+ title: t(
+ "datasource.successfully-revoked-member-principal-name-access-from-props-datasource-name",
+ [member.principal.name, props.dataSource.name]
+ ),
});
});
};
diff --git a/frontend/src/components/DataSourceSelect.vue b/frontend/src/components/DataSourceSelect.vue
index 4a6035b002..98b8abb719 100644
--- a/frontend/src/components/DataSourceSelect.vue
+++ b/frontend/src/components/DataSourceSelect.vue
@@ -9,8 +9,10 @@
"
>
<option disabled :selected="undefined === state.selectedId">
- <template v-if="!database"> Select database first </template>
- <template v-else> Select data source </template>
+ <template v-if="!database">
+ {{ $t("datasource.select-database-first") }}
+ </template>
+ <template v-else> {{ $t("datasource.select-data-source") }} </template>
</option>
<template v-if="database">
<option
@@ -20,7 +22,7 @@
:selected="dataSource.id == state.selectedId"
>
<template v-if="dataSource.type == 'RO'">
- {{ dataSource.name }} (readonly)
+ {{ dataSource.name }} ({{ $t("common.readonly") }})
</template>
<template v-else>
{{ dataSource.name }}
diff --git a/frontend/src/components/DataSourceTable.vue b/frontend/src/components/DataSourceTable.vue
index f3cfae86c9..8daf895ded 100644
--- a/frontend/src/components/DataSourceTable.vue
+++ b/frontend/src/components/DataSourceTable.vue
@@ -3,7 +3,11 @@
<div class="flex justify-between items-center">
<div class="inline-flex items-center space-x-2">
<h3 class="text-lg leading-6 font-medium text-gray-900">
- {{ database ? "Data source list" : "All data source" }}
+ {{
+ database
+ ? $t("datasource.data-source-list")
+ : $t("datasource.all-data-source")
+ }}
</h3>
<!-- Hide add button for now, as we don't allow adding new data source after creating the database. -->
<BBButtonAdd v-if="false" @add="state.showCreateModal = true" />
@@ -22,7 +26,11 @@
<BBTableSearch
ref="searchField"
class="w-56"
- :placeholder="database ? 'Search name' : 'Search name, database'"
+ :placeholder="
+ database
+ ? $t('datasource.search-name')
+ : $t('datasource.search-name-database')
+ "
@change-text="(text) => changeSearchText(text)"
/>
</div>
@@ -70,7 +78,7 @@
</div>
<BBModal
v-if="state.showCreateModal"
- :title="'Create data source'"
+ :title="$t('datasource.create-data-source')"
@close="state.showCreateModal = false"
>
<DataSourceCreateForm
@@ -91,27 +99,7 @@ import { BBTableColumn } from "../bbkit/types";
import { databaseSlug, dataSourceSlug } from "../utils";
import { Instance, Database, DataSource, DataSourceCreate } from "../types";
-
-const columnList: BBTableColumn[] = [
- {
- title: "Name",
- },
- {
- title: "Type",
- },
- {
- title: "Username",
- },
- {
- title: "Password",
- },
- {
- title: "Updated",
- },
- {
- title: "Created",
- },
-];
+import { useI18n } from "vue-i18n";
interface LocalState {
searchText: string;
@@ -135,6 +123,28 @@ export default {
setup(props) {
const store = useStore();
const router = useRouter();
+ const { t } = useI18n();
+
+ const columnList: BBTableColumn[] = [
+ {
+ title: t("common.name"),
+ },
+ {
+ title: t("common.type"),
+ },
+ {
+ title: t("common.username"),
+ },
+ {
+ title: t("common.password"),
+ },
+ {
+ title: t("common.updated-at"),
+ },
+ {
+ title: t("common.created-at"),
+ },
+ ];
const state = reactive<LocalState>({
searchText: "",
@@ -202,7 +212,10 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "SUCCESS",
- title: `Successfully created data source '${dataSource.name}'.`,
+ title: t(
+ "datasource.successfully-created-data-source-datasource-name",
+ [dataSource.name]
+ ),
});
router.push(
`/db/${databaseSlug(
diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.yml
index 68f0e98cfd..6d8a5cabad 100644
--- a/frontend/src/locales/en.yml
+++ b/frontend/src/locales/en.yml
@@ -135,6 +135,14 @@ common:
assigned: Assigned
subscribed: Subscribed
created: Created
+ roletype: Role Type
+ readonly: readonly
+ user: User
+ added-time: Added time
+ data-source: Data Source
+ grant: Grant
+ read-only: Read-only
+ connection-string: Connection string
error-page:
go-back-home: Go back home
anomaly-center: Anomaly Center
@@ -776,8 +784,8 @@ project:
project-name: '@:common.project @:common.name'
key: '@:common.key'
key-hint: (Uppercase letters identifying your project)
- cancel: "@:common.cancel"
- confirm: "@:common.create"
+ cancel: '@:common.cancel'
+ confirm: '@:common.create'
success-prompt: Successfully created project {name}.
overview:
view-all: View all
@@ -926,3 +934,26 @@ archive:
project-search-bar-placeholder: Search @.lower:{'common.project'} name
instance-search-bar-placeholder: Search @.lower:{'common.instance'} name
environment-search-bar-placeholder: Search @.lower:{'common.environment'} name
+datasource:
+ successfully-deleted-data-source-name: Successfully deleted data source '{0}'.
+ create-data-source: Create data source
+ data-source-list: Data source list
+ all-data-source: All data source
+ search-name: Search name
+ search-name-database: Search name, database
+ successfully-created-data-source-datasource-name: Successfully created data source '{0}'.
+ select-database-first: Select database first
+ select-data-source: Select data source
+ search-user: Search user
+ user-list: User list
+ revoke-access: Are you sure to revoke '{0}' access from '{1}'?
+ grant-data-source: Grant data source
+ requested-issue: Requested issue
+ successfully-revoked-member-principal-name-access-from-props-datasource-name: Successfully revoked '{0}' access from '{1}'.
+ your-issue-id-e-g-1234: Your issue id (e.g. 1234)
+ member-principal-name-already-exists: '{0} already exists'
+ successfully-granted-datasource-name-to-addedmember-principal-name: Successfully granted '{0}' to '{1}'.
+ we-also-linked-the-granted-database-to-the-requested-issue-linkedissue-name: We also linked the granted database to the requested issue '{0}'.
+ new-data-source: New data source
+ connection-name-string-copied-to-clipboard: '{0} string copied to clipboard.'
+ jdbc-cant-connect-to-socket-database-value-instance-host: 'JDBC can''t connect to socket {0} '
diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.yml
index 6ee0c13a1d..429fb7952e 100644
--- a/frontend/src/locales/zh-CN.yml
+++ b/frontend/src/locales/zh-CN.yml
@@ -135,6 +135,14 @@ common:
assigned: 已指派
subscribed: 已订阅
created: 已创建
+ roletype: 角色类型
+ readonly: 只读
+ user: 用户
+ added-time: 添加时间
+ data-source: 数据源
+ grant: 授予
+ read-only: 只读
+ connection-string: 连接字符串
error-page:
go-back-home: 回到主页
anomaly-center: 异常中心
@@ -801,3 +809,26 @@ archive:
project-search-bar-placeholder: 搜索@.lower:{'common.project'}的名称
instance-bar-placeholder: 搜索@.lower:{'common.instance'}的名称
environment-bar-placeholder: 搜索@.lower:{'common.environment'}的名称
+datasource:
+ successfully-deleted-data-source-name: 成功删除数据源'{0}'。
+ create-data-source: 创建数据源
+ data-source-list: 数据源列表
+ all-data-source: 所有数据源
+ search-name: 搜索名称
+ search-name-database: 搜索名称,数据库
+ successfully-created-data-source-datasource-name: 成功创建数据源 '{0}'。
+ select-database-first: 先选择数据库
+ select-data-source: 选择数据源
+ search-user: 搜索用户
+ user-list: 用户列表
+ revoke-access: 您确定要取消 '{0}' 对 '{1}' 的访问权限?
+ grant-data-source: 授予数据源
+ requested-issue: 申请工单
+ successfully-revoked-member-principal-name-access-from-props-datasource-name: 成功取消 '{0}' 对 '{1}' 的访问权限。
+ your-issue-id-e-g-1234: 您的工单 id (例如 1234)
+ member-principal-name-already-exists: '{0} 已经存在'
+ successfully-granted-datasource-name-to-addedmember-principal-name: 成功授予 '{1}' '{0}'
+ we-also-linked-the-granted-database-to-the-requested-issue-linkedissue-name: 我们也把被授予的数据库链接到了申请工单 '{0}'。
+ new-data-source: 新数据源
+ connection-name-string-copied-to-clipboard: '{0} 字符串已复制到剪贴板。'
+ jdbc-cant-connect-to-socket-database-value-instance-host: 'JDBC 无法连接到 socket {0} '
diff --git a/frontend/src/views/DataSourceDetail.vue b/frontend/src/views/DataSourceDetail.vue
index 1c8e1cec7b..fd04c4459f 100644
--- a/frontend/src/views/DataSourceDetail.vue
+++ b/frontend/src/views/DataSourceDetail.vue
@@ -3,12 +3,7 @@
<main class="flex-1 relative pb-8 overflow-y-auto">
<!-- Highlight Panel -->
<div
- class="
- px-4
- pb-4
- border-b border-block-border
- md:flex md:items-center md:justify-between
- "
+ class="px-4 pb-4 border-b border-block-border md:flex md:items-center md:justify-between"
>
<div class="flex-1 min-w-0">
<!-- Summary -->
@@ -28,29 +23,19 @@
<!-- Padding value is to prevent flickering when switching between edit/non-edit mode -->
<h1
v-else
- class="
- pt-2
- pb-2.5
- text-xl
- font-bold
- leading-6
- text-main
- truncate
- "
+ class="pt-2 pb-2.5 text-xl font-bold leading-6 text-main truncate"
>
{{ dataSource.name }}
</h1>
</div>
<dl
- class="
- flex flex-col
- space-y-1
- sm:space-y-0 sm:flex-row sm:flex-wrap
- "
+ class="flex flex-col space-y-1 sm:space-y-0 sm:flex-row sm:flex-wrap"
>
- <dt class="sr-only">Environment</dt>
+ <dt class="sr-only">{{ $t("common.environment") }}</dt>
<dd class="flex items-center text-sm sm:mr-4">
- <span class="textlabel">Environment&nbsp;-&nbsp;</span>
+ <span class="textlabel"
+ >{{ $t("common.environment") }}&nbsp;-&nbsp;</span
+ >
<router-link
:to="`/environment/${environmentSlug(
dataSource.instance.environment
@@ -61,9 +46,11 @@
</router-link>
</dd>
<template v-if="isCurrentUserDBAOrOwner">
- <dt class="sr-only">Instance</dt>
+ <dt class="sr-only">{{ $t("common.instance") }}</dt>
<dd class="flex items-center text-sm sm:mr-4">
- <span class="textlabel">Instance&nbsp;-&nbsp;</span>
+ <span class="textlabel"
+ >{{ $t("common.instance") }}&nbsp;-&nbsp;</span
+ >
<router-link
:to="`/instance/${instanceSlug(dataSource.instance)}`"
class="normal-link"
@@ -72,23 +59,19 @@
</router-link>
</dd>
</template>
- <dt class="sr-only">Database</dt>
+ <dt class="sr-only">{{ $t("common.database") }}</dt>
<dd class="flex items-center text-sm sm:mr-4">
- <span class="textlabel">Database&nbsp;-&nbsp;</span>
+ <span class="textlabel"
+ >{{ $t("common.database") }}&nbsp;-&nbsp;</span
+ >
<router-link :to="`/db/${databaseSlug}`" class="normal-link">
{{ dataSource.database.name }}
</router-link>
</dd>
- <dt class="sr-only">RoleType</dt>
+ <dt class="sr-only">{{ $t("common.roletype") }}</dt>
<dd
v-data-source-type
- class="
- flex
- items-center
- text-sm text-control
- font-medium
- sm:mr-4
- "
+ class="flex items-center text-sm text-control font-medium sm:mr-4"
>
{{ dataSource.type }}
</dd>
@@ -103,7 +86,7 @@
class="btn-normal"
@click.prevent="cancelEdit"
>
- Cancel
+ {{ $t("common.cancel") }}
</button>
<button
type="button"
@@ -115,7 +98,7 @@
<heroicons-solid:save
class="-ml-1 mr-2 h-5 w-5 text-control-light"
/>
- <span>Save</span>
+ <span>{{ $t("common.save") }}</span>
</button>
</template>
<template v-else>
@@ -128,7 +111,7 @@
<heroicons-solid:pencil
class="-ml-1 mr-2 h-5 w-5 text-control-light"
/>
- <span>Edit</span>
+ <span>{{ $t("common.edit") }}</span>
</button>
</template>
</div>
@@ -179,6 +162,7 @@ import DataSourceConnectionPanel from "../components/DataSourceConnectionPanel.v
import DataSourceMemberTable from "../components/DataSourceMemberTable.vue";
import { idFromSlug, isDBAOrOwner } from "../utils";
import { DataSource, DataSourcePatch, Principal } from "../types";
+import { useI18n } from "vue-i18n";
interface LocalState {
editing: boolean;
@@ -205,6 +189,8 @@ export default {
const store = useStore();
const router = useRouter();
+ const { t } = useI18n();
+
const dataSourceId = idFromSlug(props.dataSourceSlug);
const state = reactive<LocalState>({
@@ -276,7 +262,9 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "SUCCESS",
- title: `Successfully deleted data source '${name}'.`,
+ title: t("datasource.successfully-deleted-data-source-name", [
+ name,
+ ]),
});
router.push(`/db/${props.dataSourceSlug}`);
});