@device-management-toolkit/ui-toolkit-angular 11.1.8 → 12.0.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.
- package/fesm2022/device-management-toolkit-ui-toolkit-angular-ider.mjs +231 -127
- package/fesm2022/device-management-toolkit-ui-toolkit-angular-ider.mjs.map +1 -1
- package/fesm2022/device-management-toolkit-ui-toolkit-angular-kvm.mjs +586 -371
- package/fesm2022/device-management-toolkit-ui-toolkit-angular-kvm.mjs.map +1 -1
- package/fesm2022/device-management-toolkit-ui-toolkit-angular-sol.mjs +297 -180
- package/fesm2022/device-management-toolkit-ui-toolkit-angular-sol.mjs.map +1 -1
- package/fesm2022/device-management-toolkit-ui-toolkit-angular.mjs +1104 -648
- package/fesm2022/device-management-toolkit-ui-toolkit-angular.mjs.map +1 -1
- package/package.json +4 -4
- package/types/device-management-toolkit-ui-toolkit-angular-ider.d.ts +69 -38
- package/types/device-management-toolkit-ui-toolkit-angular-kvm.d.ts +89 -54
- package/types/device-management-toolkit-ui-toolkit-angular-sol.d.ts +54 -33
- package/types/device-management-toolkit-ui-toolkit-angular.d.ts +204 -113
|
@@ -1,649 +1,1105 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { Terminal } from
|
|
4
|
-
import {
|
|
5
|
-
import { takeUntilDestroyed } from
|
|
6
|
-
import { fromEvent, timer } from
|
|
7
|
-
import { throttleTime } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, Renderer2, ViewEncapsulation, effect, inject, input, output, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { Terminal } from "@xterm/xterm";
|
|
4
|
+
import { AMTDesktop, AMTIDER, AMTKvmDataRedirector, AMTRedirector, AmtTerminal, DataProcessor, KeyBoardHelper, MouseHelper, Protocol, TerminalDataProcessor } from "@device-management-toolkit/ui-toolkit/core";
|
|
5
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
6
|
+
import { fromEvent, timer } from "rxjs";
|
|
7
|
+
import { throttleTime } from "rxjs/operators";
|
|
8
|
+
var TerminalComponent = class TerminalComponent {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.term = input.required(...ngDevMode ? [{ debugName: "term" }] : /* istanbul ignore next */ []);
|
|
11
|
+
this.handleKeyPress = output();
|
|
12
|
+
this.container = null;
|
|
13
|
+
}
|
|
14
|
+
ngOnInit() {
|
|
15
|
+
const term = this.term();
|
|
16
|
+
if (term == null) throw new Error("Terminal not found");
|
|
17
|
+
this.container = document.getElementById("terminal");
|
|
18
|
+
if (this.container == null) throw new Error("Container not found");
|
|
19
|
+
term.open(this.container);
|
|
20
|
+
term.onKey(({ key, domEvent }) => {
|
|
21
|
+
domEvent.preventDefault();
|
|
22
|
+
if (domEvent.ctrlKey && domEvent.key === "c") {
|
|
23
|
+
const termValue = this.term();
|
|
24
|
+
if (termValue.hasSelection()) navigator.clipboard.writeText(termValue.getSelection()).then(() => {}).catch((err) => {
|
|
25
|
+
console.error("Failed to copy to clipboard", err);
|
|
26
|
+
});
|
|
27
|
+
else termValue.write("");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (domEvent.ctrlKey && domEvent.key === "v") {
|
|
31
|
+
navigator.clipboard.readText().then((text) => {
|
|
32
|
+
this.handleKeyPress.emit(text);
|
|
33
|
+
}).catch((err) => {
|
|
34
|
+
console.error("Failed to read clipboard", err);
|
|
35
|
+
});
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
this.handleKeyPress.emit(key);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
static {
|
|
42
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
43
|
+
minVersion: "12.0.0",
|
|
44
|
+
version: "22.2.2",
|
|
45
|
+
ngImport: i0,
|
|
46
|
+
type: TerminalComponent,
|
|
47
|
+
deps: [],
|
|
48
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
static {
|
|
52
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
53
|
+
minVersion: "17.1.0",
|
|
54
|
+
version: "22.2.2",
|
|
55
|
+
type: TerminalComponent,
|
|
56
|
+
isStandalone: true,
|
|
57
|
+
selector: "amt-terminal",
|
|
58
|
+
inputs: { term: {
|
|
59
|
+
classPropertyName: "term",
|
|
60
|
+
publicName: "term",
|
|
61
|
+
isSignal: true,
|
|
62
|
+
isRequired: true,
|
|
63
|
+
transformFunction: null
|
|
64
|
+
} },
|
|
65
|
+
outputs: { handleKeyPress: "handleKeyPress" },
|
|
66
|
+
ngImport: i0,
|
|
67
|
+
template: "<div id=\"terminal\" class=\"xtermDisplay\" style=\"width: fit-content\"></div>\n"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
72
|
+
minVersion: "12.0.0",
|
|
73
|
+
version: "22.2.2",
|
|
74
|
+
ngImport: i0,
|
|
75
|
+
type: TerminalComponent,
|
|
76
|
+
decorators: [{
|
|
77
|
+
type: Component,
|
|
78
|
+
args: [{
|
|
79
|
+
selector: "amt-terminal",
|
|
80
|
+
template: "<div id=\"terminal\" class=\"xtermDisplay\" style=\"width: fit-content\"></div>\n"
|
|
81
|
+
}]
|
|
82
|
+
}],
|
|
83
|
+
propDecorators: {
|
|
84
|
+
term: [{
|
|
85
|
+
type: i0.Input,
|
|
86
|
+
args: [{
|
|
87
|
+
isSignal: true,
|
|
88
|
+
alias: "term",
|
|
89
|
+
required: true
|
|
90
|
+
}]
|
|
91
|
+
}],
|
|
92
|
+
handleKeyPress: [{
|
|
93
|
+
type: i0.Output,
|
|
94
|
+
args: ["handleKeyPress"]
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var SOLComponent = class SOLComponent {
|
|
99
|
+
constructor() {
|
|
100
|
+
this.destroyRef = inject(DestroyRef);
|
|
101
|
+
this.terminal = null;
|
|
102
|
+
this.term = null;
|
|
103
|
+
this.redirector = null;
|
|
104
|
+
this.dataProcessor = null;
|
|
105
|
+
this._deviceState = signal(0, ...ngDevMode ? [{ debugName: "_deviceState" }] : /* istanbul ignore next */ []);
|
|
106
|
+
this.deviceState = this._deviceState.asReadonly();
|
|
107
|
+
this.deviceStatus = output();
|
|
108
|
+
this.deviceConnection = input(false, ...ngDevMode ? [{ debugName: "deviceConnection" }] : /* istanbul ignore next */ []);
|
|
109
|
+
this.mpsServer = input("", ...ngDevMode ? [{ debugName: "mpsServer" }] : /* istanbul ignore next */ []);
|
|
110
|
+
this.authToken = input("", ...ngDevMode ? [{ debugName: "authToken" }] : /* istanbul ignore next */ []);
|
|
111
|
+
this.deviceId = input("", ...ngDevMode ? [{ debugName: "deviceId" }] : /* istanbul ignore next */ []);
|
|
112
|
+
effect(() => {
|
|
113
|
+
if (this.deviceConnection()) {
|
|
114
|
+
if (this.redirector == null) this.instantiate();
|
|
115
|
+
this.startSol();
|
|
116
|
+
} else if (this.redirector != null) this.stopSol();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
instantiate() {
|
|
120
|
+
this.terminal = new AmtTerminal();
|
|
121
|
+
this.dataProcessor = new TerminalDataProcessor(this.terminal);
|
|
122
|
+
const config = {
|
|
123
|
+
mode: "sol",
|
|
124
|
+
protocol: Protocol.SOL,
|
|
125
|
+
fr: new FileReader(),
|
|
126
|
+
host: this.deviceId(),
|
|
127
|
+
port: 16994,
|
|
128
|
+
user: "",
|
|
129
|
+
pass: "",
|
|
130
|
+
tls: 0,
|
|
131
|
+
tls1only: 0,
|
|
132
|
+
authToken: this.authToken(),
|
|
133
|
+
server: this.mpsServer()
|
|
134
|
+
};
|
|
135
|
+
this.redirector = new AMTRedirector(config);
|
|
136
|
+
this.terminal.onSend = this.redirector.send.bind(this.redirector);
|
|
137
|
+
this.redirector.onNewState = this.terminal.StateChange.bind(this.terminal);
|
|
138
|
+
this.redirector.onStateChanged = this.onTerminalStateChange.bind(this);
|
|
139
|
+
this.redirector.onProcessData = this.dataProcessor.processData.bind(this);
|
|
140
|
+
this.dataProcessor.processDataToXterm = this.handleWriteToXterm.bind(this);
|
|
141
|
+
this.dataProcessor.clearTerminal = this.handleClearTerminal.bind(this);
|
|
142
|
+
this.term = new Terminal({
|
|
143
|
+
rows: 30,
|
|
144
|
+
cols: 100,
|
|
145
|
+
cursorStyle: "block",
|
|
146
|
+
fontWeight: "bold"
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
handleKeyPress(domEvent) {
|
|
150
|
+
this.terminal?.TermSendKeys(domEvent);
|
|
151
|
+
}
|
|
152
|
+
handleClearTerminal() {
|
|
153
|
+
this.term?.reset();
|
|
154
|
+
}
|
|
155
|
+
handleWriteToXterm(str) {
|
|
156
|
+
this.term?.write(str);
|
|
157
|
+
}
|
|
158
|
+
onTerminalStateChange(redirector, state) {
|
|
159
|
+
this.deviceStatus.emit(state);
|
|
160
|
+
this._deviceState.set(state);
|
|
161
|
+
}
|
|
162
|
+
startSol() {
|
|
163
|
+
if (this.redirector != null) this.redirector.start(WebSocket);
|
|
164
|
+
}
|
|
165
|
+
stopSol() {
|
|
166
|
+
if (this.redirector != null) {
|
|
167
|
+
this.redirector.stop();
|
|
168
|
+
this.handleClearTerminal();
|
|
169
|
+
this.term?.dispose();
|
|
170
|
+
this.cleanup();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
cleanup() {
|
|
174
|
+
this.terminal = null;
|
|
175
|
+
this.redirector = null;
|
|
176
|
+
this.dataProcessor = null;
|
|
177
|
+
this.term = null;
|
|
178
|
+
}
|
|
179
|
+
ngOnDestroy() {
|
|
180
|
+
this.stopSol();
|
|
181
|
+
}
|
|
182
|
+
static {
|
|
183
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
184
|
+
minVersion: "12.0.0",
|
|
185
|
+
version: "22.2.2",
|
|
186
|
+
ngImport: i0,
|
|
187
|
+
type: SOLComponent,
|
|
188
|
+
deps: [],
|
|
189
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
static {
|
|
193
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
194
|
+
minVersion: "17.0.0",
|
|
195
|
+
version: "22.2.2",
|
|
196
|
+
type: SOLComponent,
|
|
197
|
+
isStandalone: true,
|
|
198
|
+
selector: "amt-sol",
|
|
199
|
+
inputs: {
|
|
200
|
+
deviceConnection: {
|
|
201
|
+
classPropertyName: "deviceConnection",
|
|
202
|
+
publicName: "deviceConnection",
|
|
203
|
+
isSignal: true,
|
|
204
|
+
isRequired: false,
|
|
205
|
+
transformFunction: null
|
|
206
|
+
},
|
|
207
|
+
mpsServer: {
|
|
208
|
+
classPropertyName: "mpsServer",
|
|
209
|
+
publicName: "mpsServer",
|
|
210
|
+
isSignal: true,
|
|
211
|
+
isRequired: false,
|
|
212
|
+
transformFunction: null
|
|
213
|
+
},
|
|
214
|
+
authToken: {
|
|
215
|
+
classPropertyName: "authToken",
|
|
216
|
+
publicName: "authToken",
|
|
217
|
+
isSignal: true,
|
|
218
|
+
isRequired: false,
|
|
219
|
+
transformFunction: null
|
|
220
|
+
},
|
|
221
|
+
deviceId: {
|
|
222
|
+
classPropertyName: "deviceId",
|
|
223
|
+
publicName: "deviceId",
|
|
224
|
+
isSignal: true,
|
|
225
|
+
isRequired: false,
|
|
226
|
+
transformFunction: null
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
outputs: { deviceStatus: "deviceStatus" },
|
|
230
|
+
ngImport: i0,
|
|
231
|
+
template: "<div class=\"container\">\n @if (deviceState() === 3 && term) {\n <amt-terminal [term]=\"term\" (handleKeyPress)=\"handleKeyPress($event)\"></amt-terminal>\n }\n</div>\n",
|
|
232
|
+
styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}\n"],
|
|
233
|
+
dependencies: [{
|
|
234
|
+
kind: "component",
|
|
235
|
+
type: TerminalComponent,
|
|
236
|
+
selector: "amt-terminal",
|
|
237
|
+
inputs: ["term"],
|
|
238
|
+
outputs: ["handleKeyPress"]
|
|
239
|
+
}],
|
|
240
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
245
|
+
minVersion: "12.0.0",
|
|
246
|
+
version: "22.2.2",
|
|
247
|
+
ngImport: i0,
|
|
248
|
+
type: SOLComponent,
|
|
249
|
+
decorators: [{
|
|
250
|
+
type: Component,
|
|
251
|
+
args: [{
|
|
252
|
+
selector: "amt-sol",
|
|
253
|
+
encapsulation: ViewEncapsulation.None,
|
|
254
|
+
imports: [TerminalComponent],
|
|
255
|
+
template: "<div class=\"container\">\n @if (deviceState() === 3 && term) {\n <amt-terminal [term]=\"term\" (handleKeyPress)=\"handleKeyPress($event)\"></amt-terminal>\n }\n</div>\n",
|
|
256
|
+
styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}\n"]
|
|
257
|
+
}]
|
|
258
|
+
}],
|
|
259
|
+
ctorParameters: () => [],
|
|
260
|
+
propDecorators: {
|
|
261
|
+
deviceStatus: [{
|
|
262
|
+
type: i0.Output,
|
|
263
|
+
args: ["deviceStatus"]
|
|
264
|
+
}],
|
|
265
|
+
deviceConnection: [{
|
|
266
|
+
type: i0.Input,
|
|
267
|
+
args: [{
|
|
268
|
+
isSignal: true,
|
|
269
|
+
alias: "deviceConnection",
|
|
270
|
+
required: false
|
|
271
|
+
}]
|
|
272
|
+
}],
|
|
273
|
+
mpsServer: [{
|
|
274
|
+
type: i0.Input,
|
|
275
|
+
args: [{
|
|
276
|
+
isSignal: true,
|
|
277
|
+
alias: "mpsServer",
|
|
278
|
+
required: false
|
|
279
|
+
}]
|
|
280
|
+
}],
|
|
281
|
+
authToken: [{
|
|
282
|
+
type: i0.Input,
|
|
283
|
+
args: [{
|
|
284
|
+
isSignal: true,
|
|
285
|
+
alias: "authToken",
|
|
286
|
+
required: false
|
|
287
|
+
}]
|
|
288
|
+
}],
|
|
289
|
+
deviceId: [{
|
|
290
|
+
type: i0.Input,
|
|
291
|
+
args: [{
|
|
292
|
+
isSignal: true,
|
|
293
|
+
alias: "deviceId",
|
|
294
|
+
required: false
|
|
295
|
+
}]
|
|
296
|
+
}]
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
var KVMComponent = class KVMComponent {
|
|
300
|
+
constructor() {
|
|
301
|
+
this.renderer = inject(Renderer2);
|
|
302
|
+
this.destroyRef = inject(DestroyRef);
|
|
303
|
+
this.KEY_SEQUENCE_DELAY_MS = 10;
|
|
304
|
+
this.canvas = viewChild("canvas", ...ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []);
|
|
305
|
+
this.device = viewChild.required("device", ...ngDevMode ? [{ debugName: "device" }] : /* istanbul ignore next */ []);
|
|
306
|
+
this.context = null;
|
|
307
|
+
this.width = signal(400, ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
|
|
308
|
+
this.height = signal(400, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
309
|
+
this.isFullscreen = input(false, ...ngDevMode ? [{ debugName: "isFullscreen" }] : /* istanbul ignore next */ []);
|
|
310
|
+
this.mpsServer = input("", ...ngDevMode ? [{ debugName: "mpsServer" }] : /* istanbul ignore next */ []);
|
|
311
|
+
this.authToken = input("", ...ngDevMode ? [{ debugName: "authToken" }] : /* istanbul ignore next */ []);
|
|
312
|
+
this.deviceId = input("", ...ngDevMode ? [{ debugName: "deviceId" }] : /* istanbul ignore next */ []);
|
|
313
|
+
this.deviceStatus = output();
|
|
314
|
+
this.deviceConnection = input(false, ...ngDevMode ? [{ debugName: "deviceConnection" }] : /* istanbul ignore next */ []);
|
|
315
|
+
this.selectedEncoding = input(1, ...ngDevMode ? [{ debugName: "selectedEncoding" }] : /* istanbul ignore next */ []);
|
|
316
|
+
this.selectedHotkey = input("", ...ngDevMode ? [{ debugName: "selectedHotkey" }] : /* istanbul ignore next */ []);
|
|
317
|
+
this.module = null;
|
|
318
|
+
this.redirector = null;
|
|
319
|
+
this.dataProcessor = null;
|
|
320
|
+
this.mouseHelper = null;
|
|
321
|
+
this.keyboardHelper = null;
|
|
322
|
+
this.selected = signal(1, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
323
|
+
this.isEncodingChange = false;
|
|
324
|
+
this.encodings = [{
|
|
325
|
+
value: 1,
|
|
326
|
+
viewValue: "RLE 8"
|
|
327
|
+
}, {
|
|
328
|
+
value: 2,
|
|
329
|
+
viewValue: "RLE 16"
|
|
330
|
+
}];
|
|
331
|
+
this.onConnectionStateChange = (redirector, state) => {
|
|
332
|
+
this.deviceStatus.emit(state);
|
|
333
|
+
};
|
|
334
|
+
effect(() => {
|
|
335
|
+
this.toggleFullscreen();
|
|
336
|
+
});
|
|
337
|
+
effect(() => {
|
|
338
|
+
const connected = this.deviceConnection();
|
|
339
|
+
if (connected && this.redirector == null && !this.isEncodingChange) {
|
|
340
|
+
console.log("KVMComponent: Device connected, initializing KVM...");
|
|
341
|
+
this.init();
|
|
342
|
+
} else if (!connected && this.redirector != null) {
|
|
343
|
+
console.log("KVMComponent: Device disconnected, stopping KVM...");
|
|
344
|
+
this.stopKvm();
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
effect(() => {
|
|
348
|
+
if (this.selectedEncoding() === this.selected() || !this.deviceConnection()) return;
|
|
349
|
+
console.log("KVMComponent: Encoding changed to", this.selectedEncoding());
|
|
350
|
+
const encoding = this.selectedEncoding();
|
|
351
|
+
this.selected.set(encoding);
|
|
352
|
+
if (this.redirector != null) {
|
|
353
|
+
this.isEncodingChange = true;
|
|
354
|
+
this.onEncodingChange();
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
effect(() => {
|
|
358
|
+
const hotkey = this.selectedHotkey();
|
|
359
|
+
if (hotkey && this.deviceConnection() && this.keyboardHelper) {
|
|
360
|
+
console.log("KVMComponent: Hotkey triggered:", hotkey);
|
|
361
|
+
this.sendHotkey(hotkey);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
toggleFullscreen() {
|
|
366
|
+
const canvasElement = this.canvas()?.nativeElement;
|
|
367
|
+
if (!canvasElement) return;
|
|
368
|
+
if (this.isFullscreen()) {
|
|
369
|
+
if (canvasElement.requestFullscreen) canvasElement.requestFullscreen();
|
|
370
|
+
this.renderer.addClass(canvasElement, "fullscreen");
|
|
371
|
+
} else {
|
|
372
|
+
if (document.exitFullscreen && document.fullscreenElement != null) document.exitFullscreen();
|
|
373
|
+
this.renderer.removeClass(canvasElement, "fullscreen");
|
|
374
|
+
}
|
|
375
|
+
this.mouseHelper?.resetOffsets();
|
|
376
|
+
}
|
|
377
|
+
instantiate() {
|
|
378
|
+
const canvas = this.canvas();
|
|
379
|
+
this.context = canvas?.nativeElement.getContext("2d") || null;
|
|
380
|
+
const config = {
|
|
381
|
+
mode: "kvm",
|
|
382
|
+
protocol: Protocol.KVM,
|
|
383
|
+
fr: new FileReader(),
|
|
384
|
+
host: this.deviceId(),
|
|
385
|
+
port: 16994,
|
|
386
|
+
user: "",
|
|
387
|
+
pass: "",
|
|
388
|
+
tls: 0,
|
|
389
|
+
tls1only: 0,
|
|
390
|
+
authToken: this.authToken(),
|
|
391
|
+
server: this.mpsServer()
|
|
392
|
+
};
|
|
393
|
+
this.redirector = new AMTKvmDataRedirector(config);
|
|
394
|
+
this.module = new AMTDesktop(this.context);
|
|
395
|
+
this.dataProcessor = new DataProcessor(this.redirector, this.module);
|
|
396
|
+
this.mouseHelper = new MouseHelper(this.module, this.redirector, 200);
|
|
397
|
+
this.keyboardHelper = new KeyBoardHelper(this.module, this.redirector);
|
|
398
|
+
this.redirector.onProcessData = this.module.processData.bind(this.module);
|
|
399
|
+
this.redirector.onStart = this.module.start.bind(this.module);
|
|
400
|
+
this.redirector.onNewState = this.module.onStateChange.bind(this.module);
|
|
401
|
+
this.redirector.onSendKvmData = this.module.onSendKvmData.bind(this.module);
|
|
402
|
+
this.redirector.onStateChanged = this.onConnectionStateChange.bind(this);
|
|
403
|
+
this.redirector.onError = this.onRedirectorError.bind(this);
|
|
404
|
+
this.module.onSend = this.redirector.send.bind(this.redirector);
|
|
405
|
+
this.module.onProcessData = this.dataProcessor.processData.bind(this.dataProcessor);
|
|
406
|
+
this.module.bpp = this.selected();
|
|
407
|
+
this.mouseMove$ = fromEvent(canvas?.nativeElement, "mousemove").pipe(throttleTime(200), takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
|
408
|
+
this.mouseHelper?.mousemove(event);
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
onRedirectorError() {
|
|
412
|
+
this.reset();
|
|
413
|
+
}
|
|
414
|
+
init() {
|
|
415
|
+
this.instantiate();
|
|
416
|
+
setTimeout(() => {
|
|
417
|
+
this.autoConnect();
|
|
418
|
+
}, 4e3);
|
|
419
|
+
}
|
|
420
|
+
autoConnect() {
|
|
421
|
+
if (this.redirector) {
|
|
422
|
+
this.redirector.start(WebSocket);
|
|
423
|
+
this.keyboardHelper?.GrabKeyInput();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
onEncodingChange() {
|
|
427
|
+
this.stopKvm();
|
|
428
|
+
timer(1e3).subscribe(() => {
|
|
429
|
+
this.init();
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
reset() {
|
|
433
|
+
this.redirector = null;
|
|
434
|
+
this.module = null;
|
|
435
|
+
this.dataProcessor = null;
|
|
436
|
+
this.height.set(400);
|
|
437
|
+
this.width.set(400);
|
|
438
|
+
}
|
|
439
|
+
stopKvm() {
|
|
440
|
+
this.redirector?.stop();
|
|
441
|
+
this.keyboardHelper?.UnGrabKeyInput();
|
|
442
|
+
this.reset();
|
|
443
|
+
}
|
|
444
|
+
onMouseup(event) {
|
|
445
|
+
this.mouseHelper?.mouseup(event);
|
|
446
|
+
}
|
|
447
|
+
onMousedown(event) {
|
|
448
|
+
this.mouseHelper?.mousedown(event);
|
|
449
|
+
}
|
|
450
|
+
onMousemove(event) {
|
|
451
|
+
this.mouseHelper?.mousemove(event);
|
|
452
|
+
}
|
|
453
|
+
sendHotkey(hotKeyType) {
|
|
454
|
+
if (!this.keyboardHelper) {
|
|
455
|
+
console.warn("KVMComponent: Cannot send hotkey - keyboard helper not available");
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const keySequence = this.getKeySequence(hotKeyType);
|
|
459
|
+
if (keySequence?.keys) {
|
|
460
|
+
console.log("KVMComponent: Sending hotkey sequence for", hotKeyType);
|
|
461
|
+
keySequence.keys.forEach((key, index) => {
|
|
462
|
+
setTimeout(() => {
|
|
463
|
+
const upDown = key.down ? 1 : 0;
|
|
464
|
+
const mockEvent = {
|
|
465
|
+
keyCode: key.code,
|
|
466
|
+
preventDefault: () => {},
|
|
467
|
+
stopPropagation: () => {}
|
|
468
|
+
};
|
|
469
|
+
this.keyboardHelper.handleKeyEvent(upDown, mockEvent);
|
|
470
|
+
}, index * this.KEY_SEQUENCE_DELAY_MS);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
getKeySequence(hotKeyType) {
|
|
475
|
+
const altFnMatch = hotKeyType.match(/^alt-f(\d+)$/);
|
|
476
|
+
const ctrlAltFnMatch = hotKeyType.match(/^ctrl-alt-f(\d+)$/);
|
|
477
|
+
if (altFnMatch) {
|
|
478
|
+
const fnNum = parseInt(altFnMatch[1], 10);
|
|
479
|
+
return this.buildFunctionKeySequence(fnNum, false);
|
|
480
|
+
}
|
|
481
|
+
if (ctrlAltFnMatch) {
|
|
482
|
+
const fnNum = parseInt(ctrlAltFnMatch[1], 10);
|
|
483
|
+
return this.buildFunctionKeySequence(fnNum, true);
|
|
484
|
+
}
|
|
485
|
+
switch (hotKeyType) {
|
|
486
|
+
case "ctrl-alt-del": return { keys: [
|
|
487
|
+
{
|
|
488
|
+
code: 17,
|
|
489
|
+
down: true
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
code: 18,
|
|
493
|
+
down: true
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
code: 46,
|
|
497
|
+
down: true
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
code: 46,
|
|
501
|
+
down: false
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
code: 18,
|
|
505
|
+
down: false
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
code: 17,
|
|
509
|
+
down: false
|
|
510
|
+
}
|
|
511
|
+
] };
|
|
512
|
+
case "alt-tab": return { keys: [
|
|
513
|
+
{
|
|
514
|
+
code: 18,
|
|
515
|
+
down: true
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
code: 9,
|
|
519
|
+
down: true
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
code: 9,
|
|
523
|
+
down: false
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
code: 18,
|
|
527
|
+
down: false
|
|
528
|
+
}
|
|
529
|
+
] };
|
|
530
|
+
case "alt-release": return { keys: [{
|
|
531
|
+
code: 18,
|
|
532
|
+
down: false
|
|
533
|
+
}] };
|
|
534
|
+
case "windows": return { keys: [{
|
|
535
|
+
code: 65511,
|
|
536
|
+
down: true
|
|
537
|
+
}, {
|
|
538
|
+
code: 65511,
|
|
539
|
+
down: false
|
|
540
|
+
}] };
|
|
541
|
+
case "windows-l": return { keys: [
|
|
542
|
+
{
|
|
543
|
+
code: 65511,
|
|
544
|
+
down: true
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
code: 108,
|
|
548
|
+
down: true
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
code: 108,
|
|
552
|
+
down: false
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
code: 65511,
|
|
556
|
+
down: false
|
|
557
|
+
}
|
|
558
|
+
] };
|
|
559
|
+
case "windows-r": return { keys: [
|
|
560
|
+
{
|
|
561
|
+
code: 65511,
|
|
562
|
+
down: true
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
code: 82,
|
|
566
|
+
down: true
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
code: 82,
|
|
570
|
+
down: false
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
code: 65511,
|
|
574
|
+
down: false
|
|
575
|
+
}
|
|
576
|
+
] };
|
|
577
|
+
case "windows-up": return { keys: [
|
|
578
|
+
{
|
|
579
|
+
code: 65511,
|
|
580
|
+
down: true
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
code: 65362,
|
|
584
|
+
down: true
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
code: 65362,
|
|
588
|
+
down: false
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
code: 65511,
|
|
592
|
+
down: false
|
|
593
|
+
}
|
|
594
|
+
] };
|
|
595
|
+
case "windows-down": return { keys: [
|
|
596
|
+
{
|
|
597
|
+
code: 65511,
|
|
598
|
+
down: true
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
code: 65364,
|
|
602
|
+
down: true
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
code: 65364,
|
|
606
|
+
down: false
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
code: 65511,
|
|
610
|
+
down: false
|
|
611
|
+
}
|
|
612
|
+
] };
|
|
613
|
+
case "windows-left": return { keys: [
|
|
614
|
+
{
|
|
615
|
+
code: 65511,
|
|
616
|
+
down: true
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
code: 65361,
|
|
620
|
+
down: true
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
code: 65361,
|
|
624
|
+
down: false
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
code: 65511,
|
|
628
|
+
down: false
|
|
629
|
+
}
|
|
630
|
+
] };
|
|
631
|
+
case "windows-right": return { keys: [
|
|
632
|
+
{
|
|
633
|
+
code: 65511,
|
|
634
|
+
down: true
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
code: 65363,
|
|
638
|
+
down: true
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
code: 65363,
|
|
642
|
+
down: false
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
code: 65511,
|
|
646
|
+
down: false
|
|
647
|
+
}
|
|
648
|
+
] };
|
|
649
|
+
case "ctrl-w": return { keys: [
|
|
650
|
+
{
|
|
651
|
+
code: 65507,
|
|
652
|
+
down: true
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
code: 87,
|
|
656
|
+
down: true
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
code: 87,
|
|
660
|
+
down: false
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
code: 65507,
|
|
664
|
+
down: false
|
|
665
|
+
}
|
|
666
|
+
] };
|
|
667
|
+
default: return null;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
buildFunctionKeySequence(fnNum, includeCtrl) {
|
|
671
|
+
if (fnNum < 1 || fnNum > 12) return null;
|
|
672
|
+
const fnKeyCode = 65470 + (fnNum - 1);
|
|
673
|
+
const keys = [];
|
|
674
|
+
if (includeCtrl) keys.push({
|
|
675
|
+
code: 65507,
|
|
676
|
+
down: true
|
|
677
|
+
});
|
|
678
|
+
keys.push({
|
|
679
|
+
code: 65513,
|
|
680
|
+
down: true
|
|
681
|
+
});
|
|
682
|
+
keys.push({
|
|
683
|
+
code: fnKeyCode,
|
|
684
|
+
down: true
|
|
685
|
+
});
|
|
686
|
+
keys.push({
|
|
687
|
+
code: fnKeyCode,
|
|
688
|
+
down: false
|
|
689
|
+
});
|
|
690
|
+
keys.push({
|
|
691
|
+
code: 65513,
|
|
692
|
+
down: false
|
|
693
|
+
});
|
|
694
|
+
if (includeCtrl) keys.push({
|
|
695
|
+
code: 65507,
|
|
696
|
+
down: false
|
|
697
|
+
});
|
|
698
|
+
return { keys };
|
|
699
|
+
}
|
|
700
|
+
ngOnDestroy() {
|
|
701
|
+
this.mouseMove$?.unsubscribe();
|
|
702
|
+
this.stopKvm();
|
|
703
|
+
}
|
|
704
|
+
static {
|
|
705
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
706
|
+
minVersion: "12.0.0",
|
|
707
|
+
version: "22.2.2",
|
|
708
|
+
ngImport: i0,
|
|
709
|
+
type: KVMComponent,
|
|
710
|
+
deps: [],
|
|
711
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
static {
|
|
715
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
716
|
+
minVersion: "17.2.0",
|
|
717
|
+
version: "22.2.2",
|
|
718
|
+
type: KVMComponent,
|
|
719
|
+
isStandalone: true,
|
|
720
|
+
selector: "amt-kvm",
|
|
721
|
+
inputs: {
|
|
722
|
+
isFullscreen: {
|
|
723
|
+
classPropertyName: "isFullscreen",
|
|
724
|
+
publicName: "isFullscreen",
|
|
725
|
+
isSignal: true,
|
|
726
|
+
isRequired: false,
|
|
727
|
+
transformFunction: null
|
|
728
|
+
},
|
|
729
|
+
mpsServer: {
|
|
730
|
+
classPropertyName: "mpsServer",
|
|
731
|
+
publicName: "mpsServer",
|
|
732
|
+
isSignal: true,
|
|
733
|
+
isRequired: false,
|
|
734
|
+
transformFunction: null
|
|
735
|
+
},
|
|
736
|
+
authToken: {
|
|
737
|
+
classPropertyName: "authToken",
|
|
738
|
+
publicName: "authToken",
|
|
739
|
+
isSignal: true,
|
|
740
|
+
isRequired: false,
|
|
741
|
+
transformFunction: null
|
|
742
|
+
},
|
|
743
|
+
deviceId: {
|
|
744
|
+
classPropertyName: "deviceId",
|
|
745
|
+
publicName: "deviceId",
|
|
746
|
+
isSignal: true,
|
|
747
|
+
isRequired: false,
|
|
748
|
+
transformFunction: null
|
|
749
|
+
},
|
|
750
|
+
deviceConnection: {
|
|
751
|
+
classPropertyName: "deviceConnection",
|
|
752
|
+
publicName: "deviceConnection",
|
|
753
|
+
isSignal: true,
|
|
754
|
+
isRequired: false,
|
|
755
|
+
transformFunction: null
|
|
756
|
+
},
|
|
757
|
+
selectedEncoding: {
|
|
758
|
+
classPropertyName: "selectedEncoding",
|
|
759
|
+
publicName: "selectedEncoding",
|
|
760
|
+
isSignal: true,
|
|
761
|
+
isRequired: false,
|
|
762
|
+
transformFunction: null
|
|
763
|
+
},
|
|
764
|
+
selectedHotkey: {
|
|
765
|
+
classPropertyName: "selectedHotkey",
|
|
766
|
+
publicName: "selectedHotkey",
|
|
767
|
+
isSignal: true,
|
|
768
|
+
isRequired: false,
|
|
769
|
+
transformFunction: null
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
outputs: { deviceStatus: "deviceStatus" },
|
|
773
|
+
viewQueries: [{
|
|
774
|
+
propertyName: "canvas",
|
|
775
|
+
first: true,
|
|
776
|
+
predicate: ["canvas"],
|
|
777
|
+
descendants: true,
|
|
778
|
+
isSignal: true
|
|
779
|
+
}, {
|
|
780
|
+
propertyName: "device",
|
|
781
|
+
first: true,
|
|
782
|
+
predicate: ["device"],
|
|
783
|
+
descendants: true,
|
|
784
|
+
isSignal: true
|
|
785
|
+
}],
|
|
786
|
+
ngImport: i0,
|
|
787
|
+
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",
|
|
788
|
+
styles: [".canvas{max-height:80%;max-width:100%}canvas.fullscreen{height:100vh!important}\n"]
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
793
|
+
minVersion: "12.0.0",
|
|
794
|
+
version: "22.2.2",
|
|
795
|
+
ngImport: i0,
|
|
796
|
+
type: KVMComponent,
|
|
797
|
+
decorators: [{
|
|
798
|
+
type: Component,
|
|
799
|
+
args: [{
|
|
800
|
+
selector: "amt-kvm",
|
|
801
|
+
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",
|
|
802
|
+
styles: [".canvas{max-height:80%;max-width:100%}canvas.fullscreen{height:100vh!important}\n"]
|
|
803
|
+
}]
|
|
804
|
+
}],
|
|
805
|
+
ctorParameters: () => [],
|
|
806
|
+
propDecorators: {
|
|
807
|
+
canvas: [{
|
|
808
|
+
type: i0.ViewChild,
|
|
809
|
+
args: ["canvas", { isSignal: true }]
|
|
810
|
+
}],
|
|
811
|
+
device: [{
|
|
812
|
+
type: i0.ViewChild,
|
|
813
|
+
args: ["device", { isSignal: true }]
|
|
814
|
+
}],
|
|
815
|
+
isFullscreen: [{
|
|
816
|
+
type: i0.Input,
|
|
817
|
+
args: [{
|
|
818
|
+
isSignal: true,
|
|
819
|
+
alias: "isFullscreen",
|
|
820
|
+
required: false
|
|
821
|
+
}]
|
|
822
|
+
}],
|
|
823
|
+
mpsServer: [{
|
|
824
|
+
type: i0.Input,
|
|
825
|
+
args: [{
|
|
826
|
+
isSignal: true,
|
|
827
|
+
alias: "mpsServer",
|
|
828
|
+
required: false
|
|
829
|
+
}]
|
|
830
|
+
}],
|
|
831
|
+
authToken: [{
|
|
832
|
+
type: i0.Input,
|
|
833
|
+
args: [{
|
|
834
|
+
isSignal: true,
|
|
835
|
+
alias: "authToken",
|
|
836
|
+
required: false
|
|
837
|
+
}]
|
|
838
|
+
}],
|
|
839
|
+
deviceId: [{
|
|
840
|
+
type: i0.Input,
|
|
841
|
+
args: [{
|
|
842
|
+
isSignal: true,
|
|
843
|
+
alias: "deviceId",
|
|
844
|
+
required: false
|
|
845
|
+
}]
|
|
846
|
+
}],
|
|
847
|
+
deviceStatus: [{
|
|
848
|
+
type: i0.Output,
|
|
849
|
+
args: ["deviceStatus"]
|
|
850
|
+
}],
|
|
851
|
+
deviceConnection: [{
|
|
852
|
+
type: i0.Input,
|
|
853
|
+
args: [{
|
|
854
|
+
isSignal: true,
|
|
855
|
+
alias: "deviceConnection",
|
|
856
|
+
required: false
|
|
857
|
+
}]
|
|
858
|
+
}],
|
|
859
|
+
selectedEncoding: [{
|
|
860
|
+
type: i0.Input,
|
|
861
|
+
args: [{
|
|
862
|
+
isSignal: true,
|
|
863
|
+
alias: "selectedEncoding",
|
|
864
|
+
required: false
|
|
865
|
+
}]
|
|
866
|
+
}],
|
|
867
|
+
selectedHotkey: [{
|
|
868
|
+
type: i0.Input,
|
|
869
|
+
args: [{
|
|
870
|
+
isSignal: true,
|
|
871
|
+
alias: "selectedHotkey",
|
|
872
|
+
required: false
|
|
873
|
+
}]
|
|
874
|
+
}]
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
var IDERComponent = class IDERComponent {
|
|
878
|
+
constructor() {
|
|
879
|
+
this.destroyRef = inject(DestroyRef);
|
|
880
|
+
this.redirector = null;
|
|
881
|
+
this.ider = null;
|
|
882
|
+
this.data = null;
|
|
883
|
+
this._deviceState = signal(0, ...ngDevMode ? [{ debugName: "_deviceState" }] : /* istanbul ignore next */ []);
|
|
884
|
+
this.deviceState = this._deviceState.asReadonly();
|
|
885
|
+
this.deviceStatus = output();
|
|
886
|
+
this.iderData = output();
|
|
887
|
+
this.deviceConnection = input(false, ...ngDevMode ? [{ debugName: "deviceConnection" }] : /* istanbul ignore next */ []);
|
|
888
|
+
this.cdrom = input(null, ...ngDevMode ? [{ debugName: "cdrom" }] : /* istanbul ignore next */ []);
|
|
889
|
+
this.floppy = input(null, ...ngDevMode ? [{ debugName: "floppy" }] : /* istanbul ignore next */ []);
|
|
890
|
+
this.mpsServer = input("", ...ngDevMode ? [{ debugName: "mpsServer" }] : /* istanbul ignore next */ []);
|
|
891
|
+
this.authToken = input("", ...ngDevMode ? [{ debugName: "authToken" }] : /* istanbul ignore next */ []);
|
|
892
|
+
this.deviceId = input("", ...ngDevMode ? [{ debugName: "deviceId" }] : /* istanbul ignore next */ []);
|
|
893
|
+
this.onConnectionStateChange = (redirector, state) => {
|
|
894
|
+
this.deviceStatus.emit(state);
|
|
895
|
+
this._deviceState.set(state);
|
|
896
|
+
};
|
|
897
|
+
effect(() => {
|
|
898
|
+
if (this.deviceConnection()) {
|
|
899
|
+
if (this.redirector == null) this.init();
|
|
900
|
+
} else this.stopIder();
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
init() {
|
|
904
|
+
this.instantiate();
|
|
905
|
+
setTimeout(() => {
|
|
906
|
+
this.startIder();
|
|
907
|
+
}, 4e3);
|
|
908
|
+
}
|
|
909
|
+
startIder() {
|
|
910
|
+
if (this.redirector != null) this.redirector.start(WebSocket);
|
|
911
|
+
}
|
|
912
|
+
instantiate() {
|
|
913
|
+
const config = {
|
|
914
|
+
mode: "ider",
|
|
915
|
+
protocol: Protocol.IDER,
|
|
916
|
+
fr: new FileReader(),
|
|
917
|
+
host: this.deviceId(),
|
|
918
|
+
port: 16994,
|
|
919
|
+
user: "",
|
|
920
|
+
pass: "",
|
|
921
|
+
tls: 0,
|
|
922
|
+
tls1only: 0,
|
|
923
|
+
authToken: this.authToken(),
|
|
924
|
+
server: this.mpsServer()
|
|
925
|
+
};
|
|
926
|
+
this.redirector = new AMTRedirector(config);
|
|
927
|
+
this.ider = new AMTIDER(this.redirector, this.cdrom(), this.floppy());
|
|
928
|
+
this.redirector.onNewState = this.ider.stateChange.bind(this.ider);
|
|
929
|
+
this.redirector.onStateChanged = this.onConnectionStateChange.bind(this);
|
|
930
|
+
this.redirector.onProcessData = this.ider.processData.bind(this.ider);
|
|
931
|
+
this.ider.sectorStats = this.iderSectorStats.bind(this);
|
|
932
|
+
}
|
|
933
|
+
iderSectorStats(mode, dev, total, start, len) {
|
|
934
|
+
if (this.ider == null) return;
|
|
935
|
+
if (mode === 1) {
|
|
936
|
+
if (dev === 0) this.ider.floppyRead += len * 512;
|
|
937
|
+
else this.ider.cdromRead += len * 2048;
|
|
938
|
+
} else if (dev === 0) this.ider.floppyWrite += len * 512;
|
|
939
|
+
else this.ider.cdromWrite += len * 2048;
|
|
940
|
+
this.iderData.emit({
|
|
941
|
+
floppyRead: this.ider.floppyRead,
|
|
942
|
+
cdromRead: this.ider.cdromRead,
|
|
943
|
+
floppyWrite: this.ider.floppyWrite,
|
|
944
|
+
cdromWrite: this.ider.cdromWrite
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
stopIder() {
|
|
948
|
+
if (this.redirector != null) {
|
|
949
|
+
this.redirector.stop();
|
|
950
|
+
this.cleanup();
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
cleanup() {
|
|
954
|
+
this.redirector = null;
|
|
955
|
+
this.ider = null;
|
|
956
|
+
}
|
|
957
|
+
ngOnDestroy() {
|
|
958
|
+
if (this.ider != null) this.ider.stop();
|
|
959
|
+
}
|
|
960
|
+
static {
|
|
961
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
962
|
+
minVersion: "12.0.0",
|
|
963
|
+
version: "22.2.2",
|
|
964
|
+
ngImport: i0,
|
|
965
|
+
type: IDERComponent,
|
|
966
|
+
deps: [],
|
|
967
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
static {
|
|
971
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
972
|
+
minVersion: "17.1.0",
|
|
973
|
+
version: "22.2.2",
|
|
974
|
+
type: IDERComponent,
|
|
975
|
+
isStandalone: true,
|
|
976
|
+
selector: "amt-ider",
|
|
977
|
+
inputs: {
|
|
978
|
+
deviceConnection: {
|
|
979
|
+
classPropertyName: "deviceConnection",
|
|
980
|
+
publicName: "deviceConnection",
|
|
981
|
+
isSignal: true,
|
|
982
|
+
isRequired: false,
|
|
983
|
+
transformFunction: null
|
|
984
|
+
},
|
|
985
|
+
cdrom: {
|
|
986
|
+
classPropertyName: "cdrom",
|
|
987
|
+
publicName: "cdrom",
|
|
988
|
+
isSignal: true,
|
|
989
|
+
isRequired: false,
|
|
990
|
+
transformFunction: null
|
|
991
|
+
},
|
|
992
|
+
floppy: {
|
|
993
|
+
classPropertyName: "floppy",
|
|
994
|
+
publicName: "floppy",
|
|
995
|
+
isSignal: true,
|
|
996
|
+
isRequired: false,
|
|
997
|
+
transformFunction: null
|
|
998
|
+
},
|
|
999
|
+
mpsServer: {
|
|
1000
|
+
classPropertyName: "mpsServer",
|
|
1001
|
+
publicName: "mpsServer",
|
|
1002
|
+
isSignal: true,
|
|
1003
|
+
isRequired: false,
|
|
1004
|
+
transformFunction: null
|
|
1005
|
+
},
|
|
1006
|
+
authToken: {
|
|
1007
|
+
classPropertyName: "authToken",
|
|
1008
|
+
publicName: "authToken",
|
|
1009
|
+
isSignal: true,
|
|
1010
|
+
isRequired: false,
|
|
1011
|
+
transformFunction: null
|
|
1012
|
+
},
|
|
1013
|
+
deviceId: {
|
|
1014
|
+
classPropertyName: "deviceId",
|
|
1015
|
+
publicName: "deviceId",
|
|
1016
|
+
isSignal: true,
|
|
1017
|
+
isRequired: false,
|
|
1018
|
+
transformFunction: null
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
outputs: {
|
|
1022
|
+
deviceStatus: "deviceStatus",
|
|
1023
|
+
iderData: "iderData"
|
|
1024
|
+
},
|
|
1025
|
+
ngImport: i0,
|
|
1026
|
+
template: "",
|
|
1027
|
+
isInline: true
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1032
|
+
minVersion: "12.0.0",
|
|
1033
|
+
version: "22.2.2",
|
|
1034
|
+
ngImport: i0,
|
|
1035
|
+
type: IDERComponent,
|
|
1036
|
+
decorators: [{
|
|
1037
|
+
type: Component,
|
|
1038
|
+
args: [{
|
|
1039
|
+
selector: "amt-ider",
|
|
1040
|
+
template: ""
|
|
1041
|
+
}]
|
|
1042
|
+
}],
|
|
1043
|
+
ctorParameters: () => [],
|
|
1044
|
+
propDecorators: {
|
|
1045
|
+
deviceStatus: [{
|
|
1046
|
+
type: i0.Output,
|
|
1047
|
+
args: ["deviceStatus"]
|
|
1048
|
+
}],
|
|
1049
|
+
iderData: [{
|
|
1050
|
+
type: i0.Output,
|
|
1051
|
+
args: ["iderData"]
|
|
1052
|
+
}],
|
|
1053
|
+
deviceConnection: [{
|
|
1054
|
+
type: i0.Input,
|
|
1055
|
+
args: [{
|
|
1056
|
+
isSignal: true,
|
|
1057
|
+
alias: "deviceConnection",
|
|
1058
|
+
required: false
|
|
1059
|
+
}]
|
|
1060
|
+
}],
|
|
1061
|
+
cdrom: [{
|
|
1062
|
+
type: i0.Input,
|
|
1063
|
+
args: [{
|
|
1064
|
+
isSignal: true,
|
|
1065
|
+
alias: "cdrom",
|
|
1066
|
+
required: false
|
|
1067
|
+
}]
|
|
1068
|
+
}],
|
|
1069
|
+
floppy: [{
|
|
1070
|
+
type: i0.Input,
|
|
1071
|
+
args: [{
|
|
1072
|
+
isSignal: true,
|
|
1073
|
+
alias: "floppy",
|
|
1074
|
+
required: false
|
|
1075
|
+
}]
|
|
1076
|
+
}],
|
|
1077
|
+
mpsServer: [{
|
|
1078
|
+
type: i0.Input,
|
|
1079
|
+
args: [{
|
|
1080
|
+
isSignal: true,
|
|
1081
|
+
alias: "mpsServer",
|
|
1082
|
+
required: false
|
|
1083
|
+
}]
|
|
1084
|
+
}],
|
|
1085
|
+
authToken: [{
|
|
1086
|
+
type: i0.Input,
|
|
1087
|
+
args: [{
|
|
1088
|
+
isSignal: true,
|
|
1089
|
+
alias: "authToken",
|
|
1090
|
+
required: false
|
|
1091
|
+
}]
|
|
1092
|
+
}],
|
|
1093
|
+
deviceId: [{
|
|
1094
|
+
type: i0.Input,
|
|
1095
|
+
args: [{
|
|
1096
|
+
isSignal: true,
|
|
1097
|
+
alias: "deviceId",
|
|
1098
|
+
required: false
|
|
1099
|
+
}]
|
|
1100
|
+
}]
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
648
1103
|
export { IDERComponent, KVMComponent, SOLComponent };
|
|
649
|
-
|
|
1104
|
+
|
|
1105
|
+
//# sourceMappingURL=device-management-toolkit-ui-toolkit-angular.mjs.map
|