diff --git a/bundles/org.openhab.ui/web/src/pages/settings/things/add/choose-thing-type.vue b/bundles/org.openhab.ui/web/src/pages/settings/things/add/choose-thing-type.vue index dc8d6d681..6d2426c86 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/things/add/choose-thing-type.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/things/add/choose-thing-type.vue @@ -34,7 +34,7 @@ import ConfigSheet from '@/components/config/config-sheet.vue' +import ThingInboxMixin from '@/pages/settings/things/thing-inbox-mixin' export default { - components: { ConfigSheet }, + mixins: [ThingInboxMixin], + components: { + ConfigSheet + }, props: ['bindingId'], data () { return { @@ -224,28 +228,25 @@ export default { Promise.reject('Failed to load inbox: ' + e) }) }, - approve (entry) { - console.log(`Add ${entry.thingUID} as thing`) - this.$f7.dialog.prompt(`This will create a new Thing of type ${entry.thingTypeUID} with the following name:`, - 'Add as Thing', - (name) => { - this.$oh.api.postPlain(`/rest/inbox/${entry.thingUID}/approve`, name).then((res) => { - this.$f7.toast.create({ - text: 'Entry approved', - destroyOnClose: true, - closeTimeout: 2000 - }).open() - setTimeout(() => { this.$f7router.navigate('/settings/things/', { reloadCurrent: true }) }, 300) - }).catch((err) => { - this.$f7.toast.create({ - text: 'Error during thing creation: ' + err, - destroyOnClose: true, - closeTimeout: 2000 - }).open() - }) - }, - null, - entry.label) + openEntryActions (entry) { + let actions = this.$f7.actions.create({ + convertToPopover: true, + closeOnEscape: true, + buttons: [ + [ + { + text: entry.label, + label: true + } + ], + [ + this.entryActionsAddAsThingButton(entry, this.loadInbox), + this.entryActionsAddAsThingWithCustomIdButton(entry, this.loadInbox) + ] + ] + }) + + actions.open() }, approveAll () { this.$f7.dialog.confirm('Add all discovered Things?', 'Add Things', () => { diff --git a/bundles/org.openhab.ui/web/src/pages/settings/things/inbox/inbox-list.vue b/bundles/org.openhab.ui/web/src/pages/settings/things/inbox/inbox-list.vue index 4ae86899f..f130bc638 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/things/inbox/inbox-list.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/things/inbox/inbox-list.vue @@ -132,7 +132,10 @@