Skip to content

Commit

Permalink
improve(msg-left-item):add msg type meta props
Browse files Browse the repository at this point in the history
  • Loading branch information
ni00 authored and ysfscream committed Aug 1, 2023
1 parent 4e354bd commit edc294c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/MsgLeftItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,13 @@ export default class MsgLeftItem extends Vue {
return this.meta ? JSON.parse(this.meta).schemaName : null
}
get msgType() {
return this.meta ? JSON.parse(this.meta).msgType : null
}
private mounted() {
try {
if (this.payload && JSON.parse(this.payload)) {
if (this.payload && this.msgType === 'JSON') {
this.hightlight = true
this.$nextTick(() => {
Prism.highlightAll()
Expand Down
7 changes: 7 additions & 0 deletions src/views/connections/ConnectionsDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ export default class ConnectionsDetail extends Vue {
}
}
private updateReceivedMsgType(message: MessageModel, msgType: PayloadType) {
const metaObj = JSON.parse(message.meta || '{}')
metaObj['msgType'] = msgType
message.meta = JSON.stringify(metaObj)
}
// Connect
public async connect(): Promise<boolean | void> {
this.isReconnect = false
Expand Down Expand Up @@ -1140,6 +1146,7 @@ export default class ConnectionsDetail extends Vue {
}
this.updateMeta(receivedMessage, 'function', 'received')
this.updateMeta(receivedMessage, 'schema', 'received')
this.updateReceivedMsgType(receivedMessage, this.receivedMsgType)
return receivedMessage
}
Expand Down

0 comments on commit edc294c

Please sign in to comment.