Skip to content

Commit

Permalink
fix(meta): fix meta data saving issue requiring two clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
ysfscream authored and Red-Asuka committed Apr 23, 2023
1 parent 2ddff65 commit bc65f46
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/MsgPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,20 @@ export default class MsgPublish extends Vue {
private topicRequired = false
private isValidProp(value: any) {
return value !== null && value !== undefined && value !== false
}
private getHasMqtt5PropState() {
return (
Object.entries(this.MQTT5PropsForm).filter(([_, v]) => v !== null && v !== undefined && v !== false).length > 0
)
return Object.values(this.MQTT5PropsForm).some(this.isValidProp)
}
private async saveMeta() {
this.hasMqtt5Prop = this.getHasMqtt5PropState()
this.saveMetaLoading = true
await this.updatePushProp()
this.saveMetaLoading = false
this.showMetaCard = false
this.hasMqtt5Prop = this.getHasMqtt5PropState()
}
private changeVisable() {
Expand Down Expand Up @@ -391,7 +393,6 @@ export default class MsgPublish extends Vue {
this.MQTT5PropsSend = _.cloneDeep(this.MQTT5PropsForm)
const propRecords = Object.entries(this.MQTT5PropsForm).filter(([_, v]) => v !== null && v !== undefined && v !== 0)
const props = Object.fromEntries(propRecords)
const { connectionService } = useServices()
return await connectionService.addPushProp(props, this.$route.params.id)
}
Expand Down

0 comments on commit bc65f46

Please sign in to comment.