node-red-contrib-unifi-ultimate 0.1.9 → 0.1.10

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/README.md CHANGED
@@ -20,6 +20,11 @@ Control and monitor `UniFi Network`, `UniFi Protect`, and `UniFi Access` from No
20
20
 
21
21
  [View Changelog](CHANGELOG.md)
22
22
 
23
+ <a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ">
24
+ <img src="resources/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" align="absmiddle">
25
+ Watch news and tutorials on YouTube
26
+ </a>
27
+
23
28
  ## Install
24
29
 
25
30
  In Node-RED:
@@ -310,4 +315,4 @@ Import from `examples/`:
310
315
  [license-image]: https://img.shields.io/badge/license-MIT-green.svg
311
316
  [license-url]: https://opensource.org/licenses/MIT
312
317
  [youtube-image]: https://img.shields.io/badge/YouTube-Subscribe-red?logo=youtube&logoColor=white
313
- [youtube-url]: https://www.youtube.com/@maxsupervibe
318
+ [youtube-url]: https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 20" role="img" aria-labelledby="title">
2
+ <title id="title">YouTube</title>
3
+ <path fill="#FF0000" d="M27.4 3.1c-.3-1.2-1.3-2.1-2.5-2.4C22.7.1 14 .1 14 .1S5.3.1 3.1.7C1.9 1 .9 1.9.6 3.1 0 5.3 0 10 0 10s0 4.7.6 6.9c.3 1.2 1.3 2.1 2.5 2.4 2.2.6 10.9.6 10.9.6s8.7 0 10.9-.6c1.2-.3 2.1-1.2 2.5-2.4.6-2.2.6-6.9.6-6.9s0-4.7-.6-6.9z"/>
4
+ <path fill="#FFFFFF" d="M11.2 14.2 18.5 10l-7.3-4.2v8.4z"/>
5
+ </svg>
@@ -16,36 +16,17 @@
16
16
  },
