@sumaris-net/ngx-components 1.22.9 → 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 +752 -73
- 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 +6 -0
- package/esm2015/public_api.js +11 -2
- package/esm2015/src/app/core/menu/menu.component.js +2 -2
- 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 +6 -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 +94 -0
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +131 -30
- 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 +35 -6
- package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
- package/esm2015/src/app/social/user-event/user-event.module.js +4 -4
- package/esm2015/src/app/social/user-event/user-event.service.js +74 -17
- package/fesm2015/sumaris-net.ngx-components.js +637 -63
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +8 -1
- 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.component.d.ts → user-event-notification.icon.d.ts} +3 -2
- 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 +16 -12
- package/src/theme/_ngx-components.scss +12 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +0 -89
|
@@ -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
|
}
|
|
@@ -24829,7 +24834,7 @@
|
|
|
24829
24834
|
MenuComponent.decorators = [
|
|
24830
24835
|
{ type: i0.Component, args: [{
|
|
24831
24836
|
selector: 'app-menu',
|
|
24832
|
-
template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" [contentId]=\"contentId\">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf=\"isLogin; else notLogin\" class=\"ion-toolbar-top\">\n <ion-grid>\n <ion-row>\n <ion-col size=\"4\">\n <button type=\"button\" mat-flat-button\n class=\"user-avatar\" [class.primary]=\"!accountAvatar\"\n [style.background-image]=\"'url('+(accountAvatar||'./assets/img/person.png')+')'\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\n </button>\n </ion-col>\n <ion-col size=\"8\" class=\"user-logo\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"108px\"/>\n <span *ngIf=\"!logo\" style=\"width: 108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n <ion-col>\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\n <ion-label color=\"primary\" class=\"ion-text-wrap ion-text-start\">\n <h3 class=\"no-margin username\">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n </ion-col>\n\n <!-- Insertion
|
|
24837
|
+
template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" [contentId]=\"contentId\">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf=\"isLogin; else notLogin\" class=\"ion-toolbar-top\">\n <ion-grid>\n <ion-row>\n <ion-col size=\"4\">\n <button type=\"button\" mat-flat-button\n class=\"user-avatar\" [class.primary]=\"!accountAvatar\"\n [style.background-image]=\"'url('+(accountAvatar||'./assets/img/person.png')+')'\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\n </button>\n </ion-col>\n <ion-col size=\"8\" class=\"user-logo\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"108px\"/>\n <span *ngIf=\"!logo\" style=\"width: 108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n <ion-col>\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\n <ion-label color=\"primary\" class=\"ion-text-wrap ion-text-start\">\n <h3 class=\"no-margin username\">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n </ion-col>\n\n <!-- Insertion headerBottomRight -->\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"headerBottomRight\"></ng-container>\n </ion-col>\n </ion-row>\n </ion-grid>\n\n </ion-toolbar>\n\n <!-- User not logged -->\n <ng-template #notLogin>\n <mat-toolbar class=\"ion-padding\" @fadeInAnimation\n style=\"height: unset; display: block; margin: auto; text-align: center;\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"150px;\">\n <span *ngIf=\"!logo\" style=\"width: 150px\">{{appName}}</span>\n </mat-toolbar>\n </ng-template>\n </ion-header>\n\n <ion-content [class.has-user-header]=\"isLogin\">\n\n <ion-list lines=\"none\">\n <ion-menu-toggle auto-hide=\"false\"\n [class.flex-spacer]=\"item.cssClass == 'flex-spacer'\"\n *ngFor=\"let item of $items | async\">\n\n <!-- link -->\n <ion-item *ngIf=\"!loading && item.path\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n [routerLink]=\"item.path\"\n routerDirection=\"root\"\n routerLinkActive=\"selected\"\n [routerLinkActiveOptions]=\"{exact: (item.path === '/')}\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- action -->\n <ion-item *ngIf=\"!loading && item.action\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n (click)=\"doAction(item.action, $event)\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- divider -->\n <ion-item-divider @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}}\"\n *ngIf=\"!loading && !item.path && !item.action\">\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item-divider>\n\n </ion-menu-toggle>\n </ion-list>\n </ion-content>\n\n <ion-footer class=\"hidden-xs hidden-sm\">\n <ion-toolbar>\n\n <ion-buttons slot=\"start\">\n <ion-button mat-icon-button color=\"accent\" (click)=\"openAboutModal($event)\">\n <mat-icon slot=\"icon-only\">help_outline</mat-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title (click)=\"openAboutModal($event)\" color=\"medium\">\n {{'MENU.FOOTER_VERSION_ABOUT'| translate: {version: appVersion} }}\n </ion-title>\n\n <ion-buttons slot=\"end\">\n <button mat-icon-button color=\"accent\" (click)=\"toggleSplitPaneShow($event)\"\n class=\"hidden-xs hidden-sm hidden-md\"\n [title]=\"(splitPane.when ? 'COMMON.BTN_HIDE_MENU' : 'COMMON.BTN_SHOW_MENU') |translate\">\n <mat-icon><span>{{splitPane.when ? '«' : '»'}}</span></mat-icon>\n </button>\n </ion-buttons>\n </ion-toolbar>\n </ion-footer>\n\n </ion-menu>\n\n <ng-content></ng-content>\n\n</ion-split-pane>\n\n<ng-template #headerBottomRight>\n <ng-content select=\"[headerBottomRight]\"></ng-content>\n</ng-template>\n",
|
|
24833
24838
|
animations: [fadeInAnimation],
|
|
24834
24839
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
24835
24840
|
styles: ["ion-menu{--ion-item-background:transparent;--ion-item-divider-background:transparent;--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint);--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-primary);--ion-item-icon-color-selected:var(--ion-color-primary);--ion-item-text-color-disable:var(--ion-color-medium);--ion-item-icon-color-disable:var(--ion-color-medium)}ion-menu ion-header ion-text{color:var(--ion-color-primary)}ion-menu ion-header .user-avatar{background-size:cover;background-repeat:no-repeat;background-position:50%;background-color:var(--ion-color-secondary);border:1px solid var(--ion-color-primary);overflow:hidden!important;font-size:var(--avatar-size,60px)!important;line-height:var(--avatar-size,60px);height:var(--avatar-size,60px)!important;width:var(--avatar-size,60px)!important;border-radius:50%;display:inline-block}ion-menu ion-header .user-avatar:hover{background-color:var(--ion-color-secondary-shade);border:2px solid var(--ion-color-primary-shade)}ion-menu ion-header .user-logo{text-align:right}ion-menu ion-header .user-logo img{max-width:120px;max-height:var(--avatar-size,60px);width:auto}ion-menu ion-header .username{padding-top:0;margin-top:0;margin-bottom:0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}ion-menu ion-header button[mat-button]{padding:0;text-align:start!important;width:100%}ion-menu .scroll-content{margin-top:79px!important}ion-menu .has-user-header .scroll-content{margin-top:188px!important}ion-menu ion-content.has-profile-header{--offset-top:188px}ion-menu ion-content.no-profile-header{--offset-top:79px}ion-menu ion-content ion-list{min-height:100%;display:flex;flex-direction:column;justify-content:flex-start}ion-menu ion-content ion-list ion-menu-toggle.flex-spacer{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-end}ion-menu ion-content ion-list ion-item.primary{--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint)}ion-menu ion-content ion-list ion-item.secondary{--ion-item-icon-color:var(--ion-color-secondary-tint);--ion-item-text-color:var(--ion-color-secondary-tint)}ion-menu ion-content ion-list ion-item.tertiary{--ion-item-icon-color:var(--ion-color-tertiary-tint);--ion-item-text-color:var(--ion-color-tertiary-tint)}ion-menu ion-content ion-list ion-item.danger{--ion-item-icon-color:var(--ion-color-danger-tint);--ion-item-text-color:var(--ion-color-danger-tint)}ion-menu ion-content ion-list ion-item.medium{--ion-item-icon-color:var(--ion-color-medium-shade);--ion-item-text-color:var(--ion-color-medium-shade)}ion-menu ion-content ion-list ion-item.dark{--ion-item-icon-color:var(--ion-color-dark-tint);--ion-item-text-color:var(--ion-color-dark-tint)}ion-menu ion-content ion-list ion-item ion-icon,ion-menu ion-content ion-list ion-item mat-icon{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item ion-label,ion-menu ion-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-menu ion-content ion-list ion-item.selected{background-color:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-menu ion-content ion-list ion-item.selected ion-icon,ion-menu ion-content ion-list ion-item.selected mat-icon{color:var(--ion-item-icon-color-selected)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item.selected ion-label,ion-menu ion-content ion-list ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-menu ion-content ion-list ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}ion-menu ion-footer{display:block!important}ion-menu ion-footer ion-toolbar ion-title{cursor:pointer;font-size:12pt;font-weight:400;text-align:center;padding:0 8px}ion-menu ion-footer ion-toolbar ion-button{--width:40px}@media screen and (max-width:767px){ion-menu ion-footer{display:none!important;visibility:hidden!important}}@media screen and (min-width:768px){ion-menu ion-scroll{overflow-y:auto!important}ion-menu .user-avatar{font-size:var(--avatar-size,80px)!important;line-height:var(--avatar-size,80px);height:var(--avatar-size,80px)!important;width:var(--avatar-size,80px)!important}ion-menu .user-logo img{max-height:var(--avatar-size,80px)}}"]
|
|
@@ -30245,7 +30250,7 @@
|
|
|
30245
30250
|
_this.network = network;
|
|
30246
30251
|
_this.translate = translate;
|
|
30247
30252
|
_this.options = options;
|
|
30248
|
-
_this.
|
|
30253
|
+
_this._countSubject = new rxjs.BehaviorSubject(0);
|
|
30249
30254
|
_this.listeners = [];
|
|
30250
30255
|
_this._subscriptions = new rxjs.Subscription();
|
|
30251
30256
|
_this.queries = options.queries;
|
|
@@ -30254,9 +30259,9 @@
|
|
|
30254
30259
|
_this._logPrefix = '[user-event-service] ';
|
|
30255
30260
|
return _this;
|
|
30256
30261
|
}
|
|
30257
|
-
Object.defineProperty(AbstractUserEventService.prototype, "
|
|
30262
|
+
Object.defineProperty(AbstractUserEventService.prototype, "countSubject", {
|
|
30258
30263
|
get: function () {
|
|
30259
|
-
return this.
|
|
30264
|
+
return this._countSubject;
|
|
30260
30265
|
},
|
|
30261
30266
|
enumerable: false,
|
|
30262
30267
|
configurable: true
|
|
@@ -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);
|
|
@@ -30345,7 +30416,7 @@
|
|
|
30345
30416
|
data: entity
|
|
30346
30417
|
});
|
|
30347
30418
|
// Update count
|
|
30348
|
-
this.
|
|
30419
|
+
this._countSubject.next(this._countSubject.value + 1);
|
|
30349
30420
|
};
|
|
30350
30421
|
AbstractUserEventService.prototype.count = function (filter, options) {
|
|
30351
30422
|
var _a;
|
|
@@ -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);
|
|
@@ -30407,15 +30479,15 @@
|
|
|
30407
30479
|
if (total && _this._debug)
|
|
30408
30480
|
console.debug(_this._logPrefix + "Received new user events count:", total);
|
|
30409
30481
|
// update count
|
|
30410
|
-
_this.
|
|
30482
|
+
_this._countSubject.next(total);
|
|
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: {
|
|
@@ -30654,7 +30726,7 @@
|
|
|
30654
30726
|
this.listeners.push(listener);
|
|
30655
30727
|
};
|
|
30656
30728
|
AbstractUserEventService.prototype.resetCount = function () {
|
|
30657
|
-
this.
|
|
30729
|
+
this._countSubject.next(undefined);
|
|
30658
30730
|
this.resetCountDate = moment$6();
|
|
30659
30731
|
// restart listening count changes
|
|
30660
30732
|
this.startListenCountChanges();
|
|
@@ -30671,7 +30743,7 @@
|
|
|
30671
30743
|
if (this._debug)
|
|
30672
30744
|
console.debug(this._logPrefix + "Receiving user events count", count);
|
|
30673
30745
|
// Update count
|
|
30674
|
-
this.
|
|
30746
|
+
this._countSubject.next(count);
|
|
30675
30747
|
// Then listen changes
|
|
30676
30748
|
this.startListenCountChanges();
|
|
30677
30749
|
return [2 /*return*/];
|
|
@@ -30805,56 +30877,180 @@
|
|
|
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
|
-
|
|
30820
|
-
.
|
|
30821
|
-
|
|
30822
|
-
|
|
30823
|
-
|
|
30824
|
-
|
|
30825
|
-
|
|
30826
|
-
|
|
30827
|
-
|
|
30828
|
-
|
|
30829
|
-
|
|
30830
|
-
|
|
30831
|
-
|
|
30832
|
-
|
|
30907
|
+
if (this.userEventService) {
|
|
30908
|
+
this.subscriptions.add(this.userEventService
|
|
30909
|
+
.watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
|
|
30910
|
+
.subscribe(function (result) {
|
|
30911
|
+
var _a;
|
|
30912
|
+
if (_this.debug)
|
|
30913
|
+
console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
|
|
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;
|
|
30917
|
+
_this.markForCheck();
|
|
30918
|
+
}));
|
|
30919
|
+
// Listen changes
|
|
30920
|
+
this.subscriptions.add(this.userEventService.listenAllChanges(undefined)
|
|
30921
|
+
.subscribe(function (data) {
|
|
30922
|
+
if (_this.debug)
|
|
30923
|
+
console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
|
|
30924
|
+
}));
|
|
30925
|
+
}
|
|
30833
30926
|
};
|
|
30834
30927
|
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
30835
30928
|
this.subscriptions.unsubscribe();
|
|
30836
30929
|
};
|
|
30837
|
-
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) {
|
|
30838
30945
|
var _a;
|
|
30839
30946
|
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
30840
30947
|
return;
|
|
30841
30948
|
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
30842
30949
|
};
|
|
30843
|
-
UserEventNotificationList.prototype.
|
|
30950
|
+
UserEventNotificationList.prototype.markAllAsRead = function (event) {
|
|
30844
30951
|
var _a;
|
|
30845
|
-
var unreadUserEvents = (this.
|
|
30952
|
+
var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
|
|
30846
30953
|
if (!unreadUserEvents.length)
|
|
30847
30954
|
return;
|
|
30848
30955
|
(_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
|
|
30849
30956
|
};
|
|
30850
|
-
UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
|
|
30851
|
-
|
|
30852
|
-
|
|
30853
|
-
|
|
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
|
+
});
|
|
30854
30987
|
};
|
|
30855
30988
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
30856
30989
|
this.popoverController.dismiss();
|
|
30857
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
|
+
};
|
|
30858
31054
|
UserEventNotificationList.prototype.markForCheck = function () {
|
|
30859
31055
|
this.cd.markForCheck();
|
|
30860
31056
|
};
|
|
@@ -30863,48 +31059,61 @@
|
|
|
30863
31059
|
UserEventNotificationList.decorators = [
|
|
30864
31060
|
{ type: i0.Component, args: [{
|
|
30865
31061
|
selector: 'app-user-event-notification-list',
|
|
30866
|
-
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",
|
|
30867
31063
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
30868
|
-
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}"]
|
|
30869
31065
|
},] }
|
|
30870
31066
|
];
|
|
30871
31067
|
UserEventNotificationList.ctorParameters = function () { return [
|
|
30872
31068
|
{ type: i0.ChangeDetectorRef },
|
|
30873
31069
|
{ type: i1$5.PopoverController },
|
|
31070
|
+
{ type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
|
|
30874
31071
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
|
|
30875
31072
|
]; };
|
|
30876
31073
|
UserEventNotificationList.propDecorators = {
|
|
30877
31074
|
debug: [{ type: i0.Input }],
|
|
31075
|
+
mobile: [{ type: i0.Input }],
|
|
30878
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 }],
|
|
30879
31082
|
readEvent: [{ type: i0.Output }],
|
|
30880
|
-
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,] }]
|
|
30881
31086
|
};
|
|
30882
31087
|
|
|
30883
|
-
var
|
|
30884
|
-
function
|
|
31088
|
+
var AppUserEventNotificationIcon = /** @class */ (function () {
|
|
31089
|
+
function AppUserEventNotificationIcon(userEventService, accountService, popoverController) {
|
|
30885
31090
|
this.userEventService = userEventService;
|
|
30886
31091
|
this.accountService = accountService;
|
|
30887
31092
|
this.popoverController = popoverController;
|
|
30888
31093
|
this.debug = false;
|
|
30889
31094
|
this.titleI18n = 'SOCIAL.USER_EVENT.NOTIFICATION.TITLE';
|
|
30890
31095
|
this.disabled = false;
|
|
31096
|
+
this.filter = null;
|
|
30891
31097
|
this._logPrefix = '[user-event-notification] ';
|
|
30892
31098
|
this._readEvent = new i0.EventEmitter();
|
|
30893
31099
|
this._readEvents = new i0.EventEmitter();
|
|
30894
31100
|
}
|
|
30895
|
-
Object.defineProperty(
|
|
31101
|
+
Object.defineProperty(AppUserEventNotificationIcon.prototype, "countChanges", {
|
|
30896
31102
|
get: function () {
|
|
30897
|
-
|
|
30898
|
-
|
|
31103
|
+
if (!this.userEventService)
|
|
31104
|
+
return rxjs.of();
|
|
31105
|
+
return this.userEventService
|
|
31106
|
+
.countSubject
|
|
31107
|
+
.pipe(operators.map(function (value) { return value === 0 ? undefined : value; }));
|
|
30899
31108
|
},
|
|
30900
31109
|
enumerable: false,
|
|
30901
31110
|
configurable: true
|
|
30902
31111
|
});
|
|
30903
|
-
|
|
31112
|
+
AppUserEventNotificationIcon.prototype.ngOnInit = function () {
|
|
30904
31113
|
return __awaiter(this, void 0, void 0, function () {
|
|
30905
31114
|
var _this = this;
|
|
30906
|
-
return __generator(this, function (
|
|
30907
|
-
switch (
|
|
31115
|
+
return __generator(this, function (_a) {
|
|
31116
|
+
switch (_a.label) {
|
|
30908
31117
|
case 0:
|
|
30909
31118
|
if (isNil(this.userEventService)) {
|
|
30910
31119
|
console.warn(this._logPrefix + "No service injected");
|
|
@@ -30915,7 +31124,7 @@
|
|
|
30915
31124
|
return [4 /*yield*/, this.userEventService.ready()];
|
|
30916
31125
|
case 1:
|
|
30917
31126
|
// Wait service
|
|
30918
|
-
|
|
31127
|
+
_a.sent();
|
|
30919
31128
|
// Subscribe to read event
|
|
30920
31129
|
this._readEvent.subscribe(function (value) {
|
|
30921
31130
|
// default: mark event as read
|
|
@@ -30929,11 +31138,11 @@
|
|
|
30929
31138
|
});
|
|
30930
31139
|
});
|
|
30931
31140
|
};
|
|
30932
|
-
|
|
31141
|
+
AppUserEventNotificationIcon.prototype.showList = function (event) {
|
|
30933
31142
|
return __awaiter(this, void 0, void 0, function () {
|
|
30934
31143
|
var popover;
|
|
30935
|
-
return __generator(this, function (
|
|
30936
|
-
switch (
|
|
31144
|
+
return __generator(this, function (_a) {
|
|
31145
|
+
switch (_a.label) {
|
|
30937
31146
|
case 0:
|
|
30938
31147
|
// Reset count
|
|
30939
31148
|
this.userEventService.resetCount();
|
|
@@ -30949,42 +31158,42 @@
|
|
|
30949
31158
|
keyboardClose: true,
|
|
30950
31159
|
event: event,
|
|
30951
31160
|
translucent: true,
|
|
30952
|
-
cssClass: 'popover-large'
|
|
31161
|
+
cssClass: 'popover-large popover-notifications'
|
|
30953
31162
|
})];
|
|
30954
31163
|
case 1:
|
|
30955
|
-
popover =
|
|
31164
|
+
popover = _a.sent();
|
|
30956
31165
|
return [4 /*yield*/, popover.present()];
|
|
30957
31166
|
case 2:
|
|
30958
|
-
|
|
31167
|
+
_a.sent();
|
|
30959
31168
|
return [2 /*return*/];
|
|
30960
31169
|
}
|
|
30961
31170
|
});
|
|
30962
31171
|
});
|
|
30963
31172
|
};
|
|
30964
|
-
|
|
31173
|
+
AppUserEventNotificationIcon.prototype.ngOnDestroy = function () {
|
|
30965
31174
|
if (this.debug) {
|
|
30966
31175
|
console.debug(this._logPrefix + "Destroying");
|
|
30967
31176
|
}
|
|
30968
31177
|
};
|
|
30969
|
-
return
|
|
31178
|
+
return AppUserEventNotificationIcon;
|
|
30970
31179
|
}());
|
|
30971
|
-
|
|
31180
|
+
AppUserEventNotificationIcon.decorators = [
|
|
30972
31181
|
{ type: i0.Component, args: [{
|
|
30973
|
-
selector: 'app-user-event-notification-
|
|
30974
|
-
template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"
|
|
30975
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
30976
|
-
styles: [""]
|
|
31182
|
+
selector: 'app-user-event-notification-icon',
|
|
31183
|
+
template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"countChanges | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n",
|
|
31184
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
30977
31185
|
},] }
|
|
30978
31186
|
];
|
|
30979
|
-
|
|
31187
|
+
AppUserEventNotificationIcon.ctorParameters = function () { return [
|
|
30980
31188
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
|
|
30981
31189
|
{ type: AccountService },
|
|
30982
31190
|
{ type: i1$5.PopoverController }
|
|
30983
31191
|
]; };
|
|
30984
|
-
|
|
31192
|
+
AppUserEventNotificationIcon.propDecorators = {
|
|
30985
31193
|
debug: [{ type: i0.Input }],
|
|
30986
31194
|
titleI18n: [{ type: i0.Input }],
|
|
30987
|
-
disabled: [{ type: i0.Input }]
|
|
31195
|
+
disabled: [{ type: i0.Input }],
|
|
31196
|
+
filter: [{ type: i0.Input }]
|
|
30988
31197
|
};
|
|
30989
31198
|
|
|
30990
31199
|
var UserEventModule = /** @class */ (function () {
|
|
@@ -31000,11 +31209,11 @@
|
|
|
31000
31209
|
AppIconModule
|
|
31001
31210
|
],
|
|
31002
31211
|
declarations: [
|
|
31003
|
-
|
|
31212
|
+
AppUserEventNotificationIcon,
|
|
31004
31213
|
UserEventNotificationList
|
|
31005
31214
|
],
|
|
31006
31215
|
exports: [
|
|
31007
|
-
|
|
31216
|
+
AppUserEventNotificationIcon
|
|
31008
31217
|
]
|
|
31009
31218
|
},] }
|
|
31010
31219
|
];
|
|
@@ -31603,6 +31812,11 @@
|
|
|
31603
31812
|
JobModule,
|
|
31604
31813
|
MessageModule
|
|
31605
31814
|
],
|
|
31815
|
+
exports: [
|
|
31816
|
+
UserEventModule,
|
|
31817
|
+
JobModule,
|
|
31818
|
+
MessageModule
|
|
31819
|
+
]
|
|
31606
31820
|
},] }
|
|
31607
31821
|
];
|
|
31608
31822
|
|
|
@@ -33842,6 +34056,463 @@
|
|
|
33842
34056
|
},] }
|
|
33843
34057
|
];
|
|
33844
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
|
+
|
|
33845
34516
|
// Environment
|
|
33846
34517
|
|
|
33847
34518
|
/**
|
|
@@ -33897,6 +34568,7 @@
|
|
|
33897
34568
|
exports.AppTable = AppTable;
|
|
33898
34569
|
exports.AppTableDataSourceOptions = AppTableDataSourceOptions;
|
|
33899
34570
|
exports.AppTableUtils = AppTableUtils;
|
|
34571
|
+
exports.AppUserEventNotificationIcon = AppUserEventNotificationIcon;
|
|
33900
34572
|
exports.AppValidatorService = AppValidatorService;
|
|
33901
34573
|
exports.AppendToInputDirective = AppendToInputDirective;
|
|
33902
34574
|
exports.ArrayFilterPipe = ArrayFilterPipe;
|
|
@@ -33996,6 +34668,9 @@
|
|
|
33996
34668
|
exports.JobProgressionComponent = JobProgressionComponent;
|
|
33997
34669
|
exports.JobProgressionService = JobProgressionService;
|
|
33998
34670
|
exports.JobProgressionServiceToken = JobProgressionServiceToken;
|
|
34671
|
+
exports.JobProgressionTestService = JobProgressionTestService;
|
|
34672
|
+
exports.JobProgressionTestingPage = JobProgressionTestingPage;
|
|
34673
|
+
exports.JobTestingModule = JobTestingModule;
|
|
33999
34674
|
exports.JobUtils = JobUtils;
|
|
34000
34675
|
exports.KEYBOARD_HIDE_DELAY_MS = KEYBOARD_HIDE_DELAY_MS;
|
|
34001
34676
|
exports.LAT_LONG_DEFAULT_MAX_DECIMALS = LAT_LONG_DEFAULT_MAX_DECIMALS;
|
|
@@ -34075,6 +34750,7 @@
|
|
|
34075
34750
|
exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
|
|
34076
34751
|
exports.SHARED_MATERIAL_TESTING_PAGES = SHARED_MATERIAL_TESTING_PAGES;
|
|
34077
34752
|
exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
|
|
34753
|
+
exports.SOCIAL_TESTING_PAGES = SOCIAL_TESTING_PAGES;
|
|
34078
34754
|
exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
|
|
34079
34755
|
exports.SelectPeerModal = SelectPeerModal;
|
|
34080
34756
|
exports.ServerErrorCodes = ServerErrorCodes;
|
|
@@ -34103,6 +34779,7 @@
|
|
|
34103
34779
|
exports.SocialErrorCodes = SocialErrorCodes;
|
|
34104
34780
|
exports.SocialModule = SocialModule;
|
|
34105
34781
|
exports.SocialModuleOptionsToken = SocialModuleOptionsToken;
|
|
34782
|
+
exports.SocialTestingModule = SocialTestingModule;
|
|
34106
34783
|
exports.StartableService = StartableService;
|
|
34107
34784
|
exports.StatusById = StatusById;
|
|
34108
34785
|
exports.StatusIds = StatusIds;
|
|
@@ -34133,7 +34810,9 @@
|
|
|
34133
34810
|
exports.UriUtils = UriUtils;
|
|
34134
34811
|
exports.UserEventFragments = UserEventFragments;
|
|
34135
34812
|
exports.UserEventModule = UserEventModule;
|
|
34136
|
-
exports.
|
|
34813
|
+
exports.UserEventTestService = UserEventTestService;
|
|
34814
|
+
exports.UserEventTestingModule = UserEventTestingModule;
|
|
34815
|
+
exports.UserEventTestingPage = UserEventTestingPage;
|
|
34137
34816
|
exports.UserEventTypes = UserEventTypes;
|
|
34138
34817
|
exports.UsersPage = UsersPage;
|
|
34139
34818
|
exports.accountToString = accountToString;
|