@device-management-toolkit/ui-toolkit-angular 9.1.4 → 10.1.0

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.
@@ -1,7 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, output, Component, EventEmitter, ViewEncapsulation, inject, Renderer2, viewChild, effect } from '@angular/core';
2
+ import { input, output, Component, inject, DestroyRef, effect, ViewEncapsulation, Renderer2, viewChild, signal } from '@angular/core';
3
3
  import { Terminal } from '@xterm/xterm';
4
4
  import { AmtTerminal, TerminalDataProcessor, Protocol, AMTRedirector, AMTKvmDataRedirector, AMTDesktop, DataProcessor, MouseHelper, KeyBoardHelper, AMTIDER } from '@device-management-toolkit/ui-toolkit/core';
5
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
6
  import { fromEvent, timer } from 'rxjs';
6
7
  import { throttleTime } from 'rxjs/operators';
7
8
 
@@ -14,7 +15,7 @@ class TerminalComponent {
14
15
  // TODO: Notes from signal input migration:
15
16
  // Input is initialized to `undefined` but type does not allow this value.
16
17
  // This worked with `@Input` because your project uses `--strictPropertyInitialization=false`.
17
- this.term = input(undefined);
18
+ this.term = input(undefined, ...(ngDevMode ? [{ debugName: "term" }] : []));
18
19
  this.handleKeyPress = output();
19
20
  }
20
21
  ngOnInit() {
@@ -58,10 +59,10 @@ class TerminalComponent {
58
59
  this.handleKeyPress.emit(key);
59
60
  });
60
61
  }
61
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TerminalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
62
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.13", type: TerminalComponent, isStandalone: true, selector: "amt-terminal", inputs: { term: { classPropertyName: "term", publicName: "term", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { handleKeyPress: "handleKeyPress" }, ngImport: i0, template: "<div id=\"terminal\" class=\"xtermDisplay\" style=\"width: fit-content\"></div>\n" }); }
62
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: TerminalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
63
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.2", type: TerminalComponent, isStandalone: true, selector: "amt-terminal", inputs: { term: { classPropertyName: "term", publicName: "term", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { handleKeyPress: "handleKeyPress" }, ngImport: i0, template: "<div id=\"terminal\" class=\"xtermDisplay\" style=\"width: fit-content\"></div>\n" }); }
63
64
  }
64
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: TerminalComponent, decorators: [{
65
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: TerminalComponent, decorators: [{
65
66
  type: Component,
66
67
  args: [{ selector: 'amt-terminal', template: "<div id=\"terminal\" class=\"xtermDisplay\" style=\"width: fit-content\"></div>\n" }]
67
68
  }] });
@@ -72,17 +73,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImpo
72
73
  **********************************************************************/
