@sumaris-net/ngx-components 1.22.11-rc1 → 1.22.11-rc10
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 +695 -27
- 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/esm2015/public_api.js +10 -1
- package/esm2015/src/app/shared/events.js +8 -3
- package/esm2015/src/app/shared/services/entity-service.class.js +1 -1
- package/esm2015/src/app/social/job/testing/job-progression.testing.js +48 -0
- package/esm2015/src/app/social/job/testing/job-progression.testing.service.js +30 -0
- package/esm2015/src/app/social/job/testing/job.testing.module.js +25 -0
- package/esm2015/src/app/social/social.module.js +1 -1
- package/esm2015/src/app/social/social.testing.module.js +39 -0
- package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +2 -2
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +118 -19
- package/esm2015/src/app/social/user-event/testing/user-event.testing.js +179 -0
- package/esm2015/src/app/social/user-event/testing/user-event.testing.module.js +25 -0
- package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +30 -4
- package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
- package/esm2015/src/app/social/user-event/user-event.service.js +67 -10
- package/fesm2015/sumaris-net.ngx-components.js +593 -30
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +7 -0
- package/src/app/shared/events.d.ts +1 -1
- package/src/app/shared/services/entity-service.class.d.ts +7 -0
- package/src/app/social/job/testing/job-progression.testing.d.ts +11 -0
- package/src/app/social/job/testing/job-progression.testing.service.d.ts +10 -0
- package/src/app/social/job/testing/job.testing.module.d.ts +2 -0
- package/src/app/social/social.testing.module.d.ts +4 -0
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +37 -12
- package/src/app/social/user-event/testing/user-event.testing.d.ts +23 -0
- package/src/app/social/user-event/testing/user-event.testing.module.d.ts +2 -0
- package/src/app/social/user-event/testing/user-event.testing.service.d.ts +4 -3
- package/src/app/social/user-event/user-event.model.d.ts +1 -0
- package/src/app/social/user-event/user-event.service.d.ts +12 -8
- package/src/theme/_ngx-components.scss +12 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -1151,7 +1151,7 @@
|
|
|
1151
1151
|
* @param element
|
|
1152
1152
|
* @param threshold default to '15%'
|
|
1153
1153
|
*/
|
|
1154
|
-
function fromScrollEndEvent(element, threshold) {
|
|
1154
|
+
function fromScrollEndEvent(element, threshold, dueTime) {
|
|
1155
1155
|
threshold = threshold || '15%';
|
|
1156
1156
|
var isEnd;
|
|
1157
1157
|
// Listen using percentage
|
|
@@ -1173,6 +1173,11 @@
|
|
|
1173
1173
|
else {
|
|
1174
1174
|
throw new Error('Invalid argument \'threshold\'. Expected value unit: \'px\' or \'%\' ');
|
|
1175
1175
|
}
|
|
1176
|
+
// Check bottom reach, even if NO scroll event (e.g. when already reach the bottom)
|
|
1177
|
+
if (dueTime > 0) {
|
|
1178
|
+
return rxjs.merge(rxjs.fromEvent(element, 'scroll'), rxjs.timer(dueTime))
|
|
1179
|
+
.pipe(operators.filter(function () { return isEnd(); }));
|
|
1180
|
+
}
|
|
1176
1181
|
return rxjs.fromEvent(element, 'scroll')
|
|
1177
1182
|
.pipe(operators.filter(function () { return isEnd(); }));
|
|
1178
1183
|
}
|
|
@@ -30289,7 +30294,7 @@
|
|
|
30289
30294
|
AbstractUserEventService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
|
|
30290
30295
|
return this.watchPage({ offset: offset, size: size, sortBy: sortBy, sortDirection: sortDirection }, filter, options);
|
|
30291
30296
|
};
|
|
30292
|
-
AbstractUserEventService.prototype.watchPage = function (page, filter,
|
|
30297
|
+
AbstractUserEventService.prototype.watchPage = function (page, filter, opts) {
|
|
30293
30298
|
var _this = this;
|
|
30294
30299
|
var _a;
|
|
30295
30300
|
var now = this._debug && Date.now();
|
|
@@ -30306,7 +30311,7 @@
|
|
|
30306
30311
|
filter.recipients = [recipient];
|
|
30307
30312
|
}
|
|
30308
30313
|
}
|
|
30309
|
-
var withContent = (
|
|
30314
|
+
var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
|
|
30310
30315
|
return this.mutableWatchQuery({
|
|
30311
30316
|
queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
|
|
30312
30317
|
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
@@ -30319,7 +30324,8 @@
|
|
|
30319
30324
|
},
|
|
30320
30325
|
arrayFieldName: 'data',
|
|
30321
30326
|
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30322
|
-
fetchPolicy: (
|
|
30327
|
+
fetchPolicy: (opts === null || opts === void 0 ? void 0 : opts.fetchPolicy) || 'cache-first',
|
|
30328
|
+
insertFilterFn: filter && filter.asFilterFn()
|
|
30323
30329
|
})
|
|
30324
30330
|
.pipe(operators.map(function (res) {
|
|
30325
30331
|
var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
|
|
@@ -30327,14 +30333,79 @@
|
|
|
30327
30333
|
console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30328
30334
|
now = null;
|
|
30329
30335
|
}
|
|
30330
|
-
// Must re-order because of
|
|
30336
|
+
// Must re-order because of listenAllChanges result will add new event at the end
|
|
30331
30337
|
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30332
|
-
|
|
30338
|
+
var result = {
|
|
30333
30339
|
data: data,
|
|
30334
30340
|
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30335
30341
|
};
|
|
30342
|
+
// Add fetch more capability, if total was fetched
|
|
30343
|
+
if (isNotNil(res.total)) {
|
|
30344
|
+
var nextOffset_1 = (page.offset || 0) + data.length;
|
|
30345
|
+
if (nextOffset_1 < result.total) {
|
|
30346
|
+
result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
30347
|
+
}
|
|
30348
|
+
}
|
|
30349
|
+
return result;
|
|
30336
30350
|
}));
|
|
30337
30351
|
};
|
|
30352
|
+
AbstractUserEventService.prototype.loadPage = function (page, filter, opts) {
|
|
30353
|
+
var _a;
|
|
30354
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30355
|
+
var now, recipient, withContent, res, data, result, nextOffset_2;
|
|
30356
|
+
var _this = this;
|
|
30357
|
+
return __generator(this, function (_b) {
|
|
30358
|
+
switch (_b.label) {
|
|
30359
|
+
case 0:
|
|
30360
|
+
now = this._debug && Date.now();
|
|
30361
|
+
if (!filter)
|
|
30362
|
+
filter = this.defaultFilter();
|
|
30363
|
+
console.debug(this._logPrefix + "Loading user events...", filter);
|
|
30364
|
+
filter = this.asFilter(filter);
|
|
30365
|
+
// Force recipient to current issuer, if not admin and not specified
|
|
30366
|
+
if (isEmptyArray(filter === null || filter === void 0 ? void 0 : filter.recipients) || !this.accountService.isAdmin()) {
|
|
30367
|
+
recipient = this.defaultRecipient();
|
|
30368
|
+
if (!((_a = filter === null || filter === void 0 ? void 0 : filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
|
|
30369
|
+
console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
|
|
30370
|
+
filter.recipients = [recipient];
|
|
30371
|
+
}
|
|
30372
|
+
}
|
|
30373
|
+
withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
|
|
30374
|
+
return [4 /*yield*/, this.graphql.query({
|
|
30375
|
+
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
30376
|
+
variables: {
|
|
30377
|
+
page: Object.assign(Object.assign({ sortBy: 'creationDate' }, page), {
|
|
30378
|
+
// @ts-ignore
|
|
30379
|
+
sortDirection: (page.sortDirection || 'desc').toUpperCase()
|
|
30380
|
+
}),
|
|
30381
|
+
filter: filter && filter.asPodObject()
|
|
30382
|
+
},
|
|
30383
|
+
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30384
|
+
fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy
|
|
30385
|
+
})];
|
|
30386
|
+
case 1:
|
|
30387
|
+
res = _b.sent();
|
|
30388
|
+
data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
|
|
30389
|
+
if (now)
|
|
30390
|
+
console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30391
|
+
// Must re-order because of listenAllChanges result will add new event at the end
|
|
30392
|
+
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30393
|
+
result = {
|
|
30394
|
+
data: data,
|
|
30395
|
+
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30396
|
+
};
|
|
30397
|
+
// Add fetch more capability, if total was fetched
|
|
30398
|
+
if (isNotNil(res.total)) {
|
|
30399
|
+
nextOffset_2 = (page.offset || 0) + data.length;
|
|
30400
|
+
if (nextOffset_2 < result.total) {
|
|
30401
|
+
result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_2 }), filter, opts); };
|
|
30402
|
+
}
|
|
30403
|
+
}
|
|
30404
|
+
return [2 /*return*/, result];
|
|
30405
|
+
}
|
|
30406
|
+
});
|
|
30407
|
+
});
|
|
30408
|
+
};
|
|
30338
30409
|
AbstractUserEventService.prototype.add = function (entity) {
|
|
30339
30410
|
// TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
|
|
30340
30411
|
entity = this.processUserEvent(entity);
|
|
@@ -30391,6 +30462,7 @@
|
|
|
30391
30462
|
filter = this.defaultFilter();
|
|
30392
30463
|
// Apply last reset date as start date
|
|
30393
30464
|
filter.startDate = this.resetCountDate;
|
|
30465
|
+
filter.excludeRead = true;
|
|
30394
30466
|
filter = this.asFilter(filter);
|
|
30395
30467
|
if (this._debug)
|
|
30396
30468
|
console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
|
|
@@ -30411,11 +30483,11 @@
|
|
|
30411
30483
|
return total;
|
|
30412
30484
|
}));
|
|
30413
30485
|
};
|
|
30414
|
-
AbstractUserEventService.prototype.
|
|
30486
|
+
AbstractUserEventService.prototype.listenAllChanges = function (filter, options) {
|
|
30415
30487
|
var _this = this;
|
|
30416
30488
|
var _a;
|
|
30417
|
-
if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.
|
|
30418
|
-
console.warn(this._logPrefix + "Subscription query '
|
|
30489
|
+
if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenAllChanges)) {
|
|
30490
|
+
console.warn(this._logPrefix + "Subscription query 'listenAllChanges' not provided, skip.");
|
|
30419
30491
|
return rxjs.of();
|
|
30420
30492
|
}
|
|
30421
30493
|
if (!filter)
|
|
@@ -30425,7 +30497,7 @@
|
|
|
30425
30497
|
if (this._debug)
|
|
30426
30498
|
console.debug(this._logPrefix + "[WS] Listening changes for user events with filter:", filter);
|
|
30427
30499
|
return this.graphql.subscribe({
|
|
30428
|
-
query: this.subscriptions.
|
|
30500
|
+
query: this.subscriptions.listenAllChanges,
|
|
30429
30501
|
fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
|
|
30430
30502
|
variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
|
|
30431
30503
|
error: {
|
|
@@ -30805,28 +30877,47 @@
|
|
|
30805
30877
|
]; };
|
|
30806
30878
|
|
|
30807
30879
|
var UserEventNotificationList = /** @class */ (function () {
|
|
30808
|
-
function UserEventNotificationList(cd, popoverController, userEventService) {
|
|
30880
|
+
function UserEventNotificationList(cd, popoverController, settings, userEventService) {
|
|
30881
|
+
var _a;
|
|
30809
30882
|
this.cd = cd;
|
|
30810
30883
|
this.popoverController = popoverController;
|
|
30884
|
+
this.settings = settings;
|
|
30811
30885
|
this.userEventService = userEventService;
|
|
30812
|
-
this.debug = false;
|
|
30813
|
-
this.userEvents = new rxjs.BehaviorSubject(undefined);
|
|
30814
30886
|
this.subscriptions = new rxjs.Subscription();
|
|
30887
|
+
this._fetchingMore = false;
|
|
30888
|
+
this.debug = false;
|
|
30889
|
+
this.pageSize = 10;
|
|
30890
|
+
this.sortBy = 'creationDate';
|
|
30891
|
+
this.sortDirection = 'desc';
|
|
30892
|
+
this.enableInfiniteScroll = true;
|
|
30893
|
+
this.$items = new rxjs.BehaviorSubject(undefined);
|
|
30894
|
+
this.$itemCount = new rxjs.BehaviorSubject(undefined);
|
|
30895
|
+
this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
|
|
30815
30896
|
}
|
|
30897
|
+
Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
|
|
30898
|
+
get: function () {
|
|
30899
|
+
return this.enableInfiniteScroll && !!this._fetchMoreFn;
|
|
30900
|
+
},
|
|
30901
|
+
enumerable: false,
|
|
30902
|
+
configurable: true
|
|
30903
|
+
});
|
|
30816
30904
|
UserEventNotificationList.prototype.ngOnInit = function () {
|
|
30817
30905
|
var _this = this;
|
|
30818
30906
|
// Watch all user events
|
|
30819
30907
|
if (this.userEventService) {
|
|
30820
30908
|
this.subscriptions.add(this.userEventService
|
|
30821
|
-
.watchAll(0,
|
|
30909
|
+
.watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
|
|
30822
30910
|
.subscribe(function (result) {
|
|
30911
|
+
var _a;
|
|
30823
30912
|
if (_this.debug)
|
|
30824
30913
|
console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
|
|
30825
|
-
_this.
|
|
30914
|
+
_this.$items.next(result.data);
|
|
30915
|
+
_this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
30916
|
+
_this._fetchMoreFn = result.fetchMore;
|
|
30826
30917
|
_this.markForCheck();
|
|
30827
30918
|
}));
|
|
30828
30919
|
// Listen changes
|
|
30829
|
-
this.subscriptions.add(this.userEventService.
|
|
30920
|
+
this.subscriptions.add(this.userEventService.listenAllChanges(undefined)
|
|
30830
30921
|
.subscribe(function (data) {
|
|
30831
30922
|
if (_this.debug)
|
|
30832
30923
|
console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
|
|
@@ -30836,27 +30927,130 @@
|
|
|
30836
30927
|
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
30837
30928
|
this.subscriptions.unsubscribe();
|
|
30838
30929
|
};
|
|
30839
|
-
UserEventNotificationList.prototype.
|
|
30930
|
+
UserEventNotificationList.prototype.click = function (event, userEvent) {
|
|
30931
|
+
if (!userEvent)
|
|
30932
|
+
return; // Skip
|
|
30933
|
+
// MarkAsRead
|
|
30934
|
+
this.markAsRead(event, userEvent);
|
|
30935
|
+
// Get the default action (if any)
|
|
30936
|
+
var defaultAction = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.default; });
|
|
30937
|
+
if (defaultAction) {
|
|
30938
|
+
this.executeAction(event, defaultAction, userEvent);
|
|
30939
|
+
}
|
|
30940
|
+
};
|
|
30941
|
+
UserEventNotificationList.prototype.isDefaultAction = function (action) {
|
|
30942
|
+
return action && action.default || false;
|
|
30943
|
+
};
|
|
30944
|
+
UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
|
|
30840
30945
|
var _a;
|
|
30841
30946
|
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
30842
30947
|
return;
|
|
30843
30948
|
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
30844
30949
|
};
|
|
30845
|
-
UserEventNotificationList.prototype.
|
|
30950
|
+
UserEventNotificationList.prototype.markAllAsRead = function (event) {
|
|
30846
30951
|
var _a;
|
|
30847
|
-
var unreadUserEvents = (this.
|
|
30952
|
+
var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
|
|
30848
30953
|
if (!unreadUserEvents.length)
|
|
30849
30954
|
return;
|
|
30850
30955
|
(_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
|
|
30851
30956
|
};
|
|
30852
|
-
UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
|
|
30853
|
-
|
|
30854
|
-
|
|
30855
|
-
|
|
30957
|
+
UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
|
|
30958
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30959
|
+
var res, err_1;
|
|
30960
|
+
return __generator(this, function (_b) {
|
|
30961
|
+
switch (_b.label) {
|
|
30962
|
+
case 0:
|
|
30963
|
+
if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
|
|
30964
|
+
return [2 /*return*/]; // Skip if prevented
|
|
30965
|
+
// Disable default action (.e.g avoid to call click() function)
|
|
30966
|
+
if (event)
|
|
30967
|
+
event.preventDefault();
|
|
30968
|
+
_b.label = 1;
|
|
30969
|
+
case 1:
|
|
30970
|
+
_b.trys.push([1, 4, , 5]);
|
|
30971
|
+
res = action.executeAction(userEvent);
|
|
30972
|
+
this.dismiss();
|
|
30973
|
+
if (!(res instanceof Promise)) return [3 /*break*/, 3];
|
|
30974
|
+
return [4 /*yield*/, res];
|
|
30975
|
+
case 2:
|
|
30976
|
+
_b.sent();
|
|
30977
|
+
_b.label = 3;
|
|
30978
|
+
case 3: return [3 /*break*/, 5];
|
|
30979
|
+
case 4:
|
|
30980
|
+
err_1 = _b.sent();
|
|
30981
|
+
console.error(err_1);
|
|
30982
|
+
return [3 /*break*/, 5];
|
|
30983
|
+
case 5: return [2 /*return*/];
|
|
30984
|
+
}
|
|
30985
|
+
});
|
|
30986
|
+
});
|
|
30856
30987
|
};
|
|
30857
30988
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
30858
30989
|
this.popoverController.dismiss();
|
|
30859
30990
|
};
|
|
30991
|
+
UserEventNotificationList.prototype.fetchMore = function (event) {
|
|
30992
|
+
var _a;
|
|
30993
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30994
|
+
var result, data, err_2;
|
|
30995
|
+
return __generator(this, function (_b) {
|
|
30996
|
+
switch (_b.label) {
|
|
30997
|
+
case 0:
|
|
30998
|
+
if (!this._fetchMoreFn || this._fetchingMore)
|
|
30999
|
+
return [2 /*return*/];
|
|
31000
|
+
console.debug('[user-event-notification-list] Fetching more notifications...', event);
|
|
31001
|
+
this._fetchingMore = true;
|
|
31002
|
+
_b.label = 1;
|
|
31003
|
+
case 1:
|
|
31004
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
31005
|
+
return [4 /*yield*/, this._fetchMoreFn()];
|
|
31006
|
+
case 2:
|
|
31007
|
+
result = _b.sent();
|
|
31008
|
+
data = __spread((this.$items.value || []), result.data);
|
|
31009
|
+
// Remove duplication (e.g. when new user event was added by subscription)
|
|
31010
|
+
data = removeDuplicatesFromArray(data, 'id');
|
|
31011
|
+
this.$items.next(data);
|
|
31012
|
+
this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
31013
|
+
this._fetchMoreFn = result.fetchMore;
|
|
31014
|
+
return [3 /*break*/, 5];
|
|
31015
|
+
case 3:
|
|
31016
|
+
err_2 = _b.sent();
|
|
31017
|
+
console.error(err_2);
|
|
31018
|
+
this._fetchMoreFn = undefined;
|
|
31019
|
+
return [3 /*break*/, 5];
|
|
31020
|
+
case 4:
|
|
31021
|
+
this.markForCheck();
|
|
31022
|
+
this._fetchingMore = false;
|
|
31023
|
+
return [7 /*endfinally*/];
|
|
31024
|
+
case 5: return [2 /*return*/];
|
|
31025
|
+
}
|
|
31026
|
+
});
|
|
31027
|
+
});
|
|
31028
|
+
};
|
|
31029
|
+
UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
|
|
31030
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31031
|
+
var panel;
|
|
31032
|
+
var _this = this;
|
|
31033
|
+
return __generator(this, function (_b) {
|
|
31034
|
+
switch (_b.label) {
|
|
31035
|
+
case 0:
|
|
31036
|
+
if (this._fetchMoreSubscription)
|
|
31037
|
+
this._fetchMoreSubscription.unsubscribe();
|
|
31038
|
+
threshold = threshold || (this.mobile ? '15%' : '2%');
|
|
31039
|
+
return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
|
|
31040
|
+
case 1:
|
|
31041
|
+
_b.sent();
|
|
31042
|
+
return [4 /*yield*/, this.ionContent.getScrollElement()];
|
|
31043
|
+
case 2:
|
|
31044
|
+
panel = _b.sent();
|
|
31045
|
+
// Trigger fetch more, end end scroll reached
|
|
31046
|
+
this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
|
|
31047
|
+
.subscribe(function () { return _this.fetchMore(); });
|
|
31048
|
+
this.subscriptions.add(this._fetchMoreSubscription);
|
|
31049
|
+
return [2 /*return*/];
|
|
31050
|
+
}
|
|
31051
|
+
});
|
|
31052
|
+
});
|
|
31053
|
+
};
|
|
30860
31054
|
UserEventNotificationList.prototype.markForCheck = function () {
|
|
30861
31055
|
this.cd.markForCheck();
|
|
30862
31056
|
};
|
|
@@ -30865,21 +31059,30 @@
|
|
|
30865
31059
|
UserEventNotificationList.decorators = [
|
|
30866
31060
|
{ type: i0.Component, args: [{
|
|
30867
31061
|
selector: 'app-user-event-notification-list',
|
|
30868
|
-
template: "
|
|
31062
|
+
template: "<ion-content>\n <ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n <ion-col class=\"top-action\" *ngIf=\"$items|async|isNotEmptyArray\">\n <ion-text color=\"primary\">\n <a (click)=\"markAllAsRead($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-text>\n </ion-col>\n </ion-row>\n\n <ion-item\n *ngFor=\"let item of $items | async; last as last\"\n [lines]=\"last ? 'none' : undefined\"\n [class.unread]=\"!item.readDate\"\n [class.tappable]=\"item.actions|arrayFilter:isDefaultAction|isNotEmptyArray\"\n (click)=\"click($event, item)\">\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"item.avatar; else avatarIcon\" src=\"{{ item.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"item.avatarIcon\"\n [ref]=\"item.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding message\">\n <ion-row>\n <ion-col size=\"12\">\n <p [class.unread]=\"!item.readDate\" [innerHTML]=\"item.message\"></p>\n </ion-col>\n </ion-row>\n\n <!-- date -->\n <ion-row>\n <ion-col size=\"12\">\n <app-icon\n *ngIf=\"item.icon\"\n [ref]=\"item.icon\"\n height=\"16\"\n width=\"16\"\n style=\"vertical-align: sub; margin-right: 3px\"\n ></app-icon>\n <small>\n <span>{{item.creationDate|dateFromNow}}</span>\n <span style=\"color: gray\">{{ ' | ' + (item.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n\n <!-- actions -->\n <ion-row *ngIf=\"item.actions|isNotEmptyArray\">\n <ion-col></ion-col>\n <ion-col size=\"auto\">\n <ng-container *ngFor=\"let action of item.actions\">\n <a *ngIf=\"!action.default\" class=\"action\" (click)=\"executeAction($event, action, item)\" [title]=\"(action.title || action.name) |translate\">\n <app-icon *ngIf=\"action.iconRef\" slot=\"start\" height=\"20\" width=\"20\" [ref]=\"action.iconRef\"></app-icon>\n <span>{{ action.name | translate }}</span>\n </a>\n </ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n <mat-icon slot=\"end\" *ngIf=\"item.actions|arrayFilter: isDefaultAction|isNotEmptyArray\">chevron_right</mat-icon>\n </ion-item>\n\n <!-- loading -->\n <ion-item *ngIf=\"!($items|async); else noResult\" lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n\n <!-- no result -->\n <ng-template #noResult>\n <ion-item *ngIf=\"$items|async|isEmptyArray\" lines=\"none\">\n <ion-text color=\"dark\" class=\"text-italic\">{{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}</ion-text>\n </ion-item>\n </ng-template>\n\n <!-- Loading more spinner -->\n <ion-item *ngIf=\"canFetchMore\" (ngInit)=\"_initInfiniteScroll()\" lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n\n <!-- footer -->\n <ion-row *ngIf=\"$itemCount|async; let count\"\n class=\"ion-list-footer column\">\n <ion-col>\n <ion-text class=\"ion-float-end ion-padding-end\"><i>{{'COMMON.RESULT_COUNT'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n </ion-list>\n</ion-content>\n",
|
|
30869
31063
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
30870
|
-
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.
|
|
31064
|
+
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-height:calc(90vh - 20px)}ion-list ion-item.tappable{cursor:pointer}ion-list ion-item.tappable:hover{--ion-item-background:var(--ion-item-background-color-hover)}.message{font-size:.9em}.message p{margin-top:5px;margin-bottom:5px}.message p.unread{font-weight:700}.top-action{text-align:end;margin-right:8px}.top-action a{cursor:pointer;color:var(--ion-color-contrast)}.top-action a:hover{text-decoration:underline}a.action{font-size:.9em;margin-right:10px;cursor:pointer}a.action:hover span{text-decoration:underline}a.action app-icon{vertical-align:middle}"]
|
|
30871
31065
|
},] }
|
|
30872
31066
|
];
|
|
30873
31067
|
UserEventNotificationList.ctorParameters = function () { return [
|
|
30874
31068
|
{ type: i0.ChangeDetectorRef },
|
|
30875
31069
|
{ type: i1$5.PopoverController },
|
|
31070
|
+
{ type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
|
|
30876
31071
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
|
|
30877
31072
|
]; };
|
|
30878
31073
|
UserEventNotificationList.propDecorators = {
|
|
30879
31074
|
debug: [{ type: i0.Input }],
|
|
31075
|
+
mobile: [{ type: i0.Input }],
|
|
30880
31076
|
titleI18n: [{ type: i0.Input }],
|
|
31077
|
+
pageSize: [{ type: i0.Input }],
|
|
31078
|
+
sortBy: [{ type: i0.Input }],
|
|
31079
|
+
sortDirection: [{ type: i0.Input }],
|
|
31080
|
+
filter: [{ type: i0.Input }],
|
|
31081
|
+
enableInfiniteScroll: [{ type: i0.Input }],
|
|
30881
31082
|
readEvent: [{ type: i0.Output }],
|
|
30882
|
-
readEvents: [{ type: i0.Output }]
|
|
31083
|
+
readEvents: [{ type: i0.Output }],
|
|
31084
|
+
ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
|
|
31085
|
+
ionItems: [{ type: i0.ViewChildren, args: [i1$5.IonItem,] }]
|
|
30883
31086
|
};
|
|
30884
31087
|
|
|
30885
31088
|
var AppUserEventNotificationIcon = /** @class */ (function () {
|
|
@@ -30955,7 +31158,7 @@
|
|
|
30955
31158
|
keyboardClose: true,
|
|
30956
31159
|
event: event,
|
|
30957
31160
|
translucent: true,
|
|
30958
|
-
cssClass: 'popover-large'
|
|
31161
|
+
cssClass: 'popover-large popover-notifications'
|
|
30959
31162
|
})];
|
|
30960
31163
|
case 1:
|
|
30961
31164
|
popover = _a.sent();
|
|
@@ -33853,6 +34056,463 @@
|
|
|
33853
34056
|
},] }
|
|
33854
34057
|
];
|
|
33855
34058
|
|
|
34059
|
+
var JobProgressionTestService = /** @class */ (function () {
|
|
34060
|
+
function JobProgressionTestService() {
|
|
34061
|
+
}
|
|
34062
|
+
JobProgressionTestService.prototype.listenChanges = function (id, options) {
|
|
34063
|
+
return rxjs.interval(100).pipe(operators.take(111), operators.map(function (value) {
|
|
34064
|
+
if (value <= 10) {
|
|
34065
|
+
return {
|
|
34066
|
+
id: id,
|
|
34067
|
+
name: "Job #" + id,
|
|
34068
|
+
current: 0,
|
|
34069
|
+
total: 0,
|
|
34070
|
+
message: "Progression pending"
|
|
34071
|
+
};
|
|
34072
|
+
}
|
|
34073
|
+
value = value - 10;
|
|
34074
|
+
return {
|
|
34075
|
+
id: id,
|
|
34076
|
+
name: "Job #" + id,
|
|
34077
|
+
current: value,
|
|
34078
|
+
total: 100,
|
|
34079
|
+
message: "Progression " + value + "/100"
|
|
34080
|
+
};
|
|
34081
|
+
}));
|
|
34082
|
+
};
|
|
34083
|
+
return JobProgressionTestService;
|
|
34084
|
+
}());
|
|
34085
|
+
JobProgressionTestService.decorators = [
|
|
34086
|
+
{ type: i0.Injectable }
|
|
34087
|
+
];
|
|
34088
|
+
|
|
34089
|
+
var JobProgressionTestingPage = /** @class */ (function () {
|
|
34090
|
+
function JobProgressionTestingPage() {
|
|
34091
|
+
this.nJob = 0;
|
|
34092
|
+
this.options = {
|
|
34093
|
+
autoHide: true
|
|
34094
|
+
};
|
|
34095
|
+
this.job = new exports.JobProgression();
|
|
34096
|
+
this.job.id = 0;
|
|
34097
|
+
this.job.name = 'test';
|
|
34098
|
+
this.job.current = 0;
|
|
34099
|
+
this.job.total = 100;
|
|
34100
|
+
}
|
|
34101
|
+
JobProgressionTestingPage.prototype.incrementJob = function (value) {
|
|
34102
|
+
this.job.current = Math.max(0, this.job.current + value);
|
|
34103
|
+
this.job.message = "Fake progression (very long message very long message very long message very long message) " + this.job.current + "/100";
|
|
34104
|
+
if (this.job.current > this.job.total) {
|
|
34105
|
+
this.jobProgression.removeJob(0);
|
|
34106
|
+
this.job.current = 0;
|
|
34107
|
+
}
|
|
34108
|
+
else if (!this.jobProgression.getProgression(0)) {
|
|
34109
|
+
this.jobProgression.jobProgressions.push(this.job);
|
|
34110
|
+
}
|
|
34111
|
+
this.jobProgression.updateValue();
|
|
34112
|
+
};
|
|
34113
|
+
JobProgressionTestingPage.prototype.addJob = function () {
|
|
34114
|
+
// Add fake job
|
|
34115
|
+
this.nJob++;
|
|
34116
|
+
this.jobProgression.addJob(this.nJob);
|
|
34117
|
+
};
|
|
34118
|
+
return JobProgressionTestingPage;
|
|
34119
|
+
}());
|
|
34120
|
+
JobProgressionTestingPage.decorators = [
|
|
34121
|
+
{ type: i0.Component, args: [{
|
|
34122
|
+
selector: 'job-progression-testing',
|
|
34123
|
+
template: "<ion-toolbar color=\"primary\">\n <ion-title>Job progression</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-job-progression #jobProgression [debug]=\"true\" [options]=\"options\" ></app-job-progression>\n\n <p>\n <ion-button (click)=\"incrementJob(10)\">\n +10\n </ion-button>\n <ion-button (click)=\"incrementJob(-10)\">\n -10\n </ion-button>\n </p>\n <p>\n <ion-button (click)=\"addJob()\">Add Job</ion-button>\n </p>\n</ion-content>\n",
|
|
34124
|
+
providers: [
|
|
34125
|
+
{ provide: JobProgressionServiceToken, useClass: JobProgressionTestService }
|
|
34126
|
+
]
|
|
34127
|
+
},] }
|
|
34128
|
+
];
|
|
34129
|
+
JobProgressionTestingPage.ctorParameters = function () { return []; };
|
|
34130
|
+
JobProgressionTestingPage.propDecorators = {
|
|
34131
|
+
jobProgression: [{ type: i0.ViewChild, args: ['jobProgression',] }]
|
|
34132
|
+
};
|
|
34133
|
+
|
|
34134
|
+
var JobTestingModule = /** @class */ (function () {
|
|
34135
|
+
function JobTestingModule() {
|
|
34136
|
+
}
|
|
34137
|
+
return JobTestingModule;
|
|
34138
|
+
}());
|
|
34139
|
+
JobTestingModule.decorators = [
|
|
34140
|
+
{ type: i0.NgModule, args: [{
|
|
34141
|
+
imports: [
|
|
34142
|
+
i1$4.CommonModule,
|
|
34143
|
+
i1$2.TranslateModule.forChild(),
|
|
34144
|
+
SharedModule,
|
|
34145
|
+
JobModule
|
|
34146
|
+
],
|
|
34147
|
+
declarations: [
|
|
34148
|
+
JobProgressionTestingPage
|
|
34149
|
+
],
|
|
34150
|
+
exports: [
|
|
34151
|
+
JobProgressionTestingPage
|
|
34152
|
+
]
|
|
34153
|
+
},] }
|
|
34154
|
+
];
|
|
34155
|
+
|
|
34156
|
+
var UserEventTestService = /** @class */ (function (_super) {
|
|
34157
|
+
__extends(UserEventTestService, _super);
|
|
34158
|
+
function UserEventTestService(graphql, accountService, network, translate, environment) {
|
|
34159
|
+
var _this = _super.call(this, graphql, accountService, network, translate, {
|
|
34160
|
+
queries: {
|
|
34161
|
+
loadAll: null,
|
|
34162
|
+
loadAllWithContent: null
|
|
34163
|
+
},
|
|
34164
|
+
production: environment === null || environment === void 0 ? void 0 : environment.production
|
|
34165
|
+
}) || this;
|
|
34166
|
+
_this.graphql = graphql;
|
|
34167
|
+
_this.accountService = accountService;
|
|
34168
|
+
_this.network = network;
|
|
34169
|
+
_this.translate = translate;
|
|
34170
|
+
_this.environment = environment;
|
|
34171
|
+
_this.userEvents = [];
|
|
34172
|
+
return _this;
|
|
34173
|
+
}
|
|
34174
|
+
UserEventTestService.prototype.fromObject = function (source) {
|
|
34175
|
+
return exports.UserEvent.fromObject(source);
|
|
34176
|
+
};
|
|
34177
|
+
UserEventTestService.prototype.add = function (entity) {
|
|
34178
|
+
entity = this.processUserEvent(entity);
|
|
34179
|
+
entity.id = this.userEvents.length + 1;
|
|
34180
|
+
this.userEvents = __spread([
|
|
34181
|
+
entity
|
|
34182
|
+
], this.userEvents);
|
|
34183
|
+
this._countSubject.next((this._countSubject.value || 0) + 1);
|
|
34184
|
+
};
|
|
34185
|
+
UserEventTestService.prototype.asFilter = function (filter) {
|
|
34186
|
+
return filter;
|
|
34187
|
+
};
|
|
34188
|
+
UserEventTestService.prototype.count = function (filter, options) {
|
|
34189
|
+
return Promise.resolve(this.userEvents.length);
|
|
34190
|
+
};
|
|
34191
|
+
UserEventTestService.prototype.delete = function (entity) {
|
|
34192
|
+
return Promise.resolve(undefined);
|
|
34193
|
+
};
|
|
34194
|
+
UserEventTestService.prototype.deleteAll = function (data, opts) {
|
|
34195
|
+
return Promise.resolve(undefined);
|
|
34196
|
+
};
|
|
34197
|
+
UserEventTestService.prototype.listenAllChanges = function (filter, options) {
|
|
34198
|
+
return rxjs.of();
|
|
34199
|
+
};
|
|
34200
|
+
UserEventTestService.prototype.save = function (entity, options) {
|
|
34201
|
+
var _a;
|
|
34202
|
+
var toSave = (_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id == (entity === null || entity === void 0 ? void 0 : entity.id); });
|
|
34203
|
+
Object.assign(toSave, entity);
|
|
34204
|
+
return entity;
|
|
34205
|
+
};
|
|
34206
|
+
UserEventTestService.prototype.saveAll = function (data, opts) {
|
|
34207
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
34208
|
+
var _b, _c, entity, e_1_1;
|
|
34209
|
+
var e_1, _d;
|
|
34210
|
+
return __generator(this, function (_e) {
|
|
34211
|
+
switch (_e.label) {
|
|
34212
|
+
case 0:
|
|
34213
|
+
_e.trys.push([0, 5, 6, 7]);
|
|
34214
|
+
_b = __values((data || [])), _c = _b.next();
|
|
34215
|
+
_e.label = 1;
|
|
34216
|
+
case 1:
|
|
34217
|
+
if (!!_c.done) return [3 /*break*/, 4];
|
|
34218
|
+
entity = _c.value;
|
|
34219
|
+
return [4 /*yield*/, this.save(entity)];
|
|
34220
|
+
case 2:
|
|
34221
|
+
_e.sent();
|
|
34222
|
+
_e.label = 3;
|
|
34223
|
+
case 3:
|
|
34224
|
+
_c = _b.next();
|
|
34225
|
+
return [3 /*break*/, 1];
|
|
34226
|
+
case 4: return [3 /*break*/, 7];
|
|
34227
|
+
case 5:
|
|
34228
|
+
e_1_1 = _e.sent();
|
|
34229
|
+
e_1 = { error: e_1_1 };
|
|
34230
|
+
return [3 /*break*/, 7];
|
|
34231
|
+
case 6:
|
|
34232
|
+
try {
|
|
34233
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
34234
|
+
}
|
|
34235
|
+
finally { if (e_1) throw e_1.error; }
|
|
34236
|
+
return [7 /*endfinally*/];
|
|
34237
|
+
case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
|
|
34238
|
+
}
|
|
34239
|
+
});
|
|
34240
|
+
});
|
|
34241
|
+
};
|
|
34242
|
+
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34243
|
+
var _this = this;
|
|
34244
|
+
var _a;
|
|
34245
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34246
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34247
|
+
var res = { data: data, total: total };
|
|
34248
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34249
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34250
|
+
// Add fetch more
|
|
34251
|
+
var nextOffset = offset + data.length;
|
|
34252
|
+
if (nextOffset < res.total) {
|
|
34253
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34254
|
+
}
|
|
34255
|
+
return rxjs.of(res);
|
|
34256
|
+
};
|
|
34257
|
+
UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34258
|
+
var _this = this;
|
|
34259
|
+
var _a;
|
|
34260
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34261
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34262
|
+
var res = { data: data, total: total };
|
|
34263
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34264
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34265
|
+
// Add fetch more
|
|
34266
|
+
var nextOffset = offset + data.length;
|
|
34267
|
+
if (nextOffset < res.total) {
|
|
34268
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34269
|
+
}
|
|
34270
|
+
return Promise.resolve(res);
|
|
34271
|
+
};
|
|
34272
|
+
return UserEventTestService;
|
|
34273
|
+
}(AbstractUserEventService));
|
|
34274
|
+
UserEventTestService.decorators = [
|
|
34275
|
+
{ type: i0.Injectable }
|
|
34276
|
+
];
|
|
34277
|
+
UserEventTestService.ctorParameters = function () { return [
|
|
34278
|
+
{ type: GraphqlService },
|
|
34279
|
+
{ type: AccountService },
|
|
34280
|
+
{ type: NetworkService },
|
|
34281
|
+
{ type: i1$2.TranslateService },
|
|
34282
|
+
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
34283
|
+
]; };
|
|
34284
|
+
|
|
34285
|
+
var moment$a = momentImported__namespace;
|
|
34286
|
+
var UserEventTestingPage = /** @class */ (function () {
|
|
34287
|
+
function UserEventTestingPage(userEventService, router, alertController, translateService) {
|
|
34288
|
+
var _this = this;
|
|
34289
|
+
this.userEventService = userEventService;
|
|
34290
|
+
this.router = router;
|
|
34291
|
+
this.alertController = alertController;
|
|
34292
|
+
this.translateService = translateService;
|
|
34293
|
+
userEventService.registerListener({
|
|
34294
|
+
accept: function (userEvent) { return true; },
|
|
34295
|
+
onReceived: function (userEvent) {
|
|
34296
|
+
_this.customize(userEvent);
|
|
34297
|
+
return userEvent;
|
|
34298
|
+
}
|
|
34299
|
+
});
|
|
34300
|
+
userEventService.registerListener({
|
|
34301
|
+
accept: function (userEvent) { return userEvent.level == "DEBUG"; },
|
|
34302
|
+
onRead: function (userEvent) { _this.showMessage("debug message read "); }
|
|
34303
|
+
});
|
|
34304
|
+
}
|
|
34305
|
+
UserEventTestingPage.prototype.customize = function (userEvent) {
|
|
34306
|
+
// Choose avatarIcon
|
|
34307
|
+
switch (userEvent.level) {
|
|
34308
|
+
case 'ERROR':
|
|
34309
|
+
userEvent.avatarIcon = { icon: 'close-outline', color: 'danger' };
|
|
34310
|
+
break;
|
|
34311
|
+
case 'WARNING':
|
|
34312
|
+
userEvent.avatarIcon = { icon: 'warning-outline', color: 'warning' };
|
|
34313
|
+
break;
|
|
34314
|
+
case 'INFO':
|
|
34315
|
+
userEvent.avatarIcon = { icon: 'information-circle-outline' };
|
|
34316
|
+
break;
|
|
34317
|
+
case 'DEBUG':
|
|
34318
|
+
userEvent.avatarIcon = { icon: 'cog', color: "medium" };
|
|
34319
|
+
break;
|
|
34320
|
+
}
|
|
34321
|
+
// Choose icon
|
|
34322
|
+
switch (userEvent.type) {
|
|
34323
|
+
case 'message':
|
|
34324
|
+
userEvent.icon = { matIcon: 'inbox', color: 'accent' };
|
|
34325
|
+
break;
|
|
34326
|
+
case 'upload':
|
|
34327
|
+
userEvent.icon = { matIcon: 'file_upload' };
|
|
34328
|
+
break;
|
|
34329
|
+
case 'download':
|
|
34330
|
+
userEvent.icon = { matIcon: 'file_download' };
|
|
34331
|
+
break;
|
|
34332
|
+
}
|
|
34333
|
+
};
|
|
34334
|
+
UserEventTestingPage.prototype.addNotification = function () {
|
|
34335
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34336
|
+
issuer: 'system',
|
|
34337
|
+
recipient: 'me',
|
|
34338
|
+
type: 'message',
|
|
34339
|
+
level: 'INFO',
|
|
34340
|
+
message: 'message test message test message test message test message test message test message test message test',
|
|
34341
|
+
creationDate: moment$a(),
|
|
34342
|
+
}));
|
|
34343
|
+
};
|
|
34344
|
+
UserEventTestingPage.prototype.addError = function () {
|
|
34345
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34346
|
+
issuer: 'system',
|
|
34347
|
+
recipient: 'me',
|
|
34348
|
+
type: 'upload',
|
|
34349
|
+
level: 'ERROR',
|
|
34350
|
+
message: 'message error',
|
|
34351
|
+
creationDate: moment$a(),
|
|
34352
|
+
}));
|
|
34353
|
+
};
|
|
34354
|
+
UserEventTestingPage.prototype.addWarning = function () {
|
|
34355
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34356
|
+
issuer: 'system',
|
|
34357
|
+
recipient: 'me',
|
|
34358
|
+
type: 'download',
|
|
34359
|
+
level: 'WARNING',
|
|
34360
|
+
message: 'message warning',
|
|
34361
|
+
creationDate: moment$a(),
|
|
34362
|
+
}));
|
|
34363
|
+
};
|
|
34364
|
+
UserEventTestingPage.prototype.addDebug = function () {
|
|
34365
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34366
|
+
issuer: 'system',
|
|
34367
|
+
recipient: 'me',
|
|
34368
|
+
type: 'debug',
|
|
34369
|
+
level: 'DEBUG',
|
|
34370
|
+
message: 'message DEBUG',
|
|
34371
|
+
creationDate: moment$a(),
|
|
34372
|
+
}));
|
|
34373
|
+
};
|
|
34374
|
+
UserEventTestingPage.prototype.addNotificationWithLink = function () {
|
|
34375
|
+
var _this = this;
|
|
34376
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34377
|
+
issuer: 'system',
|
|
34378
|
+
recipient: 'me',
|
|
34379
|
+
type: 'message',
|
|
34380
|
+
level: 'INFO',
|
|
34381
|
+
message: 'message with link',
|
|
34382
|
+
creationDate: moment$a(),
|
|
34383
|
+
actions: [{
|
|
34384
|
+
name: 'click here',
|
|
34385
|
+
iconRef: {
|
|
34386
|
+
icon: 'arrow-forward-outline'
|
|
34387
|
+
},
|
|
34388
|
+
executeAction: function (event) { _this.router.navigateByUrl('/'); }
|
|
34389
|
+
}]
|
|
34390
|
+
}));
|
|
34391
|
+
};
|
|
34392
|
+
UserEventTestingPage.prototype.addNotificationWithAction = function () {
|
|
34393
|
+
var _this = this;
|
|
34394
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34395
|
+
issuer: 'system',
|
|
34396
|
+
recipient: 'me',
|
|
34397
|
+
type: 'message',
|
|
34398
|
+
level: 'INFO',
|
|
34399
|
+
message: 'message with action',
|
|
34400
|
+
creationDate: moment$a(),
|
|
34401
|
+
actions: [
|
|
34402
|
+
{
|
|
34403
|
+
name: 'click here',
|
|
34404
|
+
iconRef: {
|
|
34405
|
+
icon: 'arrow-forward-outline',
|
|
34406
|
+
color: 'warning'
|
|
34407
|
+
},
|
|
34408
|
+
executeAction: function (event) { _this.showMessage('action 1'); }
|
|
34409
|
+
},
|
|
34410
|
+
{
|
|
34411
|
+
name: 'click here 2',
|
|
34412
|
+
iconRef: {
|
|
34413
|
+
matIcon: 'settings_applications',
|
|
34414
|
+
color: 'secondary'
|
|
34415
|
+
},
|
|
34416
|
+
executeAction: function (event) { _this.showMessage('action 2'); }
|
|
34417
|
+
}
|
|
34418
|
+
]
|
|
34419
|
+
}));
|
|
34420
|
+
};
|
|
34421
|
+
UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
|
|
34422
|
+
var _this = this;
|
|
34423
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34424
|
+
issuer: 'system',
|
|
34425
|
+
recipient: 'me',
|
|
34426
|
+
type: 'message',
|
|
34427
|
+
level: 'INFO',
|
|
34428
|
+
message: 'message with action',
|
|
34429
|
+
creationDate: moment$a(),
|
|
34430
|
+
actions: [
|
|
34431
|
+
{
|
|
34432
|
+
default: true,
|
|
34433
|
+
name: 'default',
|
|
34434
|
+
executeAction: function (event) { _this.showMessage('default action'); }
|
|
34435
|
+
}
|
|
34436
|
+
]
|
|
34437
|
+
}));
|
|
34438
|
+
};
|
|
34439
|
+
UserEventTestingPage.prototype.showMessage = function (text) {
|
|
34440
|
+
return Alerts.showError(text, this.alertController, this.translateService);
|
|
34441
|
+
};
|
|
34442
|
+
return UserEventTestingPage;
|
|
34443
|
+
}());
|
|
34444
|
+
UserEventTestingPage.decorators = [
|
|
34445
|
+
{ type: i0.Component, args: [{
|
|
34446
|
+
selector: 'job-progression-testing',
|
|
34447
|
+
template: "<ion-toolbar color=\"primary\">\n <ion-title>User events</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-user-event-notification-icon #notification [debug]=\"true\"></app-user-event-notification-icon>\n\n <p>\n <ion-button (click)=\"addNotification()\">Add notification</ion-button>\n <ion-button (click)=\"addError()\">Add error</ion-button>\n <ion-button (click)=\"addWarning()\">Add warning</ion-button>\n <ion-button (click)=\"addDebug()\">Add debug</ion-button>\n </p>\n <p>\n <ion-button (click)=\"addNotificationWithLink()\">Add notification with link</ion-button>\n <ion-button (click)=\"addNotificationWithAction()\">Add notification with action</ion-button>\n <ion-button (click)=\"addNotificationWithDefaultAction()\">Add notification with default action</ion-button>\n </p>\n</ion-content>\n"
|
|
34448
|
+
},] }
|
|
34449
|
+
];
|
|
34450
|
+
UserEventTestingPage.ctorParameters = function () { return [
|
|
34451
|
+
{ type: UserEventTestService, decorators: [{ type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
|
|
34452
|
+
{ type: i3.Router },
|
|
34453
|
+
{ type: i1$5.AlertController },
|
|
34454
|
+
{ type: i1$2.TranslateService }
|
|
34455
|
+
]; };
|
|
34456
|
+
UserEventTestingPage.propDecorators = {
|
|
34457
|
+
notification: [{ type: i0.ViewChild, args: ['notification',] }]
|
|
34458
|
+
};
|
|
34459
|
+
|
|
34460
|
+
var UserEventTestingModule = /** @class */ (function () {
|
|
34461
|
+
function UserEventTestingModule() {
|
|
34462
|
+
}
|
|
34463
|
+
return UserEventTestingModule;
|
|
34464
|
+
}());
|
|
34465
|
+
UserEventTestingModule.decorators = [
|
|
34466
|
+
{ type: i0.NgModule, args: [{
|
|
34467
|
+
imports: [
|
|
34468
|
+
i1$4.CommonModule,
|
|
34469
|
+
i1$2.TranslateModule.forChild(),
|
|
34470
|
+
SharedModule,
|
|
34471
|
+
UserEventModule
|
|
34472
|
+
],
|
|
34473
|
+
declarations: [
|
|
34474
|
+
UserEventTestingPage
|
|
34475
|
+
],
|
|
34476
|
+
exports: [
|
|
34477
|
+
UserEventTestingPage
|
|
34478
|
+
]
|
|
34479
|
+
},] }
|
|
34480
|
+
];
|
|
34481
|
+
|
|
34482
|
+
var SOCIAL_TESTING_PAGES = [
|
|
34483
|
+
{ label: 'Social components', divider: true },
|
|
34484
|
+
{ label: 'User event', page: '/testing/social/user-event' },
|
|
34485
|
+
{ label: 'Job progression', page: '/testing/social/job-progression' }
|
|
34486
|
+
];
|
|
34487
|
+
var routes$6 = [
|
|
34488
|
+
{
|
|
34489
|
+
path: 'job-progression',
|
|
34490
|
+
pathMatch: 'full',
|
|
34491
|
+
component: JobProgressionTestingPage
|
|
34492
|
+
},
|
|
34493
|
+
{
|
|
34494
|
+
path: 'user-event',
|
|
34495
|
+
pathMatch: 'full',
|
|
34496
|
+
component: UserEventTestingPage
|
|
34497
|
+
},
|
|
34498
|
+
];
|
|
34499
|
+
var SocialTestingModule = /** @class */ (function () {
|
|
34500
|
+
function SocialTestingModule() {
|
|
34501
|
+
}
|
|
34502
|
+
return SocialTestingModule;
|
|
34503
|
+
}());
|
|
34504
|
+
SocialTestingModule.decorators = [
|
|
34505
|
+
{ type: i0.NgModule, args: [{
|
|
34506
|
+
imports: [
|
|
34507
|
+
i1$4.CommonModule,
|
|
34508
|
+
i1$2.TranslateModule.forChild(),
|
|
34509
|
+
i3.RouterModule.forChild(routes$6),
|
|
34510
|
+
JobTestingModule,
|
|
34511
|
+
UserEventTestingModule
|
|
34512
|
+
],
|
|
34513
|
+
},] }
|
|
34514
|
+
];
|
|
34515
|
+
|
|
33856
34516
|
// Environment
|
|
33857
34517
|
|
|
33858
34518
|
/**
|
|
@@ -34008,6 +34668,9 @@
|
|
|
34008
34668
|
exports.JobProgressionComponent = JobProgressionComponent;
|
|
34009
34669
|
exports.JobProgressionService = JobProgressionService;
|
|
34010
34670
|
exports.JobProgressionServiceToken = JobProgressionServiceToken;
|
|
34671
|
+
exports.JobProgressionTestService = JobProgressionTestService;
|
|
34672
|
+
exports.JobProgressionTestingPage = JobProgressionTestingPage;
|
|
34673
|
+
exports.JobTestingModule = JobTestingModule;
|
|
34011
34674
|
exports.JobUtils = JobUtils;
|
|
34012
34675
|
exports.KEYBOARD_HIDE_DELAY_MS = KEYBOARD_HIDE_DELAY_MS;
|
|
34013
34676
|
exports.LAT_LONG_DEFAULT_MAX_DECIMALS = LAT_LONG_DEFAULT_MAX_DECIMALS;
|
|
@@ -34087,6 +34750,7 @@
|
|
|
34087
34750
|
exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
|
|
34088
34751
|
exports.SHARED_MATERIAL_TESTING_PAGES = SHARED_MATERIAL_TESTING_PAGES;
|
|
34089
34752
|
exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
|
|
34753
|
+
exports.SOCIAL_TESTING_PAGES = SOCIAL_TESTING_PAGES;
|
|
34090
34754
|
exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
|
|
34091
34755
|
exports.SelectPeerModal = SelectPeerModal;
|
|
34092
34756
|
exports.ServerErrorCodes = ServerErrorCodes;
|
|
@@ -34115,6 +34779,7 @@
|
|
|
34115
34779
|
exports.SocialErrorCodes = SocialErrorCodes;
|
|
34116
34780
|
exports.SocialModule = SocialModule;
|
|
34117
34781
|
exports.SocialModuleOptionsToken = SocialModuleOptionsToken;
|
|
34782
|
+
exports.SocialTestingModule = SocialTestingModule;
|
|
34118
34783
|
exports.StartableService = StartableService;
|
|
34119
34784
|
exports.StatusById = StatusById;
|
|
34120
34785
|
exports.StatusIds = StatusIds;
|
|
@@ -34145,6 +34810,9 @@
|
|
|
34145
34810
|
exports.UriUtils = UriUtils;
|
|
34146
34811
|
exports.UserEventFragments = UserEventFragments;
|
|
34147
34812
|
exports.UserEventModule = UserEventModule;
|
|
34813
|
+
exports.UserEventTestService = UserEventTestService;
|
|
34814
|
+
exports.UserEventTestingModule = UserEventTestingModule;
|
|
34815
|
+
exports.UserEventTestingPage = UserEventTestingPage;
|
|
34148
34816
|
exports.UserEventTypes = UserEventTypes;
|
|
34149
34817
|
exports.UsersPage = UsersPage;
|
|
34150
34818
|
exports.accountToString = accountToString;
|