Skip to content

Commit abd11d5

Browse files
authored
fix: routing not displayed when session id includes : (#7517)
* fix: routing not displayed when session id includes `:` fixes: #7515
1 parent afeda9b commit abd11d5

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

dashboard/src/components/platform/AddNewPlatform.vue

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -860,17 +860,15 @@ export default {
860860
// 过滤出属于该平台的路由,并保持顺序
861861
const routes = [];
862862
for (const [umop, confId] of Object.entries(routingTable)) {
863-
if (this.isUmopMatchPlatform(umop, platformId)) {
864-
const parts = umop.split(':');
865-
if (parts.length === 3) {
866-
routes.push({
867-
umop: umop,
868-
originalUmop: umop, // 保存原始 UMOP 用于更新时查找
869-
messageType: parts[1] === '' || parts[1] === '*' ? '*' : parts[1],
870-
sessionId: parts[2] === '' || parts[2] === '*' ? '*' : parts[2],
871-
configId: confId
872-
});
873-
}
863+
const parsedUmop = this.parseUmop(umop);
864+
if (this.isParsedUmopMatchPlatform(parsedUmop, platformId)) {
865+
routes.push({
866+
umop: umop,
867+
originalUmop: umop, // 保存原始 UMOP 用于更新时查找
868+
messageType: parsedUmop.messageType || '*',
869+
sessionId: parsedUmop.sessionId || '*',
870+
configId: confId
871+
});
874872
}
875873
}
876874
@@ -992,11 +990,29 @@ export default {
992990
},
993991
994992
isUmopMatchPlatform(umop, platformId) {
995-
if (!umop) return false;
996-
const parts = umop.split(':');
997-
if (parts.length !== 3) return false;
998-
const platform = parts[0];
999-
return platform === platformId || platform === '' || platform === '*';
993+
const parsedUmop = this.parseUmop(umop);
994+
return this.isParsedUmopMatchPlatform(parsedUmop, platformId);
995+
},
996+
997+
isParsedUmopMatchPlatform(parsedUmop, platformId) {
998+
if (!parsedUmop) return false;
999+
return parsedUmop.platform === platformId || parsedUmop.platform === '' || parsedUmop.platform === '*';
1000+
},
1001+
1002+
parseUmop(umop) {
1003+
if (!umop) return null;
1004+
1005+
const firstSeparatorIndex = umop.indexOf(':');
1006+
if (firstSeparatorIndex === -1) return null;
1007+
1008+
const secondSeparatorIndex = umop.indexOf(':', firstSeparatorIndex + 1);
1009+
if (secondSeparatorIndex === -1) return null;
1010+
1011+
return {
1012+
platform: umop.slice(0, firstSeparatorIndex),
1013+
messageType: umop.slice(firstSeparatorIndex + 1, secondSeparatorIndex),
1014+
sessionId: umop.slice(secondSeparatorIndex + 1)
1015+
};
10001016
},
10011017
10021018
// 获取消息类型标签

0 commit comments

Comments
 (0)