ngx-hana-nameserver-history-viewer 1.1.3 → 1.1.90

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