node-red-contrib-knx-ultimate 6.2.2 → 6.2.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/nodes/knxUltimateAI.js +7 -1
- package/nodes/knxUltimateHueAreaMotion.html +16 -4
- package/nodes/knxUltimateHueBattery.html +16 -4
- package/nodes/knxUltimateHueButton.html +16 -4
- package/nodes/knxUltimateHueCameraMotion.html +16 -4
- package/nodes/knxUltimateHueContactSensor.html +16 -4
- package/nodes/knxUltimateHueController.html +1259 -0
- package/nodes/knxUltimateHueController.js +28 -0
- package/nodes/knxUltimateHueHumiditySensor.html +16 -4
- package/nodes/knxUltimateHueLight.html +16 -4
- package/nodes/knxUltimateHueLightSensor.html +16 -4
- package/nodes/knxUltimateHueMotion.html +16 -4
- package/nodes/knxUltimateHuePlug.html +16 -4
- package/nodes/knxUltimateHueScene.html +19 -7
- package/nodes/knxUltimateHueTapDial.html +16 -4
- package/nodes/knxUltimateHueTemperatureSensor.html +16 -4
- package/nodes/knxUltimateHueZigbeeConnectivity.html +16 -4
- package/nodes/knxUltimateHuedevice_software_update.html +16 -4
- package/nodes/locales/de/knxUltimateHueAreaMotion.html +1 -1
- package/nodes/locales/de/knxUltimateHueBattery.html +1 -0
- package/nodes/locales/de/knxUltimateHueButton.html +1 -0
- package/nodes/locales/de/knxUltimateHueCameraMotion.html +1 -0
- package/nodes/locales/de/knxUltimateHueContactSensor.html +1 -0
- package/nodes/locales/de/knxUltimateHueController.html +668 -0
- package/nodes/locales/de/knxUltimateHueController.json +47 -0
- package/nodes/locales/de/knxUltimateHueHumiditySensor.html +1 -0
- package/nodes/locales/de/knxUltimateHueLight.html +1 -0
- package/nodes/locales/de/knxUltimateHueLightSensor.html +1 -0
- package/nodes/locales/de/knxUltimateHueMotion.html +1 -0
- package/nodes/locales/de/knxUltimateHuePlug.html +1 -0
- package/nodes/locales/de/knxUltimateHueScene.html +1 -0
- package/nodes/locales/de/knxUltimateHueTapDial.html +1 -0
- package/nodes/locales/de/knxUltimateHueTemperatureSensor.html +1 -0
- package/nodes/locales/de/knxUltimateHueZigbeeConnectivity.html +1 -0
- package/nodes/locales/de/knxUltimateHuedevice_software_update.html +1 -0
- package/nodes/locales/en/knxUltimateHueAreaMotion.html +1 -1
- package/nodes/locales/en/knxUltimateHueBattery.html +1 -0
- package/nodes/locales/en/knxUltimateHueButton.html +1 -0
- package/nodes/locales/en/knxUltimateHueCameraMotion.html +1 -0
- package/nodes/locales/en/knxUltimateHueContactSensor.html +1 -0
- package/nodes/locales/en/knxUltimateHueController.html +671 -0
- package/nodes/locales/en/knxUltimateHueController.json +47 -0
- package/nodes/locales/en/knxUltimateHueHumiditySensor.html +1 -0
- package/nodes/locales/en/knxUltimateHueLight.html +1 -0
- package/nodes/locales/en/knxUltimateHueLightSensor.html +1 -0
- package/nodes/locales/en/knxUltimateHueMotion.html +1 -0
- package/nodes/locales/en/knxUltimateHuePlug.html +1 -0
- package/nodes/locales/en/knxUltimateHueScene.html +1 -0
- package/nodes/locales/en/knxUltimateHueTapDial.html +1 -0
- package/nodes/locales/en/knxUltimateHueTemperatureSensor.html +1 -0
- package/nodes/locales/en/knxUltimateHueZigbeeConnectivity.html +1 -0
- package/nodes/locales/en/knxUltimateHuedevice_software_update.html +1 -0
- package/nodes/locales/es/knxUltimateHueAreaMotion.html +1 -1
- package/nodes/locales/es/knxUltimateHueBattery.html +1 -0
- package/nodes/locales/es/knxUltimateHueButton.html +1 -0
- package/nodes/locales/es/knxUltimateHueCameraMotion.html +1 -0
- package/nodes/locales/es/knxUltimateHueContactSensor.html +1 -0
- package/nodes/locales/es/knxUltimateHueController.html +671 -0
- package/nodes/locales/es/knxUltimateHueController.json +47 -0
- package/nodes/locales/es/knxUltimateHueHumiditySensor.html +1 -0
- package/nodes/locales/es/knxUltimateHueLight.html +1 -0
- package/nodes/locales/es/knxUltimateHueLightSensor.html +1 -0
- package/nodes/locales/es/knxUltimateHueMotion.html +1 -0
- package/nodes/locales/es/knxUltimateHuePlug.html +1 -0
- package/nodes/locales/es/knxUltimateHueScene.html +1 -0
- package/nodes/locales/es/knxUltimateHueTapDial.html +1 -0
- package/nodes/locales/es/knxUltimateHueTemperatureSensor.html +1 -0
- package/nodes/locales/es/knxUltimateHueZigbeeConnectivity.html +1 -0
- package/nodes/locales/es/knxUltimateHuedevice_software_update.html +1 -0
- package/nodes/locales/fr/knxUltimateHueAreaMotion.html +1 -1
- package/nodes/locales/fr/knxUltimateHueBattery.html +1 -0
- package/nodes/locales/fr/knxUltimateHueButton.html +1 -0
- package/nodes/locales/fr/knxUltimateHueCameraMotion.html +1 -0
- package/nodes/locales/fr/knxUltimateHueContactSensor.html +1 -0
- package/nodes/locales/fr/knxUltimateHueController.html +671 -0
- package/nodes/locales/fr/knxUltimateHueController.json +47 -0
- package/nodes/locales/fr/knxUltimateHueHumiditySensor.html +1 -0
- package/nodes/locales/fr/knxUltimateHueLight.html +1 -0
- package/nodes/locales/fr/knxUltimateHueLightSensor.html +1 -0
- package/nodes/locales/fr/knxUltimateHueMotion.html +1 -0
- package/nodes/locales/fr/knxUltimateHuePlug.html +1 -0
- package/nodes/locales/fr/knxUltimateHueScene.html +1 -0
- package/nodes/locales/fr/knxUltimateHueTapDial.html +1 -0
- package/nodes/locales/fr/knxUltimateHueTemperatureSensor.html +1 -0
- package/nodes/locales/fr/knxUltimateHueZigbeeConnectivity.html +1 -0
- package/nodes/locales/fr/knxUltimateHuedevice_software_update.html +1 -0
- package/nodes/locales/it/knxUltimateHueAreaMotion.html +1 -1
- package/nodes/locales/it/knxUltimateHueBattery.html +1 -0
- package/nodes/locales/it/knxUltimateHueButton.html +1 -0
- package/nodes/locales/it/knxUltimateHueCameraMotion.html +1 -0
- package/nodes/locales/it/knxUltimateHueContactSensor.html +1 -0
- package/nodes/locales/it/knxUltimateHueController.html +671 -0
- package/nodes/locales/it/knxUltimateHueController.json +47 -0
- package/nodes/locales/it/knxUltimateHueHumiditySensor.html +1 -0
- package/nodes/locales/it/knxUltimateHueLight.html +1 -0
- package/nodes/locales/it/knxUltimateHueLightSensor.html +1 -0
- package/nodes/locales/it/knxUltimateHueMotion.html +1 -0
- package/nodes/locales/it/knxUltimateHuePlug.html +1 -0
- package/nodes/locales/it/knxUltimateHueScene.html +1 -0
- package/nodes/locales/it/knxUltimateHueTapDial.html +1 -0
- package/nodes/locales/it/knxUltimateHueTemperatureSensor.html +1 -0
- package/nodes/locales/it/knxUltimateHueZigbeeConnectivity.html +1 -0
- package/nodes/locales/it/knxUltimateHuedevice_software_update.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueAreaMotion.html +1 -1
- package/nodes/locales/zh-CN/knxUltimateHueBattery.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueButton.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueCameraMotion.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueContactSensor.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueController.html +673 -0
- package/nodes/locales/zh-CN/knxUltimateHueController.json +47 -0
- package/nodes/locales/zh-CN/knxUltimateHueHumiditySensor.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueLight.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueLightSensor.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueMotion.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHuePlug.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueScene.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueTapDial.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueTemperatureSensor.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHueZigbeeConnectivity.html +1 -0
- package/nodes/locales/zh-CN/knxUltimateHuedevice_software_update.html +1 -0
- package/nodes/utils/hueControllerProfileAdapter.js +104 -0
- package/nodes/utils/hueControllerProfiles/runtime/area_motion.js +221 -0
- package/nodes/utils/hueControllerProfiles/runtime/button.js +295 -0
- package/nodes/utils/hueControllerProfiles/runtime/camera_motion.js +221 -0
- package/nodes/utils/hueControllerProfiles/runtime/contact.js +191 -0
- package/nodes/utils/hueControllerProfiles/runtime/device_power.js +185 -0
- package/nodes/utils/hueControllerProfiles/runtime/device_software_update.js +185 -0
- package/nodes/utils/hueControllerProfiles/runtime/humidity.js +204 -0
- package/nodes/utils/hueControllerProfiles/runtime/light.js +1583 -0
- package/nodes/utils/hueControllerProfiles/runtime/light_level.js +180 -0
- package/nodes/utils/hueControllerProfiles/runtime/motion.js +185 -0
- package/nodes/utils/hueControllerProfiles/runtime/plug.js +344 -0
- package/nodes/utils/hueControllerProfiles/runtime/relative_rotary.js +271 -0
- package/nodes/utils/hueControllerProfiles/runtime/scene.js +352 -0
- package/nodes/utils/hueControllerProfiles/runtime/temperature.js +187 -0
- package/nodes/utils/hueControllerProfiles/runtime/zigbee_connectivity.js +185 -0
- package/package.json +5 -2
- package/resources/hueControllerMigration.js +338 -0
- package/resources/hueControllerMigrationDialog.js +235 -0
- package/resources/hueControllerProfiles.js +9290 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
const api = factory()
|
|
3
|
+
if (typeof module === 'object' && module.exports) module.exports = api
|
|
4
|
+
if (root) {
|
|
5
|
+
root.KNXUltimateHueControllerMigrationDialog = api
|
|
6
|
+
if (root.RED && root.jQuery && root.document) {
|
|
7
|
+
api.installLegacyButton(root.RED, root.jQuery, root, root.document)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}(typeof globalThis !== 'undefined' ? globalThis : this, function () {
|
|
11
|
+
'use strict'
|
|
12
|
+
|
|
13
|
+
const EVENT_NAMESPACE = '.knxUltimateHueControllerMigrationDialog'
|
|
14
|
+
const BUTTON_SELECTOR = '.hue-legacy-migrate-flow'
|
|
15
|
+
const I18N_PREFIX = 'node-red-contrib-knx-ultimate/knxUltimateHueController:knxUltimateHueController.'
|
|
16
|
+
let closeActiveDialog = function () {}
|
|
17
|
+
|
|
18
|
+
function defaultTranslate (RED, key, fallback, values) {
|
|
19
|
+
try {
|
|
20
|
+
const qualifiedKey = `${I18N_PREFIX}${key}`
|
|
21
|
+
const translated = RED._(qualifiedKey, values)
|
|
22
|
+
if (translated && translated !== qualifiedKey) return translated
|
|
23
|
+
} catch (error) { /* use fallback */ }
|
|
24
|
+
return fallback
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function closeEditorTray (RED, $) {
|
|
28
|
+
try {
|
|
29
|
+
if (RED.actions && typeof RED.actions.invoke === 'function') {
|
|
30
|
+
RED.actions.invoke('core:cancel-edit-tray')
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
} catch (error) { /* use the compatible button fallback */ }
|
|
34
|
+
const $cancel = $('#node-dialog-cancel:visible, #node-config-dialog-cancel:visible').first()
|
|
35
|
+
if ($cancel.length) $cancel.trigger('click')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function reserveDonationWindow (windowObject) {
|
|
39
|
+
try {
|
|
40
|
+
if (!windowObject || typeof windowObject.open !== 'function') return undefined
|
|
41
|
+
const donationWindow = windowObject.open('', '_blank')
|
|
42
|
+
if (donationWindow) {
|
|
43
|
+
try { donationWindow.opener = null } catch (error) { /* best-effort isolation */ }
|
|
44
|
+
}
|
|
45
|
+
return donationWindow
|
|
46
|
+
} catch (error) {
|
|
47
|
+
return undefined
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function closeDonationWindow (donationWindow) {
|
|
52
|
+
try {
|
|
53
|
+
if (donationWindow && typeof donationWindow.close === 'function') donationWindow.close()
|
|
54
|
+
} catch (error) { /* best effort after a failed conversion */ }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function showCompletionMessage (RED, translate, convertedCount) {
|
|
58
|
+
if (!RED || typeof RED.notify !== 'function') return
|
|
59
|
+
const message = translate('migration_success', 'Process finished. {{count}} legacy HUE nodes were converted. Inspect every modified node, including its function, configuration, pins and wiring, before clicking Deploy.')
|
|
60
|
+
.replace('{{count}}', String(convertedCount))
|
|
61
|
+
let notification
|
|
62
|
+
try {
|
|
63
|
+
notification = RED.notify(message, {
|
|
64
|
+
modal: true,
|
|
65
|
+
fixed: true,
|
|
66
|
+
type: 'success',
|
|
67
|
+
buttons: [{
|
|
68
|
+
text: translate('migration_ok', 'OK'),
|
|
69
|
+
class: 'primary',
|
|
70
|
+
click () {
|
|
71
|
+
if (notification && typeof notification.close === 'function') notification.close()
|
|
72
|
+
}
|
|
73
|
+
}]
|
|
74
|
+
})
|
|
75
|
+
} catch (error) { /* the conversion is already complete */ }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function open (options = {}) {
|
|
79
|
+
const RED = options.RED
|
|
80
|
+
const $ = options.$
|
|
81
|
+
const windowObject = options.windowObject
|
|
82
|
+
const documentObject = options.documentObject
|
|
83
|
+
const migrationApi = options.migrationApi || (windowObject && windowObject.KNXUltimateHueControllerMigration)
|
|
84
|
+
const translate = typeof options.translate === 'function'
|
|
85
|
+
? options.translate
|
|
86
|
+
: (key, fallback, values) => defaultTranslate(RED, key, fallback, values)
|
|
87
|
+
|
|
88
|
+
if (!RED || !$ || !windowObject || !documentObject || !migrationApi ||
|
|
89
|
+
typeof migrationApi.collectLegacyHueNodes !== 'function' ||
|
|
90
|
+
typeof migrationApi.createLocalMigrationPatches !== 'function' ||
|
|
91
|
+
typeof migrationApi.applyLocalMigration !== 'function' ||
|
|
92
|
+
typeof migrationApi.createUsageMailto !== 'function' ||
|
|
93
|
+
typeof migrationApi.openUsageMailto !== 'function' ||
|
|
94
|
+
typeof migrationApi.MIGRATION_DONATION_URL !== 'string') {
|
|
95
|
+
if (RED && typeof RED.notify === 'function') {
|
|
96
|
+
RED.notify(translate('migration_unavailable', 'The HUE migration tool is unavailable. Restart Node-RED after updating the package.'), 'error')
|
|
97
|
+
}
|
|
98
|
+
return function () {}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const legacyNodes = migrationApi.collectLegacyHueNodes(RED)
|
|
102
|
+
if (legacyNodes.length === 0) {
|
|
103
|
+
if (typeof RED.notify === 'function') RED.notify(translate('migration_none', 'No legacy HUE nodes were found.'), 'warning')
|
|
104
|
+
return function () {}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const $dialog = $('<div class="hue-controller-migration-dialog"></div>').appendTo('body')
|
|
108
|
+
$('<div class="hue-controller-migration-summary"></div>')
|
|
109
|
+
.text(translate('migration_confirm', '{{count}} legacy HUE nodes will be converted directly in the editor.').replace('{{count}}', String(legacyNodes.length)))
|
|
110
|
+
.css({ marginBottom: '10px', fontWeight: 'bold' })
|
|
111
|
+
.appendTo($dialog)
|
|
112
|
+
$('<div class="hue-controller-migration-note"></div>')
|
|
113
|
+
.text(translate('migration_privacy', 'Conversion happens entirely in this browser. No flow, node, configuration, credential, group address, or wiring data is transmitted or retained.'))
|
|
114
|
+
.css({ marginBottom: '10px', padding: '8px 10px', borderLeft: '4px solid #2980b9', background: '#eaf4fb' })
|
|
115
|
+
.appendTo($dialog)
|
|
116
|
+
$('<div class="hue-controller-migration-email"></div>')
|
|
117
|
+
.text(translate('migration_email_notice', 'After conversion, your email app will open an editable draft addressed to the author without navigating away from Node-RED, and a new browser window will open the donation page. The draft contains only the number of converted nodes and space for optional notes; nothing is sent automatically and no flow data is added to the donation link.'))
|
|
118
|
+
.css({ marginBottom: '10px' })
|
|
119
|
+
.appendTo($dialog)
|
|
120
|
+
$('<div class="form-tips hue-controller-migration-backup"></div>')
|
|
121
|
+
.text(translate('migration_deploy_notice', 'Before continuing, export a backup of your flows. The current editor will close. Only the legacy HUE nodes will be changed; all config nodes and wiring remain untouched. Review the result, then click Deploy yourself.'))
|
|
122
|
+
.css({ marginBottom: '10px', padding: '8px 10px', borderLeft: '4px solid #d79b00', background: '#fff8df' })
|
|
123
|
+
.appendTo($dialog)
|
|
124
|
+
$('<div class="form-tips hue-controller-migration-review"></div>')
|
|
125
|
+
.text(translate('migration_review_notice', 'Safety check: after conversion, inspect every modified HUE node in the flow. Verify its selected function, configuration references, input/output pins and wiring before clicking Deploy.'))
|
|
126
|
+
.css({ marginBottom: '12px', padding: '8px 10px', borderLeft: '4px solid #d79b00', background: '#fff8df' })
|
|
127
|
+
.appendTo($dialog)
|
|
128
|
+
const $status = $('<div class="hue-controller-migration-status"></div>')
|
|
129
|
+
.css({ minHeight: '20px', marginTop: '8px' })
|
|
130
|
+
.appendTo($dialog)
|
|
131
|
+
|
|
132
|
+
let closed = false
|
|
133
|
+
let running = false
|
|
134
|
+
let $convert
|
|
135
|
+
const closeDialog = () => {
|
|
136
|
+
if (closed) return
|
|
137
|
+
closed = true
|
|
138
|
+
if ($convert) $convert.off(EVENT_NAMESPACE)
|
|
139
|
+
try { $dialog.dialog('destroy') } catch (error) { /* already detached */ }
|
|
140
|
+
$dialog.remove()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const performMigration = () => {
|
|
144
|
+
if (running) return
|
|
145
|
+
running = true
|
|
146
|
+
$convert.prop('disabled', true)
|
|
147
|
+
let donationWindow
|
|
148
|
+
try {
|
|
149
|
+
migrationApi.createLocalMigrationPatches(legacyNodes)
|
|
150
|
+
donationWindow = reserveDonationWindow(windowObject)
|
|
151
|
+
closeDialog()
|
|
152
|
+
closeEditorTray(RED, $)
|
|
153
|
+
windowObject.setTimeout(() => {
|
|
154
|
+
let convertedCount
|
|
155
|
+
try {
|
|
156
|
+
convertedCount = migrationApi.applyLocalMigration(RED, legacyNodes)
|
|
157
|
+
} catch (error) {
|
|
158
|
+
closeDonationWindow(donationWindow)
|
|
159
|
+
const message = error && error.message ? error.message : String(error)
|
|
160
|
+
RED.notify(`${translate('migration_failed', 'HUE migration failed; the flow was not changed:')} ${message}`, 'error')
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
if (donationWindow && !donationWindow.closed && donationWindow.location) {
|
|
165
|
+
donationWindow.location.href = migrationApi.MIGRATION_DONATION_URL
|
|
166
|
+
} else if (typeof windowObject.open === 'function') {
|
|
167
|
+
const opened = windowObject.open(migrationApi.MIGRATION_DONATION_URL, '_blank', 'noopener,noreferrer')
|
|
168
|
+
if (!opened) throw new Error('The browser blocked the donation window')
|
|
169
|
+
} else {
|
|
170
|
+
throw new Error('Browser window opening is unavailable')
|
|
171
|
+
}
|
|
172
|
+
} catch (error) {
|
|
173
|
+
RED.notify(translate('migration_donation_failed', 'The nodes were converted, but the donation page could not be opened.'), 'warning')
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
const mailto = migrationApi.createUsageMailto(convertedCount, {
|
|
177
|
+
subject: translate('migration_email_subject', 'KNX Ultimate - legacy HUE conversion used'),
|
|
178
|
+
body: translate('migration_email_body', 'Hello Massimo,\n\nI used the legacy HUE node conversion button.\nConverted legacy HUE nodes: {{count}}.\n\nOptional notes:\n')
|
|
179
|
+
})
|
|
180
|
+
migrationApi.openUsageMailto(mailto, {
|
|
181
|
+
document: documentObject,
|
|
182
|
+
setTimeout: (callback, delay) => windowObject.setTimeout(callback, delay)
|
|
183
|
+
})
|
|
184
|
+
} catch (error) {
|
|
185
|
+
RED.notify(translate('migration_email_failed', 'The nodes were converted, but the email draft could not be opened.'), 'warning')
|
|
186
|
+
}
|
|
187
|
+
showCompletionMessage(RED, translate, convertedCount)
|
|
188
|
+
}, 0)
|
|
189
|
+
} catch (error) {
|
|
190
|
+
closeDonationWindow(donationWindow)
|
|
191
|
+
running = false
|
|
192
|
+
$convert.prop('disabled', false)
|
|
193
|
+
const message = error && error.message ? error.message : String(error)
|
|
194
|
+
$status.text(`${translate('migration_failed', 'HUE migration failed; the flow was not changed:')} ${message}`).css('color', '#b00020')
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
$dialog.dialog({
|
|
199
|
+
modal: true,
|
|
200
|
+
width: Math.min(680, Math.max(520, $(windowObject).width() - 80)),
|
|
201
|
+
title: translate('migration_title', 'Convert legacy HUE nodes'),
|
|
202
|
+
beforeClose: () => !running,
|
|
203
|
+
close: closeDialog,
|
|
204
|
+
buttons: [
|
|
205
|
+
{
|
|
206
|
+
text: translate('migration_close', 'Cancel'),
|
|
207
|
+
click () { if (!running) $(this).dialog('close') }
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
text: translate('migration_convert', 'Convert HUE nodes'),
|
|
211
|
+
class: 'hue-controller-migration-convert',
|
|
212
|
+
click: performMigration
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
open () {
|
|
216
|
+
$convert = $dialog.parent().find('.hue-controller-migration-convert')
|
|
217
|
+
$convert.addClass('primary')
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
return closeDialog
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function installLegacyButton (RED, $, windowObject, documentObject) {
|
|
224
|
+
if (!RED || !$ || !documentObject) return
|
|
225
|
+
const $document = $(documentObject)
|
|
226
|
+
$document.off(`click${EVENT_NAMESPACE}`, BUTTON_SELECTOR)
|
|
227
|
+
$document.on(`click${EVENT_NAMESPACE}`, BUTTON_SELECTOR, (event) => {
|
|
228
|
+
event.preventDefault()
|
|
229
|
+
closeActiveDialog()
|
|
230
|
+
closeActiveDialog = open({ RED, $, windowObject, documentObject })
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return { installLegacyButton, open }
|
|
235
|
+
}))
|