@esfaenza/admin-module 15.2.12 → 15.2.13
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/lib/components/topact/topact_search.component.mjs +37 -8
- package/esm2020/lib/models/components/TopActivitiesDataView.mjs +1 -1
- package/fesm2015/esfaenza-admin-module.mjs +39 -6
- package/fesm2015/esfaenza-admin-module.mjs.map +1 -1
- package/fesm2020/esfaenza-admin-module.mjs +36 -7
- package/fesm2020/esfaenza-admin-module.mjs.map +1 -1
- package/lib/components/topact/topact_search.component.d.ts +5 -1
- package/lib/models/components/TopActivitiesDataView.d.ts +1 -0
- package/package.json +1 -1
|
@@ -31,8 +31,8 @@ import * as i3 from '@esfaenza/preferences';
|
|
|
31
31
|
import * as i4 from '@esfaenza/httpservice';
|
|
32
32
|
import { HttpParams } from '@angular/common/http';
|
|
33
33
|
import { __decorate } from 'tslib';
|
|
34
|
-
import { catchError } from 'rxjs/operators';
|
|
35
|
-
import { of } from 'rxjs';
|
|
34
|
+
import { takeUntil, catchError } from 'rxjs/operators';
|
|
35
|
+
import { ReplaySubject, interval, of } from 'rxjs';
|
|
36
36
|
|
|
37
37
|
class AuditsView extends AppSearch {
|
|
38
38
|
constructor() {
|
|
@@ -715,6 +715,8 @@ class AdmTopActivitiesComponent {
|
|
|
715
715
|
this.searchView = new TopActivitiesDataView();
|
|
716
716
|
this.autoUpdate = false;
|
|
717
717
|
this.seconds = "5";
|
|
718
|
+
this.rtWindow = null;
|
|
719
|
+
this.destroyed$ = new ReplaySubject(1);
|
|
718
720
|
this.seriesPropertiesMapping = {};
|
|
719
721
|
this.propertiesSeriesMapping = {
|
|
720
722
|
["cputime"]: "CPU",
|
|
@@ -729,10 +731,31 @@ class AdmTopActivitiesComponent {
|
|
|
729
731
|
this.intercom.send(InboundMessageTypes.Navigation, { sub: false, routeTitle: this.lc.loc(this.route.snapshot.data["title"]) });
|
|
730
732
|
}
|
|
731
733
|
ngOnInit() {
|
|
734
|
+
// Ogni minuto calcolo qual è la finestra del realTime
|
|
735
|
+
interval(60 * 1000).pipe(takeUntil(this.destroyed$)).subscribe(_ => {
|
|
736
|
+
this.updateRealTimeWindow();
|
|
737
|
+
});
|
|
732
738
|
this.storageSub = this.route.queryParams.subscribe(params => {
|
|
733
739
|
this.Init(params["ignoreStorage"]);
|
|
734
740
|
});
|
|
735
741
|
}
|
|
742
|
+
async updateRealTimeWindow() {
|
|
743
|
+
let data = new TopActivitiesDataView();
|
|
744
|
+
data = await this.http.post(Repository.POST_Director_GetTopActivities, data).toPromise();
|
|
745
|
+
let reference = data.items[0];
|
|
746
|
+
for (let i = 0; i < reference.actsessions.length; i++) {
|
|
747
|
+
let itemref = reference.actsessions[i];
|
|
748
|
+
let theD = this.dateExts.getDateConvertion(itemref.sampletime);
|
|
749
|
+
if (!this.rtWindow)
|
|
750
|
+
this.rtWindow = { from: theD, to: theD };
|
|
751
|
+
else {
|
|
752
|
+
if (theD.isBefore(this.rtWindow.from))
|
|
753
|
+
this.rtWindow.from = theD;
|
|
754
|
+
if (theD.isAfter(this.rtWindow.to))
|
|
755
|
+
this.rtWindow.to = theD;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
736
759
|
Init(ignoreStore) {
|
|
737
760
|
this.doInit(ignoreStore);
|
|
738
761
|
}
|
|
@@ -759,14 +782,20 @@ class AdmTopActivitiesComponent {
|
|
|
759
782
|
}
|
|
760
783
|
}
|
|
761
784
|
ngOnDestroy() {
|
|
785
|
+
this.destroyed$.next(true);
|
|
786
|
+
this.destroyed$.complete();
|
|
762
787
|
if (this.storageSub)
|
|
763
788
|
this.storageSub.unsubscribe();
|
|
764
789
|
}
|
|
765
|
-
sendSearch(resetPage = true, update = false, searchViewOverride = null) {
|
|
766
|
-
this.searchView
|
|
767
|
-
if (
|
|
768
|
-
this.
|
|
769
|
-
this.
|
|
790
|
+
async sendSearch(resetPage = true, update = false, searchViewOverride = null) {
|
|
791
|
+
let sv = searchViewOverride ?? this.searchView;
|
|
792
|
+
if ((sv.filterfrom || sv.filterto) && !this.rtWindow)
|
|
793
|
+
await this.updateRealTimeWindow();
|
|
794
|
+
let dateRequestOnRealtimeWindow = sv.filterfrom && this.dateExts.getDateConvertion(sv.filterfrom).isAfter(this.rtWindow.from) &&
|
|
795
|
+
sv.filterto && this.dateExts.getDateConvertion(sv.filterto).isBefore(this.rtWindow.to);
|
|
796
|
+
sv.filterrealtime = dateRequestOnRealtimeWindow;
|
|
797
|
+
sv.searchinprogress = true;
|
|
798
|
+
this.POSTGetItems(Repository.POST_Director_GetTopActivities, sv, update);
|
|
770
799
|
}
|
|
771
800
|
POSTGetItems(url, data, update) {
|
|
772
801
|
this.http.post(url, data).subscribe(async (t) => {
|