73
74
  class SOLComponent {
74
75
  constructor() {
76
+ this.destroyRef = inject(DestroyRef);
75
77
  this.deviceState = 0;
76
78
  this.deviceStatus = output();
77
- this.deviceConnection = input(new EventEmitter());
78
- this.mpsServer = input('');
79
- this.authToken = input('');
80
- this.deviceId = input('');
81
- }
82
- ngOnInit() {
83
- this.deviceConnection().subscribe((data) => {
84
- if (data) {
85
- this.init();
79
+ this.deviceConnection = input(false, ...(ngDevMode ? [{ debugName: "deviceConnection" }] : []));
80
+ this.mpsServer = input('', ...(ngDevMode ? [{ debugName: "mpsServer" }] : []));
81
+ this.authToken = input('', ...(ngDevMode ? [{ debugName: "authToken" }] : []));
82
+ this.deviceId = input('', ...(ngDevMode ? [{ debugName: "deviceId" }] : []));
83
+ // React to deviceConnection changes
84
+ effect(() => {
85
+ const connected = this.deviceConnection();
86
+ if (connected) {
87
+ if (this.redirector == null) {
88
+ this.init();
89
+ }
86
90
  }
87
91
  else {
88
92
  this.stopSol();
@@ -147,7 +151,7 @@ class SOLComponent {
147
151
  }
148
152
  }
149
153
  stopSol() {
150
- if (this.redirector !== null) {
154
+ if (this.redirector != null) {
151
155
  this.redirector.stop();
152
156
  this.handleClearTerminal();
153
157
  this.term?.dispose();
@@ -164,13 +168,13 @@ class SOLComponent {
164
168
  ngOnDestroy() {
165
169
  this.stopSol();
166
170
  }
167
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: SOLComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
168
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.13", type: SOLComponent, isStandalone: true, selector: "amt-sol", inputs: { deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus" }, ngImport: i0, template: "<div class=\"container\">\n @if (deviceState === 3) {\n <amt-terminal [term]=\"term\" (handleKeyPress)=\"handleKeyPress($event)\"></amt-terminal>\n }\n</div>\n", styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}\n"], dependencies: [{ kind: "component", type: TerminalComponent, selector: "amt-terminal", inputs: ["term"], outputs: ["handleKeyPress"] }], encapsulation: i0.ViewEncapsulation.None }); }
171
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: SOLComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
172
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.2", type: SOLComponent, isStandalone: true, selector: "amt-sol", inputs: { deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus" }, ngImport: i0, template: "<div class=\"container\">\n @if (deviceState === 3) {\n <amt-terminal [term]=\"term\" (handleKeyPress)=\"handleKeyPress($event)\"></amt-terminal>\n }\n</div>\n", styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}\n"], dependencies: [{ kind: "component", type: TerminalComponent, selector: "amt-terminal", inputs: ["term"], outputs: ["handleKeyPress"] }], encapsulation: i0.ViewEncapsulation.None }); }
169
173
  }
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: SOLComponent, decorators: [{
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: SOLComponent, decorators: [{
171
175
  type: Component,
172
176
  args: [{ selector: 'amt-sol', encapsulation: ViewEncapsulation.None, imports: [TerminalComponent], template: "<div class=\"container\">\n @if (deviceState === 3) {\n <amt-terminal [term]=\"term\" (handleKeyPress)=\"handleKeyPress($event)\"></amt-terminal>\n }\n</div>\n", styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}\n"] }]
173
- }] });
177
+ }], ctorParameters: () => [] });
174
178
 
175
179
  /*********************************************************************
176
180
  * Copyright (c) Intel Corporation 2023
@@ -179,20 +183,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImpo
179
183
  class KVMComponent {
180
184
  constructor() {
181
185
  this.renderer = inject(Renderer2);
182
- this.canvas = viewChild('canvas');
186
+ this.destroyRef = inject(DestroyRef);
187
+ this.KEY_SEQUENCE_DELAY_MS = 10;
188
+ this.canvas = viewChild('canvas', ...(ngDevMode ? [{ debugName: "canvas" }] : []));
183
189
  this.device = viewChild.required('device');
184
- this.isFullscreen = input(false);
185
- //setting a width and height for the canvas
186
- this.width = 400;
187
- this.height = 400;
188
- this.mpsServer = input('');
189
- this.authToken = input('');
190
- this.deviceId = input('');
190
+ // Canvas properties
191
+ this.context = null;
192
+ this.width = signal(400, ...(ngDevMode ? [{ debugName: "width" }] : []));
193
+ this.height = signal(400, ...(ngDevMode ? [{ debugName: "height" }] : []));
194
+ // Input properties
195
+ this.isFullscreen = input(false, ...(ngDevMode ? [{ debugName: "isFullscreen" }] : []));
196
+ this.mpsServer = input('', ...(ngDevMode ? [{ debugName: "mpsServer" }] : []));
197
+ this.authToken = input('', ...(ngDevMode ? [{ debugName: "authToken" }] : []));
198
+ this.deviceId = input('', ...(ngDevMode ? [{ debugName: "deviceId" }] : []));
199
+ // Input/Output properties
191
200
  this.deviceStatus = output();
192
- this.deviceConnection = input(new EventEmitter());
193
- this.selectedEncoding = input(new EventEmitter());
194
- this.powerState = 0;
195
- this.selected = 1;
201
+ this.deviceConnection = input(false, ...(ngDevMode ? [{ debugName: "deviceConnection" }] : []));
202
+ this.selectedEncoding = input(1, ...(ngDevMode ? [{ debugName: "selectedEncoding" }] : []));
203
+ this.selectedHotkey = input('', ...(ngDevMode ? [{ debugName: "selectedHotkey" }] : []));
204
+ // Component state
205
+ this.module = null;
206
+ this.redirector = null;
207
+ this.dataProcessor = null;
208
+ this.mouseHelper = null;
209
+ this.keyboardHelper = null;
210
+ this.selected = signal(1, ...(ngDevMode ? [{ debugName: "selected" }] : []));
196
211
  this.encodings = [
197
212
  { value: 1, viewValue: 'RLE 8' },
198
213
  { value: 2, viewValue: 'RLE 16' }
@@ -200,39 +215,38 @@ class KVMComponent {
200
215
  this.onConnectionStateChange = (redirector, state) => {
201
216
  this.deviceStatus.emit(state);
202
217
  };
203
- this.reset = () => {
204
- this.redirector = null;
205
- this.module = null;
206
- this.dataProcessor = null;
207
- this.height = 400;
208
- this.width = 400;
209
- this.instantiate();
210
- };
211
- this.stopKvm = () => {
212
- this.redirector?.stop();
213
- this.keyboardHelper.UnGrabKeyInput();
214
- this.reset();
215
- };
216
218
  effect(() => {
217
219
  this.toggleFullscreen();
218
220
  });
219
- }
220
- ngOnInit() {
221
- this.deviceConnection().subscribe((data) => {
222
- if (data) {
221
+ // React to deviceConnection changes
222
+ effect(() => {
223
+ const connected = this.deviceConnection();
224
+ if (connected && this.redirector == null) {
225
+ console.log('KVMComponent: Device connected, initializing KVM...');
223
226
  this.init();
224
227
  }
225
- else {
228
+ else if (!connected) {
229
+ console.log('KVMComponent: Device disconnected, stopping KVM...');
226
230
  this.stopKvm();
227
231
  }
228
232
  });
229
- this.selectedEncoding().subscribe((data) => {
230
- this.selected = data;
233
+ // React to selectedEncoding changes
234
+ effect(() => {
235
+ if (this.selectedEncoding() === this.selected() || !this.deviceConnection())
236
+ return;
237
+ console.log('KVMComponent: Encoding changed to', this.selectedEncoding());
238
+ const encoding = this.selectedEncoding();
239
+ this.selected.set(encoding);
231
240
  this.onEncodingChange();
232
241
  });
233
- }
234
- ngAfterViewInit() {
235
- this.init();
242
+ // React to selectedHotkey changes
243
+ effect(() => {
244
+ const hotkey = this.selectedHotkey();
245
+ if (hotkey && this.deviceConnection() && this.keyboardHelper) {
246
+ console.log('KVMComponent: Hotkey triggered:', hotkey);
247
+ this.sendHotkey(hotkey);
248
+ }
249
+ });
236
250
  }
237
251
  toggleFullscreen() {
238
252
  const canvasElement = this.canvas()?.nativeElement;
@@ -250,13 +264,11 @@ class KVMComponent {
250
264
  }
251
265
  this.renderer.removeClass(canvasElement, 'fullscreen');
252
266
  }
253
- if (this.mouseHelper != null) {
254
- this.mouseHelper.resetOffsets();
255
- }
267
+ this.mouseHelper?.resetOffsets();
256
268
  }
257
269
  instantiate() {
258
270
  const canvas = this.canvas();
259
- this.context = canvas?.nativeElement.getContext('2d');
271
+ this.context = canvas?.nativeElement.getContext('2d') || null;
260
272
  const config = {
261
273
  mode: 'kvm',
262
274
  protocol: Protocol.KVM,
@@ -283,12 +295,11 @@ class KVMComponent {
283
295
  this.redirector.onError = this.onRedirectorError.bind(this);
284
296
  this.module.onSend = this.redirector.send.bind(this.redirector);
285
297
  this.module.onProcessData = this.dataProcessor.processData.bind(this.dataProcessor);
286
- this.module.bpp = this.selected;
287
- this.mouseMove = fromEvent(canvas?.nativeElement, 'mousemove');
288
- this.mouseMove.pipe(throttleTime(200)).subscribe((event) => {
289
- if (this.mouseHelper != null) {
290
- this.mouseHelper.mousemove(event);
291
- }
298
+ this.module.bpp = this.selected();
299
+ this.mouseMove$ = fromEvent(canvas?.nativeElement, 'mousemove')
300
+ .pipe(throttleTime(200), takeUntilDestroyed(this.destroyRef))
301
+ .subscribe((event) => {
302
+ this.mouseHelper?.mousemove(event);
292
303
  });
293
304
  }
294
305
  onRedirectorError() {
@@ -301,9 +312,9 @@ class KVMComponent {
301
312
  }, 4000);
302
313
  }
303
314
  autoConnect() {
304
- if (this.redirector != null) {
315
+ if (this.redirector) {
305
316
  this.redirector.start(WebSocket);
306
- this.keyboardHelper.GrabKeyInput();
317
+ this.keyboardHelper?.GrabKeyInput();
307
318
  }
308
319
  }
309
320
  onEncodingChange() {
@@ -312,51 +323,200 @@ class KVMComponent {
312
323
  this.autoConnect();
313
324
  });
314
325
  }
326
+ reset() {
327
+ this.redirector = null;
328
+ this.module = null;
329
+ this.dataProcessor = null;
330
+ this.height.set(400);
331
+ this.width.set(400);
332
+ this.instantiate();
333
+ }
334
+ stopKvm() {
335
+ this.redirector?.stop();
336
+ this.keyboardHelper?.UnGrabKeyInput();
337
+ this.reset();
338
+ }
315
339
  onMouseup(event) {
316
- if (this.mouseHelper != null) {
317
- this.mouseHelper.mouseup(event);
318
- }
340
+ this.mouseHelper?.mouseup(event);
319
341
  }
320
342
  onMousedown(event) {
321
- if (this.mouseHelper != null) {
322
- this.mouseHelper.mousedown(event);
323
- }
343
+ this.mouseHelper?.mousedown(event);
324
344
  }
325
345
  onMousemove(event) {
326
- if (this.mouseHelper != null) {
327
- this.mouseHelper.mousemove(event);
346
+ this.mouseHelper?.mousemove(event);
347
+ }
348
+ sendHotkey(hotKeyType) {
349
+ if (!this.keyboardHelper) {
350
+ console.warn('KVMComponent: Cannot send hotkey - keyboard helper not available');
351
+ return;
352
+ }
353
+ const keySequence = this.getKeySequence(hotKeyType);
354
+ if (keySequence?.keys) {
355
+ console.log('KVMComponent: Sending hotkey sequence for', hotKeyType);
356
+ // Send each key in the sequence with a small delay
357
+ keySequence.keys.forEach((key, index) => {
358
+ setTimeout(() => {
359
+ // Use the KeyboardHelper's existing handleKeyEvent method
360
+ // 0 = Up, 1 = Down (from the UpDown enum)
361
+ const upDown = key.down ? 1 : 0;
362
+ // Create a mock keyboard event with the key code
363
+ const mockEvent = {
364
+ keyCode: key.code,
365
+ preventDefault: () => { },
366
+ stopPropagation: () => { }
367
+ };
368
+ // Use the existing handleKeyEvent method
369
+ this.keyboardHelper.handleKeyEvent(upDown, mockEvent);
370
+ }, index * this.KEY_SEQUENCE_DELAY_MS); // delay between keys
371
+ });
372
+ }
373
+ }
374
+ getKeySequence(hotKeyType) {
375
+ // Based on the KeyBoardHelper, these are the key codes for various combinations
376
+ switch (hotKeyType) {
377
+ case 'ctrl-alt-del':
378
+ return {
379
+ keys: [
380
+ { code: 17, down: true }, // Ctrl down (JS keyCode)
381
+ { code: 18, down: true }, // Alt down (JS keyCode)
382
+ { code: 46, down: true }, // Delete down (JS keyCode)
383
+ { code: 46, down: false }, // Delete up (JS keyCode)
384
+ { code: 18, down: false }, // Alt up (JS keyCode)
385
+ { code: 17, down: false } // Ctrl up (JS keyCode)
386
+ ]
387
+ };
388
+ case 'alt-tab':
389
+ return {
390
+ keys: [
391
+ { code: 18, down: true }, // Alt down (JS keyCode)
392
+ { code: 9, down: true }, // Tab down (JS keyCode)
393
+ { code: 9, down: false }, // Tab up (JS keyCode)
394
+ { code: 18, down: false } // Alt up (JS keyCode)
395
+ ]
396
+ };
397
+ case 'alt-release':
398
+ return {
399
+ keys: [
400
+ { code: 18, down: false } // Alt up (JS keyCode)
401
+ ]
402
+ };
403
+ case 'windows':
404
+ return {
405
+ keys: [
406
+ { code: 0xffe7, down: true }, // Windows key down
407
+ { code: 0xffe7, down: false } // Windows key up
408
+ ]
409
+ };
410
+ case 'windows-l':
411
+ return {
412
+ keys: [
413
+ { code: 0xffe7, down: true }, // Windows down
414
+ { code: 108, down: true }, // L down
415
+ { code: 108, down: false }, // L up
416
+ { code: 0xffe7, down: false } // Windows up
417
+ ]
418
+ };
419
+ case 'windows-r':
420
+ return {
421
+ keys: [
422
+ { code: 0xffe7, down: true }, // Windows down
423
+ { code: 82, down: true }, // R down
424
+ { code: 82, down: false }, // R up
425
+ { code: 0xffe7, down: false } // Windows up
426
+ ]
427
+ };
428
+ case 'windows-up':
429
+ return {
430
+ keys: [
431
+ { code: 0xffe7, down: true }, // Windows down
432
+ { code: 0xff52, down: true }, // Up arrow down
433
+ { code: 0xff52, down: false }, // Up arrow up
434
+ { code: 0xffe7, down: false } // Windows up
435
+ ]
436
+ };
437
+ case 'windows-down':
438
+ return {
439
+ keys: [
440
+ { code: 0xffe7, down: true }, // Windows down
441
+ { code: 0xff54, down: true }, // Down arrow down
442
+ { code: 0xff54, down: false }, // Down arrow up
443
+ { code: 0xffe7, down: false } // Windows up
444
+ ]
445
+ };
446
+ case 'windows-left':
447
+ return {
448
+ keys: [
449
+ { code: 0xffe7, down: true }, // Windows down
450
+ { code: 0xff51, down: true }, // Left arrow down
451
+ { code: 0xff51, down: false }, // Left arrow up
452
+ { code: 0xffe7, down: false } // Windows up
453
+ ]
454
+ };
455
+ case 'windows-right':
456
+ return {
457
+ keys: [
458
+ { code: 0xffe7, down: true }, // Windows down
459
+ { code: 0xff53, down: true }, // Right arrow down
460
+ { code: 0xff53, down: false }, // Right arrow up
461
+ { code: 0xffe7, down: false } // Windows up
462
+ ]
463
+ };
464
+ case 'alt-f4':
465
+ return {
466
+ keys: [
467
+ { code: 0xffe9, down: true }, // Alt down
468
+ { code: 0xffc1, down: true }, // F4 down (F1 = 0xffbe, so F4 = 0xffc1)
469
+ { code: 0xffc1, down: false }, // F4 up
470
+ { code: 0xffe9, down: false } // Alt up
471
+ ]
472
+ };
473
+ case 'ctrl-w':
474
+ return {
475
+ keys: [
476
+ { code: 0xffe3, down: true }, // Ctrl down
477
+ { code: 87, down: true }, // W down
478
+ { code: 87, down: false }, // W up
479
+ { code: 0xffe3, down: false } // Ctrl up
480
+ ]
481
+ };
482
+ default:
483
+ return null;
328
484
  }
329
485
  }
330
486
  ngOnDestroy() {
487
+ this.mouseMove$?.unsubscribe();
331
488
  this.stopKvm();
332
489
  }
333
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: KVMComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
334
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.13", type: KVMComponent, isStandalone: true, selector: "amt-kvm", inputs: { isFullscreen: { classPropertyName: "isFullscreen", publicName: "isFullscreen", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null }, deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, selectedEncoding: { classPropertyName: "selectedEncoding", publicName: "selectedEncoding", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true, isSignal: true }, { propertyName: "device", first: true, predicate: ["device"], descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <canvas\n class=\"canvas\"\n #canvas\n [width]=\"width\"\n [height]=\"height\"\n oncontextmenu=\"return false\"\n (mouseup)=\"onMouseup($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mousemove)=\"onMousemove($event)\"></canvas>\n</div>\n", styles: [".canvas{max-height:80%;max-width:100%}canvas.fullscreen{height:100vh!important}\n"] }); }
490
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: KVMComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
491
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.1.2", type: KVMComponent, isStandalone: true, selector: "amt-kvm", inputs: { isFullscreen: { classPropertyName: "isFullscreen", publicName: "isFullscreen", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null }, deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, selectedEncoding: { classPropertyName: "selectedEncoding", publicName: "selectedEncoding", isSignal: true, isRequired: false, transformFunction: null }, selectedHotkey: { classPropertyName: "selectedHotkey", publicName: "selectedHotkey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true, isSignal: true }, { propertyName: "device", first: true, predicate: ["device"], descendants: true, isSignal: true }], ngImport: i0, template: "<div>\n <canvas\n class=\"canvas\"\n #canvas\n [width]=\"width\"\n [height]=\"height\"\n oncontextmenu=\"return false\"\n (mouseup)=\"onMouseup($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mousemove)=\"onMousemove($event)\"></canvas>\n</div>\n", styles: [".canvas{max-height:80%;max-width:100%}canvas.fullscreen{height:100vh!important}\n"] }); }
335
492
  }
336
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: KVMComponent, decorators: [{
493
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: KVMComponent, decorators: [{
337
494
  type: Component,
338
495
  args: [{ selector: 'amt-kvm', template: "<div>\n <canvas\n class=\"canvas\"\n #canvas\n [width]=\"width\"\n [height]=\"height\"\n oncontextmenu=\"return false\"\n (mouseup)=\"onMouseup($event)\"\n (mousedown)=\"onMousedown($event)\"\n (mousemove)=\"onMousemove($event)\"></canvas>\n</div>\n", styles: [".canvas{max-height:80%;max-width:100%}canvas.fullscreen{height:100vh!important}\n"] }]
339
496
  }], ctorParameters: () => [] });
340
497
 
341
498
  class IDERComponent {
342
499
  constructor() {
500
+ this.destroyRef = inject(DestroyRef);
343
501
  this.deviceState = 0;
344
502
  this.deviceStatus = output();
345
503
  this.iderData = output();
346
- this.deviceConnection = input(new EventEmitter());
347
- this.cdrom = input(null);
348
- this.floppy = input(null);
349
- this.mpsServer = input('');
350
- this.authToken = input('');
351
- this.deviceId = input('');
504
+ this.deviceConnection = input(false, ...(ngDevMode ? [{ debugName: "deviceConnection" }] : []));
505
+ this.cdrom = input(null, ...(ngDevMode ? [{ debugName: "cdrom" }] : []));
506
+ this.floppy = input(null, ...(ngDevMode ? [{ debugName: "floppy" }] : []));
507
+ this.mpsServer = input('', ...(ngDevMode ? [{ debugName: "mpsServer" }] : []));
508
+ this.authToken = input('', ...(ngDevMode ? [{ debugName: "authToken" }] : []));
509
+ this.deviceId = input('', ...(ngDevMode ? [{ debugName: "deviceId" }] : []));
352
510
  this.onConnectionStateChange = (redirector, state) => {
353
511
  this.deviceStatus.emit(state);
354
512
  };
355
- }
356
- ngOnInit() {
357
- this.deviceConnection().subscribe((data) => {
358
- if (data) {
359
- this.init();
513
+ // React to deviceConnection changes
514
+ effect(() => {
515
+ const connected = this.deviceConnection();
516
+ if (connected) {
517
+ if (this.redirector == null) {
518
+ this.init();
519
+ }
360
520
  }
361
521
  else {
362
522
  this.stopIder();
@@ -427,7 +587,7 @@ class IDERComponent {
427
587
  });
428
588
  }
429
589
  stopIder() {
430
- if (this.redirector !== null) {
590
+ if (this.redirector != null) {
431
591
  this.redirector.stop();
432
592
  this.cleanup();
433
593
  }
@@ -441,13 +601,13 @@ class IDERComponent {
441
601
  this.ider.stop();
442
602
  }
443
603
  }
444
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: IDERComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
445
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.13", type: IDERComponent, isStandalone: true, selector: "amt-ider", inputs: { deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, cdrom: { classPropertyName: "cdrom", publicName: "cdrom", isSignal: true, isRequired: false, transformFunction: null }, floppy: { classPropertyName: "floppy", publicName: "floppy", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus", iderData: "iderData" }, ngImport: i0, template: '', isInline: true }); }
604
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: IDERComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
605
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.2", type: IDERComponent, isStandalone: true, selector: "amt-ider", inputs: { deviceConnection: { classPropertyName: "deviceConnection", publicName: "deviceConnection", isSignal: true, isRequired: false, transformFunction: null }, cdrom: { classPropertyName: "cdrom", publicName: "cdrom", isSignal: true, isRequired: false, transformFunction: null }, floppy: { classPropertyName: "floppy", publicName: "floppy", isSignal: true, isRequired: false, transformFunction: null }, mpsServer: { classPropertyName: "mpsServer", publicName: "mpsServer", isSignal: true, isRequired: false, transformFunction: null }, authToken: { classPropertyName: "authToken", publicName: "authToken", isSignal: true, isRequired: false, transformFunction: null }, deviceId: { classPropertyName: "deviceId", publicName: "deviceId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { deviceStatus: "deviceStatus", iderData: "iderData" }, ngImport: i0, template: '', isInline: true }); }
446
606
  }
447
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: IDERComponent, decorators: [{
607
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.2", ngImport: i0, type: IDERComponent, decorators: [{
448
608
  type: Component,
449
609
  args: [{ selector: 'amt-ider', template: '' }]
450
- }] });
610
+ }], ctorParameters: () => [] });
451
611
 
452
612
  /*********************************************************************
453
613
  * Copyright (c) Intel Corporation 2023