@open-amt-cloud-toolkit/ui-toolkit-angular 2.0.4 → 2.0.5

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.
Files changed (45) hide show
  1. package/dist +1 -1
  2. package/kvm/README.md +26 -0
  3. package/kvm/bundles/kvm.umd.js +233 -0
  4. package/kvm/bundles/kvm.umd.js.map +1 -0
  5. package/kvm/bundles/kvm.umd.min.js +2 -0
  6. package/kvm/bundles/kvm.umd.min.js.map +1 -0
  7. package/kvm/esm2015/kvm.js +5 -0
  8. package/kvm/esm2015/lib/kvm.component.js +173 -0
  9. package/kvm/esm2015/lib/kvm.module.js +28 -0
  10. package/kvm/esm2015/public-api.js +6 -0
  11. package/kvm/fesm2015/kvm.js +208 -0
  12. package/kvm/fesm2015/kvm.js.map +1 -0
  13. package/kvm/kvm.d.ts +6 -0
  14. package/kvm/kvm.d.ts.map +1 -0
  15. package/kvm/lib/kvm.component.d.ts +48 -0
  16. package/kvm/lib/kvm.component.d.ts.map +1 -0
  17. package/kvm/lib/kvm.module.d.ts +10 -0
  18. package/kvm/lib/kvm.module.d.ts.map +1 -0
  19. package/kvm/package.json +21 -0
  20. package/kvm/public-api.d.ts +3 -0
  21. package/kvm/public-api.d.ts.map +1 -0
  22. package/package.json +1 -1
  23. package/sol/README.md +24 -0
  24. package/sol/bundles/sol.umd.js +237 -0
  25. package/sol/bundles/sol.umd.js.map +1 -0
  26. package/sol/bundles/sol.umd.min.js +2 -0
  27. package/sol/bundles/sol.umd.min.js.map +1 -0
  28. package/sol/esm2015/lib/sol.component.js +126 -0
  29. package/sol/esm2015/lib/sol.module.js +35 -0
  30. package/sol/esm2015/lib/terminal/terminal.component.js +46 -0
  31. package/sol/esm2015/public-api.js +6 -0
  32. package/sol/esm2015/sol.js +5 -0
  33. package/sol/fesm2015/sol.js +210 -0
  34. package/sol/fesm2015/sol.js.map +1 -0
  35. package/sol/lib/sol.component.d.ts +33 -0
  36. package/sol/lib/sol.component.d.ts.map +1 -0
  37. package/sol/lib/sol.module.d.ts +11 -0
  38. package/sol/lib/sol.module.d.ts.map +1 -0
  39. package/sol/lib/terminal/terminal.component.d.ts +11 -0
  40. package/sol/lib/terminal/terminal.component.d.ts.map +1 -0
  41. package/sol/package.json +22 -0
  42. package/sol/public-api.d.ts +3 -0
  43. package/sol/public-api.d.ts.map +1 -0
  44. package/sol/sol.d.ts +6 -0
  45. package/sol/sol.d.ts.map +1 -0
