Click once work, UI fixes.

Ylian Saint-Hilaire committed Mar 22, 2021 at 20:04 UTC d750077f451e3e4b56f99d628be3b0b7adaa1d35
5 files changed +31 -8
amtmanager.js
+22
@@ -295,6 +295,11 @@ module.exports.CreateAmtManager = function (parent) {
295 if (Array.isArray(event.nodeids)) { for (var i in event.nodeids) { performPowerAction(event.nodeids[i], 2); } }
296 break;
297 }
298 + case 'clickoncerecovery': { // React to Intel AMT Click Once Recovery command
299 + if (event.noact == 1) return; // Take no action on these events. We are likely in peering mode and need to only act when the database signals the change in state.
300 + if (Array.isArray(event.nodeids)) { for (var i in event.nodeids) { performClickOnceRecoveryAction(event.nodeids[i], event.file); } }
301 + break;
302 + }
303 case 'changenode': { // React to changes in a device
304 var devices = obj.amtDevices[event.nodeid], rescan = false;
305 if (devices != null) {
@@ -805,6 +810,23 @@ module.exports.CreateAmtManager = function (parent) {
810 }
811
812
813 + // Perform Intel AMT Click Once Recovery on a device
814 + function performClickOnceRecoveryAction(nodeid, file) {
815 + var devices = obj.amtDevices[nodeid];
816 + if (devices == null) return;
817 + for (var i in devices) {
818 + var dev = devices[i];
819 + // If not LMS, has a AMT stack present and is in connected state, perform operation.
820 + if ((dev.connType != 2) && (dev.state == 1) && (dev.amtstack != null)) {
821 + console.log('Perform Click Once Recovery', nodeid, file);
822 +
823 + // TODO: Make sure the MPS server root certificate is present.
824 + // TODO: Generate the one-time URL.
825 + // TODO: Issue the WSMAN command.
826 + }
827 + }
828 + }
829 +
830 //
831 // Intel AMT Clock Syncronization
832 //
meshuser.js
+2 -2
@@ -5510,8 +5510,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
5510 // Check if we found this device and if we have full rights
5511 if ((node == null) || (rights != 0xFFFFFFFF)) return;
5512
5513 - // Perform Intel AMT Click Once Recovery
5514 - console.log('ClickOnceRecovery', node._id, file.fullpath);
5513 + // Event Intel AMT Click Once Recovery, this will cause Intel AMT wake operations on this and other servers.
5514 + parent.parent.DispatchEvent('*', obj, { action: 'clickoncerecovery', userid: user._id, username: user.name, nodeids: [node._id], domain: domain.id, nolog: 1, file: file.fullpath });
5515 });
5516 }
5517
public/styles/style.css
+1
@@ -2385,6 +2385,7 @@ a {
2385 grid-area: deskarea1;
2386 -ms-grid-column: 1;
2387 -ms-grid-row: 1;
2388 + height: 20px;
2389 }
2390
2391
views/default.handlebars
+3 -3
@@ -582,7 +582,7 @@
582 <span id=connectbutton1span><input type=button id=connectbutton1 cmenu="deskConnectButton" value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
583 <span id=connectbutton1hspan>&nbsp;<input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel&reg; AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
584 <span id=disconnectbutton1span>&nbsp;<input type=button id=disconnectbutton1 value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span>
585 - &nbsp;<span id="deskstatus">Disconnected</span><span id="deskmetadata"></span>
585 + &nbsp;<span id="deskstatus" style="line-height:22px">Disconnected</span><span id="deskmetadata"></span>
586 </div>
587 </div>
588 <div id=deskarea2 style="">
@@ -676,7 +676,7 @@
676 <span id="connectbutton2span"><input type="button" id="connectbutton2" cmenu="termConnectButton" value="Connect" onclick=connectTerminal(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
677 <span id="connectbutton2hspan">&nbsp;<input type="button" id="connectbutton2h" value="HW Connect" title="Connect using Intel&reg; AMT hardware KVM" onclick=connectTerminal(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
678 <span id="disconnectbutton2span">&nbsp;<input type="button" id="disconnectbutton2" value="Disconnect" onclick=connectTerminal(event,0) onkeypress="return false" onkeydown="return false" /></span>
679 - &nbsp;<span id="termstatus">Disconnected</span><span id="termtitle"></span>
679 + &nbsp;<span id="termstatus" style="line-height:22px">Disconnected</span><span id="termtitle"></span>
680 </div>
681 </td>
682 </tr>
@@ -6613,7 +6613,7 @@
6613 if (((currentNode.conn & 1) != 0) && ((rights & 131072) != 0)) { count++; y += '<option value=106>' + "Run Commands" + '</option>'; } // Remote command permission
6614 if ((currentNode.conn != 0) && ((rights & 262144) != 0)) { count++; y += '<option value=4>' + "Sleep" + '</option><option value=3>' + "Reset" + '</option><option value=2>' + "Power off" + '</option>'; }
6615 if ((currentNode.conn & 16) != 0) { count++; y += '<option value=103>' + "Send MQTT Message" + '</option>'; }
6616 - if ((getNodeAmtVersion(currentNode) >= 15) && ((currentNode.conn & 6) != 0) && (rights == 0xFFFFFFFF) && ((features & 0x00000400) == 0)) { count++; y += '<option value=107>' + "Intel&reg; AMT Click Once Recovery" + '</option>'; } // CIRA (2) or AMT (4) connected
6616 + if ((getNodeAmtVersion(currentNode) >= 15) && (currentNode.intelamt.state == 2) && ((currentNode.conn & 6) != 0) && (rights == 0xFFFFFFFF) && ((features & 0x00000400) == 0)) { count++; y += '<option value=107>' + "Intel&reg; AMT Click Once Recovery" + '</option>'; } // CIRA (2) or AMT (4) connected
6617 if (((currentNode.conn & 1) != 0) && ((rights & 32768) != 0)) { count++; y += '<option value=104>' + "Uninstall Agent" + '</option>'; }
6618 y += '</select>';
6619 x += addHtmlValue("Operation", y);
webserver.js
+3 -3
@@ -3439,10 +3439,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3439 for (var i in files.files) {
3440 var file = files.files[i];
3441
3442 - // Perform Intel AMT Click Once Recovery
3443 - console.log('ClickOnceRecovery', node._id, file.path);
3442 + // Event Intel AMT Click Once Recovery, this will cause Intel AMT wake operations on this and other servers.
3443 + parent.DispatchEvent('*', obj, { action: 'clickoncerecovery', userid: user._id, username: user.name, nodeids: [node._id], domain: domain.id, nolog: 1, file: file.path });
3444
3445 - try { obj.fs.unlinkSync(file.path); } catch (e) { }
3445 + try { obj.fs.unlinkSync(file.path); } catch (e) { } // TODO: Remove this file after 30 minutes.
3446 }
3447 res.send('');
3448 });