ngx-hana-nameserver-history-viewer 1.2.1-2.beta → 21.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.
Files changed (147) hide show
  1. package/README.md +2 -1
  2. package/{fesm2020 → fesm2022}/ngx-hana-nameserver-history-viewer.mjs +3925 -3979
  3. package/fesm2022/ngx-hana-nameserver-history-viewer.mjs.map +1 -0
  4. package/ngx-hana-nameserver-history-viewer-21.0.0.tgz +0 -0
  5. package/package.json +17 -25
  6. package/types/ngx-hana-nameserver-history-viewer.d.ts +534 -0
  7. package/esm2020/ngx-hana-nameserver-history-viewer.mjs +0 -5
  8. package/esm2020/public-api.mjs +0 -2
  9. package/esm2020/src/nameserver-history-viewer/components/alert/alert.component.mjs +0 -68
  10. package/esm2020/src/nameserver-history-viewer/components/alert/alert.module.mjs +0 -22
  11. package/esm2020/src/nameserver-history-viewer/components/alert/index.mjs +0 -3
  12. package/esm2020/src/nameserver-history-viewer/components/file-drop-input/file-drop-input.component.mjs +0 -112
  13. package/esm2020/src/nameserver-history-viewer/components/file-drop-input/index.mjs +0 -2
  14. package/esm2020/src/nameserver-history-viewer/components/index.mjs +0 -9
  15. package/esm2020/src/nameserver-history-viewer/components/instruction/index.mjs +0 -2
  16. package/esm2020/src/nameserver-history-viewer/components/instruction/instruction.component.mjs +0 -42
  17. package/esm2020/src/nameserver-history-viewer/components/nameserver-history.component.mjs +0 -556
  18. package/esm2020/src/nameserver-history-viewer/components/port-selector/index.mjs +0 -2
  19. package/esm2020/src/nameserver-history-viewer/components/port-selector/port-selector.component.mjs +0 -69
  20. package/esm2020/src/nameserver-history-viewer/components/port-selector/port-selector.service.mjs +0 -41
  21. package/esm2020/src/nameserver-history-viewer/components/progress-bar/index.mjs +0 -2
  22. package/esm2020/src/nameserver-history-viewer/components/progress-bar/progress-bar.component.mjs +0 -40
  23. package/esm2020/src/nameserver-history-viewer/components/time-range-selector/index.mjs +0 -2
  24. package/esm2020/src/nameserver-history-viewer/components/time-range-selector/time-range-selector.component.mjs +0 -70
  25. package/esm2020/src/nameserver-history-viewer/components/timezone-selector/index.mjs +0 -2
  26. package/esm2020/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.component.mjs +0 -88
  27. package/esm2020/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.service.mjs +0 -47
  28. package/esm2020/src/nameserver-history-viewer/index.mjs +0 -3
  29. package/esm2020/src/nameserver-history-viewer/nameserver-history.module.mjs +0 -63
  30. package/esm2020/src/nameserver-history-viewer/services/chart.service.mjs +0 -328
  31. package/esm2020/src/nameserver-history-viewer/services/file.service.mjs +0 -390
  32. package/esm2020/src/nameserver-history-viewer/services/index.mjs +0 -4
  33. package/esm2020/src/nameserver-history-viewer/services/ui.service.mjs +0 -557
  34. package/esm2020/src/nameserver-history-viewer/types/abort.types.mjs +0 -6
  35. package/esm2020/src/nameserver-history-viewer/types/alert.types.mjs +0 -8
  36. package/esm2020/src/nameserver-history-viewer/types/chart-content-data-item.types.mjs +0 -2
  37. package/esm2020/src/nameserver-history-viewer/types/chart-content-data.types.mjs +0 -2
  38. package/esm2020/src/nameserver-history-viewer/types/chart-content-header.types.mjs +0 -2
  39. package/esm2020/src/nameserver-history-viewer/types/chart-content-time.types.mjs +0 -2
  40. package/esm2020/src/nameserver-history-viewer/types/chart-content.types.mjs +0 -2
  41. package/esm2020/src/nameserver-history-viewer/types/color-rgba.types.mjs +0 -2
  42. package/esm2020/src/nameserver-history-viewer/types/html-element.type.mjs +0 -9
  43. package/esm2020/src/nameserver-history-viewer/types/index.mjs +0 -28
  44. package/esm2020/src/nameserver-history-viewer/types/item.types.mjs +0 -14
  45. package/esm2020/src/nameserver-history-viewer/types/legend-color.types.mjs +0 -2
  46. package/esm2020/src/nameserver-history-viewer/types/load-history-info-backup.types.mjs +0 -2
  47. package/esm2020/src/nameserver-history-viewer/types/load-history-info-columnstore.types.mjs +0 -2
  48. package/esm2020/src/nameserver-history-viewer/types/load-history-info-host.types.mjs +0 -2
  49. package/esm2020/src/nameserver-history-viewer/types/load-history-info-item.types.mjs +0 -2
  50. package/esm2020/src/nameserver-history-viewer/types/load-history-info-persistence.types.mjs +0 -2
  51. package/esm2020/src/nameserver-history-viewer/types/load-history-info-rowstore.types.mjs +0 -2
  52. package/esm2020/src/nameserver-history-viewer/types/load-history-info-server.types.mjs +0 -2
  53. package/esm2020/src/nameserver-history-viewer/types/load-history-info-session-admission-control.types.mjs +0 -2
  54. package/esm2020/src/nameserver-history-viewer/types/load-history-info-sql.types.mjs +0 -2
  55. package/esm2020/src/nameserver-history-viewer/types/load-history-info-sync-primitives.types.mjs +0 -2
  56. package/esm2020/src/nameserver-history-viewer/types/load-history-info-threads.types.mjs +0 -2
  57. package/esm2020/src/nameserver-history-viewer/types/load-history-info.types.mjs +0 -2
  58. package/esm2020/src/nameserver-history-viewer/types/port.types.mjs +0 -2
  59. package/esm2020/src/nameserver-history-viewer/types/scale-group.types.mjs +0 -17
  60. package/esm2020/src/nameserver-history-viewer/types/unit-category.types.mjs +0 -10
  61. package/esm2020/src/nameserver-history-viewer/types/unit.types.mjs +0 -14
  62. package/esm2020/src/nameserver-history-viewer/utils/chart-util.mjs +0 -25
  63. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/chartjs_ext.mjs +0 -2
  64. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/data_culling.mjs +0 -56
  65. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/data_mipmap.mjs +0 -139
  66. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/index.mjs +0 -41
  67. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/lttb_data_mipmap.mjs +0 -106
  68. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/responsive_downsample_plugin.mjs +0 -167
  69. package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/utils.mjs +0 -114
  70. package/esm2020/src/nameserver-history-viewer/utils/chartjs-zoom/chart.zoom.mjs +0 -527
  71. package/esm2020/src/nameserver-history-viewer/utils/chartjs-zoom/index.mjs +0 -2
  72. package/esm2020/src/nameserver-history-viewer/utils/file-util.mjs +0 -161
  73. package/esm2020/src/nameserver-history-viewer/utils/index.mjs +0 -5
  74. package/esm2020/src/nameserver-history-viewer/utils/time-util.mjs +0 -99
  75. package/esm2020/src/nameserver-history-viewer/utils/ui-util.mjs +0 -162
  76. package/fesm2015/ngx-hana-nameserver-history-viewer.mjs +0 -4097
  77. package/fesm2015/ngx-hana-nameserver-history-viewer.mjs.map +0 -1
  78. package/fesm2020/ngx-hana-nameserver-history-viewer.mjs.map +0 -1
  79. package/ngx-hana-nameserver-history-viewer.d.ts +0 -5
  80. package/public-api.d.ts +0 -1
  81. package/src/nameserver-history-viewer/components/alert/alert.component.d.ts +0 -21
  82. package/src/nameserver-history-viewer/components/alert/alert.module.d.ts +0 -8
  83. package/src/nameserver-history-viewer/components/alert/index.d.ts +0 -2
  84. package/src/nameserver-history-viewer/components/file-drop-input/file-drop-input.component.d.ts +0 -16
  85. package/src/nameserver-history-viewer/components/file-drop-input/index.d.ts +0 -1
  86. package/src/nameserver-history-viewer/components/index.d.ts +0 -8
  87. package/src/nameserver-history-viewer/components/instruction/index.d.ts +0 -1
  88. package/src/nameserver-history-viewer/components/instruction/instruction.component.d.ts +0 -17
  89. package/src/nameserver-history-viewer/components/nameserver-history.component.d.ts +0 -262
  90. package/src/nameserver-history-viewer/components/port-selector/index.d.ts +0 -1
  91. package/src/nameserver-history-viewer/components/port-selector/port-selector.component.d.ts +0 -31
  92. package/src/nameserver-history-viewer/components/port-selector/port-selector.service.d.ts +0 -14
  93. package/src/nameserver-history-viewer/components/progress-bar/index.d.ts +0 -1
  94. package/src/nameserver-history-viewer/components/progress-bar/progress-bar.component.d.ts +0 -6
  95. package/src/nameserver-history-viewer/components/time-range-selector/index.d.ts +0 -1
  96. package/src/nameserver-history-viewer/components/time-range-selector/time-range-selector.component.d.ts +0 -19
  97. package/src/nameserver-history-viewer/components/timezone-selector/index.d.ts +0 -1
  98. package/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.component.d.ts +0 -26
  99. package/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.service.d.ts +0 -21
  100. package/src/nameserver-history-viewer/index.d.ts +0 -2
  101. package/src/nameserver-history-viewer/nameserver-history.module.d.ts +0 -19
  102. package/src/nameserver-history-viewer/services/chart.service.d.ts +0 -59
  103. package/src/nameserver-history-viewer/services/file.service.d.ts +0 -63
  104. package/src/nameserver-history-viewer/services/index.d.ts +0 -3
  105. package/src/nameserver-history-viewer/services/ui.service.d.ts +0 -88
  106. package/src/nameserver-history-viewer/types/abort.types.d.ts +0 -4
  107. package/src/nameserver-history-viewer/types/alert.types.d.ts +0 -6
  108. package/src/nameserver-history-viewer/types/chart-content-data-item.types.d.ts +0 -4
  109. package/src/nameserver-history-viewer/types/chart-content-data.types.d.ts +0 -4
  110. package/src/nameserver-history-viewer/types/chart-content-header.types.d.ts +0 -4
  111. package/src/nameserver-history-viewer/types/chart-content-time.types.d.ts +0 -3
  112. package/src/nameserver-history-viewer/types/chart-content.types.d.ts +0 -10
  113. package/src/nameserver-history-viewer/types/color-rgba.types.d.ts +0 -6
  114. package/src/nameserver-history-viewer/types/html-element.type.d.ts +0 -7
  115. package/src/nameserver-history-viewer/types/index.d.ts +0 -27
  116. package/src/nameserver-history-viewer/types/item.types.d.ts +0 -12
  117. package/src/nameserver-history-viewer/types/legend-color.types.d.ts +0 -4
  118. package/src/nameserver-history-viewer/types/load-history-info-backup.types.d.ts +0 -7
  119. package/src/nameserver-history-viewer/types/load-history-info-columnstore.types.d.ts +0 -7
  120. package/src/nameserver-history-viewer/types/load-history-info-host.types.d.ts +0 -15
  121. package/src/nameserver-history-viewer/types/load-history-info-item.types.d.ts +0 -13
  122. package/src/nameserver-history-viewer/types/load-history-info-persistence.types.d.ts +0 -11
  123. package/src/nameserver-history-viewer/types/load-history-info-rowstore.types.d.ts +0 -5
  124. package/src/nameserver-history-viewer/types/load-history-info-server.types.d.ts +0 -10
  125. package/src/nameserver-history-viewer/types/load-history-info-session-admission-control.types.d.ts +0 -10
  126. package/src/nameserver-history-viewer/types/load-history-info-sql.types.d.ts +0 -16
  127. package/src/nameserver-history-viewer/types/load-history-info-sync-primitives.types.d.ts +0 -5
  128. package/src/nameserver-history-viewer/types/load-history-info-threads.types.d.ts +0 -9
  129. package/src/nameserver-history-viewer/types/load-history-info.types.d.ts +0 -22
  130. package/src/nameserver-history-viewer/types/port.types.d.ts +0 -5
  131. package/src/nameserver-history-viewer/types/scale-group.types.d.ts +0 -15
  132. package/src/nameserver-history-viewer/types/unit-category.types.d.ts +0 -8
  133. package/src/nameserver-history-viewer/types/unit.types.d.ts +0 -12
  134. package/src/nameserver-history-viewer/utils/chart-util.d.ts +0 -14
  135. package/src/nameserver-history-viewer/utils/chartjs-downsample/chartjs_ext.d.ts +0 -89
  136. package/src/nameserver-history-viewer/utils/chartjs-downsample/data_culling.d.ts +0 -32
  137. package/src/nameserver-history-viewer/utils/chartjs-downsample/data_mipmap.d.ts +0 -78
  138. package/src/nameserver-history-viewer/utils/chartjs-downsample/index.d.ts +0 -1
  139. package/src/nameserver-history-viewer/utils/chartjs-downsample/lttb_data_mipmap.d.ts +0 -57
  140. package/src/nameserver-history-viewer/utils/chartjs-downsample/responsive_downsample_plugin.d.ts +0 -55
  141. package/src/nameserver-history-viewer/utils/chartjs-downsample/utils.d.ts +0 -64
  142. package/src/nameserver-history-viewer/utils/chartjs-zoom/chart.zoom.d.ts +0 -30
  143. package/src/nameserver-history-viewer/utils/chartjs-zoom/index.d.ts +0 -1
  144. package/src/nameserver-history-viewer/utils/file-util.d.ts +0 -68
  145. package/src/nameserver-history-viewer/utils/index.d.ts +0 -4
  146. package/src/nameserver-history-viewer/utils/time-util.d.ts +0 -23
  147. package/src/nameserver-history-viewer/utils/ui-util.d.ts +0 -41
