Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(desktop): fix bytes statistics #1208

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/SubscriptionsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,12 @@ export default class SubscriptionsList extends Vue {
}
}

private saveTopicToSubList(topic: string, qos: QoS, index?: number, aliasArr?: string[]): void {
private saveTopicToSubList(topic: string, qos: QoS, index?: number, aliasArr?: string[], id?: string): void {
const existTopicIndex: number = this.subsList.findIndex((item: SubscriptionModel) => item.topic === topic)
if (existTopicIndex !== -1) {
this.subsList[existTopicIndex].qos = qos
} else {
let { topic: unuseTopic, color, alias, id, ...others } = this.subRecord
let { topic: unuseTopic, id: recordID, color, alias, ...others } = this.subRecord
if (index !== undefined && aliasArr !== undefined) {
alias = aliasArr ? aliasArr[index] : alias
if (index > 0) {
Expand All @@ -400,7 +400,7 @@ export default class SubscriptionsList extends Vue {
}
this.subsList.push({
topic,
id,
id: id ?? recordID,
color,
alias,
...others,
Expand All @@ -409,7 +409,7 @@ export default class SubscriptionsList extends Vue {
}

public async subscribe(
{ topic, alias, qos, nl, rap, rh, subscriptionIdentifier, disabled }: SubscriptionModel,
{ topic, alias, qos, nl, rap, rh, subscriptionIdentifier, disabled, id }: SubscriptionModel,
isAuto?: boolean,
enable?: boolean,
) {
Expand Down Expand Up @@ -460,10 +460,10 @@ export default class SubscriptionsList extends Vue {
this.$log.info(`Enabled topic: ${topic}`)
} else {
if (!Array.isArray(topicsArr)) {
this.saveTopicToSubList(topic, qos)
this.saveTopicToSubList(topic, qos, undefined, undefined, id)
} else {
topicsArr.forEach((topic, index) => {
this.saveTopicToSubList(topic, qos, index, aliasArr as string[])
this.saveTopicToSubList(topic, qos, index, aliasArr as string[], id)
})
}
this.$log.info(`Saved topic: ${topic}`)
Expand Down