@liujitcn/kratos-admin-system 0.0.95 → 0.0.96
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.
- package/dist/package/declarations/src/api/system/admin/v1/mqtt_message.d.ts +10 -0
- package/dist/package/declarations/src/locales/generated.d.ts +68 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/mqtt_message.d.ts +121 -0
- package/dist/package/declarations/src/views/tool/mqtt-message/index.vue.d.ts +3 -0
- package/dist/package/src/api/system/admin/v1/mqtt_message.ts +33 -0
- package/dist/package/src/locales/en-US.json +17 -0
- package/dist/package/src/locales/ja-JP.json +17 -0
- package/dist/package/src/locales/zh-CN.json +17 -0
- package/dist/package/src/locales/zh-TW.json +17 -0
- package/dist/package/src/rpc/system/admin/v1/mqtt_message.ts +137 -0
- package/dist/package/src/views/tool/mqtt-message/index.vue +276 -0
- package/dist/package/src/views/tool/ops-monitoring/index.vue +4 -3
- package/package.json +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GetMqttMessageRequest, MqttMessageDetail, MqttMessageService, PageMqttMessageRequest, PageMqttMessageResponse } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/mqtt_message";
|
|
2
|
+
/** Admin MQTT 消息记录查询服务。 */
|
|
3
|
+
export declare class MqttMessageServiceImpl implements MqttMessageService {
|
|
4
|
+
/** 分页查询 MQTT 消息记录。 */
|
|
5
|
+
PageMqttMessage(request: PageMqttMessageRequest): Promise<PageMqttMessageResponse>;
|
|
6
|
+
/** 查询 MQTT 消息记录详情。 */
|
|
7
|
+
GetMqttMessage(request: GetMqttMessageRequest): Promise<MqttMessageDetail>;
|
|
8
|
+
}
|
|
9
|
+
/** 默认 MQTT 消息记录查询服务。 */
|
|
10
|
+
export declare const defMqttMessageService: MqttMessageServiceImpl;
|
|
@@ -1771,6 +1771,23 @@ export declare const LOCALE_MESSAGES: {
|
|
|
1771
1771
|
"system.runtime.log.value.entry_count": string;
|
|
1772
1772
|
"system.runtime.log.value.instance": string;
|
|
1773
1773
|
"system.runtime.log.value.live_console": string;
|
|
1774
|
+
"system.mqtt_message.direction.publish": string;
|
|
1775
|
+
"system.mqtt_message.direction.subscribe": string;
|
|
1776
|
+
"system.mqtt_message.field.created_at": string;
|
|
1777
|
+
"system.mqtt_message.field.direction": string;
|
|
1778
|
+
"system.mqtt_message.field.error": string;
|
|
1779
|
+
"system.mqtt_message.field.format": string;
|
|
1780
|
+
"system.mqtt_message.field.handled_at": string;
|
|
1781
|
+
"system.mqtt_message.field.id": string;
|
|
1782
|
+
"system.mqtt_message.field.latency": string;
|
|
1783
|
+
"system.mqtt_message.field.message_id": string;
|
|
1784
|
+
"system.mqtt_message.field.payload_json": string;
|
|
1785
|
+
"system.mqtt_message.field.payload_raw": string;
|
|
1786
|
+
"system.mqtt_message.field.qos": string;
|
|
1787
|
+
"system.mqtt_message.field.size": string;
|
|
1788
|
+
"system.mqtt_message.field.status": string;
|
|
1789
|
+
"system.mqtt_message.field.topic": string;
|
|
1790
|
+
"system.mqtt_message.title.detail": string;
|
|
1774
1791
|
"system.sse.error.auth_expired": string;
|
|
1775
1792
|
"system.sse.error.connection_closed": string;
|
|
1776
1793
|
"system.sse.error.connection_failed": string;
|
|
@@ -3547,6 +3564,23 @@ export declare const LOCALE_MESSAGES: {
|
|
|
3547
3564
|
"system.runtime.log.value.entry_count": string;
|
|
3548
3565
|
"system.runtime.log.value.instance": string;
|
|
3549
3566
|
"system.runtime.log.value.live_console": string;
|
|
3567
|
+
"system.mqtt_message.direction.publish": string;
|
|
3568
|
+
"system.mqtt_message.direction.subscribe": string;
|
|
3569
|
+
"system.mqtt_message.field.created_at": string;
|
|
3570
|
+
"system.mqtt_message.field.direction": string;
|
|
3571
|
+
"system.mqtt_message.field.error": string;
|
|
3572
|
+
"system.mqtt_message.field.format": string;
|
|
3573
|
+
"system.mqtt_message.field.handled_at": string;
|
|
3574
|
+
"system.mqtt_message.field.id": string;
|
|
3575
|
+
"system.mqtt_message.field.latency": string;
|
|
3576
|
+
"system.mqtt_message.field.message_id": string;
|
|
3577
|
+
"system.mqtt_message.field.payload_json": string;
|
|
3578
|
+
"system.mqtt_message.field.payload_raw": string;
|
|
3579
|
+
"system.mqtt_message.field.qos": string;
|
|
3580
|
+
"system.mqtt_message.field.size": string;
|
|
3581
|
+
"system.mqtt_message.field.status": string;
|
|
3582
|
+
"system.mqtt_message.field.topic": string;
|
|
3583
|
+
"system.mqtt_message.title.detail": string;
|
|
3550
3584
|
"system.sse.error.auth_expired": string;
|
|
3551
3585
|
"system.sse.error.connection_closed": string;
|
|
3552
3586
|
"system.sse.error.connection_failed": string;
|
|
@@ -5323,6 +5357,23 @@ export declare const LOCALE_MESSAGES: {
|
|
|
5323
5357
|
"system.runtime.log.value.entry_count": string;
|
|
5324
5358
|
"system.runtime.log.value.instance": string;
|
|
5325
5359
|
"system.runtime.log.value.live_console": string;
|
|
5360
|
+
"system.mqtt_message.direction.publish": string;
|
|
5361
|
+
"system.mqtt_message.direction.subscribe": string;
|
|
5362
|
+
"system.mqtt_message.field.created_at": string;
|
|
5363
|
+
"system.mqtt_message.field.direction": string;
|
|
5364
|
+
"system.mqtt_message.field.error": string;
|
|
5365
|
+
"system.mqtt_message.field.format": string;
|
|
5366
|
+
"system.mqtt_message.field.handled_at": string;
|
|
5367
|
+
"system.mqtt_message.field.id": string;
|
|
5368
|
+
"system.mqtt_message.field.latency": string;
|
|
5369
|
+
"system.mqtt_message.field.message_id": string;
|
|
5370
|
+
"system.mqtt_message.field.payload_json": string;
|
|
5371
|
+
"system.mqtt_message.field.payload_raw": string;
|
|
5372
|
+
"system.mqtt_message.field.qos": string;
|
|
5373
|
+
"system.mqtt_message.field.size": string;
|
|
5374
|
+
"system.mqtt_message.field.status": string;
|
|
5375
|
+
"system.mqtt_message.field.topic": string;
|
|
5376
|
+
"system.mqtt_message.title.detail": string;
|
|
5326
5377
|
"system.sse.error.auth_expired": string;
|
|
5327
5378
|
"system.sse.error.connection_closed": string;
|
|
5328
5379
|
"system.sse.error.connection_failed": string;
|
|
@@ -7099,6 +7150,23 @@ export declare const LOCALE_MESSAGES: {
|
|
|
7099
7150
|
"system.runtime.log.value.entry_count": string;
|
|
7100
7151
|
"system.runtime.log.value.instance": string;
|
|
7101
7152
|
"system.runtime.log.value.live_console": string;
|
|
7153
|
+
"system.mqtt_message.direction.publish": string;
|
|
7154
|
+
"system.mqtt_message.direction.subscribe": string;
|
|
7155
|
+
"system.mqtt_message.field.created_at": string;
|
|
7156
|
+
"system.mqtt_message.field.direction": string;
|
|
7157
|
+
"system.mqtt_message.field.error": string;
|
|
7158
|
+
"system.mqtt_message.field.format": string;
|
|
7159
|
+
"system.mqtt_message.field.handled_at": string;
|
|
7160
|
+
"system.mqtt_message.field.id": string;
|
|
7161
|
+
"system.mqtt_message.field.latency": string;
|
|
7162
|
+
"system.mqtt_message.field.message_id": string;
|
|
7163
|
+
"system.mqtt_message.field.payload_json": string;
|
|
7164
|
+
"system.mqtt_message.field.payload_raw": string;
|
|
7165
|
+
"system.mqtt_message.field.qos": string;
|
|
7166
|
+
"system.mqtt_message.field.size": string;
|
|
7167
|
+
"system.mqtt_message.field.status": string;
|
|
7168
|
+
"system.mqtt_message.field.topic": string;
|
|
7169
|
+
"system.mqtt_message.title.detail": string;
|
|
7102
7170
|
"system.sse.error.auth_expired": string;
|
|
7103
7171
|
"system.sse.error.connection_closed": string;
|
|
7104
7172
|
"system.sse.error.connection_failed": string;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/** MQTT 消息方向枚举;字典编码为 mqtt_message_direction。 */
|
|
2
|
+
export declare enum MqttMessageDirection {
|
|
3
|
+
/** MQTT_MESSAGE_DIRECTION_UNSPECIFIED - 未指定消息方向。 */
|
|
4
|
+
MQTT_MESSAGE_DIRECTION_UNSPECIFIED = 0,
|
|
5
|
+
/** MQTT_MESSAGE_DIRECTION_PUBLISH - Admin 向 Broker 发布消息。 */
|
|
6
|
+
MQTT_MESSAGE_DIRECTION_PUBLISH = 1,
|
|
7
|
+
/** MQTT_MESSAGE_DIRECTION_SUBSCRIBE - Admin 从 Broker 订阅接收消息。 */
|
|
8
|
+
MQTT_MESSAGE_DIRECTION_SUBSCRIBE = 2
|
|
9
|
+
}
|
|
10
|
+
/** MQTT Payload 格式枚举;字典编码为 mqtt_message_payload_format。 */
|
|
11
|
+
export declare enum MqttMessagePayloadFormat {
|
|
12
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_UNSPECIFIED - 未指定 Payload 格式。 */
|
|
13
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_UNSPECIFIED = 0,
|
|
14
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_JSON - JSON 格式。 */
|
|
15
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_JSON = 1,
|
|
16
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_TEXT - UTF-8 文本格式。 */
|
|
17
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_TEXT = 2,
|
|
18
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_BINARY - 二进制格式。 */
|
|
19
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_BINARY = 3
|
|
20
|
+
}
|
|
21
|
+
/** MQTT 消息处理状态枚举;字典编码为 mqtt_message_status。 */
|
|
22
|
+
export declare enum MqttMessageStatus {
|
|
23
|
+
/** MQTT_MESSAGE_STATUS_UNSPECIFIED - 未指定处理状态。 */
|
|
24
|
+
MQTT_MESSAGE_STATUS_UNSPECIFIED = 0,
|
|
25
|
+
/** MQTT_MESSAGE_STATUS_SENT - 发布消息已得到 Broker 确认。 */
|
|
26
|
+
MQTT_MESSAGE_STATUS_SENT = 1,
|
|
27
|
+
/** MQTT_MESSAGE_STATUS_HANDLED - 订阅消息已处理。 */
|
|
28
|
+
MQTT_MESSAGE_STATUS_HANDLED = 2,
|
|
29
|
+
/** MQTT_MESSAGE_STATUS_FAILED - 发布或订阅处理失败。 */
|
|
30
|
+
MQTT_MESSAGE_STATUS_FAILED = 3
|
|
31
|
+
}
|
|
32
|
+
/** MQTT 消息分页查询条件。 */
|
|
33
|
+
export interface PageMqttMessageRequest {
|
|
34
|
+
/** 消息方向 */
|
|
35
|
+
direction: MqttMessageDirection;
|
|
36
|
+
/** MQTT主题 */
|
|
37
|
+
topic: string;
|
|
38
|
+
/** 处理状态 */
|
|
39
|
+
status: MqttMessageStatus;
|
|
40
|
+
/** 消息格式 */
|
|
41
|
+
payload_format: MqttMessagePayloadFormat;
|
|
42
|
+
/** 当前页码 */
|
|
43
|
+
page_num: number;
|
|
44
|
+
/** 每页数量 */
|
|
45
|
+
page_size: number;
|
|
46
|
+
}
|
|
47
|
+
/** MQTT 消息分页响应。 */
|
|
48
|
+
export interface PageMqttMessageResponse {
|
|
49
|
+
/** 消息记录列表 */
|
|
50
|
+
mqtt_messages: MqttMessageSummary[];
|
|
51
|
+
/** 总数 */
|
|
52
|
+
total: number;
|
|
53
|
+
}
|
|
54
|
+
/** MQTT 消息详情查询条件。 */
|
|
55
|
+
export interface GetMqttMessageRequest {
|
|
56
|
+
/** 消息记录ID */
|
|
57
|
+
id: number;
|
|
58
|
+
}
|
|
59
|
+
/** MQTT 消息记录摘要。 */
|
|
60
|
+
export interface MqttMessageSummary {
|
|
61
|
+
/** 消息记录ID */
|
|
62
|
+
id: number;
|
|
63
|
+
/** 消息方向 */
|
|
64
|
+
direction: MqttMessageDirection;
|
|
65
|
+
/** MQTT主题 */
|
|
66
|
+
topic: string;
|
|
67
|
+
/** 消息大小,单位字节 */
|
|
68
|
+
payload_size: number;
|
|
69
|
+
/** 消息格式 */
|
|
70
|
+
payload_format: MqttMessagePayloadFormat;
|
|
71
|
+
/** MQTT QoS */
|
|
72
|
+
qos: number;
|
|
73
|
+
/** 处理状态 */
|
|
74
|
+
status: MqttMessageStatus;
|
|
75
|
+
/** 处理耗时,单位毫秒 */
|
|
76
|
+
latency_ms: number;
|
|
77
|
+
/** 创建时间 */
|
|
78
|
+
created_at: string;
|
|
79
|
+
}
|
|
80
|
+
/** MQTT 消息记录详情。 */
|
|
81
|
+
export interface MqttMessageDetail {
|
|
82
|
+
/** 消息记录ID */
|
|
83
|
+
id: number;
|
|
84
|
+
/** 消息方向 */
|
|
85
|
+
direction: MqttMessageDirection;
|
|
86
|
+
/** MQTT主题 */
|
|
87
|
+
topic: string;
|
|
88
|
+
/** 原始消息内容 */
|
|
89
|
+
payload_raw: Uint8Array;
|
|
90
|
+
/** 解析后的JSON内容 */
|
|
91
|
+
payload_json: string;
|
|
92
|
+
/** 消息大小,单位字节 */
|
|
93
|
+
payload_size: number;
|
|
94
|
+
/** 消息格式 */
|
|
95
|
+
payload_format: MqttMessagePayloadFormat;
|
|
96
|
+
/** MQTT QoS */
|
|
97
|
+
qos: number;
|
|
98
|
+
/** 是否为保留消息 */
|
|
99
|
+
retained: boolean;
|
|
100
|
+
/** 是否为重复消息 */
|
|
101
|
+
duplicate: boolean;
|
|
102
|
+
/** MQTT或业务消息ID */
|
|
103
|
+
message_id: string;
|
|
104
|
+
/** 处理状态 */
|
|
105
|
+
status: MqttMessageStatus;
|
|
106
|
+
/** 错误信息 */
|
|
107
|
+
error_message: string;
|
|
108
|
+
/** 处理耗时,单位毫秒 */
|
|
109
|
+
latency_ms: number;
|
|
110
|
+
/** 创建时间 */
|
|
111
|
+
created_at: string;
|
|
112
|
+
/** 处理完成时间 */
|
|
113
|
+
handled_at: string;
|
|
114
|
+
}
|
|
115
|
+
/** Admin MQTT 消息记录查询服务。 */
|
|
116
|
+
export interface MqttMessageService {
|
|
117
|
+
/** 分页查询 MQTT 消息记录。 */
|
|
118
|
+
PageMqttMessage(request: PageMqttMessageRequest): Promise<PageMqttMessageResponse>;
|
|
119
|
+
/** 查询 MQTT 消息记录详情。 */
|
|
120
|
+
GetMqttMessage(request: GetMqttMessageRequest): Promise<MqttMessageDetail>;
|
|
121
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import service from "@liujitcn/kratos-admin-core/request";
|
|
2
|
+
import type {
|
|
3
|
+
GetMqttMessageRequest,
|
|
4
|
+
MqttMessageDetail,
|
|
5
|
+
MqttMessageService,
|
|
6
|
+
PageMqttMessageRequest,
|
|
7
|
+
PageMqttMessageResponse
|
|
8
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/mqtt_message";
|
|
9
|
+
|
|
10
|
+
const MQTT_MESSAGE_URL = "/v1/admin/mqtt-message";
|
|
11
|
+
|
|
12
|
+
/** Admin MQTT 消息记录查询服务。 */
|
|
13
|
+
export class MqttMessageServiceImpl implements MqttMessageService {
|
|
14
|
+
/** 分页查询 MQTT 消息记录。 */
|
|
15
|
+
PageMqttMessage(request: PageMqttMessageRequest): Promise<PageMqttMessageResponse> {
|
|
16
|
+
return service<PageMqttMessageRequest, PageMqttMessageResponse>({
|
|
17
|
+
url: MQTT_MESSAGE_URL,
|
|
18
|
+
method: "get",
|
|
19
|
+
params: request
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 查询 MQTT 消息记录详情。 */
|
|
24
|
+
GetMqttMessage(request: GetMqttMessageRequest): Promise<MqttMessageDetail> {
|
|
25
|
+
return service<GetMqttMessageRequest, MqttMessageDetail>({
|
|
26
|
+
url: `${MQTT_MESSAGE_URL}/${request.id}`,
|
|
27
|
+
method: "get"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 默认 MQTT 消息记录查询服务。 */
|
|
33
|
+
export const defMqttMessageService = new MqttMessageServiceImpl();
|
|
@@ -1770,6 +1770,23 @@
|
|
|
1770
1770
|
"system.runtime.log.value.entry_count": "{count} entries",
|
|
1771
1771
|
"system.runtime.log.value.instance": "Instance {id}",
|
|
1772
1772
|
"system.runtime.log.value.live_console": "Live console",
|
|
1773
|
+
"system.mqtt_message.direction.publish": "Publish",
|
|
1774
|
+
"system.mqtt_message.direction.subscribe": "Subscribe",
|
|
1775
|
+
"system.mqtt_message.field.created_at": "Recorded at",
|
|
1776
|
+
"system.mqtt_message.field.direction": "Direction",
|
|
1777
|
+
"system.mqtt_message.field.error": "Error",
|
|
1778
|
+
"system.mqtt_message.field.format": "Format",
|
|
1779
|
+
"system.mqtt_message.field.handled_at": "Handled at",
|
|
1780
|
+
"system.mqtt_message.field.id": "Record ID",
|
|
1781
|
+
"system.mqtt_message.field.latency": "Latency (ms)",
|
|
1782
|
+
"system.mqtt_message.field.message_id": "Message ID",
|
|
1783
|
+
"system.mqtt_message.field.payload_json": "Payload",
|
|
1784
|
+
"system.mqtt_message.field.payload_raw": "Raw Payload",
|
|
1785
|
+
"system.mqtt_message.field.qos": "QoS",
|
|
1786
|
+
"system.mqtt_message.field.size": "Size",
|
|
1787
|
+
"system.mqtt_message.field.status": "Status",
|
|
1788
|
+
"system.mqtt_message.field.topic": "Topic",
|
|
1789
|
+
"system.mqtt_message.title.detail": "MQTT message details",
|
|
1773
1790
|
"system.sse.error.auth_expired": "SSE authentication has expired",
|
|
1774
1791
|
"system.sse.error.connection_closed": "SSE connection closed",
|
|
1775
1792
|
"system.sse.error.connection_failed": "SSE connection failed: {status}"
|
|
@@ -1770,6 +1770,23 @@
|
|
|
1770
1770
|
"system.runtime.log.value.entry_count": "{count} 件",
|
|
1771
1771
|
"system.runtime.log.value.instance": "インスタンス {id}",
|
|
1772
1772
|
"system.runtime.log.value.live_console": "リアルタイムコンソール",
|
|
1773
|
+
"system.mqtt_message.direction.publish": "発行",
|
|
1774
|
+
"system.mqtt_message.direction.subscribe": "購読",
|
|
1775
|
+
"system.mqtt_message.field.created_at": "記録日時",
|
|
1776
|
+
"system.mqtt_message.field.direction": "方向",
|
|
1777
|
+
"system.mqtt_message.field.error": "エラー",
|
|
1778
|
+
"system.mqtt_message.field.format": "形式",
|
|
1779
|
+
"system.mqtt_message.field.handled_at": "処理完了日時",
|
|
1780
|
+
"system.mqtt_message.field.id": "記録ID",
|
|
1781
|
+
"system.mqtt_message.field.latency": "処理時間(ミリ秒)",
|
|
1782
|
+
"system.mqtt_message.field.message_id": "メッセージID",
|
|
1783
|
+
"system.mqtt_message.field.payload_json": "メッセージ内容",
|
|
1784
|
+
"system.mqtt_message.field.payload_raw": "元の Payload",
|
|
1785
|
+
"system.mqtt_message.field.qos": "QoS",
|
|
1786
|
+
"system.mqtt_message.field.size": "サイズ",
|
|
1787
|
+
"system.mqtt_message.field.status": "状態",
|
|
1788
|
+
"system.mqtt_message.field.topic": "トピック",
|
|
1789
|
+
"system.mqtt_message.title.detail": "MQTTメッセージ詳細",
|
|
1773
1790
|
"system.sse.error.auth_expired": "SSE 認証の有効期限が切れました",
|
|
1774
1791
|
"system.sse.error.connection_closed": "SSE 接続が閉じられました",
|
|
1775
1792
|
"system.sse.error.connection_failed": "SSE 接続に失敗しました: {status}"
|
|
@@ -1770,6 +1770,23 @@
|
|
|
1770
1770
|
"system.runtime.log.value.entry_count": "{count} 条",
|
|
1771
1771
|
"system.runtime.log.value.instance": "实例 {id}",
|
|
1772
1772
|
"system.runtime.log.value.live_console": "实时控制台",
|
|
1773
|
+
"system.mqtt_message.direction.publish": "发布",
|
|
1774
|
+
"system.mqtt_message.direction.subscribe": "订阅",
|
|
1775
|
+
"system.mqtt_message.field.created_at": "记录时间",
|
|
1776
|
+
"system.mqtt_message.field.direction": "方向",
|
|
1777
|
+
"system.mqtt_message.field.error": "错误信息",
|
|
1778
|
+
"system.mqtt_message.field.format": "格式",
|
|
1779
|
+
"system.mqtt_message.field.handled_at": "处理完成时间",
|
|
1780
|
+
"system.mqtt_message.field.id": "记录ID",
|
|
1781
|
+
"system.mqtt_message.field.latency": "耗时(毫秒)",
|
|
1782
|
+
"system.mqtt_message.field.message_id": "消息ID",
|
|
1783
|
+
"system.mqtt_message.field.payload_json": "消息内容",
|
|
1784
|
+
"system.mqtt_message.field.payload_raw": "原始 Payload",
|
|
1785
|
+
"system.mqtt_message.field.qos": "QoS",
|
|
1786
|
+
"system.mqtt_message.field.size": "大小",
|
|
1787
|
+
"system.mqtt_message.field.status": "状态",
|
|
1788
|
+
"system.mqtt_message.field.topic": "主题",
|
|
1789
|
+
"system.mqtt_message.title.detail": "MQTT消息详情",
|
|
1773
1790
|
"system.sse.error.auth_expired": "SSE 认证已失效",
|
|
1774
1791
|
"system.sse.error.connection_closed": "SSE 连接已关闭",
|
|
1775
1792
|
"system.sse.error.connection_failed": "SSE 连接失败:{status}"
|
|
@@ -1770,6 +1770,23 @@
|
|
|
1770
1770
|
"system.runtime.log.value.entry_count": "{count} 筆",
|
|
1771
1771
|
"system.runtime.log.value.instance": "執行個體 {id}",
|
|
1772
1772
|
"system.runtime.log.value.live_console": "即時主控台",
|
|
1773
|
+
"system.mqtt_message.direction.publish": "發布",
|
|
1774
|
+
"system.mqtt_message.direction.subscribe": "訂閱",
|
|
1775
|
+
"system.mqtt_message.field.created_at": "記錄時間",
|
|
1776
|
+
"system.mqtt_message.field.direction": "方向",
|
|
1777
|
+
"system.mqtt_message.field.error": "錯誤訊息",
|
|
1778
|
+
"system.mqtt_message.field.format": "格式",
|
|
1779
|
+
"system.mqtt_message.field.handled_at": "處理完成時間",
|
|
1780
|
+
"system.mqtt_message.field.id": "記錄ID",
|
|
1781
|
+
"system.mqtt_message.field.latency": "耗時(毫秒)",
|
|
1782
|
+
"system.mqtt_message.field.message_id": "訊息ID",
|
|
1783
|
+
"system.mqtt_message.field.payload_json": "訊息內容",
|
|
1784
|
+
"system.mqtt_message.field.payload_raw": "原始 Payload",
|
|
1785
|
+
"system.mqtt_message.field.qos": "QoS",
|
|
1786
|
+
"system.mqtt_message.field.size": "大小",
|
|
1787
|
+
"system.mqtt_message.field.status": "狀態",
|
|
1788
|
+
"system.mqtt_message.field.topic": "主題",
|
|
1789
|
+
"system.mqtt_message.title.detail": "MQTT訊息詳情",
|
|
1773
1790
|
"system.sse.error.auth_expired": "SSE 驗證已失效",
|
|
1774
1791
|
"system.sse.error.connection_closed": "SSE 連線已關閉",
|
|
1775
1792
|
"system.sse.error.connection_failed": "SSE 連線失敗:{status}"
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.12.1
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: system/admin/v1/mqtt_message.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
/** MQTT 消息方向枚举;字典编码为 mqtt_message_direction。 */
|
|
10
|
+
export enum MqttMessageDirection {
|
|
11
|
+
/** MQTT_MESSAGE_DIRECTION_UNSPECIFIED - 未指定消息方向。 */
|
|
12
|
+
MQTT_MESSAGE_DIRECTION_UNSPECIFIED = 0,
|
|
13
|
+
/** MQTT_MESSAGE_DIRECTION_PUBLISH - Admin 向 Broker 发布消息。 */
|
|
14
|
+
MQTT_MESSAGE_DIRECTION_PUBLISH = 1,
|
|
15
|
+
/** MQTT_MESSAGE_DIRECTION_SUBSCRIBE - Admin 从 Broker 订阅接收消息。 */
|
|
16
|
+
MQTT_MESSAGE_DIRECTION_SUBSCRIBE = 2,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** MQTT Payload 格式枚举;字典编码为 mqtt_message_payload_format。 */
|
|
20
|
+
export enum MqttMessagePayloadFormat {
|
|
21
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_UNSPECIFIED - 未指定 Payload 格式。 */
|
|
22
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_UNSPECIFIED = 0,
|
|
23
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_JSON - JSON 格式。 */
|
|
24
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_JSON = 1,
|
|
25
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_TEXT - UTF-8 文本格式。 */
|
|
26
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_TEXT = 2,
|
|
27
|
+
/** MQTT_MESSAGE_PAYLOAD_FORMAT_BINARY - 二进制格式。 */
|
|
28
|
+
MQTT_MESSAGE_PAYLOAD_FORMAT_BINARY = 3,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** MQTT 消息处理状态枚举;字典编码为 mqtt_message_status。 */
|
|
32
|
+
export enum MqttMessageStatus {
|
|
33
|
+
/** MQTT_MESSAGE_STATUS_UNSPECIFIED - 未指定处理状态。 */
|
|
34
|
+
MQTT_MESSAGE_STATUS_UNSPECIFIED = 0,
|
|
35
|
+
/** MQTT_MESSAGE_STATUS_SENT - 发布消息已得到 Broker 确认。 */
|
|
36
|
+
MQTT_MESSAGE_STATUS_SENT = 1,
|
|
37
|
+
/** MQTT_MESSAGE_STATUS_HANDLED - 订阅消息已处理。 */
|
|
38
|
+
MQTT_MESSAGE_STATUS_HANDLED = 2,
|
|
39
|
+
/** MQTT_MESSAGE_STATUS_FAILED - 发布或订阅处理失败。 */
|
|
40
|
+
MQTT_MESSAGE_STATUS_FAILED = 3,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** MQTT 消息分页查询条件。 */
|
|
44
|
+
export interface PageMqttMessageRequest {
|
|
45
|
+
/** 消息方向 */
|
|
46
|
+
direction: MqttMessageDirection;
|
|
47
|
+
/** MQTT主题 */
|
|
48
|
+
topic: string;
|
|
49
|
+
/** 处理状态 */
|
|
50
|
+
status: MqttMessageStatus;
|
|
51
|
+
/** 消息格式 */
|
|
52
|
+
payload_format: MqttMessagePayloadFormat;
|
|
53
|
+
/** 当前页码 */
|
|
54
|
+
page_num: number;
|
|
55
|
+
/** 每页数量 */
|
|
56
|
+
page_size: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** MQTT 消息分页响应。 */
|
|
60
|
+
export interface PageMqttMessageResponse {
|
|
61
|
+
/** 消息记录列表 */
|
|
62
|
+
mqtt_messages: MqttMessageSummary[];
|
|
63
|
+
/** 总数 */
|
|
64
|
+
total: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** MQTT 消息详情查询条件。 */
|
|
68
|
+
export interface GetMqttMessageRequest {
|
|
69
|
+
/** 消息记录ID */
|
|
70
|
+
id: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** MQTT 消息记录摘要。 */
|
|
74
|
+
export interface MqttMessageSummary {
|
|
75
|
+
/** 消息记录ID */
|
|
76
|
+
id: number;
|
|
77
|
+
/** 消息方向 */
|
|
78
|
+
direction: MqttMessageDirection;
|
|
79
|
+
/** MQTT主题 */
|
|
80
|
+
topic: string;
|
|
81
|
+
/** 消息大小,单位字节 */
|
|
82
|
+
payload_size: number;
|
|
83
|
+
/** 消息格式 */
|
|
84
|
+
payload_format: MqttMessagePayloadFormat;
|
|
85
|
+
/** MQTT QoS */
|
|
86
|
+
qos: number;
|
|
87
|
+
/** 处理状态 */
|
|
88
|
+
status: MqttMessageStatus;
|
|
89
|
+
/** 处理耗时,单位毫秒 */
|
|
90
|
+
latency_ms: number;
|
|
91
|
+
/** 创建时间 */
|
|
92
|
+
created_at: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** MQTT 消息记录详情。 */
|
|
96
|
+
export interface MqttMessageDetail {
|
|
97
|
+
/** 消息记录ID */
|
|
98
|
+
id: number;
|
|
99
|
+
/** 消息方向 */
|
|
100
|
+
direction: MqttMessageDirection;
|
|
101
|
+
/** MQTT主题 */
|
|
102
|
+
topic: string;
|
|
103
|
+
/** 原始消息内容 */
|
|
104
|
+
payload_raw: Uint8Array;
|
|
105
|
+
/** 解析后的JSON内容 */
|
|
106
|
+
payload_json: string;
|
|
107
|
+
/** 消息大小,单位字节 */
|
|
108
|
+
payload_size: number;
|
|
109
|
+
/** 消息格式 */
|
|
110
|
+
payload_format: MqttMessagePayloadFormat;
|
|
111
|
+
/** MQTT QoS */
|
|
112
|
+
qos: number;
|
|
113
|
+
/** 是否为保留消息 */
|
|
114
|
+
retained: boolean;
|
|
115
|
+
/** 是否为重复消息 */
|
|
116
|
+
duplicate: boolean;
|
|
117
|
+
/** MQTT或业务消息ID */
|
|
118
|
+
message_id: string;
|
|
119
|
+
/** 处理状态 */
|
|
120
|
+
status: MqttMessageStatus;
|
|
121
|
+
/** 错误信息 */
|
|
122
|
+
error_message: string;
|
|
123
|
+
/** 处理耗时,单位毫秒 */
|
|
124
|
+
latency_ms: number;
|
|
125
|
+
/** 创建时间 */
|
|
126
|
+
created_at: string;
|
|
127
|
+
/** 处理完成时间 */
|
|
128
|
+
handled_at: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Admin MQTT 消息记录查询服务。 */
|
|
132
|
+
export interface MqttMessageService {
|
|
133
|
+
/** 分页查询 MQTT 消息记录。 */
|
|
134
|
+
PageMqttMessage(request: PageMqttMessageRequest): Promise<PageMqttMessageResponse>;
|
|
135
|
+
/** 查询 MQTT 消息记录详情。 */
|
|
136
|
+
GetMqttMessage(request: GetMqttMessageRequest): Promise<MqttMessageDetail>;
|
|
137
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-box mqtt-message-page">
|
|
3
|
+
<ProTable ref="proTable" row-key="id" :columns="columns" :request-api="requestTable" />
|
|
4
|
+
|
|
5
|
+
<ProDialog
|
|
6
|
+
v-model="detail.visible"
|
|
7
|
+
:title="t('system.mqtt_message.title.detail')"
|
|
8
|
+
width="min(960px, calc(100vw - 32px))"
|
|
9
|
+
destroy-on-close
|
|
10
|
+
:show-footer="false"
|
|
11
|
+
>
|
|
12
|
+
<template v-if="detail.item">
|
|
13
|
+
<el-descriptions :column="2" border>
|
|
14
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.id')">{{ detail.item.id }}</el-descriptions-item>
|
|
15
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.direction')">
|
|
16
|
+
<el-tag size="small" effect="plain">{{ directionLabel(detail.item.direction) }}</el-tag>
|
|
17
|
+
</el-descriptions-item>
|
|
18
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.topic')" :span="2">
|
|
19
|
+
<code>{{ detail.item.topic }}</code>
|
|
20
|
+
</el-descriptions-item>
|
|
21
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.format')">
|
|
22
|
+
{{ payloadFormatLabel(detail.item.payload_format) }}
|
|
23
|
+
</el-descriptions-item>
|
|
24
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.status')">
|
|
25
|
+
{{ statusLabel(detail.item.status) }}
|
|
26
|
+
</el-descriptions-item>
|
|
27
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.size')">{{ detail.item.payload_size }} B</el-descriptions-item>
|
|
28
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.qos')">{{ detail.item.qos }}</el-descriptions-item>
|
|
29
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.created_at')">{{ formatDateTime(detail.item.created_at) }}</el-descriptions-item>
|
|
30
|
+
<el-descriptions-item :label="t('system.mqtt_message.field.handled_at')">{{ formatDateTime(detail.item.handled_at) }}</el-descriptions-item>
|
|
31
|
+
<el-descriptions-item v-if="detail.item.message_id" :label="t('system.mqtt_message.field.message_id')" :span="2">{{ detail.item.message_id }}</el-descriptions-item>
|
|
32
|
+
<el-descriptions-item v-if="detail.item.error_message" :label="t('system.mqtt_message.field.error')" :span="2">{{ detail.item.error_message }}</el-descriptions-item>
|
|
33
|
+
</el-descriptions>
|
|
34
|
+
|
|
35
|
+
<section v-if="detail.item.payload_json" class="mqtt-payload-section">
|
|
36
|
+
<h3>{{ t('system.mqtt_message.field.payload_json') }}</h3>
|
|
37
|
+
<pre class="mqtt-payload">{{ prettyJson(detail.item.payload_json) }}</pre>
|
|
38
|
+
</section>
|
|
39
|
+
<section class="mqtt-payload-section">
|
|
40
|
+
<h3>{{ t('system.mqtt_message.field.payload_raw') }}</h3>
|
|
41
|
+
<pre class="mqtt-payload">{{ decodePayload(detail.item.payload_raw, detail.item.payload_format) }}</pre>
|
|
42
|
+
</section>
|
|
43
|
+
</template>
|
|
44
|
+
</ProDialog>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { computed, h, onMounted, reactive, ref } from "vue";
|
|
50
|
+
import { ElTag } from "element-plus";
|
|
51
|
+
import { View } from "@element-plus/icons-vue";
|
|
52
|
+
import ProTable from "@liujitcn/kratos-admin-core/components/ProTable";
|
|
53
|
+
import ProDialog from "@liujitcn/kratos-admin-core/components/Dialog/ProDialog.vue";
|
|
54
|
+
import type { ColumnProps, EnumProps, ProTableInstance } from "@liujitcn/kratos-admin-core/components/ProTable/interface";
|
|
55
|
+
import { buildPageRequest } from "@liujitcn/kratos-admin-core/table";
|
|
56
|
+
import { formatDateTime } from "@liujitcn/kratos-admin-core/format";
|
|
57
|
+
import { t } from "@liujitcn/kratos-admin-core";
|
|
58
|
+
import { defBaseDictService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_dict";
|
|
59
|
+
import { defMqttMessageService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/mqtt_message";
|
|
60
|
+
import type {
|
|
61
|
+
MqttMessageDetail,
|
|
62
|
+
MqttMessageDirection,
|
|
63
|
+
MqttMessagePayloadFormat,
|
|
64
|
+
MqttMessageSummary,
|
|
65
|
+
MqttMessageStatus,
|
|
66
|
+
PageMqttMessageRequest
|
|
67
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/mqtt_message";
|
|
68
|
+
import {
|
|
69
|
+
MqttMessageDirection as MqttMessageDirectionEnum,
|
|
70
|
+
MqttMessagePayloadFormat as MqttMessagePayloadFormatEnum,
|
|
71
|
+
MqttMessageStatus as MqttMessageStatusEnum
|
|
72
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/mqtt_message";
|
|
73
|
+
import type { OptionBaseDictResponse_BaseDictItem } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_dict";
|
|
74
|
+
|
|
75
|
+
defineOptions({ name: "MqttMessage", inheritAttrs: false });
|
|
76
|
+
|
|
77
|
+
const proTable = ref<ProTableInstance>();
|
|
78
|
+
const detail = reactive<{ visible: boolean; item?: MqttMessageDetail }>({ visible: false });
|
|
79
|
+
const DICTIONARY_CODES = {
|
|
80
|
+
direction: "mqtt_message_direction",
|
|
81
|
+
payloadFormat: "mqtt_message_payload_format",
|
|
82
|
+
status: "mqtt_message_status"
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
const dictionaryItems = ref<Record<string, OptionBaseDictResponse_BaseDictItem[]>>({});
|
|
86
|
+
let dictionaryLoadPromise: Promise<void> | undefined;
|
|
87
|
+
|
|
88
|
+
const directionValues: Record<string, MqttMessageDirection> = {
|
|
89
|
+
PUBLISH: MqttMessageDirectionEnum.MQTT_MESSAGE_DIRECTION_PUBLISH,
|
|
90
|
+
SUBSCRIBE: MqttMessageDirectionEnum.MQTT_MESSAGE_DIRECTION_SUBSCRIBE
|
|
91
|
+
};
|
|
92
|
+
const payloadFormatValues: Record<string, MqttMessagePayloadFormat> = {
|
|
93
|
+
JSON: MqttMessagePayloadFormatEnum.MQTT_MESSAGE_PAYLOAD_FORMAT_JSON,
|
|
94
|
+
TEXT: MqttMessagePayloadFormatEnum.MQTT_MESSAGE_PAYLOAD_FORMAT_TEXT,
|
|
95
|
+
BINARY: MqttMessagePayloadFormatEnum.MQTT_MESSAGE_PAYLOAD_FORMAT_BINARY
|
|
96
|
+
};
|
|
97
|
+
const statusValues: Record<string, MqttMessageStatus> = {
|
|
98
|
+
SENT: MqttMessageStatusEnum.MQTT_MESSAGE_STATUS_SENT,
|
|
99
|
+
HANDLED: MqttMessageStatusEnum.MQTT_MESSAGE_STATUS_HANDLED,
|
|
100
|
+
FAILED: MqttMessageStatusEnum.MQTT_MESSAGE_STATUS_FAILED
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/** 加载 MQTT 页面依赖的三个字典。 */
|
|
104
|
+
async function loadDictionaries() {
|
|
105
|
+
if (!dictionaryLoadPromise) {
|
|
106
|
+
dictionaryLoadPromise = defBaseDictService.OptionBaseDict({}).then(response => {
|
|
107
|
+
const codes = new Set<string>(Object.values(DICTIONARY_CODES));
|
|
108
|
+
dictionaryItems.value = Object.fromEntries(
|
|
109
|
+
(response.base_dicts ?? [])
|
|
110
|
+
.filter(dictionary => codes.has(dictionary.code))
|
|
111
|
+
.map(dictionary => [dictionary.code, dictionary.items ?? []])
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
await dictionaryLoadPromise;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** 将字典项转换为表格搜索使用的 Proto 枚举选项。 */
|
|
119
|
+
async function loadEnumOptions(
|
|
120
|
+
code: string,
|
|
121
|
+
values: Record<string, number>
|
|
122
|
+
): Promise<EnumProps[]> {
|
|
123
|
+
await loadDictionaries();
|
|
124
|
+
return (dictionaryItems.value[code] ?? []).flatMap(item => {
|
|
125
|
+
const value = values[item.value];
|
|
126
|
+
return value === undefined ? [] : [{ label: item.label, value, tagType: item.tag_type }];
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const directionOptions = () => loadEnumOptions(DICTIONARY_CODES.direction, directionValues);
|
|
131
|
+
const payloadFormatOptions = () => loadEnumOptions(DICTIONARY_CODES.payloadFormat, payloadFormatValues);
|
|
132
|
+
const statusOptions = () => loadEnumOptions(DICTIONARY_CODES.status, statusValues);
|
|
133
|
+
|
|
134
|
+
const columns = computed(() => {
|
|
135
|
+
const data: ColumnProps[] = [
|
|
136
|
+
{
|
|
137
|
+
prop: "direction",
|
|
138
|
+
label: t("system.mqtt_message.field.direction"),
|
|
139
|
+
width: 120,
|
|
140
|
+
enum: directionOptions,
|
|
141
|
+
search: { el: "select" },
|
|
142
|
+
render: scope => h(ElTag, { size: "small", effect: "plain" }, () => directionLabel((scope.row as MqttMessageSummary).direction))
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
prop: "topic",
|
|
146
|
+
label: t("system.mqtt_message.field.topic"),
|
|
147
|
+
minWidth: 280,
|
|
148
|
+
search: { el: "input", props: { clearable: true } },
|
|
149
|
+
render: scope => h("code", { title: scope.row.topic }, scope.row.topic)
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
prop: "payload_format",
|
|
153
|
+
label: t("system.mqtt_message.field.format"),
|
|
154
|
+
width: 110,
|
|
155
|
+
enum: payloadFormatOptions,
|
|
156
|
+
search: { el: "select" },
|
|
157
|
+
render: scope => payloadFormatLabel((scope.row as MqttMessageSummary).payload_format)
|
|
158
|
+
},
|
|
159
|
+
{ prop: "payload_size", label: t("system.mqtt_message.field.size"), width: 120, align: "right" },
|
|
160
|
+
{ prop: "qos", label: t("system.mqtt_message.field.qos"), width: 80, align: "center" },
|
|
161
|
+
{
|
|
162
|
+
prop: "status",
|
|
163
|
+
label: t("system.mqtt_message.field.status"),
|
|
164
|
+
width: 120,
|
|
165
|
+
enum: statusOptions,
|
|
166
|
+
search: { el: "select" },
|
|
167
|
+
render: scope => statusLabel((scope.row as MqttMessageSummary).status)
|
|
168
|
+
},
|
|
169
|
+
{ prop: "latency_ms", label: t("system.mqtt_message.field.latency"), width: 120, align: "right" },
|
|
170
|
+
{ prop: "created_at", label: t("system.mqtt_message.field.created_at"), minWidth: 190, align: "center", render: scope => formatDateTime(scope.row.created_at) },
|
|
171
|
+
{
|
|
172
|
+
prop: "operation",
|
|
173
|
+
label: t("common.field.operation"),
|
|
174
|
+
cellType: "actions",
|
|
175
|
+
actions: [{ label: t("common.action.view"), type: "primary", link: true, icon: View, onClick: scope => void openDetail(scope.row as MqttMessageSummary) }]
|
|
176
|
+
}
|
|
177
|
+
];
|
|
178
|
+
return data;
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
/** 请求 MQTT 消息分页列表。 */
|
|
182
|
+
async function requestTable(params: PageMqttMessageRequest) {
|
|
183
|
+
const response = await defMqttMessageService.PageMqttMessage(buildPageRequest(params));
|
|
184
|
+
return { data: { list: response.mqtt_messages ?? [], total: response.total } };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** 打开 MQTT 消息详情。 */
|
|
188
|
+
async function openDetail(item: MqttMessageSummary) {
|
|
189
|
+
detail.item = await defMqttMessageService.GetMqttMessage({ id: item.id });
|
|
190
|
+
await loadDictionaries();
|
|
191
|
+
detail.visible = true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** 获取消息方向本地化名称。 */
|
|
195
|
+
function directionLabel(direction: MqttMessageDirection | string) {
|
|
196
|
+
return dictionaryLabel(DICTIONARY_CODES.direction, enumDictionaryValue(direction, directionValues));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** 获取消息格式本地化名称。 */
|
|
200
|
+
function payloadFormatLabel(format: MqttMessagePayloadFormat | string) {
|
|
201
|
+
return dictionaryLabel(DICTIONARY_CODES.payloadFormat, enumDictionaryValue(format, payloadFormatValues));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** 获取消息状态本地化名称。 */
|
|
205
|
+
function statusLabel(status: MqttMessageStatus | string) {
|
|
206
|
+
return dictionaryLabel(DICTIONARY_CODES.status, enumDictionaryValue(status, statusValues));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** 将接口枚举值转换为字典中的稳定值,兼容字符串枚举响应。 */
|
|
210
|
+
function enumDictionaryValue(value: number | string, values: Record<string, number>) {
|
|
211
|
+
const numericValue = typeof value === "number" ? value : Number(value);
|
|
212
|
+
const matchedValue = Object.entries(values).find(([, enumValue]) => enumValue === numericValue)?.[0];
|
|
213
|
+
if (matchedValue) return matchedValue;
|
|
214
|
+
return typeof value === "string" ? value.replace(/^MQTT_MESSAGE_(?:DIRECTION|PAYLOAD_FORMAT|STATUS)_/, "") : "";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** 读取字典标签,字典尚未加载或值未知时回退到稳定值。 */
|
|
218
|
+
function dictionaryLabel(code: string, value: string) {
|
|
219
|
+
return dictionaryItems.value[code]?.find(item => item.value === value)?.label ?? (value || "-");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** 将已解析 JSON 以缩进格式展示。 */
|
|
223
|
+
function prettyJson(value: string) {
|
|
224
|
+
try {
|
|
225
|
+
return JSON.stringify(JSON.parse(value), null, 2);
|
|
226
|
+
} catch {
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** 将原始字节内容转换为可读文本,无法解码时展示 Base64。 */
|
|
232
|
+
function decodePayload(value: Uint8Array | string | undefined, format: MqttMessagePayloadFormat | string) {
|
|
233
|
+
if (!value) return "";
|
|
234
|
+
if (typeof value === "string") return value;
|
|
235
|
+
if (enumDictionaryValue(format, payloadFormatValues) === "BINARY") return toBase64(value);
|
|
236
|
+
try {
|
|
237
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(value);
|
|
238
|
+
} catch {
|
|
239
|
+
return toBase64(value);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** 将字节内容分块编码为 Base64,避免大 Payload 触发调用栈限制。 */
|
|
244
|
+
function toBase64(value: Uint8Array) {
|
|
245
|
+
let binary = "";
|
|
246
|
+
const chunkSize = 0x8000;
|
|
247
|
+
for (let index = 0; index < value.length; index += chunkSize) {
|
|
248
|
+
binary += String.fromCharCode(...value.subarray(index, index + chunkSize));
|
|
249
|
+
}
|
|
250
|
+
return btoa(binary);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
onMounted(() => {
|
|
254
|
+
void loadDictionaries();
|
|
255
|
+
});
|
|
256
|
+
</script>
|
|
257
|
+
|
|
258
|
+
<style scoped>
|
|
259
|
+
.mqtt-payload-section {
|
|
260
|
+
margin-top: 18px;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.mqtt-payload-section h3 {
|
|
264
|
+
margin: 0 0 8px;
|
|
265
|
+
font-size: 14px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.mqtt-payload {
|
|
269
|
+
max-height: 420px;
|
|
270
|
+
overflow: auto;
|
|
271
|
+
padding: 12px;
|
|
272
|
+
background: var(--el-fill-color-light);
|
|
273
|
+
white-space: pre-wrap;
|
|
274
|
+
word-break: break-word;
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
@@ -657,6 +657,7 @@ onBeforeUnmount(stopMonitoring);
|
|
|
657
657
|
.ops-monitoring-page {
|
|
658
658
|
--ops-card-bg: var(--admin-page-card-bg);
|
|
659
659
|
--ops-card-border: var(--admin-page-card-border);
|
|
660
|
+
--ops-grid-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
|
|
660
661
|
--ops-text-primary: var(--admin-page-text-primary);
|
|
661
662
|
--ops-text-secondary: var(--admin-page-text-secondary);
|
|
662
663
|
--ops-text-placeholder: var(--admin-page-text-placeholder);
|
|
@@ -746,7 +747,7 @@ onBeforeUnmount(stopMonitoring);
|
|
|
746
747
|
opacity: 0.65;
|
|
747
748
|
}
|
|
748
749
|
.ops-primary-grid {
|
|
749
|
-
grid-template-columns:
|
|
750
|
+
grid-template-columns: var(--ops-grid-columns);
|
|
750
751
|
margin-bottom: 10px;
|
|
751
752
|
}
|
|
752
753
|
.ops-panel :deep(.el-card__header),
|
|
@@ -985,7 +986,7 @@ onBeforeUnmount(stopMonitoring);
|
|
|
985
986
|
margin-bottom: 10px;
|
|
986
987
|
}
|
|
987
988
|
.ops-storage-grid {
|
|
988
|
-
grid-template-columns:
|
|
989
|
+
grid-template-columns: var(--ops-grid-columns);
|
|
989
990
|
}
|
|
990
991
|
.ops-storage-card {
|
|
991
992
|
min-width: 0;
|
|
@@ -1064,7 +1065,7 @@ onBeforeUnmount(stopMonitoring);
|
|
|
1064
1065
|
background: var(--el-fill-color-light);
|
|
1065
1066
|
}
|
|
1066
1067
|
.ops-secondary-grid {
|
|
1067
|
-
grid-template-columns:
|
|
1068
|
+
grid-template-columns: var(--ops-grid-columns);
|
|
1068
1069
|
margin-bottom: 10px;
|
|
1069
1070
|
}
|
|
1070
1071
|
.ops-table :deep(.el-table__inner-wrapper::before) {
|
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.
|
|
4
|
+
"version": "0.0.96",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "kratos-admin system management module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"sortablejs": "^1.15.2",
|
|
17
17
|
"swagger-ui-dist": "^5.32.15",
|
|
18
18
|
"vue-element-plus-x": "^2.0.3",
|
|
19
|
-
"@liujitcn/kratos-admin-core": "0.0.
|
|
19
|
+
"@liujitcn/kratos-admin-core": "0.0.96"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@element-plus/icons-vue": "^2.3.1",
|