|
27 | 27 | <f7-list-item media-item title="Block Libraries" footer="Develop custom extensions for Blockly scripts" link="blocks/">
|
28 | 28 | <f7-icon slot="media" f7="ticket" color="gray" />
|
29 | 29 | </f7-list-item>
|
30 |
| - <f7-list-item media-item title="Add Items from Textual Definition" footer="Create or update items & links in bulk" link="add-items-dsl"> |
| 30 | + <f7-list-item media-item title="Copy DSL Definitions for All Things" footer="Copy all Things' DSL definitions to clipboard" link="#" @click="copyThingsDsl"> |
| 31 | + <f7-icon slot="media" f7="lightbulb" color="gray" /> |
| 32 | + </f7-list-item> |
| 33 | + <f7-list-item media-item title="Copy DSL Definitions for All Items" footer="Copy all Items' DSL definitions to clipboard" link="#" @click="copyItemsDsl"> |
| 34 | + <f7-icon slot="media" f7="square_on_circle" color="gray" /> |
| 35 | + </f7-list-item> |
| 36 | + <f7-list-item media-item title="Add Items from DSL Definition" footer="Create or update items & links in bulk" link="add-items-dsl"> |
31 | 37 | <f7-icon slot="media" f7="text_badge_plus" color="gray" />
|
32 | 38 | </f7-list-item>
|
33 | 39 | </f7-list>
|
|
125 | 131 | </style>
|
126 | 132 |
|
127 | 133 | <script>
|
| 134 | +import Vue from 'vue' |
| 135 | +import Clipboard from 'v-clipboard' |
| 136 | +
|
| 137 | +Vue.use(Clipboard) |
128 | 138 |
|
129 | 139 | export default {
|
130 | 140 | components: {
|
@@ -167,6 +177,34 @@ export default {
|
167 | 177 | this.$oh.ws.close(this.wsClient)
|
168 | 178 | this.wsClient = null
|
169 | 179 | this.wsEvents = []
|
| 180 | + }, |
| 181 | + copyThingsDsl () { |
| 182 | + this.$oh.api.getPlain({ |
| 183 | + url: '/rest/file-format/things', |
| 184 | + headers: { accept: 'text/vnd.openhab.dsl.thing' } |
| 185 | + }).then((definition) => { |
| 186 | + if (this.$clipboard(definition)) { |
| 187 | + this.$f7.toast.show({ |
| 188 | + text: 'Things DSL definitions copied to clipboard', |
| 189 | + destroyOnClose: true, |
| 190 | + closeTimeout: 2000 |
| 191 | + }).open() |
| 192 | + } |
| 193 | + }) |
| 194 | + }, |
| 195 | + copyItemsDsl () { |
| 196 | + this.$oh.api.getPlain({ |
| 197 | + url: '/rest/file-format/items', |
| 198 | + headers: { accept: 'text/vnd.openhab.dsl.item' } |
| 199 | + }).then((definition) => { |
| 200 | + if (this.$clipboard(definition)) { |
| 201 | + this.$f7.toast.show({ |
| 202 | + text: 'Items DSL definitions copied to clipboard', |
| 203 | + destroyOnClose: true, |
| 204 | + closeTimeout: 2000 |
| 205 | + }).open() |
| 206 | + } |
| 207 | + }) |
170 | 208 | }
|
171 | 209 | },
|
172 | 210 | asyncComputed: {
|
|
0 commit comments