@liujitcn/kratos-admin-system 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +18 -1
  2. package/dist/package/declarations/src/api/base/notification.d.ts +24 -0
  3. package/dist/package/declarations/src/api/system/base_audit_log.d.ts +55 -0
  4. package/dist/package/declarations/src/api/system/base_dashboard.d.ts +14 -0
  5. package/dist/package/declarations/src/api/system/base_file.d.ts +13 -0
  6. package/dist/package/declarations/src/api/system/base_login_policy.d.ts +10 -0
  7. package/dist/package/declarations/src/api/system/base_message.d.ts +24 -0
  8. package/dist/package/declarations/src/api/system/base_message_category.d.ts +21 -0
  9. package/dist/package/declarations/src/api/system/base_session.d.ts +11 -0
  10. package/dist/package/declarations/src/api/system/oauth_client.d.ts +24 -0
  11. package/dist/package/declarations/src/components/AuditLogTable.vue.d.ts +45 -0
  12. package/dist/package/declarations/src/components/auditLog.d.ts +9 -0
  13. package/dist/package/declarations/src/locales/generated.d.ts +1312 -16
  14. package/dist/package/declarations/src/rpc/base/v1/login.d.ts +149 -0
  15. package/dist/package/declarations/src/rpc/base/v1/notification.d.ts +281 -0
  16. package/dist/package/declarations/src/rpc/base/v1/oauth.d.ts +25 -0
  17. package/dist/package/declarations/src/rpc/base/v1/oauth_client.d.ts +23 -0
  18. package/dist/package/declarations/src/rpc/system/admin/v1/base_audit_log.d.ts +640 -0
  19. package/dist/package/declarations/src/rpc/system/admin/v1/base_dashboard.d.ts +60 -0
  20. package/dist/package/declarations/src/rpc/system/admin/v1/base_file.d.ts +73 -0
  21. package/dist/package/declarations/src/rpc/system/admin/v1/base_i18n.d.ts +10 -6
  22. package/dist/package/declarations/src/rpc/system/admin/v1/base_job.d.ts +5 -0
  23. package/dist/package/declarations/src/rpc/system/admin/v1/base_login_policy.d.ts +51 -0
  24. package/dist/package/declarations/src/rpc/system/admin/v1/base_message.d.ts +193 -0
  25. package/dist/package/declarations/src/rpc/system/admin/v1/base_message_category.d.ts +125 -0
  26. package/dist/package/declarations/src/rpc/system/admin/v1/base_session.d.ts +33 -0
  27. package/dist/package/declarations/src/rpc/system/admin/v1/base_user.d.ts +3 -3
  28. package/dist/package/declarations/src/rpc/system/admin/v1/oauth_client.d.ts +145 -0
  29. package/dist/package/declarations/src/views/base/api-log/index.vue.d.ts +3 -0
  30. package/dist/package/declarations/src/views/base/dashboard/index.vue.d.ts +3 -0
  31. package/dist/package/declarations/src/views/base/data-access-log/index.vue.d.ts +3 -0
  32. package/dist/package/declarations/src/views/base/file/index.vue.d.ts +3 -0
  33. package/dist/package/declarations/src/views/base/login-log/index.vue.d.ts +3 -0
  34. package/dist/package/declarations/src/views/base/login-policy/index.vue.d.ts +3 -0
  35. package/dist/package/declarations/src/views/base/message/index.vue.d.ts +3 -0
  36. package/dist/package/declarations/src/views/base/message-category/index.vue.d.ts +3 -0
  37. package/dist/package/declarations/src/views/base/oauth-client/index.vue.d.ts +3 -0
  38. package/dist/package/declarations/src/views/base/operation-log/index.vue.d.ts +3 -0
  39. package/dist/package/declarations/src/views/base/permission-log/index.vue.d.ts +3 -0
  40. package/dist/package/declarations/src/views/base/policy-evaluation-log/index.vue.d.ts +3 -0
  41. package/dist/package/declarations/src/views/message/inbox/index.vue.d.ts +3 -0
  42. package/dist/package/declarations/src/views/profile/components/session.vue.d.ts +3 -0
  43. package/dist/package/src/api/base/notification.ts +69 -0
  44. package/dist/package/src/api/base/sse.ts +4 -4
  45. package/dist/package/src/api/system/auth.ts +1 -0
  46. package/dist/package/src/api/system/base_audit_log.ts +168 -0
  47. package/dist/package/src/api/system/base_dashboard.ts +55 -0
  48. package/dist/package/src/api/system/base_file.ts +43 -0
  49. package/dist/package/src/api/system/base_login_policy.ts +32 -0
  50. package/dist/package/src/api/system/base_message.ts +70 -0
  51. package/dist/package/src/api/system/base_message_category.ts +57 -0
  52. package/dist/package/src/api/system/base_session.ts +33 -0
  53. package/dist/package/src/api/system/oauth_client.ts +102 -0
  54. package/dist/package/src/components/AuditLogTable.vue +105 -0
  55. package/dist/package/src/components/Notification.vue +196 -0
  56. package/dist/package/src/components/auditLog.ts +46 -0
  57. package/dist/package/src/locales/README.md +4 -2
  58. package/dist/package/src/locales/en-US.json +334 -10
  59. package/dist/package/src/locales/ja-JP.json +338 -14
  60. package/dist/package/src/locales/zh-CN.json +334 -10
  61. package/dist/package/src/locales/zh-TW.json +337 -13
  62. package/dist/package/src/module.ts +5 -2
  63. package/dist/package/src/rpc/base/v1/login.ts +172 -0
  64. package/dist/package/src/rpc/base/v1/notification.ts +315 -0
  65. package/dist/package/src/rpc/base/v1/oauth.ts +25 -0
  66. package/dist/package/src/rpc/base/v1/oauth_client.ts +33 -0
  67. package/dist/package/src/rpc/system/admin/v1/base_audit_log.ts +737 -0
  68. package/dist/package/src/rpc/system/admin/v1/base_dashboard.ts +81 -0
  69. package/dist/package/src/rpc/system/admin/v1/base_file.ts +88 -0
  70. package/dist/package/src/rpc/system/admin/v1/base_i18n.ts +10 -6
  71. package/dist/package/src/rpc/system/admin/v1/base_job.ts +5 -0
  72. package/dist/package/src/rpc/system/admin/v1/base_login_policy.ts +63 -0
  73. package/dist/package/src/rpc/system/admin/v1/base_message.ts +236 -0
  74. package/dist/package/src/rpc/system/admin/v1/base_message_category.ts +149 -0
  75. package/dist/package/src/rpc/system/admin/v1/base_session.ts +44 -0
  76. package/dist/package/src/rpc/system/admin/v1/base_user.ts +3 -3
  77. package/dist/package/src/rpc/system/admin/v1/oauth_client.ts +174 -0
  78. package/dist/package/src/views/ai/chat/components/ChatPanel.vue +2 -2
  79. package/dist/package/src/views/ai/chat/message.ts +7 -3
  80. package/dist/package/src/views/base/api-log/index.vue +83 -0
  81. package/dist/package/src/views/base/config/index.vue +3 -3
  82. package/dist/package/src/views/base/dashboard/index.vue +200 -0
  83. package/dist/package/src/views/base/data-access-log/index.vue +84 -0
  84. package/dist/package/src/views/base/dict/index.vue +2 -2
  85. package/dist/package/src/views/base/dict/item.vue +2 -2
  86. package/dist/package/src/views/base/file/index.vue +119 -0
  87. package/dist/package/src/views/base/job/index.vue +62 -7
  88. package/dist/package/src/views/base/language/index.vue +2 -1
  89. package/dist/package/src/views/base/login-log/index.vue +92 -0
  90. package/dist/package/src/views/base/login-policy/index.vue +219 -0
  91. package/dist/package/src/views/base/menu/index.vue +2 -2
  92. package/dist/package/src/views/base/message/index.vue +582 -0
  93. package/dist/package/src/views/base/message-category/index.vue +356 -0
  94. package/dist/package/src/views/base/oauth-client/index.vue +411 -0
  95. package/dist/package/src/views/base/operation-log/index.vue +82 -0
  96. package/dist/package/src/views/base/permission-log/index.vue +85 -0
  97. package/dist/package/src/views/base/policy-evaluation-log/index.vue +82 -0
  98. package/dist/package/src/views/message/inbox/index.vue +249 -0
  99. package/dist/package/src/views/profile/components/base.vue +6 -5
  100. package/dist/package/src/views/profile/components/password.vue +2 -2
  101. package/dist/package/src/views/profile/components/security.vue +475 -62
  102. package/dist/package/src/views/profile/components/session.vue +153 -0
  103. package/dist/package/src/views/profile/index.vue +35 -22
  104. package/dist/package/src/views/tool/code-gen/config.ts +1 -0
  105. package/dist/package/src/views/tool/ops-monitoring/index.vue +25 -21
  106. package/package.json +2 -2
  107. package/dist/package/declarations/src/api/system/base_log.d.ts +0 -9
  108. package/dist/package/declarations/src/rpc/system/admin/v1/base_log.d.ts +0 -87
  109. package/dist/package/src/api/system/base_log.ts +0 -32
  110. package/dist/package/src/rpc/system/admin/v1/base_log.ts +0 -101
  111. package/dist/package/src/views/base/log/index.vue +0 -339
  112. /package/dist/package/declarations/src/{views/base/log/index.vue.d.ts → components/Notification.vue.d.ts} +0 -0
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <el-card class="session-card" shadow="never">
3
+ <template #header>
4
+ <div class="session-header">
5
+ <div>
6
+ <h3>{{ t("system.profile.session.title") }}</h3>
7
+ <p>{{ t("system.profile.session.description") }}</p>
8
+ </div>
9
+ <el-button :loading="loading" @click="loadSession">
10
+ <el-icon><Refresh /></el-icon>
11
+ {{ t("system.profile.session.action.refresh") }}
12
+ </el-button>
13
+ </div>
14
+ </template>
15
+
16
+ <el-skeleton v-if="loading && !session" :rows="5" animated />
17
+ <el-empty v-else-if="!session" :description="t('system.profile.session.empty')" />
18
+ <div v-else class="session-details">
19
+ <div class="session-status">
20
+ <el-tag type="success" effect="plain">{{ t("system.profile.session.status.active") }}</el-tag>
21
+ <span>{{ session.user_name }} · {{ session.tenant_code }}</span>
22
+ </div>
23
+ <dl class="session-grid">
24
+ <div>
25
+ <dt>{{ t("system.profile.session.field.client_ip") }}</dt>
26
+ <dd>{{ session.client_ip || "-" }}</dd>
27
+ </div>
28
+ <div>
29
+ <dt>{{ t("system.profile.session.field.device") }}</dt>
30
+ <dd>{{ session.device || "-" }}</dd>
31
+ </div>
32
+ <div>
33
+ <dt>{{ t("system.profile.session.field.issued_at") }}</dt>
34
+ <dd>{{ session.issued_at || "-" }}</dd>
35
+ </div>
36
+ <div>
37
+ <dt>{{ t("system.profile.session.field.expires_in") }}</dt>
38
+ <dd>{{ formatExpires(session.expires_in) }}</dd>
39
+ </div>
40
+ </dl>
41
+ <div class="session-actions">
42
+ <el-button type="danger" plain @click="revokeAll">
43
+ <el-icon><SwitchButton /></el-icon>
44
+ {{ t("system.profile.session.action.revoke_all") }}
45
+ </el-button>
46
+ </div>
47
+ </div>
48
+ </el-card>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { onMounted, ref } from "vue";
53
+ import { useRouter } from "vue-router";
54
+ import { t } from "@liujitcn/kratos-admin-core";
55
+ import { LOGIN_URL } from "@liujitcn/kratos-admin-core/config";
56
+ import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
57
+ import { defBaseSessionService } from "@liujitcn/kratos-admin-system/api/system/base_session";
58
+ import type { BaseSession } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_session";
59
+
60
+ const loading = ref(false);
61
+ const session = ref<BaseSession>();
62
+ const router = useRouter();
63
+ const userStore = useUserStore();
64
+
65
+ /** 拉取当前会话信息。 */
66
+ async function loadSession() {
67
+ loading.value = true;
68
+ try {
69
+ session.value = await defBaseSessionService.GetCurrentBaseSession({});
70
+ } finally {
71
+ loading.value = false;
72
+ }
73
+ }
74
+
75
+ /** 撤销当前用户全部会话并返回登录页。 */
76
+ async function revokeAll() {
77
+ await ElMessageBox.confirm(t("system.profile.session.confirm.revoke_all"), t("system.profile.session.confirm.title"), {
78
+ type: "warning"
79
+ });
80
+ await defBaseSessionService.RevokeAllBaseSessions({});
81
+ userStore.clearAuthData();
82
+ ElMessage.success(t("system.profile.session.message.revoked"));
83
+ session.value = undefined;
84
+ await router.replace(LOGIN_URL);
85
+ }
86
+
87
+ /** 将秒数格式化为可读的剩余有效期。 */
88
+ function formatExpires(seconds: number) {
89
+ if (!seconds || seconds < 60) return t("system.profile.session.value.less_than_minute");
90
+ const hours = Math.floor(seconds / 3600);
91
+ const minutes = Math.floor((seconds % 3600) / 60);
92
+ if (hours > 0) return t("system.profile.session.value.hours_minutes", { hours, minutes });
93
+ return t("system.profile.session.value.minutes", { minutes });
94
+ }
95
+
96
+ onMounted(loadSession);
97
+ </script>
98
+
99
+ <style scoped lang="scss">
100
+ .session-card {
101
+ border: 1px solid var(--el-border-color-light);
102
+ }
103
+ .session-header,
104
+ .session-status,
105
+ .session-actions {
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: space-between;
109
+ gap: 12px;
110
+ }
111
+ .session-header h3 {
112
+ margin: 0;
113
+ color: var(--el-text-color-primary);
114
+ font-size: 18px;
115
+ }
116
+ .session-header p {
117
+ margin: 6px 0 0;
118
+ color: var(--el-text-color-secondary);
119
+ font-size: 13px;
120
+ }
121
+ .session-grid {
122
+ display: grid;
123
+ grid-template-columns: repeat(2, minmax(0, 1fr));
124
+ gap: 16px;
125
+ margin: 24px 0;
126
+ }
127
+ .session-grid div {
128
+ padding: 14px;
129
+ background: var(--el-fill-color-light);
130
+ border-radius: 6px;
131
+ }
132
+ .session-grid dt {
133
+ color: var(--el-text-color-secondary);
134
+ font-size: 12px;
135
+ }
136
+ .session-grid dd {
137
+ margin: 6px 0 0;
138
+ color: var(--el-text-color-primary);
139
+ overflow-wrap: anywhere;
140
+ }
141
+ .session-actions {
142
+ justify-content: flex-end;
143
+ }
144
+ @media screen and (width <= 640px) {
145
+ .session-header {
146
+ align-items: flex-start;
147
+ flex-direction: column;
148
+ }
149
+ .session-grid {
150
+ grid-template-columns: 1fr;
151
+ }
152
+ }
153
+ </style>
@@ -26,6 +26,7 @@
26
26
  @refreshed="loadUserProfile"