@@ -1,4097 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Input, Output, NgModule, isDevMode, Injectable, ChangeDetectionStrategy, ElementRef, ViewChild } from '@angular/core';
3
- import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i2$1 from '@angular/forms';
6
- import { FormsModule } from '@angular/forms';
7
- import * as i1$1 from '@danielmoncada/angular-datetime-picker';
8
- import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
9
- import moment from 'moment-timezone';
10
- import * as i2 from 'ngx-dropdown-list';
11
- import { DropdownListModule } from 'ngx-dropdown-list';
12
- import { __awaiter } from 'tslib';
13
- import { SelectionModel } from '@angular/cdk/collections';
14
- import * as chartjs from 'chart.js';
15
- import { Chart as Chart$2 } from 'chart.js';
16
- import { parse } from 'papaparse';
17
- import * as hammerjs from 'hammerjs';
18
- import moment$1 from 'moment';
19
- import * as i8 from 'ngx-selection-table';
20
- import { SelectionTableModule } from 'ngx-selection-table';
21
-
22
- class AlertComponent {
23
- constructor() {
24
- this.alertMessageChange = new EventEmitter();
25
- }
26
- ngOnChanges(changes) {
27
- if (changes.alertMessage) {
28
- this._setMessage(changes.alertMessage.currentValue);
29
- }
30
- }
31
- _setMessage(msgString) {
32
- this.message = void 0;
33
- if (msgString && msgString.length > 0) {
34
- this._showMessage(msgString);
35
- this._setTimeout();
36
- }
37
- }
38
- _showMessage(msgString) {
39
- setTimeout(() => this.message = msgString, 100);
40
- }
41
- _setTimeout() {
42
- if (this.alertTimeout > 0) {
43
- // clear time out first, it doesn't matter whether the _timeout is undefined or not.
44
- clearTimeout(this._timeout);
45
- this._timeout = setTimeout(() => this.clearAlert(), this.alertTimeout);
46
- }
47
- }
48
- clearAlert() {
49
- this.alertMessage = void 0;
50
- this.alertType = void 0;
51
- this.alertMessageChange.emit(this.alertMessage);
52
- clearTimeout(this._timeout);
53
- }
54
- /**
55
- * get css class base on the alert type
56
- */
57
- get alertClassType() {
58
- if (this.alertType) {
59
- switch (this.alertType.toLowerCase()) {
60
- case 'success':
61
- return 'alert-success';
62
- case 'error':
63
- return 'alert-error';
64
- case 'info':
65
- return 'alert-info';
66
- case 'warning':
67
- return 'alert-warning';
68
- }
69
- }
70
- }
71
- }
72
- AlertComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
73
- AlertComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: AlertComponent, selector: "alert", inputs: { alertMessage: "alertMessage", alertType: "alertType", alertTimeout: "alertTimeout" }, outputs: { alertMessageChange: "alertMessageChange" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"alert-container\" *ngIf=\"message\">\r\n <div [ngClass]=\"alertClassType\">\r\n {{message}}\r\n <a class=\"close\" (click)=\"clearAlert()\">&times;</a>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n\r\n", styles: [".alert-container{position:relative;width:100%;text-align:left}.alert-container .fadein,.alert-container .alert-error,.alert-container .alert-warning,.alert-container .alert-info,.alert-container .alert-success{animation:fadein 1s;-moz-animation:fadein 1s;-webkit-animation:fadein 1s;-o-animation:fadein 1s}@keyframes fadein{0%{opacity:0}to{opacity:1}}.alert-container .alert,.alert-container .alert-error,.alert-container .alert-warning,.alert-container .alert-info,.alert-container .alert-success{display:inline-block;padding:.5rem 1rem;border:1px solid transparent;border-radius:.25rem;font-size:12px}.alert-container .alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-container .alert-info{color:#0c5460;background-color:#d1ecf1;border-color:#bee5eb}.alert-container .alert-warning{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.alert-container .alert-error{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-container .close{color:#000;text-shadow:0 1px 0 #fff;opacity:.5;box-sizing:border-box}.alert-container .close:hover{cursor:pointer;font-weight:900;color:red}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
74
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AlertComponent, decorators: [{
75
- type: Component,
76
- args: [{ selector: 'alert', template: "<div class=\"alert-container\" *ngIf=\"message\">\r\n <div [ngClass]=\"alertClassType\">\r\n {{message}}\r\n <a class=\"close\" (click)=\"clearAlert()\">&times;</a>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n\r\n", styles: [".alert-container{position:relative;width:100%;text-align:left}.alert-container .fadein,.alert-container .alert-error,.alert-container .alert-warning,.alert-container .alert-info,.alert-container .alert-success{animation:fadein 1s;-moz-animation:fadein 1s;-webkit-animation:fadein 1s;-o-animation:fadein 1s}@keyframes fadein{0%{opacity:0}to{opacity:1}}.alert-container .alert,.alert-container .alert-error,.alert-container .alert-warning,.alert-container .alert-info,.alert-container .alert-success{display:inline-block;padding:.5rem 1rem;border:1px solid transparent;border-radius:.25rem;font-size:12px}.alert-container .alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-container .alert-info{color:#0c5460;background-color:#d1ecf1;border-color:#bee5eb}.alert-container .alert-warning{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.alert-container .alert-error{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-container .close{color:#000;text-shadow:0 1px 0 #fff;opacity:.5;box-sizing:border-box}.alert-container .close:hover{cursor:pointer;font-weight:900;color:red}\n"] }]
77
- }], propDecorators: { alertMessage: [{
78
- type: Input
79
- }], alertType: [{
80
- type: Input
81
- }], alertTimeout: [{
82
- type: Input
83
- }], alertMessageChange: [{
84
- type: Output
85
- }] } });
86
-
87
- class AlertModule {
88
- }
89
- AlertModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
90
- AlertModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AlertModule, declarations: [AlertComponent], imports: [CommonModule], exports: [AlertComponent] });
91
- AlertModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AlertModule, providers: [], imports: [[CommonModule]] });
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AlertModule, decorators: [{
93
- type: NgModule,
94
- args: [{
95
- declarations: [
96
- AlertComponent,
97
- ],
98
- exports: [AlertComponent],
99
- imports: [CommonModule],
100
- providers: [],
101
- bootstrap: [],
102
- }]
103
- }] });
104
-
105
- class FileDropInputComponent {
106
- constructor() {
107
- this.dropAreaText = '';
108
- this.inputAreaText = '';
109
- this.fileDrop = new EventEmitter();
110
- this.fileInput = new EventEmitter();
111
- this.droppingFlag = false;
112
- }
113
- static _stopAndPrevent(event) {
114
- event.stopPropagation(); // Stops some browsers from redirecting.
115
- event.preventDefault(); // Stops some browsers' default action, like open the file directly
116
- }
117
- browseFiles(event) {
118
- this.fileInput.emit(event);
119
- }
120
- onDragOver(event) {
121
- FileDropInputComponent._stopAndPrevent(event);
122
- if (!this.droppingFlag) {
123
- this.droppingFlag = true;
124
- }
125
- }
126
- onDragLeave(event) {
127
- FileDropInputComponent._stopAndPrevent(event);
128
- if (this.droppingFlag) {
129
- this.droppingFlag = false;
130
- }
131
- }
132
- onDropFiles(event) {
133
- FileDropInputComponent._stopAndPrevent(event);
134
- this.droppingFlag = false;
135
- let length = 0;
136
- if (event.dataTransfer.items) {
137
- length = event.dataTransfer.items.length;
138
- }
139
- else {
140
- length = event.dataTransfer.files.length;
141
- }
142
- if (length > 1) {
143
- event.error = 'Multiple files/folders are not supported';
144
- this.fileDrop.emit(event);
145
- return;
146
- }
147
- if (length === 1) {
148
- let fileEntry;
149
- if (event.dataTransfer.items) {
150
- if (event.dataTransfer.items[0].webkitGetAsEntry) {
151
- fileEntry = event.dataTransfer.items[0].webkitGetAsEntry();
152
- }
153
- }
154
- else {
155
- if (event.dataTransfer.files[0].webkitGetAsEntry) {
156
- fileEntry = event.dataTransfer.files[0].webkitGetAsEntry();
157
- }
158
- }
159
- if (fileEntry) {
160
- if (fileEntry.isFile) {
161
- event.error = void 0;
162
- }
163
- else if (fileEntry.isDirectory) {
164
- event.error = `Folder (${fileEntry.name}) is not supported.`;
165
- }
166
- else {
167
- event.error = `Internal error, can not get the type of the dropped item (${fileEntry.name}).`;
168
- }
169
- }
170
- const file = event.dataTransfer.files && event.dataTransfer.files.length > 0 ? event.dataTransfer.files[0] : null;
171
- if (file) {
172
- event.file = file;
173
- }
174
- else {
175
- event.error = 'Internal error, can not get the dropped file.';
176
- }
177
- this.fileDrop.emit(event);
178
- return;
179
- }
180
- }
181
- }
182
- FileDropInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FileDropInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
183
- FileDropInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: FileDropInputComponent, selector: "file-drop-input", inputs: { dropAreaText: "dropAreaText", inputAreaText: "inputAreaText" }, outputs: { fileDrop: "fileDrop", fileInput: "fileInput" }, ngImport: i0, template: `
184
- <div class="file-drop-input" [class.file-drop-dropping]="droppingFlag" (drop)="onDropFiles($event)"
185
- (dragover)="onDragOver($event)" (dragleave)="onDragLeave($event)">
186
- <div class="drop-content">
187
- <label class="input-button">
188
- <input type="file" (change)="browseFiles($event)" accept=".trc"/> {{inputAreaText}}&nbsp;
189
- </label>{{dropAreaText}}
190
- </div>
191
- </div>
192
- `, isInline: true, styles: [".file-drop-dropping{background-color:#94949499}.file-drop-input{width:100%;height:100%;border-radius:1px;border:0}.file-drop-input .drop-content{color:#4169e1;height:46px;display:flex;justify-content:center;align-items:center}.file-drop-input .drop-content .input-button{display:inline-block;border:none;outline:0;cursor:pointer;font-weight:700;padding:0 2px;color:#00008b}.file-drop-input .drop-content .input-button:hover{text-shadow:1px 1px 3px royalblue}.file-drop-input .drop-content .input-button input{display:none}\n"] });
193
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FileDropInputComponent, decorators: [{
194
- type: Component,
195
- args: [{ selector: 'file-drop-input', template: `
196
- <div class="file-drop-input" [class.file-drop-dropping]="droppingFlag" (drop)="onDropFiles($event)"
197
- (dragover)="onDragOver($event)" (dragleave)="onDragLeave($event)">
198
- <div class="drop-content">
199
- <label class="input-button">
200
- <input type="file" (change)="browseFiles($event)" accept=".trc"/> {{inputAreaText}}&nbsp;
201
- </label>{{dropAreaText}}
202
- </div>
203
- </div>
204
- `, styles: [".file-drop-dropping{background-color:#94949499}.file-drop-input{width:100%;height:100%;border-radius:1px;border:0}.file-drop-input .drop-content{color:#4169e1;height:46px;display:flex;justify-content:center;align-items:center}.file-drop-input .drop-content .input-button{display:inline-block;border:none;outline:0;cursor:pointer;font-weight:700;padding:0 2px;color:#00008b}.file-drop-input .drop-content .input-button:hover{text-shadow:1px 1px 3px royalblue}.file-drop-input .drop-content .input-button input{display:none}\n"] }]
205
- }], propDecorators: { dropAreaText: [{
206
- type: Input
207
- }], inputAreaText: [{
208
- type: Input
209
- }], fileDrop: [{
210
- type: Output
211
- }], fileInput: [{
212
- type: Output
213
- }] } });
214
-
215
- class ProgressBarComponent {
216
- }
217
- ProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
218
- ProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: ProgressBarComponent, selector: "progress-bar", inputs: { progress: "progress" }, ngImport: i0, template: `
219
- <div class="progress-content">
220
- <div class="progress">
221
- <span class="bar" [style.width]="progress + '%'" [class.is-done]="progress == 100"></span>
222
- </div>
223
- </div>
224
- <div class="progress-text-content">
225
- <span class="progress-text" [class.is-done]="progress === 100">
226
- <span>{{ progress }}% </span>
227
- <span *ngIf="progress < 100">Parsing...</span> <!--{{file?.name}}-->
228
- <span *ngIf="progress === 100">Done</span>
229
- </span>
230
- </div>
231
- `, isInline: true, styles: [".progress-content{display:flex;align-items:center;margin:8px 10px;padding-right:20px;padding-left:20px}.progress-content .progress{display:block;position:relative;width:100%;height:12px;border-radius:3px;background:#3a4048}.progress-content .progress .bar{position:absolute;top:0;left:0;height:12px;background:linear-gradient(90deg,#13ebff 0,#6cefbd 100%)}.progress-content .progress .bar .is-done{background:#6cefbd}.progress-text-content{display:flex;align-items:center;justify-content:space-between;margin:-5px 30px 0;padding-right:50px}.progress-text-content .progress-text{font-size:13px;font-weight:600;color:#13ebff;transition:color .2s ease-out}.progress-text-content .progress-text .is-done{color:#6cefbd}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
232
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ProgressBarComponent, decorators: [{
233
- type: Component,
234
- args: [{ selector: 'progress-bar', template: `
235
- <div class="progress-content">
236
- <div class="progress">
237
- <span class="bar" [style.width]="progress + '%'" [class.is-done]="progress == 100"></span>
238
- </div>
239
- </div>
240
- <div class="progress-text-content">
241
- <span class="progress-text" [class.is-done]="progress === 100">
242
- <span>{{ progress }}% </span>
243
- <span *ngIf="progress < 100">Parsing...</span> <!--{{file?.name}}-->
244
- <span *ngIf="progress === 100">Done</span>
245
- </span>
246
- </div>
247
- `, styles: [".progress-content{display:flex;align-items:center;margin:8px 10px;padding-right:20px;padding-left:20px}.progress-content .progress{display:block;position:relative;width:100%;height:12px;border-radius:3px;background:#3a4048}.progress-content .progress .bar{position:absolute;top:0;left:0;height:12px;background:linear-gradient(90deg,#13ebff 0,#6cefbd 100%)}.progress-content .progress .bar .is-done{background:#6cefbd}.progress-text-content{display:flex;align-items:center;justify-content:space-between;margin:-5px 30px 0;padding-right:50px}.progress-text-content .progress-text{font-size:13px;font-weight:600;color:#13ebff;transition:color .2s ease-out}.progress-text-content .progress-text .is-done{color:#6cefbd}\n"] }]
248
- }], propDecorators: { progress: [{
249
- type: Input
250
- }] } });
251
-
252
- function _randomColorFactor() {
253
- return Math.round(Math.random() * 255);
254
- }
255
- /**
256
- * generate random color
257
- * @param opacity alpha
258
- */
259
- function randomColor(opacity) {
260
- return 'rgba(' + _randomColorFactor() + ',' + _randomColorFactor() + ',' + _randomColorFactor() + ',' + (opacity || '.3') + ')';
261
- }
262
- /**
263
- * generate the rgba string from ColorRgba
264
- */
265
- function getColorString(rgbaColor) {
266
- return `rgba(${rgbaColor['red']}, ${rgbaColor['green']}, ${rgbaColor['blue']}, ${rgbaColor['alpha']})`;
267
- }
268
- /**
269
- * format Number with commas
270
- */
271
- function getNumberWithCommas(num) {
272
- const [integerPart, decimalPart] = num.toString().split('.');
273
- const integerWithCommas = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
274
- return decimalPart ? `${integerWithCommas}.${decimalPart}` : integerWithCommas;
275
- }
276
-
277
- var Item;
278
- (function (Item) {
279
- Item["kpi"] = "KPI";
280
- Item["yScale"] = "Y-Scale";
281
- Item["yScaleGroup"] = "_YScaleGroup";
282
- Item["unit"] = "Unit";
283
- Item["max"] = "Max";
284
- Item["average"] = "Average";
285
- Item["sum"] = "Sum";
286
- Item["last"] = "Last";
287
- Item["description"] = "Description";
288
- Item["header"] = "header";
289
- })(Item || (Item = {}));
290
-
291
- var ScaleGroup;
292
- (function (ScaleGroup) {
293
- ScaleGroup[ScaleGroup["CPU"] = 0] = "CPU";
294
- ScaleGroup[ScaleGroup["Memory"] = 1] = "Memory";
295
- ScaleGroup[ScaleGroup["Disk"] = 2] = "Disk";
296
- ScaleGroup[ScaleGroup["Network"] = 3] = "Network";
297
- ScaleGroup[ScaleGroup["Swap"] = 4] = "Swap";
298
- ScaleGroup[ScaleGroup["Time"] = 5] = "Time";
299
- ScaleGroup[ScaleGroup["Req"] = 6] = "Req";
300
- ScaleGroup[ScaleGroup["Stmt"] = 7] = "Stmt";
301
- ScaleGroup[ScaleGroup["WRTime"] = 8] = "WRTime";
302
- ScaleGroup[ScaleGroup["WRSize"] = 9] = "WRSize";
303
- ScaleGroup[ScaleGroup["Conn"] = 10] = "Conn";
304
- ScaleGroup[ScaleGroup["Trans"] = 11] = "Trans";
305
- ScaleGroup[ScaleGroup["Unknown"] = 12] = "Unknown";
306
- })(ScaleGroup || (ScaleGroup = {}));
307
-
308
- var Unit;
309
- (function (Unit) {
310
- Unit["PCT"] = "%";
311
- Unit["MS"] = "ms";
312
- Unit["Empty"] = "";
313
- Unit["GB"] = "GB";
314
- Unit["MB"] = "MB";
315
- Unit["MBPerSec"] = "MB/s";
316
- Unit["SecPerSec"] = "Sec/s";
317
- Unit["StmtPerSec"] = "stm/s";
318
- Unit["ReqPerSec"] = "req/s";
319
- Unit["ColPerSec"] = "col/s";
320
- })(Unit || (Unit = {}));
321
-
322
- var UnitType;
323
- (function (UnitType) {
324
- UnitType[UnitType["TypeEA"] = 0] = "TypeEA";
325
- UnitType[UnitType["TypeGB"] = 1] = "TypeGB";
326
- UnitType[UnitType["TypeMB"] = 2] = "TypeMB";
327
- UnitType[UnitType["TypeSecSec"] = 3] = "TypeSecSec";
328
- UnitType[UnitType["TypeMBSec"] = 4] = "TypeMBSec";
329
- UnitType[UnitType["TypeSec"] = 5] = "TypeSec";
330
- })(UnitType || (UnitType = {}));
331
-
332
- var Alert;
333
- (function (Alert) {
334
- Alert["success"] = "success";
335
- Alert["error"] = "error";
336
- Alert["info"] = "info";
337
- Alert["warning"] = "warning";
338
- })(Alert || (Alert = {}));
339
-
340
- var HtmlElement;
341
- (function (HtmlElement) {
342
- HtmlElement[HtmlElement["chartArea"] = 0] = "chartArea";
343
- HtmlElement[HtmlElement["readFileProgress"] = 1] = "readFileProgress";
344
- HtmlElement[HtmlElement["showChartButton"] = 2] = "showChartButton";
345
- HtmlElement[HtmlElement["loadPortsButton"] = 3] = "loadPortsButton";
346
- HtmlElement[HtmlElement["resetChartButton"] = 4] = "resetChartButton";
347
- })(HtmlElement || (HtmlElement = {}));
348
-
349
- var Abort;
350
- (function (Abort) {
351
- Abort[Abort["maxLineNumReached"] = 0] = "maxLineNumReached";
352
- Abort[Abort["maxTimeRangeReached"] = 1] = "maxTimeRangeReached";
353
- })(Abort || (Abort = {}));
354
-
355
- /**
356
- * For some reason, hana studio will abandon the last line of nameserver history trace file
357
- */
358
- const _IGNORED_LINE_FROM_TAIL = 1;
359
- /**
360
- * None index server ports in name server history,
361
- * 01: name server; 02: preprocessor; 04: script server; 05: statistics server / diserver;
362
- * 06: web dispatcher; 07: xsengine; 10 compileserver; 11 dpserver; 12 esserver; 29 xscontroller
363
- */
364
- const _NON_INDEX_SERVER_PORTS = ['01', '02', '04', '05', '06', '07', '10', '11', '12', '29'];
365
- /**
366
- * Get the ignored line number from tail (For some reason, hana studio will abandon the last line of nameserver history trace file).
367
- */
368
- function getIgnoredLineNumFromTail() {
369
- return _IGNORED_LINE_FROM_TAIL;
370
- }
371
- /**
372
- * get the port that needs to be displayed from ports list via the selected port
373
- * @param ports overall ports list
374
- * @param port the selected port
375
- */
376
- function getDisplayPort(ports, port) {
377
- if (ports != null && ports.length > 0) {
378
- if (port == null || port.length === 0) {
379
- // if no port is selected
380
- if (ports.length === 1) {
381
- // not mdc system, will display the only one
382
- port = ports[0];
383
- }
384
- else {
385
- // select the first service (not in _NON_INDEX_SERVER_PORTS list)
386
- port = getRealPorts(ports).find(p => _NON_INDEX_SERVER_PORTS.indexOf(p.slice(-2)) < 0);
387
- if (port == null) {
388
- port = getRealPorts(ports)[0];
389
- }
390
- }
391
- }
392
- else {
393
- // get real port is port is some thing like 3**03
394
- if (port.slice(1, 3) === '**') {
395
- port = ports.find(key => key.slice(-2) === port.slice(-2));
396
- }
397
- else {
398
- port = ports.find(key => key === port);
399
- }
400
- }
401
- }
402
- else {
403
- port = void 0;
404
- }
405
- return port;
406
- }
407
- /**
408
- * Generate the ports for ngx-select.
409
- * If the provided ports is not null and no port has been selected,
410
- * will choose the first item which is not 01 (nameserver) or 07 (xsengine)
411
- *
412
- */
413
- function generatePorts(ports = null, selectedPort = null) {
414
- if (ports == null) {
415
- return null;
416
- }
417
- else {
418
- // if no selection, choose the first item which is not 01 (nameserver) or 07 (xsengine)
419
- if (selectedPort == null || selectedPort === '') {
420
- const firstIndexServer = ports.find(p => _NON_INDEX_SERVER_PORTS.indexOf(p.slice(-2)) < 0);
421
- selectedPort = firstIndexServer ? firstIndexServer : ports[0];
422
- }
423
- let index = ports.findIndex(port => port === selectedPort);
424
- if (index === -1) {
425
- // selection is not exists in the file
426
- index = 0;
427
- }
428
- const newPorts = ports.map(port => ({ id: port, text: port }));
429
- newPorts[index].selected = true;
430
- return newPorts;
431
- }
432
- }
433
- /**
434
- * get unit factor by unit
435
- */
436
- function getUnitFactor(unitType) {
437
- let unitFactor = 1;
438
- switch (unitType) {
439
- case UnitType.TypeGB:
440
- // BYTE to GB
441
- unitFactor = 1024 * 1024 * 1024;
442
- break;
443
- case UnitType.TypeMB:
444
- case UnitType.TypeMBSec:
445
- // BYTE to MB
446
- unitFactor = 1024 * 1024;
447
- break;
448
- case UnitType.TypeSecSec:
449
- // micro second to second
450
- unitFactor = 1000000;
451
- }
452
- return unitFactor;
453
- }
454
- /**
455
- * get value by unit (divided by the unit factor).
456
- */
457
- function getValueByUnit(value, unit) {
458
- return (value / getUnitFactor(unit));
459
- }
460
- /**
461
- * get rounded value: if value >= 10, round to integer; if value < 10, round to at most 2 decimal places
462
- */
463
- function getRoundedValue(value) {
464
- return value >= 10 ? Math.round(value) : Math.round(value * 100) / 100;
465
- }
466
- /**
467
- * check whether unit is time related.
468
- */
469
- function isUnitTimeRelated(unit) {
470
- return unit === UnitType.TypeMBSec || unit === UnitType.TypeSec || unit === UnitType.TypeSecSec;
471
- }
472
- /**
473
- * calculate YScale base on the provided value
474
- */
475
- function calculateYScale(value) {
476
- // round up to next 2,5,10,20,50,100,...
477
- if (value <= 0) {
478
- return 100;
479
- }
480
- const scale = Math.pow(10, Math.floor(Math.log10(value)));
481
- if (scale >= value) {
482
- return scale;
483
- }
484
- if (2 * scale >= value) {
485
- return 2 * scale;
486
- }
487
- if (5 * scale >= value) {
488
- return 5 * scale;
489
- }
490
- return 10 * scale;
491
- }
492
- function isEmptyData(data) {
493
- if (data) {
494
- return Object.keys(data).findIndex(port => {
495
- if (port != null && data[port]) {
496
- return data[port].findIndex(row => row && row.length > 0) >= 0;
497
- }
498
- return false;
499
- }) < 0;
500
- }
501
- return true;
502
- }
503
- function sleep(time) {
504
- return new Promise((resolve) => setTimeout(resolve, time));
505
- }
506
- function setChartHeight(nsAll, nsContent) {
507
- // const item1 = (document.getElementsByClassName('nameserver-history-all') as HTMLCollectionOf<HTMLElement>)[0];
508
- // const item2 = (document.getElementsByClassName('nameserver-history-content') as HTMLCollectionOf<HTMLElement>)[0];
509
- if (nsAll && nsContent) {
510
- const chartHeight = nsAll.offsetWidth * 0.75 / 2 + 10;
511
- nsContent.style.height = `${chartHeight}px`;
512
- }
513
- }
514
-
515
- /**
516
- * get the time range for all ports
517
- */
518
- function _getTotalTimeRange(time) {
519
- if (time) {
520
- let startTime = 4102358400000; // 2099/12/31
521
- let endTime = 0;
522
- Object.keys(time).forEach(port => {
523
- if (time[port]) {
524
- const timeRangeCurrent = _getTimeRange(time[port]);
525
- startTime = startTime > timeRangeCurrent.startTime ? timeRangeCurrent.startTime : startTime;
526
- endTime = endTime < timeRangeCurrent.endTime ? timeRangeCurrent.endTime : endTime;
527
- }
528
- });
529
- return { startTime: startTime, endTime: endTime };
530
- }
531
- }
532
- /**
533
- * get the time range (startTime ~ endTime) base on the time (the xScale)
534
- */
535
- function _getTimeRange(time) {
536
- const ignoredLineNumFromTail = getIgnoredLineNumFromTail();
537
- if (time) {
538
- let startTime = 4102358400000; // 2099/12/31
539
- let endTime = 0;
540
- const len = time.length;
541
- if (len > ignoredLineNumFromTail) {
542
- startTime = time[0] > startTime ? startTime : time[0];
543
- endTime = time[len - ignoredLineNumFromTail - 1] > endTime ? time[len - ignoredLineNumFromTail - 1] : endTime;
544
- }
545
- return { startTime: startTime, endTime: endTime };
546
- }
547
- }
548
- /**
549
- * get default local time zone
550
- */
551
- function getDefaultTimezone() {
552
- return moment.tz.guess();
553
- }
554
- /**
555
- * Get time from provided timezone, using this only because chart.js doesn't support timezone.
556
- * This function will be removed when chart.js starts to support timezone feature.
557
- * @param time time in seconds (Epoch time)
558
- * @param timezone timezone string, uses local timezone if this is null.
559
- */
560
- function getTimeFromTimeZone(time, timezone) {
561
- if (timezone == null || timezone.length === 0) {
562
- timezone = getDefaultTimezone();
563
- console.warn(`getTimeFromTimeZone - Input timezone is null, returning the local (${timezone}) time. `);
564
- }
565
- const utcOffset = moment.tz.zone(timezone).utcOffset(time * 1000);
566
- const currentOffset = moment.tz.zone(getDefaultTimezone()).utcOffset(time * 1000);
567
- // convert to utc and then to selected timezone
568
- return time + currentOffset * 60 - utcOffset * 60;
569
- }
570
- /**
571
- * Get time formatted with the provided timezone
572
- */
573
- function getTimeString(time) {
574
- return moment(time).format('YYYY-MM-DD HH:mm:ss');
575
- }
576
- /**
577
- * Get the time range string by time array, eg: 2018-10-25 10:10:00 ~ 2018-10-25 12:12:00
578
- */
579
- function getTimeRangeString(time) {
580
- let startTimeString = 'N/A';
581
- let endTimeString = 'N/A';
582
- let timeRange;
583
- if (Array.isArray(time)) {
584
- timeRange = _getTimeRange(time);
585
- }
586
- else {
587
- timeRange = _getTotalTimeRange(time);
588
- }
589
- if (timeRange) {
590
- if (timeRange.startTime < 4102358400000) {
591
- startTimeString = getTimeString(timeRange.startTime);
592
- }
593
- if (timeRange.endTime > 0) {
594
- endTimeString = getTimeString(timeRange.endTime);
595
- }
596
- return `${startTimeString} ~ ${endTimeString}`;
597
- }
598
- }
599
- /**
600
- * print processed time from the provided beginTime, only works in dev mode
601
- */
602
- function printProcessedTime(beginTime, step) {
603
- if (isDevMode()) {
604
- // only do it in dev mode
605
- const timeAfter = new Date();
606
- const parsingTime = (timeAfter.getTime() - beginTime.getTime()) / 1000;
607
- console.log(`${step}, Parsing time: ${parsingTime} seconds`);
608
- }
609
- }
610
-
611
- const _DEFAULT_PORT = 'DEFAULT';
612
- /**
613
- * get the default port string (for non-MDC system)
614
- */
615
- function getDefaultPort() {
616
- return _DEFAULT_PORT;
617
- }
618
- /**
619
- * get abbreviated file name
620
- * @param fileName
621
- */
622
- function getAbbreviatedFileName(fileName) {
623
- return fileName == null || fileName.length <= 22 ? fileName : `${fileName.slice(0, 11)}...${fileName.slice(-11)}`;
624
- }
625
- /**
626
- * get port if empty return default port
627
- */
628
- function getPort(port) {
629
- return port == null || port.length === 0 ? _DEFAULT_PORT : port;
630
- }
631
- /**
632
- * get all real ports except the default port "default"
633
- */
634
- function getRealPorts(ports, includeDefault = false) {
635
- if (ports == null) {
636
- return [];
637
- }
638
- if (includeDefault) {
639
- return ports;
640
- }
641
- else {
642
- return ports.filter(port => port !== _DEFAULT_PORT);
643
- }
644
- }
645
- /**
646
- * get file from <input>
647
- * @param inputTarget
648
- */
649
- function getFileFromInput(inputTarget) {
650
- if (inputTarget && inputTarget.files && inputTarget.files.length >= 0) {
651
- return inputTarget.files[0];
652
- }
653
- }
654
- /**
655
- * get file from drag and drop
656
- */
657
- function getFileFromDrop(dragEvent) {
658
- return new Promise((resolve, reject) => {
659
- if (dragEvent.error) {
660
- reject(dragEvent.error);
661
- }
662
- else {
663
- if (dragEvent.file) {
664
- resolve(dragEvent.file);
665
- }
666
- }
667
- });
668
- }
669
- /**
670
- * Check whether the port from file is the same with the selected port.
671
- * If the selected port is empty, return true directly. This makes all ports will be selected.
672
- * @param portFromFile Port read from file
673
- * @param portFromSelection Port from selection.
674
- * @param isMDC MDC flag
675
- */
676
- function isSamePort(portFromFile, portFromSelection, isMDC) {
677
- // if it's MDC system, and the port From File is default port, return false
678
- if (isMDC && portFromFile === _DEFAULT_PORT) {
679
- return false;
680
- }
681
- // if selected port is empty, return true directly. This makes all ports being selected
682
- if (portFromSelection == null || portFromSelection.length === 0) {
683
- return true;
684
- }
685
- return portFromFile === portFromSelection || portFromFile.slice(-2) === portFromSelection.slice(-2);
686
- }
687
- /**
688
- * As javascript can't get the full path of file, if these two files have same
689
- * 1. lastModified, 2. name, 3. size, these two files are considered as the same file
690
- */
691
- function isSameFile(file1, file2) {
692
- if (file1 && file2) {
693
- if (file1.lastModified === file2.lastModified && file1.name === file2.name && file1.size === file2.size) {
694
- return true;
695
- }
696
- }
697
- return false;
698
- }
699
- /**
700
- * Check whether the provided port is a valid port (3xxxx)
701
- */
702
- function isValidPort(port) {
703
- return port && port.length === 5 && port[0] === '3';
704
- }
705
- /**
706
- * get next value from current value base on the operator "<" or ">".
707
- * Keep using current value until the "nextValue" is not empty.
708
- */
709
- function calculateValue(lastValue, nextValue) {
710
- // if the relative value missed, it's null.
711
- // And if it's missed, just use current value from last line.
712
- let newValue = lastValue;
713
- if (nextValue != null && nextValue.length > 0) {
714
- if (nextValue[0] === '<') {
715
- newValue = lastValue - parseFloat(nextValue.slice(1));
716
- }
717
- else if (nextValue[0] === '>') {
718
- newValue = lastValue + parseFloat(nextValue.slice(1));
719
- }
720
- else {
721
- newValue = parseFloat(nextValue);
722
- }
723
- }
724
- return newValue;
725
- }
726
- /**
727
- * get next time value from current time base on the operator "<" or ">".
728
- * If nextValue is not "<" or ">", returns converted time base on the timezone
729
- */
730
- function calculateValue4Time(lastValue, nextValue, timezone) {
731
- // if the relative value missed, it's null.
732
- // And if it's missed, just use current value from last line.
733
- let newValue = lastValue;
734
- if (nextValue != null && nextValue.length > 0) {
735
- if (nextValue[0] !== '<' && nextValue[0] !== '>') {
736
- newValue = getTimeFromTimeZone(parseFloat(nextValue), timezone);
737
- }
738
- else {
739
- newValue = calculateValue(lastValue, nextValue);
740
- }
741
- }
742
- return newValue;
743
- }
744
- /**
745
- * check whether the data comes from valid nameserver history file
746
- */
747
- function validateData(data) {
748
- return data == null ? false : data.length >= 4 && ['host', 'time'].every(i => data[0].includes(i));
749
- }
750
- /**
751
- * convert blob to file
752
- * @param theBlob
753
- * @param fileName
754
- */
755
- function blobToFile(theBlob, fileName) {
756
- const blob = theBlob;
757
- // A Blob() is almost a File() - it's just missing the two properties below which we will add
758
- blob.lastModifiedDate = new Date();
759
- blob.name = fileName;
760
- // Cast to a File() type
761
- return theBlob;
762
- }
763
- /**
764
- * check the object is a File object or not a File(Blob)
765
- * @param obj
766
- */
767
- function isFile(obj) {
768
- return obj && typeof obj.name === 'string';
769
- }
770
-
771
- class TimezoneSelectorService {
772
- /**
773
- * get the default timezone
774
- */
775
- getDefaultTimezone() {
776
- return getDefaultTimezone();
777
- }
778
- /**
779
- * Get all the timezones for each region
780
- */
781
- getZones() {
782
- const timezones = [];
783
- const zones = moment.tz.names();
784
- zones.forEach(zone => {
785
- // get region
786
- let region;
787
- if (zone.indexOf('/') > 0) {
788
- region = zone.slice(0, zone.indexOf('/'));
789
- this._buildTimezones(timezones, region, zone);
790
- }
791
- });
792
- return timezones;
793
- }
794
- /**
795
- * build timezone lists
796
- */
797
- _buildTimezones(timezones, region, zone) {
798
- if (timezones) {
799
- let timezoneRegion = timezones.find(tz => tz.region === region);
800
- if (!timezoneRegion) {
801
- timezoneRegion = { region: region, zones: [] };
802
- timezones.push(timezoneRegion);
803
- }
804
- timezoneRegion.zones.push(zone);
805
- }
806
- }
807
- }
808
- TimezoneSelectorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimezoneSelectorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
809
- TimezoneSelectorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimezoneSelectorService });
810
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimezoneSelectorService, decorators: [{
811
- type: Injectable
812
- }] });
813
-
814
- class TimezoneSelectorComponent {
815
- constructor(service) {
816
- this.service = service;
817
- this.disabled = false;
818
- this.timezoneChange = new EventEmitter();
819
- const defaultTZ = this.service.getDefaultTimezone();
820
- this.timezones = this.service.getZones().map(tz => ({ group: tz.region, items: tz.zones.map(zone => ({ id: zone, value: zone, text: this._getFormattedZone(tz.region, zone), selected: zone === defaultTZ })) }));
821
- }
822
- static _formatNumber(number) {
823
- return number < 10 || !number ? `0${number}` : `${number}`;
824
- }
825
- ngOnChanges(changes) {
826
- if (changes.timezone && changes.timezone.currentValue) {
827
- if (this.timezones) {
828
- this.timezones = this.service.getZones().map(tz => ({ group: tz.region, items: tz.zones.map(zone => ({ id: zone, value: zone, text: this._getFormattedZone(tz.region, zone), selected: zone === changes.timezone.currentValue })) }));
829
- }
830
- }
831
- }
832
- _getFormattedZone(region, zone) {
833
- return `${region} - ${this._formatTimezone(zone)} ${this._getOffset(zone)}`;
834
- }
835
- _formatTimezone(zone) {
836
- const tz = zone.split('/');
837
- return tz[tz.length - 1].replace('_', ' ');
838
- }
839
- _getOffset(zone) {
840
- let offset = moment.tz(zone).utcOffset();
841
- const neg = offset < 0;
842
- if (neg) {
843
- offset = -1 * offset;
844
- }
845
- const hours = Math.floor(offset / 60);
846
- const minutes = (offset / 60 - hours) * 60;
847
- return `(GMT${neg ? '-' : '+'}${TimezoneSelectorComponent._formatNumber(hours)}:${TimezoneSelectorComponent._formatNumber(minutes)})`;
848
- }
849
- /**
850
- * onChange function called by the "ngx-select" element
851
- * @param selectedTimezone The timezone string selected
852
- */
853
- onChange(selectedTimezone) {
854
- this.timezone = selectedTimezone;
855
- this.timezoneChange.emit(this.timezone);
856
- }
857
- }
858
- TimezoneSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimezoneSelectorComponent, deps: [{ token: TimezoneSelectorService }], target: i0.ɵɵFactoryTarget.Component });
859
- TimezoneSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: TimezoneSelectorComponent, selector: "timezone-selector", inputs: { disabled: "disabled", timezone: "timezone" }, outputs: { timezoneChange: "timezoneChange" }, providers: [TimezoneSelectorService], usesOnChanges: true, ngImport: i0, template: `
860
- <ngx-dropdown-list (selectionChange)="onChange($event)"
861
- [items]="timezones"
862
- [multiSelection]="false"
863
- [placeHolder]="'Timezones'"
864
- [(selectedValue)]="timezone"
865
- [filterBox]="true"
866
- [disabled]="disabled"
867
- [allowClear]="false">
868
- </ngx-dropdown-list>
869
- `, isInline: true, components: [{ type: i2.DropdownListComponent, selector: "ngx-dropdown-list", inputs: ["placeHolder", "items", "multiSelection", "selectedValue", "filterBox", "suffixText", "disabled", "allowClear", "formatNumber"], outputs: ["selectedValueChange", "selectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
870
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimezoneSelectorComponent, decorators: [{
871
- type: Component,
872
- args: [{
873
- selector: 'timezone-selector',
874
- template: `
875
- <ngx-dropdown-list (selectionChange)="onChange($event)"
876
- [items]="timezones"
877
- [multiSelection]="false"
878
- [placeHolder]="'Timezones'"
879
- [(selectedValue)]="timezone"
880
- [filterBox]="true"
881
- [disabled]="disabled"
882
- [allowClear]="false">
883
- </ngx-dropdown-list>
884
- `,
885
- providers: [TimezoneSelectorService],
886
- changeDetection: ChangeDetectionStrategy.OnPush
887
- }]
888
- }], ctorParameters: function () { return [{ type: TimezoneSelectorService }]; }, propDecorators: { disabled: [{
889
- type: Input
890
- }], timezone: [{
891
- type: Input
892
- }], timezoneChange: [{
893
- type: Output
894
- }] } });
895
-
896
- class PortSelectorService {
897
- /**
898
- * generate the default ports from 3**01 to 3**99
899
- * the ports which used (3**01, 3**03, 3**07, 3**40, 3**43, 3*46, 3**49, 3**52, 3**55, 3*58, 3**61 ...)
900
- * by hana normally will be put in the first places
901
- */
902
- _getDefaultPorts() {
903
- if (this._defaultPorts) {
904
- return this._defaultPorts;
905
- }
906
- // name server, default index server and xsengine
907
- this._defaultPorts = [
908
- { id: '3**01', text: '3**01' },
909
- { id: '3**03', text: '3**03' },
910
- { id: '3**07', text: '3**07' }
911
- ];
912
- // tenant index servers
913
- for (let i = 40; i < 100; i += 3) {
914
- this._defaultPorts.push({ id: `3**${i}`, text: `3**${i}` });
915
- }
916
- // others
917
- for (let i = 1; i < 100; i++) {
918
- const port = i > 9 ? `3**${i}` : `3**0${i}`;
919
- if (this._defaultPorts.findIndex(item => item.id === port) < 0) {
920
- this._defaultPorts.push({ id: port, text: port });
921
- }
922
- }
923
- return this._defaultPorts;
924
- }
925
- getPorts(ports = null) {
926
- return ports != null && ports.length > 0 ? ports : this._getDefaultPorts();
927
- }
928
- }
929
- PortSelectorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PortSelectorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
930
- PortSelectorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PortSelectorService });
931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PortSelectorService, decorators: [{
932
- type: Injectable
933
- }] });
934
-
935
- class PortSelectorComponent {
936
- constructor(service) {
937
- this.service = service;
938
- /**
939
- * Input: boolean (optional) bind to [disabled]
940
- */
941
- this.disabled = false;
942
- /**
943
- * Output event bind to (port)
944
- */
945
- this.portChange = new EventEmitter();
946
- }
947
- get displayPorts() {
948
- return this.service.getPorts(this.ports);
949
- }
950
- /**
951
- * onChange function called by the "ngx-select" element
952
- */
953
- onChange(event) {
954
- this.portChange.emit(event);
955
- }
956
- }
957
- PortSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PortSelectorComponent, deps: [{ token: PortSelectorService }], target: i0.ɵɵFactoryTarget.Component });
958
- PortSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PortSelectorComponent, selector: "port-selector", inputs: { disabled: "disabled", port: "port", ports: "ports" }, outputs: { portChange: "portChange" }, providers: [PortSelectorService], ngImport: i0, template: `
959
- <label style="width: 100%">
960
- <ngx-dropdown-list (selectionChange)="onChange($event)"
961
- [items]="displayPorts"
962
- [multiSelection]="false"
963
- [placeHolder]="'Ports'"
964
- [(selectedValue)]="port"
965
- [filterBox]="true"
966
- [disabled]="disabled">
967
- </ngx-dropdown-list>
968
- </label>
969
- `, isInline: true, components: [{ type: i2.DropdownListComponent, selector: "ngx-dropdown-list", inputs: ["placeHolder", "items", "multiSelection", "selectedValue", "filterBox", "suffixText", "disabled", "allowClear", "formatNumber"], outputs: ["selectedValueChange", "selectionChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
970
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PortSelectorComponent, decorators: [{
971
- type: Component,
972
- args: [{
973
- selector: 'port-selector',
974
- template: `
975
- <label style="width: 100%">
976
- <ngx-dropdown-list (selectionChange)="onChange($event)"
977
- [items]="displayPorts"
978
- [multiSelection]="false"
979
- [placeHolder]="'Ports'"
980
- [(selectedValue)]="port"
981
- [filterBox]="true"
982
- [disabled]="disabled">
983
- </ngx-dropdown-list>
984
- </label>
985
- `,
986
- providers: [PortSelectorService],
987
- changeDetection: ChangeDetectionStrategy.OnPush
988
- }]
989
- }], ctorParameters: function () { return [{ type: PortSelectorService }]; }, propDecorators: { disabled: [{
990
- type: Input
991
- }], portChange: [{
992
- type: Output
993
- }], port: [{
994
- type: Input
995
- }], ports: [{
996
- type: Input
997
- }] } });
998
-
999
- class InstructionComponent {
1000
- constructor() {
1001
- this.step1Finished = false;
1002
- this.step2Finished = false;
1003
- this.step3Finished = false;
1004
- this.step4Finished = false;
1005
- this.step5Finished = false;
1006
- this.show = true;
1007
- /**
1008
- * Output event bind to (show)
1009
- */
1010
- this.showChange = new EventEmitter();
1011
- }
1012
- onClose() {
1013
- this.show = false;
1014
- this.showChange.emit(this.show);
1015
- }
1016
- }
1017
- InstructionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: InstructionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1018
- InstructionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: InstructionComponent, selector: "instruction", inputs: { step1Finished: "step1Finished", step2Finished: "step2Finished", step3Finished: "step3Finished", step4Finished: "step4Finished", step5Finished: "step5Finished", show: "show" }, outputs: { showChange: "showChange" }, ngImport: i0, template: "<div class=\"instruction\" *ngIf=\"show\">\r\n <div class=\"close\" (click)=\"onClose()\">&times;</div>\r\n <div class=\"mandatory\" [class.completed]=\"step1Finished\">\r\n <label>Select nameserver history file <span class=\"flag\">*</span></label> <br>\r\n <ul>\r\n <li>Click the \"Browse\" </li>\r\n <li>Drag and drop your file to \"Drop File Here\"</li>\r\n </ul>\r\n </div>\r\n <div class=\"optional\" [class.completed]=\"step2Finished\">\r\n <label>Select time range and timezone <span class=\"flag\">(optional)</span></label> <br>\r\n <ul>\r\n <li>If you do not select time range, this tool will read from the beginning until it reaches the configured maxRowsLimitation. </li>\r\n <li>If you do not select time zone, this tool will use your local default timezone.</li>\r\n </ul>\r\n </div>\r\n <div class=\"optional\" [class.completed]=\"step3Finished\">\r\n <label>Select ports <span class=\"flag\">(optional)</span></label> <br>\r\n <ul>\r\n <li>If you do not choose any port, this tool will try to load data for all ports until it reaches the configured maxRowsLimitation.</li>\r\n <li>After choosing one port, this tool will only try to load data for the selected port until it reaches the configured maxRowsLimitation.</li>\r\n <li>If you do not know any port information, you can click \"Load\" to load all ports from the nameserver history file.</li>\r\n </ul>\r\n </div>\r\n <div class=\"mandatory\" [class.completed]=\"step4Finished\">\r\n <label>Load the data from nameserver history file and show the chart <span class=\"flag\">*</span></label> <br>\r\n <ul><li>Click button \"Show\"</li></ul>\r\n </div>\r\n <div class=\"optional\" [class.completed]=\"step5Finished\">\r\n <label>Reset the chart <span class=\"flag\">(optional)</span></label> <br>\r\n <ul><li>If you zoomed in, you can go back to original status by clicking \"Reset Chart\"</li></ul>\r\n </div>\r\n</div>\r\n", styles: [".instruction{margin-top:15px;padding:15px;position:relative;width:100%;height:auto;text-align:left;text-shadow:0 0 1px #DDDDDD;font-size:16px;font-weight:400;background:#f8f8f8;box-shadow:inset 0 20px 20px -20px #0009;border:1px dashed #0782d0}.instruction .close{position:absolute;top:2px;right:4px;color:red;font-size:14px}.instruction .close:hover{font-weight:700;cursor:pointer}.instruction li{font-size:14px;display:list-item}.instruction .mandatory{color:#3a4048}.instruction .mandatory .flag{color:red;display:inline}.instruction .optional{color:#3a4048}.instruction .optional .flag{color:#00008b;display:inline}.instruction .completed{color:#2e8b57}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1019
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: InstructionComponent, decorators: [{
1020
- type: Component,
1021
- args: [{ selector: 'instruction', template: "<div class=\"instruction\" *ngIf=\"show\">\r\n <div class=\"close\" (click)=\"onClose()\">&times;</div>\r\n <div class=\"mandatory\" [class.completed]=\"step1Finished\">\r\n <label>Select nameserver history file <span class=\"flag\">*</span></label> <br>\r\n <ul>\r\n <li>Click the \"Browse\" </li>\r\n <li>Drag and drop your file to \"Drop File Here\"</li>\r\n </ul>\r\n </div>\r\n <div class=\"optional\" [class.completed]=\"step2Finished\">\r\n <label>Select time range and timezone <span class=\"flag\">(optional)</span></label> <br>\r\n <ul>\r\n <li>If you do not select time range, this tool will read from the beginning until it reaches the configured maxRowsLimitation. </li>\r\n <li>If you do not select time zone, this tool will use your local default timezone.</li>\r\n </ul>\r\n </div>\r\n <div class=\"optional\" [class.completed]=\"step3Finished\">\r\n <label>Select ports <span class=\"flag\">(optional)</span></label> <br>\r\n <ul>\r\n <li>If you do not choose any port, this tool will try to load data for all ports until it reaches the configured maxRowsLimitation.</li>\r\n <li>After choosing one port, this tool will only try to load data for the selected port until it reaches the configured maxRowsLimitation.</li>\r\n <li>If you do not know any port information, you can click \"Load\" to load all ports from the nameserver history file.</li>\r\n </ul>\r\n </div>\r\n <div class=\"mandatory\" [class.completed]=\"step4Finished\">\r\n <label>Load the data from nameserver history file and show the chart <span class=\"flag\">*</span></label> <br>\r\n <ul><li>Click button \"Show\"</li></ul>\r\n </div>\r\n <div class=\"optional\" [class.completed]=\"step5Finished\">\r\n <label>Reset the chart <span class=\"flag\">(optional)</span></label> <br>\r\n <ul><li>If you zoomed in, you can go back to original status by clicking \"Reset Chart\"</li></ul>\r\n </div>\r\n</div>\r\n", styles: [".instruction{margin-top:15px;padding:15px;position:relative;width:100%;height:auto;text-align:left;text-shadow:0 0 1px #DDDDDD;font-size:16px;font-weight:400;background:#f8f8f8;box-shadow:inset 0 20px 20px -20px #0009;border:1px dashed #0782d0}.instruction .close{position:absolute;top:2px;right:4px;color:red;font-size:14px}.instruction .close:hover{font-weight:700;cursor:pointer}.instruction li{font-size:14px;display:list-item}.instruction .mandatory{color:#3a4048}.instruction .mandatory .flag{color:red;display:inline}.instruction .optional{color:#3a4048}.instruction .optional .flag{color:#00008b;display:inline}.instruction .completed{color:#2e8b57}\n"] }]
1022
- }], propDecorators: { step1Finished: [{
1023
- type: Input
1024
- }], step2Finished: [{
1025
- type: Input
1026
- }], step3Finished: [{
1027
- type: Input
1028
- }], step4Finished: [{
1029
- type: Input
1030
- }], step5Finished: [{
1031
- type: Input
1032
- }], show: [{
1033
- type: Input
1034
- }], showChange: [{
1035
- type: Output
1036
- }] } });
1037
-
1038
- class TimeRangeSelectorComponent {
1039
- constructor() {
1040
- this.disabled = false;
1041
- /**
1042
- * for two way binding.
1043
- */
1044
- this.dateTimeRangeChange = new EventEmitter();
1045
- }
1046
- /**
1047
- * triggered when picker closed
1048
- */
1049
- afterPickerClosed() {
1050
- this.dateTimeRangeChange.emit(this.dateTimeRange);
1051
- }
1052
- }
1053
- TimeRangeSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimeRangeSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1054
- TimeRangeSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: TimeRangeSelectorComponent, selector: "time-range-selector", inputs: { disabled: "disabled", dateTimeRange: "dateTimeRange" }, outputs: { dateTimeRangeChange: "dateTimeRangeChange" }, ngImport: i0, template: `
1055
- <div class="time-range">
1056
- <div class="time-range-from">
1057
- <input placeholder="Date Time Range From:"
1058
- [disabled]="disabled"
1059
- [(ngModel)]="dateTimeRange"
1060
- [selectMode]="'rangeFrom'"
1061
- [owlDateTimeTrigger]="dtRange2" [owlDateTime]="dtRange2" #dateTime2="ngModel" readonly>
1062
- <owl-date-time #dtRange2 (afterPickerClosed)="afterPickerClosed()"></owl-date-time>
1063
- </div>
1064
- <div class="time-range-to">
1065
- <input placeholder="Date Time Range To:"
1066
- [disabled]="disabled"
1067
- [(ngModel)]="dateTimeRange"
1068
- [selectMode]="'rangeTo'"
1069
- [owlDateTimeTrigger]="dtRange3" [owlDateTime]="dtRange3" #dateTime3="ngModel" readonly>
1070
- <owl-date-time #dtRange3 (afterPickerClosed)="afterPickerClosed()"></owl-date-time>
1071
- </div>
1072
- </div>
1073
- `, isInline: true, styles: [":host *,:host *:before,:host *:after{box-sizing:inherit;display:inherit;font-size:inherit;font-weight:inherit;font-family:inherit}:host .hover-box,:host .time-range input:hover,.time-range :host input:hover,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{outline:0;box-shadow:0 0 6px #23adff}:host .dashed-box,:host .nameserver-history-all .toolbar-chart .chart-operation button,:host .nameserver-history-all .toolbar-chart .port-selection,:host .nameserver-history-all .toolbar-chart .input-time,:host .nameserver-history-all .toolbar-chart .upload-box-content{background:#f8f8f8;box-shadow:inset 0 20px 20px -20px #0009;border:1px dashed #0782d0}:host .solid-box,:host .time-range input,.time-range :host input,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{background:#fff none;border:1px solid #ccc;border-radius:4px;line-height:1.42857143}:host .nameserver-history-all{width:98%;min-width:1314px;height:auto;border:1px none #0782d0;border-bottom-style:dashed;margin:3px 1%;box-sizing:border-box;display:inline-block;font-size:14px;font-weight:400;font-family:Helvetica,Arial,sans-serif}:host .nameserver-history-all .toolbar-chart{width:100%;height:48px}:host .nameserver-history-all .toolbar-chart button{text-align:center;white-space:nowrap;vertical-align:middle}:host .nameserver-history-all .toolbar-chart button:hover{text-shadow:1px 1px 3px royalblue;cursor:pointer;font-weight:600}:host .nameserver-history-all .toolbar-chart button:disabled{text-shadow:none;opacity:.65;cursor:default;color:#a9a9a9;font-weight:400}:host .nameserver-history-all .toolbar-chart .upload-box-content{width:20%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .upload-box-content .box-stream-mode-text{text-align:center;color:#00008b}:host .nameserver-history-all .toolbar-chart .input-time{margin-left:1%;margin-right:1%;width:43%;height:100%}:host .nameserver-history-all .toolbar-chart .input-time .input-time-range{height:100%;width:57%;float:left}:host .nameserver-history-all .toolbar-chart .input-time .timezone-selector{margin-top:6px;height:100%;width:42.5%;margin-right:.5%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection{width:14%;margin-right:1%;height:48px}:host .nameserver-history-all .toolbar-chart .port-selection .port-selector{margin-top:6px;margin-left:2%;margin-right:1%;width:47%;float:left}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button{margin-top:6px;margin-left:1%;margin-right:2%;width:47%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{color:#333;width:100%;padding:6px 12px;margin-bottom:0}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{text-shadow:None;font-weight:400}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:disabled{box-shadow:none}:host .nameserver-history-all .toolbar-chart .chart-operation{width:20%;height:48px;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation .left{margin-right:1%;width:49%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .chart-operation .right{width:50%;height:100%;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation button{width:100%;height:100%;color:#00008b}:host .nameserver-history-all .nameserver-history-content{width:100%;height:730px;margin:5px 5px 5px 0}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-chart{width:75%;height:100%;position:relative;float:left}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-controller{width:25%;height:100%;float:right;overflow:auto}:host .message-container{width:98%;margin:0 1%;box-sizing:border-box;display:inline-block}.time-range{width:100%;box-sizing:border-box}.time-range .time-range-from{width:48.5%;float:left;margin-left:1%;margin-right:1%}.time-range .time-range-to{width:48.5%;float:right;margin-right:1%}.time-range input{margin-top:6px;width:100%;padding:6px 12px;color:#495057;cursor:pointer}.time-range input:disabled{box-shadow:none}\n"], components: [{ type: i1$1.OwlDateTimeComponent, selector: "owl-date-time", inputs: ["backdropClass", "panelClass", "startAt", "endAt", "pickerType", "pickerMode", "disabled", "opened", "scrollStrategy"], outputs: ["afterPickerClosed", "afterPickerOpen", "yearSelected", "monthSelected", "dateSelected"], exportAs: ["owlDateTime"] }], directives: [{ type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.OwlDateTimeInputDirective, selector: "input[owlDateTime]", inputs: ["required", "owlDateTime", "owlDateTimeFilter", "_disabled", "min", "max", "selectMode", "rangeSeparator", "value", "values"], outputs: ["dateTimeChange", "dateTimeInput"], exportAs: ["owlDateTimeInput"] }, { type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1$1.OwlDateTimeTriggerDirective, selector: "[owlDateTimeTrigger]", inputs: ["owlDateTimeTrigger", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1074
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: TimeRangeSelectorComponent, decorators: [{
1075
- type: Component,
1076
- args: [{ selector: 'time-range-selector', template: `
1077
- <div class="time-range">
1078
- <div class="time-range-from">
1079
- <input placeholder="Date Time Range From:"
1080
- [disabled]="disabled"
1081
- [(ngModel)]="dateTimeRange"
1082
- [selectMode]="'rangeFrom'"
1083
- [owlDateTimeTrigger]="dtRange2" [owlDateTime]="dtRange2" #dateTime2="ngModel" readonly>
1084
- <owl-date-time #dtRange2 (afterPickerClosed)="afterPickerClosed()"></owl-date-time>
1085
- </div>
1086
- <div class="time-range-to">
1087
- <input placeholder="Date Time Range To:"
1088
- [disabled]="disabled"
1089
- [(ngModel)]="dateTimeRange"
1090
- [selectMode]="'rangeTo'"
1091
- [owlDateTimeTrigger]="dtRange3" [owlDateTime]="dtRange3" #dateTime3="ngModel" readonly>
1092
- <owl-date-time #dtRange3 (afterPickerClosed)="afterPickerClosed()"></owl-date-time>
1093
- </div>
1094
- </div>
1095
- `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host *,:host *:before,:host *:after{box-sizing:inherit;display:inherit;font-size:inherit;font-weight:inherit;font-family:inherit}:host .hover-box,:host .time-range input:hover,.time-range :host input:hover,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{outline:0;box-shadow:0 0 6px #23adff}:host .dashed-box,:host .nameserver-history-all .toolbar-chart .chart-operation button,:host .nameserver-history-all .toolbar-chart .port-selection,:host .nameserver-history-all .toolbar-chart .input-time,:host .nameserver-history-all .toolbar-chart .upload-box-content{background:#f8f8f8;box-shadow:inset 0 20px 20px -20px #0009;border:1px dashed #0782d0}:host .solid-box,:host .time-range input,.time-range :host input,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{background:#fff none;border:1px solid #ccc;border-radius:4px;line-height:1.42857143}:host .nameserver-history-all{width:98%;min-width:1314px;height:auto;border:1px none #0782d0;border-bottom-style:dashed;margin:3px 1%;box-sizing:border-box;display:inline-block;font-size:14px;font-weight:400;font-family:Helvetica,Arial,sans-serif}:host .nameserver-history-all .toolbar-chart{width:100%;height:48px}:host .nameserver-history-all .toolbar-chart button{text-align:center;white-space:nowrap;vertical-align:middle}:host .nameserver-history-all .toolbar-chart button:hover{text-shadow:1px 1px 3px royalblue;cursor:pointer;font-weight:600}:host .nameserver-history-all .toolbar-chart button:disabled{text-shadow:none;opacity:.65;cursor:default;color:#a9a9a9;font-weight:400}:host .nameserver-history-all .toolbar-chart .upload-box-content{width:20%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .upload-box-content .box-stream-mode-text{text-align:center;color:#00008b}:host .nameserver-history-all .toolbar-chart .input-time{margin-left:1%;margin-right:1%;width:43%;height:100%}:host .nameserver-history-all .toolbar-chart .input-time .input-time-range{height:100%;width:57%;float:left}:host .nameserver-history-all .toolbar-chart .input-time .timezone-selector{margin-top:6px;height:100%;width:42.5%;margin-right:.5%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection{width:14%;margin-right:1%;height:48px}:host .nameserver-history-all .toolbar-chart .port-selection .port-selector{margin-top:6px;margin-left:2%;margin-right:1%;width:47%;float:left}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button{margin-top:6px;margin-left:1%;margin-right:2%;width:47%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{color:#333;width:100%;padding:6px 12px;margin-bottom:0}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{text-shadow:None;font-weight:400}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:disabled{box-shadow:none}:host .nameserver-history-all .toolbar-chart .chart-operation{width:20%;height:48px;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation .left{margin-right:1%;width:49%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .chart-operation .right{width:50%;height:100%;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation button{width:100%;height:100%;color:#00008b}:host .nameserver-history-all .nameserver-history-content{width:100%;height:730px;margin:5px 5px 5px 0}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-chart{width:75%;height:100%;position:relative;float:left}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-controller{width:25%;height:100%;float:right;overflow:auto}:host .message-container{width:98%;margin:0 1%;box-sizing:border-box;display:inline-block}.time-range{width:100%;box-sizing:border-box}.time-range .time-range-from{width:48.5%;float:left;margin-left:1%;margin-right:1%}.time-range .time-range-to{width:48.5%;float:right;margin-right:1%}.time-range input{margin-top:6px;width:100%;padding:6px 12px;color:#495057;cursor:pointer}.time-range input:disabled{box-shadow:none}\n"] }]
1096
- }], propDecorators: { disabled: [{
1097
- type: Input
1098
- }], dateTimeRange: [{
1099
- type: Input
1100
- }], dateTimeRangeChange: [{
1101
- type: Output
1102
- }] } });
1103
-
1104
- // Using dynamic flag to fix the issue of ng-packagr #696: Lambda not supported
1105
- // @dynamic
1106
- class UIService {
1107
- constructor() {
1108
- this._DEFAULT_DISPLAY_ITEMS = ['cpuUsed', 'indexserverMemUsed', 'mvccNum'];
1109
- this._HIDED_COLUMNS = [Item.yScaleGroup, Item.description];
1110
- this._MEASURE_COLUMNS = [Item.max, Item.average, Item.sum, Item.last];
1111
- this._loadHistoryInfos = {};
1112
- }
1113
- /**
1114
- * get the colors for legends
1115
- */
1116
- static getColors(alpha = null) {
1117
- if (alpha == null) {
1118
- alpha = 0.8;
1119
- }
1120
- return {
1121
- cpuUsed: this._getRgbColor(199, 21, 133, alpha),
1122
- memoryResident: this._getRgbColor(238, 130, 238, alpha),
1123
- memoryTotalResident: this._getRgbColor(72, 61, 139, alpha),
1124
- memoryUsed: this._getRgbColor(0, 0, 205, alpha),
1125
- memoryLimit: this._getRgbColor(255, 105, 180, alpha),
1126
- memorySize: this._getRgbColor(70, 130, 180, alpha),
1127
- diskUsed: this._getRgbColor(25, 25, 112, alpha),
1128
- diskSize: this._getRgbColor(0, 255, 255, alpha),
1129
- networkIn: this._getRgbColor(102, 51, 153, alpha),
1130
- networkOut: this._getRgbColor(245, 222, 179, alpha),
1131
- swapIn: this._getRgbColor(47, 79, 79, alpha),
1132
- swapOut: this._getRgbColor(205, 92, 92, alpha),
1133
- indexserverCpu: this._getRgbColor(255, 99, 71, alpha),
1134
- indexserverCpuSys: this._getRgbColor(255, 20, 147, alpha),
1135
- indexserverMemUsed: this._getRgbColor(0, 255, 0, alpha),
1136
- indexserverMemLimit: this._getRgbColor(139, 0, 0, alpha),
1137
- indexserverHandles: this._getRgbColor(139, 0, 139, alpha),
1138
- indexserverPingtime: this._getRgbColor(189, 183, 107, alpha),
1139
- indexserverSwapIn: this._getRgbColor(112, 128, 144, alpha),
1140
- sqlConnections: this._getRgbColor(85, 107, 47, alpha),
1141
- internalConnections: this._getRgbColor(46, 139, 87, alpha),
1142
- externalConnections: this._getRgbColor(147, 112, 219, alpha),
1143
- idleConnections: this._getRgbColor(216, 191, 216, alpha),
1144
- sqlTransactions: this._getRgbColor(220, 20, 60, alpha),
1145
- internalTransactions: this._getRgbColor(186, 85, 211, alpha),
1146
- externalTransactions: this._getRgbColor(221, 160, 221, alpha),
1147
- userTransactions: this._getRgbColor(210, 105, 30, alpha),
1148
- sqlBlockedTrans: this._getRgbColor(0, 0, 255, alpha),
1149
- sqlStatements: this._getRgbColor(188, 143, 143, alpha),
1150
- cidRange: this._getRgbColor(32, 178, 170, alpha),
1151
- tidRange: this._getRgbColor(124, 252, 0, alpha),
1152
- pendingRequestCount: this._getRgbColor(160, 32, 240, alpha),
1153
- mvccNum: this._getRgbColor(65, 105, 225, alpha),
1154
- acquiredRecordLocks: this._getRgbColor(0, 250, 154, alpha),
1155
- searchCount: this._getRgbColor(127, 255, 212, alpha),
1156
- indexingCount: this._getRgbColor(0, 191, 255, alpha),
1157
- mergeCount: this._getRgbColor(135, 206, 235, alpha),
1158
- unloadCount: this._getRgbColor(255, 165, 0, alpha),
1159
- indexserverThreads: this._getRgbColor(0, 100, 0, alpha),
1160
- waitingThreads: this._getRgbColor(176, 48, 96, alpha),
1161
- totalThreads: this._getRgbColor(100, 149, 237, alpha),
1162
- activeSqlExecutors: this._getRgbColor(175, 238, 238, alpha),
1163
- waitingSqlExecutors: this._getRgbColor(50, 205, 50, alpha),
1164
- totalSqlExecutors: this._getRgbColor(240, 230, 140, alpha),
1165
- dataWriteSize: this._getRgbColor(102, 205, 170, alpha),
1166
- dataWriteTime: this._getRgbColor(169, 169, 169, alpha),
1167
- logWriteSize: this._getRgbColor(160, 82, 45, alpha),
1168
- logWriteTime: this._getRgbColor(128, 128, 0, alpha),
1169
- dataReadSize: this._getRgbColor(255, 215, 0, alpha),
1170
- dataReadTime: this._getRgbColor(95, 158, 160, alpha),
1171
- logReadSize: this._getRgbColor(255, 0, 0, alpha),
1172
- logReadTime: this._getRgbColor(184, 134, 11, alpha),
1173
- dataBackupWriteSize: this._getRgbColor(255, 255, 0, alpha),
1174
- dataBackupWriteTime: this._getRgbColor(154, 205, 50, alpha),
1175
- logBackupWriteSize: this._getRgbColor(0, 0, 139, alpha),
1176
- logBackupWriteTime: this._getRgbColor(219, 112, 147, alpha),
1177
- mutexCollisionCount: this._getRgbColor(244, 164, 96, alpha),
1178
- readWriteLockCollisionCount: this._getRgbColor(233, 150, 122, alpha),
1179
- admissinControlAdmitCount: this._getRgbColor(143, 188, 143, alpha),
1180
- admissionControlRejectCount: this._getRgbColor(255, 0, 255, alpha),
1181
- admissionControlWaitingRequests: this._getRgbColor(153, 50, 204, alpha),
1182
- admissionControlWaitTime: this._getRgbColor(144, 238, 144, alpha), // lightgreen
1183
- };
1184
- }
1185
- static get _unitType() {
1186
- const unitType = {};
1187
- unitType[Unit.PCT] = UnitType.TypeEA;
1188
- unitType[Unit.MS] = UnitType.TypeEA;
1189
- unitType[Unit.Empty] = UnitType.TypeEA;
1190
- unitType[Unit.GB] = UnitType.TypeGB;
1191
- unitType[Unit.MB] = UnitType.TypeMB;
1192
- unitType[Unit.MBPerSec] = UnitType.TypeMBSec;
1193
- unitType[Unit.SecPerSec] = UnitType.TypeSecSec;
1194
- unitType[Unit.StmtPerSec] = UnitType.TypeSec;
1195
- unitType[Unit.ReqPerSec] = UnitType.TypeSec;
1196
- unitType[Unit.ColPerSec] = UnitType.TypeSec;
1197
- return unitType;
1198
- }
1199
- /**
1200
- * get yScale group list from the enum ScaleGroup
1201
- */
1202
- static get _YScaleGroupList() {
1203
- return Object.keys(ScaleGroup).filter(key => !isNaN(Number(ScaleGroup[key]))).map(key => ScaleGroup[key]);
1204
- }
1205
- /**
1206
- * Generate one item by the provided attributes and values
1207
- * @param args the dynamic parameter of [attribute, value]
1208
- */
1209
- static _generateLoadHistoryInfoItem(...args) {
1210
- const obj = {};
1211
- if (!args || args.length <= 0) {
1212
- return obj;
1213
- }
1214
- args.forEach(item => {
1215
- if (item && item.length >= 2) {
1216
- obj[item[0]] = item[1];
1217
- }
1218
- });
1219
- return obj;
1220
- }
1221
- /**
1222
- * generate the loadHistoryInfo object with default values.
1223
- */
1224
- static _generateLoadHistoryInfo() {
1225
- // minimum value for YScale of swapIn, swapOut, indexserverSwapIn is 100 (according to hana studio)
1226
- const infoItem = UIService._generateLoadHistoryInfoItem; // just for making the name shorter...
1227
- const cpuUsed = infoItem([Item.kpi, 'CPU'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.CPU], [Item.unit, Unit.PCT], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'CPU Used by all processes']);
1228
- const memoryResident = infoItem([Item.kpi, 'Database Resident Memory'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Physical memory used for all HANA processes']);
1229
- const memoryTotalResident = infoItem([Item.kpi, 'Total Resident Memory'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Physical memory used for all processes']);
1230
- const memoryUsed = infoItem([Item.kpi, 'Database Used Memory'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Memory used for all HANA processes']);
1231
- const memoryLimit = infoItem([Item.kpi, 'Database Allocation Limit'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Memory allocation limit for all processes of HANA instance']);
1232
- const memorySize = infoItem([Item.kpi, 'Physical Memory Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Physical memory size']);
1233
- const diskUsed = infoItem([Item.kpi, 'Disk Used'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Disk], [Item.unit, Unit.GB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Disk used']);
1234
- const diskSize = infoItem([Item.kpi, 'Disk Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Disk], [Item.unit, Unit.GB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Disk size']);
1235
- const networkIn = infoItem([Item.kpi, 'Network In'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Network], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes read from network by all processes']);
1236
- const networkOut = infoItem([Item.kpi, 'Network Out'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Network], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes written to network by all processes']);
1237
- const swapIn = infoItem([Item.kpi, 'Swap In'], [Item.yScale, 100], [Item.yScaleGroup, ScaleGroup.Swap], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes read from swap by all processes (pswpin line in /proc/vmstat * sysconf(_SC_PAGESIZE))']);
1238
- const swapOut = infoItem([Item.kpi, 'Swap Out'], [Item.yScale, 100], [Item.yScaleGroup, ScaleGroup.Swap], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes written To swap by all processes (pswpout line in /proc/vmstat * sysconf(_SC_PAGESIZE))']);
1239
- const indexserverCpu = infoItem([Item.kpi, 'Index Server CPU'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.CPU], [Item.unit, Unit.PCT], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'CPU used by Service']);
1240
- const indexserverCpuSys = infoItem([Item.kpi, 'System CPU'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.CPU], [Item.unit, Unit.PCT], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'OS Kernel/System CPU used by Service']);
1241
- const indexserverMemUsed = infoItem([Item.kpi, 'Memory Used'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Memory used by Service']);
1242
- const indexserverMemLimit = infoItem([Item.kpi, 'Memory Allocation Limit'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Memory], [Item.unit, Unit.MB], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Memory allocation limit for Service']);
1243
- const indexserverHandles = infoItem([Item.kpi, 'Handles'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of open handles']);
1244
- const indexserverPingtime = infoItem([Item.kpi, 'Ping Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.MS], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Duration of Service ping request (THREAD_METHOD=\'__nsWatchdog\'). This request includes the collection of service specific KPI\'s']);
1245
- const indexserverSwapIn = infoItem([Item.kpi, 'Index Server Swap In'], [Item.yScale, 100], [Item.yScaleGroup, ScaleGroup.Swap], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes read from swap by Service (column 12(majflt) in /proc/<pid>/stat * sysconf(_SC_PAGESIZE))']);
1246
- const sqlConnections = infoItem([Item.kpi, 'Open Connections'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Conn], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of open SQL connections']);
1247
- const internalConnections = infoItem([Item.kpi, 'Internal Connections'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Conn], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of open SQL internal connections']);
1248
- const externalConnections = infoItem([Item.kpi, 'External Connections'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Conn], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of open SQL external connections']);
1249
- const idleConnections = infoItem([Item.kpi, 'Idle Connections'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Conn], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of open SQL idle connections']);
1250
- const sqlTransactions = infoItem([Item.kpi, 'Open Transactions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Trans], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of open SQL transactions']);
1251
- const internalTransactions = infoItem([Item.kpi, 'Internal Transactions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Trans], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of internal transactions']);
1252
- const externalTransactions = infoItem([Item.kpi, 'External Transactions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Trans], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of external transactions']);
1253
- const userTransactions = infoItem([Item.kpi, 'User Transactions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Trans], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of user transactions']);
1254
- const sqlBlockedTrans = infoItem([Item.kpi, 'Blocked Transactions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of blocked SQL transactions']);
1255
- const sqlStatements = infoItem([Item.kpi, 'Statements'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Stmt], [Item.unit, Unit.StmtPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of finished SQL statements']);
1256
- const cidRange = infoItem([Item.kpi, 'Active Commit ID Range'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Range between newest and oldest active commit ID']);
1257
- const tidRange = infoItem([Item.kpi, 'Active Transaction ID Range'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Range between newest and oldest active transaction ID']);
1258
- const pendingRequestCount = infoItem([Item.kpi, 'Pending Request Count'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of pending session requests']);
1259
- const mvccNum = infoItem([Item.kpi, 'Active Versions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of active MVCC versions']);
1260
- const acquiredRecordLocks = infoItem([Item.kpi, 'Acquired Record Locks'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of acquired record locks']);
1261
- const searchCount = infoItem([Item.kpi, 'Read Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Req], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of read requests (select)']);
1262
- const indexingCount = infoItem([Item.kpi, 'Write Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Req], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of write requests (insert,update,delete)']);
1263
- const mergeCount = infoItem([Item.kpi, 'Merge Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Req], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of merge requests']);
1264
- const unloadCount = infoItem([Item.kpi, 'Column Unloads'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Req], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of column unloads']);
1265
- const indexserverThreads = infoItem([Item.kpi, 'Active Threads'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of active threads']);
1266
- const waitingThreads = infoItem([Item.kpi, 'Waiting Threads'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of waiting threads']);
1267
- const totalThreads = infoItem([Item.kpi, 'Total Threads'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Total number of threads']);
1268
- const activeSqlExecutors = infoItem([Item.kpi, 'Active SqlExecutors'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of active SqlExecutors']);
1269
- const waitingSqlExecutors = infoItem([Item.kpi, 'Waiting SqlExecutors'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of waiting SqlExecutors']);
1270
- const totalSqlExecutors = infoItem([Item.kpi, 'Total SqlExecutors'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.Empty], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Total number of SqlExecutors']);
1271
- const dataWriteSize = infoItem([Item.kpi, 'Data Write Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRSize], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes written to data area']);
1272
- const dataWriteTime = infoItem([Item.kpi, 'Data Write Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRTime], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Time used for writing to data area']);
1273
- const logWriteSize = infoItem([Item.kpi, 'Log Write Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRSize], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes written to log area']);
1274
- const logWriteTime = infoItem([Item.kpi, 'Log Write Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRTime], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Time used for writing to log area']);
1275
- const dataReadSize = infoItem([Item.kpi, 'Data Read Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRSize], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes read from data area']);
1276
- const dataReadTime = infoItem([Item.kpi, 'Data Read Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRTime], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Time used for reading from data area']);
1277
- const logReadSize = infoItem([Item.kpi, 'Log Read Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRSize], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes read from log area']);
1278
- const logReadTime = infoItem([Item.kpi, 'Log Read Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRTime], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Time used for reading from log area']);
1279
- const dataBackupWriteSize = infoItem([Item.kpi, 'Data Backup Write Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRSize], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes written to data backup']);
1280
- const dataBackupWriteTime = infoItem([Item.kpi, 'Data Backup Write Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRTime], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Time used for writing to data backup']);
1281
- const logBackupWriteSize = infoItem([Item.kpi, 'Log Backup Write Size'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRSize], [Item.unit, Unit.MBPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Bytes written to log backup']);
1282
- const logBackupWriteTime = infoItem([Item.kpi, 'Log Backup Write Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.WRTime], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Time used for writing to log backup']);
1283
- const mutexCollisionCount = infoItem([Item.kpi, 'Mutex Collisions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ColPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of collisions on mutexes']);
1284
- const readWriteLockCollisionCount = infoItem([Item.kpi, 'Read/Write Lock Collisions'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ColPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of collisions on read/write locks']);
1285
- const admissinControlAdmitCount = infoItem([Item.kpi, 'Admitted Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of session requests admitted by admission control']);
1286
- const admissionControlRejectCount = infoItem([Item.kpi, 'Rejected Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of session requests rejected by admission control']);
1287
- const admissionControlWaitingRequests = infoItem([Item.kpi, 'Waiting Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of session requests waiting in admission control queue']);
1288
- const admissionControlWaitTime = infoItem([Item.kpi, 'Wait Time'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.SecPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Total wait time of session requests queued in admission control queue']);
1289
- const admissionControlEnqueueCount = infoItem([Item.kpi, 'Enqueued Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of session requests enqueued by admission control']);
1290
- const admissionControlDequeueCount = infoItem([Item.kpi, 'Dequeued Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of session requests dequeued by admission control']);
1291
- const admissionControlTimeoutCount = infoItem([Item.kpi, 'Timed out Requests'], [Item.yScale, 0,], [Item.yScaleGroup, ScaleGroup.Unknown], [Item.unit, Unit.ReqPerSec], [Item.max, -1], [Item.average, -1], [Item.sum, -1], [Item.last, -1], [Item.description, 'Number of timed out session requests in admission control queue']);
1292
- // generate Host
1293
- const loadHistoryInfoHost = {
1294
- cpuUsed: cpuUsed,
1295
- memoryResident: memoryResident,
1296
- memoryTotalResident: memoryTotalResident,
1297
- memoryUsed: memoryUsed,
1298
- memoryLimit: memoryLimit,
1299
- memorySize: memorySize,
1300
- diskUsed: diskUsed,
1301
- diskSize: diskSize,
1302
- networkIn: networkIn,
1303
- networkOut: networkOut,
1304
- swapIn: swapIn,
1305
- swapOut: swapOut,
1306
- };
1307
- // generate Index Server
1308
- const loadHistoryInfoIndexServer = {
1309
- indexserverCpu: indexserverCpu,
1310
- indexserverCpuSys: indexserverCpuSys,
1311
- indexserverMemUsed: indexserverMemUsed,
1312
- indexserverMemLimit: indexserverMemLimit,
1313
- indexserverHandles: indexserverHandles,
1314
- indexserverPingtime: indexserverPingtime,
1315
- indexserverSwapIn: indexserverSwapIn,
1316
- };
1317
- // generate SQL
1318
- const loadHistoryInfoSQL = {
1319
- sqlConnections: sqlConnections,
1320
- internalConnections: internalConnections,
1321
- externalConnections: externalConnections,
1322
- idleConnections: idleConnections,
1323
- sqlTransactions: sqlTransactions,
1324
- internalTransactions: internalTransactions,
1325
- externalTransactions: externalTransactions,
1326
- userTransactions: userTransactions,
1327
- sqlBlockedTrans: sqlBlockedTrans,
1328
- sqlStatements: sqlStatements,
1329
- cidRange: cidRange,
1330
- tidRange: tidRange,
1331
- pendingRequestCount: pendingRequestCount,
1332
- };
1333
- // generate Row Store
1334
- const loadHistoryInfoRowStore = {
1335
- mvccNum: mvccNum,
1336
- acquiredRecordLocks: acquiredRecordLocks,
1337
- };
1338
- // generate Column Store
1339
- const loadHistoryInfoColumnStore = {
1340
- searchCount: searchCount,
1341
- indexingCount: indexingCount,
1342
- mergeCount: mergeCount,
1343
- unloadCount: unloadCount,
1344
- };
1345
- // generate Threads
1346
- const loadHistoryInfoThreads = {
1347
- indexserverThreads: indexserverThreads,
1348
- waitingThreads: waitingThreads,
1349
- totalThreads: totalThreads,
1350
- activeSqlExecutors: activeSqlExecutors,
1351
- waitingSqlExecutors: waitingSqlExecutors,
1352
- totalSqlExecutors: totalSqlExecutors,
1353
- };
1354
- // generate Persistence
1355
- const loadHistoryInfoPersistence = {
1356
- dataWriteSize: dataWriteSize,
1357
- dataWriteTime: dataWriteTime,
1358
- logWriteSize: logWriteSize,
1359
- logWriteTime: logWriteTime,
1360
- dataReadSize: dataReadSize,
1361
- dataReadTime: dataReadTime,
1362
- logReadSize: logReadSize,
1363
- logReadTime: logReadTime,
1364
- };
1365
- // generate Backup
1366
- const loadHistoryInfoBackup = {
1367
- dataBackupWriteSize: dataBackupWriteSize,
1368
- dataBackupWriteTime: dataBackupWriteTime,
1369
- logBackupWriteSize: logBackupWriteSize,
1370
- logBackupWriteTime: logBackupWriteTime,
1371
- };
1372
- // generate Synchronization Primitives
1373
- const loadHistoryInfoSynchronizationPrimitives = {
1374
- mutexCollisionCount: mutexCollisionCount,
1375
- readWriteLockCollisionCount: readWriteLockCollisionCount,
1376
- };
1377
- // Session Admission Control
1378
- const loadHistoryInfoSessionAdmissionControl = {
1379
- admissinControlAdmitCount: admissinControlAdmitCount,
1380
- admissionControlRejectCount: admissionControlRejectCount,
1381
- admissionControlWaitingRequests: admissionControlWaitingRequests,
1382
- admissionControlWaitTime: admissionControlWaitTime,
1383
- admissionControlEnqueueCount: admissionControlEnqueueCount,
1384
- admissionControlDequeueCount: admissionControlDequeueCount,
1385
- admissionControlTimeoutCount: admissionControlTimeoutCount,
1386
- };
1387
- return {
1388
- 'Host': loadHistoryInfoHost,
1389
- 'Index Server': loadHistoryInfoIndexServer,
1390
- 'SQL': loadHistoryInfoSQL,
1391
- 'Row Store': loadHistoryInfoRowStore,
1392
- 'Column Store': loadHistoryInfoColumnStore,
1393
- 'Threads': loadHistoryInfoThreads,
1394
- 'Persistence': loadHistoryInfoPersistence,
1395
- 'Backup': loadHistoryInfoBackup,
1396
- 'Synchronization Primitives': loadHistoryInfoSynchronizationPrimitives,
1397
- 'Session Admission Control': loadHistoryInfoSessionAdmissionControl
1398
- };
1399
- }
1400
- /**
1401
- * get rgbcolor object via red, green, blue and alpha.
1402
- */
1403
- static _getRgbColor(red, green, blue, alpha) {
1404
- return { red: red, green: green, blue: blue, alpha: alpha };
1405
- }
1406
- static _getYScaleForItem(item, yScale) {
1407
- return yScale > item[Item.yScale] ? (item[Item.unit] === Unit.PCT ? 100 : yScale) : item[Item.yScale];
1408
- }
1409
- static _getMaxValueOfGroup(groupItems) {
1410
- let max = 0;
1411
- if (groupItems) {
1412
- max = groupItems.reduce((maxValue, current) => {
1413
- return current.Max > maxValue ? current.Max : maxValue;
1414
- }, 0);
1415
- }
1416
- return max;
1417
- }
1418
- _getLoadHistoryInfo(port) {
1419
- if (!this._loadHistoryInfos[port]) {
1420
- this._loadHistoryInfos[port] = UIService._generateLoadHistoryInfo();
1421
- }
1422
- return this._loadHistoryInfos[port];
1423
- }
1424
- _getProcessingUnit(itemKey, port) {
1425
- const historyDetailItem = this._getItemByKey(itemKey, port);
1426
- if (historyDetailItem) {
1427
- let unit = historyDetailItem.Unit;
1428
- if (!unit) {
1429
- unit = '';
1430
- }
1431
- return UIService._unitType[unit];
1432
- }
1433
- }
1434
- _setOverview(key, overview, unit, port) {
1435
- const historyDetailItem = this._getItemByKey(key, port);
1436
- if (historyDetailItem) {
1437
- historyDetailItem.Max = overview.Max >= 0 ? overview.Max : 0;
1438
- historyDetailItem.Average = overview.Average >= 0 ? overview.Average : 0;
1439
- // only TYPE_CONVERSION_MBSEC and TYPE_CONVERTION_SEC (eg: MB/s, req/s stmt/s...) need sum
1440
- historyDetailItem.Sum = isUnitTimeRelated(unit) ? (overview.Sum >= 0 ? overview.Sum : 0) : '-';
1441
- historyDetailItem.Last = overview.Last >= 0 ? overview.Last : 0;
1442
- }
1443
- }
1444
- /**
1445
- * convert unit values (eg: byte to MB or GB) and generate the control data (sum, max, avg) for one row
1446
- */
1447
- _convertUnitAndGenerateRowControlData(row, key, unit, port) {
1448
- return new Promise(resolve => {
1449
- if (row) {
1450
- const overview = { Sum: 0, Max: 0, Average: 0, Last: 0 };
1451
- const ignoredTailLineNum = getIgnoredLineNumFromTail();
1452
- let invalidCount = 0;
1453
- // convert unit and calculate the overview data, skip the first, and last three rows.
1454
- row.forEach((item, index, arrayData) => {
1455
- // skip ignored line(s) from tail
1456
- if (index <= row.length - ignoredTailLineNum - 1) {
1457
- if (arrayData[index].y >= 0) {
1458
- arrayData[index].y = getValueByUnit(item.y, unit);
1459
- overview.Sum += arrayData[index].y;
1460
- if (isUnitTimeRelated(unit)) {
1461
- if (index === 0) {
1462
- // according to hana studio, for those time related column, the first value is set to 0
1463
- arrayData[index].y = 0;
1464
- }
1465
- else {
1466
- // get value for unit like: MB/s (value / seconds)
1467
- const timeDiff = arrayData[index].x - arrayData[index - 1].x;
1468
- arrayData[index].y = timeDiff !== 0 ? arrayData[index].y * 1000 / timeDiff : 0;
1469
- }
1470
- }
1471
- arrayData[index].y = getRoundedValue(arrayData[index].y);
1472
- if (arrayData[index].y > overview.Max) {
1473
- overview.Max = arrayData[index].y;
1474
- }
1475
- }
1476
- else {
1477
- // set value to 0, for those points with value -1 or < 0
1478
- arrayData[index].y = 0;
1479
- // invalid count + 1, for calculating the average (not time relative)
1480
- invalidCount++;
1481
- }
1482
- }
1483
- });
1484
- if (row.length >= (ignoredTailLineNum + invalidCount)) {
1485
- if (isUnitTimeRelated(unit)) {
1486
- const timePeriod = row[row.length - ignoredTailLineNum - 1].x - row[0].x;
1487
- overview.Average = timePeriod !== 0 ? getRoundedValue(overview.Sum * 1000 / timePeriod) : 0;
1488
- }
1489
- else {
1490
- const validItemCount = row.length - ignoredTailLineNum - invalidCount;
1491
- overview.Average = validItemCount > 0 ? getRoundedValue(overview.Sum / validItemCount) : 0;
1492
- }
1493
- overview.Last = row[row.length - ignoredTailLineNum - 1].y;
1494
- overview.Sum = getRoundedValue(overview.Sum);
1495
- overview.Max = getRoundedValue(overview.Max);
1496
- // remove those ignored lines
1497
- row.length = row.length - ignoredTailLineNum;
1498
- }
1499
- this._setOverview(key, overview, unit, port);
1500
- }
1501
- resolve();
1502
- });
1503
- }
1504
- /**
1505
- * Loop from all history items, put those history items which
1506
- * have the same yScaleGroup together, using yScaleGroup as key.
1507
- * eg: {__SCALE_GROUP_CPU:[item1, item2...], __SCALE_GROUP_UNKNOWN:[item3, item4...]}
1508
- */
1509
- _getYScaleGroupWithHistoryItems(port) {
1510
- const yScaleGroup = {};
1511
- const loadHistoryInfo = this._getLoadHistoryInfo(port);
1512
- Object.keys(loadHistoryInfo).forEach(parentKey => {
1513
- Object.keys(loadHistoryInfo[parentKey]).forEach(childKey => {
1514
- const detailItem = loadHistoryInfo[parentKey][childKey];
1515
- const yScaleGroupKey = detailItem._YScaleGroup;
1516
- if (!yScaleGroup[yScaleGroupKey]) {
1517
- yScaleGroup[yScaleGroupKey] = [];
1518
- }
1519
- yScaleGroup[yScaleGroupKey].push(detailItem);
1520
- });
1521
- });
1522
- return yScaleGroup;
1523
- }
1524
- _setYScaleOfGroup(groupItems, group) {
1525
- if (groupItems) {
1526
- if (group === ScaleGroup.Unknown) {
1527
- groupItems.forEach(item => item[Item.yScale] = UIService._getYScaleForItem(item, calculateYScale(item.Max)));
1528
- }
1529
- else {
1530
- const yScale = calculateYScale(UIService._getMaxValueOfGroup(groupItems));
1531
- groupItems.forEach(item => item[Item.yScale] = UIService._getYScaleForItem(item, yScale));
1532
- }
1533
- }
1534
- }
1535
- _getItemByKey(key, port) {
1536
- const loadHistoryInfo = this._getLoadHistoryInfo(port);
1537
- for (const itemKey of Object.keys(loadHistoryInfo)) {
1538
- if (key in loadHistoryInfo[itemKey]) {
1539
- return loadHistoryInfo[itemKey][key];
1540
- }
1541
- }
1542
- }
1543
- /**
1544
- * reset the load history info object, to prevent memory leak
1545
- */
1546
- clearLoadHistoryInfos() {
1547
- this._loadHistoryInfos = {};
1548
- }
1549
- /**
1550
- * get all the data for the selection table
1551
- */
1552
- getSelectionTableRows(headerKeys, port, defaultDisplayItems) {
1553
- const rows = [];
1554
- const loadHistoryInfo = this._getLoadHistoryInfo(port);
1555
- const defaultItems = defaultDisplayItems && defaultDisplayItems.length > 0 ? defaultDisplayItems : this._DEFAULT_DISPLAY_ITEMS;
1556
- Object.keys(loadHistoryInfo).forEach(keyParent => {
1557
- rows.push({ KPI: keyParent, header: true });
1558
- const len = rows.length;
1559
- rows.push(...Object.keys(loadHistoryInfo[keyParent])
1560
- .filter(keyChild => headerKeys.includes(keyChild))
1561
- .map(keyChild => {
1562
- loadHistoryInfo[keyParent][keyChild].header = false;
1563
- loadHistoryInfo[keyParent][keyChild].checked = defaultItems.includes(keyChild);
1564
- return loadHistoryInfo[keyParent][keyChild];
1565
- }));
1566
- if (len === rows.length) {
1567
- // no sub items, remove the header
1568
- rows.pop();
1569
- }
1570
- });
1571
- return rows;
1572
- }
1573
- /**
1574
- * get all hidden columns. Those hidden columns = input hidden columns + default hidden columns
1575
- * @param hideMeasureColumns the array contains the columns list that need to be hidden.
1576
- */
1577
- getHiddenColumns(hideMeasureColumns) {
1578
- // only measure columns can be hidden
1579
- const hideColumns = hideMeasureColumns ? hideMeasureColumns.filter(column => this._MEASURE_COLUMNS.includes(column)) : [];
1580
- return hideColumns ? this._HIDED_COLUMNS.concat(hideColumns) : this._HIDED_COLUMNS;
1581
- }
1582
- /**
1583
- * get header information and format it to {headKey: key, headText: text}
1584
- */
1585
- getHeader(keys, port) {
1586
- return keys.map(key => {
1587
- const item = this._getItemByKey(key, port);
1588
- if (item != null && 'KPI' in item) {
1589
- return ({ key: key, text: item.KPI });
1590
- }
1591
- else {
1592
- console.warn(`${key} is not configured.`);
1593
- }
1594
- }).filter(key => key != null);
1595
- }
1596
- /**
1597
- * Get the selected items, which need to be displayed on the chart.
1598
- * @param headerKeys array that contains the keys of header
1599
- * @param port the relative port
1600
- * @param defaultDisplayItems the items list that will be displayed by default.
1601
- */
1602
- getDisplayItems(headerKeys, port, defaultDisplayItems) {
1603
- const selectionTable = this.getSelectionTableRows(headerKeys, port, defaultDisplayItems);
1604
- return selectionTable.filter(row => row.checked).map(row => row.KPI);
1605
- }
1606
- /**
1607
- * Get the Y Scale by the keys and port
1608
- */
1609
- getYScale(keys, port) {
1610
- const yScales = [];
1611
- if (keys) {
1612
- keys.forEach(key => {
1613
- yScales.push(this._getItemByKey(key, port)[Item.yScale]);
1614
- });
1615
- }
1616
- return yScales;
1617
- }
1618
- /**
1619
- * Generate Y Scale for the port
1620
- */
1621
- generateYScale(port) {
1622
- const yScaleGroup = this._getYScaleGroupWithHistoryItems(port);
1623
- UIService._YScaleGroupList.forEach(group => {
1624
- const historyItems = yScaleGroup[group];
1625
- if (historyItems) {
1626
- this._setYScaleOfGroup(historyItems, group);
1627
- }
1628
- });
1629
- }
1630
- /**
1631
- * convert unit values (eg: byte to MB or GB) and generate the control data (sum, max, avg)
1632
- * @param data the nameserver history data
1633
- * @param header header list
1634
- * @param port selected port
1635
- */
1636
- convertUnitAndGenerateControlData(data, header, port) {
1637
- const promises = [];
1638
- if (data && header) {
1639
- data.forEach((row, index) => {
1640
- if (row) {
1641
- // get detail history item key, like indexserverCpu
1642
- const itemKey = header[index];
1643
- const unit = this._getProcessingUnit(itemKey, port);
1644
- promises.push(this._convertUnitAndGenerateRowControlData(row, itemKey, unit, port));
1645
- }
1646
- });
1647
- }
1648
- return Promise.all(promises);
1649
- }
1650
- }
1651
- UIService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: UIService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1652
- UIService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: UIService });
1653
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: UIService, decorators: [{
1654
- type: Injectable
1655
- }] });
1656
-
1657
- // Using dynamic flag to fix the issue of ng-packagr #696: Lambda not supported
1658
- // @dynamic
1659
- class ChartService {
1660
- /**
1661
- * toggle the dataset status of the chart, synchronously
1662
- */
1663
- static _toggleDataSet(dataSetIndex, chart, hidden) {
1664
- // meta.hidden = false and dataset.hidden = false --> show
1665
- // meta.hidden = false and dataset.hidden = true --> show
1666
- // meta.hidden = null and dataset.hidden = false -> show
1667
- // meta.hidden = null and dataset.hidden = true -> hide
1668
- // in the first case (false, false), needs to click legend twice to
1669
- // hide the dataset, because the first click only set meta.hidden = null)
1670
- if (dataSetIndex != null && chart != null) {
1671
- const meta = chart.getDatasetMeta(dataSetIndex);
1672
- if (meta) {
1673
- if (!hidden) {
1674
- // display the item, if dataset hidden is false, set hidden of meta to null,
1675
- meta.hidden = !chart.data.datasets[dataSetIndex].hidden ? null : hidden;
1676
- }
1677
- else {
1678
- meta.hidden = hidden;
1679
- }
1680
- }
1681
- }
1682
- }
1683
- static _restoreDataSetStatus(chart, datasetIndex, status) {
1684
- if (chart && chart.data && chart.data.datasets && chart.getDatasetMeta(datasetIndex) && status) {
1685
- chart.data.datasets[datasetIndex].hidden = status.datasetStatus;
1686
- chart.getDatasetMeta(datasetIndex).hidden = status.metaStatus;
1687
- }
1688
- }
1689
- /**
1690
- * initialize/clear the configuration for the chart
1691
- */
1692
- static _initConfig(chart) {
1693
- // init data sets
1694
- if (chart.data && chart.data.datasets) {
1695
- chart.data.datasets.length = 0;
1696
- chart.data.datasets = void 0;
1697
- chart.data = void 0;
1698
- }
1699
- // init options
1700
- if (chart.options && chart.options.scales && (chart.options.scales.xAxes || chart.options.scales.yAxis)) {
1701
- if (chart.options.scales.xAxes) {
1702
- chart.options.scales.xAxes.length = 0;
1703
- chart.options.scales.xAxes = void 0;
1704
- }
1705
- if (chart.options.scales.yAxes) {
1706
- chart.options.scales.yAxes.length = 0;
1707
- chart.options.scales.yAxes = void 0;
1708
- }
1709
- chart.options.scales = void 0;
1710
- chart.options = void 0;
1711
- }
1712
- }
1713
- /**
1714
- * Generate DataSets by the data and header information
1715
- */
1716
- static _generateDataSets(data, header, headerKey, defaultItems) {
1717
- const alpha = 0.5;
1718
- const colors = UIService.getColors(alpha);
1719
- return data.map((item, i) => {
1720
- const color = colors[headerKey[i]] ? getColorString(colors[headerKey[i]]) : randomColor(alpha);
1721
- return {
1722
- borderColor: color,
1723
- backgroundColor: color,
1724
- borderWidth: 1.25,
1725
- spanGaps: false,
1726
- label: header[i],
1727
- data: data[i],
1728
- fill: false,
1729
- yAxisID: `y-axis-${i}`,
1730
- hidden: !defaultItems.includes(header[i])
1731
- };
1732
- });
1733
- }
1734
- static _generateXAxes(time) {
1735
- const format = 'MMMDD HH:mm:ss';
1736
- return [
1737
- {
1738
- type: 'time',
1739
- time: {
1740
- // unit: 'second',
1741
- // stepSize: 1,
1742
- displayFormats: {
1743
- 'millisecond': format,
1744
- 'second': format,
1745
- 'minute': format,
1746
- 'hour': 'MMMDD HH',
1747
- 'day': 'MMMDD YYYY',
1748
- 'week': format,
1749
- 'month': format,
1750
- 'quarter': format,
1751
- 'year': format,
1752
- },
1753
- tooltipFormat: 'll HH:mm:ss',
1754
- min: time[0],
1755
- max: time[time.length - 1]
1756
- },
1757
- // scaleLabel: {
1758
- // display: false,
1759
- // labelString: 'Date'
1760
- // },
1761
- ticks: {
1762
- maxRotation: 0,
1763
- reverse: true
1764
- }
1765
- }
1766
- ];
1767
- }
1768
- static _generateYAxes(data, yScale) {
1769
- return data.map((item, i) => ({
1770
- type: 'linear',
1771
- display: false,
1772
- position: 'left',
1773
- id: `y-axis-${i}`,
1774
- gridLines: {},
1775
- ticks: {
1776
- min: 0,
1777
- max: yScale[i]
1778
- }
1779
- }));
1780
- }
1781
- /**
1782
- * generate configuration for chart
1783
- */
1784
- static _generateChartConfig(time, data, yScale, header, headerKey, selection, tableSource, title, defaultItems, zoomCallback) {
1785
- return {
1786
- type: 'line',
1787
- data: {
1788
- datasets: ChartService._generateDataSets(data, header, headerKey, defaultItems)
1789
- },
1790
- options: {
1791
- elements: { point: { radius: 0, hitRadius: 5, hoverRadius: 5 } },
1792
- responsive: true,
1793
- animation: {
1794
- duration: 0, // general animation time
1795
- },
1796
- hover: {
1797
- animationDuration: 0,
1798
- onHover: function (e) {
1799
- const point = this.getElementAtEvent(e);
1800
- if (point.length) {
1801
- e.target.style.cursor = 'pointer';
1802
- }
1803
- else {
1804
- e.target.style.cursor = 'default';
1805
- }
1806
- }
1807
- },
1808
- responsiveAnimationDuration: 0,
1809
- legend: {
1810
- position: 'bottom',
1811
- onHover: (e) => {
1812
- e.target.style.cursor = 'pointer';
1813
- },
1814
- labels: {
1815
- filter: (legendItem) => selection.isSelected(tableSource.find(row => legendItem.text === row.KPI))
1816
- }
1817
- },
1818
- title: {
1819
- display: true,
1820
- text: title
1821
- },
1822
- responsiveDownsample: {
1823
- enabled: true,
1824
- desiredDataPointDistance: 2,
1825
- minNumPoints: 200,
1826
- maxNumPointsToDraw: 100
1827
- },
1828
- tooltips: {
1829
- callbacks: {
1830
- label: function (tooltipItem, chartData) {
1831
- // format numbers with commas and add unit information
1832
- const label = chartData.datasets[tooltipItem.datasetIndex].label || '';
1833
- if (label) {
1834
- // get unit (eg: MB, GB, MB/s, % and so on)
1835
- const rowItem = tableSource.find(controlTableRow => label === controlTableRow.KPI) || '';
1836
- const unit = rowItem[Item.unit] && rowItem[Item.unit] !== Unit.PCT ? ` ${rowItem[Item.unit]}` : rowItem[Item.unit] || '';
1837
- return `${label}: ${getNumberWithCommas(tooltipItem.yLabel)}${unit}`;
1838
- }
1839
- else {
1840
- return getNumberWithCommas(tooltipItem.yLabel);
1841
- }
1842
- }
1843
- }
1844
- },
1845
- scales: {
1846
- xAxes: ChartService._generateXAxes(time),
1847
- yAxes: ChartService._generateYAxes(data, yScale)
1848
- },
1849
- zoom: {
1850
- enabled: true,
1851
- drag: true,
1852
- mode: 'x',
1853
- onZoom: zoomCallback
1854
- }
1855
- }
1856
- };
1857
- }
1858
- _getDataSetIndexByLabel(label, chart) {
1859
- if (chart.data && chart.data.datasets) {
1860
- return chart.data.datasets.findIndex(dataset => dataset.label === label);
1861
- }
1862
- return -1;
1863
- }
1864
- /**
1865
- * destroy the chart, release the resource of the chart
1866
- */
1867
- _destroyChart(chart) {
1868
- return new Promise((resolve) => {
1869
- if (chart) {
1870
- chart.destroy();
1871
- }
1872
- resolve();
1873
- });
1874
- }
1875
- /**
1876
- * update/refresh the chart
1877
- */
1878
- _updateChart(chart) {
1879
- return new Promise((resolve, reject) => {
1880
- if (chart) {
1881
- chart.update();
1882
- resolve();
1883
- }
1884
- else {
1885
- reject('Updating chart failed, error: the chart object is empty.');
1886
- }
1887
- });
1888
- }
1889
- /**
1890
- * reset zoom of the chart
1891
- */
1892
- _resetZoom(chart) {
1893
- return new Promise((resolve, reject) => {
1894
- if (chart) {
1895
- const datasetStatusBeforeReset = [];
1896
- if (chart.data && chart.data.datasets) {
1897
- chart.data.datasets.forEach((dataset, index) => {
1898
- const meta = chart.getDatasetMeta(index);
1899
- if (meta) {
1900
- datasetStatusBeforeReset[index] = { metaStatus: meta.hidden, datasetStatus: dataset.hidden };
1901
- }
1902
- else {
1903
- reject(`Internal error, can not find the meta ${index}.`);
1904
- }
1905
- });
1906
- }
1907
- chart.resetZoom();
1908
- resolve(datasetStatusBeforeReset);
1909
- }
1910
- else {
1911
- reject('Resetting chart failed, error: the chart object is empty.');
1912
- }
1913
- });
1914
- }
1915
- /**
1916
- * Reset Chart to initial status
1917
- * If legend is already selected/unselected from the list, it wouldn't be restored.
1918
- * @param dataSourceData the data sets of the chart
1919
- * @param selection selection status list
1920
- */
1921
- resetChart(dataSourceData, selection) {
1922
- return this._resetZoom(this._chart).then((datasetStatusBeforeZoom) => {
1923
- // reset the data set by the selection status
1924
- dataSourceData.filter(row => !row.header).forEach(row => {
1925
- const index = this._getDataSetIndexByLabel(row.KPI, this._chart);
1926
- if (!selection.isSelected(row)) {
1927
- ChartService._toggleDataSet(index, this._chart, true);
1928
- }
1929
- else {
1930
- ChartService._restoreDataSetStatus(this._chart, index, datasetStatusBeforeZoom[index]);
1931
- }
1932
- });
1933
- return this._updateChart(this._chart);
1934
- });
1935
- }
1936
- /**
1937
- * destroy the chart and reinitialize the configuration of the chart
1938
- */
1939
- destroyChart() {
1940
- return this._destroyChart(this._chart).then(() => {
1941
- if (this._chart) {
1942
- ChartService._initConfig(this._chart);
1943
- this._chart = void 0;
1944
- }
1945
- });
1946
- }
1947
- /**
1948
- * generate configuration for chart and create the chart object.
1949
- */
1950
- buildChart(time, data, yScale, header, headerKey, selection, tableSource, title, defaultItems, zoomCB) {
1951
- return new Promise((resolve, reject) => {
1952
- var _a;
1953
- const ctx = (_a = document.getElementById('chartNameServerHistory')) === null || _a === void 0 ? void 0 : _a.getContext('2d');
1954
- if (ctx) {
1955
- const cfg = ChartService._generateChartConfig(time, data, yScale, header, headerKey, selection, tableSource, title, defaultItems, zoomCB);
1956
- this._chart = new Chart$2(ctx, cfg);
1957
- resolve();
1958
- }
1959
- else {
1960
- reject('Can not find the canvas.');
1961
- }
1962
- });
1963
- }
1964
- /**
1965
- * show/hide the relative data set
1966
- */
1967
- toggleDataInChart(label, hide) {
1968
- return new Promise((resolve) => {
1969
- ChartService._toggleDataSet(this._getDataSetIndexByLabel(label, this._chart), this._chart, hide);
1970
- resolve(this._updateChart(this._chart));
1971
- });
1972
- }
1973
- }
1974
- ChartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1975
- ChartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ChartService });
1976
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ChartService, decorators: [{
1977
- type: Injectable
1978
- }] });
1979
-
1980
- /**
1981
- * prevent browser from crashing, set the max rows limitation.
1982
- * This could be overwritten by the input:maxRowsLimitation of the component.
1983
- */
1984
- const _DEFAULT_MAX_ROWS_IN_MEMORY = 100000;
1985
- class FileService {
1986
- /**
1987
- * prevent browser from crashing, set the max rows limitation.
1988
- * @param limitation if this parameter is not null, the default value will be overwritten by this one.
1989
- */
1990
- static _getMaxRowsLimitation(limitation = null) {
1991
- if (limitation == null || isNaN(limitation) || limitation.length === 0) {
1992
- return _DEFAULT_MAX_ROWS_IN_MEMORY;
1993
- }
1994
- return Number(limitation);
1995
- }
1996
- /**
1997
- * get all available ports from data
1998
- */
1999
- static _getPorts(data, firstChunk, ports) {
2000
- let line = 0;
2001
- if (firstChunk) {
2002
- // start from line 3
2003
- line = 2;
2004
- }
2005
- for (; line < data.length; line++) {
2006
- const dataItem = data[line][1];
2007
- if (dataItem != null && dataItem.length > 0) {
2008
- if (isValidPort(dataItem) && ports.indexOf(dataItem) === -1) {
2009
- ports.push(dataItem);
2010
- }
2011
- }
2012
- }
2013
- }
2014
- /**
2015
- * get the time column from the analyzed data
2016
- * @param data the analyzed data
2017
- * @param firstChunk whether it's first chunk or not
2018
- * @param startTime selected starting time. It's millisecond, need to be converted second.
2019
- * @param endTime selected ending time. It's millisecond, need to be converted second.
2020
- * @param lastProcessedTime last processed time form last chunk
2021
- * @param time time object which contains the time data for all ports
2022
- * @param selectedPort if the selected port is empty (did not select any port), all ports info are needed
2023
- * @param isMDC flag for MDC system
2024
- * @param timezone selected timezone
2025
- * @param maxRowsLimitation prevent browser from crashing, set the max rows limitation.
2026
- * This comes from the input: maxRowsLimitation of the component.
2027
- */
2028
- static _getTimeColumn(data, firstChunk, startTime, endTime, lastProcessedTime, time, selectedPort, isMDC, timezone, maxRowsLimitation) {
2029
- // convert millisecond to second for startTime and endTime.
2030
- startTime = startTime / 1000;
2031
- endTime = endTime / 1000;
2032
- const timeColumn = 2;
2033
- let startLine = 0;
2034
- let iStart = -1;
2035
- let iEnd = -1;
2036
- let curTime = lastProcessedTime;
2037
- let lastProcessedTimeReturn;
2038
- let totalNum = 0;
2039
- let mdcFlag = isMDC;
2040
- const defaultPort = getDefaultPort();
2041
- const maxRowNum = this._getMaxRowsLimitation(maxRowsLimitation);
2042
- if (firstChunk) {
2043
- if (curTime >= startTime && curTime <= endTime) {
2044
- iStart = 1; // start from first line
2045
- /** Modified at 2018/10/10,
2046
- * in some case, eg: the nameserver history trace gets modified by Kook, Jin Young's python script,
2047
- * the port show in the first line as well, and does not like the non-mdc system, this kind of file has
2048
- * one port in it. The history for non-mdc system doesn't have port info in the port column.*/
2049
- // get port for the line 1.
2050
- const firstLinePort = getPort(data[1][1]);
2051
- // init time array for the first line.
2052
- if (!selectedPort || selectedPort.length === 0 || isSamePort(firstLinePort, selectedPort, mdcFlag)) {
2053
- // does not select any port or
2054
- // it's non-mdc (mdcFlag is false at the beginning) system and the selected port is the first line port
2055
- time[firstLinePort] = [];
2056
- time[firstLinePort][0] = curTime * 1000;
2057
- }
2058
- }
2059
- lastProcessedTimeReturn = curTime;
2060
- startLine = 2;
2061
- }
2062
- // get current total number
2063
- Object.keys(time).forEach(key => {
2064
- if (time[key]) {
2065
- totalNum += time[key].length;
2066
- }
2067
- });
2068
- if (curTime == null) {
2069
- console.error('getTimeColumn', 'Can not get the time from the file, internal error!');
2070
- return { indexStart: null, indexEnd: null, lastProcessedTime: null, isMDC: null };
2071
- }
2072
- for (let i = startLine; i < data.length; i++) {
2073
- // sometime the last line is empty, need to be skipped.
2074
- if (data[i] == null || data[i].length === 0 || (data[i].length === 1 && data[i][0].length === 0)) {
2075
- continue;
2076
- }
2077
- // get port number and initialize the relative port array in time
2078
- const port = getPort(data[i][1]); // data[i][1] == null || data[i][1].length == 0 ? __DEFAULT_PORT : data[i][1];
2079
- if (!(port in time)) {
2080
- // add undefined port to time, then we can find all ports in time
2081
- time[port] = void 0;
2082
- }
2083
- if (time[port] == null && isSamePort(port, selectedPort, mdcFlag)) {
2084
- time[port] = [];
2085
- // if other ports exists in this file, default port will be set to undefined.
2086
- if (!mdcFlag && port !== defaultPort && time[defaultPort]) {
2087
- // update the total num;
2088
- totalNum -= time[defaultPort].length;
2089
- time[defaultPort].length = 0;
2090
- time[defaultPort] = void 0;
2091
- mdcFlag = true;
2092
- }
2093
- }
2094
- curTime = calculateValue4Time(curTime, data[i][timeColumn], timezone);
2095
- if (curTime > endTime) {
2096
- if (iEnd < 0) {
2097
- iEnd = i - 1;
2098
- }
2099
- break;
2100
- }
2101
- if (iStart >= 0) {
2102
- if (time[port]) {
2103
- // not null means it's the selected port
2104
- time[port][time[port].length] = curTime * 1000;
2105
- totalNum++;
2106
- }
2107
- }
2108
- else {
2109
- if (curTime >= startTime && curTime <= endTime) {
2110
- if (time[port]) {
2111
- // only selected port counted in
2112
- if (iStart < 0) {
2113
- iStart = i;
2114
- }
2115
- time[port][time[port].length] = curTime * 1000;
2116
- totalNum++;
2117
- }
2118
- }
2119
- }
2120
- // last processed time need to be recorded anyway
2121
- lastProcessedTimeReturn = curTime;
2122
- if (totalNum >= maxRowNum) {
2123
- iEnd = i;
2124
- break;
2125
- }
2126
- }
2127
- return { indexStart: iStart, indexEnd: iEnd, lastProcessedTime: lastProcessedTimeReturn, isMDC: mdcFlag };
2128
- }
2129
- /**
2130
- * Get data for all columns
2131
- * @param columnNum the total number of columns. For mdc system,
2132
- * the length of each row is different. Host relative data does not exist in tenant line.
2133
- * Needs to use column number from the first line.
2134
- * @param data data parsed by papa
2135
- * @param firstChunk the flag which identifies whether it's the first chunk or not.
2136
- * @param time
2137
- * @param indexStart
2138
- * @param indexEnd
2139
- * @param lastProcessedLine
2140
- * @param resultData the result data after analyzed
2141
- * @param selectedPort
2142
- * @param isMDC
2143
- */
2144
- static _getDataColumns(columnNum, data, firstChunk, time, indexStart, indexEnd, lastProcessedLine, resultData, selectedPort, isMDC) {
2145
- let startLine = 0;
2146
- // for mdc system, the length is not correct (host relative data only exists in the "empty" port line).
2147
- // Needs to use header from the first line.
2148
- // const columnNum = data[0].length;
2149
- if (firstChunk) {
2150
- /**
2151
- * Modified at 2018/10/10,
2152
- * in some case, eg: the nameserver history trace gets modified by Kook, Jin Young's python script,
2153
- * the port show in the first line as well, and does not like the non-mdc system, this kind of file has
2154
- * one port in it. The history for non-mdc system doesn't have port info in the port column.
2155
- */
2156
- // get port for the line 1.
2157
- const firstLinePort = getPort(data[1][1]);
2158
- // Initialize data column with default 'DEFAULT' port if it's not MDC system. MDC system, 'DEFAULT' gets ignored
2159
- if (!isMDC && time[firstLinePort]) {
2160
- resultData[firstLinePort] = [];
2161
- // removed below logic, because first line is the real number, do not need to do the convert.
2162
- // curLine = data[1].slice(3).map(Number);
2163
- for (let j = 3; j < columnNum; j++) {
2164
- const index = j - 3;
2165
- // initialize data array for all columns of the default '0000' port
2166
- resultData[firstLinePort][index] = [];
2167
- // get the first line data of the column if it's included
2168
- if (indexStart === 1) {
2169
- resultData[firstLinePort][index][0] = { x: time[firstLinePort][0], y: lastProcessedLine[index] };
2170
- }
2171
- }
2172
- }
2173
- startLine = 2;
2174
- }
2175
- for (let j = 3; j < columnNum; j++) {
2176
- const index = j - 3;
2177
- for (let i = startLine; i < data.length; i++) {
2178
- // sometime the last line is empty, need to be skipped.
2179
- if (data[i] == null || data[i].length === 0 || (data[i].length === 1 && data[i][0].length === 0)) {
2180
- continue;
2181
- }
2182
- // get port number and initialize the relative port array in data
2183
- const port = getPort(data[i][1]);
2184
- if (resultData[port] == null && isSamePort(port, selectedPort, isMDC)) {
2185
- resultData[port] = [];
2186
- }
2187
- if (resultData[port] && resultData[port][index] == null) {
2188
- resultData[port][index] = [];
2189
- }
2190
- lastProcessedLine[index] = calculateValue(lastProcessedLine[index], data[i][j]);
2191
- if (i >= indexStart && (i <= indexEnd || indexEnd < 0) && indexStart >= 0) {
2192
- if (resultData[port]) {
2193
- const length = resultData[port][index].length;
2194
- resultData[port][index][length] = { x: time[port][length], y: lastProcessedLine[index] };
2195
- }
2196
- }
2197
- else if (indexEnd > 0 && i > indexEnd) {
2198
- break;
2199
- }
2200
- }
2201
- }
2202
- }
2203
- /**
2204
- * Get Chart data from provided file.
2205
- * @param file the nameserver history file
2206
- * @param startTime
2207
- * @param endTime
2208
- * @param port
2209
- * @param timezone
2210
- * @param maxRowsLimitation prevent browser from crashing, set the max rows limitation.
2211
- * @param progress call back function for updating progress
2212
- */
2213
- getChartContentFromFile(file, startTime, endTime, port, timezone, maxRowsLimitation, progress) {
2214
- // load done, beginning parsing
2215
- const beginTime = new Date();
2216
- let firstChunk = true;
2217
- // save last processed data just for the later calculation
2218
- let lastProcessedData;
2219
- // save last processed time just for the later calculation
2220
- let lastProcessedTime;
2221
- // save last processed cursor position for progress calculation.
2222
- // let lastProcessedCursor = 0;
2223
- let indexStart = -1, indexEnd = -1;
2224
- const time = {};
2225
- const data = {};
2226
- let header;
2227
- let host;
2228
- let isMDC = false;
2229
- let columnNum;
2230
- let abortType;
2231
- const rejectAndAbort = (reject, parser) => {
2232
- if (progress) {
2233
- progress(100);
2234
- }
2235
- reject(`${file.name} is empty or the format is not correct.`);
2236
- parser.abort();
2237
- };
2238
- return new Promise((resolve, reject) => {
2239
- parse(file, {
2240
- chunk: (results, parser) => {
2241
- // the progress increment of this step
2242
- // let analyzeStepProgress = (results.meta.cursor - lastProcessedCursor) / file.size * 100;
2243
- printProcessedTime(beginTime, 'step1');
2244
- if (indexEnd >= 0) {
2245
- // already finished, quite.
2246
- return;
2247
- }
2248
- else {
2249
- // reset start point
2250
- indexStart = -1;
2251
- }
2252
- // get time column
2253
- if (firstChunk) {
2254
- if (!validateData(results.data)) {
2255
- return rejectAndAbort(reject, parser);
2256
- }
2257
- // initialize the header
2258
- header = results.data[0].slice(3);
2259
- // get column number
2260
- columnNum = results.data[0].length;
2261
- // get host name
2262
- host = results.data[1][0];
2263
- // get the first line time info from first line, it is a real number, do not need to do the convert with ">,<".
2264
- lastProcessedTime = getTimeFromTimeZone(parseFloat(results.data[1][2]), timezone);
2265
- // get the first line data info from first line, it is a real number, do not need to do the convert with ">,<".
2266
- lastProcessedData = results.data[1].slice(3).map(Number);
2267
- }
2268
- printProcessedTime(beginTime, 'step2');
2269
- if (!lastProcessedData) {
2270
- return rejectAndAbort(reject, parser);
2271
- }
2272
- // get time column
2273
- ({ indexStart, indexEnd, lastProcessedTime, isMDC } = FileService._getTimeColumn(results.data, firstChunk, startTime, endTime, lastProcessedTime, time, port, isMDC, timezone, maxRowsLimitation));
2274
- printProcessedTime(beginTime, 'step3');
2275
- if (indexStart == null && indexEnd == null && lastProcessedTime == null && isMDC == null) {
2276
- return rejectAndAbort(reject, parser);
2277
- }
2278
- // get all other data columns
2279
- FileService._getDataColumns(columnNum, results.data, firstChunk, time, indexStart, indexEnd, lastProcessedData, data, port, isMDC);
2280
- if (firstChunk) {
2281
- firstChunk = false;
2282
- }
2283
- printProcessedTime(beginTime, 'step4');
2284
- if (indexEnd >= 0) {
2285
- // do not need to process the left parts, manually trigger complete
2286
- const processedLines = Object.keys(time).reduce((total, curKey) => time[curKey] ? total + time[curKey].length : total, 0);
2287
- if (processedLines >= FileService._getMaxRowsLimitation(maxRowsLimitation)) {
2288
- abortType = Abort.maxLineNumReached;
2289
- }
2290
- else {
2291
- abortType = Abort.maxTimeRangeReached;
2292
- }
2293
- if (progress) {
2294
- progress(100);
2295
- }
2296
- parser.abort();
2297
- return;
2298
- }
2299
- else {
2300
- // the overall progress if this step is finished
2301
- if (progress) {
2302
- progress(Math.round(results.meta.cursor / file.size * 100));
2303
- }
2304
- // lastProcessedCursor = results.meta.cursor;
2305
- }
2306
- },
2307
- complete: () => {
2308
- printProcessedTime(beginTime, 'step_complete');
2309
- resolve({ header: header, host: host, time: time, data: data, aborted: abortType });
2310
- }
2311
- });
2312
- });
2313
- }
2314
- /**
2315
- * Get all ports from the name server history file
2316
- * @param file the name server history file
2317
- * @param progress call back for updating the progress
2318
- */
2319
- getPortsFromFile(file, progress) {
2320
- const beginTime = new Date();
2321
- let firstChunk = true;
2322
- const ports = [];
2323
- const defaultPort = getDefaultPort();
2324
- return new Promise((resolve, reject) => {
2325
- parse(file, {
2326
- chunk: (results, parser) => {
2327
- // get time column
2328
- if (firstChunk) {
2329
- if (!validateData(results.data)) {
2330
- if (progress) {
2331
- progress(100);
2332
- }
2333
- reject(`${file.name} is empty or the format is not correct.`);
2334
- parser.abort();
2335
- return;
2336
- }
2337
- }
2338
- printProcessedTime(beginTime, 'port.step1');
2339
- FileService._getPorts(results.data, firstChunk, ports);
2340
- if (firstChunk) {
2341
- firstChunk = false;
2342
- }
2343
- if (progress) {
2344
- progress(Math.round(results.meta.cursor / file.size * 100));
2345
- }
2346
- },
2347
- complete: () => {
2348
- // parsing done
2349
- printProcessedTime(beginTime, 'step_complete');
2350
- if (ports.length === 0) {
2351
- ports[0] = defaultPort;
2352
- }
2353
- resolve(ports);
2354
- }
2355
- });
2356
- });
2357
- }
2358
- }
2359
- FileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2360
- FileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FileService });
2361
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FileService, decorators: [{
2362
- type: Injectable
2363
- }] });
2364
-
2365
- /**
2366
- * This plugin is adapted from: https://github.com/3dcl/chartjs-plugin-responsive-downsample
2367
- * for controlling the radius of point.
2368
- *
2369
- * MIT License
2370
- * Copyright (c) 2018 3D Content Logistics
2371
- *
2372
- * Permission is hereby granted, free of charge, to any person obtaining a copy
2373
- * of this software and associated documentation files (the "Software"), to deal
2374
- * in the Software without restriction, including without limitation the rights
2375
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2376
- * copies of the Software, and to permit persons to whom the Software is
2377
- * furnished to do so, subject to the following conditions:
2378
- * The above copyright notice and this permission notice shall be included in all
2379
- * copies or substantial portions of the Software.
2380
- *
2381
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2382
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2383
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2384
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2385
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2386
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2387
- * SOFTWARE.
2388
- */
2389
- /**
2390
- * Check if a value is null or undefined
2391
- */
2392
- function isNil(value) {
2393
- return (typeof value === 'undefined') || value === null;
2394
- }
2395
- /**
2396
- * Clamp a number to a range
2397
- * @param value
2398
- * @param min
2399
- * @param max
2400
- */
2401
- function clamp(value, min, max) {
2402
- return Math.min(Math.max(value, min), max);
2403
- }
2404
- /**
2405
- * Recursively assign default values to an object if object is missing the keys.
2406
- * @param object The destination object to assign default values to
2407
- * @param defaults The default values for the object
2408
- * @return The destination object
2409
- */
2410
- function defaultsDeep(object, defaults) {
2411
- for (const key in defaults) {
2412
- if (defaults.hasOwnProperty(key)) {
2413
- const value = object[key];
2414
- if (typeof value === 'undefined') {
2415
- object[key] = defaults[key];
2416
- }
2417
- else if (value !== null && typeof value === 'object') {
2418
- object[key] = defaultsDeep(value, defaults[key]);
2419
- }
2420
- }
2421
- }
2422
- return object;
2423
- }
2424
- /**
2425
- * Finds the first element in an array for that the comaperator functions returns true
2426
- *
2427
- * @export
2428
- * @param array An array
2429
- * @param compareFunction Comperator function returning true for the element seeked
2430
- * @returns The found element or undefined
2431
- */
2432
- function findInArray(array, compareFunction) {
2433
- if (isNil(array)) {
2434
- return undefined;
2435
- }
2436
- for (let i = 0; i < array.length; i++) {
2437
- if (compareFunction(array[i]) === true) {
2438
- return array[i];
2439
- }
2440
- }
2441
- return undefined;
2442
- }
2443
- /**
2444
- * Finds the first index in an array for that the comaperator function for an element returns true
2445
- *
2446
- * @export
2447
- * @param array An array of elements
2448
- * @param compareFunction Comperator function returning true for the element seeked
2449
- * @returns Index of the matched element or -1 if no element was found
2450
- */
2451
- function findIndexInArray(array, compareFunction) {
2452
- if (isNil(array)) {
2453
- return undefined;
2454
- }
2455
- for (let i = 0; i < array.length; i++) {
2456
- if (compareFunction(array[i]) === true) {
2457
- return i;
2458
- }
2459
- }
2460
- return -1;
2461
- }
2462
- /**
2463
- * If points number is less than minNumPoints, show radius for all points.
2464
- */
2465
- function changePointRadius(chart, options) {
2466
- if (chart && chart.data && chart.data.datasets && options) {
2467
- let pointRadiusChangeFlag = false;
2468
- const maxNumPointsToDraw = options.maxNumPointsToDraw == null ? 100 : options.maxNumPointsToDraw;
2469
- for (const dataset of chart.data.datasets) {
2470
- if (dataset.data.length < maxNumPointsToDraw) {
2471
- pointRadiusChangeFlag = true;
2472
- break;
2473
- }
2474
- }
2475
- chart.options.elements.point.radius = pointRadiusChangeFlag ? 2 : 0;
2476
- }
2477
- }
2478
-
2479
- /**
2480
- * A mipmap data structure for line chart data. Uses averages to downsample data.
2481
- */
2482
- class DataMipmap {
2483
- /**
2484
- * Create a data mipmap
2485
- * @param data The orignal line chart data
2486
- * @param minNumPoints Minimal number of points on lowest mipmap level(limits number of levels)
2487
- */
2488
- constructor(data, minNumPoints = 2) {
2489
- this.minNumPoints = minNumPoints;
2490
- this.setData(data);
2491
- }
2492
- /**
2493
- * Set the line chart data and update mipmap level.
2494
- * @param data The orignal line chart data
2495
- */
2496
- setData(data) {
2497
- this.originalData = data || [];
2498
- this.mipMaps = [];
2499
- this.resolution = this.computeResolution(this.originalData);
2500
- this.createMipMap();
2501
- }
2502
- /**
2503
- * Set the minimal number of points
2504
- * @param minNumPoints Minimal number of points on lowest mipmap level(limits number of levels)
2505
- */
2506
- setMinNumPoints(minNumPoints) {
2507
- this.minNumPoints = minNumPoints;
2508
- this.mipMaps = [];
2509
- this.createMipMap();
2510
- }
2511
- /**
2512
- * Get the best fitting mipmap level for a certain scale resolution
2513
- * @param resolution Desired resolution in ms per pixel
2514
- */
2515
- getMipMapForResolution(resolution) {
2516
- return this.getMipMapLevel(this.getMipMapIndexForResolution(resolution));
2517
- }
2518
- /**
2519
- * Computes the index of the best fitting mipmap level for a certain scale resolution
2520
- * @param resolution Desired resolution in ms per pixel
2521
- */
2522
- getMipMapIndexForResolution(resolution) {
2523
- if (isNil(resolution)) {
2524
- return 0;
2525
- }
2526
- const factor = resolution / this.resolution;
2527
- return clamp(Math.floor(Math.log(factor) / Math.log(2.0)), 0, this.mipMaps.length - 1);
2528
- }
2529
- /**
2530
- * Get a mipmap level by index
2531
- * @param level The index of the mipmap level
2532
- */
2533
- getMipMapLevel(level) {
2534
- return this.mipMaps[level];
2535
- }
2536
- /**
2537
- * Get all mipmap level
2538
- */
2539
- getMipMaps() {
2540
- return this.mipMaps;
2541
- }
2542
- /**
2543
- * Get the number of available mipmap level
2544
- */
2545
- getNumLevel() {
2546
- return this.mipMaps.length;
2547
- }
2548
- computeResolution(data) {
2549
- let minTimeDistance = Infinity;
2550
- for (let i = 0, end = this.originalData.length - 1; i < end; ++i) {
2551
- const current = this.originalData[i];
2552
- const next = this.originalData[i + 1];
2553
- minTimeDistance = Math.min(Math.abs(this.getTime(current) - this.getTime(next)), minTimeDistance);
2554
- }
2555
- return minTimeDistance;
2556
- }
2557
- createMipMap() {
2558
- let targetResolution = this.resolution;
2559
- let targetLength = this.originalData.length;
2560
- this.mipMaps.push(this.originalData);
2561
- let lastMipMap = this.originalData;
2562
- while (lastMipMap.length > this.minNumPoints) {
2563
- targetResolution = targetResolution * 2;
2564
- targetLength = Math.floor(targetLength * 0.5);
2565
- lastMipMap = this.downsampleToResolution(lastMipMap, targetResolution, targetLength);
2566
- this.mipMaps.push(lastMipMap);
2567
- }
2568
- }
2569
- downsampleToResolution(data, targetResolution, targetLength) {
2570
- const output = [];
2571
- let aggregationValues = [];
2572
- let firstPoint = data[0];
2573
- aggregationValues.push(firstPoint);
2574
- for (let i = 1, end = data.length; i < end; ++i) {
2575
- const currentPoint = data[i];
2576
- const timeDistance = Math.abs(this.getTime(firstPoint) - this.getTime(currentPoint));
2577
- if (timeDistance < targetResolution) {
2578
- aggregationValues.push(currentPoint);
2579
- }
2580
- else {
2581
- // create new sensor value in output
2582
- const newPoint = this.getAverage(aggregationValues);
2583
- output.push(newPoint);
2584
- // reset aggregation data structure
2585
- firstPoint = currentPoint;
2586
- aggregationValues = [currentPoint];
2587
- }
2588
- }
2589
- // insert last point
2590
- output.push(this.getAverage(aggregationValues));
2591
- return output;
2592
- }
2593
- getAverage(aggregationValues) {
2594
- const value = aggregationValues
2595
- .map(point => point.y)
2596
- .reduce((previous, current) => previous + current)
2597
- / aggregationValues.length;
2598
- return {
2599
- x: aggregationValues[0].x || aggregationValues[0].t,
2600
- y: value
2601
- };
2602
- }
2603
- getTime(point) {
2604
- const x = point.x || point.t;
2605
- if (typeof x === 'number') {
2606
- return x;
2607
- }
2608
- else if (typeof x === 'string') {
2609
- return new Date(x).getTime();
2610
- }
2611
- else {
2612
- return x.getTime();
2613
- }
2614
- }
2615
- }
2616
-
2617
- /**
2618
- * A mipmap data structure that uses Largest-Triangle-Three-Buckets algorithm to downsample data
2619
- */
2620
- class LTTBDataMipmap extends DataMipmap {
2621
- getMipMapIndexForResolution(resolution) {
2622
- if (isNil(resolution)) {
2623
- return 0;
2624
- }
2625
- let index = findIndexInArray(this.resolutions, (levelResolution) => levelResolution >= resolution);
2626
- if (index === -1) {
2627
- // use smallest mipmap as fallback
2628
- index = this.resolutions.length - 1;
2629
- }
2630
- return index;
2631
- }
2632
- createMipMap() {
2633
- super.createMipMap();
2634
- this.resolutions = this.mipMaps.map((level) => this.computeAverageResolution(level));
2635
- }
2636
- /**
2637
- * This method is adapted from: https://github.com/sveinn-steinarsson/flot-downsample
2638
- *
2639
- * The MIT License
2640
- * Copyright (c) 2013 by Sveinn Steinarsson
2641
- * Permission is hereby granted, free of charge, to any person obtaining a copy
2642
- * of this software and associated documentation files (the "Software"), to deal
2643
- * in the Software without restriction, including without limitation the rights
2644
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2645
- * copies of the Software, and to permit persons to whom the Software is
2646
- * furnished to do so, subject to the following conditions:
2647
- * The above copyright notice and this permission notice shall be included in
2648
- * all copies or substantial portions of the Software.
2649
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2650
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2651
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2652
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2653
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2654
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2655
- * THE SOFTWARE.
2656
- */
2657
- downsampleToResolution(data, targetResolution, targetLength) {
2658
- const dataLength = data.length;
2659
- if (targetLength >= dataLength || targetLength === 0) {
2660
- return data; // data has target size
2661
- }
2662
- const output = [];
2663
- // bucket size, leave room for start and end data points
2664
- const bucksetSize = (dataLength - 2) / (targetLength - 2);
2665
- let a = 0; // initially a is the first point in the triangle
2666
- let maxAreaPoint;
2667
- let maxArea;
2668
- let area;
2669
- let nextA;
2670
- // always add the first point
2671
- output.push(data[a]);
2672
- for (let i = 0; i < targetLength - 2; ++i) {
2673
- // Calculate point average for next bucket (containing c)
2674
- let avgX = 0;
2675
- let avgY = 0;
2676
- let avgRangeStart = Math.floor((i + 1) * bucksetSize) + 1;
2677
- let avgRangeEnd = Math.floor((i + 2) * bucksetSize) + 1;
2678
- avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
2679
- const avgRangeLength = avgRangeEnd - avgRangeStart;
2680
- for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
2681
- avgX += this.getTime(data[avgRangeStart]);
2682
- avgY += data[avgRangeStart].y * 1;
2683
- }
2684
- avgX /= avgRangeLength;
2685
- avgY /= avgRangeLength;
2686
- // Get the range for this bucket
2687
- let rangeOffs = Math.floor((i + 0) * bucksetSize) + 1;
2688
- const rangeTo = Math.floor((i + 1) * bucksetSize) + 1;
2689
- // Point a
2690
- const pointA = data[a];
2691
- const pointAX = this.getTime(pointA);
2692
- const pointAY = pointA.y * 1;
2693
- maxArea = area = -1;
2694
- for (; rangeOffs < rangeTo; rangeOffs++) {
2695
- // Calculate triangle area over three buckets
2696
- area = Math.abs((pointAX - avgX) * (data[rangeOffs].y - pointAY) -
2697
- (pointAX - this.getTime(data[rangeOffs])) * (avgY - pointAY)) * 0.5;
2698
- if (area > maxArea) {
2699
- maxArea = area;
2700
- maxAreaPoint = data[rangeOffs];
2701
- nextA = rangeOffs; // Next a is this b
2702
- }
2703
- }
2704
- output.push(maxAreaPoint); // Pick this point from the bucket
2705
- a = nextA; // This a is the next a (chosen b)
2706
- }
2707
- output.push(data[dataLength - 1]); // Always add last
2708
- return output;
2709
- }
2710
- computeAverageResolution(data) {
2711
- let timeDistances = 0;
2712
- for (let i = 0, end = this.originalData.length - 1; i < end; ++i) {
2713
- const current = this.originalData[i];
2714
- const next = this.originalData[i + 1];
2715
- timeDistances += Math.abs(this.getTime(current) - this.getTime(next));
2716
- }
2717
- return timeDistances / (data.length - 1);
2718
- }
2719
- }
2720
-
2721
- function getCompareValue(value) {
2722
- if (typeof value === 'number') {
2723
- return value;
2724
- }
2725
- else if (typeof value === 'string') {
2726
- return (new Date(value)).getTime();
2727
- }
2728
- else if (value instanceof Date) {
2729
- return value.getTime();
2730
- }
2731
- else {
2732
- return moment$1(value).toDate().getTime();
2733
- }
2734
- }
2735
- function rangeIsEqual(previousValue, currentValue) {
2736
- if (isNil(previousValue) ||
2737
- isNil(currentValue) ||
2738
- isNil(previousValue[0]) ||
2739
- isNil(previousValue[1]) ||
2740
- isNil(currentValue[0]) ||
2741
- isNil(currentValue[1])) {
2742
- return false;
2743
- }
2744
- previousValue = [getCompareValue(previousValue[0]), getCompareValue(previousValue[1])];
2745
- currentValue = [getCompareValue(currentValue[0]), getCompareValue(currentValue[1])];
2746
- return previousValue[0] === currentValue[0] && previousValue[1] === currentValue[1];
2747
- }
2748
- function getScaleRange(scale) {
2749
- if (isNil(scale)) {
2750
- return [null, null];
2751
- }
2752
- const start = scale.getValueForPixel(scale.left);
2753
- const end = scale.getValueForPixel(scale.right);
2754
- return [start, end];
2755
- }
2756
- function cullData(data, range) {
2757
- const startValue = getCompareValue(range[0]);
2758
- const endValue = getCompareValue(range[1]);
2759
- let startIndex = 0;
2760
- let endIndex = data.length;
2761
- for (let i = 1; i < data.length; ++i) {
2762
- const point = data[i];
2763
- const compareValue = getCompareValue(point.x || point.t);
2764
- if (compareValue <= startValue) {
2765
- startIndex = i;
2766
- }
2767
- if (compareValue >= endValue) {
2768
- endIndex = i + 1;
2769
- break;
2770
- }
2771
- }
2772
- return data.slice(startIndex, endIndex);
2773
- }
2774
-
2775
- /**
2776
- * This plugin is adapted from: https://github.com/3dcl/chartjs-plugin-responsive-downsample
2777
- * for controlling the radius of point.
2778
- *
2779
- * MIT License
2780
- * Copyright (c) 2018 3D Content Logistics
2781
- *
2782
- * Permission is hereby granted, free of charge, to any person obtaining a copy
2783
- * of this software and associated documentation files (the "Software"), to deal
2784
- * in the Software without restriction, including without limitation the rights
2785
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2786
- * copies of the Software, and to permit persons to whom the Software is
2787
- * furnished to do so, subject to the following conditions:
2788
- * The above copyright notice and this permission notice shall be included in all
2789
- * copies or substantial portions of the Software.
2790
- *
2791
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2792
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2793
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2794
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2795
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2796
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2797
- * SOFTWARE.
2798
- */
2799
- // Using dynamic flag to fix the issue of ng-packagr #696: Lambda not supported
2800
- // @dynamic
2801
- /**
2802
- * Chart js Plugin for downsampling data
2803
- */
2804
- class ResponsiveDownsamplePlugin {
2805
- static getPluginOptions(chart) {
2806
- const options = chart.options.responsiveDownsample || {};
2807
- defaultsDeep(options, {
2808
- enabled: false,
2809
- aggregationAlgorithm: 'LTTB',
2810
- desiredDataPointDistance: 1,
2811
- minNumPoints: 100,
2812
- maxNumPointsToDraw: 100,
2813
- cullData: true
2814
- });
2815
- if (options.enabled) {
2816
- chart.options.responsiveDownsample = options;
2817
- }
2818
- return options;
2819
- }
2820
- static hasDataChanged(chart) {
2821
- return !isNil(findInArray(chart.data.datasets, (dataset) => {
2822
- return isNil(dataset.mipMap);
2823
- }));
2824
- }
2825
- static createDataMipMap(chart, options) {
2826
- chart.data.datasets.forEach((dataset) => {
2827
- // @ts-ignore
2828
- const data = !isNil(dataset.originalData) ? dataset.originalData : dataset.data;
2829
- const mipMap = (options.aggregationAlgorithm === 'LTTB')
2830
- ? new LTTBDataMipmap(data, options.minNumPoints)
2831
- : new DataMipmap(data, options.minNumPoints);
2832
- dataset.originalData = data;
2833
- dataset.mipMap = mipMap;
2834
- // @ts-ignore
2835
- dataset.data = mipMap.getMipMapLevel(mipMap.getNumLevel() - 1); // set last level for first render pass
2836
- });
2837
- }
2838
- static restoreOriginalData(chart) {
2839
- let updated = false;
2840
- chart.data.datasets.forEach((dataset) => {
2841
- // @ts-ignore
2842
- if (!isNil(dataset.originalData) && dataset.data !== dataset.originalData) {
2843
- // @ts-ignore
2844
- dataset.data = dataset.originalData;
2845
- updated = true;
2846
- }
2847
- });
2848
- return updated;
2849
- }
2850
- static getTargetResolution(chart, options) {
2851
- const xScale = chart.scales['x-axis-0'];
2852
- if (isNil(xScale)) {
2853
- return null;
2854
- }
2855
- const start = moment$1(xScale.getValueForPixel(xScale.left));
2856
- const end = moment$1(xScale.getValueForPixel(xScale.left + 1));
2857
- const targetResolution = end.diff(start);
2858
- return targetResolution * options.desiredDataPointDistance;
2859
- }
2860
- static updateMipMap(chart, options, rangeChanged) {
2861
- let updated = false;
2862
- chart.data.datasets.forEach((dataset) => {
2863
- const mipMap = dataset.mipMap;
2864
- if (isNil(mipMap)) {
2865
- return;
2866
- }
2867
- const mipMalLevel = mipMap.getMipMapIndexForResolution(options.targetResolution);
2868
- if (mipMalLevel === dataset.currentMipMapLevel && !rangeChanged) {
2869
- // skip update if mip map level and data range did not change
2870
- return;
2871
- }
2872
- updated = true;
2873
- dataset.currentMipMapLevel = mipMalLevel;
2874
- let newData = mipMap.getMipMapLevel(mipMalLevel);
2875
- if (options.cullData) {
2876
- newData = cullData(newData, options.scaleRange);
2877
- }
2878
- // @ts-ignore
2879
- dataset.data = newData;
2880
- });
2881
- return updated;
2882
- }
2883
- beforeInit(chart) {
2884
- const options = ResponsiveDownsamplePlugin.getPluginOptions(chart);
2885
- if (!options.enabled) {
2886
- return;
2887
- }
2888
- ResponsiveDownsamplePlugin.createDataMipMap(chart, options);
2889
- options.needsUpdate = true;
2890
- }
2891
- beforeDatasetsUpdate(chart) {
2892
- const options = ResponsiveDownsamplePlugin.getPluginOptions(chart);
2893
- if (!options.enabled) {
2894
- // restore original data and remove state from options
2895
- options.needsUpdate = ResponsiveDownsamplePlugin.restoreOriginalData(chart);
2896
- delete options.targetResolution;
2897
- delete options.scaleRange;
2898
- return;
2899
- }
2900
- // only update mip map if data set was reloaded externally
2901
- if (ResponsiveDownsamplePlugin.hasDataChanged(chart)) {
2902
- ResponsiveDownsamplePlugin.createDataMipMap(chart, options);
2903
- options.needsUpdate = true;
2904
- }
2905
- }
2906
- beforeRender(chart) {
2907
- const options = ResponsiveDownsamplePlugin.getPluginOptions(chart);
2908
- if (!options.enabled) {
2909
- // update chart if data was restored from original data
2910
- if (options.needsUpdate) {
2911
- options.needsUpdate = false;
2912
- chart.update(0);
2913
- return false;
2914
- }
2915
- return;
2916
- }
2917
- const targetResolution = ResponsiveDownsamplePlugin.getTargetResolution(chart, options);
2918
- const xScale = chart.scales['x-axis-0'];
2919
- const scaleRange = getScaleRange(xScale);
2920
- const rangeChanged = !rangeIsEqual(options.scaleRange, scaleRange);
2921
- if (options.needsUpdate ||
2922
- options.targetResolution !== targetResolution ||
2923
- rangeChanged) {
2924
- options.targetResolution = targetResolution;
2925
- options.scaleRange = scaleRange;
2926
- options.needsUpdate = false;
2927
- if (ResponsiveDownsamplePlugin.updateMipMap(chart, options, rangeChanged)) {
2928
- changePointRadius(chart, options);
2929
- // update chart and cancel current render
2930
- chart.update(0);
2931
- return false;
2932
- }
2933
- }
2934
- }
2935
- }
2936
-
2937
- /**
2938
- * This plugin is adapted from: https://github.com/3dcl/chartjs-plugin-responsive-downsample
2939
- * for controlling the radius of point.
2940
- *
2941
- * MIT License
2942
- * Copyright (c) 2018 3D Content Logistics
2943
- *
2944
- * Permission is hereby granted, free of charge, to any person obtaining a copy
2945
- * of this software and associated documentation files (the "Software"), to deal
2946
- * in the Software without restriction, including without limitation the rights
2947
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2948
- * copies of the Software, and to permit persons to whom the Software is
2949
- * furnished to do so, subject to the following conditions:
2950
- * The above copyright notice and this permission notice shall be included in all
2951
- * copies or substantial portions of the Software.
2952
- *
2953
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2954
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2955
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2956
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2957
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2958
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2959
- * SOFTWARE.
2960
- */
2961
- const Chart$1 = window && window.Chart ? window.Chart : chartjs.Chart;
2962
- // comment this because this plugin is only used internally, merge ChartOptions interface is unnecessary
2963
- // and causes build error: "error TS2665: Invalid module name in augmentation.".
2964
- // // Extend chart.js options interface
2965
- // declare module 'chart.js' {
2966
- // interface ChartOptions {
2967
- // /**
2968
- // * Options for responsive downsample plugin
2969
- // */
2970
- // responsiveDownsample?: ResponsiveDownsamplePluginOptions;
2971
- // }
2972
- // }
2973
- Chart$1.pluginService.register(new ResponsiveDownsamplePlugin());
2974
-
2975
- /**
2976
- * this plugin is adapted from: https://github.com/chartjs/chartjs-plugin-zoom
2977
- * for following two open issues:
2978
- * https://github.com/chartjs/chartjs-plugin-zoom/pull/155
2979
- * https://github.com/chartjs/chartjs-plugin-zoom/pull/150
2980
- *
2981
- * The MIT License (MIT) Copyright (c) 2013-2016 Nick Downie
2982
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this
2983
- * software and associated documentation files (the "Software"), to deal in the Software
2984
- * without restriction, including without limitation the rights to use, copy, modify, merge,
2985
- * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
2986
- * to whom the Software is furnished to do so, subject to the following conditions:
2987
- *
2988
- * The above copyright notice and this permission notice shall be included in all copies or
2989
- * substantial portions of the Software.
2990
- *
2991
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
2992
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
2993
- * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
2994
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2995
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2996
- * THE SOFTWARE.
2997
- */
2998
- const Hammer = window && window.Hammer ? window.Hammer : hammerjs.Hammer;
2999
- const Chart = window && window.Chart ? window.Chart : chartjs.Chart;
3000
- const helpers = Chart.helpers;
3001
- // Take the zoom namespace of Chart
3002
- const zoomNS = Chart.Zoom = Chart.Zoom || {};
3003
- // Where we store functions to handle different scale types
3004
- const zoomFunctions = zoomNS.zoomFunctions = zoomNS.zoomFunctions || {};
3005
- const panFunctions = zoomNS.panFunctions = zoomNS.panFunctions || {};
3006
- // Default options if none are provided
3007
- const defaultOptions = zoomNS.defaults = {
3008
- pan: {
3009
- enabled: true,
3010
- mode: 'xy',
3011
- speed: 20,
3012
- threshold: 10
3013
- },
3014
- zoom: {
3015
- enabled: true,
3016
- mode: 'xy',
3017
- sensitivity: 3
3018
- }
3019
- };
3020
- function directionEnabled(mode, dir) {
3021
- if (mode === undefined) {
3022
- return true;
3023
- }
3024
- else if (typeof mode === 'string') {
3025
- return mode.indexOf(dir) !== -1;
3026
- }
3027
- return false;
3028
- }
3029
- function rangeMaxLimiter(zoomPanOptions, newMax) {
3030
- if (zoomPanOptions.scaleAxes && zoomPanOptions.rangeMax &&
3031
- !helpers.isNullOrUndef(zoomPanOptions.rangeMax[zoomPanOptions.scaleAxes])) {
3032
- const rangeMax = zoomPanOptions.rangeMax[zoomPanOptions.scaleAxes];
3033
- if (newMax > rangeMax) {
3034
- newMax = rangeMax;
3035
- }
3036
- }
3037
- return newMax;
3038
- }
3039
- function rangeMinLimiter(zoomPanOptions, newMin) {
3040
- if (zoomPanOptions.scaleAxes && zoomPanOptions.rangeMin &&
3041
- !helpers.isNullOrUndef(zoomPanOptions.rangeMin[zoomPanOptions.scaleAxes])) {
3042
- const rangeMin = zoomPanOptions.rangeMin[zoomPanOptions.scaleAxes];
3043
- if (newMin < rangeMin) {
3044
- newMin = rangeMin;
3045
- }
3046
- }
3047
- return newMin;
3048
- }
3049
- function zoomIndexScale(scale, zoom, center, zoomOptions) {
3050
- const labels = scale.chart.data.labels;
3051
- let minIndex = scale.minIndex;
3052
- const lastLabelIndex = labels.length - 1;
3053
- let maxIndex = scale.maxIndex;
3054
- const sensitivity = zoomOptions.sensitivity;
3055
- const chartCenter = scale.isHorizontal() ? scale.left + (scale.width / 2) : scale.top + (scale.height / 2);
3056
- const centerPointer = scale.isHorizontal() ? center.x : center.y;
3057
- zoomNS.zoomCumulativeDelta = zoom > 1 ? zoomNS.zoomCumulativeDelta + 1 : zoomNS.zoomCumulativeDelta - 1;
3058
- if (Math.abs(zoomNS.zoomCumulativeDelta) > sensitivity) {
3059
- if (zoomNS.zoomCumulativeDelta < 0) {
3060
- if (centerPointer >= chartCenter) {
3061
- if (minIndex <= 0) {
3062
- maxIndex = Math.min(lastLabelIndex, maxIndex + 1);
3063
- }
3064
- else {
3065
- minIndex = Math.max(0, minIndex - 1);
3066
- }
3067
- }
3068
- else if (centerPointer < chartCenter) {
3069
- if (maxIndex >= lastLabelIndex) {
3070
- minIndex = Math.max(0, minIndex - 1);
3071
- }
3072
- else {
3073
- maxIndex = Math.min(lastLabelIndex, maxIndex + 1);
3074
- }
3075
- }
3076
- zoomNS.zoomCumulativeDelta = 0;
3077
- }
3078
- else if (zoomNS.zoomCumulativeDelta > 0) {
3079
- if (centerPointer >= chartCenter) {
3080
- minIndex = minIndex < maxIndex ? minIndex = Math.min(maxIndex, minIndex + 1) : minIndex;
3081
- }
3082
- else if (centerPointer < chartCenter) {
3083
- maxIndex = maxIndex > minIndex ? maxIndex = Math.max(minIndex, maxIndex - 1) : maxIndex;
3084
- }
3085
- zoomNS.zoomCumulativeDelta = 0;
3086
- }
3087
- scale.options.ticks.min = rangeMinLimiter(zoomOptions, labels[minIndex]);
3088
- scale.options.ticks.max = rangeMaxLimiter(zoomOptions, labels[maxIndex]);
3089
- }
3090
- }
3091
- function zoomTimeScale(scale, zoom, center, zoomOptions) {
3092
- const options = scale.options;
3093
- // var range;
3094
- // var min_percent;
3095
- // if (scale.isHorizontal()) {
3096
- // range = scale.right - scale.left;
3097
- // min_percent = (center.x - scale.left) / range;
3098
- // } else {
3099
- // range = scale.bottom - scale.top;
3100
- // min_percent = (center.y - scale.top) / range;
3101
- // }
3102
- //
3103
- // var max_percent = 1 - min_percent;
3104
- const range = scale.max - scale.min;
3105
- const newDiff = range * (zoom - 1);
3106
- const cursorPixel = scale.isHorizontal() ? center.x : center.y;
3107
- const min_percent = (scale.getValueForPixel(cursorPixel) - scale.min) / range;
3108
- const max_percent = 1 - min_percent;
3109
- const minDelta = newDiff * min_percent;
3110
- const maxDelta = newDiff * max_percent;
3111
- const newMin = scale.min + minDelta;
3112
- const newMax = scale.max - maxDelta;
3113
- const diffMinMax = newMax - newMin;
3114
- const minLimitExceeded = rangeMinLimiter(zoomOptions, diffMinMax) !== diffMinMax;
3115
- const maxLimitExceeded = rangeMaxLimiter(zoomOptions, diffMinMax) !== diffMinMax;
3116
- if (!minLimitExceeded && !maxLimitExceeded) {
3117
- options.time.min = newMin;
3118
- options.time.max = newMax;
3119
- }
3120
- }
3121
- function zoomNumericalScale(scale, zoom, center, zoomOptions) {
3122
- const range = scale.max - scale.min;
3123
- const newDiff = range * (zoom - 1);
3124
- const cursorPixel = scale.isHorizontal() ? center.x : center.y;
3125
- const min_percent = (scale.getValueForPixel(cursorPixel) - scale.min) / range;
3126
- const max_percent = 1 - min_percent;
3127
- const minDelta = newDiff * min_percent;
3128
- const maxDelta = newDiff * max_percent;
3129
- scale.options.ticks.min = rangeMinLimiter(zoomOptions, scale.min + minDelta);
3130
- scale.options.ticks.max = rangeMaxLimiter(zoomOptions, scale.max - maxDelta);
3131
- }
3132
- function zoomScale(scale, zoom, center, zoomOptions) {
3133
- const fn = zoomFunctions[scale.options.type];
3134
- if (fn) {
3135
- fn(scale, zoom, center, zoomOptions);
3136
- }
3137
- }
3138
- function doZoom(chartInstance, zoom, center, whichAxes) {
3139
- const ca = chartInstance.chartArea;
3140
- if (!center) {
3141
- center = {
3142
- x: (ca.left + ca.right) / 2,
3143
- y: (ca.top + ca.bottom) / 2,
3144
- };
3145
- }
3146
- const zoomOptions = chartInstance.options.zoom;
3147
- if (zoomOptions && helpers.getValueOrDefault(zoomOptions.enabled, defaultOptions.zoom.enabled)) {
3148
- // Do the zoom here
3149
- const zoomMode = helpers.getValueOrDefault(chartInstance.options.zoom.mode, defaultOptions.zoom.mode);
3150
- zoomOptions.sensitivity = helpers.getValueOrDefault(chartInstance.options.zoom.sensitivity, defaultOptions.zoom.sensitivity);
3151
- // Which axe should be modified when figers were used.
3152
- let _whichAxes;
3153
- if (zoomMode === 'xy' && whichAxes !== undefined) {
3154
- // based on fingers positions
3155
- _whichAxes = whichAxes;
3156
- }
3157
- else {
3158
- // no effect
3159
- _whichAxes = 'xy';
3160
- }
3161
- helpers.each(chartInstance.scales, function (scale, id) {
3162
- if (scale.isHorizontal() && directionEnabled(zoomMode, 'x') && directionEnabled(_whichAxes, 'x')) {
3163
- zoomOptions.scaleAxes = 'x';
3164
- zoomScale(scale, zoom, center, zoomOptions);
3165
- }
3166
- else if (!scale.isHorizontal() && directionEnabled(zoomMode, 'y') && directionEnabled(_whichAxes, 'y')) {
3167
- // Do Y zoom
3168
- zoomOptions.scaleAxes = 'y';
3169
- zoomScale(scale, zoom, center, zoomOptions);
3170
- }
3171
- });
3172
- chartInstance.update(0);
3173
- if (typeof zoomOptions.onZoom === 'function') {
3174
- zoomOptions.onZoom();
3175
- }
3176
- }
3177
- }
3178
- function panIndexScale(scale, delta, panOptions) {
3179
- const labels = scale.chart.data.labels;
3180
- const lastLabelIndex = labels.length - 1;
3181
- const offsetAmt = Math.max((scale.ticks.length - ((scale.options.gridLines.offsetGridLines) ? 0 : 1)), 1);
3182
- const panSpeed = panOptions.speed;
3183
- let minIndex = scale.minIndex;
3184
- const step = Math.round(scale.width / (offsetAmt * panSpeed));
3185
- let maxIndex;
3186
- zoomNS.panCumulativeDelta += delta;
3187
- minIndex = zoomNS.panCumulativeDelta > step ? Math.max(0, minIndex - 1) : zoomNS.panCumulativeDelta < -step ? Math.min(lastLabelIndex - offsetAmt + 1, minIndex + 1) : minIndex;
3188
- zoomNS.panCumulativeDelta = minIndex !== scale.minIndex ? 0 : zoomNS.panCumulativeDelta;
3189
- maxIndex = Math.min(lastLabelIndex, minIndex + offsetAmt - 1);
3190
- scale.options.ticks.min = rangeMinLimiter(panOptions, labels[minIndex]);
3191
- scale.options.ticks.max = rangeMaxLimiter(panOptions, labels[maxIndex]);
3192
- }
3193
- function panTimeScale(scale, delta, panOptions) {
3194
- const options = scale.options;
3195
- const limitedMax = rangeMaxLimiter(panOptions, scale.getValueForPixel(scale.getPixelForValue(scale.max) - delta));
3196
- const limitedMin = rangeMinLimiter(panOptions, scale.getValueForPixel(scale.getPixelForValue(scale.min) - delta));
3197
- const limitedTimeDelta = delta < 0 ? limitedMax - scale.max : limitedMin - scale.min;
3198
- options.time.max = scale.max + limitedTimeDelta;
3199
- options.time.min = scale.min + limitedTimeDelta;
3200
- }
3201
- function panNumericalScale(scale, delta, panOptions) {
3202
- const tickOpts = scale.options.ticks;
3203
- const start = scale.start, end = scale.end;
3204
- if (tickOpts.reverse) {
3205
- tickOpts.max = scale.getValueForPixel(scale.getPixelForValue(start) - delta);
3206
- tickOpts.min = scale.getValueForPixel(scale.getPixelForValue(end) - delta);
3207
- }
3208
- else {
3209
- tickOpts.min = scale.getValueForPixel(scale.getPixelForValue(start) - delta);
3210
- tickOpts.max = scale.getValueForPixel(scale.getPixelForValue(end) - delta);
3211
- }
3212
- tickOpts.min = rangeMinLimiter(panOptions, tickOpts.min);
3213
- tickOpts.max = rangeMaxLimiter(panOptions, tickOpts.max);
3214
- }
3215
- function panScale(scale, delta, panOptions) {
3216
- const fn = panFunctions[scale.options.type];
3217
- if (fn) {
3218
- fn(scale, delta, panOptions);
3219
- }
3220
- }
3221
- function doPan(chartInstance, deltaX, deltaY) {
3222
- const panOptions = chartInstance.options.pan;
3223
- if (panOptions && helpers.getValueOrDefault(panOptions.enabled, defaultOptions.pan.enabled)) {
3224
- const panMode = helpers.getValueOrDefault(chartInstance.options.pan.mode, defaultOptions.pan.mode);
3225
- panOptions.speed = helpers.getValueOrDefault(chartInstance.options.pan.speed, defaultOptions.pan.speed);
3226
- helpers.each(chartInstance.scales, function (scale, id) {
3227
- if (scale.isHorizontal() && directionEnabled(panMode, 'x') && deltaX !== 0) {
3228
- panOptions.scaleAxes = 'x';
3229
- panScale(scale, deltaX, panOptions);
3230
- }
3231
- else if (!scale.isHorizontal() && directionEnabled(panMode, 'y') && deltaY !== 0) {
3232
- panOptions.scaleAxes = 'y';
3233
- panScale(scale, deltaY, panOptions);
3234
- }
3235
- });
3236
- chartInstance.update(0);
3237
- if (typeof panOptions.onPan === 'function') {
3238
- panOptions.onPan();
3239
- }
3240
- }
3241
- }
3242
- function positionInChartArea(chartInstance, position) {
3243
- return (position.x >= chartInstance.chartArea.left && position.x <= chartInstance.chartArea.right) &&
3244
- (position.y >= chartInstance.chartArea.top && position.y <= chartInstance.chartArea.bottom);
3245
- }
3246
- function getYAxis(chartInstance) {
3247
- const scales = chartInstance.scales;
3248
- for (const scaleId in scales) {
3249
- if (scales.hasOwnProperty(scaleId)) {
3250
- const scale = scales[scaleId];
3251
- if (!scale.isHorizontal()) {
3252
- return scale;
3253
- }
3254
- }
3255
- }
3256
- }
3257
- // Store these for later
3258
- zoomNS.zoomFunctions.category = zoomIndexScale;
3259
- zoomNS.zoomFunctions.time = zoomTimeScale;
3260
- zoomNS.zoomFunctions.linear = zoomNumericalScale;
3261
- zoomNS.zoomFunctions.logarithmic = zoomNumericalScale;
3262
- zoomNS.panFunctions.category = panIndexScale;
3263
- zoomNS.panFunctions.time = panTimeScale;
3264
- zoomNS.panFunctions.linear = panNumericalScale;
3265
- zoomNS.panFunctions.logarithmic = panNumericalScale;
3266
- // Globals for catergory pan and zoom
3267
- zoomNS.panCumulativeDelta = 0;
3268
- zoomNS.zoomCumulativeDelta = 0;
3269
- // Chartjs Zoom Plugin
3270
- const zoomPlugin = {
3271
- afterInit: function (chartInstance) {
3272
- helpers.each(chartInstance.scales, function (scale) {
3273
- scale.originalOptions = helpers.clone(scale.options);
3274
- });
3275
- chartInstance.resetZoom = function () {
3276
- helpers.each(chartInstance.scales, function (scale, id) {
3277
- const timeOptions = scale.options.time;
3278
- const tickOptions = scale.options.ticks;
3279
- if (timeOptions) {
3280
- timeOptions.min = scale.originalOptions.time.min;
3281
- timeOptions.max = scale.originalOptions.time.max;
3282
- }
3283
- if (tickOptions) {
3284
- tickOptions.min = scale.originalOptions.ticks.min;
3285
- tickOptions.max = scale.originalOptions.ticks.max;
3286
- }
3287
- });
3288
- helpers.each(chartInstance.data.datasets, function (dataset, id) {
3289
- dataset._meta = null;
3290
- });
3291
- chartInstance.update();
3292
- };
3293
- },
3294
- beforeInit: function (chartInstance) {
3295
- chartInstance.zoom = {};
3296
- const node = chartInstance.zoom.node = chartInstance.chart.ctx.canvas;
3297
- const options = chartInstance.options;
3298
- const panThreshold = helpers.getValueOrDefault(options.pan ? options.pan.threshold : undefined, zoomNS.defaults.pan.threshold);
3299
- if (!options.zoom || !options.zoom.enabled) {
3300
- return;
3301
- }
3302
- if (options.zoom.drag) {
3303
- // Only want to zoom horizontal axis
3304
- options.zoom.mode = 'x';
3305
- chartInstance.zoom._mouseDownHandler = function (event) {
3306
- chartInstance.zoom._dragZoomStart = event;
3307
- };
3308
- node.addEventListener('mousedown', chartInstance.zoom._mouseDownHandler);
3309
- chartInstance.zoom._mouseMoveHandler = function (event) {
3310
- if (chartInstance.zoom._dragZoomStart) {
3311
- chartInstance.zoom._dragZoomEnd = event;
3312
- chartInstance.update(0);
3313
- }
3314
- };
3315
- node.addEventListener('mousemove', chartInstance.zoom._mouseMoveHandler);
3316
- chartInstance.zoom._mouseUpHandler = function (event) {
3317
- if (chartInstance.zoom._dragZoomStart) {
3318
- const chartArea = chartInstance.chartArea;
3319
- const yAxis = getYAxis(chartInstance);
3320
- const beginPoint = chartInstance.zoom._dragZoomStart;
3321
- const offsetX = beginPoint.target.getBoundingClientRect().left;
3322
- const startX = Math.max(Math.min(beginPoint.clientX, event.clientX) - offsetX, chartArea.left);
3323
- const endX = Math.min(Math.max(beginPoint.clientX, event.clientX) - offsetX, chartArea.right);
3324
- const dragDistance = endX - startX;
3325
- const chartDistance = chartArea.right - chartArea.left;
3326
- const zoom = 1 + (chartDistance - dragDistance) / chartDistance;
3327
- const centerX = chartArea.left + (startX - chartArea.left) / (zoom - 1);
3328
- // Remove drag start and end before chart update to stop drawing selected area
3329
- chartInstance.zoom._dragZoomStart = null;
3330
- chartInstance.zoom._dragZoomEnd = null;
3331
- if (dragDistance > 0) {
3332
- doZoom(chartInstance, zoom, {
3333
- x: centerX,
3334
- y: (yAxis.bottom - yAxis.top) / 2,
3335
- });
3336
- }
3337
- }
3338
- };
3339
- // node.addEventListener('mouseup', chartInstance.zoom._mouseUpHandler);
3340
- node.ownerDocument.addEventListener('mouseup', chartInstance.zoom._mouseUpHandler);
3341
- }
3342
- else {
3343
- chartInstance.zoom._wheelHandler = function (event) {
3344
- const rect = event.target.getBoundingClientRect();
3345
- const offsetX = event.clientX - rect.left;
3346
- const offsetY = event.clientY - rect.top;
3347
- const center = {
3348
- x: offsetX,
3349
- y: offsetY
3350
- };
3351
- if (event.deltaY < 0) {
3352
- doZoom(chartInstance, 1.1, center);
3353
- }
3354
- else {
3355
- doZoom(chartInstance, 0.909, center);
3356
- }
3357
- // Prevent the event from triggering the default behavior (eg. Content scrolling).
3358
- event.preventDefault();
3359
- };
3360
- node.addEventListener('wheel', chartInstance.zoom._wheelHandler);
3361
- }
3362
- if (Hammer) {
3363
- const mc = new Hammer.Manager(node);
3364
- mc.add(new Hammer.Pinch());
3365
- mc.add(new Hammer.Pan({
3366
- threshold: panThreshold
3367
- }));
3368
- // Hammer reports the total scaling. We need the incremental amount
3369
- let currentPinchScaling;
3370
- const handlePinch = function (e) {
3371
- const diff = 1 / (currentPinchScaling) * e.scale;
3372
- const rect = e.target.getBoundingClientRect();
3373
- const offsetX = e.center.x - rect.left;
3374
- const offsetY = e.center.y - rect.top;
3375
- const center = {
3376
- x: offsetX,
3377
- y: offsetY
3378
- };
3379
- // fingers position difference
3380
- const x = Math.abs(e.pointers[0].clientX - e.pointers[1].clientX);
3381
- const y = Math.abs(e.pointers[0].clientY - e.pointers[1].clientY);
3382
- // diagonal fingers will change both (xy) axes
3383
- const p = x / y;
3384
- let xy;
3385
- if (p > 0.3 && p < 1.7) {
3386
- xy = 'xy';
3387
- }
3388
- else if (x > y) {
3389
- // x axis
3390
- xy = 'x';
3391
- }
3392
- else {
3393
- // y axis
3394
- xy = 'y';
3395
- }
3396
- doZoom(chartInstance, diff, center, xy);
3397
- // Keep track of overall scale
3398
- currentPinchScaling = e.scale;
3399
- };
3400
- mc.on('pinchstart', function (e) {
3401
- currentPinchScaling = 1; // reset tracker
3402
- });
3403
- mc.on('pinch', handlePinch);
3404
- mc.on('pinchend', function (e) {
3405
- handlePinch(e);
3406
- currentPinchScaling = null; // reset
3407
- zoomNS.zoomCumulativeDelta = 0;
3408
- });
3409
- let currentDeltaX = null, currentDeltaY = null, panning = false;
3410
- const handlePan = function (e) {
3411
- if (currentDeltaX !== null && currentDeltaY !== null) {
3412
- panning = true;
3413
- const deltaX = e.deltaX - currentDeltaX;
3414
- const deltaY = e.deltaY - currentDeltaY;
3415
- currentDeltaX = e.deltaX;
3416
- currentDeltaY = e.deltaY;
3417
- doPan(chartInstance, deltaX, deltaY);
3418
- }
3419
- };
3420
- mc.on('panstart', function (e) {
3421
- currentDeltaX = 0;
3422
- currentDeltaY = 0;
3423
- handlePan(e);
3424
- });
3425
- mc.on('panmove', handlePan);
3426
- mc.on('panend', function (e) {
3427
- currentDeltaX = null;
3428
- currentDeltaY = null;
3429
- zoomNS.panCumulativeDelta = 0;
3430
- setTimeout(function () { panning = false; }, 500);
3431
- });
3432
- chartInstance.zoom._ghostClickHandler = function (e) {
3433
- if (panning) {
3434
- e.stopImmediatePropagation();
3435
- e.preventDefault();
3436
- }
3437
- };
3438
- node.addEventListener('click', chartInstance.zoom._ghostClickHandler);
3439
- chartInstance._mc = mc;
3440
- }
3441
- },
3442
- beforeDatasetsDraw: function (chartInstance) {
3443
- const ctx = chartInstance.chart.ctx;
3444
- const chartArea = chartInstance.chartArea;
3445
- ctx.save();
3446
- ctx.beginPath();
3447
- if (chartInstance.zoom._dragZoomEnd) {
3448
- const yAxis = getYAxis(chartInstance);
3449
- const beginPoint = chartInstance.zoom._dragZoomStart;
3450
- const endPoint = chartInstance.zoom._dragZoomEnd;
3451
- const offsetX = beginPoint.target.getBoundingClientRect().left;
3452
- const startX = Math.min(beginPoint.clientX, endPoint.clientX) - offsetX;
3453
- const endX = Math.max(beginPoint.clientX, endPoint.clientX) - offsetX;
3454
- const rectWidth = endX - startX;
3455
- ctx.fillStyle = 'rgba(225,225,225,0.5)';
3456
- ctx.lineWidth = 5;
3457
- ctx.fillRect(startX, yAxis.top, rectWidth, yAxis.bottom - yAxis.top);
3458
- }
3459
- ctx.rect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
3460
- ctx.clip();
3461
- },
3462
- afterDatasetsDraw: function (chartInstance) {
3463
- chartInstance.chart.ctx.restore();
3464
- },
3465
- destroy: function (chartInstance) {
3466
- if (chartInstance.zoom) {
3467
- const options = chartInstance.options;
3468
- const node = chartInstance.zoom.node;
3469
- if (options.zoom && options.zoom.drag) {
3470
- node.removeEventListener('mousedown', chartInstance.zoom._mouseDownHandler);
3471
- node.removeEventListener('mousemove', chartInstance.zoom._mouseMoveHandler);
3472
- // node.removeEventListener('mouseup', chartInstance.zoom._mouseUpHandler);
3473
- node.ownerDocument.removeEventListener('mouseup', chartInstance.zoom._mouseUpHandler);
3474
- }
3475
- else {
3476
- node.removeEventListener('wheel', chartInstance.zoom._wheelHandler);
3477
- }
3478
- if (Hammer) {
3479
- node.removeEventListener('click', chartInstance.zoom._ghostClickHandler);
3480
- }
3481
- delete chartInstance.zoom;
3482
- const mc = chartInstance._mc;
3483
- if (mc) {
3484
- mc.remove('pinchstart');
3485
- mc.remove('pinch');
3486
- mc.remove('pinchend');
3487
- mc.remove('panstart');
3488
- mc.remove('pan');
3489
- mc.remove('panend');
3490
- }
3491
- }
3492
- }
3493
- };
3494
- Chart.pluginService.register(zoomPlugin);
3495
-
3496
- var SearchType;
3497
- (function (SearchType) {
3498
- SearchType["searchWithSubHeader"] = "searchWithSubHeader";
3499
- SearchType["searchAll"] = "searchAll";
3500
- SearchType["searchInChildren"] = "searchInChildren";
3501
- })(SearchType || (SearchType = {}));
3502
- class NameServerHistoryComponent {
3503
- constructor(fileService, chartService, uiService) {
3504
- this.fileService = fileService;
3505
- this.chartService = chartService;
3506
- this.uiService = uiService;
3507
- /**
3508
- * Input (optional) bind to [showInstruction]
3509
- */
3510
- this.showInstruction = true;
3511
- /**
3512
- * time info of the name server history file
3513
- */
3514
- this.time = {};
3515
- /**
3516
- * data of the name server history file
3517
- */
3518
- this.data = {};
3519
- /**
3520
- * header of the name server history file
3521
- */
3522
- this.header = [];
3523
- /**
3524
- * host of the name server history file
3525
- */
3526
- this.host = 'nameserver history file';
3527
- /**
3528
- * the progress for reading file
3529
- */
3530
- this.readProgress = 0;
3531
- /**
3532
- * selected/dropped file name (abbreviation), full file name will be shown via the tooltips
3533
- */
3534
- this.abbreviatedFileName = 'or Drop File Here';
3535
- /**
3536
- * for the instruction step 4
3537
- */
3538
- this.stepShowChart = false;
3539
- this.searchType = SearchType.searchAll;
3540
- }
3541
- ngOnChanges(changes) {
3542
- return __awaiter(this, void 0, void 0, function* () {
3543
- const fbc = changes.fileBuffer;
3544
- if (fbc && fbc.currentValue && fbc.currentValue !== fbc.previousValue && !isFile(fbc.currentValue)) {
3545
- // simulate selecting file
3546
- const simulatedEvent = { target: { files: [blobToFile(fbc.currentValue, this.streamModeFileName)] } };
3547
- yield this.fileSelected(simulatedEvent);
3548
- this.port = undefined; // clear the port selection
3549
- if (this.autoDisplay) {
3550
- this.onResize(); // ngAfterViewInit/resize won't work in electron
3551
- this.showChart();
3552
- }
3553
- }
3554
- });
3555
- }
3556
- ngAfterViewInit() {
3557
- // init items' status
3558
- // reset chart button will be disable by default later, only be enabled after zoomed
3559
- this._toggleItems([
3560
- { id: HtmlElement.chartArea, status: false },
3561
- { id: HtmlElement.readFileProgress, status: false },
3562
- { id: HtmlElement.showChartButton, status: false },
3563
- { id: HtmlElement.loadPortsButton, status: true },
3564
- { id: HtmlElement.resetChartButton, status: false }
3565
- ]);
3566
- this.onResize(); // update the size, otherwise there may have a scrollbar (because of the toast) if auto display is set to true
3567
- }
3568
- /**
3569
- * Reset Chart to initial status
3570
- * If legend is already selected/unselected from the list, it wouldn't be restored.
3571
- */
3572
- resetChart() {
3573
- this._toggleItems([{ id: HtmlElement.resetChartButton, status: false }]);
3574
- if (this.tableSource && this._selection) {
3575
- this.chartService.resetChart(this.tableSource, this._selection)
3576
- .catch(e => this._showMessage(Alert.error, e));
3577
- }
3578
- }
3579
- /**
3580
- * read the file and display the chart
3581
- */
3582
- showChart() {
3583
- // after click, this button and reset button needs to be disabled
3584
- this._toggleItems([
3585
- { id: HtmlElement.resetChartButton, status: false },
3586
- { id: HtmlElement.showChartButton, status: false }
3587
- ]);
3588
- this.stepShowChart = true;
3589
- this._initChartEnv().then(() => {
3590
- const selectedTime = this._selectedTimeRange;
3591
- if (selectedTime.startTime > selectedTime.endTime) {
3592
- this._showMessage(Alert.error, 'Time range is not correct.');
3593
- return;
3594
- }
3595
- if (this.file) {
3596
- // it's time for displaying the reading progress bar
3597
- this._toggleItems([{ id: HtmlElement.readFileProgress, status: true }]);
3598
- return this._buildChartFromDataFile(this.file, selectedTime.startTime, selectedTime.endTime, this.port);
3599
- }
3600
- }).catch(e => {
3601
- this._showMessage(Alert.error, e);
3602
- this._toggleItems([{ id: HtmlElement.readFileProgress, status: false }]);
3603
- });
3604
- }
3605
- /**
3606
- * load all ports from file
3607
- */
3608
- loadPorts() {
3609
- // do confirmation actions
3610
- if (this.file) {
3611
- // before start loading ports from file, display progress bar and disable the show chart button
3612
- this._toggleItems([
3613
- { id: HtmlElement.readFileProgress, status: true },
3614
- { id: HtmlElement.showChartButton, status: false }
3615
- ]);
3616
- this._readPortsFromFile(this.file);
3617
- }
3618
- }
3619
- /**
3620
- * select name server history file, currently only supports 1 file.
3621
- */
3622
- fileSelected(event) {
3623
- return __awaiter(this, void 0, void 0, function* () {
3624
- const selectedFile = getFileFromInput(event.target);
3625
- if (selectedFile) {
3626
- if (!isSameFile(this.file, selectedFile)) {
3627
- // init port selector
3628
- yield this._initPortSelector().catch(e => this._showMessage(Alert.error, e));
3629
- this.file = selectedFile;
3630
- this.abbreviatedFileName = getAbbreviatedFileName(this.file.name);
3631
- // after file has been selected, the show chart button needs to be enabled
3632
- this._toggleItems([{ id: HtmlElement.showChartButton, status: true }]);
3633
- }
3634
- }
3635
- });
3636
- }
3637
- /**
3638
- * drop name server history file, currently only supports 1 file.
3639
- */
3640
- fileDropped(event) {
3641
- getFileFromDrop(event)
3642
- .then(file => {
3643
- if (!isSameFile(this.file, file)) {
3644
- // init port selector
3645
- this.file = file;
3646
- if (this.file) {
3647
- this.abbreviatedFileName = getAbbreviatedFileName(this.file.name);
3648
- // after file has been dropped, the show chart button needs to be enabled
3649
- this._toggleItems([{ id: HtmlElement.showChartButton, status: true }]);
3650
- }
3651
- }
3652
- })
3653
- .then(() => {
3654
- return this._initPortSelector();
3655
- })
3656
- .catch(e => this._showMessage(Alert.error, e));
3657
- }
3658
- /**
3659
- * Select one item from selection table, relative dataset will be shown or hidden
3660
- */
3661
- selectItem(event) {
3662
- if (event && event.tableRow) {
3663
- const row = event.tableRow;
3664
- this._selection.toggle(row);
3665
- this.chartService.toggleDataInChart(row.KPI, !this._selection.isSelected(row))
3666
- .catch(e => this._showMessage(Alert.error, e));
3667
- }
3668
- }
3669
- /**
3670
- * recalculating chart height when resizing
3671
- */
3672
- onResize() {
3673
- const nameserverHistoryAllElement = this.nameserverHistoryAllRef ? this.nameserverHistoryAllRef.nativeElement : null;
3674
- const nameserverHistoryContentElement = this.nameserverHistoryContentRef ? this.nameserverHistoryContentRef.nativeElement : null;
3675
- setChartHeight(nameserverHistoryAllElement, nameserverHistoryContentElement);
3676
- }
3677
- /**
3678
- * Switch port and reinitialize chart, triggered by changing the port
3679
- * @param port the selected port
3680
- */
3681
- switchPortForChart(port) {
3682
- if (port === this._currentChartPort) {
3683
- // not to switch port, because the relative port is displaying, no need to render twice.
3684
- return;
3685
- }
3686
- if (!this.file || !port || port.length === 0 || port.slice(1, 3) === '**') {
3687
- return;
3688
- }
3689
- else if (Object.keys(this.time).length > 1 && !getRealPorts(Object.keys(this.time).filter(key => this.time[key])).includes(port)) {
3690
- this._showMessage(Alert.info, `Data of port:${port} is not loaded, please load the data first by clicking the "Show" button.`);
3691
- return;
3692
- }
3693
- // only do switch ports when available ports number > 1
3694
- if (Object.keys(this.time).filter(key => this.time[key]).length > 1) {
3695
- // disable the "show chart" and "reset chart" button first
3696
- this._toggleItems([
3697
- { id: HtmlElement.showChartButton, status: false },
3698
- { id: HtmlElement.resetChartButton, status: false }
3699
- ]);
3700
- // init the environment with switch flag
3701
- this._initChartEnv(true).then(() => {
3702
- return this._buildChart(port, null, true);
3703
- }).catch(e => this._showMessage(Alert.error, e));
3704
- }
3705
- }
3706
- /**
3707
- * get the columns which need to be hidden from the selection table
3708
- */
3709
- get hiddenColumns() {
3710
- return this.uiService.getHiddenColumns(this.hideMeasureColumns);
3711
- }
3712
- /**
3713
- * get default timezone
3714
- */
3715
- get defaultTimezone() {
3716
- return getDefaultTimezone();
3717
- }
3718
- /**
3719
- * get the key column (KPI)
3720
- */
3721
- get kpiColumn() {
3722
- return Item.kpi;
3723
- }
3724
- /**
3725
- * get the key column (KPI)
3726
- */
3727
- get descColumn() {
3728
- return Item.description;
3729
- }
3730
- /**
3731
- * get the selected time range, set second and millisecond part to 0
3732
- */
3733
- get _selectedTimeRange() {
3734
- let startTime = 0;
3735
- let endTime = 4102358400000; // 2099/12/31
3736
- if (this.dateTimeRange != null) {
3737
- if (this.dateTimeRange.length >= 1) {
3738
- // get start time
3739
- if (this.dateTimeRange[0]) {
3740
- startTime = this.dateTimeRange[0].setSeconds(0, 0);
3741
- }
3742
- if (this.dateTimeRange[1]) {
3743
- endTime = this.dateTimeRange[1].setSeconds(0, 0);
3744
- }
3745
- }
3746
- }
3747
- return { startTime: startTime, endTime: endTime };
3748
- }
3749
- /**
3750
- * get the time range string, eg: 2018-10-25 10:25 ~ 2018-10-26 10:26
3751
- */
3752
- get _selectedTimeRangeString() {
3753
- const selectedTimeRangeString = this._selectedTimeRange;
3754
- return `${getTimeString(selectedTimeRangeString.startTime)} ~ ${getTimeString(selectedTimeRangeString.endTime)}`;
3755
- }
3756
- /**
3757
- * get array of header key
3758
- */
3759
- get _headerKey() {
3760
- if (this.header) {
3761
- return this.header.map(headerItem => headerItem.key);
3762
- }
3763
- }
3764
- /**
3765
- * get array of header text
3766
- */
3767
- get _headerText() {
3768
- return this.header.map(headerItem => headerItem.text);
3769
- }
3770
- /**
3771
- * read ports from the selected nameserver history file
3772
- * @param file nameserver history file
3773
- */
3774
- _readPortsFromFile(file) {
3775
- this.fileService.getPortsFromFile(file, (progress) => {
3776
- this.readProgress = progress;
3777
- }).then(ports => {
3778
- return sleep(100).then(() => {
3779
- return this._initPortSelector(ports);
3780
- });
3781
- }).catch(e => this._showMessage(Alert.error, e));
3782
- }
3783
- /**
3784
- * build chart from the selected nameserver history file
3785
- * @param file the nameserver history file
3786
- * @param startTime start time
3787
- * @param endTime end time
3788
- * @param selectedPort selected port for nameserver history file (MDC system)
3789
- */
3790
- _buildChartFromDataFile(file, startTime, endTime, selectedPort) {
3791
- return this.fileService.getChartContentFromFile(file, startTime, endTime, selectedPort, this.timezone, this.maxRowsLimitation, progress => this.readProgress = progress)
3792
- .then(result => {
3793
- // parsing done
3794
- const beginTime = new Date();
3795
- const promises = [];
3796
- const ports = getRealPorts(Object.keys(result.time), true);
3797
- ports.forEach(port => {
3798
- // convert the unit and generate controlling data for all ports
3799
- promises.push(this.uiService.convertUnitAndGenerateControlData(result.data[port], result.header, port));
3800
- });
3801
- return Promise.all(promises)
3802
- .then(() => {
3803
- // get all ports from the analyzed data(time)
3804
- // get the port that will be shown in the page
3805
- const port = getDisplayPort(ports, selectedPort);
3806
- printProcessedTime(beginTime, 'converting step');
3807
- ports.forEach(portItem => this.uiService.generateYScale(portItem));
3808
- printProcessedTime(beginTime, 'generating YScale step');
3809
- this.data = result.data;
3810
- this.time = result.time;
3811
- this.header = this.uiService.getHeader(result.header, port);
3812
- this.host = result.host;
3813
- if (result.aborted === Abort.maxLineNumReached) {
3814
- this._showMessage(Alert.warning, `Maximum number of lines reached. Processed time range is: ${getTimeRangeString(this.time)}.`);
3815
- }
3816
- else {
3817
- if (isEmptyData(this.data)) {
3818
- this._showMessage(Alert.info, `Cannot find any data for the selected time period: ${this._selectedTimeRangeString}`);
3819
- }
3820
- else {
3821
- this._showMessage(Alert.success, `Processed time range is: ${getTimeRangeString(this.time)}.`);
3822
- }
3823
- }
3824
- return sleep(100).then(() => {
3825
- return this._buildChart(port, ports);
3826
- });
3827
- });
3828
- });
3829
- }
3830
- /**
3831
- * reinitialize the port selector with the ports
3832
- */
3833
- _initPortSelector(ports = null, selectedPort = null) {
3834
- return new Promise(resolve => {
3835
- // initialization for ngx-select
3836
- if (ports != null && ports.length > 1) {
3837
- // MDC, remove default '0000' port
3838
- this.ports = generatePorts(getRealPorts(ports), selectedPort);
3839
- }
3840
- else {
3841
- this.ports = generatePorts(ports);
3842
- }
3843
- if (ports != null && selectedPort === null) {
3844
- // reset status when doing:
3845
- // 1. loading ports
3846
- // 2. the file doesn't contain the selected Port
3847
- this.readProgress = 0;
3848
- // hide the progress bar and enable the "show chart" button
3849
- this._toggleItems([
3850
- { id: HtmlElement.readFileProgress, status: false },
3851
- { id: HtmlElement.showChartButton, status: true }
3852
- ]);
3853
- }
3854
- resolve();
3855
- });
3856
- }
3857
- /**
3858
- * build and display the chart on page
3859
- * @param port the selected port
3860
- * @param ports all available ports
3861
- * @param switchFlag indicates whether this function is triggered from switching ports (no init port selector needed)
3862
- */
3863
- _buildChart(port, ports, switchFlag = false) {
3864
- const beginTime = new Date();
3865
- if (port) {
3866
- return Promise.resolve(this._loadSettingsForSelectionsTable(port))
3867
- .then(() => {
3868
- // get the config
3869
- return this.chartService.buildChart(this.time[port], this.data[port], this.uiService.getYScale(this._headerKey, port), this._headerText, this._headerKey, this._selection, this.tableSource, this._getHostTitle(port), this.uiService.getDisplayItems(this._headerKey, port, this.defaultSelectedItems), this._onZoom.bind(this))
3870
- .then(() => {
3871
- this.readProgress = 0;
3872
- // after chart has been created, show the chart area, hide progress bar and enable the "show chart" button
3873
- this._toggleItems([
3874
- { id: HtmlElement.chartArea, status: true },
3875
- { id: HtmlElement.readFileProgress, status: false },
3876
- { id: HtmlElement.showChartButton, status: true }
3877
- ]);
3878
- // set port to current displaying port
3879
- this._currentChartPort = port;
3880
- printProcessedTime(beginTime, 'step_build_chart');
3881
- if (ports && ports.length > 0) {
3882
- if (!switchFlag) {
3883
- // initialize port selector. Do not need to do it when switching port.
3884
- return this._initPortSelector(ports, port);
3885
- }
3886
- }
3887
- });
3888
- });
3889
- }
3890
- else {
3891
- if (ports.length > 0) {
3892
- this._showMessage(Alert.warning, 'The selected port does not exist in the name server history file. Please choose a correct port and have a try again.');
3893
- if (!switchFlag) {
3894
- // initialize port selector. Do not need to do it when switching port.
3895
- return this._initPortSelector(ports, port);
3896
- }
3897
- }
3898
- }
3899
- }
3900
- /**
3901
- * get the string that will be displayed on the title area of the chart
3902
- * eg: host1 - 30040 (2018-09-05 15:32:32 ~ 2018-09-07 15:32:15)
3903
- * @param port selected port
3904
- */
3905
- _getHostTitle(port) {
3906
- if (this.host) {
3907
- return `${this.host} - ${port} ( ${getTimeRangeString(this.time[port])} )`;
3908
- }
3909
- }
3910
- /**
3911
- * after zoom, enable the reset button.
3912
- */
3913
- _onZoom() {
3914
- this._toggleItems([{ id: HtmlElement.resetChartButton, status: true }]);
3915
- }
3916
- /**
3917
- * initialize chart, including: destroy current chart, initialize config, initialize all relative data
3918
- */
3919
- _initChartEnv(switchFlag = false) {
3920
- return this.chartService.destroyChart().then(() => {
3921
- {
3922
- // cleanup other data
3923
- this._toggleItems([{ id: HtmlElement.chartArea, status: false }]);
3924
- if (!switchFlag) {
3925
- Object.keys(this.time).forEach(key => {
3926
- if (this.time[key]) {
3927
- this.time[key].length = 0;
3928
- }
3929
- });
3930
- this.time = {};
3931
- Object.keys(this.data).forEach(key => {
3932
- if (this.data[key]) {
3933
- this.data[key].length = 0;
3934
- }
3935
- });
3936
- this.data = {};
3937
- this.header.length = 0;
3938
- this.host = 'nameserver history file';
3939
- this.tableSource = void 0;
3940
- this.readProgress = 0;
3941
- this.uiService.clearLoadHistoryInfos();
3942
- }
3943
- }
3944
- });
3945
- }
3946
- /**
3947
- * Load settings for the selection table (the right part of the chart)
3948
- * @param port the selected port
3949
- */
3950
- _loadSettingsForSelectionsTable(port) {
3951
- this.tableSource = this.uiService.getSelectionTableRows(this._headerKey, port, this.defaultSelectedItems);
3952
- this._selection = new SelectionModel(true, []);
3953
- this.tableSource.forEach(row => {
3954
- if (this.uiService.getDisplayItems(this._headerKey, port, this.defaultSelectedItems).includes(row.KPI)) {
3955
- this._selection.select(row);
3956
- }
3957
- });
3958
- }
3959
- /**
3960
- * Show messages
3961
- * @param type type of the message
3962
- * @param message message text
3963
- */
3964
- _showMessage(type, message) {
3965
- if (type) {
3966
- switch (type) {
3967
- case Alert.success:
3968
- case Alert.info:
3969
- break;
3970
- case Alert.warning:
3971
- console.warn(message);
3972
- break;
3973
- case Alert.error:
3974
- console.error(message);
3975
- }
3976
- }
3977
- if (this.alertMessage === message) {
3978
- // try trigger the change event of the alert.
3979
- this.alertMessage = void 0;
3980
- setTimeout(() => this.alertMessage = message, 100);
3981
- }
3982
- else {
3983
- this.alertMessage = message;
3984
- }
3985
- this.alertType = type;
3986
- }
3987
- /**
3988
- * toggle items with the provided status (show or hide the relative element on the page)
3989
- * @param items items with the relative id and status.
3990
- */
3991
- _toggleItems(items) {
3992
- const getVariableNameByTypeId = (id) => {
3993
- switch (id) {
3994
- case HtmlElement.chartArea: return 'showChartFlag';
3995
- case HtmlElement.readFileProgress: return 'showReadFileProgress';
3996
- case HtmlElement.showChartButton: return 'enableShowChartButton';
3997
- case HtmlElement.loadPortsButton: return 'enableLoadPortsButton';
3998
- case HtmlElement.resetChartButton: return 'enableResetChartButton';
3999
- }
4000
- };
4001
- if (items) {
4002
- items.forEach(item => {
4003
- this[getVariableNameByTypeId(item.id)] = item.status;
4004
- });
4005
- }
4006
- }
4007
- }
4008
- NameServerHistoryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NameServerHistoryComponent, deps: [{ token: FileService }, { token: ChartService }, { token: UIService }], target: i0.ɵɵFactoryTarget.Component });
4009
- NameServerHistoryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NameServerHistoryComponent, selector: "ngx-hana-nameserver-history-viewer", inputs: { defaultSelectedItems: "defaultSelectedItems", hideMeasureColumns: "hideMeasureColumns", maxRowsLimitation: "maxRowsLimitation", showInstruction: "showInstruction", timezone: "timezone", fileBuffer: "fileBuffer", streamModeFileName: "streamModeFileName", autoDisplay: "autoDisplay" }, providers: [FileService, ChartService, UIService], viewQueries: [{ propertyName: "nameserverHistoryAllRef", first: true, predicate: ["nameserverHistoryAll"], descendants: true, read: ElementRef }, { propertyName: "nameserverHistoryContentRef", first: true, predicate: ["nameserverHistoryContent"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: "<div #nameserverHistoryAll class=\"nameserver-history-all\" (window:resize)=\"onResize()\">\r\n <div class=\"toolbar-chart\">\r\n <div class=\"upload-box-content\">\r\n <div *ngIf=\"!showReadFileProgress\">\r\n <file-drop-input (fileDrop)=\"fileDropped($event)\" (fileInput)=\"fileSelected($event)\"\r\n [dropAreaText]= \"abbreviatedFileName\"\r\n [inputAreaText]=\"'Browse'\"\r\n [title]=\"file?.name? file.name:'Select a name server history file from your local disk.'\"\r\n *ngIf=\"!fileBuffer\">\r\n </file-drop-input>\r\n <p *ngIf=\"fileBuffer\" class=\"box-stream-mode-text\">{{streamModeFileName || 'nameserver_history.trc (stream mode)'}}</p>\r\n </div>\r\n <div *ngIf=\"showReadFileProgress\">\r\n <progress-bar [progress]=\"readProgress\"></progress-bar>\r\n </div>\r\n </div>\r\n <div class=\"input-time\">\r\n <div class=\"input-time-range\">\r\n <time-range-selector [disabled]=\"showReadFileProgress\" [(dateTimeRange)]=\"dateTimeRange\"></time-range-selector>\r\n </div>\r\n <div class=\"timezone-selector\">\r\n <timezone-selector [(timezone)]=\"timezone\" [disabled]=\"showReadFileProgress\"></timezone-selector>\r\n </div>\r\n </div>\r\n\r\n <div class=\"port-selection\">\r\n <div class=\"port-selector\">\r\n <port-selector (portChange)=\"switchPortForChart($event)\" [(port)]=\"port\" [ports]=\"ports\" [disabled]=\"showReadFileProgress\"></port-selector>\r\n </div>\r\n <div class=\"port-load-button\">\r\n <button (click)=\"loadPorts()\" title=\"Load all ports from name server history trace file.\" [disabled]=\"!enableShowChartButton || port || !enableLoadPortsButton\">{{showReadFileProgress? \"Loading...\" : \"Load\"}}</button>\r\n </div>\r\n </div>\r\n\r\n <div class=\"chart-operation\">\r\n <div class=\"left\">\r\n <button (click)=\"showChart()\" title=\"Load and display all data from name server history trace file.\" [disabled]=\"!enableShowChartButton\">{{showReadFileProgress? \"Loading...\" : \"Show\"}}</button>\r\n </div>\r\n <div class=\"right\">\r\n <button (click)=\"resetChart()\" title=\"Reset zoom of chart.\" [disabled]=\"showReadFileProgress || !enableResetChartButton\">Reset Chart</button>\r\n </div>\r\n </div>\r\n </div>\r\n <div #nameserverHistoryContent class=\"nameserver-history-content\">\r\n <div class=\"nameserver-history-content-chart\">\r\n <instruction [(show)]=\"showInstruction\" *ngIf=\"!showChartFlag && showInstruction\"\r\n [step1Finished]=\"!!file\"\r\n [step2Finished]=\"dateTimeRange && (!!dateTimeRange[0] || !!dateTimeRange[1]) || timezone != defaultTimezone\"\r\n [step3Finished]=\"!!port\"\r\n [step4Finished]=\"stepShowChart && !enableShowChartButton\"\r\n [step5Finished]=\"false\">\r\n </instruction>\r\n <canvas id=\"chartNameServerHistory\" ></canvas>\r\n </div>\r\n <div class=\"nameserver-history-content-controller\" >\r\n <ngx-selection-table (change)=\"selectItem($event)\" *ngIf=\"showChartFlag\"\r\n [filter]=\"true\"\r\n [checkbox]=\"true\"\r\n [tableSource]=\"tableSource\"\r\n [keyColumn]=\"kpiColumn\"\r\n [hiddenColumns]=\"hiddenColumns\"\r\n [tooltipColumn]=\"descColumn\"\r\n [searchStyle]=\"searchType\"\r\n [searchColumn]=\"kpiColumn\"\r\n [multiSelection]=\"true\">\r\n </ngx-selection-table>\r\n </div>\r\n </div>\r\n</div>\r\n<div class=\"message-container\" *ngIf=\"alertMessage\">\r\n <alert [(alertMessage)]=\"alertMessage\" [alertType]=\"alertType\" [alertTimeout]=\"30000\"></alert>\r\n</div>\r\n", styles: [":host *,:host *:before,:host *:after{box-sizing:inherit;display:inherit;font-size:inherit;font-weight:inherit;font-family:inherit}:host .hover-box,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{outline:0;box-shadow:0 0 6px #23adff}:host .dashed-box,:host .nameserver-history-all .toolbar-chart .chart-operation button,:host .nameserver-history-all .toolbar-chart .port-selection,:host .nameserver-history-all .toolbar-chart .input-time,:host .nameserver-history-all .toolbar-chart .upload-box-content{background:#f8f8f8;box-shadow:inset 0 20px 20px -20px #0009;border:1px dashed #0782d0}:host .solid-box,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{background:#fff none;border:1px solid #ccc;border-radius:4px;line-height:1.42857143}:host .nameserver-history-all{width:98%;min-width:1314px;height:auto;border:1px none #0782d0;border-bottom-style:dashed;margin:3px 1%;box-sizing:border-box;display:inline-block;font-size:14px;font-weight:400;font-family:Helvetica,Arial,sans-serif}:host .nameserver-history-all .toolbar-chart{width:100%;height:48px}:host .nameserver-history-all .toolbar-chart button{text-align:center;white-space:nowrap;vertical-align:middle}:host .nameserver-history-all .toolbar-chart button:hover{text-shadow:1px 1px 3px royalblue;cursor:pointer;font-weight:600}:host .nameserver-history-all .toolbar-chart button:disabled{text-shadow:none;opacity:.65;cursor:default;color:#a9a9a9;font-weight:400}:host .nameserver-history-all .toolbar-chart .upload-box-content{width:20%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .upload-box-content .box-stream-mode-text{text-align:center;color:#00008b}:host .nameserver-history-all .toolbar-chart .input-time{margin-left:1%;margin-right:1%;width:43%;height:100%}:host .nameserver-history-all .toolbar-chart .input-time .input-time-range{height:100%;width:57%;float:left}:host .nameserver-history-all .toolbar-chart .input-time .timezone-selector{margin-top:6px;height:100%;width:42.5%;margin-right:.5%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection{width:14%;margin-right:1%;height:48px}:host .nameserver-history-all .toolbar-chart .port-selection .port-selector{margin-top:6px;margin-left:2%;margin-right:1%;width:47%;float:left}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button{margin-top:6px;margin-left:1%;margin-right:2%;width:47%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{color:#333;width:100%;padding:6px 12px;margin-bottom:0}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{text-shadow:None;font-weight:400}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:disabled{box-shadow:none}:host .nameserver-history-all .toolbar-chart .chart-operation{width:20%;height:48px;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation .left{margin-right:1%;width:49%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .chart-operation .right{width:50%;height:100%;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation button{width:100%;height:100%;color:#00008b}:host .nameserver-history-all .nameserver-history-content{width:100%;height:730px;margin:5px 5px 5px 0}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-chart{width:75%;height:100%;position:relative;float:left}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-controller{width:25%;height:100%;float:right;overflow:auto}:host .message-container{width:98%;margin:0 1%;box-sizing:border-box;display:inline-block}\n"], components: [{ type: FileDropInputComponent, selector: "file-drop-input", inputs: ["dropAreaText", "inputAreaText"], outputs: ["fileDrop", "fileInput"] }, { type: ProgressBarComponent, selector: "progress-bar", inputs: ["progress"] }, { type: TimeRangeSelectorComponent, selector: "time-range-selector", inputs: ["disabled", "dateTimeRange"], outputs: ["dateTimeRangeChange"] }, { type: TimezoneSelectorComponent, selector: "timezone-selector", inputs: ["disabled", "timezone"], outputs: ["timezoneChange"] }, { type: PortSelectorComponent, selector: "port-selector", inputs: ["disabled", "port", "ports"], outputs: ["portChange"] }, { type: InstructionComponent, selector: "instruction", inputs: ["step1Finished", "step2Finished", "step3Finished", "step4Finished", "step5Finished", "show"], outputs: ["showChange"] }, { type: i8.SelectionTableComponent, selector: "ngx-selection-table", inputs: ["filter", "keyColumn", "tableSource", "checkbox", "multiSelection", "clickToSelect", "hiddenColumns", "tooltipColumn", "searchStyle", "searchColumn"], outputs: ["change"] }, { type: AlertComponent, selector: "alert", inputs: ["alertMessage", "alertType", "alertTimeout"], outputs: ["alertMessageChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4010
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NameServerHistoryComponent, decorators: [{
4011
- type: Component,
4012
- args: [{ selector: 'ngx-hana-nameserver-history-viewer', providers: [FileService, ChartService, UIService], template: "<div #nameserverHistoryAll class=\"nameserver-history-all\" (window:resize)=\"onResize()\">\r\n <div class=\"toolbar-chart\">\r\n <div class=\"upload-box-content\">\r\n <div *ngIf=\"!showReadFileProgress\">\r\n <file-drop-input (fileDrop)=\"fileDropped($event)\" (fileInput)=\"fileSelected($event)\"\r\n [dropAreaText]= \"abbreviatedFileName\"\r\n [inputAreaText]=\"'Browse'\"\r\n [title]=\"file?.name? file.name:'Select a name server history file from your local disk.'\"\r\n *ngIf=\"!fileBuffer\">\r\n </file-drop-input>\r\n <p *ngIf=\"fileBuffer\" class=\"box-stream-mode-text\">{{streamModeFileName || 'nameserver_history.trc (stream mode)'}}</p>\r\n </div>\r\n <div *ngIf=\"showReadFileProgress\">\r\n <progress-bar [progress]=\"readProgress\"></progress-bar>\r\n </div>\r\n </div>\r\n <div class=\"input-time\">\r\n <div class=\"input-time-range\">\r\n <time-range-selector [disabled]=\"showReadFileProgress\" [(dateTimeRange)]=\"dateTimeRange\"></time-range-selector>\r\n </div>\r\n <div class=\"timezone-selector\">\r\n <timezone-selector [(timezone)]=\"timezone\" [disabled]=\"showReadFileProgress\"></timezone-selector>\r\n </div>\r\n </div>\r\n\r\n <div class=\"port-selection\">\r\n <div class=\"port-selector\">\r\n <port-selector (portChange)=\"switchPortForChart($event)\" [(port)]=\"port\" [ports]=\"ports\" [disabled]=\"showReadFileProgress\"></port-selector>\r\n </div>\r\n <div class=\"port-load-button\">\r\n <button (click)=\"loadPorts()\" title=\"Load all ports from name server history trace file.\" [disabled]=\"!enableShowChartButton || port || !enableLoadPortsButton\">{{showReadFileProgress? \"Loading...\" : \"Load\"}}</button>\r\n </div>\r\n </div>\r\n\r\n <div class=\"chart-operation\">\r\n <div class=\"left\">\r\n <button (click)=\"showChart()\" title=\"Load and display all data from name server history trace file.\" [disabled]=\"!enableShowChartButton\">{{showReadFileProgress? \"Loading...\" : \"Show\"}}</button>\r\n </div>\r\n <div class=\"right\">\r\n <button (click)=\"resetChart()\" title=\"Reset zoom of chart.\" [disabled]=\"showReadFileProgress || !enableResetChartButton\">Reset Chart</button>\r\n </div>\r\n </div>\r\n </div>\r\n <div #nameserverHistoryContent class=\"nameserver-history-content\">\r\n <div class=\"nameserver-history-content-chart\">\r\n <instruction [(show)]=\"showInstruction\" *ngIf=\"!showChartFlag && showInstruction\"\r\n [step1Finished]=\"!!file\"\r\n [step2Finished]=\"dateTimeRange && (!!dateTimeRange[0] || !!dateTimeRange[1]) || timezone != defaultTimezone\"\r\n [step3Finished]=\"!!port\"\r\n [step4Finished]=\"stepShowChart && !enableShowChartButton\"\r\n [step5Finished]=\"false\">\r\n </instruction>\r\n <canvas id=\"chartNameServerHistory\" ></canvas>\r\n </div>\r\n <div class=\"nameserver-history-content-controller\" >\r\n <ngx-selection-table (change)=\"selectItem($event)\" *ngIf=\"showChartFlag\"\r\n [filter]=\"true\"\r\n [checkbox]=\"true\"\r\n [tableSource]=\"tableSource\"\r\n [keyColumn]=\"kpiColumn\"\r\n [hiddenColumns]=\"hiddenColumns\"\r\n [tooltipColumn]=\"descColumn\"\r\n [searchStyle]=\"searchType\"\r\n [searchColumn]=\"kpiColumn\"\r\n [multiSelection]=\"true\">\r\n </ngx-selection-table>\r\n </div>\r\n </div>\r\n</div>\r\n<div class=\"message-container\" *ngIf=\"alertMessage\">\r\n <alert [(alertMessage)]=\"alertMessage\" [alertType]=\"alertType\" [alertTimeout]=\"30000\"></alert>\r\n</div>\r\n", styles: [":host *,:host *:before,:host *:after{box-sizing:inherit;display:inherit;font-size:inherit;font-weight:inherit;font-family:inherit}:host .hover-box,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{outline:0;box-shadow:0 0 6px #23adff}:host .dashed-box,:host .nameserver-history-all .toolbar-chart .chart-operation button,:host .nameserver-history-all .toolbar-chart .port-selection,:host .nameserver-history-all .toolbar-chart .input-time,:host .nameserver-history-all .toolbar-chart .upload-box-content{background:#f8f8f8;box-shadow:inset 0 20px 20px -20px #0009;border:1px dashed #0782d0}:host .solid-box,:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{background:#fff none;border:1px solid #ccc;border-radius:4px;line-height:1.42857143}:host .nameserver-history-all{width:98%;min-width:1314px;height:auto;border:1px none #0782d0;border-bottom-style:dashed;margin:3px 1%;box-sizing:border-box;display:inline-block;font-size:14px;font-weight:400;font-family:Helvetica,Arial,sans-serif}:host .nameserver-history-all .toolbar-chart{width:100%;height:48px}:host .nameserver-history-all .toolbar-chart button{text-align:center;white-space:nowrap;vertical-align:middle}:host .nameserver-history-all .toolbar-chart button:hover{text-shadow:1px 1px 3px royalblue;cursor:pointer;font-weight:600}:host .nameserver-history-all .toolbar-chart button:disabled{text-shadow:none;opacity:.65;cursor:default;color:#a9a9a9;font-weight:400}:host .nameserver-history-all .toolbar-chart .upload-box-content{width:20%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .upload-box-content .box-stream-mode-text{text-align:center;color:#00008b}:host .nameserver-history-all .toolbar-chart .input-time{margin-left:1%;margin-right:1%;width:43%;height:100%}:host .nameserver-history-all .toolbar-chart .input-time .input-time-range{height:100%;width:57%;float:left}:host .nameserver-history-all .toolbar-chart .input-time .timezone-selector{margin-top:6px;height:100%;width:42.5%;margin-right:.5%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection{width:14%;margin-right:1%;height:48px}:host .nameserver-history-all .toolbar-chart .port-selection .port-selector{margin-top:6px;margin-left:2%;margin-right:1%;width:47%;float:left}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button{margin-top:6px;margin-left:1%;margin-right:2%;width:47%;float:right}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button{color:#333;width:100%;padding:6px 12px;margin-bottom:0}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:hover{text-shadow:None;font-weight:400}:host .nameserver-history-all .toolbar-chart .port-selection .port-load-button button:disabled{box-shadow:none}:host .nameserver-history-all .toolbar-chart .chart-operation{width:20%;height:48px;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation .left{margin-right:1%;width:49%;height:100%;float:left}:host .nameserver-history-all .toolbar-chart .chart-operation .right{width:50%;height:100%;float:right}:host .nameserver-history-all .toolbar-chart .chart-operation button{width:100%;height:100%;color:#00008b}:host .nameserver-history-all .nameserver-history-content{width:100%;height:730px;margin:5px 5px 5px 0}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-chart{width:75%;height:100%;position:relative;float:left}:host .nameserver-history-all .nameserver-history-content .nameserver-history-content-controller{width:25%;height:100%;float:right;overflow:auto}:host .message-container{width:98%;margin:0 1%;box-sizing:border-box;display:inline-block}\n"] }]
4013
- }], ctorParameters: function () { return [{ type: FileService }, { type: ChartService }, { type: UIService }]; }, propDecorators: { nameserverHistoryAllRef: [{
4014
- type: ViewChild,
4015
- args: ['nameserverHistoryAll', { read: ElementRef }]
4016
- }], nameserverHistoryContentRef: [{
4017
- type: ViewChild,
4018
- args: ['nameserverHistoryContent', { read: ElementRef }]
4019
- }], defaultSelectedItems: [{
4020
- type: Input
4021
- }], hideMeasureColumns: [{
4022
- type: Input
4023
- }], maxRowsLimitation: [{
4024
- type: Input
4025
- }], showInstruction: [{
4026
- type: Input
4027
- }], timezone: [{
4028
- type: Input
4029
- }], fileBuffer: [{
4030
- type: Input
4031
- }], streamModeFileName: [{
4032
- type: Input
4033
- }], autoDisplay: [{
4034
- type: Input
4035
- }] } });
4036
-
4037
- class NameserverHistoryModule {
4038
- }
4039
- NameserverHistoryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NameserverHistoryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4040
- NameserverHistoryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NameserverHistoryModule, declarations: [NameServerHistoryComponent,
4041
- FileDropInputComponent,
4042
- ProgressBarComponent,
4043
- TimezoneSelectorComponent,
4044
- PortSelectorComponent,
4045
- InstructionComponent,
4046
- TimeRangeSelectorComponent], imports: [AlertModule,
4047
- SelectionTableModule,
4048
- DropdownListModule,
4049
- OwlDateTimeModule,
4050
- OwlNativeDateTimeModule,
4051
- CommonModule,
4052
- FormsModule], exports: [NameServerHistoryComponent] });
4053
- NameserverHistoryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NameserverHistoryModule, providers: [], imports: [[
4054
- AlertModule,
4055
- SelectionTableModule,
4056
- DropdownListModule,
4057
- OwlDateTimeModule,
4058
- OwlNativeDateTimeModule,
4059
- CommonModule,
4060
- FormsModule
4061
- ]] });
4062
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NameserverHistoryModule, decorators: [{
4063
- type: NgModule,
4064
- args: [{
4065
- declarations: [
4066
- NameServerHistoryComponent,
4067
- FileDropInputComponent,
4068
- ProgressBarComponent,
4069
- TimezoneSelectorComponent,
4070
- PortSelectorComponent,
4071
- InstructionComponent,
4072
- TimeRangeSelectorComponent
4073
- ],
4074
- exports: [
4075
- NameServerHistoryComponent
4076
- ],
4077
- imports: [
4078
- AlertModule,
4079
- SelectionTableModule,
4080
- DropdownListModule,
4081
- OwlDateTimeModule,
4082
- OwlNativeDateTimeModule,
4083
- CommonModule,
4084
- FormsModule
4085
- ],
4086
- entryComponents: [],
4087
- providers: [],
4088
- bootstrap: []
4089
- }]
4090
- }] });
4091
-
4092
- /**
4093
- * Generated bundle index. Do not edit.
4094
- */
4095
-
4096
- export { NameServerHistoryComponent, NameserverHistoryModule };
4097
- //# sourceMappingURL=ngx-hana-nameserver-history-viewer.mjs.map