Thing details: Add "Install Binding" button for HANDLER_MISSING_ERROR (#3003)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
pull/3009/head
jimtng 2025-01-12 20:03:36 +10:00 committed by GitHub
parent bd3f1c4e0d
commit 4b1ef3b4dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View File

@ -253,6 +253,7 @@ import { AddonIcons, AddonTitles, AddonSuggestionLabels, AddonConnectionTypes, A
export default {
mixins: [AddonStoreMixin],
props: ['searchFor'],
components: {
AddonsSection
},
@ -326,9 +327,12 @@ export default {
})
this.ready = true
this.startEventSource()
setTimeout(() => {
this.$nextTick(() => {
this.$f7.lazy.create('.page-addon-store')
}, 100)
if (this.searchFor) {
this.$refs.storeSearchbar.search(this.searchFor)
}
})
})
})
},

View File

@ -136,7 +136,8 @@
<f7-block class="block-narrow" v-if="ready">
<f7-col>
<f7-list>
<f7-list-button color="blue" title="Copy Thing" @click="copyThing" />
<f7-list-button v-if="thing.statusInfo.statusDetail === 'HANDLER_MISSING_ERROR'" color="blue" title="Install Binding" @click="installBinding" />
<f7-list-button v-if="!error" color="blue" title="Copy Thing" @click="copyThing" />
<f7-list-button v-if="editable" color="red" title="Delete Thing" @click="deleteThing" />
</f7-list>
</f7-col>
@ -649,6 +650,15 @@ export default {
}
)
},
installBinding () {
this.$f7router.navigate({
url: '/addons/binding/'
}, {
props: {
searchFor: this.thing.UID.split(':')[0]
}
})
},
toggleDisabled () {
const enable = (this.thing.statusInfo.statusDetail === 'DISABLED')
this.$oh.api.putPlain('/rest/things/' + this.thingId + '/enable', enable.toString()).then((data) => {