17
17
  oneditprepare: function () {
18
18
  const $host = $("#node-config-input-host");
19
- const $connectionHint = $("#node-config-input-connectionHint");
19
+ const $apiToken = $("#node-config-input-apiToken");
20
+ const $rejectUnauthorized = $("#node-config-input-rejectUnauthorized");
21
+ const $apiTokenRow = $apiToken.closest(".form-row");
22
+ const $securityRow = $rejectUnauthorized.closest(".form-row");
23
+ const $advancedRow = $("#node-config-row-advanced");
20
24
 
21
- function escapeHtml(value) {
22
- // The connection preview is rendered as HTML, so sanitize any
23
- // host text typed by the user first.
24
- return String(value || "")
25
- .replace(/&/g, "&amp;")
26
- .replace(/</g, "&lt;")
27
- .replace(/>/g, "&gt;")
28
- .replace(/"/g, "&quot;")
29
- .replace(/'/g, "&#39;");
30
- }
31
-
32
- function refreshConnectionHint() {
33
- const host = String($host.val() || "").trim();
34
- if (!host) {
35
- $connectionHint.html("<strong>Enter your controller address</strong>The node uses the standard UniFi Access API connection automatically.");
36
- return;
37
- }
38
-
39
- // UniFi Access defaults to port 12445. Show the fully resolved
40
- // host in the preview even when the user omitted the port.
41
- const normalizedHost = host.replace(/^https?:\/\//i, "").replace(/\/+$/, "");
42
- const hasPort = /:\d+$/.test(normalizedHost);
43
- const previewHost = hasPort ? normalizedHost : normalizedHost + ":12445";
44
- $connectionHint.html(
45
- "<strong>Connection preview</strong>Will connect to <code>https://" +
46
- escapeHtml(previewHost) +
47
- "</code>"
48
- );
25
+ function syncProgressiveRows() {
26
+ const hasHost = String($host.val() || "").trim() !== "";
27
+ $apiTokenRow.toggle(hasHost);
28
+ $securityRow.toggle(hasHost);
29
+ $advancedRow.toggle(hasHost);
49
30
  }
50
31
 
51
32
  try {
@@ -55,11 +36,10 @@
55
36
  } catch (error) {
56
37
  }
57
38
 
58
- refreshConnectionHint();
39
+ syncProgressiveRows();
59
40
 
60
41
  $host.on("change input", function () {
61
- // Keep the preview synchronized with the current host value.
62
- refreshConnectionHint();
42
+ syncProgressiveRows();
63
43
  });
64
44
  }
65
45
  });
@@ -70,12 +50,11 @@
70
50
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-access-black.svg" alt="UniFi Access logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
71
51
  </div>
72
52
  <div class="form-row unifi-ultimate-hero">
73
- <div class="unifi-ultimate-hero-panel">
74
- <strong>Connect Node-RED to your UniFi Access application.</strong>
75
- <span>Use the Access host or IP address and an Access API token.</span>
76
- </div>
53
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
54
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
55
+ <span>Youtube Tutorials</span>
56
+ </a>
77
57
  </div>
78
- <div class="unifi-ultimate-section-title">Connection</div>
79
58
  <div class="form-row">
80
59
  <label for="node-config-input-host"><i class="fa fa-globe"></i> Controller</label>
81
60
  <input type="text" id="node-config-input-host" placeholder="192.168.1.10 or access.local:12445">
@@ -89,9 +68,6 @@
89
68
  <input type="checkbox" id="node-config-input-rejectUnauthorized" style="display:inline-block; width:auto; vertical-align:top;">
90
69
  <span style="margin-left:8px;">Secure connection only</span>
91
70
  </div>
92
- <div class="form-row">
93
- <div id="node-config-input-connectionHint" class="unifi-ultimate-card"></div>
94
- </div>
95
71
  <div id="node-config-row-advanced" class="unifi-ultimate-advanced">
96
72
  <div class="form-row">
97
73
  <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -101,6 +77,8 @@
101
77
  </script>
102
78
 
103
79
  <script type="text/html" data-help-name="unifi-access-config">
80
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
81
+
104
82
  <p>Shared connection for UniFi Access nodes.</p>
105
83
 
106
84
  <h3>Configuration</h3>
@@ -86,8 +86,10 @@
86
86
  const $capabilityConfigRow = $("#node-row-capabilityConfig");
87
87
  const $capabilityConfigContainer = $("#node-input-capabilityConfigContainer");
88
88
  const $refresh = $("#node-input-refreshDevices");
89
- const $selectionSummary = $("#node-input-selectionSummary");
90
- const $selectionDetail = $("#node-input-selectionDetail");
89
+ const $deviceTypeRow = $deviceType.closest(".form-row");
90
+ const $deviceIdRow = $deviceId.closest(".form-row");
91
+ const $capabilityRow = $capability.closest(".form-row");
92
+ const $advancedRow = $("#node-row-advanced");
91
93
  let capabilityConfig = parseCapabilityConfig(node.capabilityConfig);
92
94
  let capabilityListRequestId = 0;
93
95
  let capabilityOptionsRequestId = 0;
@@ -95,6 +97,26 @@
95
97
  let isInitializingEditor = true;
96
98
  let deviceTypeDefinitions = [];
97
99
  let capabilityDefinitions = [];
100
+
101
+ function hasSelection($field) {
102
+ const value = String($field.val() || "").trim();
103
+ return value !== "" && value !== "_ADD_";
104
+ }
105
+
106
+ function syncProgressiveRows() {
107
+ const hasServer = hasSelection($server);
108
+ const hasDeviceType = hasSelection($deviceType);
109
+ const hasDevice = hasSelection($deviceId);
110
+ const hasCapability = hasSelection($capability);
111
+ const hasCapabilityFields = $capabilityConfigRow.data("has-fields") === true;
112
+
113
+ $deviceTypeRow.toggle(hasServer);
114
+ $deviceIdRow.toggle(hasServer && hasDeviceType);
115
+ $capabilityRow.toggle(hasServer && hasDeviceType && hasDevice);
116
+ $capabilityConfigRow.toggle(hasServer && hasDeviceType && hasDevice && hasCapability && hasCapabilityFields);
117
+ $advancedRow.toggle(hasServer && hasDeviceType && hasDevice && hasCapability);
118
+ }
119
+
98
120
  function parseCapabilityConfig(rawValue) {
99
121
  if (rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
100
122
  return rawValue;
@@ -498,9 +520,7 @@
498
520
  } else if (capabilityDefinition && capabilityDefinition.description) {
499
521
  detail = capabilityDefinition.description;
500
522
  }
501
-
502
- $selectionSummary.text(summary);
503
- $selectionDetail.text(detail);
523
+ syncProgressiveRows();
504
524
  }
505
525
 
506
526
  function syncNameFromSelection() {
@@ -664,6 +684,7 @@
664
684
  $capabilityConfigContainer.empty();
665
685
 
666
686
  if (fields.length === 0) {
687
+ $capabilityConfigRow.data("has-fields", false);
667
688
  $capabilityConfigRow.hide();
668
689
  if (renderOptions.clearStoredConfig) {
669
690
  capabilityConfig = {};
@@ -679,6 +700,7 @@
679
700
  writeCapabilityConfig();
680
701
  }
681
702
 
703
+ $capabilityConfigRow.data("has-fields", true);
682
704
  $capabilityConfigRow.show();
683
705
  fields.forEach(function (field) {
684
706
  const fieldId = "node-input-capability-config-" + field.id;
@@ -1027,17 +1049,15 @@
1027
1049
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-access-black.svg" alt="UniFi Access logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
1028
1050
  </div>
1029
1051
  <div class="form-row unifi-ultimate-hero">
1030
- <div class="unifi-ultimate-hero-panel">
1031
- <strong>Control doors and Access devices from a flow.</strong>
1032
- <span>Choose a door or device, then select the action to run when a message arrives.</span>
1033
- </div>
1052
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
1053
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
1054
+ <span>Youtube Tutorials</span>
1055
+ </a>
1034
1056
  </div>
1035
- <div class="unifi-ultimate-section-title">Connection</div>
1036
1057
  <div class="form-row">
1037
1058
  <label for="node-input-server"><i class="fa fa-cog"></i> Connection</label>
1038
1059
  <input type="text" id="node-input-server">
1039
1060
  </div>
1040
- <div class="unifi-ultimate-section-title">Target</div>
1041
1061
  <div class="form-row">
1042
1062
  <label for="node-input-deviceType"><i class="fa fa-cubes"></i> Control</label>
1043
1063
  <select id="node-input-deviceType"></select>
@@ -1049,17 +1069,10 @@
1049
1069
  <i class="fa fa-refresh"></i>
1050
1070
  </a>
1051
1071
  </div>
1052
- <div class="unifi-ultimate-section-title">Action</div>
1053
1072
  <div class="form-row">
1054
1073
  <label for="node-input-capability"><i class="fa fa-tasks"></i> Action</label>
1055
1074
  <select id="node-input-capability"></select>
1056
1075
  </div>
1057
- <div class="form-row">
1058
- <div class="unifi-ultimate-card">
1059
- <strong id="node-input-selectionSummary">Choose a connection to begin.</strong>
1060
- <div id="node-input-selectionDetail">The editor only shows actions supported by the selected UniFi Access device.</div>
1061
- </div>
1062
- </div>
1063
1076
  <div class="form-row" id="node-row-capabilityConfig" style="display:none;">
1064
1077
  <label><i class="fa fa-sliders"></i> Action options</label>
1065
1078
  <div id="node-input-capabilityConfigContainer" style="width:70%; display:inline-block;"></div>
@@ -1079,6 +1092,8 @@
1079
1092
  </script>
1080
1093
 
1081
1094
  <script type="text/html" data-help-name="unifi-access-device">
1095
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
1096
+
1082
1097
  <p>Use this node to execute a configured UniFi Access action or listen for live Access events.</p>
1083
1098
 
1084
1099
  <h3>Configuration</h3>
@@ -18,34 +18,20 @@
18
18
  },
19
19
  oneditprepare: function () {
20
20
  const $host = $("#node-config-input-host");
21
- const $connectionHint = $("#node-config-input-connectionHint");
21
+ const $apiKey = $("#node-config-input-apiKey");
22
+ const $rejectUnauthorized = $("#node-config-input-rejectUnauthorized");
23
+ const $powerObservationIntervalSeconds = $("#node-config-input-powerObservationIntervalSeconds");
24
+ const $apiKeyRow = $apiKey.closest(".form-row");
25
+ const $securityRow = $rejectUnauthorized.closest(".form-row");
26
+ const $powerObservationRow = $powerObservationIntervalSeconds.closest(".form-row");
27
+ const $advancedRow = $("#node-config-row-advanced");
22
28
 
23
- function escapeHtml(value) {
24
- // The preview is rendered as HTML, so sanitize user input before
25
- // echoing the controller host back into the hint box.
26
- return String(value || "")
27
- .replace(/&/g, "&amp;")
28
- .replace(/</g, "&lt;")
29
- .replace(/>/g, "&gt;")
30
- .replace(/\"/g, "&quot;")
31
- .replace(/'/g, "&#39;");
32
- }
33
-
34
- function refreshConnectionHint() {
35
- const host = String($host.val() || "").trim();
36
- if (!host) {
37
- $connectionHint.html("<strong>Enter your controller address</strong>The node builds the UniFi Network connection automatically.");
38
- return;
39
- }
40
-
41
- // The runtime accepts either a bare host or a full URL, but the
42
- // preview intentionally shows the normalized integration endpoint.
43
- const normalizedHost = host.replace(/^https?:\/\//i, "").replace(/\/+$/, "");
44
- $connectionHint.html(
45
- "<strong>Connection preview</strong>Will connect to <code>https://" +
46
- escapeHtml(normalizedHost) +
47
- "/proxy/network/integration</code>"
48
- );
29
+ function syncProgressiveRows() {
30
+ const hasHost = String($host.val() || "").trim() !== "";
31
+ $apiKeyRow.toggle(hasHost);
32
+ $securityRow.toggle(hasHost);
33
+ $powerObservationRow.toggle(hasHost);
34
+ $advancedRow.toggle(hasHost);
49
35
  }
50
36
 
51
37
  try {
@@ -55,10 +41,9 @@
55
41
  } catch (error) {
56
42
  }
57
43
 
58
- refreshConnectionHint();
44
+ syncProgressiveRows();
59
45
  $host.on("change input", function () {
60
- // Update the preview live as the user edits the controller host.
61
- refreshConnectionHint();
46
+ syncProgressiveRows();
62
47
  });
63
48
  }
64
49
  });
@@ -69,12 +54,11 @@
69
54
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-network-black.svg" alt="UniFi Network logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
70
55
  </div>
71
56
  <div class="form-row unifi-ultimate-hero">
72
- <div class="unifi-ultimate-hero-panel">
73
- <strong>Connect Node-RED to your UniFi Network application.</strong>
74
- <span>Use a local UniFi OS host or IP address and a Network API key.</span>
75
- </div>
57
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
58
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
59
+ <span>Youtube Tutorials</span>
60
+ </a>
76
61
  </div>
77
- <div class="unifi-ultimate-section-title">Connection</div>
78
62
  <div class="form-row">
79
63
  <label for="node-config-input-host"><i class="fa fa-globe"></i> Controller</label>
80
64
  <input type="text" id="node-config-input-host" placeholder="192.168.1.10">
@@ -92,9 +76,6 @@
92
76
  <label for="node-config-input-powerObservationIntervalSeconds"><i class="fa fa-repeat"></i> Power Poll (s)</label>
93
77
  <input type="text" id="node-config-input-powerObservationIntervalSeconds" placeholder="15">
94
78
  </div>
95
- <div class="form-row">
96
- <div id="node-config-input-connectionHint" class="unifi-ultimate-card"></div>
97
- </div>
98
79
  <div id="node-config-row-advanced" class="unifi-ultimate-advanced">
99
80
  <div class="form-row">
100
81
  <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -104,6 +85,8 @@
104
85
  </script>
105
86
 
106
87
  <script type="text/html" data-help-name="unifi-network-config">
88
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
89
+
107
90
  <p>Shared connection for UniFi Network nodes.</p>
108
91
 
109
92
  <h3>Configuration</h3>
@@ -61,14 +61,68 @@
61
61
  const $rowSwitch = $("#node-row-deviceId");
62
62
  const $rowClient = $("#node-row-clientLookupId");
63
63
  const $rowPort = $("#node-row-portIdx");
64
- const $selectionSummary = $("#node-input-selectionSummary");
65
- const $selectionDetail = $("#node-input-selectionDetail");
64
+ const $selectionModeRow = $selectionMode.closest(".form-row");
65
+ const $actionRow = $action.closest(".form-row");
66
+ const $warningRow = $(".unifi-ultimate-warning").closest(".form-row");
67
+ const $advancedRow = $("#node-row-advanced");
66
68
  let suspendChangeHandling = false;
67
69
  let isInitializingEditor = true;
68
70
  let clientTargetsPopulated = false;
69
71
  let clientTargetsLoading = false;
70
72
  let clientsLoadedForServerId = "";
71
73
  let clientsRequestPromise = null;
74
+ let clientWaitOverlayDepth = 0;
75
+
76
+ function hasSelection($field) {
77
+ const value = String($field.val() || "").trim();
78
+ return value !== "" && value !== "_ADD_";
79
+ }
80
+
81
+ function syncProgressiveRows() {
82
+ const hasServer = hasSelection($server);
83
+ const mode = getSelectionMode();
84
+ const hasSwitch = hasSelection($deviceId);
85
+ const hasPort = hasSelection($portIdx);
86
+ const hasClient = hasSelection($clientLookupId);
87
+ const hasTarget = mode === "client" ? hasClient : (hasSwitch && hasPort);
88
+ const hasAction = hasSelection($action);
89
+
90
+ $selectionModeRow.toggle(hasServer);
91
+ $rowSwitch.toggle(hasServer && mode === "switchPort");
92
+ $rowPort.toggle(hasServer && mode === "switchPort" && hasSwitch);
93
+ $rowClient.toggle(hasServer && mode === "client");
94
+ $actionRow.toggle(hasServer && hasTarget);
95
+ $warningRow.toggle(hasServer && hasTarget && hasAction);
96
+ $advancedRow.toggle(hasServer && hasTarget && hasAction);
97
+ }
98
+
99
+ function setClientWaitOverlay(visible, message) {
100
+ const $overlay = $("#node-input-clientWaitOverlay");
101
+ const $message = $("#node-input-clientWaitMessage");
102
+ if ($overlay.length === 0) {
103
+ return;
104
+ }
105
+
106
+ if (message) {
107
+ $message.text(message);
108
+ }
109
+
110
+ $overlay.css("display", visible === true ? "flex" : "none");
111
+ }
112
+
113
+ function withClientWait(message, work) {
114
+ clientWaitOverlayDepth += 1;
115
+ setClientWaitOverlay(true, message || "Loading client target...");
116
+
117
+ return Promise.resolve()
118
+ .then(work)
119
+ .finally(function () {
120
+ clientWaitOverlayDepth = Math.max(0, clientWaitOverlayDepth - 1);
121
+ if (clientWaitOverlayDepth === 0) {
122
+ setClientWaitOverlay(false);
123
+ }
124
+ });
125
+ }
72
126
 
73
127
  function getSelectedActionValue() {
74
128
  return String($action.val() || node.action || "msgPayload").trim().toLowerCase();
@@ -392,16 +446,7 @@
392
446
  }
393
447
 
394
448
  function refreshSelectionModeUi() {
395
- const mode = getSelectionMode();
396
- if (mode === "client") {
397
- $rowClient.show();
398
- $rowSwitch.hide();
399
- $rowPort.hide();
400
- } else {
401
- $rowClient.hide();
402
- $rowSwitch.show();
403
- $rowPort.show();
404
- }
449
+ syncProgressiveRows();
405
450
  updateDerivedTargetFieldsState();
406
451
  }
407
452
 
@@ -410,7 +455,9 @@
410
455
  if (getSelectionMode() !== "client" || clientTargetsLoading) {
411
456
  return;
412
457
  }
413
- loadClients({ showLoading: false });
458
+ withClientWait("Loading client targets...", function () {
459
+ return loadClients({ showLoading: false });
460
+ });
414
461
  }
415
462
 
416
463
  $clientLookupId
@@ -465,9 +512,7 @@
465
512
  if (selectedActionUsesPayloadControl()) {
466
513
  detail = "Send msg.payload=true to enable PoE, or msg.payload=false to disable PoE.";
467
514
  }
468
-
469
- $selectionSummary.text(summary);
470
- $selectionDetail.text(detail);
515
+ syncProgressiveRows();
471
516
  }
472
517
 
473
518
  function refreshActionUi() {
@@ -692,8 +737,6 @@
692
737
  .prop("disabled", true);
693
738
  bindLazyClientLookupLoad();
694
739
  updateDerivedTargetFieldsState();
695
- $selectionSummary.text("Loading client targets...");
696
- $selectionDetail.text("Please wait while UniFi returns clients and switch-port attachments.");
697
740
  }
698
741
 
699
742
  function hasOptionValue($select, value) {
@@ -882,10 +925,19 @@
882
925
  return;
883
926
  }
884
927
  clientsLoadedForServerId = "";
885
- loadEditorData({
886
- loadClients: getSelectionMode() === "client",
887
- forceClients: true
888
- });
928
+ if (getSelectionMode() === "client") {
929
+ withClientWait("Loading client targets...", function () {
930
+ return loadEditorData({
931
+ loadClients: true,
932
+ forceClients: true
933
+ });
934
+ });
935
+ } else {
936
+ loadEditorData({
937
+ loadClients: false,
938
+ forceClients: true
939
+ });
940
+ }
889
941
  });
890
942
 
891
943
  $deviceId.on("change", function () {
@@ -913,8 +965,10 @@
913
965
  refreshSelectionModeUi();
914
966
  rememberSelectedTargetName();
915
967
  if (getSelectionMode() === "client") {
916
- loadClients({ showLoading: false }).then(function () {
917
- return applySelectedClientTarget();
968
+ withClientWait("Loading client targets...", function () {
969
+ return loadClients({ showLoading: false }).then(function () {
970
+ return applySelectedClientTarget();
971
+ });
918
972
  });
919
973
  } else {
920
974
  refreshSummary();
@@ -928,7 +982,9 @@
928
982
  const isUserSelection = $clientLookupId.data("unifi-user-selection") === true;
929
983
  $clientLookupId.removeData("unifi-user-selection");
930
984
  if (getSelectionMode() === "client") {
931
- applySelectedClientTarget({ syncName: isUserSelection });
985
+ withClientWait("Resolving client switch and port...", function () {
986
+ return applySelectedClientTarget({ syncName: isUserSelection });
987
+ });
932
988
  } else {
933
989
  refreshSummary();
934
990
  }
@@ -944,10 +1000,12 @@
944
1000
  });
945
1001
  $refreshClients.on("click", function (event) {
946
1002
  event.preventDefault();
947
- loadClients({ force: true }).then(function () {
948
- if (getSelectionMode() === "client") {
949
- return applySelectedClientTarget();
950
- }
1003
+ withClientWait("Loading client targets...", function () {
1004
+ return loadClients({ force: true }).then(function () {
1005
+ if (getSelectionMode() === "client") {
1006
+ return applySelectedClientTarget();
1007
+ }
1008
+ });
951
1009
  });
952
1010
  });
953
1011
 
@@ -976,17 +1034,21 @@
976
1034
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-network-black.svg" alt="UniFi Network logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
977
1035
  </div>
978
1036
  <div class="form-row unifi-ultimate-hero">
979
- <div class="unifi-ultimate-hero-panel">
980
- <strong>Control power on a switch port.</strong>
981
- <span>Target a switch and port directly, or pick a client and let UniFi resolve the connected port.</span>
1037
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
1038
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
1039
+ <span>Youtube Tutorials</span>
1040
+ </a>
1041
+ </div>
1042
+ <div id="node-input-clientWaitOverlay" class="unifi-ultimate-wait-overlay" style="display:none;">
1043
+ <div class="unifi-ultimate-wait-dialog">
1044
+ <div class="unifi-ultimate-wait-spinner"></div>
1045
+ <div id="node-input-clientWaitMessage">Loading client target...</div>
982
1046
  </div>
983
1047
  </div>
984
- <div class="unifi-ultimate-section-title">Connection</div>
985
1048
  <div class="form-row">
986
1049
  <label for="node-input-server"><i class="fa fa-cog"></i> Connection</label>
987
1050
  <input type="text" id="node-input-server">
988
1051
  </div>
989
- <div class="unifi-ultimate-section-title">Target</div>
990
1052
  <div class="form-row">
991
1053
  <label for="node-input-selectionMode"><i class="fa fa-crosshairs"></i> Search by</label>
992
1054
  <select id="node-input-selectionMode">
@@ -1012,7 +1074,6 @@
1012
1074
  <label for="node-input-portIdx"><i class="fa fa-plug"></i> Port</label>
1013
1075
  <select id="node-input-portIdx"></select>
1014
1076
  </div>
1015
- <div class="unifi-ultimate-section-title">Action</div>
1016
1077
  <div class="form-row">
1017
1078
  <label for="node-input-action"><i class="fa fa-power-off"></i> Action</label>
1018
1079
  <select id="node-input-action">
@@ -1023,12 +1084,6 @@
1023
1084
  <option value="emitPowerConsumption">Emit Power Consumption</option>
1024
1085
  </select>
1025
1086
  </div>
1026
- <div class="form-row">
1027
- <div class="unifi-ultimate-card">
1028
- <strong id="node-input-selectionSummary">Choose a switch and a port.</strong>
1029
- <div id="node-input-selectionDetail">This node sends a port action request to UniFi Network.</div>
1030
- </div>
1031
- </div>
1032
1087
  <div class="form-row">
1033
1088
  <div class="unifi-ultimate-card unifi-ultimate-warning">
1034
1089
  <strong>Power actions can disconnect devices.</strong>
@@ -1049,6 +1104,8 @@
1049
1104
  </script>
1050
1105
 
1051
1106
  <script type="text/html" data-help-name="unifi-network-control-poe">
1107
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
1108
+
1052
1109
  <p>Controls PoE on a selected UniFi switch port.</p>
1053
1110
 
1054
1111
  <h3>Configuration</h3>
@@ -85,8 +85,10 @@
85
85
  const $capabilityConfigRow = $("#node-row-capabilityConfig");
86
86
  const $capabilityConfigContainer = $("#node-input-capabilityConfigContainer");
87
87
  const $refresh = $("#node-input-refreshDevices");
88
- const $selectionSummary = $("#node-input-selectionSummary");
89
- const $selectionDetail = $("#node-input-selectionDetail");
88
+ const $deviceTypeRow = $deviceType.closest(".form-row");
89
+ const $deviceIdRow = $deviceId.closest(".form-row");
90
+ const $capabilityRow = $capability.closest(".form-row");
91
+ const $advancedRow = $("#node-row-advanced");
90
92
  let capabilityConfig = parseCapabilityConfig(node.capabilityConfig);
91
93
  let capabilityListRequestId = 0;
92
94
  let capabilityOptionsRequestId = 0;
@@ -96,6 +98,26 @@
96
98
  let capabilityDefinitions = [];
97
99
  let clientTargetsLoading = false;
98
100
  let clientTargetsPopulated = false;
101
+
102
+ function hasSelection($field) {
103
+ const value = String($field.val() || "").trim();
104
+ return value !== "" && value !== "_ADD_";
105
+ }
106
+
107
+ function syncProgressiveRows() {
108
+ const hasServer = hasSelection($server);
109
+ const hasDeviceType = hasSelection($deviceType);
110
+ const hasDevice = hasSelection($deviceId);
111
+ const hasCapability = hasSelection($capability);
112
+ const hasCapabilityFields = $capabilityConfigRow.data("has-fields") === true;
113
+
114
+ $deviceTypeRow.toggle(hasServer);
115
+ $deviceIdRow.toggle(hasServer && hasDeviceType);
116
+ $capabilityRow.toggle(hasServer && hasDeviceType && hasDevice);
117
+ $capabilityConfigRow.toggle(hasServer && hasDeviceType && hasDevice && hasCapability && hasCapabilityFields);
118
+ $advancedRow.toggle(hasServer && hasDeviceType && hasDevice && hasCapability);
119
+ }
120
+
99
121
  function parseCapabilityConfig(rawValue) {
100
122
  if (rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
101
123
  return rawValue;
@@ -551,9 +573,7 @@
551
573
  } else if (capabilityDefinition && capabilityDefinition.description) {
552
574
  detail = capabilityDefinition.description;
553
575
  }
554
-
555
- $selectionSummary.text(summary);
556
- $selectionDetail.text(detail);
576
+ syncProgressiveRows();
557
577
  }
558
578
 
559
579
  function syncNameFromSelection() {
@@ -720,6 +740,7 @@
720
740
  $capabilityConfigContainer.empty();
721
741
 
722
742
  if (fields.length === 0) {
743
+ $capabilityConfigRow.data("has-fields", false);
723
744
  $capabilityConfigRow.hide();
724
745
  if (renderOptions.clearStoredConfig) {
725
746
  capabilityConfig = {};
@@ -736,6 +757,7 @@
736
757
  writeCapabilityConfig();
737
758
  }
738
759
 
760
+ $capabilityConfigRow.data("has-fields", true);
739
761
  $capabilityConfigRow.show();
740
762
  fields.forEach(function (field) {
741
763
  const fieldId = "node-input-capability-config-" + field.id;
@@ -894,8 +916,6 @@
894
916
  .val(label)
895
917
  .prop("disabled", true);
896
918
  updateDerivedFieldsState();
897
- $selectionSummary.text(label);
898
- $selectionDetail.text("Please wait while UniFi returns the list.");
899
919
  }
900
920
 
901
921
  function loadCapabilities() {
@@ -1130,17 +1150,15 @@
1130
1150
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-network-black.svg" alt="UniFi Network logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
1131
1151
  </div>
1132
1152
  <div class="form-row unifi-ultimate-hero">
1133
- <div class="unifi-ultimate-hero-panel">
1134
- <strong>Choose a site, UniFi device, or client.</strong>
1135
- <span>The node shows only actions that make sense for the selected item.</span>
1136
- </div>
1153
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
1154
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
1155
+ <span>Youtube Tutorials</span>
1156
+ </a>
1137
1157
  </div>
1138
- <div class="unifi-ultimate-section-title">Connection</div>
1139
1158
  <div class="form-row">
1140
1159
  <label for="node-input-server"><i class="fa fa-cog"></i> Connection</label>
1141
1160
  <input type="text" id="node-input-server">
1142
1161
  </div>
1143
- <div class="unifi-ultimate-section-title">Target</div>
1144
1162
  <div class="form-row">
1145
1163
  <label for="node-input-deviceType"><i class="fa fa-cubes"></i> Resource</label>
1146
1164
  <select id="node-input-deviceType"></select>
@@ -1152,17 +1170,10 @@
1152
1170
  <i class="fa fa-refresh"></i>
1153
1171
  </a>
1154
1172
  </div>
1155
- <div class="unifi-ultimate-section-title">Action</div>
1156
1173
  <div class="form-row">
1157
1174
  <label for="node-input-capability"><i class="fa fa-tasks"></i> Action</label>
1158
1175
  <select id="node-input-capability"></select>
1159
1176
  </div>
1160
- <div class="form-row">
1161
- <div class="unifi-ultimate-card">
1162
- <strong id="node-input-selectionSummary">Choose a connection to begin.</strong>
1163
- <div id="node-input-selectionDetail">The editor only shows actions supported by the selected UniFi Network item.</div>
1164
- </div>
1165
- </div>
1166
1177
  <div class="form-row" id="node-row-capabilityConfig" style="display:none;">
1167
1178
  <label><i class="fa fa-sliders"></i> Action options</label>
1168
1179
  <div id="node-input-capabilityConfigContainer" style="width:70%; display:inline-block;"></div>
@@ -1182,6 +1193,8 @@
1182
1193
  </script>
1183
1194
 
1184
1195
  <script type="text/html" data-help-name="unifi-network-device">
1196
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
1197
+
1185
1198
  <p>Use this node to execute a configured UniFi Network action on a selected site, UniFi device, or client.</p>
1186
1199
 
1187
1200
  <h3>Configuration</h3>
@@ -30,10 +30,23 @@
30
30
  const $clientId = $("#node-input-clientId");
31
31
  const $deviceName = $("#node-input-deviceName");
32
32
  const $refresh = $("#node-input-refreshClients");
33
- const $selectionSummary = $("#node-input-selectionSummary");
34
- const $selectionDetail = $("#node-input-selectionDetail");
33
+ const $clientRow = $clientId.closest(".form-row");
34
+ const $advancedRow = $("#node-row-advanced");
35
35
  let suspendChangeHandling = false;
36
36
 
37
+ function hasSelection($field) {
38
+ const value = String($field.val() || "").trim();
39
+ return value !== "" && value !== "_ADD_";
40
+ }
41
+
42
+ function syncProgressiveRows() {
43
+ const hasServer = hasSelection($server);
44
+ const hasClient = hasSelection($clientId);
45
+
46
+ $clientRow.toggle(hasServer);
47
+ $advancedRow.toggle(hasServer && hasClient);
48
+ }
49
+
37
50
  function requestJson(url) {
38
51
  return new Promise(function (resolve, reject) {
39
52
  $.getJSON(url, function (data) {
@@ -316,9 +329,7 @@
316
329
  summary = "Monitoring presence for " + clientName + ".";
317
330
  detail = "Connect and disconnect hysteresis reduce false flapping on unstable links.";
318
331
  }
319
-
320
- $selectionSummary.text(summary);
321
- $selectionDetail.text(detail);
332
+ syncProgressiveRows();
322
333
  }
323
334
 
324
335
  function syncNameFromSelection() {
@@ -397,8 +408,6 @@
397
408
  $("#node-input-clientId-search")
398
409
  .val("Loading clients, please wait...")
399
410
  .prop("disabled", true);
400
- $selectionSummary.text("Loading clients...");
401
- $selectionDetail.text("Please wait while UniFi returns the client list.");
402
411
  }
403
412
 
404
413
  function loadClients() {
@@ -471,17 +480,15 @@
471
480
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-network-black.svg" alt="UniFi Network logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
472
481
  </div>
473
482
  <div class="form-row unifi-ultimate-hero">
474
- <div class="unifi-ultimate-hero-panel">
475
- <strong>Track one client with stable true/false output.</strong>
476
- <span>Hysteresis avoids noisy online/offline transitions when Wi-Fi clients roam.</span>
477
- </div>
483
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
484
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
485
+ <span>Youtube Tutorials</span>
486
+ </a>
478
487
  </div>
479
- <div class="unifi-ultimate-section-title">Connection</div>
480
488
  <div class="form-row">
481
489
  <label for="node-input-server"><i class="fa fa-cog"></i> Connection</label>
482
490
  <input type="text" id="node-input-server">
483
491
  </div>
484
- <div class="unifi-ultimate-section-title">Client</div>
485
492
  <div class="form-row">
486
493
  <label for="node-input-clientId"><i class="fa fa-wifi"></i> Client</label>
487
494
  <select id="node-input-clientId" style="width:70%;"></select>
@@ -489,12 +496,6 @@
489
496
  <i class="fa fa-refresh"></i>
490
497
  </a>
491
498
  </div>
492
- <div class="form-row">
493
- <div class="unifi-ultimate-card">
494
- <strong id="node-input-selectionSummary">Choose a connection to begin.</strong>
495
- <div id="node-input-selectionDetail">Select one client. The node emits true when connected and false when disconnected.</div>
496
- </div>
497
- </div>
498
499
  <div id="node-row-advanced" class="unifi-ultimate-advanced">
499
500
  <div class="form-row">
500
501
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -521,6 +522,8 @@
521
522
  </script>
522
523
 
523
524
  <script type="text/html" data-help-name="unifi-network-presence">
525
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
526
+
524
527
  <p>Detects whether a selected UniFi Network client is currently connected.</p>
525
528
 
526
529
  <h3>Configuration</h3>
@@ -18,34 +18,17 @@
18
18
  },
19
19
  oneditprepare: function () {
20
20
  const $host = $("#node-config-input-host");
21
- const $connectionHint = $("#node-config-input-connectionHint");
21
+ const $apiKey = $("#node-config-input-apiKey");
22
+ const $rejectUnauthorized = $("#node-config-input-rejectUnauthorized");
23
+ const $apiKeyRow = $apiKey.closest(".form-row");
24
+ const $securityRow = $rejectUnauthorized.closest(".form-row");
25
+ const $advancedRow = $("#node-config-row-advanced");
22
26
 
23
- function escapeHtml(value) {
24
- // The preview is injected as HTML, so sanitize user-controlled
25
- // host values before displaying them in the summary card.
26
- return String(value || "")
27
- .replace(/&/g, "&amp;")
28
- .replace(/</g, "&lt;")
29
- .replace(/>/g, "&gt;")
30
- .replace(/"/g, "&quot;")
31
- .replace(/'/g, "&#39;");
32
- }
33
-
34
- function refreshConnectionHint() {
35
- const host = String($host.val() || "").trim();
36
- if (!host) {
37
- $connectionHint.html("<strong>Enter your controller address</strong>The node builds the Protect connection automatically.");
38
- return;
39
- }
40
-
41
- // The runtime normalizes the host and then appends the Protect
42
- // integration proxy path. Mirror that behavior in the preview.
43
- const normalizedHost = host.replace(/^https?:\/\//i, "").replace(/\/+$/, "");
44
- $connectionHint.html(
45
- "<strong>Connection preview</strong>Will connect to <code>https://" +
46
- escapeHtml(normalizedHost) +
47
- "/proxy/protect/integration</code>"
48
- );
27
+ function syncProgressiveRows() {
28
+ const hasHost = String($host.val() || "").trim() !== "";
29
+ $apiKeyRow.toggle(hasHost);
30
+ $securityRow.toggle(hasHost);
31
+ $advancedRow.toggle(hasHost);
49
32
  }
50
33
 
51
34
  try {
@@ -55,11 +38,10 @@
55
38
  } catch (error) {
56
39
  }
57
40
 
58
- refreshConnectionHint();
41
+ syncProgressiveRows();
59
42
 
60
43
  $host.on("change input", function () {
61
- // Refresh the preview in real time when the controller changes.
62
- refreshConnectionHint();
44
+ syncProgressiveRows();
63
45
  });
64
46
 
65
47
  }
@@ -71,12 +53,11 @@
71
53
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-protect-black.svg" alt="UniFi Protect logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
72
54
  </div>
73
55
  <div class="form-row unifi-ultimate-hero">
74
- <div class="unifi-ultimate-hero-panel">
75
- <strong>Connect Node-RED to your UniFi Protect application.</strong>
76
- <span>Use a UniFi OS host or IP address and a Protect API key.</span>
77
- </div>
56
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
57
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
58
+ <span>Youtube Tutorials</span>
59
+ </a>
78
60
  </div>
79
- <div class="unifi-ultimate-section-title">Connection</div>
80
61
  <div class="form-row">
81
62
  <label for="node-config-input-host"><i class="fa fa-globe"></i> Controller</label>
82
63
  <input type="text" id="node-config-input-host" placeholder="192.168.1.10">
@@ -90,9 +71,6 @@
90
71
  <input type="checkbox" id="node-config-input-rejectUnauthorized" style="display:inline-block; width:auto; vertical-align:top;">
91
72
  <span style="margin-left:8px;">Secure connection only</span>
92
73
  </div>
93
- <div class="form-row">
94
- <div id="node-config-input-connectionHint" class="unifi-ultimate-card"></div>
95
- </div>
96
74
  <div id="node-config-row-advanced" class="unifi-ultimate-advanced">
97
75
  <div class="form-row">
98
76
  <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
@@ -106,6 +84,8 @@
106
84
  </script>
107
85
 
108
86
  <script type="text/html" data-help-name="unifi-protect-config">
87
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
88
+
109
89
  <p>Shared connection for UniFi Protect nodes.</p>
110
90
 
111
91
  <h3>Configuration</h3>
@@ -86,8 +86,10 @@
86
86
  const $capabilityConfigRow = $("#node-row-capabilityConfig");
87
87
  const $capabilityConfigContainer = $("#node-input-capabilityConfigContainer");
88
88
  const $refresh = $("#node-input-refreshDevices");
89
- const $selectionSummary = $("#node-input-selectionSummary");
90
- const $selectionDetail = $("#node-input-selectionDetail");
89
+ const $deviceTypeRow = $deviceType.closest(".form-row");
90
+ const $deviceIdRow = $deviceId.closest(".form-row");
91
+ const $capabilityRow = $capability.closest(".form-row");
92
+ const $advancedRow = $("#node-row-advanced");
91
93
  let capabilityConfig = parseCapabilityConfig(node.capabilityConfig);
92
94
  let capabilityListRequestId = 0;
93
95
  let capabilityOptionsRequestId = 0;
@@ -95,6 +97,26 @@
95
97
  let isInitializingEditor = true;
96
98
  let deviceTypeDefinitions = [];
97
99
  let capabilityDefinitions = [];
100
+
101
+ function hasSelection($field) {
102
+ const value = String($field.val() || "").trim();
103
+ return value !== "" && value !== "_ADD_";
104
+ }
105
+
106
+ function syncProgressiveRows() {
107
+ const hasServer = hasSelection($server);
108
+ const hasDeviceType = hasSelection($deviceType);
109
+ const hasDevice = hasSelection($deviceId);
110
+ const hasCapability = hasSelection($capability);
111
+ const hasCapabilityFields = $capabilityConfigRow.data("has-fields") === true;
112
+
113
+ $deviceTypeRow.toggle(hasServer);
114
+ $deviceIdRow.toggle(hasServer && hasDeviceType);
115
+ $capabilityRow.toggle(hasServer && hasDeviceType && hasDevice);
116
+ $capabilityConfigRow.toggle(hasServer && hasDeviceType && hasDevice && hasCapability && hasCapabilityFields);
117
+ $advancedRow.toggle(hasServer && hasDeviceType && hasDevice && hasCapability);
118
+ }
119
+
98
120
  function parseCapabilityConfig(rawValue) {
99
121
  if (rawValue && typeof rawValue === "object" && !Array.isArray(rawValue)) {
100
122
  return rawValue;
@@ -487,9 +509,7 @@
487
509
  } else if (capabilityDefinition && capabilityDefinition.description) {
488
510
  detail = capabilityDefinition.description;
489
511
  }
490
-
491
- $selectionSummary.text(summary);
492
- $selectionDetail.text(detail);
512
+ syncProgressiveRows();
493
513
  }
494
514
 
495
515
  function syncNameFromSelection() {
@@ -668,6 +688,7 @@
668
688
  $capabilityConfigContainer.empty();
669
689
 
670
690
  if (fields.length === 0) {
691
+ $capabilityConfigRow.data("has-fields", false);
671
692
  $capabilityConfigRow.hide();
672
693
  if (renderOptions.clearStoredConfig) {
673
694
  capabilityConfig = {};
@@ -683,6 +704,7 @@
683
704
  writeCapabilityConfig();
684
705
  }
685
706
 
707
+ $capabilityConfigRow.data("has-fields", true);
686
708
  $capabilityConfigRow.show();
687
709
  fields.forEach(function (field) {
688
710
  const fieldId = "node-input-capability-config-" + field.id;
@@ -1038,17 +1060,15 @@
1038
1060
  <img class="unifi-ultimate-product-logo" src="resources/node-red-contrib-unifi-ultimate/logos/unifi-protect-black.svg" alt="UniFi Protect logo" onerror="this.closest('.unifi-ultimate-product-logo-row').style.display='none';">
1039
1061
  </div>
1040
1062
  <div class="form-row unifi-ultimate-hero">
1041
- <div class="unifi-ultimate-hero-panel">
1042
- <strong>Monitor cameras, sensors, viewers, and NVR state.</strong>
1043
- <span>Select a Protect item, then choose whether to read, listen, or control it.</span>
1044
- </div>
1063
+ <a class="unifi-ultimate-youtube-link" href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer">
1064
+ <img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18">
1065
+ <span>Youtube Tutorials</span>
1066
+ </a>
1045
1067
  </div>
1046
- <div class="unifi-ultimate-section-title">Connection</div>
1047
1068
  <div class="form-row">
1048
1069
  <label for="node-input-server"><i class="fa fa-cog"></i> Connection</label>
1049
1070
  <input type="text" id="node-input-server">
1050
1071
  </div>
1051
- <div class="unifi-ultimate-section-title">Target</div>
1052
1072
  <div class="form-row">
1053
1073
  <label for="node-input-deviceType"><i class="fa fa-cubes"></i> Control</label>
1054
1074
  <select id="node-input-deviceType"></select>
@@ -1060,17 +1080,10 @@
1060
1080
  <i class="fa fa-refresh"></i>
1061
1081
  </a>
1062
1082
  </div>
1063
- <div class="unifi-ultimate-section-title">Action</div>
1064
1083
  <div class="form-row">
1065
1084
  <label for="node-input-capability"><i class="fa fa-tasks"></i> Action</label>
1066
1085
  <select id="node-input-capability"></select>
1067
1086
  </div>
1068
- <div class="form-row">
1069
- <div class="unifi-ultimate-card">
1070
- <strong id="node-input-selectionSummary">Choose a connection to begin.</strong>
1071
- <div id="node-input-selectionDetail">The editor only shows actions supported by the selected UniFi Protect device.</div>
1072
- </div>
1073
- </div>
1074
1087
  <div class="form-row" id="node-row-capabilityConfig" style="display:none;">
1075
1088
  <label><i class="fa fa-sliders"></i> Action options</label>
1076
1089
  <div id="node-input-capabilityConfigContainer" style="width:70%; display:inline-block;"></div>
@@ -1090,6 +1103,8 @@
1090
1103
  </script>
1091
1104
 
1092
1105
  <script type="text/html" data-help-name="unifi-protect-device">
1106
+ <p><a href="https://www.youtube.com/watch?v=ZOq7M5mgUBk&list=PL9Yh1bjbLAYrWKtMlopN0swuQXbdJ8MFJ" target="_blank" rel="noopener noreferrer"><img src="resources/node-red-contrib-unifi-ultimate/logos/youtube-icon.svg" alt="YouTube" width="24" height="18" style="vertical-align:text-bottom; margin-right:6px;">Youtube Tutorials</a></p>
1107
+
1093
1108
  <p>Use this node to execute a configured UniFi Protect action or listen for live Protect events.</p>
1094
1109
 
1095
1110
  <h3>Configuration</h3>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-unifi-ultimate",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Node-RED nodes for Ubiquiti UniFi integrations, including UniFi Protect, UniFi Access, and UniFi Network.",
5
5
  "files": [
6
6
  "nodes/",
@@ -13,45 +13,19 @@
13
13
  margin: 0 0 14px 0;
14
14
  }
15
15
 
16
- .unifi-ultimate-hero-panel {
17
- padding: 14px 16px;
18
- border: 1px solid #d9e7f5;
19
- border-radius: 14px;
20
- background: linear-gradient(135deg, #eef7ff 0%, #f8fbff 58%, #f7fafc 100%);
21
- box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
22
- color: #334155;
23
- }
24
-
25
- .unifi-ultimate-eyebrow {
26
- margin-bottom: 4px;
27
- color: #2563eb;
28
- font-size: 11px;
29
- font-weight: 700;
30
- letter-spacing: 0.08em;
31
- text-transform: uppercase;
32
- }
33
-
34
- .unifi-ultimate-hero-panel strong {
35
- display: block;
36
- color: #0f172a;
37
- font-size: 15px;
38
- line-height: 1.35;
39
- }
40
-
41
- .unifi-ultimate-hero-panel span {
42
- display: block;
43
- margin-top: 4px;
44
- line-height: 1.45;
16
+ .unifi-ultimate-youtube-link {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: 8px;
20
+ color: #d92323;
21
+ font-weight: 600;
22
+ line-height: 1.4;
23
+ text-decoration: none;
45
24
  }
46
25
 
47
- .unifi-ultimate-section-title {
48
- margin: 14px 0 8px 150px;
49
- color: #64748b;
50
- font-size: 11px;
51
- font-weight: 700;
52
- letter-spacing: 0.08em;
53
- text-transform: uppercase;
54
- text-align: left;
26
+ .unifi-ultimate-youtube-link:hover {
27
+ color: #b91c1c;
28
+ text-decoration: underline;
55
29
  }
56
30
 
57
31
  .unifi-ultimate-card {
@@ -91,3 +65,42 @@
91
65
  .unifi-ultimate-warning strong {
92
66
  color: #9a3412;
93
67
  }
68
+
69
+ .unifi-ultimate-wait-overlay {
70
+ position: fixed;
71
+ inset: 0;
72
+ z-index: 2000;
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ background: rgba(248, 250, 252, 0.72);
77
+ }
78
+
79
+ .unifi-ultimate-wait-dialog {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 12px;
83
+ min-width: 220px;
84
+ padding: 14px 16px;
85
+ border: 1px solid #e2e8f0;
86
+ border-radius: 8px;
87
+ background: #ffffff;
88
+ color: #334155;
89
+ font-weight: 600;
90
+ box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
91
+ }
92
+
93
+ .unifi-ultimate-wait-spinner {
94
+ width: 22px;
95
+ height: 22px;
96
+ border: 3px solid #fecaca;
97
+ border-top-color: #dc2626;
98
+ border-radius: 50%;
99
+ animation: unifi-ultimate-spin 0.8s linear infinite;
100
+ }
101
+
102
+ @keyframes unifi-ultimate-spin {
103
+ to {
104
+ transform: rotate(360deg);
105
+ }
106
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 20" role="img" aria-labelledby="title">
2
+ <title id="title">YouTube</title>
3
+ <path fill="#FF0000" d="M27.4 3.1c-.3-1.2-1.3-2.1-2.5-2.4C22.7.1 14 .1 14 .1S5.3.1 3.1.7C1.9 1 .9 1.9.6 3.1 0 5.3 0 10 0 10s0 4.7.6 6.9c.3 1.2 1.3 2.1 2.5 2.4 2.2.6 10.9.6 10.9.6s8.7 0 10.9-.6c1.2-.3 2.1-1.2 2.5-2.4.6-2.2.6-6.9.6-6.9s0-4.7-.6-6.9z"/>
4
+ <path fill="#FFFFFF" d="M11.2 14.2 18.5 10l-7.3-4.2v8.4z"/>
5
+ </svg>