@@ -0,0 +1,208 @@
1
+ import { EventEmitter, ɵɵdefineComponent, ɵɵviewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ɵɵelementStart, ɵɵlistener, ɵɵelementEnd, ɵɵadvance, ɵɵproperty, ɵsetClassMetadata, Component, ViewChild, Input, Output, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
2
+ import { ConsoleLogger, AMTKvmDataRedirector, Protocol, AMTDesktop, DataProcessor, MouseHelper, KeyBoardHelper } from '@open-amt-cloud-toolkit/ui-toolkit/core';
3
+ import { fromEvent, timer } from 'rxjs';
4
+ import { throttleTime } from 'rxjs/operators';
5
+ import { BrowserModule } from '@angular/platform-browser';
6
+ import { HttpClientModule } from '@angular/common/http';
7
+
8
+ const _c0 = ["canvas"];
9
+ const _c1 = ["device"];
10
+ class KvmComponent {
11
+ constructor() {
12
+ // //setting a width and height for the canvas
13
+ this.width = 400;
14
+ this.height = 400;
15
+ this.mpsServer = '';
16
+ this.authToken = '';
17
+ this.deviceId = '';
18
+ this.deviceStatus = new EventEmitter();
19
+ this.deviceConnection = new EventEmitter();
20
+ this.selectedEncoding = new EventEmitter();
21
+ this.powerState = 0;
22
+ this.selected = 1;
23
+ this.mouseMove = null;
24
+ this.encodings = [
25
+ { value: 1, viewValue: 'RLE 8' },
26
+ { value: 2, viewValue: 'RLE 16' }
27
+ ];
28
+ this.onConnectionStateChange = (redirector, state) => {
29
+ this.deviceStatus.emit(state);
30
+ };
31
+ this.reset = () => {
32
+ this.redirector = null;
33
+ this.module = null;
34
+ this.dataProcessor = null;
35
+ this.height = 400;
36
+ this.width = 400;
37
+ this.instantiate();
38
+ };
39
+ this.stopKvm = () => {
40
+ this.redirector.stop();
41
+ this.keyboardHelper.UnGrabKeyInput();
42
+ this.reset();
43
+ };
44
+ }
45
+ ngOnInit() {
46
+ this.logger = new ConsoleLogger(1);
47
+ this.deviceConnection.subscribe((data) => {
48
+ if (data) {
49
+ this.init();
50
+ }
51
+ else {
52
+ this.stopKvm();
53
+ }
54
+ });
55
+ this.selectedEncoding.subscribe((data) => {
56
+ this.selected = data;
57
+ this.onEncodingChange();
58
+ });
59
+ }
60
+ ngAfterViewInit() {
61
+ this.init();
62
+ }
63
+ instantiate() {
64
+ var _a, _b;
65
+ this.context = (_a = this.canvas) === null || _a === void 0 ? void 0 : _a.nativeElement.getContext('2d');
66
+ this.redirector = new AMTKvmDataRedirector(this.logger, Protocol.KVM, new FileReader(), this.deviceId, 16994, '', '', 0, 0, this.authToken, this.mpsServer);
67
+ this.module = new AMTDesktop(this.logger, this.context);
68
+ this.dataProcessor = new DataProcessor(this.logger, this.redirector, this.module);
69
+ this.mouseHelper = new MouseHelper(this.module, this.redirector, 200);
70
+ this.keyboardHelper = new KeyBoardHelper(this.module, this.redirector);
71
+ this.redirector.onProcessData = this.module.processData.bind(this.module);
72
+ this.redirector.onStart = this.module.start.bind(this.module);
73
+ this.redirector.onNewState = this.module.onStateChange.bind(this.module);
74
+ this.redirector.onSendKvmData = this.module.onSendKvmData.bind(this.module);
75
+ this.redirector.onStateChanged = this.onConnectionStateChange.bind(this);
76
+ this.redirector.onError = this.onRedirectorError.bind(this);
77
+ this.module.onSend = this.redirector.send.bind(this.redirector);
78
+ this.module.onProcessData = this.dataProcessor.processData.bind(this.dataProcessor);
79
+ this.module.bpp = this.selected;
80
+ this.mouseMove = fromEvent((_b = this.canvas) === null || _b === void 0 ? void 0 : _b.nativeElement, 'mousemove');
81
+ this.mouseMove.pipe(throttleTime(200)).subscribe((event) => {
82
+ if (this.mouseHelper != null) {
83
+ this.mouseHelper.mousemove(event);
84
+ }
85
+ });
86
+ }
87
+ onRedirectorError() {
88
+ this.reset();
89
+ }
90
+ init() {
91
+ this.instantiate();
92
+ setTimeout(() => {
93
+ this.autoConnect();
94
+ }, 4000);
95
+ }
96
+ autoConnect() {
97
+ if (this.redirector != null) {
98
+ this.redirector.start(WebSocket);
99
+ this.keyboardHelper.GrabKeyInput();
100
+ }
101
+ }
102
+ onEncodingChange() {
103
+ this.stopKvm();
104
+ timer(1000).subscribe(() => {
105
+ this.autoConnect();
106
+ });
107
+ }
108
+ onMouseup(event) {
109
+ if (this.mouseHelper != null) {
110
+ this.mouseHelper.mouseup(event);
111
+ }
112
+ }
113
+ onMousedown(event) {
114
+ if (this.mouseHelper != null) {
115
+ this.mouseHelper.mousedown(event);
116
+ }
117
+ }
118
+ onMousemove(event) {
119
+ if (this.mouseHelper != null) {
120
+ this.mouseHelper.mousemove(event);
121
+ }
122
+ }
123
+ ngOnDestroy() {
124
+ this.stopKvm();
125
+ }
126
+ }
127
+ KvmComponent.ɵfac = function KvmComponent_Factory(t) { return new (t || KvmComponent)(); };
128
+ KvmComponent.ɵcmp = ɵɵdefineComponent({ type: KvmComponent, selectors: [["amt-kvm"]], viewQuery: function KvmComponent_Query(rf, ctx) { if (rf & 1) {
129
+ ɵɵviewQuery(_c0, 1);
130
+ ɵɵviewQuery(_c1, 1);
131
+ } if (rf & 2) {
132
+ let _t;
133
+ ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.canvas = _t.first);
134
+ ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.device = _t.first);
135
+ } }, inputs: { width: "width", height: "height", mpsServer: "mpsServer", authToken: "authToken", deviceId: "deviceId", deviceConnection: "deviceConnection", selectedEncoding: "selectedEncoding" }, outputs: { deviceStatus: "deviceStatus" }, decls: 3, vars: 2, consts: [["oncontextmenu", "return false", 1, "canvas", 3, "width", "height", "mouseup", "mousedown", "mousemove"], ["canvas", ""]], template: function KvmComponent_Template(rf, ctx) { if (rf & 1) {
136
+ ɵɵelementStart(0, "div");
137
+ ɵɵelementStart(1, "canvas", 0, 1);
138
+ ɵɵlistener("mouseup", function KvmComponent_Template_canvas_mouseup_1_listener($event) { return ctx.onMouseup($event); })("mousedown", function KvmComponent_Template_canvas_mousedown_1_listener($event) { return ctx.onMousedown($event); })("mousemove", function KvmComponent_Template_canvas_mousemove_1_listener($event) { return ctx.onMousemove($event); });
139
+ ɵɵelementEnd();
140
+ ɵɵelementEnd();
141
+ } if (rf & 2) {
142
+ ɵɵadvance(1);
143
+ ɵɵproperty("width", ctx.width)("height", ctx.height);
144
+ } }, styles: [".canvas[_ngcontent-%COMP%]{max-height:80%;max-width:100%}"] });
145
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵsetClassMetadata(KvmComponent, [{
146
+ type: Component,
147
+ args: [{
148
+ selector: 'amt-kvm',
149
+ templateUrl: './kvm.component.html',
150
+ styleUrls: ['./kvm.component.css']
151
+ }]
152
+ }], function () { return []; }, { canvas: [{
153
+ type: ViewChild,
154
+ args: ['canvas', { static: false }]
155
+ }], device: [{
156
+ type: ViewChild,
157
+ args: ['device', { static: false }]
158
+ }], width: [{
159
+ type: Input
160
+ }], height: [{
161
+ type: Input
162
+ }], mpsServer: [{
163
+ type: Input
164
+ }], authToken: [{
165
+ type: Input
166
+ }], deviceId: [{
167
+ type: Input
168
+ }], deviceStatus: [{
169
+ type: Output
170
+ }], deviceConnection: [{
171
+ type: Input
172
+ }], selectedEncoding: [{
173
+ type: Input
174
+ }] }); })();
175
+
176
+ class KvmModule {
177
+ }
178
+ KvmModule.ɵfac = function KvmModule_Factory(t) { return new (t || KvmModule)(); };
179
+ KvmModule.ɵmod = ɵɵdefineNgModule({ type: KvmModule });
180
+ KvmModule.ɵinj = ɵɵdefineInjector({ imports: [[
181
+ HttpClientModule,
182
+ BrowserModule,
183
+ ]] });
184
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(KvmModule, { declarations: [KvmComponent], imports: [HttpClientModule,
185
+ BrowserModule], exports: [KvmComponent] }); })();
186
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵsetClassMetadata(KvmModule, [{
187
+ type: NgModule,
188
+ args: [{
189
+ declarations: [KvmComponent],
190
+ imports: [
191
+ HttpClientModule,
192
+ BrowserModule,
193
+ ],
194
+ exports: [KvmComponent],
195
+ schemas: []
196
+ }]
197
+ }], null, null); })();
198
+
199
+ /*
200
+ * Public API Surface of kvm
201
+ */
202
+
203
+ /**
204
+ * Generated bundle index. Do not edit.
205
+ */
206
+
207
+ export { KvmComponent, KvmModule };
208
+ //# sourceMappingURL=kvm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kvm.js","sources":["../../../projects/kvm/src/lib/kvm.component.ts","../../../projects/kvm/src/lib/kvm.component.html","../../../projects/kvm/src/lib/kvm.module.ts","../../../projects/kvm/src/public-api.ts","../../../projects/kvm/src/kvm.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewChild\n} from '@angular/core'\nimport {\n AMTDesktop,\n AMTKvmDataRedirector,\n ConsoleLogger,\n DataProcessor,\n IDataProcessor,\n ILogger,\n KeyBoardHelper,\n MouseHelper,\n Protocol\n} from '@open-amt-cloud-toolkit/ui-toolkit/core'\nimport { fromEvent, timer } from 'rxjs'\nimport { throttleTime } from 'rxjs/operators'\nimport { ActivatedRoute } from '@angular/router'\n\n@Component({\n selector: 'amt-kvm',\n templateUrl: './kvm.component.html',\n styleUrls: ['./kvm.component.css']\n})\nexport class KvmComponent implements OnInit, AfterViewInit, OnDestroy {\n @ViewChild('canvas', { static: false }) canvas: ElementRef | undefined\n @ViewChild('device', { static: false }) device: string\n public context!: CanvasRenderingContext2D\n\n // //setting a width and height for the canvas\n\n @Input() public width = 400\n @Input() public height = 400\n @Input() public mpsServer = ''\n @Input() public authToken = ''\n @Input() public deviceId = ''\n\n @Output() deviceStatus: EventEmitter<number> = new EventEmitter<number>()\n @Input() deviceConnection: EventEmitter<boolean> = new EventEmitter<boolean>()\n @Input() selectedEncoding: EventEmitter<number> = new EventEmitter<number>()\n module: any\n redirector: any\n dataProcessor!: IDataProcessor | null\n mouseHelper!: MouseHelper\n keyboardHelper!: KeyBoardHelper\n logger!: ILogger\n powerState: any = 0\n selected = 1\n timeInterval!: any\n mouseMove: any = null\n encodings = [\n { value: 1, viewValue: 'RLE 8' },\n { value: 2, viewValue: 'RLE 16' }\n ]\n\n constructor() {\n\n }\n\n\n\n ngOnInit(): void {\n this.logger = new ConsoleLogger(1)\n this.deviceConnection.subscribe((data: boolean) => {\n if (data) {\n this.init()\n } else {\n this.stopKvm()\n }\n })\n this.selectedEncoding.subscribe((data) => {\n this.selected = data\n this.onEncodingChange()\n })\n }\n\n ngAfterViewInit(): void {\n this.init()\n }\n\n instantiate(): void {\n this.context = this.canvas?.nativeElement.getContext('2d')\n this.redirector = new AMTKvmDataRedirector(\n this.logger,\n Protocol.KVM,\n new FileReader(),\n this.deviceId,\n 16994,\n '',\n '',\n 0,\n 0,\n this.authToken,\n this.mpsServer\n )\n this.module = new AMTDesktop(this.logger as any, this.context)\n this.dataProcessor = new DataProcessor(\n this.logger,\n this.redirector,\n this.module\n )\n this.mouseHelper = new MouseHelper(this.module, this.redirector, 200)\n this.keyboardHelper = new KeyBoardHelper(this.module, this.redirector)\n this.redirector.onProcessData = this.module.processData.bind(this.module)\n this.redirector.onStart = this.module.start.bind(this.module)\n this.redirector.onNewState = this.module.onStateChange.bind(this.module)\n this.redirector.onSendKvmData = this.module.onSendKvmData.bind(this.module)\n this.redirector.onStateChanged = this.onConnectionStateChange.bind(this)\n this.redirector.onError = this.onRedirectorError.bind(this)\n this.module.onSend = this.redirector.send.bind(this.redirector)\n this.module.onProcessData = this.dataProcessor.processData.bind(\n this.dataProcessor\n )\n this.module.bpp = this.selected\n this.mouseMove = fromEvent(this.canvas?.nativeElement, 'mousemove')\n this.mouseMove.pipe(throttleTime(200)).subscribe((event: any) => {\n if (this.mouseHelper != null) {\n this.mouseHelper.mousemove(event)\n }\n })\n }\n\n onConnectionStateChange = (redirector: any, state: number): any => {\n this.deviceStatus.emit(state)\n }\n\n onRedirectorError(): void {\n this.reset()\n }\n\n init(): void {\n this.instantiate()\n setTimeout(() => {\n this.autoConnect()\n }, 4000)\n }\n\n autoConnect(): void {\n if (this.redirector != null) {\n this.redirector.start(WebSocket)\n this.keyboardHelper.GrabKeyInput()\n }\n }\n\n onEncodingChange(): void {\n this.stopKvm()\n timer(1000).subscribe(() => {\n this.autoConnect()\n })\n }\n\n reset = (): void => {\n this.redirector = null\n this.module = null\n this.dataProcessor = null\n this.height = 400\n this.width = 400\n this.instantiate()\n }\n\n stopKvm = (): void => {\n this.redirector.stop()\n this.keyboardHelper.UnGrabKeyInput()\n this.reset()\n }\n\n onMouseup(event: MouseEvent): void {\n if (this.mouseHelper != null) {\n this.mouseHelper.mouseup(event)\n }\n }\n\n onMousedown(event: MouseEvent): void {\n if (this.mouseHelper != null) {\n this.mouseHelper.mousedown(event)\n }\n }\n\n onMousemove(event: MouseEvent): void {\n if (this.mouseHelper != null) {\n this.mouseHelper.mousemove(event)\n }\n }\n\n ngOnDestroy(): void {\n this.stopKvm()\n }\n}\n","<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)\"\n ></canvas>\n</div>\n","import { NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { KvmComponent } from './kvm.component'\nimport { HttpClientModule } from '@angular/common/http'\n@NgModule({\n declarations: [KvmComponent],\n imports: [\n HttpClientModule,\n BrowserModule,\n ],\n exports: [KvmComponent],\n schemas: []\n\n})\nexport class KvmModule { }\n","/*\n * Public API Surface of kvm\n */\n\nexport * from './lib/kvm.component'\nexport * from './lib/kvm.module'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵadvance","i0.ɵɵproperty"],"mappings":";;;;;;;;;MAgCa,YAAY;IA+BvB;;QAxBgB,UAAK,GAAG,GAAG,CAAA;QACX,WAAM,GAAG,GAAG,CAAA;QACZ,cAAS,GAAG,EAAE,CAAA;QACd,cAAS,GAAG,EAAE,CAAA;QACd,aAAQ,GAAG,EAAE,CAAA;QAEnB,iBAAY,GAAyB,IAAI,YAAY,EAAU,CAAA;QAChE,qBAAgB,GAA0B,IAAI,YAAY,EAAW,CAAA;QACrE,qBAAgB,GAAyB,IAAI,YAAY,EAAU,CAAA;QAO5E,eAAU,GAAQ,CAAC,CAAA;QACnB,aAAQ,GAAG,CAAC,CAAA;QAEZ,cAAS,GAAQ,IAAI,CAAA;QACrB,cAAS,GAAG;YACV,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;YAChC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE;SAClC,CAAA;QAqED,4BAAuB,GAAG,CAAC,UAAe,EAAE,KAAa;YACvD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SAC9B,CAAA;QA2BD,UAAK,GAAG;YACN,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;YACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;YAClB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;YACzB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA;YACjB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;YAChB,IAAI,CAAC,WAAW,EAAE,CAAA;SACnB,CAAA;QAED,YAAO,GAAG;YACR,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;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AAC,OAAO,EAAE,CAAA;KACf;;wEAlKU,YAAY;8CAAZ,YAAY;;;;;;;;QChCzBA,wBAAK;QACHA,iCASC;QAHCC,gGAAW,qBAAiB,IAAC,0FAChB,uBAAmB,IADH,0FAEhB,uBAAmB,IAFH;QAG9BC,cAAS;QACZA,cAAM;;QAPFC,YAAe;QAAfC,8BAAe,sBAAA;;oFD4BN,YAAY;cALxB,SAAS;eAAC;gBACT,QAAQ,EAAE,SAAS;gBACnB,WAAW,EAAE,sBAAsB;gBACnC,SAAS,EAAE,CAAC,qBAAqB,CAAC;aACnC;sCAEyC,MAAM;kBAA7C,SAAS;mBAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;YACE,MAAM;kBAA7C,SAAS;mBAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;YAKtB,KAAK;kBAApB,KAAK;YACU,MAAM;kBAArB,KAAK;YACU,SAAS;kBAAxB,KAAK;YACU,SAAS;kBAAxB,KAAK;YACU,QAAQ;kBAAvB,KAAK;YAEI,YAAY;kBAArB,MAAM;YACE,gBAAgB;kBAAxB,KAAK;YACG,gBAAgB;kBAAxB,KAAK;;;MEjCK,SAAS;;kEAAT,SAAS;0CAAT,SAAS;8CARX;YACP,gBAAgB;YAChB,aAAa;SACd;qFAKU,SAAS,mBATL,YAAY,aAEzB,gBAAgB;QAChB,aAAa,aAEL,YAAY;oFAIX,SAAS;cAVrB,QAAQ;eAAC;gBACR,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,OAAO,EAAE;oBACP,gBAAgB;oBAChB,aAAa;iBACd;gBACD,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,OAAO,EAAE,EAAE;aAEZ;;;ACbD;;;;ACAA;;;;;;"}
package/kvm/kvm.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="kvm" />
5
+ export * from './public-api';
6
+ //# sourceMappingURL=kvm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kvm.d.ts","sourceRoot":"","sources":["../../projects/kvm/src/kvm.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { IDataProcessor, ILogger, KeyBoardHelper, MouseHelper } from '@open-amt-cloud-toolkit/ui-toolkit/core';
3
+ import * as i0 from "@angular/core";
4
+ export declare class KvmComponent implements OnInit, AfterViewInit, OnDestroy {
5
+ canvas: ElementRef | undefined;
6
+ device: string;
7
+ context: CanvasRenderingContext2D;
8
+ width: number;
9
+ height: number;
10
+ mpsServer: string;
11
+ authToken: string;
12
+ deviceId: string;
13
+ deviceStatus: EventEmitter<number>;
14
+ deviceConnection: EventEmitter<boolean>;
15
+ selectedEncoding: EventEmitter<number>;
16
+ module: any;
17
+ redirector: any;
18
+ dataProcessor: IDataProcessor | null;
19
+ mouseHelper: MouseHelper;
20
+ keyboardHelper: KeyBoardHelper;
21
+ logger: ILogger;
22
+ powerState: any;
23
+ selected: number;
24
+ timeInterval: any;
25
+ mouseMove: any;
26
+ encodings: {
27
+ value: number;
28
+ viewValue: string;
29
+ }[];
30
+ constructor();
31
+ ngOnInit(): void;
32
+ ngAfterViewInit(): void;
33
+ instantiate(): void;
34
+ onConnectionStateChange: (redirector: any, state: number) => any;
35
+ onRedirectorError(): void;
36
+ init(): void;
37
+ autoConnect(): void;
38
+ onEncodingChange(): void;
39
+ reset: () => void;
40
+ stopKvm: () => void;
41
+ onMouseup(event: MouseEvent): void;
42
+ onMousedown(event: MouseEvent): void;
43
+ onMousemove(event: MouseEvent): void;
44
+ ngOnDestroy(): void;
45
+ static ɵfac: i0.ɵɵFactoryDef<KvmComponent, never>;
46
+ static ɵcmp: i0.ɵɵComponentDefWithMeta<KvmComponent, "amt-kvm", never, { "width": "width"; "height": "height"; "mpsServer": "mpsServer"; "authToken": "authToken"; "deviceId": "deviceId"; "deviceConnection": "deviceConnection"; "selectedEncoding": "selectedEncoding"; }, { "deviceStatus": "deviceStatus"; }, never, never>;
47
+ }
48
+ //# sourceMappingURL=kvm.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kvm.component.d.ts","sourceRoot":"","sources":["../../../projects/kvm/src/lib/kvm.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,UAAU,EACV,YAAY,EAGZ,SAAS,EACT,MAAM,EAGP,MAAM,eAAe,CAAA;AACtB,OAAO,EAKL,cAAc,EACd,OAAO,EACP,cAAc,EACd,WAAW,EAEZ,MAAM,yCAAyC,CAAA;;AAKhD,qBAKa,YAAa,YAAW,MAAM,EAAE,aAAa,EAAE,SAAS;IAC3B,MAAM,EAAE,UAAU,GAAG,SAAS,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IAC/C,OAAO,EAAG,wBAAwB,CAAA;IAIzB,KAAK,SAAM;IACX,MAAM,SAAM;IACZ,SAAS,SAAK;IACd,SAAS,SAAK;IACd,QAAQ,SAAK;IAEnB,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,CAA6B;IAChE,gBAAgB,EAAE,YAAY,CAAC,OAAO,CAAC,CAA8B;IACrE,gBAAgB,EAAE,YAAY,CAAC,MAAM,CAAC,CAA6B;IAC5E,MAAM,EAAE,GAAG,CAAA;IACX,UAAU,EAAE,GAAG,CAAA;IACf,aAAa,EAAG,cAAc,GAAG,IAAI,CAAA;IACrC,WAAW,EAAG,WAAW,CAAA;IACzB,cAAc,EAAG,cAAc,CAAA;IAC/B,MAAM,EAAG,OAAO,CAAA;IAChB,UAAU,EAAE,GAAG,CAAI;IACnB,QAAQ,SAAI;IACZ,YAAY,EAAG,GAAG,CAAA;IAClB,SAAS,EAAE,GAAG,CAAO;IACrB,SAAS;;;QAGR;;IAQD,QAAQ,IAAI,IAAI;IAehB,eAAe,IAAI,IAAI;IAIvB,WAAW,IAAI,IAAI;IA0CnB,uBAAuB,eAAgB,GAAG,SAAS,MAAM,KAAG,GAAG,CAE9D;IAED,iBAAiB,IAAI,IAAI;IAIzB,IAAI,IAAI,IAAI;IAOZ,WAAW,IAAI,IAAI;IAOnB,gBAAgB,IAAI,IAAI;IAOxB,KAAK,QAAO,IAAI,CAOf;IAED,OAAO,QAAO,IAAI,CAIjB;IAED,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMlC,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMpC,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAMpC,WAAW,IAAI,IAAI;iCAhKR,YAAY;2CAAZ,YAAY;CAmKxB"}
@@ -0,0 +1,10 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./kvm.component";
3
+ import * as i2 from "@angular/common/http";
4
+ import * as i3 from "@angular/platform-browser";
5
+ export declare class KvmModule {
6
+ static ɵfac: i0.ɵɵFactoryDef<KvmModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDefWithMeta<KvmModule, [typeof i1.KvmComponent], [typeof i2.HttpClientModule, typeof i3.BrowserModule], [typeof i1.KvmComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDef<KvmModule>;
9
+ }
10
+ //# sourceMappingURL=kvm.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kvm.module.d.ts","sourceRoot":"","sources":["../../../projects/kvm/src/lib/kvm.module.ts"],"names":[],"mappings":";;;;AAIA,qBAUa,SAAS;iCAAT,SAAS;0CAAT,SAAS;kCAAT,SAAS;CAAI"}
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "kvm",
3
+ "version": "2.0.2",
4
+ "peerDependencies": {
5
+ "@angular/common": "^11.2.14",
6
+ "@angular/core": "^11.2.14"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.0.0"
10
+ },
11
+ "main": "bundles/kvm.umd.js",
12
+ "module": "fesm2015/kvm.js",
13
+ "es2015": "fesm2015/kvm.js",
14
+ "esm2015": "esm2015/kvm.js",
15
+ "fesm2015": "fesm2015/kvm.js",
16
+ "typings": "kvm.d.ts",
17
+ "sideEffects": false,
18
+ "scripts": {
19
+ "prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\\nPlease delete and rebuild the package, without compiling with Ivy, before attempting to publish.\\n')\" && exit 1"
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ export * from './lib/kvm.component';
2
+ export * from './lib/kvm.module';
3
+ //# sourceMappingURL=public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../projects/kvm/src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-amt-cloud-toolkit/ui-toolkit-angular",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "license": "Apache-2.0",
5
5
  "bugs": {
6
6
  "url": "https://github.com/open-amt-cloud-toolkit/ui-toolkit-angular/issues"
package/sol/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Sol
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.14.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project sol` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project sol`.
8
+ > Note: Don't forget to add `--project sol` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build sol` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build sol`, go to the dist folder `cd dist/sol` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test sol` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,237 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('xterm'), require('@open-amt-cloud-toolkit/ui-toolkit/core'), require('@angular/common'), require('@angular/cdk/keycodes'), require('@angular/platform-browser'), require('@angular/common/http')) :
3
+ typeof define === 'function' && define.amd ? define('sol', ['exports', '@angular/core', 'xterm', '@open-amt-cloud-toolkit/ui-toolkit/core', '@angular/common', '@angular/cdk/keycodes', '@angular/platform-browser', '@angular/common/http'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sol = {}, global.ng.core, global.xterm, global['@open-amt-cloud-toolkit']['ui-toolkit'].core, global.ng.common, global.ng.cdk.keycodes, global.ng.platformBrowser, global.ng.common.http));
5
+ }(this, (function (exports, i0, xterm, core, i1, keycodes, platformBrowser, http) { 'use strict';
6
+
7
+ var TerminalComponent = /** @class */ (function () {
8
+ function TerminalComponent() {
9
+ this.handleKeyPress = new i0.EventEmitter();
10
+ }
11
+ TerminalComponent.prototype.ngOnInit = function () {
12
+ var _this = this;
13
+ this.container = document.getElementById('terminal');
14
+ this.term.open(this.container);
15
+ this.term.onData(function (data) {
16
+ _this.handleKeyPress.emit(data);
17
+ });
18
+ this.term.attachCustomKeyEventHandler(function (e) {
19
+ e.stopPropagation();
20
+ e.preventDefault();
21
+ if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === keycodes.C) {
22
+ return navigator.clipboard.writeText(_this.term.getSelection());
23
+ }
24
+ else if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === keycodes.V) {
25
+ return navigator.clipboard.readText().then(function (text) {
26
+ _this.handleKeyPress.emit(text);
27
+ });
28
+ }
29
+ else if (e.code === keycodes.SPACE) {
30
+ return _this.handleKeyPress.emit(e.key);
31
+ }
32
+ });
33
+ };
34
+ return TerminalComponent;
35
+ }());
36
+ TerminalComponent.ɵfac = function TerminalComponent_Factory(t) { return new (t || TerminalComponent)(); };
37
+ TerminalComponent.ɵcmp = i0.ɵɵdefineComponent({ type: TerminalComponent, selectors: [["amt-terminal"]], inputs: { term: "term" }, outputs: { handleKeyPress: "handleKeyPress" }, decls: 1, vars: 0, consts: [["id", "terminal", 1, "xtermDisplay", 2, "width", "fit-content"]], template: function TerminalComponent_Template(rf, ctx) {
38
+ if (rf & 1) {
39
+ i0.ɵɵelement(0, "div", 0);
40
+ }
41
+ }, encapsulation: 2 });
42
+ (function () {
43
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TerminalComponent, [{
44
+ type: i0.Component,
45
+ args: [{
46
+ selector: 'amt-terminal',
47
+ templateUrl: './terminal.component.html'
48
+ }]
49
+ }], null, { term: [{
50
+ type: i0.Input
51
+ }], handleKeyPress: [{
52
+ type: i0.Output
53
+ }] });
54
+ })();
55
+
56
+ function SolComponent_amt_terminal_1_Template(rf, ctx) {
57
+ if (rf & 1) {
58
+ var _r2_1 = i0.ɵɵgetCurrentView();
59
+ i0.ɵɵelementStart(0, "amt-terminal", 2);
60
+ i0.ɵɵlistener("handleKeyPress", function SolComponent_amt_terminal_1_Template_amt_terminal_handleKeyPress_0_listener($event) { i0.ɵɵrestoreView(_r2_1); var ctx_r1 = i0.ɵɵnextContext(); return ctx_r1.handleKeyPress($event); });
61
+ i0.ɵɵelementEnd();
62
+ }
63
+ if (rf & 2) {
64
+ var ctx_r0 = i0.ɵɵnextContext();
65
+ i0.ɵɵproperty("term", ctx_r0.term);
66
+ }
67
+ }
68
+ var SolComponent = /** @class */ (function () {
69
+ function SolComponent() {
70
+ this.deviceState = 0;
71
+ this.logger = new core.ConsoleLogger(core.LogLevel.ERROR);
72
+ this.deviceStatus = new i0.EventEmitter();
73
+ this.deviceConnection = new i0.EventEmitter();
74
+ this.mpsServer = '';
75
+ this.authToken = '';
76
+ this.deviceId = '';
77
+ }
78
+ SolComponent.prototype.ngOnInit = function () {
79
+ var _this = this;
80
+ this.deviceConnection.subscribe(function (data) {
81
+ if (data) {
82
+ _this.init();
83
+ }
84
+ else {
85
+ _this.stopSol();
86
+ }
87
+ });
88
+ };
89
+ SolComponent.prototype.ngAfterViewInit = function () {
90
+ this.init();
91
+ };
92
+ SolComponent.prototype.init = function () {
93
+ var _this = this;
94
+ this.instantiate();
95
+ setTimeout(function () {
96
+ _this.startSol();
97
+ }, 4000);
98
+ };
99
+ SolComponent.prototype.instantiate = function () {
100
+ this.terminal = new core.AmtTerminal();
101
+ this.dataProcessor = new core.TerminalDataProcessor(this.terminal);
102
+ this.redirector = new core.AMTRedirector(this.logger, core.Protocol.SOL, new FileReader(), this.deviceId, 16994, '', '', 0, 0, this.authToken, this.mpsServer);
103
+ this.terminal.onSend = this.redirector.send.bind(this.redirector);
104
+ this.redirector.onNewState = this.terminal.StateChange.bind(this.terminal);
105
+ this.redirector.onStateChanged = this.onTerminalStateChange.bind(this);
106
+ this.redirector.onProcessData = this.dataProcessor.processData.bind(this);
107
+ this.dataProcessor.processDataToXterm = this.handleWriteToXterm.bind(this);
108
+ this.dataProcessor.clearTerminal = this.handleClearTerminal.bind(this);
109
+ this.term = new xterm.Terminal({
110
+ rows: 30,
111
+ cols: 100,
112
+ cursorStyle: 'block',
113
+ fontWeight: 'bold'
114
+ });
115
+ };
116
+ SolComponent.prototype.handleKeyPress = function (domEvent) {
117
+ this.terminal.TermSendKeys(domEvent);
118
+ };
119
+ SolComponent.prototype.handleClearTerminal = function () {
120
+ this.term.reset();
121
+ };
122
+ SolComponent.prototype.handleWriteToXterm = function (str) {
123
+ this.term.write(str);
124
+ };
125
+ SolComponent.prototype.onTerminalStateChange = function (redirector, state) {
126
+ this.deviceStatus.emit(state);
127
+ this.deviceState = state;
128
+ };
129
+ SolComponent.prototype.startSol = function () {
130
+ if (this.redirector !== null) {
131
+ this.redirector.start(WebSocket);
132
+ }
133
+ };
134
+ SolComponent.prototype.stopSol = function () {
135
+ if (this.redirector !== null) {
136
+ this.redirector.stop();
137
+ this.handleClearTerminal();
138
+ this.term.dispose();
139
+ this.cleanup();
140
+ }
141
+ };
142
+ SolComponent.prototype.cleanup = function () {
143
+ this.terminal = null;
144
+ this.redirector = null;
145
+ this.dataProcessor = null;
146
+ this.term = null;
147
+ };
148
+ SolComponent.prototype.ngOnDestroy = function () {
149
+ this.stopSol();
150
+ };
151
+ return SolComponent;
152
+ }());
153
+ SolComponent.ɵfac = function SolComponent_Factory(t) { return new (t || SolComponent)(); };
154
+ SolComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SolComponent, selectors: [["amt-sol"]], inputs: { deviceConnection: "deviceConnection", mpsServer: "mpsServer", authToken: "authToken", deviceId: "deviceId" }, outputs: { deviceStatus: "deviceStatus" }, decls: 2, vars: 1, consts: [[1, "container"], [3, "term", "handleKeyPress", 4, "ngIf"], [3, "term", "handleKeyPress"]], template: function SolComponent_Template(rf, ctx) {
155
+ if (rf & 1) {
156
+ i0.ɵɵelementStart(0, "div", 0);
157
+ i0.ɵɵtemplate(1, SolComponent_amt_terminal_1_Template, 1, 1, "amt-terminal", 1);
158
+ i0.ɵɵelementEnd();
159
+ }
160
+ if (rf & 2) {
161
+ i0.ɵɵadvance(1);
162
+ i0.ɵɵproperty("ngIf", ctx.deviceState === 3);
163
+ }
164
+ }, directives: [i1.NgIf, TerminalComponent], styles: [".container{display:block;text-align:center}.xtermDisplay{display:inline-block}"], encapsulation: 2 });
165
+ (function () {
166
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SolComponent, [{
167
+ type: i0.Component,
168
+ args: [{
169
+ selector: 'amt-sol',
170
+ templateUrl: './sol.component.html',
171
+ styleUrls: ['./sol.component.css'],
172
+ encapsulation: i0.ViewEncapsulation.None
173
+ }]
174
+ }], function () { return []; }, { deviceStatus: [{
175
+ type: i0.Output
176
+ }], deviceConnection: [{
177
+ type: i0.Input
178
+ }], mpsServer: [{
179
+ type: i0.Input
180
+ }], authToken: [{
181
+ type: i0.Input
182
+ }], deviceId: [{
183
+ type: i0.Input
184
+ }] });
185
+ })();
186
+
187
+ var SolModule = /** @class */ (function () {
188
+ function SolModule() {
189
+ }
190
+ return SolModule;
191
+ }());
192
+ SolModule.ɵfac = function SolModule_Factory(t) { return new (t || SolModule)(); };
193
+ SolModule.ɵmod = i0.ɵɵdefineNgModule({ type: SolModule });
194
+ SolModule.ɵinj = i0.ɵɵdefineInjector({ imports: [[
195
+ http.HttpClientModule,
196
+ platformBrowser.BrowserModule
197
+ ]] });
198
+ (function () {
199
+ (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(SolModule, { declarations: [SolComponent,
200
+ TerminalComponent], imports: [http.HttpClientModule,
201
+ platformBrowser.BrowserModule], exports: [SolComponent] });
202
+ })();
203
+ (function () {
204
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SolModule, [{
205
+ type: i0.NgModule,
206
+ args: [{
207
+ declarations: [
208
+ SolComponent,
209
+ TerminalComponent
210
+ ],
211
+ imports: [
212
+ http.HttpClientModule,
213
+ platformBrowser.BrowserModule
214
+ ],
215
+ exports: [
216
+ SolComponent
217
+ ],
218
+ schemas: [i0.CUSTOM_ELEMENTS_SCHEMA]
219
+ }]
220
+ }], null, null);
221
+ })();
222
+
223
+ /*
224
+ * Public API Surface of sol
225
+ */
226
+
227
+ /**
228
+ * Generated bundle index. Do not edit.
229
+ */
230
+
231
+ exports.SolComponent = SolComponent;
232
+ exports.SolModule = SolModule;
233
+
234
+ Object.defineProperty(exports, '__esModule', { value: true });
235
+
236
+ })));
237
+ //# sourceMappingURL=sol.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sol.umd.js","sources":["../../../projects/sol/src/lib/terminal/terminal.component.ts","../../../projects/sol/src/lib/terminal/terminal.component.html","../../../projects/sol/src/lib/sol.component.html","../../../projects/sol/src/lib/sol.component.ts","../../../projects/sol/src/lib/sol.module.ts","../../../projects/sol/src/public-api.ts","../../../projects/sol/src/sol.ts"],"sourcesContent":["import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'\nimport { C, V, SPACE } from '@angular/cdk/keycodes'\n@Component({\n selector: 'amt-terminal',\n templateUrl: './terminal.component.html'\n})\n\nexport class TerminalComponent implements OnInit {\n @Input() term: any\n @Output() handleKeyPress: EventEmitter<any> = new EventEmitter<any>()\n container!: any\n ngOnInit(): void {\n this.container = document.getElementById('terminal')\n this.term.open(this.container)\n this.term.onData((data: any) => {\n this.handleKeyPress.emit(data)\n })\n this.term.attachCustomKeyEventHandler((e: any) => {\n e.stopPropagation()\n e.preventDefault()\n if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === C) {\n return navigator.clipboard.writeText(this.term.getSelection())\n } else if (e.ctrlKey === true && e.shiftKey === true && e.keyCode === V) {\n return navigator.clipboard.readText().then(text => {\n this.handleKeyPress.emit(text)\n })\n } else if (e.code === SPACE) {\n return this.handleKeyPress.emit(e.key)\n }\n })\n }\n}\n","<div id=\"terminal\" class=\"xtermDisplay\" style=\"width: fit-content;\"></div>\n","<div class=\"container\">\n <amt-terminal *ngIf=\"deviceState === 3\" [term]=\"term\" (handleKeyPress)=\"handleKeyPress($event)\"></amt-terminal>\n</div>","import { Component, EventEmitter, OnInit, Output, ViewEncapsulation, OnDestroy, Input, AfterViewInit } from '@angular/core'\nimport { Terminal } from 'xterm'\nimport { AmtTerminal, AMTRedirector, TerminalDataProcessor, ConsoleLogger, Protocol, LogLevel } from '@open-amt-cloud-toolkit/ui-toolkit/core'\n\n@Component({\n selector: 'amt-sol',\n templateUrl: './sol.component.html',\n styleUrls: ['./sol.component.css'],\n encapsulation: ViewEncapsulation.None\n})\nexport class SolComponent implements OnInit, OnDestroy, AfterViewInit {\n terminal: any\n container!: any\n term: any\n redirector: any\n dataProcessor: any\n deviceState = 0\n logger: ConsoleLogger = new ConsoleLogger(LogLevel.ERROR)\n @Output() deviceStatus: EventEmitter<number> = new EventEmitter<number>()\n @Input() deviceConnection: EventEmitter<boolean> = new EventEmitter<boolean>()\n @Input() public mpsServer = ''\n @Input() public authToken = ''\n @Input() public deviceId = ''\n\n constructor() {\n\n }\n\n ngOnInit(): void {\n this.deviceConnection.subscribe((data: boolean) => {\n if (data) {\n this.init()\n } else {\n this.stopSol()\n }\n })\n }\n\n ngAfterViewInit(): void {\n this.init()\n }\n\n init(): void {\n this.instantiate()\n setTimeout(() => {\n this.startSol()\n }, 4000)\n }\n\n instantiate(): void {\n this.terminal = new AmtTerminal()\n this.dataProcessor = new TerminalDataProcessor(this.terminal)\n this.redirector = new AMTRedirector(\n this.logger,\n Protocol.SOL,\n new FileReader(),\n this.deviceId, 16994,\n '',\n '',\n 0,\n 0,\n this.authToken,\n this.mpsServer\n )\n this.terminal.onSend = this.redirector.send.bind(this.redirector)\n this.redirector.onNewState = this.terminal.StateChange.bind(this.terminal)\n this.redirector.onStateChanged = this.onTerminalStateChange.bind(this)\n this.redirector.onProcessData = this.dataProcessor.processData.bind(this)\n this.dataProcessor.processDataToXterm = this.handleWriteToXterm.bind(this)\n this.dataProcessor.clearTerminal = this.handleClearTerminal.bind(this)\n this.term = new Terminal({\n rows: 30,\n cols: 100,\n cursorStyle: 'block',\n fontWeight: 'bold'\n })\n }\n\n\n handleKeyPress(domEvent: any): void {\n this.terminal.TermSendKeys(domEvent)\n }\n\n handleClearTerminal(): void {\n this.term.reset()\n }\n\n handleWriteToXterm(str: string): void {\n this.term.write(str)\n }\n\n onTerminalStateChange(redirector: AMTRedirector, state: number): void {\n this.deviceStatus.emit(state)\n this.deviceState = state\n }\n\n startSol(): void {\n if (this.redirector !== null) {\n this.redirector.start(WebSocket)\n }\n }\n\n stopSol(): void {\n if (this.redirector !== null) {\n this.redirector.stop()\n this.handleClearTerminal()\n this.term.dispose()\n this.cleanup()\n }\n }\n\n cleanup(): void {\n this.terminal = null\n this.redirector = null\n this.dataProcessor = null\n this.term = null\n }\n\n ngOnDestroy(): void {\n this.stopSol()\n }\n}\n","import { CUSTOM_ELEMENTS_SCHEMA, ModuleWithProviders, NgModule } from '@angular/core'\nimport { BrowserModule } from '@angular/platform-browser'\nimport { HttpClientModule } from '@angular/common/http'\nimport { SolComponent } from './sol.component'\nimport { TerminalComponent } from './terminal/terminal.component'\n\n@NgModule({\n declarations: [\n SolComponent,\n TerminalComponent\n ],\n imports: [\n HttpClientModule,\n BrowserModule\n ],\n exports: [\n SolComponent\n ],\n schemas: [CUSTOM_ELEMENTS_SCHEMA]\n})\nexport class SolModule {\n}\n","/*\n * Public API Surface of sol\n */\n\nexport * from './lib/sol.component'\nexport * from './lib/sol.module'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["EventEmitter","C","V","SPACE","i0.ɵɵelement","Component","Input","Output","i0.ɵɵelementStart","i0.ɵɵlistener","i0.ɵɵelementEnd","i0.ɵɵproperty","ConsoleLogger","LogLevel","AmtTerminal","TerminalDataProcessor","AMTRedirector","Protocol","Terminal","i0.ɵɵtemplate","i0.ɵɵadvance","ViewEncapsulation","HttpClientModule","BrowserModule","NgModule","CUSTOM_ELEMENTS_SCHEMA"],"mappings":";;;;;;IAOA;QALA;YAOc,mBAAc,GAAsB,IAAIA,eAAY,EAAO,CAAA;SAsBxE;QApBG,oCAAQ,GAAR;YAAA,iBAmBC;YAlBG,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;YACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAC,IAAS;gBACvB,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACjC,CAAC,CAAA;YACF,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,UAAC,CAAM;gBACzC,CAAC,CAAC,eAAe,EAAE,CAAA;gBACnB,CAAC,CAAC,cAAc,EAAE,CAAA;gBAClB,IAAI,CAAC,CAAC,OAAO,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