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(i18n): translate Task and Issue module (#163)
Liu Ji4105f66818a2
diff --git a/frontend/src/components/InboxList.vue b/frontend/src/components/InboxList.vueindex 5bbcc11cd1..7217064dbd 100644--- a/frontend/src/components/InboxList.vue+++ b/frontend/src/components/InboxList.vue@@ -16,14 +16,7 @@<div class="flex-1 space-y-1"><div class="flex w-full justify-between space-x-2"><h3- class="- text-sm- font-base- text-control-light- flex flex-row- items-center- whitespace-nowrap- "+ class="text-sm font-base text-control-light flex flex-row items-center whitespace-nowrap"><template v-if="showCreator(inbox.activity)"><router-link@@ -59,7 +52,7 @@</template><script lang="ts">-import { computed, PropType } from "vue";+import { computed, defineComponent, PropType } from "vue";import PrincipalAvatar from "../components/PrincipalAvatar.vue";import {ActivityIssueCommentCreatePayload,@@ -74,8 +67,9 @@ import { useStore } from "vuex";import { useRouter } from "vue-router";import { isEmpty } from "lodash";import { issueActivityActionSentence } from "../utils";+import { useI18n } from "vue-i18n";-export default {+export default defineComponent({name: "InboxList",components: { PrincipalAvatar },props: {@@ -85,6 +79,7 @@ export default {},},setup() {+ const { t } = useI18n();const store = useStore();const router = useRouter();@@ -107,7 +102,8 @@ export default {const actionSentence = (activity: Activity): string => {if (activity.type.startsWith("bb.issue.")) {- const actionStr = issueActivityActionSentence(activity);+ const [tid, params] = issueActivityActionSentence(activity);+ const actionStr = t(tid, params);switch (activity.type) {case "bb.issue.create": {const payload = activity.payload as ActivityIssueCreatePayload;@@ -131,32 +127,32 @@ export default {return actionStr;} else if (activity.type == "bb.pipeline.task.status.update") {const payload = activity.payload as ActivityTaskStatusUpdatePayload;- var actionStr = `changed`;+ let actionStr = t(`activity.sentence.changed`);switch (payload.newStatus) {case "PENDING": {if (payload.oldStatus == "RUNNING") {- actionStr = `canceled`;+ actionStr = t(`activity.sentence.canceled`);} else if (payload.oldStatus == "PENDING_APPROVAL") {- actionStr = `approved`;+ actionStr = t(`activity.sentence.approved`);}break;}case "RUNNING": {- actionStr = `started`;+ actionStr = t(`activity.sentence.started`);break;}case "DONE": {- actionStr = `completed`;+ actionStr = t(`activity.sentence.completed`);break;}case "FAILED": {- actionStr = `failed`;+ actionStr = t(`activity.sentence.failed`);break;}}- return `Task '${payload.taskName}' ${actionStr} - '${- payload?.issueName || ""- }'`;+ return `${t("activity.subject-prefix.task")} '${+ payload.taskName+ }' ${actionStr} - '${payload?.issueName || ""}'`;}return "";@@ -186,5 +182,5 @@ export default {return { actionLink, showCreator, actionSentence, clickInbox };},-};+});</script>diff --git a/frontend/src/components/IssueActivityPanel.vue b/frontend/src/components/IssueActivityPanel.vueindex b2c3e98cae..67727b7967 100644--- a/frontend/src/components/IssueActivityPanel.vue+++ b/frontend/src/components/IssueActivityPanel.vue@@ -3,7 +3,7 @@<div class="divide-y divide-block-border"><div class="pb-4"><h2 id="activity-title" class="text-lg font-medium text-main">- Activity+ {{ $t("common.activity") }}</h2></div><div class="pt-6">@@ -21,16 +21,7 @@<div class="relative"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><imgclass="mt-1"@@ -44,16 +35,7 @@<template v-else-if="actionIcon(activity) == 'avatar'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-white- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"><PrincipalAvatar:principal="activity.creator"@@ -65,16 +47,7 @@<template v-else-if="actionIcon(activity) == 'create'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-solid:plus-sm class="w-5 h-5 text-control" /></div>@@ -83,16 +56,7 @@<template v-else-if="actionIcon(activity) == 'update'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-solid:pencil class="w-4 h-4 text-control" /></div>@@ -101,16 +65,7 @@<template v-else-if="actionIcon(activity) == 'run'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-outline:play class="w-6 h-6 text-control" /></div>@@ -119,16 +74,7 @@<template v-else-if="actionIcon(activity) == 'approve'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-outline:thumb-upclass="w-5 h-5 text-control"@@ -139,16 +85,7 @@<template v-else-if="actionIcon(activity) == 'cancel'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-outline:minus class="w-5 h-5 text-control" /></div>@@ -157,16 +94,7 @@<template v-else-if="actionIcon(activity) == 'fail'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-white- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-outline:exclamation-circleclass="w-6 h-6 text-error"@@ -177,16 +105,7 @@<template v-else-if="actionIcon(activity) == 'complete'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-white- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-outline:check-circleclass="w-6 h-6 text-success"@@ -197,16 +116,7 @@<template v-else-if="actionIcon(activity) == 'commit'"><div class="relative pl-0.5"><div- class="- w-7- h-7- bg-control-bg- rounded-full- ring-4 ring-white- flex- items-center- justify-center- "+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"><heroicons-outline:code class="w-5 h-5 text-control" /></div>@@ -218,12 +128,7 @@{{ actionSubjectPrefix(activity) }}<router-link:to="actionSubject(activity).link"- class="- font-medium- text-main- whitespace-nowrap- hover:underline- "+ class="font-medium text-main whitespace-nowrap hover:underline"exact-active-class="">{{ actionSubject(activity).name }}</router-link>@@ -270,48 +175,18 @@><buttontype="button"- class="- rounded-sm- text-control- hover:bg-control-bg-hover- disabled:bg-control-bg- disabled:opacity-50- disabled:cursor-not-allowed- px-2- text-xs- leading-5- font-normal- focus:ring-control focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "+ class="rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed px-2 text-xs leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"@click.prevent="cancelEditComment">- Cancel+ {{ $t("common.cancel") }}</button><buttontype="button"- class="- border border-control-border- rounded-sm- text-control- bg-control-bg- hover:bg-control-bg-hover- disabled:bg-control-bg- disabled:opacity-50- disabled:cursor-not-allowed- px-2- text-xs- leading-5- font-normal- focus:ring-control focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "+ class="border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed px-2 text-xs leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2":disabled="!allowUpdateComment"@click.prevent="doUpdateComment">- Save+ {{ $t("common.save") }}</button></template><!-- mr-2 is to vertical align with the text description edit button-->@@ -346,13 +221,15 @@state.activeActivity.id == activity.id">- <label for="comment" class="sr-only">Edit Comment</label>+ <label for="comment" class="sr-only">+ {{ $t("issue.edit-comment") }}+ </label><textarearef="editCommentTextArea"v-model="editComment"rows="3"class="textarea block w-full resize-none"- placeholder="Leave a comment..."+ :placeholder="$t('issue.leave-a-comment')"@input="(e) => {sizeToFit(e.target);@@ -375,7 +252,8 @@:href="`${activity.payload.vcsInstanceUrl}/${activity.payload.repositoryFullPath}/-/commit/${activity.payload.commitId}`"target="__blank"class="normal-link flex flex-row items-center"- >View commit+ >+ {{ $t("issue.view-commit") }}<heroicons-outline:external-link class="w-4 h-4" /></a></template>@@ -392,15 +270,7 @@<div class="relative"><PrincipalAvatar :principal="currentUser" /><span- class="- absolute- -bottom-0.5- -right-1- bg-white- rounded-tl- px-0.5- py-px- "+ class="absolute -bottom-0.5 -right-1 bg-white rounded-tl px-0.5 py-px"><!-- Heroicon name: solid/chat-alt --><heroicons-solid:chat-alt@@ -410,13 +280,15 @@</div></div><div class="ml-3 min-w-0 flex-1">- <label for="comment" class="sr-only">Create Comment</label>+ <label for="comment" class="sr-only">+ {{ $t("issue.add-a-comment") }}+ </label><textarearef="newCommentTextArea"v-model="newComment"rows="3"class="textarea block w-full resize-none whitespace-pre-wrap"- placeholder="Leave a comment..."+ :placeholder="$t('issue.leave-a-comment')"@input="(e) => {sizeToFit(e.target);@@ -430,7 +302,7 @@:disabled="newComment.length == 0"@click.prevent="doCreateComment">- Comment+ {{ $t("common.comment") }}</button></div></div>@@ -467,6 +339,7 @@ import {reactive,watchEffect,PropType,+ defineComponent,} from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";@@ -491,6 +364,7 @@ import {taskSlug,} from "../utils";import { IssueTemplate, IssueBuiltinFieldId } from "../plugins";+import { useI18n } from "vue-i18n";interface LocalState {showDeleteCommentModal: boolean;@@ -515,7 +389,7 @@ type ActionIconType =| "complete"| "commit";-export default {+export default defineComponent({name: "IssueActivityPanel",components: { PrincipalAvatar },props: {@@ -530,6 +404,7 @@ export default {},emits: ["add-subscriber-id"],setup(props, { emit }) {+ const { t } = useI18n();const store = useStore();const router = useRouter();@@ -690,12 +565,8 @@ export default {} else if (payload.oldStatus == "PENDING_APPROVAL") {return "approve";}+ break;}- // TODO(ji): Next line raises an eslint ERROR because of missing `break`.- // But I won't change it this time.- // Because I don't know whether this fall-through is meaningful.- // If it is, write a comment line "fall-through" (without quote and dash)- // above it to tell eslint to ignore it.case "RUNNING": {return "run";}@@ -716,7 +587,7 @@ export default {const actionSubjectPrefix = (activity: Activity): string => {if (activity.creator.id == SYSTEM_BOT_ID) {if (activity.type == "bb.pipeline.task.status.update") {- return "Task ";+ return `${t("activity.subject-prefix.task")} `;}}return "";@@ -750,31 +621,32 @@ export default {const actionSentence = (activity: Activity): string => {if (activity.type.startsWith("bb.issue.")) {- return issueActivityActionSentence(activity);+ const [tid, params] = issueActivityActionSentence(activity);+ return t(tid, params);}switch (activity.type) {case "bb.pipeline.task.status.update": {const payload = activity.payload as ActivityTaskStatusUpdatePayload;- var str = `changed`;+ let str = t("activity.sentence.changed");switch (payload.newStatus) {case "PENDING": {if (payload.oldStatus == "RUNNING") {- str = `canceled`;+ str = t("activity.sentence.canceled");} else if (payload.oldStatus == "PENDING_APPROVAL") {- str = `approved`;+ str = t("activity.sentence.approved");}break;}case "RUNNING": {- str = `started`;+ str = t("activity.sentence.started");break;}case "DONE": {- str = `completed`;+ str = t("activity.sentence.completed");break;}case "FAILED": {- str = `failed`;+ str = t("activity.sentence.failed");break;}}@@ -782,13 +654,18 @@ export default {// If creator is not the robot (which means we do NOT use task name in the subject),// then we append the task name here.const task = findTaskById(props.issue.pipeline, payload.taskId);- str += ` task ${task.name}`;+ str += t("activity.sentence.task-name", { name: task.name });}return str;}case "bb.pipeline.task.file.commit": {const payload = activity.payload as ActivityTaskFileCommitPayload;- return `committed ${payload.filePath} to ${payload.branch}@${payload.repositoryFullPath}`;+ // return `committed ${payload.filePath} to ${payload.branch}@${payload.repositoryFullPath}`;+ return t("activity.sentence.committed-to-at", {+ file: payload.filePath,+ branch: payload.branch,+ repo: payload.repositoryFullPath,+ });}}return "";@@ -815,5 +692,5 @@ export default {doDeleteComment,};},-};+});</script>diff --git a/frontend/src/components/IssueDescriptionPanel.vue b/frontend/src/components/IssueDescriptionPanel.vueindex 3dae2c2a14..58efd5e89f 100644--- a/frontend/src/components/IssueDescriptionPanel.vue+++ b/frontend/src/components/IssueDescriptionPanel.vue@@ -1,7 +1,7 @@<template><!-- Description Bar --><div class="flex justify-between">- <div class="textlabel">Description</div>+ <div class="textlabel">{{ $t("common.description") }}</div><div v-if="!create" class="space-x-2"><buttonv-if="allowEdit && !state.editing"@@ -17,74 +17,40 @@<buttonv-if="state.editing"type="button"- class="- mt-0.5- px-3- rounded-sm- text-control- hover:bg-control-bg-hover- disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed- text-sm- leading-5- font-normal- focus:ring-control focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "+ class="mt-0.5 px-3 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"@click.prevent="cancelEdit">- Cancel+ {{ $t("common.cancel") }}</button><buttonv-if="state.editing"type="button"- class="- mt-0.5- px-3- border border-control-border- rounded-sm- text-control- bg-control-bg- hover:bg-control-bg-hover- disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed- text-sm- leading-5- font-normal- focus:ring-control focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "+ class="mt-0.5 px-3 border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2":disabled="state.editDescription == issue.description"@click.prevent="saveEdit">- Save+ {{ $t("common.save") }}</button></div></div><!-- Description -->- <label for="description" class="sr-only">Edit Description</label>+ <label for="description" class="sr-only">+ {{ $t("issue.edit-description") }}+ </label><!-- Use border-white focus:border-white to have the invisible border widthotherwise it will have 1px jiggling switching between focus/unfocus state --><textarearef="editDescriptionTextArea"v-model="state.editDescription":rows="create ? 10 : 5"- class="- mt-2- w-full- resize-none- whitespace-pre-wrap- border-white- focus:border-white- outline-none- "+ class="mt-2 w-full resize-none whitespace-pre-wrap border-white focus:border-white outline-none":class="state.editing ? 'focus:ring-control focus-visible:ring-2' : ''":style="state.editing? '': '-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none'"- placeholder="Add some description..."+ :placeholder="$t('issue.add-some-description')":readonly="!state.editing"@input="(e) => {diff --git a/frontend/src/components/IssueHighlightPanel.vue b/frontend/src/components/IssueHighlightPanel.vueindex 2f7c388952..e673903c0d 100644--- a/frontend/src/components/IssueHighlightPanel.vue+++ b/frontend/src/components/IssueHighlightPanel.vue@@ -22,25 +22,26 @@/></div><div v-if="!create">- <p class="text-sm text-control-light">- #{{ issue.id }} opened by- <router-link- :to="`/u/${issue.creator.id}`"- class="font-medium text-control hover:underline"- >{{ issue.creator.name }}</router-link- >- at- {{ moment(issue.updatedTs * 1000).format("LLL") }}- </p>+ <i18n-t+ keypath="issue.opened-by-at"+ tag="p"+ class="text-sm text-control-light"+ >+ <template #creator>+ <router-link+ :to="`/u/${issue.creator.id}`"+ class="font-medium text-control hover:underline"+ >+ {{ issue.creator.name }}+ </router-link>+ </template>+ <template #time>+ {{ moment(issue.updatedTs * 1000).format("LLL") }}+ </template>+ </i18n-t><pv-if="pushEvent"- class="- mt-1- text-sm text-control-light- flex flex-row- items-center- space-x-1- "+ class="mt-1 text-sm text-control-light flex flex-row items-center space-x-1"><template v-if="pushEvent.vcsType.startsWith('GITLAB')"><img class="h-4 w-auto" src="../assets/gitlab-logo.svg" />@@ -48,20 +49,27 @@<a :href="vcsBranchUrl" target="_blank" class="normal-link">{{ `${vcsBranch}@${pushEvent.repositoryFullPath}` }}</a>- <span>- commit- <a- :href="pushEvent.fileCommit.url"- target="_blank"- class="normal-link"- >- {{ pushEvent.fileCommit.id.substring(0, 7) }}:- </a>- <span class="text-main">{{ pushEvent.fileCommit.title }}</span>- by- {{ pushEvent.authorName }} at- {{ moment(pushEvent.fileCommit.createdTs * 1000).format("LLL") }}- </span>++ <i18n-t keypath="issue.commit-by-at" tag="span">+ <template #id>+ <a+ :href="pushEvent.fileCommit.url"+ target="_blank"+ class="normal-link"+ >+ {{ pushEvent.fileCommit.id.substring(0, 7) }}:+ </a>+ </template>+ <template #title>+ <span class="text-main">{{ pushEvent.fileCommit.title }}</span>+ </template>+ <template #author>{{ pushEvent.authorName }}</template>+ <template #time>+ {{+ moment(pushEvent.fileCommit.createdTs * 1000).format("LLL")+ }}+ </template>+ </i18n-t></p></div></div>@@ -73,7 +81,7 @@</template><script lang="ts">-import { reactive, watch, PropType, computed } from "vue";+import { reactive, watch, PropType, computed, defineComponent } from "vue";import IssueStatusIcon from "../components/IssueStatusIcon.vue";import { activeTask } from "../utils";import { TaskDatabaseSchemaUpdatePayload, Issue, VCSPushEvent } from "../types";@@ -83,7 +91,7 @@ interface LocalState {name: string;}-export default {+export default defineComponent({name: "IssueHighlightPanel",components: { IssueStatusIcon },props: {@@ -168,5 +176,5 @@ export default {trySaveName,};},-};+});</script>diff --git a/frontend/src/components/IssueSidebar.vue b/frontend/src/components/IssueSidebar.vueindex bf7e1eb467..8244371c84 100644--- a/frontend/src/components/IssueSidebar.vue+++ b/frontend/src/components/IssueSidebar.vue@@ -4,7 +4,7 @@<div class="grid gap-y-6 gap-x-6 grid-cols-3"><template v-if="!create"><h2 class="textlabel flex items-center col-span-1 col-start-1">- Status+ {{ $t("common.status") }}</h2><div class="col-span-2"><span class="flex items-center space-x-2">@@ -17,7 +17,8 @@</template><h2 class="textlabel flex items-center col-span-1 col-start-1">- Assignee<span v-if="create" class="text-red-600">*</span>+ {{ $t("common.assignee") }}+ <span v-if="create" class="text-red-600">*</span></h2><!-- Only DBA can be assigned to the issue --><div class="col-span-2">@@ -69,7 +70,7 @@><template v-if="showStageSelect"><h2 class="textlabel flex items-center col-span-1 col-start-1">- Stage+ {{ $t("common.stage") }}</h2><div class="col-span-2"><StageSelect@@ -82,7 +83,7 @@<template v-if="databaseName"><h2 class="textlabel flex items-center col-span-1 col-start-1">- Database+ {{ $t("common.database") }}</h2><divclass="col-span-2 text-sm font-medium text-main"@@ -104,7 +105,7 @@<template v-if="showInstance"><h2 class="textlabel flex items-center col-span-1 col-start-1">- <span class="mr-1">Instance</span>+ <span class="mr-1">{{ $t("common.instance") }}</span><InstanceEngineIcon :instance="instance" /></h2><router-link@@ -116,7 +117,7 @@</template><h2 class="textlabel flex items-center col-span-1 col-start-1">- Environment+ {{ $t("common.environment") }}</h2><router-link:to="`/environment/${environmentSlug(environment)}`"@@ -129,7 +130,7 @@class="mt-6 border-t border-block-border pt-6 grid gap-y-6 gap-x-6 grid-cols-3"><h2 class="textlabel flex items-center col-span-1 col-start-1">- Project+ {{ $t("common.project") }}</h2><router-link:to="`/project/${projectSlug(project)}`"@@ -140,20 +141,20 @@<template v-if="!create"><h2 class="textlabel flex items-center col-span-1 col-start-1">- Updated+ {{ $t("common.updated-at") }}</h2><span class="textfield col-span-2">{{ moment(issue.updatedTs * 1000).format("LLL") }}</span><h2 class="textlabel flex items-center col-span-1 col-start-1">- Created+ {{ $t("common.created-at") }}</h2><span class="textfield col-span-2">{{ moment(issue.createdTs * 1000).format("LLL") }}</span><h2 class="textlabel flex items-center col-span-1 col-start-1">- Creator+ {{ $t("common.creator") }}</h2><ul class="col-span-2"><li class="flex justify-start items-center space-x-2">@@ -184,7 +185,7 @@</template><script lang="ts">-import { computed, PropType, reactive } from "vue";+import { computed, defineComponent, PropType, reactive } from "vue";import { useStore } from "vuex";import isEqual from "lodash-es/isEqual";import PrincipalAvatar from "../components/PrincipalAvatar.vue";@@ -214,7 +215,7 @@ import { useRouter } from "vue-router";// eslint-disable-next-line @typescript-eslint/no-empty-interfaceinterface LocalState {}-export default {+export default defineComponent({name: "IssueSidebar",components: {PrincipalAvatar,@@ -413,5 +414,5 @@ export default {clickDatabase,};},-};+});</script>diff --git a/frontend/src/components/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/IssueStatusTransitionButtonGroup.vueindex 95b94a2f47..11b45fb102 100644--- a/frontend/src/components/IssueStatusTransitionButtonGroup.vue+++ b/frontend/src/components/IssueStatusTransitionButtonGroup.vue@@ -6,7 +6,7 @@:disabled="!allowCreate"@click.prevent="doCreate">- Create+ {{ $t("common.create") }}</button></template><template v-else>@@ -23,7 +23,7 @@:class="transition.buttonClass"@click.prevent="tryStartTaskStatusTransition(transition)">- {{ transition.buttonName }}+ {{ $t(transition.buttonName) }}</button></template><template v-if="applicableIssueStatusTransitionList.length > 0">@@ -48,7 +48,7 @@role="menuitem"@click.prevent="tryStartIssueStatusTransition(transition)">- {{ transition.buttonName }}+ {{ $t(transition.buttonName) }}</div></template></BBContextMenu>@@ -69,12 +69,12 @@:disabled="!allowIssueStatusTransition(transition)"@click.prevent="tryStartIssueStatusTransition(transition)">- {{ transition.buttonName }}+ {{ $t(transition.buttonName) }}</button></template><template v-if="allowRollback"><button type="button" class="btn-primary" @click.prevent="doRollback">- Rollback+ {{ $t("common.rollback") }}</button></template></div>@@ -116,7 +116,7 @@</template><script lang="ts">-import { PropType, computed, reactive } from "vue";+import { PropType, computed, reactive, defineComponent } from "vue";import { Store, useStore } from "vuex";import StatusTransitionForm from "../components/StatusTransitionForm.vue";import {@@ -142,6 +142,7 @@ import {} from "../types";import { IssueTemplate } from "../plugins";import isEmpty from "lodash-es/isEmpty";+import { useI18n } from "vue-i18n";interface UpdateStatusModalState {mode: "ISSUE" | "TASK";@@ -160,7 +161,7 @@ export type IssueContext = {issue: Issue | IssueCreate;};-export default {+export default defineComponent({name: "IssueStatusTransitionButtonGroup",components: {StatusTransitionForm,@@ -186,6 +187,7 @@ export default {emits: ["create", "rollback", "change-issue-status", "change-task-status"],setup(props, { emit }) {+ const { t } = useI18n();const store = useStore();const updateStatusModalState = reactive<UpdateStatusModalState>({@@ -237,28 +239,32 @@ export default {const tryStartTaskStatusTransition = (transition: TaskStatusTransition) => {updateStatusModalState.mode = "TASK";- updateStatusModalState.okText = transition.buttonName;+ updateStatusModalState.okText = t(transition.buttonName);const task = currentTask.value;switch (transition.type) {case "RUN":updateStatusModalState.style = "INFO";- updateStatusModalState.title = `Run '${task.name}'?`;+ updateStatusModalState.title = `${t("common.run")} '${task.name}'?`;break;case "APPROVE":updateStatusModalState.style = "INFO";- updateStatusModalState.title = `Approve '${task.name}'?`;+ updateStatusModalState.title = `${t("common.approve")} '${+ task.name+ }'?`;break;case "RETRY":updateStatusModalState.style = "INFO";- updateStatusModalState.title = `Retry '${task.name}'?`;+ updateStatusModalState.title = `${t("common.retry")} '${task.name}'?`;break;case "CANCEL":updateStatusModalState.style = "INFO";- updateStatusModalState.title = `Cancel '${task.name}'?`;+ updateStatusModalState.title = `${t("common.cancel")} '${+ task.name+ }'?`;break;case "SKIP":updateStatusModalState.style = "INFO";- updateStatusModalState.title = `Skip '${task.name}'?`;+ updateStatusModalState.title = `${t("common.skip")} '${task.name}'?`;break;}updateStatusModalState.transition = transition;@@ -355,19 +361,25 @@ export default {transition: IssueStatusTransition) => {updateStatusModalState.mode = "ISSUE";- updateStatusModalState.okText = transition.buttonName;+ updateStatusModalState.okText = t(transition.buttonName);switch (transition.type) {case "RESOLVE":updateStatusModalState.style = "SUCCESS";- updateStatusModalState.title = "Resolve issue?";+ updateStatusModalState.title = t(+ "issue.status-transition.modal.resolve"+ );break;case "CANCEL":updateStatusModalState.style = "INFO";- updateStatusModalState.title = "Cancel this entire issue?";+ updateStatusModalState.title = t(+ "issue.status-transition.modal.cancel"+ );break;case "REOPEN":updateStatusModalState.style = "INFO";- updateStatusModalState.title = "Reopen issue?";+ updateStatusModalState.title = t(+ "issue.status-transition.modal.reopen"+ );break;}updateStatusModalState.transition = transition;@@ -443,5 +455,5 @@ export default {doRollback,};},-};+});</script>diff --git a/frontend/src/components/IssueSubscriberPanel.vue b/frontend/src/components/IssueSubscriberPanel.vueindex befa00ed7a..65572ff5bf 100644--- a/frontend/src/components/IssueSubscriberPanel.vue+++ b/frontend/src/components/IssueSubscriberPanel.vue@@ -1,27 +1,11 @@<template><div- class="- mt-6- border-t border-block-border- pt-6- grid- gap-y-4 gap-x-6- grid-cols-3- "+ class="mt-6 border-t border-block-border pt-6 grid gap-y-4 gap-x-6 grid-cols-3"><h2- class="- textlabel- flex- items-center- col-span-1 col-start-1- whitespace-nowrap- "+ class="textlabel flex items-center col-span-1 col-start-1 whitespace-nowrap">- {{- subscriberList.length +- (subscriberList.length > 1 ? " subscribers" : " subscriber")- }}+ {{ $t("issue.subscriber", subscriberList.length) }}</h2><div v-if="subscriberList.length > 0" class="col-span-3 col-start-1"><div class="flex space-x-1">@@ -52,14 +36,24 @@v-elseclass="h-5 w-5 text-control inline -mt-0.5 mr-1"/>- {{ isCurrentUserSubscribed ? "Unsubscribe" : "Subscribe" }}+ {{+ isCurrentUserSubscribed+ ? $t("issue.unsubscribe")+ : $t("issue.subscribe")+ }}</span></button></div></template><script lang="ts">-import { reactive, PropType, computed, watchEffect } from "vue";+import {+ reactive,+ PropType,+ computed,+ watchEffect,+ defineComponent,+} from "vue";import PrincipalAvatar from "../components/PrincipalAvatar.vue";import { Issue, IssueSubscriber } from "../types";import { useStore } from "vuex";@@ -67,7 +61,7 @@ import { useStore } from "vuex";// eslint-disable-next-line @typescript-eslint/no-empty-interfaceinterface LocalState {}-export default {+export default defineComponent({name: "IssueSubscriberPanel",components: { PrincipalAvatar },props: {@@ -122,5 +116,5 @@ export default {toggleSubscription,};},-};+});</script>diff --git a/frontend/src/components/IssueTable.vue b/frontend/src/components/IssueTable.vueindex f5c26038fc..f0c9d047b5 100644--- a/frontend/src/components/IssueTable.vue+++ b/frontend/src/components/IssueTable.vue@@ -13,62 +13,62 @@<BBTableHeaderCell:left-padding="4"class="w-4 table-cell"- :title="columnList[0].title"+ :title="$t(columnList[0].title)"/><template v-if="mode == 'ALL'"><BBTableHeaderCellclass="w-12 table-cell"- :title="columnList[1].title"+ :title="$t(columnList[1].title)"/><BBTableHeaderCellclass="w-48 table-cell"- :title="columnList[2].title"+ :title="$t(columnList[2].title)"/><BBTableHeaderCellclass="w-12 table-cell"- :title="columnList[3].title"+ :title="$t(columnList[3].title)"/><BBTableHeaderCellclass="w-12 table-cell"- :title="columnList[4].title"+ :title="$t(columnList[4].title)"/><BBTableHeaderCellclass="w-24 hidden sm:table-cell"- :title="columnList[5].title"+ :title="$t(columnList[5].title)"/><BBTableHeaderCellclass="w-24 hidden md:table-cell"- :title="columnList[6].title"+ :title="$t(columnList[6].title)"/><BBTableHeaderCellclass="w-36 hidden sm:table-cell"- :title="columnList[7].title"+ :title="$t(columnList[7].title)"/></template><template v-else-if="mode == 'PROJECT'"><BBTableHeaderCellclass="w-48 table-cell"- :title="columnList[1].title"+ :title="$t(columnList[1].title)"/><BBTableHeaderCellclass="w-12 table-cell"- :title="columnList[2].title"+ :title="$t(columnList[2].title)"/><BBTableHeaderCellclass="w-12 table-cell"- :title="columnList[3].title"+ :title="$t(columnList[3].title)"/><BBTableHeaderCellclass="w-24 hidden sm:table-cell"- :title="columnList[4].title"+ :title="$t(columnList[4].title)"/><BBTableHeaderCellclass="w-24 hidden md:table-cell"- :title="columnList[5].title"+ :title="$t(columnList[5].title)"/><BBTableHeaderCellclass="w-36 hidden sm:table-cell"- :title="columnList[6].title"+ :title="$t(columnList[6].title)"/></template></template>@@ -108,11 +108,13 @@<div class="flex flex-row items-center"><BBAvatar:size="'SMALL'"- :username="issue.assignee ? issue.assignee.name : 'Unassigned'"+ :username="+ issue.assignee ? issue.assignee.name : $t('common.unassigned')+ "/>- <span class="ml-2">{{- issue.assignee ? issue.assignee.name : "Unassigned"- }}</span>+ <span class="ml-2">+ {{ issue.assignee ? issue.assignee.name : $t("common.unassigned") }}+ </span></div></BBTableCell></template>@@ -120,7 +122,7 @@</template><script lang="ts">-import { reactive, PropType } from "vue";+import { reactive, PropType, defineComponent } from "vue";import { useRouter } from "vue-router";import {BBTableColumn,@@ -146,28 +148,28 @@ const columnListMap: Map<Mode, BBTableColumn[]> = new Map(["ALL",[{- title: "Status",+ title: "issue.table.status",},{- title: "Project",+ title: "issue.table.project",},{- title: "Name",+ title: "issue.table.name",},{- title: "Environment",+ title: "issue.table.environment",},{- title: "DB",+ title: "issue.table.db",},{- title: "Progress",+ title: "issue.table.progress",},{- title: "Updated",+ title: "issue.table.updated",},{- title: "Assignee",+ title: "issue.table.assignee",},],],@@ -175,25 +177,25 @@ const columnListMap: Map<Mode, BBTableColumn[]> = new Map(["PROJECT",[{- title: "Status",+ title: "issue.table.status",},{- title: "Name",+ title: "issue.table.name",},{- title: "Environment",+ title: "issue.table.environment",},{- title: "DB",+ title: "issue.table.db",},{- title: "Progress",+ title: "issue.table.progress",},{- title: "Updated",+ title: "issue.table.updated",},{- title: "Assignee",+ title: "issue.table.assignee",},],],@@ -203,7 +205,7 @@ interface LocalState {dataSource: any[];}-export default {+export default defineComponent({name: "IssueTable",components: { IssueStatusIcon },props: {@@ -288,7 +290,7 @@ export default {return {state,- columnList: columnListMap.get(props.mode),+ columnList: columnListMap.get(props.mode)!,activeEnvironmentName,activeDatabaseName,taskStepList,@@ -297,5 +299,5 @@ export default {clickIssueStep,};},-};+});</script>diff --git a/frontend/src/components/IssueTaskStatementPanel.vue b/frontend/src/components/IssueTaskStatementPanel.vueindex 660520271d..03f287e3c7 100644--- a/frontend/src/components/IssueTaskStatementPanel.vue+++ b/frontend/src/components/IssueTaskStatementPanel.vue@@ -9,7 +9,7 @@: 'text-control'">- {{ rollback ? "Rollback SQL" : "SQL" }}+ {{ rollback ? $t("issue.rollback-sql") : $t("common.sql") }}<span v-if="create && !rollback" class="text-red-600">*</span><span v-if="sqlHint && !rollback" class="text-accent">{{`(${sqlHint})`@@ -24,7 +24,7 @@$emit('apply-statement-to-other-stages', state.editStatement)">- Apply to other stages+ {{ $t("issue.apply-to-other-stages") }}</button></div><div v-if="!create" class="space-x-2">@@ -42,69 +42,33 @@<buttonv-if="state.editing"type="button"- class="- mt-0.5- px-3- rounded-sm- text-control- hover:bg-control-bg-hover- disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed- text-sm- leading-5- font-normal- focus:ring-control focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "+ class="mt-0.5 px-3 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"@click.prevent="cancelEdit">- Cancel+ {{ $t("common.cancel") }}</button><buttonv-if="state.editing"type="button"- class="- mt-0.5- px-3- border border-control-border- rounded-sm- text-control- bg-control-bg- hover:bg-control-bg-hover- disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed- text-sm- leading-5- font-normal- focus:ring-control focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "+ class="mt-0.5 px-3 border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2":disabled="state.editStatement == statement"@click.prevent="saveEdit">- Save+ {{ $t("common.save") }}</button></div></div>- <label class="sr-only">SQL statement</label>+ <label class="sr-only">{{ $t("common.sql-statement") }}</label><template v-if="state.editing"><textarearef="editStatementTextArea"v-model="state.editStatement"- class="- whitespace-pre-wrap- mt-2- w-full- resize-none- border-white- focus:border-white- outline-none- "+ class="whitespace-pre-wrap mt-2 w-full resize-none border-white focus:border-white outline-none":class="state.editing ? 'focus:ring-control focus-visible:ring-2' : ''":placeholder="create && rollback- ? 'Add SQL statement...'- : '(Required) Add SQL statement...'+ ? $t('issue.add-sql-statement')+ : $t('issue.optional-add-sql-statement')"@input="(e) => {@@ -128,14 +92,26 @@{{ state.editStatement }}</div><div v-else-if="state.create" class="ml-2 text-control-light">- {{ rollback ? "Add rollback SQL statement..." : "Add SQL statement..." }}+ {{+ rollback+ ? $t("issue.add-rollback-sql-statement")+ : $t("issue.add-sql-statement")+ }}</div><div v-else class="ml-2 text-control-light">None</div></div></template><script lang="ts">-import { nextTick, onMounted, onUnmounted, ref, reactive, watch } from "vue";+import {+ nextTick,+ onMounted,+ onUnmounted,+ ref,+ reactive,+ watch,+ defineComponent,+} from "vue";import { sizeToFit } from "../utils";interface LocalState {@@ -143,7 +119,7 @@ interface LocalState {editStatement: string;}-export default {+export default defineComponent({name: "IssueTaskStatementPanel",components: {},props: {@@ -170,6 +146,7 @@ export default {sqlHint: {required: false,type: String,+ default: undefined,},},emits: ["update-statement", "apply-statement-to-other-stages"],@@ -245,5 +222,5 @@ export default {cancelEdit,};},-};+});</script>diff --git a/frontend/src/components/StageSelect.vue b/frontend/src/components/StageSelect.vueindex a805725f31..092454a745 100644--- a/frontend/src/components/StageSelect.vue+++ b/frontend/src/components/StageSelect.vue@@ -9,14 +9,18 @@><template v-for="(stage, index) in pipeline.stageList" :key="index"><option :value="stage.id" :selected="stage.id == state.selectedId">- {{ isActiveStage(stage.id) ? stage.name + " (active)" : stage.name }}+ {{+ isActiveStage(stage.id)+ ? $t("issue.stage-select.active", { name: stage.name })+ : stage.name+ }}</option></template></select></template><script lang="ts">-import { PropType, reactive, watch } from "vue";+import { defineComponent, PropType, reactive, watch } from "vue";import { UNKNOWN_ID, Pipeline, StageId } from "../types";import { activeStage } from "../utils";@@ -24,7 +28,7 @@ interface LocalState {selectedId: number;}-export default {+export default defineComponent({name: "StageSelect",props: {pipeline: {@@ -59,5 +63,5 @@ export default {isActiveStage,};},-};+});</script>diff --git a/frontend/src/components/StatusTransitionForm.vue b/frontend/src/components/StatusTransitionForm.vueindex 9e8c311d69..9006db5f37 100644--- a/frontend/src/components/StatusTransitionForm.vue+++ b/frontend/src/components/StatusTransitionForm.vue@@ -6,8 +6,8 @@<div class="flex flex-row items-center text-sm"><div class="sm:col-span-1"><label class="textlabel">- {{ field.name- }}<span v-if="field.required" class="text-red-600">*</span>+ {{ field.name }}+ <span v-if="field.required" class="text-red-600">*</span></label></div></div>@@ -78,23 +78,16 @@</div><div class="sm:col-span-4 w-112 min-w-full">- <label for="about" class="textlabel"> Note </label>+ <label for="about" class="textlabel">+ {{ $t("issue.status-transition.form.note") }}+ </label><div class="mt-1"><textarearef="commentTextArea"v-model="state.comment"rows="3"- class="- textarea- block- w-full- resize-none- mt-1- text-sm text-control- rounded-md- whitespace-pre-wrap- "- placeholder="(Optional) Add a note..."+ class="textarea block w-full resize-none mt-1 text-sm text-control rounded-md whitespace-pre-wrap"+ :placeholder="$t('issue.status-transition.form.placeholder')"@input="(e) => {sizeToFit(e.target);@@ -117,7 +110,7 @@class="btn-normal mt-3 px-4 py-2 sm:mt-0 sm:w-auto"@click.prevent="$emit('cancel')">- No+ {{ $t("common.cancel") }}</button><buttontype="button"@@ -133,7 +126,7 @@</template><script lang="ts">-import { computed, reactive, ref, PropType } from "vue";+import { computed, reactive, ref, PropType, defineComponent } from "vue";import cloneDeep from "lodash-es/cloneDeep";import DatabaseSelect from "./DatabaseSelect.vue";import TaskCheckBadgeBar from "./TaskCheckBadgeBar.vue";@@ -152,7 +145,7 @@ interface LocalState {outputValueList: string[];}-export default {+export default defineComponent({name: "StatusTransitionForm",components: { DatabaseSelect, TaskCheckBadgeBar },props: {@@ -171,6 +164,7 @@ export default {// Applicable when mode = 'TASK'task: {type: Object as PropType<Task>,+ default: undefined,},transition: {required: true,@@ -209,6 +203,7 @@ export default {case "REOPEN":return "btn-primary";}+ break; // only to make eslint happy}case "TASK": {switch ((props.transition as TaskStatusTransition).type) {@@ -225,6 +220,7 @@ export default {}}}+ return ""; // only to make eslint happy});// Code block below will raise an eslint ERROR.@@ -247,6 +243,7 @@ export default {}}}+ return false; // only to make eslint happy});const runningCheckCount = computed((): number => {@@ -305,5 +302,5 @@ export default {checkSummary,};},-};+});</script>diff --git a/frontend/src/components/TaskCheckBadgeBar.vue b/frontend/src/components/TaskCheckBadgeBar.vueindex 0f0482c93d..0ea3472818 100644--- a/frontend/src/components/TaskCheckBadgeBar.vue+++ b/frontend/src/components/TaskCheckBadgeBar.vue@@ -5,15 +5,7 @@:key="index"><button- class="- inline-flex- items-center- px-3- py-0.5- rounded-full- text-sm- border border-control-border- "+ class="inline-flex items-center px-3 py-0.5 rounded-full text-sm border border-control-border":class="buttonStyle(checkRun)"@click.prevent="selectTaskCheckRun(checkRun)">@@ -73,14 +65,15 @@</template><script lang="ts">-import { computed, PropType, reactive, watch } from "vue";+import { computed, defineComponent, PropType, reactive, watch } from "vue";+import { useI18n } from "vue-i18n";import { TaskCheckRun, TaskCheckStatus, TaskCheckType } from "../types";interface LocalState {selectedTaskCheckRun?: TaskCheckRun;}-export default {+export default defineComponent({name: "TaskCheckBadgeBar",props: {taskCheckRunList: {@@ -97,10 +90,13 @@ export default {},selectedTaskCheckRun: {type: Object as PropType<TaskCheckRun>,+ default: undefined,},},emits: ["select-task-check-run"],setup(props, { emit }) {+ const { t } = useI18n();+const state = reactive<LocalState>({selectedTaskCheckRun: props.selectedTaskCheckRun,});@@ -222,15 +218,15 @@ export default {const name = (taskCheckRun: TaskCheckRun): string => {switch (taskCheckRun.type) {case "bb.task-check.database.statement.fake-advise":- return "Fake";+ return t("task.check-type.fake");case "bb.task-check.database.statement.syntax":- return "Syntax";+ return t("task.check-type.syntax");case "bb.task-check.database.statement.compatibility":- return "Compatibility";+ return t("task.check-type.compatibility");case "bb.task-check.database.connect":- return "Connection";+ return t("task.check-type.connection");case "bb.task-check.instance.migration-schema":- return "Migration schema";+ return t("task.check-type.migration-schema");}};@@ -247,5 +243,5 @@ export default {selectTaskCheckRun,};},-};+});</script>diff --git a/frontend/src/components/TaskCheckBar.vue b/frontend/src/components/TaskCheckBar.vueindex 73950fdacb..de950a525a 100644--- a/frontend/src/components/TaskCheckBar.vue+++ b/frontend/src/components/TaskCheckBar.vue@@ -7,7 +7,7 @@:disabled="hasRunningTaskCheck"@click.prevent="runChecks">- {{ hasRunningTaskCheck ? "Checking..." : "Run checks" }}+ {{ hasRunningTaskCheck ? $t("task.checking") : $t("task.run-task") }}</button><TaskCheckBadgeBar:task-check-run-list="task.taskCheckRunList"@@ -19,7 +19,7 @@/><BBModalv-if="state.showModal"- :title="`Check result for '${task.name}'`"+ :title="$t('task.check-result.title', { name: task.name })"@close="dismissDialog"><div class="space-y-4 w-208">@@ -47,14 +47,14 @@}"/>- <TaskCheckRunPanel :task-check-run="state.selectedTaskCheckRun" />+ <TaskCheckRunPanel :task-check-run="state.selectedTaskCheckRun!" /><div class="pt-4 flex justify-end"><buttontype="button"class="btn-primary py-2 px-4"@click.prevent="dismissDialog">- Close+ {{ $t("common.close") }}</button></div></div>@@ -63,13 +63,14 @@</template><script lang="ts">-import { computed, PropType, reactive } from "vue";+import { computed, defineComponent, PropType, reactive } from "vue";import { Task, TaskCheckRun, TaskCheckStatus } from "../types";import TaskCheckBadgeBar from "./TaskCheckBadgeBar.vue";import TaskCheckRunPanel from "./TaskCheckRunPanel.vue";import { BBTabFilterItem } from "../bbkit/types";import { cloneDeep } from "lodash";import { humanizeTs } from "../utils";+import { useI18n } from "vue-i18n";interface LocalState {showModal: boolean;@@ -77,7 +78,7 @@ interface LocalState {selectedTabIndex: number;}-export default {+export default defineComponent({name: "TaskCheckBar",components: { TaskCheckBadgeBar, TaskCheckRunPanel },props: {@@ -88,6 +89,8 @@ export default {},emits: ["run-checks"],setup(props, { emit }) {+ const { t } = useI18n();+const state = reactive<LocalState>({showModal: false,selectedTabIndex: 0,@@ -114,7 +117,7 @@ export default {const tabItemList = computed((): BBTabFilterItem[] => {return tabTaskCheckRunList.value.map((item, index) => {return {- title: index == 0 ? "Latest" : humanizeTs(item.createdTs),+ title: index == 0 ? t("common.latest") : humanizeTs(item.createdTs),alert: false,};});@@ -179,5 +182,5 @@ export default {runChecks,};},-};+});</script>diff --git a/frontend/src/components/TaskCheckRunPanel.vue b/frontend/src/components/TaskCheckRunPanel.vueindex 45de6435f5..24c91b1f57 100644--- a/frontend/src/components/TaskCheckRunPanel.vue+++ b/frontend/src/components/TaskCheckRunPanel.vue@@ -14,16 +14,7 @@<BBTableCell :left-padding="4" class="table-cell w-4"><div class="flex flex-row space-x-2"><div- class="- relative- w-5- h-5- flex flex-shrink-0- items-center- justify-center- rounded-full- select-none- "+ class="relative w-5 h-5 flex flex-shrink-0 items-center justify-center rounded-full select-none":class="statusIconClass(checkResult.status)"><template v-if="checkResult.status == 'SUCCESS'">@@ -61,7 +52,8 @@</template><script lang="ts">-import { computed, PropType } from "vue";+import { computed, defineComponent, PropType } from "vue";+import { useI18n } from "vue-i18n";import { BBTableColumn } from "../bbkit/types";import {TaskCheckStatus,@@ -83,7 +75,7 @@ const columnList: BBTableColumn[] = [},];-export default {+export default defineComponent({name: "TaskCheckRunPanel",components: {},props: {@@ -93,6 +85,8 @@ export default {},},setup(props) {+ const { t } = useI18n();+const statusIconClass = (status: TaskCheckStatus) => {switch (status) {case "SUCCESS":@@ -111,7 +105,7 @@ export default {return [{status: "ERROR",- title: "Error",+ title: t("common.error"),code: props.taskCheckRun.code,content: props.taskCheckRun.result.detail,},@@ -120,7 +114,7 @@ export default {return [{status: "WARN",- title: "Canceled",+ title: t("common.canceled"),code: props.taskCheckRun.code,content: "",},@@ -142,5 +136,5 @@ export default {errorCodeLink,};},-};+});</script>diff --git a/frontend/src/components/TaskRunTable.vue b/frontend/src/components/TaskRunTable.vueindex 3f6b904794..90357b41a5 100644--- a/frontend/src/components/TaskRunTable.vue+++ b/frontend/src/components/TaskRunTable.vue@@ -11,16 +11,7 @@<BBTableCell :left-padding="4" class="table-cell w-4"><div class="flex flex-row space-x-2"><div- class="- relative- w-5- h-5- flex flex-shrink-0- items-center- justify-center- rounded-full- select-none- "+ class="relative w-5 h-5 flex flex-shrink-0 items-center justify-center rounded-full select-none":class="statusIconClass(taskRun.status)"><template v-if="taskRun.status == 'RUNNING'">@@ -30,15 +21,15 @@animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;"aria-hidden="true"- ></span>+ /></template><template v-else-if="taskRun.status == 'DONE'"><heroicons-outline:check class="w-5 h-5" /></template><template v-else-if="taskRun.status == 'FAILED'">- <span class="text-white font-medium text-base" aria-hidden="true"- >!</span- >+ <span class="text-white font-medium text-base" aria-hidden="true">+ !+ </span></template><template v-else-if="taskRun.status == 'CANCELED'"><heroicons-outline:minus-sm class="w-5 h-5" />@@ -79,36 +70,19 @@</template><script lang="ts">-import { PropType } from "vue";+import { computed, defineComponent, PropType } from "vue";import PrincipalAvatar from "./PrincipalAvatar.vue";import { BBTableColumn } from "../bbkit/types";import { MigrationErrorCode, Task, TaskRun, TaskRunStatus } from "../types";import { databaseSlug, instanceSlug, migrationHistorySlug } from "../utils";+import { useI18n } from "vue-i18n";type CommentLink = {title: string;link: string;};-const columnList: BBTableColumn[] = [- {- title: "",- },- {- title: "Comment",- },- {- title: "Invoker",- },- {- title: "Started",- },- {- title: "Ended",- },-];--export default {+export default defineComponent({name: "TaskRunTable",components: { PrincipalAvatar },props: {@@ -118,6 +92,26 @@ export default {},},setup(props) {+ const { t } = useI18n();++ const columnList = computed((): BBTableColumn[] => [+ {+ title: "",+ },+ {+ title: t("task.comment"),+ },+ {+ title: t("task.invoker"),+ },+ {+ title: t("task.started"),+ },+ {+ title: t("task.ended"),+ },+ ]);+const statusIconClass = (status: TaskRunStatus) => {switch (status) {case "RUNNING":@@ -144,7 +138,7 @@ export default {switch (taskRun.type) {case "bb.task.database.schema.update": {return {- title: "View migration",+ title: t("task.view-migration"),link: `/db/${databaseSlug(props.task.database!)}/history/${migrationHistorySlug(@@ -166,7 +160,7 @@ export default {taskRun.code == MigrationErrorCode.MIGRATION_BASELINE_MISSING) {return {- title: "View migration history",+ title: t("task.view-migration-history"),link: `/db/${databaseSlug(props.task.database!)}#migration-history`,};}@@ -184,5 +178,5 @@ export default {commentLink,};},-};+});</script>diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.ymlindex 136db7657f..dee84624fc 100644--- a/frontend/src/locales/en.yml+++ b/frontend/src/locales/en.yml@@ -1,6 +1,8 @@common:+ activity: Activitysave: Savecancel: Cancel+ comment: 评论home: Homesettings: Settingsproject: Project@@ -8,6 +10,7 @@ common:help: Helpdatabase: Databasedatabases: Databases+ description: Descriptioninstance: Instanceinstances: Instancesenvironment: Environment@@ -18,12 +21,23 @@ common:archive: Archivequickstart: Quickstartlogout: Logout+ close: Close+ latest: Latest+ error: Error+ canceled: Canceled+ approval: Approval+ approve: Approve+ done: Done+ create: Create+ rollback: Rollback+ run: Run+ retry: Retry+ skip: Skip+ reopen: Reopendismiss: Dismissback: Backnext: Next- skip: Skipedit: Edit- create: Createupdate: Updatevisit: Visitrole:@@ -48,7 +62,12 @@ common:updated-at: Updatedcommit: Commitstatement: Statement+ sql-statement: "SQL statement"snapshot: Snapshot+ status: Status+ stage: Stage+ sql: SQL+ unassigned: Unassignednew: Newadd: Addquery: Query@@ -69,6 +88,23 @@ kbar:preferences:common: Preferenceschange-language: Change Language…+task:+ checking: Checking...+ run-task: Run checks+ check-result:+ title: Check result for {name}+ check-type:+ fake: Fake+ syntax: Syntax+ compatibility: Compatibility+ connection: Connection+ migration-schema: Migration schema+ comment: Comment+ invoker: Invoker+ started: Started+ ended: Ended+ view-migration: View migration+ view-migration-history: View migration historybanner:demo-intro: This is a demo version of Bytebase.demo-intro-readonly: This is a demo version of Bytebase in read-only mode.@@ -145,6 +181,77 @@ activity:comment: Commentcreated: Createdinvoker: Invoker+ sentence:+ created-issue: "created issue"+ commented: commented+ reassigned-issue: "reassigned issue from {oldName} to {newName}"+ assigned-issue: "assigned issue to {newName}"+ unassigned-issue: "unassigned issue from {oldName}"+ invalid-assignee-update: "invalid assignee update"+ changed-description: "changed description"+ changed-from-to: 'changed {name} from "{oldValue}" to "{newValue}"'+ unset-from: 'unset {name} from "{oldValue}"'+ set-to: 'set {name} to "{newValue}"'+ changed-update: "changed {name} update"+ reopened-issue: "reopened issue"+ resolved-issue: "resolved issue"+ canceled-issue: "canceled issue"+ empty: ""+ changed: changed+ updated: updated+ canceled: canceled+ approved: approved+ started: started+ completed: completed+ failed: failed+ task-name: " task {name}"+ committed-to-at: "committed {file} to{branch}{'@'}{repo}"+ subject-prefix:+ task: "Task"+issue:+ waiting-approval: Waiting Approval+ opened-by-at: opened by {creator} at {time}+ commit-by-at: commit {id} {title} by {author} at {time}+ status-transition:+ modal:+ resolve: Resolve issue?+ cancel: Cancel this entire issue?+ reopen: Reopen issue?+ dropdown:+ resolve: Resolve issue+ cancel: Cancel issue+ reopen: Reopen issue+ form:+ note: Note+ placeholder: (Optional) Add a note...+ subscribe: Subscribe+ unsubscribe: Unsubscribe+ subscriber: No subscribers | 1 subscriber | {n} subscribers+ apply-to-other-stages: "Apply to other stages"+ add-sql-statement: "Add SQL statement..."+ optional-add-sql-statement: "(Optional) Add SQL statement..."+ rollback-sql: "Rollback SQL"+ add-rollback-sql-statement: "Add rollback SQL statement..."+ edit-description: "Edit description"+ add-some-description: "Add some description..."+ add-a-comment: "Add a comment"+ edit-comment: Edit comment+ leave-a-comment: "Leave a comment..."+ view-commit: View commit+ search-issue-name: Search issue name+ table:+ open: Open+ closed: Closed+ status: Status+ project: Project+ name: Name+ environment: Environment+ db: DB+ progress: Progress+ updated: Updated+ assignee: Assignee+ stage-select:+ active: "{name} (active)"alter-schema:vcs-enabled: >-This project has enabled VCS based version control and selecting databasediff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.ymlindex 7aac3a26c0..00fbc660c7 100644--- a/frontend/src/locales/zh-CN.yml+++ b/frontend/src/locales/zh-CN.yml@@ -1,6 +1,8 @@common:+ activity: 活动save: 保存cancel: 取消+ comment: 评论home: 主页settings: 设置project: 项目@@ -8,6 +10,7 @@ common:help: 帮助database: 数据库databases: 数据库+ description: 描述instance: 实例instances: 实例environment: 环境@@ -18,12 +21,23 @@ common:archive: 归档quickstart: 快速入门logout: 登出+ close: 关闭+ latest: 最新+ error: 错误+ canceled: 已取消+ approval: 批准+ approve: 批准+ done: 完成+ create: 创建+ rollback: 回滚+ run: 运行+ retry: 重试+ skip: 跳过+ reopen: 重开dismiss: 关闭back: 返回next: 下一步- skip: 跳过edit: 编辑- create: 创建update: 更新visit: 访问role:@@ -48,7 +62,12 @@ common:updated-at: 更新于commit: 提交statement: 语句+ sql-statement: "SQL @:{'common.statement'}"snapshot: 快照+ status: 状态+ stage: 阶段+ sql: SQL+ unassigned: 未指派new: 创建add: 添加query: 查询@@ -69,6 +88,23 @@ kbar:preferences:common: 偏好设置change-language: 更改语言…+task:+ checking: 检查中…+ run-task: 运行检查+ check-result:+ title: "{name} 的检查结果"+ check-type:+ fake: Fake+ syntax: 语法+ compatibility: 兼容性+ connection: 连接+ migration-schema: 迁移 schema+ comment: 评论+ invoker: 执行者+ started: 开始于+ ended: 结束于+ view-migration: 查看迁移+ view-migration-history: 查看迁移历史banner:demo-intro: 这是 Bytebase 的演示版本。demo-intro-readonly: 这是 Bytebase 的只读演示版本@@ -121,7 +157,7 @@ settings:yourself: 你自己upgrade: 升级付费方案来解锁其他角色select-role: 选择角色- not-assigned: 未指定+ not-assigned: 未指派table:account: 账户role: 角色@@ -138,9 +174,80 @@ settings:not-allow-remove: 不能移除最后一个所有者activity:name: 名称- comment: 注释+ comment: 评论created: 创建于invoker: 执行者+ sentence:+ created-issue: "创建工单"+ commented: 评论+ reassigned-issue: "将工单由 {oldName} 重新指派给 {newName}"+ assigned-issue: "将工单指派给 {newName}"+ unassigned-issue: "将工单由 {oldName} 解除指派"+ invalid-assignee-update: "无效的指派操作"+ changed-description: "修改描述"+ changed-from-to: '将 {name} 从 "{oldValue}" 修改为 "{newValue}"'+ unset-from: '撤销 {name} 的值 (从 "{oldValue}")'+ set-to: '将 {name} 设置为 "{newValue}"'+ changed-update: "修改 {name}"+ reopened-issue: "重开工单"+ resolved-issue: "解决工单"+ canceled-issue: "取消工单"+ empty: ""+ changed: 修改+ updated: 更新+ canceled: 取消+ approved: 批准+ started: 开始+ completed: 完成+ failed: 失败+ task-name: "任务 {name}"+ committed-to-at: "提交 {file} 到 {branch}{'@'}{repo}"+ subject-prefix:+ task: "任务"+issue:+ waiting-approval: 等待批准+ opened-by-at: "{id} 由 {creator} 开启于 {time}"+ commit-by-at: "{id} {title} 由 {author} 提交于 {time}"+ status-transition:+ modal:+ resolve: 解决工单?+ cancel: 取消整个工单?+ reopen: 重开工单?+ dropdown:+ resolve: 解决+ cancel: 取消工单+ reopen: 重开+ form:+ note: 笔记+ placeholder: (可选)添加一段笔记…+ subscribe: 订阅+ unsubscribe: 取消订阅+ subscriber: 没有订阅者 | 1 个订阅者 | {n} 个订阅者+ apply-to-other-stages: "@:{'common.apply'}到其他@:{'common.stage'}"+ add-sql-statement: "添加 SQL @:{'common.statement'}…"+ optional-add-sql-statement: "(可选)添加 SQL @:{'common.statement'}…"+ rollback-sql: "@:{'common.rollback'} SQL"+ add-rollback-sql-statement: "添加 @:{'common.rollback'} SQL @:{'common.statement'}…"+ edit-description: 编辑描述+ add-some-description: 添加一些描述…+ add-a-comment: 添加评论+ edit-comment: 编辑评论+ leave-a-comment: 发表一条评论…+ view-commit: 查看提交+ search-issue-name: 搜索工单名称+ table:+ open: 开启中+ closed: 已关闭+ status: 状态+ project: 项目+ name: 名称+ environment: 环境+ db: 数据库+ progress: 进度+ updated: 更新于+ assignee: 审核人+ stage-select:+ active: "{name}(活动中)"alter-schema:vcs-enabled: 该项目开启了基于 VCS 的版本管理,选择下面的数据库会将你导航到相应的 Git 仓库以创建 schema 变更。vcs-info: 代表项目开启了基于 VCS 的版本管理。选择该类项目下的数据库会将你导航到对应的 Git 仓库以创建 schema 变更。diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.tsindex e00b290f7b..508aabc25a 100644--- a/frontend/src/types/issue.ts+++ b/frontend/src/types/issue.ts@@ -93,7 +93,7 @@ export const ISSUE_STATUS_TRANSITION_LIST: Map<{type: "RESOLVE",to: "DONE",- buttonName: "Resolve",+ buttonName: "issue.status-transition.dropdown.resolve",buttonClass: "btn-success",},],@@ -102,7 +102,7 @@ export const ISSUE_STATUS_TRANSITION_LIST: Map<{type: "CANCEL",to: "CANCELED",- buttonName: "Cancel issue",+ buttonName: "issue.status-transition.dropdown.cancel",buttonClass: "btn-normal",},],@@ -111,7 +111,7 @@ export const ISSUE_STATUS_TRANSITION_LIST: Map<{type: "REOPEN",to: "OPEN",- buttonName: "Reopen",+ buttonName: "issue.status-transition.dropdown.reopen",buttonClass: "btn-normal",},],diff --git a/frontend/src/utils/activity.ts b/frontend/src/utils/activity.tsindex 21cf7f9647..2d9388a72f 100644--- a/frontend/src/utils/activity.ts+++ b/frontend/src/utils/activity.ts@@ -12,12 +12,14 @@ export function registerStoreWithActivityUtil(theStore: Store<any>) {store = theStore;}-export function issueActivityActionSentence(activity: Activity): string {+export function issueActivityActionSentence(+ activity: Activity+): [string, Record<string, any>] {switch (activity.type) {case "bb.issue.create":- return "created issue";+ return ["activity.sentence.created-issue", {}];case "bb.issue.comment.create":- return "commented";+ return ["activity.sentence.commented", {}];case "bb.issue.field.update": {const update = activity.payload as ActivityIssueFieldUpdatePayload;@@ -35,22 +37,35 @@ export function issueActivityActionSentence(activity: Activity): string {const newName = store.getters["principal/principalById"](update.newValue).name;-- return `reassigned issue from ${oldName} to ${newName}`;+ return [+ "activity.sentence.reassigned-issue",+ {+ oldName,+ newName,+ },+ ];} else if (!update.oldValue && update.newValue) {const newName = store.getters["principal/principalById"](update.newValue).name;-- return `assigned issue to ${newName}`;+ return [+ "activity.sentence.assigned-issue",+ {+ newName,+ },+ ];} else if (update.oldValue && !update.newValue) {const oldName = store.getters["principal/principalById"](update.oldValue).name;-- return `unassigned issue from ${oldName}`;+ return [+ "activity.sentence.unassigned-issue",+ {+ oldName,+ },+ ];} else {- return `invalid assignee update`;+ return ["activity.sentence.invalid-assignee-update", {}];}}// We don't display subscriber change for now@@ -58,7 +73,7 @@ export function issueActivityActionSentence(activity: Activity): string {break;case IssueBuiltinFieldId.DESCRIPTION:// Description could be very long, so we don't display it.- return "changed description";+ return ["activity.sentence.changed-description", {}];case IssueBuiltinFieldId.NAME:case IssueBuiltinFieldId.PROJECT:case IssueBuiltinFieldId.SQL:@@ -74,30 +89,54 @@ export function issueActivityActionSentence(activity: Activity): string {oldValue = update.oldValue;newValue = update.newValue;if (oldValue && newValue) {- return `changed ${name} from "${oldValue}" to "${newValue}"`;+ return [+ "activity.sentence.changed-from-to",+ {+ name,+ oldValue,+ newValue,+ },+ ];} else if (oldValue) {- return `unset "${name} from "${oldValue}"`;+ return [+ "activity.sentence.unset-from",+ {+ name,+ oldValue,+ },+ ];} else if (newValue) {- return `set ${name} to "${newValue}"`;+ return [+ "activity.sentence.set-to",+ {+ name,+ newValue,+ },+ ];} else {- return `changed ${name} update`;+ return [+ "activity.sentence.changed-update",+ {+ name,+ },+ ];}}}- return "updated";+ return ["activity.sentence.updated", {}];}case "bb.issue.status.update": {const update = activity.payload as ActivityIssueStatusUpdatePayload;switch (update.newStatus) {case "OPEN":- return "reopened issue";+ return ["activity.sentence.reopened-issue", {}];case "DONE":- return "resolved issue";+ return ["activity.sentence.resolved-issue", {}];case "CANCELED":- return "canceled issue";+ return ["activity.sentence.canceled-issue", {}];}}}- return "";+ return ["activity.sentence.empty", {}];}diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.tsindex ddfead7dc9..bf4803df7b 100644--- a/frontend/src/utils/pipeline.ts+++ b/frontend/src/utils/pipeline.ts@@ -176,7 +176,7 @@ const TASK_STATUS_TRANSITION_LIST: Map<{type: "RUN",to: "RUNNING",- buttonName: "Run",+ buttonName: "common.run",buttonClass: "btn-primary",},],@@ -185,7 +185,7 @@ const TASK_STATUS_TRANSITION_LIST: Map<{type: "APPROVE",to: "PENDING",- buttonName: "Approve",+ buttonName: "common.approve",buttonClass: "btn-primary",},],@@ -194,7 +194,7 @@ const TASK_STATUS_TRANSITION_LIST: Map<{type: "RETRY",to: "RUNNING",- buttonName: "Retry",+ buttonName: "common.retry",buttonClass: "btn-primary",},],@@ -203,7 +203,7 @@ const TASK_STATUS_TRANSITION_LIST: Map<{type: "CANCEL",to: "PENDING",- buttonName: "Cancel",+ buttonName: "common.cancel",buttonClass: "btn-primary",},],diff --git a/frontend/src/views/IssueDashboard.vue b/frontend/src/views/IssueDashboard.vueindex 2a27ef6e40..3b3e697a32 100644--- a/frontend/src/views/IssueDashboard.vue+++ b/frontend/src/views/IssueDashboard.vue@@ -10,15 +10,7 @@<div class="flex flex-row space-x-4"><buttonv-if="project"- class="- px-4- cursor-pointer- rounded-md- text-control text-sm- bg-link-hover- focus:outline-none- hover:underline- "+ class="px-4 cursor-pointer rounded-md text-control text-sm bg-link-hover focus:outline-none hover:underline"@click.prevent="goProject">{{ project.key }}@@ -31,7 +23,7 @@/><BBTableSearchref="searchField"- :placeholder="'Search issue name'"+ :placeholder="$t('issue.search-issue-name')"@change-text="(text) => changeSearchText(text)"/></div>@@ -56,6 +48,7 @@ import { Environment, Issue, PrincipalId, ProjectId } from "../types";import { reactive, ref, computed, onMounted, watchEffect } from "vue";import { activeEnvironment, projectSlug } from "../utils";import { BBTableSectionDataSource } from "../bbkit/types";+import { useI18n } from "vue-i18n";interface LocalState {showOpen: boolean;@@ -72,6 +65,7 @@ export default {name: "IssueDashboard",components: { EnvironmentTabFilter, IssueTable, MemberSelect },setup() {+ const { t } = useI18n();const searchField = ref();const store = useStore();@@ -172,7 +166,7 @@ export default {const list = [];if (state.showOpen) {list.push({- title: "Open",+ title: t("issue.table.open"),list: filteredList(state.openList).sort((a, b) => {return b.updatedTs - a.updatedTs;}),@@ -180,7 +174,7 @@ export default {}if (state.showClosed) {list.push({- title: "Closed",+ title: t("issue.table.closed"),list: filteredList(state.closedList).sort((a, b) => {return b.updatedTs - a.updatedTs;}),diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 023617db4b..fcb79f2a0a 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -8,19 +8,19 @@v-if="showCancelBanner"class="h-8 w-full text-base font-medium bg-gray-400 text-white flex justify-center items-center">- Canceled+ {{ $t("common.canceled") }}</div><divv-else-if="showSuccessBanner"class="h-8 w-full text-base font-medium bg-success text-white flex justify-center items-center">- Done+ {{ $t("common.done") }}</div><divv-else-if="showPendingApproval"class="h-8 w-full text-base font-medium bg-accent text-white flex justify-center items-center">- Waiting Approval+ {{ $t("issue.waiting-approval") }}</div><!-- Highlight Panel --><div class="bg-white px-4 pb-4">@@ -214,7 +214,7 @@ import {watchEffect,reactive,ref,- ComputedRef,+ defineComponent,} from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";@@ -290,7 +290,7 @@ interface LocalState {pollIssueTimer?: ReturnType<typeof setTimeout>;}-export default {+export default defineComponent({name: "IssueDetail",components: {IssueHighlightPanel,@@ -1222,5 +1222,5 @@ export default {showIssueTaskStatementApply,};},-};+});</script>