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 f130bc6380..119e4075e4 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 @@ -144,6 +144,7 @@ export default { ready: false, loading: false, initSearchbar: false, + things: [], // for validating thingUIDs against existing things inbox: [], // indexedInbox: {}, selectedItems: [], @@ -194,7 +195,6 @@ export default { this.inbox = data.sort((a, b) => a.label.localeCompare(b.label)) this.initSearchbar = true this.loading = false - this.ready = true setTimeout(() => { this.$refs.listIndex.update() this.$nextTick(() => { @@ -203,6 +203,10 @@ export default { } }) }) + this.$oh.api.get('/rest/things?summary=true&staticDataOnly=true').then((things) => { + this.things = things + this.ready = true + }) }) }, switchGroupOrder (groupBy) { @@ -260,7 +264,6 @@ export default { ], [ this.entryActionsAddAsThingButton(entry, this.load), - this.entryActionsAddAsThingWithCustomIdButton(entry, this.load), { text: (!ignored) ? 'Ignore' : 'Unignore', color: (!ignored) ? 'orange' : 'blue', @@ -417,9 +420,12 @@ export default { destroyOnClose: true, closeTimeout: 2000 }).open() - this.selectedItems = [] dialog.close() - this.load() + this.$f7router.navigate('/settings/things/', { + props: { + searchFor: this.selectedItems.join(',') + } + }) }).catch((err) => { dialog.close() this.load() diff --git a/bundles/org.openhab.ui/web/src/pages/settings/things/thing-inbox-mixin.js b/bundles/org.openhab.ui/web/src/pages/settings/things/thing-inbox-mixin.js index 5c32b3f4ab..dc23befbbf 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/things/thing-inbox-mixin.js +++ b/bundles/org.openhab.ui/web/src/pages/settings/things/thing-inbox-mixin.js @@ -1,4 +1,7 @@ +import ThingMixin from '@/components/thing/thing-mixin' + export default { + mixins: [ThingMixin], methods: { /** * Approve the given entry from the inbox. @@ -31,39 +34,73 @@ export default { color: 'green', bold: true, onClick: () => { - this.$f7.dialog.prompt(`This will create a new Thing of type ${entry.thingTypeUID} with the following label:`, - 'Add as Thing', - (label) => { - this.approveEntry(entry, label).finally(() => { - loadFn() - }) - }, - null, - entry.label) - } - } - }, - entryActionsAddAsThingWithCustomIdButton (entry, loadFn) { - return { - text: 'Add as Thing (with custom ID)', - color: 'blue', - bold: true, - onClick: () => { - this.$f7.dialog.prompt(`This will create a new Thing of type ${entry.thingTypeUID}. You can change the suggested Thing ID below:`, - 'Add as Thing', - (newThingId) => { - this.$f7.dialog.prompt('Enter the desired label of the new Thing:', - 'Add as Thing', - (label) => { - this.approveEntry(entry, label, newThingId).finally(() => { - loadFn() - }) - }, - null, - entry.label) - }, - null, - entry.thingUID.substring(entry.thingUID.lastIndexOf(':') + 1)) + const lastColonIdx = entry.thingUID.lastIndexOf(':') + const uidPrefix = entry.thingUID.substring(0, lastColonIdx + 1) + const defaultId = entry.thingUID.substring(lastColonIdx + 1) + + this.$f7.dialog.create({ + title: 'Add as Thing', + text: `This will create a new Thing of type ${entry.thingTypeUID}.`, + content: ` +