@sumaris-net/ngx-components 1.9.9 → 1.10.2
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/bundles/sumaris-net.ngx-components.umd.js +143 -67
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +4 -0
- package/esm2015/public_api.js +2 -2
- package/esm2015/src/app/core/form/editor.class.js +2 -2
- package/esm2015/src/app/core/form/entity-editor.class.js +17 -15
- package/esm2015/src/app/core/home/home.js +2 -2
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +2 -2
- package/esm2015/src/app/core/services/account.service.js +22 -25
- package/esm2015/src/app/core/services/base-entity-service.class.js +3 -3
- package/esm2015/src/app/core/services/config.service.js +2 -2
- package/esm2015/src/app/core/services/network.service.js +5 -5
- package/esm2015/src/app/core/services/platform.service.js +3 -4
- package/esm2015/src/app/core/services/testing/referential-filter.model.js +23 -0
- package/esm2015/src/app/core/services/testing/referential.validator.js +44 -0
- package/esm2015/src/app/core/table/table.class.js +32 -20
- package/esm2015/src/app/shared/shared.testing.module.js +9 -3
- package/esm2015/src/app/shared/toast/toast.testing.js +39 -0
- package/esm2015/src/app/shared/toast/toast.testing.module.js +33 -0
- package/esm2015/src/app/shared/toast/toasts.js +119 -0
- package/esm2015/src/app/social/services/user-event.service.js +2 -2
- package/esm2015/sumaris-net.ngx-components.js +9 -7
- package/fesm2015/sumaris-net.ngx-components.js +140 -63
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
- package/src/app/core/form/editor.class.d.ts +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +9 -5
- package/src/app/core/home/home.d.ts +1 -1
- package/src/app/core/services/account.service.d.ts +4 -3
- package/src/app/core/services/config.service.d.ts +1 -1
- package/src/app/core/services/network.service.d.ts +1 -1
- package/src/app/core/services/platform.service.d.ts +1 -1
- package/src/app/core/services/testing/referential-filter.model.d.ts +9 -0
- package/src/app/core/services/testing/referential.validator.d.ts +19 -0
- package/src/app/core/table/table.class.d.ts +1 -1
- package/src/app/shared/shared.testing.module.d.ts +2 -0
- package/src/app/shared/toast/toast.testing.d.ts +14 -0
- package/src/app/shared/toast/toast.testing.module.d.ts +2 -0
- package/src/app/shared/{toasts.d.ts → toast/toasts.d.ts} +0 -0
- package/src/app/social/services/user-event.service.d.ts +1 -1
- package/sumaris-net.ngx-components.d.ts +8 -6
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/shared/toasts.js +0 -119
|
@@ -12277,7 +12277,7 @@
|
|
|
12277
12277
|
this.onNetworkStatusChanges.next(currentConnectionType);
|
|
12278
12278
|
// Offline mode: alert the user
|
|
12279
12279
|
if (currentConnectionType === 'none' && (!opts || opts.showToast !== false)) {
|
|
12280
|
-
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP' });
|
|
12280
|
+
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP', type: 'warning' });
|
|
12281
12281
|
}
|
|
12282
12282
|
}
|
|
12283
12283
|
}
|
|
@@ -12534,11 +12534,11 @@
|
|
|
12534
12534
|
// Force offline mode
|
|
12535
12535
|
this._forceOffline = true;
|
|
12536
12536
|
// Alert the user
|
|
12537
|
-
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP' });
|
|
12537
|
+
this.showToast({ message: 'NETWORK.INFO.OFFLINE_HELP', type: 'warning' });
|
|
12538
12538
|
}
|
|
12539
12539
|
else {
|
|
12540
12540
|
// Alert the user
|
|
12541
|
-
this.showToast({ message: 'NETWORK.INFO.OFFLINE' });
|
|
12541
|
+
this.showToast({ message: 'NETWORK.INFO.OFFLINE', type: 'warning' });
|
|
12542
12542
|
}
|
|
12543
12543
|
// Stop the network service
|
|
12544
12544
|
this.stop();
|
|
@@ -15465,7 +15465,8 @@
|
|
|
15465
15465
|
};
|
|
15466
15466
|
_this._$additionalFields = new rxjs.BehaviorSubject([]);
|
|
15467
15467
|
_this._tokenType$ = new rxjs.BehaviorSubject(undefined);
|
|
15468
|
-
_this._enableListenChanges = (!environment.account || environment.account.enableListenChanges !== false);
|
|
15468
|
+
_this._enableListenChanges = (!environment.account || environment.account.enableListenChanges !== false); // True by default
|
|
15469
|
+
_this._listenIntervalInSeconds = toNumber(environment.account && environment.account.listenIntervalInSeconds, 0); // no timer by default
|
|
15469
15470
|
_this._debug = !environment.production;
|
|
15470
15471
|
if (_this._debug)
|
|
15471
15472
|
console.debug('[account-service] Creating service');
|
|
@@ -15711,7 +15712,7 @@
|
|
|
15711
15712
|
this.onChange.next(this._data);
|
|
15712
15713
|
// Listen remote changes
|
|
15713
15714
|
if (this._enableListenChanges)
|
|
15714
|
-
this.
|
|
15715
|
+
this.startListenRemoteChanges();
|
|
15715
15716
|
return [2 /*return*/, this._data];
|
|
15716
15717
|
case 6:
|
|
15717
15718
|
error_1 = _b.sent();
|
|
@@ -15867,7 +15868,7 @@
|
|
|
15867
15868
|
this.onLogin.next(this._data);
|
|
15868
15869
|
this.onChange.next(this._data);
|
|
15869
15870
|
if (this._enableListenChanges)
|
|
15870
|
-
this.
|
|
15871
|
+
this.startListenRemoteChanges();
|
|
15871
15872
|
return [2 /*return*/, this._data];
|
|
15872
15873
|
}
|
|
15873
15874
|
});
|
|
@@ -16007,7 +16008,6 @@
|
|
|
16007
16008
|
if (hadAuthBasic)
|
|
16008
16009
|
this.onAuthBasicChange.next(undefined);
|
|
16009
16010
|
this.onChange.next(undefined);
|
|
16010
|
-
this.stopListenChanges();
|
|
16011
16011
|
return [2 /*return*/];
|
|
16012
16012
|
}
|
|
16013
16013
|
});
|
|
@@ -16170,7 +16170,7 @@
|
|
|
16170
16170
|
AccountService.prototype.listenChanges = function (opts) {
|
|
16171
16171
|
if (this._enableListenChanges)
|
|
16172
16172
|
return new rxjs.Subscription(); // Already started: skip
|
|
16173
|
-
return this.
|
|
16173
|
+
return this.startListenRemoteChanges(opts);
|
|
16174
16174
|
};
|
|
16175
16175
|
Object.defineProperty(AccountService.prototype, "additionalFields", {
|
|
16176
16176
|
get: function () {
|
|
@@ -16200,7 +16200,7 @@
|
|
|
16200
16200
|
};
|
|
16201
16201
|
/* -- protected method -- */
|
|
16202
16202
|
AccountService.prototype.resetData = function () {
|
|
16203
|
-
this.
|
|
16203
|
+
this.stopListenRemoteChanges();
|
|
16204
16204
|
this._cache.loaded = false;
|
|
16205
16205
|
this._cache.keypair = null;
|
|
16206
16206
|
this._cache.authToken = null;
|
|
@@ -16352,7 +16352,7 @@
|
|
|
16352
16352
|
this.onLogin.next(this._data);
|
|
16353
16353
|
this.onChange.next(this._data);
|
|
16354
16354
|
if (this._enableListenChanges)
|
|
16355
|
-
this.
|
|
16355
|
+
this.startListenRemoteChanges();
|
|
16356
16356
|
if (this._debug)
|
|
16357
16357
|
console.debug("[account] Account restoration [OK] {pubkey: " + pubkey.substr(0, 8) + "}, {profile: " + this._cache.mainProfile + "}");
|
|
16358
16358
|
return [2 /*return*/, account];
|
|
@@ -16602,13 +16602,13 @@
|
|
|
16602
16602
|
});
|
|
16603
16603
|
});
|
|
16604
16604
|
};
|
|
16605
|
-
AccountService.prototype.
|
|
16605
|
+
AccountService.prototype.startListenRemoteChanges = function (opts) {
|
|
16606
16606
|
var _this = this;
|
|
16607
16607
|
if (this._listenChangesSubscription)
|
|
16608
|
-
this.
|
|
16608
|
+
this.stopListenRemoteChanges(); // Stop previous subscription
|
|
16609
16609
|
if (this.network.offline)
|
|
16610
16610
|
return new rxjs.Subscription(); // Offline: skip
|
|
16611
|
-
|
|
16611
|
+
this._listenChangesSubscription = this.watchChanges(opts)
|
|
16612
16612
|
.subscribe({
|
|
16613
16613
|
next: function (data) {
|
|
16614
16614
|
console.debug("[account] Remote update detected at " + data.updateDate);
|
|
@@ -16628,21 +16628,18 @@
|
|
|
16628
16628
|
}
|
|
16629
16629
|
}
|
|
16630
16630
|
});
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
|
|
16635
|
-
return
|
|
16631
|
+
this._listenChangesSubscription.add(function () {
|
|
16632
|
+
console.debug("[account] Stop watching remote changes");
|
|
16633
|
+
_this._listenChangesSubscription = null;
|
|
16634
|
+
});
|
|
16635
|
+
return this._listenChangesSubscription;
|
|
16636
16636
|
};
|
|
16637
|
-
AccountService.prototype.
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
this._listenChangesSubscription = null;
|
|
16641
|
-
}
|
|
16637
|
+
AccountService.prototype.stopListenRemoteChanges = function () {
|
|
16638
|
+
var _a;
|
|
16639
|
+
(_a = this._listenChangesSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
16642
16640
|
};
|
|
16643
16641
|
AccountService.prototype.watchChanges = function (opts) {
|
|
16644
16642
|
var _this = this;
|
|
16645
|
-
var _a;
|
|
16646
16643
|
if (!this.started) {
|
|
16647
16644
|
// Wait service ready, then loop
|
|
16648
16645
|
return rxjs.from(this.ready())
|
|
@@ -16653,7 +16650,7 @@
|
|
|
16653
16650
|
if (this.network.offline)
|
|
16654
16651
|
throw new Error('Cannot watch account changes: network is offline.');
|
|
16655
16652
|
var variables = {
|
|
16656
|
-
interval:
|
|
16653
|
+
interval: toNumber(opts && opts.intervalInSeconds, this._listenIntervalInSeconds)
|
|
16657
16654
|
};
|
|
16658
16655
|
console.debug("[account] Watching remote changes, every " + variables.interval + "s");
|
|
16659
16656
|
return this.graphql.subscribe({
|
|
@@ -17678,8 +17675,7 @@
|
|
|
17678
17675
|
case 3:
|
|
17679
17676
|
now = Date.now();
|
|
17680
17677
|
console.info("[platform] Starting storage migration...");
|
|
17681
|
-
return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED',
|
|
17682
|
-
duration: 30000 })];
|
|
17678
|
+
return [4 /*yield*/, this.showToast({ message: 'INFO.DATA_MIGRATION_STARTED', type: 'info', duration: 30000 })];
|
|
17683
17679
|
case 4:
|
|
17684
17680
|
toast_1 = _b.sent();
|
|
17685
17681
|
_b.label = 5;
|
|
@@ -19807,7 +19803,7 @@
|
|
|
19807
19803
|
},] }
|
|
19808
19804
|
];
|
|
19809
19805
|
|
|
19810
|
-
var routes$
|
|
19806
|
+
var routes$2 = [
|
|
19811
19807
|
{
|
|
19812
19808
|
path: '',
|
|
19813
19809
|
pathMatch: 'full',
|
|
@@ -19862,7 +19858,7 @@
|
|
|
19862
19858
|
i1.ReactiveFormsModule,
|
|
19863
19859
|
SharedMaterialModule,
|
|
19864
19860
|
i1$2.TranslateModule.forChild(),
|
|
19865
|
-
i3.RouterModule.forChild(routes$
|
|
19861
|
+
i3.RouterModule.forChild(routes$2)
|
|
19866
19862
|
],
|
|
19867
19863
|
declarations: [
|
|
19868
19864
|
MaterialTestingPage,
|
|
@@ -19888,6 +19884,75 @@
|
|
|
19888
19884
|
},] }
|
|
19889
19885
|
];
|
|
19890
19886
|
|
|
19887
|
+
var ToastTestingPage = /** @class */ (function () {
|
|
19888
|
+
function ToastTestingPage(toastController, translate) {
|
|
19889
|
+
this.toastController = toastController;
|
|
19890
|
+
this.translate = translate;
|
|
19891
|
+
this.defaultOptions = {
|
|
19892
|
+
showCloseButton: false
|
|
19893
|
+
};
|
|
19894
|
+
}
|
|
19895
|
+
ToastTestingPage.prototype.showToast = function (opts) {
|
|
19896
|
+
return Toasts.show(this.toastController, this.translate, Object.assign(Object.assign(Object.assign({}, this.defaultOptions), { message: 'This is a message' }), opts));
|
|
19897
|
+
};
|
|
19898
|
+
ToastTestingPage.prototype.showInfo = function (opts) {
|
|
19899
|
+
return this.showToast(Object.assign({ type: 'info', message: 'This is a info text !' }, opts));
|
|
19900
|
+
};
|
|
19901
|
+
ToastTestingPage.prototype.showWarning = function (opts) {
|
|
19902
|
+
return this.showToast(Object.assign({ type: 'warning', message: 'This is a warning text !' }, opts));
|
|
19903
|
+
};
|
|
19904
|
+
ToastTestingPage.prototype.showError = function (opts) {
|
|
19905
|
+
return this.showToast(Object.assign({ type: 'error', message: 'This is a error text !' }, opts));
|
|
19906
|
+
};
|
|
19907
|
+
ToastTestingPage.prototype.toggleCloseButton = function () {
|
|
19908
|
+
this.defaultOptions.showCloseButton = !this.defaultOptions.showCloseButton;
|
|
19909
|
+
};
|
|
19910
|
+
return ToastTestingPage;
|
|
19911
|
+
}());
|
|
19912
|
+
ToastTestingPage.decorators = [
|
|
19913
|
+
{ type: i0.Component, args: [{
|
|
19914
|
+
selector: 'toast-testing',
|
|
19915
|
+
template: "<ion-toolbar color=\"primary\">\n <ion-title>Toasts</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <p>Toast examples:</p>\n\n <ion-button (click)=\"showToast()\" color=\"dark\">\n default\n </ion-button>\n\n <ion-button (click)=\"showInfo({duration: 100000})\" color=\"secondary\">\n info\n </ion-button>\n\n <ion-button (click)=\"showWarning()\" color=\"accent\">\n warning\n </ion-button>\n\n <ion-button (click)=\"showError()\" color=\"danger\">\n error\n </ion-button>\n\n <br/>\n\n\n <ion-list>\n\n\n <ion-item>\n <ion-checkbox slot=\"start\" [value]=\"defaultOptions.showCloseButton\" (ionChange)=\"toggleCloseButton()\"></ion-checkbox>\n <ion-label>Close button ?</ion-label>\n </ion-item>\n </ion-list>\n\n\n</ion-content>\n"
|
|
19916
|
+
},] }
|
|
19917
|
+
];
|
|
19918
|
+
ToastTestingPage.ctorParameters = function () { return [
|
|
19919
|
+
{ type: i1$5.ToastController },
|
|
19920
|
+
{ type: i1$2.TranslateService }
|
|
19921
|
+
]; };
|
|
19922
|
+
|
|
19923
|
+
var routes$1 = [
|
|
19924
|
+
{
|
|
19925
|
+
path: 'toast',
|
|
19926
|
+
pathMatch: 'full',
|
|
19927
|
+
component: ToastTestingPage
|
|
19928
|
+
}
|
|
19929
|
+
];
|
|
19930
|
+
var ToastTestingModule = /** @class */ (function () {
|
|
19931
|
+
function ToastTestingModule() {
|
|
19932
|
+
}
|
|
19933
|
+
return ToastTestingModule;
|
|
19934
|
+
}());
|
|
19935
|
+
ToastTestingModule.decorators = [
|
|
19936
|
+
{ type: i0.NgModule, args: [{
|
|
19937
|
+
imports: [
|
|
19938
|
+
i1$4.CommonModule,
|
|
19939
|
+
i1$5.IonicModule,
|
|
19940
|
+
i1$2.TranslateModule.forChild(),
|
|
19941
|
+
i3.RouterModule.forChild(routes$1)
|
|
19942
|
+
],
|
|
19943
|
+
declarations: [
|
|
19944
|
+
ToastTestingPage
|
|
19945
|
+
],
|
|
19946
|
+
exports: [
|
|
19947
|
+
i3.RouterModule,
|
|
19948
|
+
ToastTestingPage
|
|
19949
|
+
]
|
|
19950
|
+
},] }
|
|
19951
|
+
];
|
|
19952
|
+
|
|
19953
|
+
var SHARED_TESTING_PAGES = [
|
|
19954
|
+
{ label: 'Toast', page: '/testing/shared/toast' }
|
|
19955
|
+
];
|
|
19891
19956
|
var SharedTestingModule = /** @class */ (function () {
|
|
19892
19957
|
function SharedTestingModule() {
|
|
19893
19958
|
}
|
|
@@ -19898,10 +19963,12 @@
|
|
|
19898
19963
|
imports: [
|
|
19899
19964
|
i1$4.CommonModule,
|
|
19900
19965
|
i1$2.TranslateModule.forChild(),
|
|
19901
|
-
MaterialTestingModule
|
|
19966
|
+
MaterialTestingModule,
|
|
19967
|
+
ToastTestingModule
|
|
19902
19968
|
],
|
|
19903
19969
|
exports: [
|
|
19904
|
-
MaterialTestingModule
|
|
19970
|
+
MaterialTestingModule,
|
|
19971
|
+
ToastTestingModule
|
|
19905
19972
|
]
|
|
19906
19973
|
},] }
|
|
19907
19974
|
];
|
|
@@ -24152,7 +24219,7 @@
|
|
|
24152
24219
|
throw Error('Not implemented!');
|
|
24153
24220
|
var variables = opts && opts.variables || {
|
|
24154
24221
|
id: id,
|
|
24155
|
-
interval: opts && opts.interval
|
|
24222
|
+
interval: toNumber(opts && opts.interval, 0) // no timer by default
|
|
24156
24223
|
};
|
|
24157
24224
|
if (this._debug)
|
|
24158
24225
|
console.debug(this._logPrefix + ("[WS] Listening for changes on " + this._logTypeName + " {" + id + "}..."));
|
|
@@ -25552,7 +25619,7 @@
|
|
|
25552
25619
|
AppTable.prototype.deleteRows = function (event, rows, opts) {
|
|
25553
25620
|
var _a;
|
|
25554
25621
|
return __awaiter(this, void 0, void 0, function () {
|
|
25555
|
-
var confirmed, canDelete, saved,
|
|
25622
|
+
var confirmed, canDelete, saved, deleteCount, err_2;
|
|
25556
25623
|
var _this = this;
|
|
25557
25624
|
return __generator(this, function (_e) {
|
|
25558
25625
|
switch (_e.label) {
|
|
@@ -25588,13 +25655,16 @@
|
|
|
25588
25655
|
if (deleted) {
|
|
25589
25656
|
_this.visibleRowCount--;
|
|
25590
25657
|
_this.totalRowCount--;
|
|
25658
|
+
// Forget is was the edited row
|
|
25659
|
+
if (row === _this.editedRow) {
|
|
25660
|
+
_this.editedRow = undefined;
|
|
25661
|
+
}
|
|
25591
25662
|
return res;
|
|
25592
25663
|
}
|
|
25593
25664
|
}
|
|
25594
25665
|
return res.concat(row);
|
|
25595
25666
|
}, []);
|
|
25596
|
-
if (
|
|
25597
|
-
return [2 /*return*/, 0];
|
|
25667
|
+
if (!isNotEmptyArray(rows)) return [3 /*break*/, 3];
|
|
25598
25668
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
25599
25669
|
case 2:
|
|
25600
25670
|
saved = _e.sent();
|
|
@@ -25604,20 +25674,21 @@
|
|
|
25604
25674
|
}
|
|
25605
25675
|
_e.label = 3;
|
|
25606
25676
|
case 3:
|
|
25677
|
+
_e.trys.push([3, 6, , 7]);
|
|
25678
|
+
deleteCount = rows.length;
|
|
25679
|
+
if (!deleteCount) return [3 /*break*/, 5];
|
|
25607
25680
|
if (this.debug)
|
|
25608
|
-
console.debug('[table] Delete
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25681
|
+
console.debug('[table] Delete selected rows...');
|
|
25682
|
+
// Reverse row order (on a copy)
|
|
25683
|
+
// This is a workaround, need because row.delete() has async execution
|
|
25684
|
+
// and index cache is updated with a delay
|
|
25685
|
+
rows = rows.slice()
|
|
25613
25686
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
25614
|
-
|
|
25687
|
+
return [4 /*yield*/, this._dataSource.deleteAll(rows)];
|
|
25615
25688
|
case 4:
|
|
25616
|
-
_e.trys.push([4, 6, , 7]);
|
|
25617
|
-
deleteCount = rowsToDelete.length;
|
|
25618
|
-
return [4 /*yield*/, this._dataSource.deleteAll(rowsToDelete)];
|
|
25619
|
-
case 5:
|
|
25620
25689
|
_e.sent();
|
|
25690
|
+
_e.label = 5;
|
|
25691
|
+
case 5:
|
|
25621
25692
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
25622
25693
|
//this.totalRowCount -= deleteCount;
|
|
25623
25694
|
//this.visibleRowCount -= deleteCount;
|
|
@@ -25625,7 +25696,8 @@
|
|
|
25625
25696
|
this.editedRow = undefined;
|
|
25626
25697
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
25627
25698
|
this.markForCheck();
|
|
25628
|
-
|
|
25699
|
+
if (deleteCount)
|
|
25700
|
+
this.onAfterDeletedRows.next(rows);
|
|
25629
25701
|
return [2 /*return*/, deleteCount];
|
|
25630
25702
|
case 6:
|
|
25631
25703
|
err_2 = _e.sent();
|
|
@@ -27224,17 +27296,16 @@
|
|
|
27224
27296
|
var AppEntityEditor = /** @class */ (function (_super) {
|
|
27225
27297
|
__extends(AppEntityEditor, _super);
|
|
27226
27298
|
function AppEntityEditor(injector, dataType, dataService, options) {
|
|
27227
|
-
var _this = this;
|
|
27228
|
-
var _a;
|
|
27229
|
-
_this = _super.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
27299
|
+
var _this = _super.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.AlertController), injector.get(i1$2.TranslateService), options) || this;
|
|
27230
27300
|
_this.dataType = dataType;
|
|
27231
27301
|
_this.dataService = dataService;
|
|
27232
27302
|
_this.saving = false;
|
|
27233
27303
|
_this.$title = new rxjs.Subject();
|
|
27234
27304
|
_this.onUpdateView = new i0.EventEmitter();
|
|
27305
|
+
_this.environement = injector.get(ENVIRONMENT);
|
|
27235
27306
|
options = Object.assign({
|
|
27236
27307
|
// Default options
|
|
27237
|
-
enableListenChanges:
|
|
27308
|
+
enableListenChanges: !_this.environement.entityEditor || _this.environement.entityEditor.enableListenChanges !== false, listenIntervalInSeconds: toNumber(_this.environement.entityEditor && _this.environement.entityEditor.listenIntervalInSeconds, 0), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
|
|
27238
27309
|
}, options);
|
|
27239
27310
|
_this.settings = injector.get(LocalSettingsService);
|
|
27240
27311
|
_this.errorTranslator = injector.get(FormErrorTranslator);
|
|
@@ -27242,6 +27313,7 @@
|
|
|
27242
27313
|
_this.dateFormat = injector.get(DateFormatPipe);
|
|
27243
27314
|
_this.toastController = injector.get(i1$5.ToastController);
|
|
27244
27315
|
_this._enableListenChanges = options.enableListenChanges;
|
|
27316
|
+
_this._listenIntervalInSeconds = options.listenIntervalInSeconds;
|
|
27245
27317
|
_this._pathIdAttribute = options.pathIdAttribute;
|
|
27246
27318
|
_this._autoLoad = options.autoLoad;
|
|
27247
27319
|
_this._autoLoadDelay = options.autoLoadDelay;
|
|
@@ -27331,7 +27403,7 @@
|
|
|
27331
27403
|
};
|
|
27332
27404
|
AppEntityEditor.prototype.ngOnDestroy = function () {
|
|
27333
27405
|
_super.prototype.ngOnDestroy.call(this);
|
|
27334
|
-
this.
|
|
27406
|
+
this._listenChangesSubscription = null; // already unsubscribe in the super function
|
|
27335
27407
|
this.$title.complete();
|
|
27336
27408
|
this.$title.unsubscribe();
|
|
27337
27409
|
this.onUpdateView.complete();
|
|
@@ -27428,32 +27500,33 @@
|
|
|
27428
27500
|
AppEntityEditor.prototype.startListenRemoteChanges = function () {
|
|
27429
27501
|
var _this = this;
|
|
27430
27502
|
// Skip if disable, or already listening
|
|
27431
|
-
if (this.
|
|
27503
|
+
if (this._listenChangesSubscription || !this._enableListenChanges || this.isNewData)
|
|
27432
27504
|
return;
|
|
27433
27505
|
// Listen for changes on server
|
|
27434
|
-
this.
|
|
27506
|
+
this._listenChangesSubscription = this.dataService.listenChanges(this.data.id, { interval: this._listenIntervalInSeconds })
|
|
27435
27507
|
.pipe(operators.filter(isNotNil))
|
|
27436
27508
|
.subscribe(function (data) {
|
|
27437
27509
|
if (data.updateDate && data.updateDate.isAfter(_this.data.updateDate)) {
|
|
27438
27510
|
if (!_this.dirty) {
|
|
27439
27511
|
if (_this.debug)
|
|
27440
|
-
console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}
|
|
27512
|
+
console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}: reloading page...");
|
|
27441
27513
|
_this.updateView(data);
|
|
27442
27514
|
}
|
|
27443
27515
|
else {
|
|
27444
27516
|
if (_this.debug)
|
|
27445
27517
|
console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}, but page is dirty: skip reloading.");
|
|
27518
|
+
// TODO: alter user (with a toast ?)
|
|
27446
27519
|
}
|
|
27447
27520
|
}
|
|
27448
27521
|
});
|
|
27449
|
-
this.
|
|
27450
|
-
this.registerSubscription(this.
|
|
27522
|
+
this._listenChangesSubscription.add(function () { return _this._listenChangesSubscription = null; });
|
|
27523
|
+
this.registerSubscription(this._listenChangesSubscription);
|
|
27451
27524
|
};
|
|
27452
27525
|
AppEntityEditor.prototype.stopListenRemoteChanges = function () {
|
|
27453
|
-
if (this.
|
|
27454
|
-
this.unregisterSubscription(this.
|
|
27455
|
-
this.
|
|
27456
|
-
this.
|
|
27526
|
+
if (this._listenChangesSubscription) {
|
|
27527
|
+
this.unregisterSubscription(this._listenChangesSubscription);
|
|
27528
|
+
this._listenChangesSubscription.unsubscribe();
|
|
27529
|
+
this._listenChangesSubscription = null;
|
|
27457
27530
|
}
|
|
27458
27531
|
};
|
|
27459
27532
|
AppEntityEditor.prototype.updateView = function (data, opts) {
|
|
@@ -27650,7 +27723,7 @@
|
|
|
27650
27723
|
// Update the view (e.g metadata)
|
|
27651
27724
|
_b.sent();
|
|
27652
27725
|
// Subscribe to remote changes
|
|
27653
|
-
if (!this.
|
|
27726
|
+
if (!this._listenChangesSubscription)
|
|
27654
27727
|
this.startListenRemoteChanges();
|
|
27655
27728
|
this.submitted = false;
|
|
27656
27729
|
return [2 /*return*/, true];
|
|
@@ -29378,6 +29451,7 @@
|
|
|
29378
29451
|
exports.SETTINGS_SORTED_COLUMN = SETTINGS_SORTED_COLUMN;
|
|
29379
29452
|
exports.SETTINGS_STORAGE_KEY = SETTINGS_STORAGE_KEY;
|
|
29380
29453
|
exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
|
|
29454
|
+
exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
|
|
29381
29455
|
exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
|
|
29382
29456
|
exports.SelectPeerModal = SelectPeerModal;
|
|
29383
29457
|
exports.SettingsPage = SettingsPage;
|
|
@@ -29568,12 +29642,14 @@
|
|
|
29568
29642
|
exports["ɵd"] = MatBadgeIconDirective;
|
|
29569
29643
|
exports["ɵe"] = isFocusableElement;
|
|
29570
29644
|
exports["ɵf"] = MatBadgeIconTestPage;
|
|
29571
|
-
exports["ɵg"] =
|
|
29572
|
-
exports["ɵh"] =
|
|
29573
|
-
exports["ɵi"] =
|
|
29574
|
-
exports["ɵj"] =
|
|
29575
|
-
exports["ɵk"] =
|
|
29576
|
-
exports["ɵl"] =
|
|
29645
|
+
exports["ɵg"] = ToastTestingModule;
|
|
29646
|
+
exports["ɵh"] = ToastTestingPage;
|
|
29647
|
+
exports["ɵi"] = RegisterForm;
|
|
29648
|
+
exports["ɵj"] = AccountValidatorService;
|
|
29649
|
+
exports["ɵk"] = RegisterModal;
|
|
29650
|
+
exports["ɵl"] = UserSettingsValidatorService;
|
|
29651
|
+
exports["ɵm"] = LocalSettingsValidatorService;
|
|
29652
|
+
exports["ɵn"] = AppIconComponent;
|
|
29577
29653
|
|
|
29578
29654
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
29579
29655
|
|