ngx-hana-nameserver-history-viewer 1.1.9-9.8.beta → 1.2.0-9.8.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/nameserver-history-viewer/components/nameserver-history.component.mjs +16 -18
- package/esm2020/src/nameserver-history-viewer/components/timezone-selector/timezone-selector.component.mjs +2 -2
- package/esm2020/src/nameserver-history-viewer/services/chart.service.mjs +11 -6
- package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/data_culling.mjs +3 -2
- package/esm2020/src/nameserver-history-viewer/utils/chartjs-downsample/responsive_downsample_plugin.mjs +3 -2
- package/esm2020/src/nameserver-history-viewer/utils/time-util.mjs +2 -2
- package/fesm2015/ngx-hana-nameserver-history-viewer.mjs +38 -33
- package/fesm2015/ngx-hana-nameserver-history-viewer.mjs.map +1 -1
- package/fesm2020/ngx-hana-nameserver-history-viewer.mjs +37 -33
- package/fesm2020/ngx-hana-nameserver-history-viewer.mjs.map +1 -1
- package/package.json +1 -1
- package/src/nameserver-history-viewer/components/nameserver-history.component.d.ts +6 -6
- package/src/nameserver-history-viewer/utils/chartjs-downsample/data_culling.d.ts +2 -2
|
@@ -6,8 +6,7 @@ import * as i2$1 from '@angular/forms';
|
|
|
6
6
|
import { FormsModule } from '@angular/forms';
|
|
7
7
|
import * as i1$1 from '@danielmoncada/angular-datetime-picker';
|
|
8
8
|
import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
|
|
9
|
-
import * as moment from 'moment-timezone';
|
|
10
|
-
import moment__default from 'moment-timezone';
|
|
9
|
+
import * as moment$2 from 'moment-timezone';
|
|
11
10
|
import * as i2 from 'ngx-dropdown-list';
|
|
12
11
|
import { DropdownListModule } from 'ngx-dropdown-list';
|
|
13
12
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
@@ -15,7 +14,7 @@ import * as chartjs from 'chart.js';
|
|
|
15
14
|
import { Chart as Chart$2 } from 'chart.js';
|
|
16
15
|
import { parse } from 'papaparse';
|
|
17
16
|
import * as hammerjs from 'hammerjs';
|
|
18
|
-
import
|
|
17
|
+
import * as moment_module from 'moment';
|
|
19
18
|
import * as i8 from 'ngx-selection-table';
|
|
20
19
|
import { SelectionTableModule } from 'ngx-selection-table';
|
|
21
20
|
|
|
@@ -549,7 +548,7 @@ function _getTimeRange(time) {
|
|
|
549
548
|
* get default local time zone
|
|
550
549
|
*/
|
|
551
550
|
function getDefaultTimezone() {
|
|
552
|
-
return
|
|
551
|
+
return moment$2.tz.guess();
|
|
553
552
|
}
|
|
554
553
|
/**
|
|
555
554
|
* Get time from provided timezone, using this only because chart.js doesn't support timezone.
|
|
@@ -562,8 +561,8 @@ function getTimeFromTimeZone(time, timezone) {
|
|
|
562
561
|
timezone = getDefaultTimezone();
|
|
563
562
|
console.warn(`getTimeFromTimeZone - Input timezone is null, returning the local (${timezone}) time. `);
|
|
564
563
|
}
|
|
565
|
-
const utcOffset =
|
|
566
|
-
const currentOffset =
|
|
564
|
+
const utcOffset = moment$2.tz.zone(timezone).utcOffset(time * 1000);
|
|
565
|
+
const currentOffset = moment$2.tz.zone(getDefaultTimezone()).utcOffset(time * 1000);
|
|
567
566
|
// convert to utc and then to selected timezone
|
|
568
567
|
return time + currentOffset * 60 - utcOffset * 60;
|
|
569
568
|
}
|
|
@@ -571,7 +570,7 @@ function getTimeFromTimeZone(time, timezone) {
|
|
|
571
570
|
* Get time formatted with the provided timezone
|
|
572
571
|
*/
|
|
573
572
|
function getTimeString(time) {
|
|
574
|
-
return
|
|
573
|
+
return moment$2(time).format('YYYY-MM-DD HH:mm:ss');
|
|
575
574
|
}
|
|
576
575
|
/**
|
|
577
576
|
* Get the time range string by time array, eg: 2018-10-25 10:10:00 ~ 2018-10-25 12:12:00
|
|
@@ -773,7 +772,7 @@ class TimezoneSelectorService {
|
|
|
773
772
|
*/
|
|
774
773
|
getZones() {
|
|
775
774
|
const timezones = [];
|
|
776
|
-
const zones = moment.tz.names();
|
|
775
|
+
const zones = moment$2.tz.names();
|
|
777
776
|
zones.forEach(zone => {
|
|
778
777
|
// get region
|
|
779
778
|
let region;
|
|
@@ -830,7 +829,7 @@ class TimezoneSelectorComponent {
|
|
|
830
829
|
return tz[tz.length - 1].replace('_', ' ');
|
|
831
830
|
}
|
|
832
831
|
_getOffset(zone) {
|
|
833
|
-
let offset =
|
|
832
|
+
let offset = moment$2.tz(zone).utcOffset();
|
|
834
833
|
const neg = offset < 0;
|
|
835
834
|
if (neg) {
|
|
836
835
|
offset = -1 * offset;
|
|
@@ -1941,11 +1940,16 @@ class ChartService {
|
|
|
1941
1940
|
* generate configuration for chart and create the chart object.
|
|
1942
1941
|
*/
|
|
1943
1942
|
buildChart(time, data, yScale, header, headerKey, selection, tableSource, title, defaultItems, zoomCB) {
|
|
1944
|
-
return new Promise((resolve) => {
|
|
1945
|
-
const ctx = document.getElementById('chartNameServerHistory')
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1943
|
+
return new Promise((resolve, reject) => {
|
|
1944
|
+
const ctx = document.getElementById('chartNameServerHistory')?.getContext('2d');
|
|
1945
|
+
if (ctx) {
|
|
1946
|
+
const cfg = ChartService._generateChartConfig(time, data, yScale, header, headerKey, selection, tableSource, title, defaultItems, zoomCB);
|
|
1947
|
+
this._chart = new Chart$2(ctx, cfg);
|
|
1948
|
+
resolve();
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
reject('Can not find the canvas.');
|
|
1952
|
+
}
|
|
1949
1953
|
});
|
|
1950
1954
|
}
|
|
1951
1955
|
/**
|
|
@@ -2705,6 +2709,7 @@ class LTTBDataMipmap extends DataMipmap {
|
|
|
2705
2709
|
}
|
|
2706
2710
|
}
|
|
2707
2711
|
|
|
2712
|
+
const moment$1 = (window && window.moment) ? window.moment : moment_module;
|
|
2708
2713
|
function getCompareValue(value) {
|
|
2709
2714
|
if (typeof value === 'number') {
|
|
2710
2715
|
return value;
|
|
@@ -2783,6 +2788,7 @@ function cullData(data, range) {
|
|
|
2783
2788
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2784
2789
|
* SOFTWARE.
|
|
2785
2790
|
*/
|
|
2791
|
+
const moment = (window && window.moment) ? window.moment : moment_module;
|
|
2786
2792
|
// Using dynamic flag to fix the issue of ng-packagr #696: Lambda not supported
|
|
2787
2793
|
// @dynamic
|
|
2788
2794
|
/**
|
|
@@ -2839,8 +2845,8 @@ class ResponsiveDownsamplePlugin {
|
|
|
2839
2845
|
if (isNil(xScale)) {
|
|
2840
2846
|
return null;
|
|
2841
2847
|
}
|
|
2842
|
-
const start = moment
|
|
2843
|
-
const end = moment
|
|
2848
|
+
const start = moment(xScale.getValueForPixel(xScale.left));
|
|
2849
|
+
const end = moment(xScale.getValueForPixel(xScale.left + 1));
|
|
2844
2850
|
const targetResolution = end.diff(start);
|
|
2845
2851
|
return targetResolution * options.desiredDataPointDistance;
|
|
2846
2852
|
}
|
|
@@ -3525,19 +3531,6 @@ class NameServerHistoryComponent {
|
|
|
3525
3531
|
this.stepShowChart = false;
|
|
3526
3532
|
this.searchType = SearchType.searchAll;
|
|
3527
3533
|
}
|
|
3528
|
-
ngOnInit() {
|
|
3529
|
-
// this.timezone = this.defaultTimezone;
|
|
3530
|
-
this.onResize();
|
|
3531
|
-
// init items' status
|
|
3532
|
-
// reset chart button will be disable by default later, only be enabled after zoomed
|
|
3533
|
-
this._toggleItems([
|
|
3534
|
-
{ id: HtmlElement.chartArea, status: false },
|
|
3535
|
-
{ id: HtmlElement.readFileProgress, status: false },
|
|
3536
|
-
{ id: HtmlElement.showChartButton, status: false },
|
|
3537
|
-
{ id: HtmlElement.loadPortsButton, status: true },
|
|
3538
|
-
{ id: HtmlElement.resetChartButton, status: false }
|
|
3539
|
-
]);
|
|
3540
|
-
}
|
|
3541
3534
|
async ngOnChanges(changes) {
|
|
3542
3535
|
const fbc = changes.fileBuffer;
|
|
3543
3536
|
if (fbc && fbc.currentValue && fbc.currentValue !== fbc.previousValue) {
|
|
@@ -3546,15 +3539,26 @@ class NameServerHistoryComponent {
|
|
|
3546
3539
|
await this.fileSelected(simulatedEvent);
|
|
3547
3540
|
this.port = undefined; // clear the port selection
|
|
3548
3541
|
if (this.autoDisplay) {
|
|
3549
|
-
this.onResize(); // update the size, otherwise there may have a scrollbar (because of the toast) if auto display is set to true
|
|
3550
3542
|
this.showChart();
|
|
3551
3543
|
}
|
|
3552
3544
|
}
|
|
3553
3545
|
}
|
|
3546
|
+
ngAfterViewInit() {
|
|
3547
|
+
// init items' status
|
|
3548
|
+
// reset chart button will be disable by default later, only be enabled after zoomed
|
|
3549
|
+
this._toggleItems([
|
|
3550
|
+
{ id: HtmlElement.chartArea, status: false },
|
|
3551
|
+
{ id: HtmlElement.readFileProgress, status: false },
|
|
3552
|
+
{ id: HtmlElement.showChartButton, status: false },
|
|
3553
|
+
{ id: HtmlElement.loadPortsButton, status: true },
|
|
3554
|
+
{ id: HtmlElement.resetChartButton, status: false }
|
|
3555
|
+
]);
|
|
3556
|
+
this.onResize(); // update the size, otherwise there may have a scrollbar (because of the toast) if auto display is set to true
|
|
3557
|
+
}
|
|
3554
3558
|
/**
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3559
|
+
* Reset Chart to initial status
|
|
3560
|
+
* If legend is already selected/unselected from the list, it wouldn't be restored.
|
|
3561
|
+
*/
|
|
3558
3562
|
resetChart() {
|
|
3559
3563
|
this._toggleItems([{ id: HtmlElement.resetChartButton, status: false }]);
|
|
3560
3564
|
if (this.tableSource && this._selection) {
|