Skip to content

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

chore: instance assignment UX improvement (#6771)

Tianzhou (天舟)3c69dfe3342e
diff --git a/frontend/src/components/InstanceAssignment.vue b/frontend/src/components/InstanceAssignment.vue
index 50e8a2357a..29e0e5f604 100644
--- a/frontend/src/components/InstanceAssignment.vue
+++ b/frontend/src/components/InstanceAssignment.vue
@@ -2,13 +2,17 @@
<DrawerContent :title="$t('subscription.instance-assignment.manage-license')">
<div class="divide-block-border space-y-5 w-[40rem] h-full">
<div>
- <div class="text-gray-400">
- {{
- $t("subscription.instance-assignment.available-and-total-license")
- }}
+ <div class="flex space-x-2">
+ <div class="text-gray-400">
+ {{ $t("subscription.instance-assignment.used-and-total-license") }}
+ </div>
+ <LearnMoreLink
+ url="https://www.bytebase.com/docs/administration/license?source=console"
+ class="ml-1 text-sm"
+ />
</div>
<div class="mt-1 text-4xl flex items-center gap-x-2">
- <span>{{ availableLicenseCount }}</span>
+ <span>{{ assignedLicenseCount }}</span>
<span class="text-xl">/</span>
<span>{{ totalLicenseCount }}</span>
</div>
@@ -83,15 +87,15 @@
</router-link>
</div>
</BBTableCell>
- <BBTableCell class="bb-grid-cell">
- {{ hostPortOfInstanceV1(instance) }}
- </BBTableCell>
<BBTableCell class="bb-grid-cell">
<EnvironmentV1Name
:environment="instance.environmentEntity"
:link="false"
/>
</BBTableCell>
+ <BBTableCell class="bb-grid-cell">
+ {{ hostPortOfInstanceV1(instance) }}
+ </BBTableCell>
</template>
</BBTable>
</div>
@@ -145,10 +149,10 @@ const columnList: BBTableColumn[] = [
title: "common.name",
},
{
- title: "common.Address",
+ title: "common.environment",
},
{
- title: "common.environment",
+ title: "common.Address",
},
];
@@ -185,9 +189,9 @@ const totalLicenseCount = computed((): string => {
return t("subscription.unlimited");
});
-const availableLicenseCount = computed((): string => {
+const assignedLicenseCount = computed((): string => {
if (instanceCount.value > 0) {
- return `${Math.max(0, instanceCount.value - state.selectedInstance.size)}`;
+ return `${state.selectedInstance.size}`;
}
return t("subscription.unlimited");
});
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index 57a0c02bd5..54ab9cd347 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -216,7 +216,7 @@
to="/setting/subscription?manageLicense=1"
class="btn-icon-primary p-3"
>
- <heroicons-outline:cog class="w-5 h-5" />
+ <heroicons-outline:academic-cap class="w-5 h-5" />
</router-link>
<h3
class="flex-1 mt-1.5 text-center text-sm font-normal text-main tracking-tight"
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index dba6922ff9..cf3be718ca 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -54,6 +54,8 @@
"bookmarks": "Bookmarks",
"quick-action": "Quick Action",
"archive": "Archive",
+ "archived": "Archived",
+ "no-license": "No license",
"logout": "Logout",
"close": "Close",
"latest": "Latest",
@@ -1886,7 +1888,7 @@
"assign-license": "Assign License",
"n-license-remain": "remain {n}",
"manage-license": "Manage License",
- "available-and-total-license": "Available / Total Instance License",
+ "used-and-total-license": "Assigned / Total Instance License",
"success-notification": "Successfully update license assignment"
},
"update": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 86c668b5d7..1216ca4502 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -54,6 +54,8 @@
"bookmarks": "Marcadores",
"quick-action": "Acción rápida",
"archive": "Archivo",
+ "archived": "Archivada",
+ "no-license": "Sin licencia",
"logout": "Cerrar sesión",
"close": "Cerrar",
"latest": "Último",
@@ -1872,7 +1874,7 @@
"assign-license": "Asignar licencia",
"n-license-remain": "permanecer {n}",
"manage-license": "Administrar licencia",
- "available-and-total-license": "Licencia de instancia disponible/total",
+ "used-and-total-license": "Licencia asignada / total",
"success-notification": "Actualizar correctamente la asignación de licencia"
},
"update": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 67514ec61f..fc8ca3b4df 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -54,6 +54,8 @@
"bookmarks": "书签",
"quick-action": "快捷操作",
"archive": "归档",
+ "archived": "已归档",
+ "no-license": "无证书",
"logout": "登出",
"close": "关闭",
"latest": "最新",
@@ -1881,7 +1883,7 @@
"assign-license": "分配证书",
"n-license-remain": "剩余 {n}",
"manage-license": "管理证书",
- "available-and-total-license": "可分配数 / 证书总数",
+ "used-and-total-license": "已分配 / 总实例证书",
"success-notification": "证书分配更新成功"
},
"update": {
diff --git a/frontend/src/utils/v1/instance.ts b/frontend/src/utils/v1/instance.ts
index cdb0d66b78..7f657daee0 100644
--- a/frontend/src/utils/v1/instance.ts
+++ b/frontend/src/utils/v1/instance.ts
@@ -1,6 +1,7 @@
import slug from "slug";
import { keyBy, orderBy } from "lodash-es";
+import { useI18n } from "vue-i18n";
import { DataSourceType, Instance } from "@/types/proto/v1/instance_service";
import { Engine, State } from "@/types/proto/v1/common";
import { Environment } from "@/types/proto/v1/environment_service";
@@ -11,12 +12,13 @@ export const instanceV1Slug = (instance: Instance): string => {
};
export function instanceV1Name(instance: Instance) {
+ const { t } = useI18n();
let name = instance.title;
// instance cannot be deleted and activated at the same time.
if (instance.state === State.DELETED) {
- name += " (Archived)";
+ name += ` (${t("common.archived")})`;
} else if (!instance.activation) {
- name += " (Deactivate)";
+ name += ` (${t("common.no-license")})`;
}
return name;
}
diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vue
index afdd8f9063..ba9588cf5a 100644
--- a/frontend/src/views/SettingWorkspaceSubscription.vue
+++ b/frontend/src/views/SettingWorkspaceSubscription.vue
@@ -41,18 +41,16 @@
</div>
<div class="my-3">
<dt class="text-gray-400">
- {{
- $t("subscription.instance-assignment.available-and-total-license")
- }}
+ {{ $t("subscription.instance-assignment.used-and-total-license") }}
</dt>
<dd
- class="mt-1 text-4xl flex items-center gap-x-2 cursor-pointer"
+ class="mt-1 text-4xl flex items-center gap-x-2 cursor-pointer group"
@click="state.showInstanceAssignmentDrawer = true"
>
- <span>{{ availableLicenseCount }}</span>
+ <span class="group-hover:underline">{{ availableLicenseCount }}</span>
<span class="text-xl">/</span>
- <span>{{ totalLicenseCount }}</span>
- <heroicons-outline:cog class="h-6 w-6" />
+ <span class="group-hover:underline">{{ totalLicenseCount }}</span>
+ <heroicons-outline:pencil class="h-6 w-6" />
</dd>
</div>
<div v-if="!subscriptionStore.isFreePlan" class="my-3">
@@ -224,10 +222,7 @@ const totalLicenseCount = computed((): string => {
const availableLicenseCount = computed((): string => {
if (instanceCount.value > 0) {
- return `${Math.max(
- 0,
- instanceCount.value - instanceV1Store.activateInstanceCount
- )}`;
+ return `${instanceV1Store.activateInstanceCount}`;
}
return t("subscription.unlimited");
});