@sumaris-net/ngx-components 1.9.2 → 1.9.5
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 +231 -185
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +8 -3
- package/esm2015/src/app/core/account/account.js +2 -2
- package/esm2015/src/app/core/form/entity-editor.class.js +18 -9
- package/esm2015/src/app/core/graphql/graphql.service.js +1 -3
- package/esm2015/src/app/core/register/confirm/confirm.js +2 -2
- package/esm2015/src/app/core/services/account.service.js +92 -63
- package/esm2015/src/app/core/table/table.class.js +4 -4
- package/esm2015/src/environments/environment.class.js +1 -1
- package/esm2015/src/environments/environment.js +8 -3
- package/fesm2015/sumaris-net.ngx-components.js +116 -75
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +3 -2
- package/src/app/core/services/account.service.d.ts +10 -4
- package/src/environments/environment.class.d.ts +7 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2,4 +2,4 @@ import { InjectionToken } from '@angular/core';
|
|
|
2
2
|
export const ENVIRONMENT = new InjectionToken('ENV');
|
|
3
3
|
export class Environment {
|
|
4
4
|
}
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW52aXJvbm1lbnQuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvZW52aXJvbm1lbnRzL2Vudmlyb25tZW50LmNsYXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBT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EFjY291bnRcbiAgYWNjb3VudD86IHtcbiAgICBlbmFibGVMaXN0ZW5DaGFuZ2VzPzogYm9vbGVhbjtcbiAgICAvLyBJZiB1bmRlZmluZWQgb3IgMCwgdGhlbiBsaXN0ZW4gb25seSBjaGFuZ2VzIG1hZGUgYnkgdGhlIHBvZFxuICAgIC8vIElmIGdyZWF0ZXIgdGhhbiAwIDogd2lsbCBjaGVjayBjb25jdXJyZW50IGNoYW5nZXMgaW4gdGhlIERCIChlLmcuIGNoYW5nZXMgbWRlIGJ5IGFub3RoZXIgc29mdHdhcmUpIEFORCBjaGFuZ2VzIG1hZGUgdGhlIHBvZFxuICAgIGxpc3RlbkludGVydmFsSW5TZWNvbmQ/OiBudW1iZXI7XG4gIH07XG5cbiAgZW50aXR5RWRpdG9yPzoge1xuICAgIGVuYWJsZUxpc3RlbkNoYW5nZXM/OiBib29sZWFuO1xuICB9O1xuXG59XG4iXX0=
|
|
@@ -9,8 +9,6 @@ export const environment = Object.freeze({
|
|
|
9
9
|
defaultLocale: 'fr',
|
|
10
10
|
defaultLatLongFormat: 'DDMM',
|
|
11
11
|
apolloFetchPolicy: 'cache-first',
|
|
12
|
-
// FIXME: GraphQL subscription never unsubscribe...
|
|
13
|
-
listenRemoteChanges: false,
|
|
14
12
|
// FIXME: enable cache
|
|
15
13
|
persistCache: false,
|
|
16
14
|
// TODO: make this works
|
|
@@ -63,6 +61,13 @@ export const environment = Object.freeze({
|
|
|
63
61
|
// username: 'admq2', password: 'q22006'
|
|
64
62
|
// Token auth (using Person.pubkey)
|
|
65
63
|
username: 'admin@sumaris.net', password: 'admin',
|
|
64
|
+
},
|
|
65
|
+
account: {
|
|
66
|
+
enableListenChanges: true,
|
|
67
|
+
listenIntervalInSecond: 30
|
|
68
|
+
},
|
|
69
|
+
entityEditor: {
|
|
70
|
+
enableListenChanges: false
|
|
66
71
|
}
|
|
67
72
|
});
|
|
68
73
|
/*
|
|
@@ -72,4 +77,4 @@ export const environment = Object.freeze({
|
|
|
72
77
|
* because it will have performance impact when throw error
|
|
73
78
|
*/
|
|
74
79
|
import 'zone.js/dist/zone-error';
|
|
75
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
80
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW52aXJvbm1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvZW52aXJvbm1lbnRzL2Vudmlyb25tZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGdGQUFnRjtBQUNoRiwyRUFBMkU7QUFDM0UsZ0VBQWdFO0FBSWhFLE1BQU0sQ0FBQyxNQUFNLFdBQVcsR0FBZ0IsTUFBTSxDQUFDLE1BQU0sQ0FBQztJQUNwRCxJQUFJLEVBQUUsNkJBQTZCO0lBQ25DLE9BQU8sRUFBRSxTQUFTO0lBQ2xCLFVBQVUsRUFBRSxJQUFJO0lBQ2hCLE9BQU8sRUFBRSxHQUFHO0lBQ1osYUFBYSxFQUFFLElBQUk7SUFDbkIsb0JBQW9CLEVBQUUsTUFBTTtJQUM1QixpQkFBaUIsRUFBRSxhQUFhO0lBRWhDLHNCQUFzQjtJQUN0QixZQUFZLEVBQUUsS0FBSztJQUVuQix3QkFBd0I7SUFDeEIsZ0JBQWdCO0lBRWhCLGNBQWMsRUFBRSxPQUFPO0lBRXZCLFlBQVksRUFBRTtRQUNaO1lBQ0UsSUFBSSxFQUFFLFdBQVc7WUFDakIsSUFBSSxFQUFFLElBQUk7U0FDWDtRQUNEO1lBQ0UsSUFBSSxFQUFFLFdBQVc7WUFDakIsSUFBSSxFQUFFLElBQUk7U0FDWDtRQUNEO1lBQ0UsSUFBSSxFQUFFLGNBQWM7WUFDcEIsSUFBSSxFQUFFLElBQUk7U0FDWDtRQUNEO1lBQ0UsSUFBSSxFQUFFLGNBQWM7WUFDcEIsSUFBSSxFQUFFLElBQUk7U0FDWDtRQUNEO1lBQ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WVycm9yJztcbiJdfQ==
|
|
@@ -9440,8 +9440,6 @@ const environment = Object.freeze({
|
|
|
9440
9440
|
defaultLocale: 'fr',
|
|
9441
9441
|
defaultLatLongFormat: 'DDMM',
|
|
9442
9442
|
apolloFetchPolicy: 'cache-first',
|
|
9443
|
-
// FIXME: GraphQL subscription never unsubscribe...
|
|
9444
|
-
listenRemoteChanges: false,
|
|
9445
9443
|
// FIXME: enable cache
|
|
9446
9444
|
persistCache: false,
|
|
9447
9445
|
// TODO: make this works
|
|
@@ -9494,6 +9492,13 @@ const environment = Object.freeze({
|
|
|
9494
9492
|
// username: 'admq2', password: 'q22006'
|
|
9495
9493
|
// Token auth (using Person.pubkey)
|
|
9496
9494
|
username: 'admin@sumaris.net', password: 'admin',
|
|
9495
|
+
},
|
|
9496
|
+
account: {
|
|
9497
|
+
enableListenChanges: true,
|
|
9498
|
+
listenIntervalInSecond: 30
|
|
9499
|
+
},
|
|
9500
|
+
entityEditor: {
|
|
9501
|
+
enableListenChanges: false
|
|
9497
9502
|
}
|
|
9498
9503
|
});
|
|
9499
9504
|
|
|
@@ -13022,8 +13027,6 @@ class GraphqlService extends StartableService {
|
|
|
13022
13027
|
}
|
|
13023
13028
|
const headers = new HttpHeaders()
|
|
13024
13029
|
.append('Authorization', authorization);
|
|
13025
|
-
//.append('X-App-Name', environment.name)
|
|
13026
|
-
//.append('X-App-Version', environment.version)
|
|
13027
13030
|
// Use the setContext method to set the HTTP headers.
|
|
13028
13031
|
operation.setContext(Object.assign(Object.assign({}, operation.getContext()), { headers }));
|
|
13029
13032
|
// Call the next link in the middleware chain.
|
|
@@ -13590,7 +13593,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
13590
13593
|
this.onChange = new Subject();
|
|
13591
13594
|
this.onAuthTokenChange = new Subject();
|
|
13592
13595
|
this.onAuthBasicChange = new Subject();
|
|
13593
|
-
this.
|
|
13596
|
+
this._listenChangesSubscription = null;
|
|
13594
13597
|
this._cache = {
|
|
13595
13598
|
loaded: false,
|
|
13596
13599
|
keypair: null,
|
|
@@ -13603,6 +13606,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
13603
13606
|
};
|
|
13604
13607
|
this._$additionalFields = new BehaviorSubject([]);
|
|
13605
13608
|
this._tokenType$ = new BehaviorSubject(undefined);
|
|
13609
|
+
this._enableListenChanges = (!environment.account || environment.account.enableListenChanges !== false);
|
|
13606
13610
|
this._debug = !environment.production;
|
|
13607
13611
|
if (this._debug)
|
|
13608
13612
|
console.debug('[account-service] Creating service');
|
|
@@ -13790,6 +13794,9 @@ class AccountService extends BaseGraphqlService {
|
|
|
13790
13794
|
// Emit events
|
|
13791
13795
|
this.onLogin.next(this._data);
|
|
13792
13796
|
this.onChange.next(this._data);
|
|
13797
|
+
// Listen remote changes
|
|
13798
|
+
if (this._enableListenChanges)
|
|
13799
|
+
this.startListenChanges();
|
|
13793
13800
|
return this._data;
|
|
13794
13801
|
}
|
|
13795
13802
|
catch (error) {
|
|
@@ -13913,18 +13920,22 @@ class AccountService extends BaseGraphqlService {
|
|
|
13913
13920
|
// Emit event to observers
|
|
13914
13921
|
this.onLogin.next(this._data);
|
|
13915
13922
|
this.onChange.next(this._data);
|
|
13923
|
+
if (this._enableListenChanges)
|
|
13924
|
+
this.startListenChanges();
|
|
13916
13925
|
return this._data;
|
|
13917
13926
|
});
|
|
13918
13927
|
}
|
|
13919
|
-
|
|
13928
|
+
reload() {
|
|
13920
13929
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13921
13930
|
if (!this._cache.pubkey)
|
|
13922
13931
|
throw new Error('User not logged');
|
|
13923
13932
|
if (this.network.offline)
|
|
13924
13933
|
throw new Error('Cannot check account in offline mode');
|
|
13934
|
+
const now = Date.now();
|
|
13935
|
+
console.debug(`[account] Reloading account...`);
|
|
13925
13936
|
yield this.loadData();
|
|
13926
13937
|
yield this.saveLocally();
|
|
13927
|
-
console.debug(
|
|
13938
|
+
console.debug(`[account] Reloading account [OK] in ${Date.now() - now}ms`);
|
|
13928
13939
|
// Emit login event to subscribers
|
|
13929
13940
|
this.onLogin.next(this._data);
|
|
13930
13941
|
this.onChange.next(this._data);
|
|
@@ -13993,7 +14004,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
13993
14004
|
if (hadAuthBasic)
|
|
13994
14005
|
this.onAuthBasicChange.next(undefined);
|
|
13995
14006
|
this.onChange.next(undefined);
|
|
13996
|
-
this.
|
|
14007
|
+
this.stopListenChanges();
|
|
13997
14008
|
});
|
|
13998
14009
|
}
|
|
13999
14010
|
/**
|
|
@@ -14110,60 +14121,10 @@ class AccountService extends BaseGraphqlService {
|
|
|
14110
14121
|
return res && res.confirmAccountEmail;
|
|
14111
14122
|
});
|
|
14112
14123
|
}
|
|
14113
|
-
|
|
14114
|
-
if (
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
// Wait service ready, then loop
|
|
14118
|
-
return from(this.ready())
|
|
14119
|
-
.pipe(switchMap(() => this.watch()));
|
|
14120
|
-
}
|
|
14121
|
-
this._stopWatching$.next(); // Stop previous listening
|
|
14122
|
-
console.debug('[account] [WS] Watching changes');
|
|
14123
|
-
return this.graphql.subscribe({
|
|
14124
|
-
query: AccountSubscriptions.listenChanges,
|
|
14125
|
-
variables: {
|
|
14126
|
-
interval: 10
|
|
14127
|
-
},
|
|
14128
|
-
error: {
|
|
14129
|
-
code: ErrorCodes$2.SUBSCRIBE_ACCOUNT_ERROR,
|
|
14130
|
-
message: 'ERROR.ACCOUNT.SUBSCRIBE_ACCOUNT_ERROR'
|
|
14131
|
-
}
|
|
14132
|
-
})
|
|
14133
|
-
.pipe(
|
|
14134
|
-
// Stop this pipe next time we call watch()
|
|
14135
|
-
takeUntil(this._stopWatching$), map(({ data }) => {
|
|
14136
|
-
var _a;
|
|
14137
|
-
if (!data)
|
|
14138
|
-
return;
|
|
14139
|
-
const existingUpdateDate = toDateISOString((_a = this._data) === null || _a === void 0 ? void 0 : _a.updateDate);
|
|
14140
|
-
if (existingUpdateDate === data.updateDate)
|
|
14141
|
-
return;
|
|
14142
|
-
console.debug(`[account] [WS] Detected update on {${data.updateDate}}`);
|
|
14143
|
-
return Account.fromObject(data);
|
|
14144
|
-
}), filter(isNotNil));
|
|
14145
|
-
}
|
|
14146
|
-
listenChanges() {
|
|
14147
|
-
const self = this;
|
|
14148
|
-
const subscription = this.watch()
|
|
14149
|
-
.subscribe({
|
|
14150
|
-
next: (data) => self.refresh(),
|
|
14151
|
-
error: (err) => {
|
|
14152
|
-
if (err && +err.code === ServerErrorCodes.NOT_FOUND) {
|
|
14153
|
-
console.info('[account] Account not exists anymore: force user to logout...', err);
|
|
14154
|
-
self.logout();
|
|
14155
|
-
}
|
|
14156
|
-
else if (err && +err.code === ServerErrorCodes.UNAUTHORIZED) {
|
|
14157
|
-
console.info('[account] Account not authorized: force user to logout...', err);
|
|
14158
|
-
self.logout();
|
|
14159
|
-
}
|
|
14160
|
-
else {
|
|
14161
|
-
console.warn('[account] [WS] Received error:', err);
|
|
14162
|
-
}
|
|
14163
|
-
}
|
|
14164
|
-
});
|
|
14165
|
-
subscription.add(() => console.debug('[account] [WS] Stop listening changes'));
|
|
14166
|
-
return subscription;
|
|
14124
|
+
listenChanges(opts) {
|
|
14125
|
+
if (this._enableListenChanges)
|
|
14126
|
+
return new Subscription(); // Already started: skip
|
|
14127
|
+
return this.startListenChanges(opts);
|
|
14167
14128
|
}
|
|
14168
14129
|
get additionalFields() {
|
|
14169
14130
|
return this._$additionalFields.getValue();
|
|
@@ -14185,6 +14146,7 @@ class AccountService extends BaseGraphqlService {
|
|
|
14185
14146
|
}
|
|
14186
14147
|
/* -- protected method -- */
|
|
14187
14148
|
resetData() {
|
|
14149
|
+
this.stopListenChanges();
|
|
14188
14150
|
this._cache.loaded = false;
|
|
14189
14151
|
this._cache.keypair = null;
|
|
14190
14152
|
this._cache.authToken = null;
|
|
@@ -14312,6 +14274,8 @@ class AccountService extends BaseGraphqlService {
|
|
|
14312
14274
|
// Emit event
|
|
14313
14275
|
this.onLogin.next(this._data);
|
|
14314
14276
|
this.onChange.next(this._data);
|
|
14277
|
+
if (this._enableListenChanges)
|
|
14278
|
+
this.startListenChanges();
|
|
14315
14279
|
if (this._debug)
|
|
14316
14280
|
console.debug(`[account] Account restoration [OK] {pubkey: ${pubkey.substr(0, 8)}}, {profile: ${this._cache.mainProfile}}`);
|
|
14317
14281
|
return account;
|
|
@@ -14511,6 +14475,74 @@ class AccountService extends BaseGraphqlService {
|
|
|
14511
14475
|
return yield this.authenticateAndGetToken(newToken, (counter || 1) + 1 /* increment */);
|
|
14512
14476
|
});
|
|
14513
14477
|
}
|
|
14478
|
+
startListenChanges(opts) {
|
|
14479
|
+
if (this._listenChangesSubscription)
|
|
14480
|
+
this.stopListenChanges(); // Stop previous subscription
|
|
14481
|
+
if (this.network.offline)
|
|
14482
|
+
return new Subscription(); // Offline: skip
|
|
14483
|
+
const subscription = this.watchChanges(opts)
|
|
14484
|
+
.subscribe({
|
|
14485
|
+
next: (data) => {
|
|
14486
|
+
console.debug(`[account] Remote update detected at ${data.updateDate}`);
|
|
14487
|
+
this.reload();
|
|
14488
|
+
},
|
|
14489
|
+
error: (err) => {
|
|
14490
|
+
if (err && +err.code === ServerErrorCodes.NOT_FOUND) {
|
|
14491
|
+
console.info('[account] [WS] Account not exists anymore: force user to logout...', err);
|
|
14492
|
+
this.logout();
|
|
14493
|
+
}
|
|
14494
|
+
else if (err && +err.code === ServerErrorCodes.UNAUTHORIZED) {
|
|
14495
|
+
console.info('[account] [WS] Account not authorized: force user to logout...', err);
|
|
14496
|
+
this.logout();
|
|
14497
|
+
}
|
|
14498
|
+
else {
|
|
14499
|
+
console.warn('[account] [WS] Received error:', err);
|
|
14500
|
+
}
|
|
14501
|
+
}
|
|
14502
|
+
});
|
|
14503
|
+
// Add close log
|
|
14504
|
+
subscription.add(() => console.debug(`[account] Stop watching remote changes`));
|
|
14505
|
+
this._listenChangesSubscription = subscription;
|
|
14506
|
+
// Make sure to use the stop function, when unsubscribe
|
|
14507
|
+
return new Subscription(() => this.stopListenChanges());
|
|
14508
|
+
}
|
|
14509
|
+
stopListenChanges() {
|
|
14510
|
+
if (this._listenChangesSubscription) {
|
|
14511
|
+
this._listenChangesSubscription.unsubscribe();
|
|
14512
|
+
this._listenChangesSubscription = null;
|
|
14513
|
+
}
|
|
14514
|
+
}
|
|
14515
|
+
watchChanges(opts) {
|
|
14516
|
+
var _a;
|
|
14517
|
+
if (!this.started) {
|
|
14518
|
+
// Wait service ready, then loop
|
|
14519
|
+
return from(this.ready())
|
|
14520
|
+
.pipe(switchMap(() => this.watchChanges(opts)));
|
|
14521
|
+
}
|
|
14522
|
+
if (!this._cache.pubkey)
|
|
14523
|
+
throw new Error('Not logged in');
|
|
14524
|
+
if (this.network.offline)
|
|
14525
|
+
throw new Error('Cannot watch account changes: network is offline.');
|
|
14526
|
+
const variables = {
|
|
14527
|
+
interval: Math.max(0, (opts === null || opts === void 0 ? void 0 : opts.intervalInSecond) || ((_a = this.environment.account) === null || _a === void 0 ? void 0 : _a.listenIntervalInSecond) || 0)
|
|
14528
|
+
};
|
|
14529
|
+
console.debug(`[account] Watching remote changes, every ${variables.interval}s`);
|
|
14530
|
+
return this.graphql.subscribe({
|
|
14531
|
+
query: AccountSubscriptions.listenChanges,
|
|
14532
|
+
variables,
|
|
14533
|
+
error: {
|
|
14534
|
+
code: ErrorCodes$2.SUBSCRIBE_ACCOUNT_ERROR,
|
|
14535
|
+
message: 'ERROR.ACCOUNT.SUBSCRIBE_ACCOUNT_ERROR'
|
|
14536
|
+
}
|
|
14537
|
+
}).pipe(map(({ data }) => data),
|
|
14538
|
+
// Keep only if newer
|
|
14539
|
+
filter(data => {
|
|
14540
|
+
var _a;
|
|
14541
|
+
const currentUpdateDate = fromDateISOString((_a = this._data) === null || _a === void 0 ? void 0 : _a.updateDate);
|
|
14542
|
+
const remoteUpdateDate = fromDateISOString(data === null || data === void 0 ? void 0 : data.updateDate);
|
|
14543
|
+
return (remoteUpdateDate && (!currentUpdateDate || !remoteUpdateDate.isSame(currentUpdateDate, 'millisecond')));
|
|
14544
|
+
}));
|
|
14545
|
+
}
|
|
14514
14546
|
copyIdAndUpdateDate(source, target) {
|
|
14515
14547
|
if (!source)
|
|
14516
14548
|
return;
|
|
@@ -18210,7 +18242,7 @@ class RegisterConfirmPage {
|
|
|
18210
18242
|
// Send the confirmation code
|
|
18211
18243
|
const confirmed = yield this.accountService.confirmEmail(email, code);
|
|
18212
18244
|
if (confirmed && this.isLogin) {
|
|
18213
|
-
yield this.accountService.
|
|
18245
|
+
yield this.accountService.reload();
|
|
18214
18246
|
}
|
|
18215
18247
|
this.loading = false;
|
|
18216
18248
|
//this.location.replaceState("/confirm/" + email + "/");
|
|
@@ -18441,7 +18473,7 @@ class AccountPage extends AppForm {
|
|
|
18441
18473
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18442
18474
|
this.disable();
|
|
18443
18475
|
this.markAsLoading();
|
|
18444
|
-
return this.accountService.
|
|
18476
|
+
return this.accountService.reload();
|
|
18445
18477
|
});
|
|
18446
18478
|
}
|
|
18447
18479
|
startListenChanges() {
|
|
@@ -21935,7 +21967,7 @@ class AppTable {
|
|
|
21935
21967
|
return true;
|
|
21936
21968
|
}
|
|
21937
21969
|
save(opts) {
|
|
21938
|
-
var _a, _b;
|
|
21970
|
+
var _a, _b, _c, _d;
|
|
21939
21971
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21940
21972
|
opts = Object.assign({ keepEditing: this.keepEditedRowOnSave }, opts);
|
|
21941
21973
|
if (this.readOnly) {
|
|
@@ -21943,8 +21975,8 @@ class AppTable {
|
|
|
21943
21975
|
}
|
|
21944
21976
|
this.resetError();
|
|
21945
21977
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
21946
|
-
this.previouslyEditedRowId = opts.keepEditing && ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined;
|
|
21947
|
-
const previouslyEditedData = isNotNil(this.previouslyEditedRowId) && this.editedRow.currentData || ((
|
|
21978
|
+
this.previouslyEditedRowId = opts.keepEditing && ((((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.id));
|
|
21979
|
+
const previouslyEditedData = isNotNil(this.previouslyEditedRowId) && ((_c = this.editedRow) === null || _c === void 0 ? void 0 : _c.currentData) || ((_d = this.singleSelectedRow) === null || _d === void 0 ? void 0 : _d.currentData);
|
|
21948
21980
|
if (!this.confirmEditCreate()) {
|
|
21949
21981
|
throw { code: ErrorCodes$2.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
21950
21982
|
}
|
|
@@ -23443,16 +23475,16 @@ class AppEditorOptions extends AppTabEditorOptions {
|
|
|
23443
23475
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
23444
23476
|
class AppEntityEditor extends AppTabEditor {
|
|
23445
23477
|
constructor(injector, dataType, dataService, options) {
|
|
23478
|
+
var _a;
|
|
23446
23479
|
super(injector.get(ActivatedRoute), injector.get(Router), injector.get(AlertController), injector.get(TranslateService), options);
|
|
23447
23480
|
this.dataType = dataType;
|
|
23448
23481
|
this.dataService = dataService;
|
|
23449
23482
|
this.saving = false;
|
|
23450
|
-
this.hasRemoteListener = false;
|
|
23451
23483
|
this.$title = new Subject();
|
|
23452
23484
|
this.onUpdateView = new EventEmitter();
|
|
23453
23485
|
options = Object.assign({
|
|
23454
23486
|
// Default options
|
|
23455
|
-
enableListenChanges: (injector.get(ENVIRONMENT).
|
|
23487
|
+
enableListenChanges: (((_a = injector.get(ENVIRONMENT).entityEditor) === null || _a === void 0 ? void 0 : _a.enableListenChanges) === true), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: '' }, options);
|
|
23456
23488
|
this.settings = injector.get(LocalSettingsService);
|
|
23457
23489
|
this.errorTranslator = injector.get(FormErrorTranslator);
|
|
23458
23490
|
this.cd = injector.get(ChangeDetectorRef);
|
|
@@ -23526,6 +23558,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23526
23558
|
}
|
|
23527
23559
|
ngOnDestroy() {
|
|
23528
23560
|
super.ngOnDestroy();
|
|
23561
|
+
this.listenRemoteSubscription = null; // already unsubscribe in the super function
|
|
23529
23562
|
this.$title.complete();
|
|
23530
23563
|
this.$title.unsubscribe();
|
|
23531
23564
|
this.onUpdateView.complete();
|
|
@@ -23604,11 +23637,10 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23604
23637
|
}
|
|
23605
23638
|
startListenRemoteChanges() {
|
|
23606
23639
|
// Skip if disable, or already listening
|
|
23607
|
-
if (this.
|
|
23640
|
+
if (this.listenRemoteSubscription || !this._enableListenChanges || this.isNewData)
|
|
23608
23641
|
return;
|
|
23609
23642
|
// Listen for changes on server
|
|
23610
|
-
this.
|
|
23611
|
-
this.registerSubscription(this.dataService.listenChanges(this.data.id)
|
|
23643
|
+
this.listenRemoteSubscription = this.dataService.listenChanges(this.data.id)
|
|
23612
23644
|
.pipe(filter(isNotNil))
|
|
23613
23645
|
.subscribe((data) => {
|
|
23614
23646
|
if (data.updateDate && data.updateDate.isAfter(this.data.updateDate)) {
|
|
@@ -23622,8 +23654,16 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23622
23654
|
console.debug(`[data-editor] Changes detected on server, at {${data.updateDate}}, but page is dirty: skip reloading.`);
|
|
23623
23655
|
}
|
|
23624
23656
|
}
|
|
23625
|
-
})
|
|
23626
|
-
|
|
23657
|
+
});
|
|
23658
|
+
this.listenRemoteSubscription.add(() => this.listenRemoteSubscription = null);
|
|
23659
|
+
this.registerSubscription(this.listenRemoteSubscription);
|
|
23660
|
+
}
|
|
23661
|
+
stopListenRemoteChanges() {
|
|
23662
|
+
if (this.listenRemoteSubscription) {
|
|
23663
|
+
this.unregisterSubscription(this.listenRemoteSubscription);
|
|
23664
|
+
this.listenRemoteSubscription.unsubscribe();
|
|
23665
|
+
this.listenRemoteSubscription = null;
|
|
23666
|
+
}
|
|
23627
23667
|
}
|
|
23628
23668
|
updateView(data, opts) {
|
|
23629
23669
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -23767,7 +23807,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23767
23807
|
// Update the view (e.g metadata)
|
|
23768
23808
|
yield this.updateView(updatedData, opts);
|
|
23769
23809
|
// Subscribe to remote changes
|
|
23770
|
-
if (!this.
|
|
23810
|
+
if (!this.listenRemoteSubscription)
|
|
23771
23811
|
this.startListenRemoteChanges();
|
|
23772
23812
|
this.submitted = false;
|
|
23773
23813
|
return true;
|
|
@@ -23922,6 +23962,7 @@ class AppEntityEditor extends AppTabEditor {
|
|
|
23922
23962
|
}
|
|
23923
23963
|
unload() {
|
|
23924
23964
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23965
|
+
this.stopListenRemoteChanges();
|
|
23925
23966
|
this.form.reset();
|
|
23926
23967
|
this.registerForms();
|
|
23927
23968
|
this._dirty = false;
|