27
27
  @switch-tab="handleTabChange"
28
28
  />
29
+ <ProfileSession v-else-if="activeTab === 'session'" />
29
30
  <ProfilePassword v-else />
30
31
  </main>
31
32
  </section>
@@ -47,10 +48,10 @@ import { useUserStore } from "@liujitcn/kratos-admin-core/stores/runtime";
47
48
  import ProfileBase from "./components/base.vue";
48
49
  import ProfileSecurity from "./components/security.vue";
49
50
  import ProfilePassword from "./components/password.vue";
50
- import { ArrowRight } from "@element-plus/icons-vue";
51
+ import ProfileSession from "./components/session.vue";
51
52
 
52
53
  /** 个人中心标签页。 */
53
- type ProfileTab = "account" | "security" | "password";
54
+ type ProfileTab = "account" | "security" | "password" | "session";
54
55
 
55
56
  /** 左侧导航项结构。 */
56
57
  interface ProfileTabOption {
@@ -65,23 +66,33 @@ interface ProfileTabOption {
65
66
  const userStore = useUserStore();
66
67
  const route = useRoute();
67
68
  const activeTab = ref<ProfileTab>("account");
68
- const profileTabs = computed<ProfileTabOption[]>(() => [
69
- {
70
- value: "account",
71
- label: t("system.profile.account.title"),
72
- description: t("system.profile.account.nav_description")
73
- },
74
- {
75
- value: "security",
76
- label: t("system.profile.security.title"),
77
- description: t("system.profile.security.nav_description")
78
- },
79
- {
80
- value: "password",
81
- label: t("system.profile.password.title"),
82
- description: t("system.profile.password.nav_description")
69
+ const profileTabs = computed<ProfileTabOption[]>(() => {
70
+ const tabs: ProfileTabOption[] = [
71
+ {
72
+ value: "account",
73
+ label: t("system.profile.account.title"),
74
+ description: t("system.profile.account.nav_description")
75
+ },
76
+ {
77
+ value: "security",
78
+ label: t("system.profile.security.title"),
79
+ description: t("system.profile.security.nav_description")
80
+ },
81
+ {
82
+ value: "password",
83
+ label: t("system.profile.password.title"),
84
+ description: t("system.profile.password.nav_description")
85
+ }
86
+ ];
87
+ if (userStore.userInfo.role_code === "super") {
88
+ tabs.push({
89
+ value: "session",
90
+ label: t("system.profile.session.title"),
91
+ description: t("system.profile.session.nav_description")
92
+ });
83
93
  }
84
- ]);
94
+ return tabs;
95
+ });
85
96
  const userProfileForm = reactive<UserProfileForm>({
86
97
  user_name: "",
87
98
  nick_name: "",
@@ -115,8 +126,10 @@ async function loadUserProfile() {
115
126
  }
116
127
 
117
128
  onMounted(async () => {
118
- // OAuth 绑定回跳时优先打开安全设置,让子组件消费绑定结果并刷新状态。
119
- if (route.query.oauth_bind_success || route.query.oauth_bind_error) {
129
+ if (route.query.tab === "password") {
130
+ activeTab.value = "password";
131
+ } else if (route.query.oauth_bind_success || route.query.oauth_bind_error) {
132
+ // OAuth 绑定回跳时优先打开安全设置,让子组件消费绑定结果并刷新状态。
120
133
  activeTab.value = "security";
121
134
  }
122
135
  await loadUserProfile();
@@ -139,7 +152,7 @@ onMounted(async () => {
139
152
  padding: 16px;
140
153
  background: #ffffff;
141
154
  border: 1px solid #ebeef5;
142
- border-radius: 12px;
155
+ border-radius: var(--admin-page-radius);
143
156
  box-shadow: 0 2px 12px rgb(0 0 0 / 4%);
144
157
  }
145
158
  .nav-item {
@@ -153,7 +166,7 @@ onMounted(async () => {
153
166
  cursor: pointer;
154
167
  background: #ffffff;
155
168
  border: 1px solid transparent;
156
- border-radius: 10px;
169
+ border-radius: var(--admin-page-radius);
157
170
  transition: all 0.2s ease;
158
171
  }
159
172
  .nav-item + .nav-item {
@@ -73,6 +73,7 @@ const codeGenFormComponentLabelKeys: Record<ProFormComponentType, string> = {
73
73
  password: "system.code.gen.component.password",
74
74
  textarea: "system.code.gen.component.textarea",
75
75
  "input-number": "system.code.gen.component.input_number",
76
+ "color-picker": "system.code.gen.component.color_picker",
76
77
  segmented: "system.code.gen.component.segmented",
77
78
  switch: "system.code.gen.component.switch",
78
79
  checkbox: "system.code.gen.component.checkbox",
@@ -128,7 +128,7 @@
128
128
  <code>{{ item.address }}</code>
129
129
  </div>
130
130
  </div>
131
- <el-tag :type="item.status === '正常' ? 'success' : 'warning'" size="small" effect="plain">{{
131
+ <el-tag :type="isNormalStatus(item.status) ? 'success' : 'warning'" size="small" effect="plain">{{
132
132
  item.statusLabel
133
133
  }}</el-tag>
134
134
  </div>
@@ -199,12 +199,7 @@
199
199
  <strong>{{ metric.percentageLabel }}</strong>
200
200
  </span>
201
201
  </div>
202
- <el-progress
203
- :percentage="metric.percentage"
204
- :show-text="false"
205
- :stroke-width="10"
206
- :color="metric.color"
207
- />
202
+ <el-progress :percentage="metric.percentage" :show-text="false" :stroke-width="10" :color="metric.color" />
208
203
  </div>
209
204
  </div>
210
205
  </div>
@@ -362,11 +357,17 @@ const alerts = ref<OpsAlertsResponse>();
362
357
  const windowMinutes = ref(15);
363
358
  const lastCollectedAt = ref("");
364
359
  const trendGridLines = [16, 62, 108, 154, 198];
365
- const nodeMetricLabelKeys: Record<string, string> = {
366
- 堆内存: "system.ops_monitoring.node_metric.heap_memory",
367
- 内存: "system.ops_monitoring.node_metric.memory",
368
- 硬盘: "system.ops_monitoring.node_metric.disk"
369
- };
360
+ const monitoringStatusKeys = [
361
+ "system.ops_monitoring.status.normal",
362
+ "system.ops_monitoring.status.unconfigured",
363
+ "system.ops_monitoring.status.error",
364
+ "system.ops_monitoring.status.attention"
365
+ ] as const;
366
+ const nodeMetricLabelKeys = [
367
+ "system.ops_monitoring.node_metric.heap_memory",
368
+ "system.ops_monitoring.node_metric.memory",
369
+ "system.ops_monitoring.node_metric.disk"
370
+ ] as const;
370
371
  const byteUnits = ["B", "KB", "MB", "GB", "TB", "PB"];
371
372
  const trafficSummary = computed(() => traffic.value?.traffic);
372
373
 
@@ -454,7 +455,7 @@ const availabilityItems = computed<AvailabilityItem[]>(() =>
454
455
  (services.value?.services ?? []).map(service => ({
455
456
  label: service.name,
456
457
  value: translateStatus(service.status),
457
- tone: service.status === "正常" ? "ok" : "warn"
458
+ tone: isNormalStatus(service.status) ? "ok" : "warn"
458
459
  }))
459
460
  );
460
461
 
@@ -580,17 +581,20 @@ function formatRelativeTime(value?: string) {
580
581
  }
581
582
 
582
583
  function translateStatus(status?: string) {
583
- if (status === "正常") return t("system.ops_monitoring.status.normal");
584
- if (status === "未配置") return t("system.ops_monitoring.status.unconfigured");
585
- if (status === "异常") return t("system.ops_monitoring.status.error");
586
- if (status === "关注") return t("system.ops_monitoring.status.attention");
584
+ const localeKey = monitoringStatusKeys.find(key => t(key) === status);
585
+ if (localeKey) return t(localeKey);
587
586
  return status || t("system.ops_monitoring.unknown");
588
587
  }
589
588
 
589
+ /** 判断监控状态是否为当前语言下的正常状态。 */
590
+ function isNormalStatus(status?: string) {
591
+ return status === t("system.ops_monitoring.status.normal");
592
+ }
593
+
590
594
  function mapStorage(item: OpsStorage) {
591
595
  return {
592
596
  ...item,
593
- color: item.status === "正常" ? "var(--el-color-success)" : "var(--el-color-warning)",
597
+ color: isNormalStatus(item.status) ? "var(--el-color-success)" : "var(--el-color-warning)",
594
598
  statusLabel: translateStatus(item.status),
595
599
  shortName: item.short_name || item.name,
596
600
  capacityLabel: item.capacity_label || t("system.ops_monitoring.capacity"),
@@ -606,7 +610,7 @@ function mapEndpoint(endpoint: OpsEndpoint): EndpointItem {
606
610
  latency: `${formatNumber(endpoint.p95_latency_ms)} ms`,
607
611
  errorRate: `${formatNumber(endpoint.error_rate)}%`,
608
612
  status: translateStatus(endpoint.status),
609
- healthy: endpoint.status === "正常"
613
+ healthy: isNormalStatus(endpoint.status)
610
614
  };
611
615
  }
612
616
 
@@ -649,7 +653,7 @@ function formatFixedNumber(value: number) {
649
653
 
650
654
  /** 翻译实例资源指标名称,未知指标保留后端原值。 */
651
655
  function translateNodeMetricLabel(label: string) {
652
- const localeKey = nodeMetricLabelKeys[label];
656
+ const localeKey = nodeMetricLabelKeys.find(key => t(key) === label);
653
657
  return localeKey ? t(localeKey) : label;
654
658
  }
655
659
 
@@ -658,7 +662,7 @@ function mapAlert(alert: OpsAlert) {
658
662
  title: alert.title,
659
663
  detail: alert.detail,
660
664
  at: alert.at,
661
- tone: alert.status === "正常" ? "ok" : "warn"
665
+ tone: isNormalStatus(alert.status) ? "ok" : "warn"
662
666
  };
663
667
  }
664
668
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liujitcn/kratos-admin-system",
3
3
  "private": false,
4
- "version": "0.0.29",
4
+ "version": "0.0.31",
5
5
  "type": "module",
6
6
  "description": "kratos-admin system management module",
7
7
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "sortablejs": "^1.15.2",
16
16
  "swagger-ui-dist": "^5.32.9",
17
17
  "vue-element-plus-x": "^2.0.3",
18
- "@liujitcn/kratos-admin-core": "0.0.29"
18
+ "@liujitcn/kratos-admin-core": "0.0.31"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@element-plus/icons-vue": "^2.3.1",
@@ -1,9 +0,0 @@
1
- import { type BaseLog, type BaseLogService, type GetBaseLogRequest, type PageBaseLogRequest, type PageBaseLogResponse } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
2
- /** Admin系统日志服务 */
3
- export declare class BaseLogServiceImpl implements BaseLogService {
4
- /** 查询系统日志分页列表 */
5
- PageBaseLog(request: PageBaseLogRequest): Promise<PageBaseLogResponse>;
6
- /** 查询系统日志 */
7
- GetBaseLog(request: GetBaseLogRequest): Promise<BaseLog>;
8
- }
9
- export declare const defBaseLogService: BaseLogServiceImpl;
@@ -1,87 +0,0 @@
1
- /** 日志分页查询条件 */
2
- export interface PageBaseLogRequest {
3
- /** 请求时间 */
4
- request_time: string[];
5
- /** 操作方法 */
6
- operation: string;
7
- /** 状态码 */
8
- status_code?: number | undefined;
9
- /** 当前页码 */
10
- page_num: number;
11
- /** 每一页的行数 */
12
- page_size: number;
13
- }
14
- /** 日志分页响应 */
15
- export interface PageBaseLogResponse {
16
- /** 分页数据 */
17
- base_logs: BaseLog[];
18
- /** 总数 */
19
- total: number;
20
- }
21
- /** 查询日志请求参数 */
22
- export interface GetBaseLogRequest {
23
- /** 日志ID */
24
- id: number;
25
- }
26
- /** 日志 */
27
- export interface BaseLog {
28
- /** 日志ID */
29
- id: number;
30
- /** 请求ID */
31
- request_id: string;
32
- /** 请求时间 */
33
- request_time: string;
34
- /** 请求方法 */
35
- method: string;
36
- /** 操作方法 */
37
- operation: string;
38
- /** 请求路径 */
39
- path: string;
40
- /** 请求源 */
41
- referer: string;
42
- /** 请求URI */
43
- request_uri: string;
44
- /** 请求体 */
45
- request_body: string;
46
- /** 请求头 */
47
- request_header: string;
48
- /** 响应信息 */
49
- response: string;
50
- /** 操作耗时 */
51
- cost_time: string;
52
- /** 操作是否成功 */
53
- is_success: boolean;
54
- /** 状态码 */
55
- status_code: number;
56
- /** 操作失败原因 */
57
- reason: string;
58
- /** 操作地理位置 */
59
- location: string;
60
- /** 操作者用户ID */
61
- user_id: number;
62
- /** 操作者账号名 */
63
- user_name: string;
64
- /** 操作者IP */
65
- client_ip: string;
66
- /** 浏览器的用户代理信息 */
67
- user_agent: string;
68
- /** 浏览器名称 */
69
- browser_name: string;
70
- /** 浏览器版本 */
71
- browser_version: string;
72
- /** 客户端ID */
73
- client_id: string;
74
- /** 客户端名称 */
75
- client_name: string;
76
- /** 操作系统名称 */
77
- os_name: string;
78
- /** 操作系统版本 */
79
- os_version: string;
80
- }
81
- /** Admin日志服务 */
82
- export interface BaseLogService {
83
- /** 查询日志分页列表 */
84
- PageBaseLog(request: PageBaseLogRequest): Promise<PageBaseLogResponse>;
85
- /** 查询日志 */
86
- GetBaseLog(request: GetBaseLogRequest): Promise<BaseLog>;
87
- }
@@ -1,32 +0,0 @@
1
- import service from "@liujitcn/kratos-admin-core/request";
2
- import {
3
- type BaseLog,
4
- type BaseLogService,
5
- type GetBaseLogRequest,
6
- type PageBaseLogRequest,
7
- type PageBaseLogResponse
8
- } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_log";
9
-
10
- const BASE_LOG_URL = "/v1/admin/base/log";
11
-
12
- /** Admin系统日志服务 */
13
- export class BaseLogServiceImpl implements BaseLogService {
14
- /** 查询系统日志分页列表 */
15
- PageBaseLog(request: PageBaseLogRequest): Promise<PageBaseLogResponse> {
16
- return service<PageBaseLogRequest, PageBaseLogResponse>({
17
- url: `${BASE_LOG_URL}`,
18
- method: "get",
19
- params: request
20
- });
21
- }
22
-
23
- /** 查询系统日志 */
24
- GetBaseLog(request: GetBaseLogRequest): Promise<BaseLog> {
25
- return service<GetBaseLogRequest, BaseLog>({
26
- url: `${BASE_LOG_URL}/${request.id}`,
27
- method: "get"
28
- });
29
- }
30
- }
31
-
32
- export const defBaseLogService = new BaseLogServiceImpl();
@@ -1,101 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.8
4
- // protoc unknown
5
- // source: system/admin/v1/base_log.proto
6
-
7
- /* eslint-disable */
8
-
9
- /** 日志分页查询条件 */
10
- export interface PageBaseLogRequest {
11
- /** 请求时间 */
12
- request_time: string[];
13
- /** 操作方法 */
14
- operation: string;
15
- /** 状态码 */
16
- status_code?:
17
- | number
18
- | undefined;
19
- /** 当前页码 */
20
- page_num: number;
21
- /** 每一页的行数 */
22
- page_size: number;
23
- }
24
-
25
- /** 日志分页响应 */
26
- export interface PageBaseLogResponse {
27
- /** 分页数据 */
28
- base_logs: BaseLog[];
29
- /** 总数 */
30
- total: number;
31
- }
32
-
33
- /** 查询日志请求参数 */
34
- export interface GetBaseLogRequest {
35
- /** 日志ID */
36
- id: number;
37
- }
38
-
39
- /** 日志 */
40
- export interface BaseLog {
41
- /** 日志ID */
42
- id: number;
43
- /** 请求ID */
44
- request_id: string;
45
- /** 请求时间 */
46
- request_time: string;
47
- /** 请求方法 */
48
- method: string;
49
- /** 操作方法 */
50
- operation: string;
51
- /** 请求路径 */
52
- path: string;
53
- /** 请求源 */
54
- referer: string;
55
- /** 请求URI */
56
- request_uri: string;
57
- /** 请求体 */
58
- request_body: string;
59
- /** 请求头 */
60
- request_header: string;
61
- /** 响应信息 */
62
- response: string;
63
- /** 操作耗时 */
64
- cost_time: string;
65
- /** 操作是否成功 */
66
- is_success: boolean;
67
- /** 状态码 */
68
- status_code: number;
69
- /** 操作失败原因 */
70
- reason: string;
71
- /** 操作地理位置 */
72
- location: string;
73
- /** 操作者用户ID */
74
- user_id: number;
75
- /** 操作者账号名 */
76
- user_name: string;
77
- /** 操作者IP */
78
- client_ip: string;
79
- /** 浏览器的用户代理信息 */
80
- user_agent: string;
81
- /** 浏览器名称 */
82
- browser_name: string;
83
- /** 浏览器版本 */
84
- browser_version: string;
85
- /** 客户端ID */
86
- client_id: string;
87
- /** 客户端名称 */
88
- client_name: string;
89
- /** 操作系统名称 */
90
- os_name: string;
91
- /** 操作系统版本 */
92
- os_version: string;
93
- }
94
-
95
- /** Admin日志服务 */
96
- export interface BaseLogService {
97
- /** 查询日志分页列表 */
98
- PageBaseLog(request: PageBaseLogRequest): Promise<PageBaseLogResponse>;
99
- /** 查询日志 */
100
- GetBaseLog(request: GetBaseLogRequest): Promise<BaseLog>;
101
- }