Skip to content

Commit

Permalink
Merge pull request #985 from OpenC3/packetviewer_remember_packet
Browse files Browse the repository at this point in the history
Packet Viewer remember last packet
  • Loading branch information
ryanmelt authored Dec 18, 2023
2 parents 1b1028a + 976a534 commit f2c48a9
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,25 @@ export default {
// Merge default config into the currentConfig in case default isn't yet defined
let config = { ...this.currentConfig, ...this.loadDefaultConfig() }
this.applyConfig(config)

// If we're passed in the route then manually call packetChanged to update
if (this.$route.params.target && this.$route.params.packet) {
// Initial position of chooser should be correct so call packetChanged for it
this.packetChanged({
targetName: this.$route.params.target.toUpperCase(),
packetName: this.$route.params.packet.toUpperCase(),
})
} else {
if (config.target && config.packet) {
// Chooser probably won't be at the right packet so need to refresh
this.$router.push({
name: 'PackerViewer',
params: {
target: config.target,
packet: config.packet,
},
})
this.$router.go()
}
}
this.changeUpdater(true)
}
Expand All @@ -354,12 +366,6 @@ export default {
},
methods: {
packetChanged(event) {
if (
this.targetName === event.targetName &&
this.packetName === event.packetName
) {
return
}
this.api.get_target(event.targetName).then((target) => {
this.ignoredItems = target.ignored_items
})
Expand All @@ -375,14 +381,14 @@ export default {
this.$route.params.target !== event.targetName ||
this.$route.params.packet !== event.packetName
) {
this.saveDefaultConfig(this.currentConfig)
this.$router.push({
name: 'PackerViewer',
params: {
target: this.targetName,
packet: this.packetName,
},
})
this.saveDefaultConfig(this.currentConfig)
}
this.changeUpdater(true)
},
Expand Down Expand Up @@ -474,6 +480,7 @@ export default {
this.$route.params.packet !== config.packet ||
this.$route.query.config !== name
) {
// Need full refresh since chooser won't be on the right packet
this.$router.push({
name: 'PackerViewer',
params: {
Expand Down

0 comments on commit f2c48a9

Please sign in to comment.