@sumaris-net/ngx-components 1.21.0-beta18 → 1.21.0-beta20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/sumaris-net.ngx-components.umd.js +231 -83
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +9 -2
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +12 -4
- package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +10 -8
- package/esm2015/src/app/social/user-event/user-event.service.js +93 -31
- package/fesm2015/sumaris-net.ngx-components.js +116 -39
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/social/user-event/notification/user-event-notification.component.d.ts +1 -0
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +4 -1
- package/src/app/social/user-event/testing/user-event.testing.service.d.ts +0 -2
- package/src/app/social/user-event/user-event.service.d.ts +10 -7
- package/src/assets/i18n/en.json +2 -1
- package/src/assets/i18n/fr.json +2 -1
- package/src/theme/_ngx-components.scss +1 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -30443,13 +30443,21 @@
|
|
|
30443
30443
|
};
|
|
30444
30444
|
AbstractUserEventService.prototype.save = function (entity, options) {
|
|
30445
30445
|
return __awaiter(this, void 0, void 0, function () {
|
|
30446
|
-
var
|
|
30446
|
+
var allData, withContent, json, now;
|
|
30447
30447
|
var _this = this;
|
|
30448
30448
|
return __generator(this, function (_b) {
|
|
30449
30449
|
switch (_b.label) {
|
|
30450
30450
|
case 0:
|
|
30451
|
+
if (!!this.mutations.save) return [3 /*break*/, 2];
|
|
30452
|
+
if (!this.mutations.saveAll)
|
|
30453
|
+
throw new Error('Not implemented');
|
|
30454
|
+
return [4 /*yield*/, this.saveAll([entity], options)];
|
|
30455
|
+
case 1:
|
|
30456
|
+
allData = _b.sent();
|
|
30457
|
+
return [2 /*return*/, allData === null || allData === void 0 ? void 0 : allData[0]];
|
|
30458
|
+
case 2:
|
|
30451
30459
|
this.fillDefaultProperties(entity);
|
|
30452
|
-
|
|
30460
|
+
withContent = !!entity.content;
|
|
30453
30461
|
json = entity.asObject();
|
|
30454
30462
|
now = Date.now();
|
|
30455
30463
|
if (this._debug)
|
|
@@ -30469,75 +30477,167 @@
|
|
|
30469
30477
|
console.debug(_this._logPrefix + "User event saved in " + (Date.now() - now) + "ms", entity);
|
|
30470
30478
|
_this.copyIdAndUpdateDate(savedEntity, entity);
|
|
30471
30479
|
// Add to cache
|
|
30472
|
-
if (
|
|
30473
|
-
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30474
|
-
query: _this.queries.loadAll,
|
|
30475
|
-
data: Object.assign(Object.assign({}, savedEntity), { content: null })
|
|
30476
|
-
});
|
|
30480
|
+
if (withContent) {
|
|
30477
30481
|
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30478
30482
|
query: _this.queries.loadAllWithContent,
|
|
30479
30483
|
data: savedEntity
|
|
30480
30484
|
});
|
|
30481
30485
|
}
|
|
30486
|
+
else {
|
|
30487
|
+
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30488
|
+
query: _this.queries.loadAll,
|
|
30489
|
+
data: Object.assign(Object.assign({}, savedEntity), { content: null })
|
|
30490
|
+
});
|
|
30491
|
+
}
|
|
30482
30492
|
}
|
|
30483
30493
|
}
|
|
30484
30494
|
})];
|
|
30485
|
-
case
|
|
30495
|
+
case 3:
|
|
30486
30496
|
_b.sent();
|
|
30487
30497
|
return [2 /*return*/, entity];
|
|
30488
30498
|
}
|
|
30489
30499
|
});
|
|
30490
30500
|
});
|
|
30491
30501
|
};
|
|
30492
|
-
AbstractUserEventService.prototype.saveAll = function (
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30502
|
+
AbstractUserEventService.prototype.saveAll = function (entities, opts) {
|
|
30503
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30504
|
+
var json, now;
|
|
30505
|
+
var _this = this;
|
|
30506
|
+
return __generator(this, function (_b) {
|
|
30507
|
+
switch (_b.label) {
|
|
30508
|
+
case 0:
|
|
30509
|
+
if (isEmptyArray(entities))
|
|
30510
|
+
return [2 /*return*/, entities];
|
|
30511
|
+
if (!this.mutations.saveAll) {
|
|
30512
|
+
if (!this.mutations.save)
|
|
30513
|
+
throw new Error('Not implemented');
|
|
30514
|
+
// Save one by one
|
|
30515
|
+
return [2 /*return*/, chainPromises(entities.map(function (entity) { return function () { return _this.save(entity, opts); }; }))];
|
|
30516
|
+
}
|
|
30517
|
+
json = entities.map(function (entity) {
|
|
30518
|
+
_this.fillDefaultProperties(entity);
|
|
30519
|
+
return entity.asObject();
|
|
30520
|
+
});
|
|
30521
|
+
now = Date.now();
|
|
30522
|
+
if (this._debug)
|
|
30523
|
+
console.debug(this._logPrefix + "Saving user events...", json);
|
|
30524
|
+
return [4 /*yield*/, this.graphql.mutate({
|
|
30525
|
+
mutation: this.mutations.saveAll,
|
|
30526
|
+
variables: {
|
|
30527
|
+
data: json
|
|
30528
|
+
},
|
|
30529
|
+
error: { code: SocialErrorCodes.SAVE_USER_EVENT_ERROR, message: 'SOCIAL.ERROR.SAVE_USER_EVENT_ERROR' },
|
|
30530
|
+
update: function (proxy, _b) {
|
|
30531
|
+
var data = _b.data;
|
|
30532
|
+
// Update entity
|
|
30533
|
+
var savedEntities = (data === null || data === void 0 ? void 0 : data.data) || [];
|
|
30534
|
+
if (savedEntities.length) {
|
|
30535
|
+
if (_this._debug)
|
|
30536
|
+
console.debug(_this._logPrefix + "User events saved in " + (Date.now() - now) + "ms", savedEntities);
|
|
30537
|
+
entities.forEach(function (entity) {
|
|
30538
|
+
var savedEntity = savedEntities.find(function (e) { return EntityUtils.equals(e, entity, 'id'); });
|
|
30539
|
+
_this.copyIdAndUpdateDate(savedEntity, entity);
|
|
30540
|
+
});
|
|
30541
|
+
// Add to cache (assuming all with content)
|
|
30542
|
+
_this.insertIntoMutableCachedQueries(proxy, {
|
|
30543
|
+
query: _this.queries.loadAllWithContent,
|
|
30544
|
+
data: savedEntities
|
|
30545
|
+
});
|
|
30546
|
+
}
|
|
30547
|
+
}
|
|
30548
|
+
})];
|
|
30549
|
+
case 1:
|
|
30550
|
+
_b.sent();
|
|
30551
|
+
return [2 /*return*/, entities];
|
|
30552
|
+
}
|
|
30553
|
+
});
|
|
30554
|
+
});
|
|
30496
30555
|
};
|
|
30497
|
-
AbstractUserEventService.prototype.markAsRead = function (
|
|
30556
|
+
AbstractUserEventService.prototype.markAsRead = function (entities) {
|
|
30498
30557
|
return __awaiter(this, void 0, void 0, function () {
|
|
30499
|
-
var
|
|
30500
|
-
var e_1,
|
|
30501
|
-
return __generator(this, function (
|
|
30502
|
-
switch (
|
|
30558
|
+
var userEventWithoutReadListeners, _loop_1, this_1, _b, _c, entity, e_1_1;
|
|
30559
|
+
var e_1, _d;
|
|
30560
|
+
return __generator(this, function (_e) {
|
|
30561
|
+
switch (_e.label) {
|
|
30503
30562
|
case 0:
|
|
30504
|
-
|
|
30505
|
-
|
|
30506
|
-
|
|
30563
|
+
userEventWithoutReadListeners = [];
|
|
30564
|
+
_loop_1 = function (entity) {
|
|
30565
|
+
var onReadListeners, onReadListeners_1, onReadListeners_1_1, listener, e_2_1;
|
|
30566
|
+
var e_2, _b;
|
|
30567
|
+
return __generator(this, function (_c) {
|
|
30568
|
+
switch (_c.label) {
|
|
30569
|
+
case 0:
|
|
30570
|
+
onReadListeners = (this_1.listeners || []).filter(function (listener) { return !!listener.onRead; }).filter(function (listener) { return listener.accept(entity); });
|
|
30571
|
+
if (!onReadListeners.length) return [3 /*break*/, 9];
|
|
30572
|
+
_c.label = 1;
|
|
30573
|
+
case 1:
|
|
30574
|
+
_c.trys.push([1, 6, 7, 8]);
|
|
30575
|
+
onReadListeners_1 = (e_2 = void 0, __values(onReadListeners)), onReadListeners_1_1 = onReadListeners_1.next();
|
|
30576
|
+
_c.label = 2;
|
|
30577
|
+
case 2:
|
|
30578
|
+
if (!!onReadListeners_1_1.done) return [3 /*break*/, 5];
|
|
30579
|
+
listener = onReadListeners_1_1.value;
|
|
30580
|
+
return [4 /*yield*/, listener.onRead(entity)];
|
|
30581
|
+
case 3:
|
|
30582
|
+
_c.sent();
|
|
30583
|
+
_c.label = 4;
|
|
30584
|
+
case 4:
|
|
30585
|
+
onReadListeners_1_1 = onReadListeners_1.next();
|
|
30586
|
+
return [3 /*break*/, 2];
|
|
30587
|
+
case 5: return [3 /*break*/, 8];
|
|
30588
|
+
case 6:
|
|
30589
|
+
e_2_1 = _c.sent();
|
|
30590
|
+
e_2 = { error: e_2_1 };
|
|
30591
|
+
return [3 /*break*/, 8];
|
|
30592
|
+
case 7:
|
|
30593
|
+
try {
|
|
30594
|
+
if (onReadListeners_1_1 && !onReadListeners_1_1.done && (_b = onReadListeners_1.return)) _b.call(onReadListeners_1);
|
|
30595
|
+
}
|
|
30596
|
+
finally { if (e_2) throw e_2.error; }
|
|
30597
|
+
return [7 /*endfinally*/];
|
|
30598
|
+
case 8: return [3 /*break*/, 10];
|
|
30599
|
+
case 9:
|
|
30600
|
+
// Add to this list for default operation
|
|
30601
|
+
userEventWithoutReadListeners.push(entity);
|
|
30602
|
+
_c.label = 10;
|
|
30603
|
+
case 10: return [2 /*return*/];
|
|
30604
|
+
}
|
|
30605
|
+
});
|
|
30606
|
+
};
|
|
30607
|
+
this_1 = this;
|
|
30608
|
+
_e.label = 1;
|
|
30507
30609
|
case 1:
|
|
30508
|
-
|
|
30509
|
-
|
|
30510
|
-
|
|
30610
|
+
_e.trys.push([1, 6, 7, 8]);
|
|
30611
|
+
_b = __values((entities || [])), _c = _b.next();
|
|
30612
|
+
_e.label = 2;
|
|
30511
30613
|
case 2:
|
|
30512
|
-
if (!!
|
|
30513
|
-
|
|
30514
|
-
return [
|
|
30614
|
+
if (!!_c.done) return [3 /*break*/, 5];
|
|
30615
|
+
entity = _c.value;
|
|
30616
|
+
return [5 /*yield**/, _loop_1(entity)];
|
|
30515
30617
|
case 3:
|
|
30516
|
-
|
|
30517
|
-
|
|
30618
|
+
_e.sent();
|
|
30619
|
+
_e.label = 4;
|
|
30518
30620
|
case 4:
|
|
30519
|
-
|
|
30621
|
+
_c = _b.next();
|
|
30520
30622
|
return [3 /*break*/, 2];
|
|
30521
30623
|
case 5: return [3 /*break*/, 8];
|
|
30522
30624
|
case 6:
|
|
30523
|
-
e_1_1 =
|
|
30625
|
+
e_1_1 = _e.sent();
|
|
30524
30626
|
e_1 = { error: e_1_1 };
|
|
30525
30627
|
return [3 /*break*/, 8];
|
|
30526
30628
|
case 7:
|
|
30527
30629
|
try {
|
|
30528
|
-
if (
|
|
30630
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
30529
30631
|
}
|
|
30530
30632
|
finally { if (e_1) throw e_1.error; }
|
|
30531
30633
|
return [7 /*endfinally*/];
|
|
30532
|
-
case 8:
|
|
30533
|
-
case 9:
|
|
30634
|
+
case 8:
|
|
30534
30635
|
// Use default
|
|
30535
|
-
return [4 /*yield*/, this.defaultMarkAsRead(
|
|
30536
|
-
case
|
|
30636
|
+
return [4 /*yield*/, this.defaultMarkAsRead(userEventWithoutReadListeners)];
|
|
30637
|
+
case 9:
|
|
30537
30638
|
// Use default
|
|
30538
|
-
|
|
30539
|
-
|
|
30540
|
-
case 11: return [2 /*return*/];
|
|
30639
|
+
_e.sent();
|
|
30640
|
+
return [2 /*return*/];
|
|
30541
30641
|
}
|
|
30542
30642
|
});
|
|
30543
30643
|
});
|
|
@@ -30547,11 +30647,13 @@
|
|
|
30547
30647
|
this.listeners = [];
|
|
30548
30648
|
this.listeners.push(listener);
|
|
30549
30649
|
};
|
|
30650
|
+
AbstractUserEventService.prototype.resetCount = function () {
|
|
30651
|
+
this._count$.next(undefined);
|
|
30652
|
+
};
|
|
30550
30653
|
/* -- protected methods -- */
|
|
30551
30654
|
AbstractUserEventService.prototype.onLogin = function () {
|
|
30552
30655
|
return __awaiter(this, void 0, void 0, function () {
|
|
30553
30656
|
var count;
|
|
30554
|
-
var _this = this;
|
|
30555
30657
|
return __generator(this, function (_b) {
|
|
30556
30658
|
switch (_b.label) {
|
|
30557
30659
|
case 0: return [4 /*yield*/, this.count(undefined)];
|
|
@@ -30562,10 +30664,7 @@
|
|
|
30562
30664
|
// Update count
|
|
30563
30665
|
this._count$.next(count);
|
|
30564
30666
|
// Then listen changes
|
|
30565
|
-
this._listenSubscription = this.listenCountChanges(undefined).subscribe(
|
|
30566
|
-
if (_this._debug)
|
|
30567
|
-
console.debug(_this._logPrefix + "Receiving new user events count", count);
|
|
30568
|
-
});
|
|
30667
|
+
this._listenSubscription = this.listenCountChanges(undefined).subscribe();
|
|
30569
30668
|
return [2 /*return*/];
|
|
30570
30669
|
}
|
|
30571
30670
|
});
|
|
@@ -30576,7 +30675,7 @@
|
|
|
30576
30675
|
(_a = this._listenSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
30577
30676
|
};
|
|
30578
30677
|
AbstractUserEventService.prototype.processUserEvent = function (source, that) {
|
|
30579
|
-
var
|
|
30678
|
+
var e_3, _b;
|
|
30580
30679
|
that = that || this;
|
|
30581
30680
|
// Convert json source to IUserEvent
|
|
30582
30681
|
var target = that.fromObject(source);
|
|
@@ -30595,33 +30694,41 @@
|
|
|
30595
30694
|
}
|
|
30596
30695
|
}
|
|
30597
30696
|
}
|
|
30598
|
-
catch (
|
|
30697
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
30599
30698
|
finally {
|
|
30600
30699
|
try {
|
|
30601
30700
|
if (listeners_1_1 && !listeners_1_1.done && (_b = listeners_1.return)) _b.call(listeners_1);
|
|
30602
30701
|
}
|
|
30603
|
-
finally { if (
|
|
30702
|
+
finally { if (e_3) throw e_3.error; }
|
|
30604
30703
|
}
|
|
30605
30704
|
return target;
|
|
30606
30705
|
};
|
|
30607
|
-
AbstractUserEventService.prototype.defaultMarkAsRead = function (
|
|
30706
|
+
AbstractUserEventService.prototype.defaultMarkAsRead = function (userEvents) {
|
|
30608
30707
|
return __awaiter(this, void 0, void 0, function () {
|
|
30708
|
+
var localEntities, remoteEntities;
|
|
30609
30709
|
return __generator(this, function (_b) {
|
|
30610
30710
|
switch (_b.label) {
|
|
30611
30711
|
case 0:
|
|
30612
|
-
if (!
|
|
30712
|
+
if (!userEvents)
|
|
30613
30713
|
throw new Error(this._logPrefix + "Invalid event to save");
|
|
30714
|
+
if (!userEvents.length)
|
|
30715
|
+
return [2 /*return*/];
|
|
30614
30716
|
// set read date
|
|
30615
|
-
userEvent.readDate = moment$6();
|
|
30616
|
-
|
|
30617
|
-
|
|
30618
|
-
|
|
30619
|
-
|
|
30620
|
-
|
|
30621
|
-
|
|
30717
|
+
userEvents.forEach(function (userEvent) { return userEvent.readDate = moment$6(); });
|
|
30718
|
+
localEntities = userEvents.filter(function (userEvent) { return !userEvent.id || userEvent.id < 0; });
|
|
30719
|
+
remoteEntities = userEvents.filter(function (userEvent) { return userEvent.id > 0; });
|
|
30720
|
+
// save local entities
|
|
30721
|
+
if (localEntities.length) {
|
|
30722
|
+
if (this._debug)
|
|
30723
|
+
console.debug(this._logPrefix + "Save local user event");
|
|
30724
|
+
// TODO !!!!!!!!!!!!!
|
|
30725
|
+
}
|
|
30726
|
+
if (!remoteEntities.length) return [3 /*break*/, 2];
|
|
30727
|
+
return [4 /*yield*/, this.saveAll(remoteEntities)];
|
|
30728
|
+
case 1:
|
|
30622
30729
|
_b.sent();
|
|
30623
|
-
_b.label =
|
|
30624
|
-
case
|
|
30730
|
+
_b.label = 2;
|
|
30731
|
+
case 2: return [2 /*return*/];
|
|
30625
30732
|
}
|
|
30626
30733
|
});
|
|
30627
30734
|
});
|
|
@@ -31028,12 +31135,19 @@
|
|
|
31028
31135
|
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
31029
31136
|
this.subscriptions.unsubscribe();
|
|
31030
31137
|
};
|
|
31031
|
-
UserEventNotificationList.prototype.read = function (
|
|
31138
|
+
UserEventNotificationList.prototype.read = function (event, userEvent) {
|
|
31032
31139
|
var _a;
|
|
31033
31140
|
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
31034
31141
|
return;
|
|
31035
31142
|
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
31036
31143
|
};
|
|
31144
|
+
UserEventNotificationList.prototype.readAll = function (event) {
|
|
31145
|
+
var _a;
|
|
31146
|
+
var unreadUserEvents = (this.userEvents.value || []).filter(function (value) { return !value.readDate; });
|
|
31147
|
+
if (!unreadUserEvents.length)
|
|
31148
|
+
return;
|
|
31149
|
+
(_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
|
|
31150
|
+
};
|
|
31037
31151
|
UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
|
|
31038
31152
|
// Execute then close popover
|
|
31039
31153
|
action.executeAction(userEvent);
|
|
@@ -31050,7 +31164,7 @@
|
|
|
31050
31164
|
UserEventNotificationList.decorators = [
|
|
31051
31165
|
{ type: i0.Component, args: [{
|
|
31052
31166
|
selector: 'app-user-event-notification-list',
|
|
31053
|
-
template: "\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-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.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\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '➞ ' + action.name}}\n </a>\n </span>\n </p>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <app-icon\n *ngIf=\"userEvent.icon\"\n [ref]=\"userEvent.icon\"\n height=\"16\"\n width=\"16\"\n [style.vertical-align]=\"'sub'\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span [style.color]=\"'gray'\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n</ion-list>\n",
|
|
31167
|
+
template: "\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-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.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\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '➞ ' + action.name}}\n </a>\n </span>\n </p>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <app-icon\n *ngIf=\"userEvent.icon\"\n [ref]=\"userEvent.icon\"\n height=\"16\"\n width=\"16\"\n [style.vertical-align]=\"'sub'\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span [style.color]=\"'gray'\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n <ion-row class=\"ion-list-footer column\">\n <ion-col>\n <a style=\"cursor: pointer\" (click)=\"readAll($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-col>\n </ion-row>\n\n</ion-list>\n",
|
|
31054
31168
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
31055
31169
|
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}.unread{font-weight:700}"]
|
|
31056
31170
|
},] }
|
|
@@ -31063,7 +31177,8 @@
|
|
|
31063
31177
|
UserEventNotificationList.propDecorators = {
|
|
31064
31178
|
debug: [{ type: i0.Input }],
|
|
31065
31179
|
titleI18n: [{ type: i0.Input }],
|
|
31066
|
-
readEvent: [{ type: i0.Output }]
|
|
31180
|
+
readEvent: [{ type: i0.Output }],
|
|
31181
|
+
readEvents: [{ type: i0.Output }]
|
|
31067
31182
|
};
|
|
31068
31183
|
|
|
31069
31184
|
var UserEventNotificationComponent = /** @class */ (function () {
|
|
@@ -31076,6 +31191,7 @@
|
|
|
31076
31191
|
this.disabled = false;
|
|
31077
31192
|
this._logPrefix = '[user-event-notification] ';
|
|
31078
31193
|
this._readEvent = new i0.EventEmitter();
|
|
31194
|
+
this._readEvents = new i0.EventEmitter();
|
|
31079
31195
|
}
|
|
31080
31196
|
Object.defineProperty(UserEventNotificationComponent.prototype, "count", {
|
|
31081
31197
|
get: function () {
|
|
@@ -31097,6 +31213,9 @@
|
|
|
31097
31213
|
// Subscribe to read event
|
|
31098
31214
|
this._readEvent.subscribe(function (value) {
|
|
31099
31215
|
// default: mark event as read
|
|
31216
|
+
_this.userEventService.markAsRead([value]);
|
|
31217
|
+
});
|
|
31218
|
+
this._readEvents.subscribe(function (value) {
|
|
31100
31219
|
_this.userEventService.markAsRead(value);
|
|
31101
31220
|
});
|
|
31102
31221
|
return [2 /*return*/];
|
|
@@ -31108,19 +31227,23 @@
|
|
|
31108
31227
|
var popover;
|
|
31109
31228
|
return __generator(this, function (_b) {
|
|
31110
31229
|
switch (_b.label) {
|
|
31111
|
-
case 0:
|
|
31112
|
-
|
|
31113
|
-
|
|
31114
|
-
|
|
31115
|
-
|
|
31116
|
-
|
|
31117
|
-
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31230
|
+
case 0:
|
|
31231
|
+
// Reset count
|
|
31232
|
+
this.userEventService.resetCount();
|
|
31233
|
+
return [4 /*yield*/, this.popoverController.create({
|
|
31234
|
+
component: UserEventNotificationList,
|
|
31235
|
+
componentProps: {
|
|
31236
|
+
debug: this.debug,
|
|
31237
|
+
titleI18n: this.titleI18n,
|
|
31238
|
+
readEvent: this._readEvent,
|
|
31239
|
+
readEvents: this._readEvents
|
|
31240
|
+
},
|
|
31241
|
+
backdropDismiss: true,
|
|
31242
|
+
keyboardClose: true,
|
|
31243
|
+
event: event,
|
|
31244
|
+
translucent: true,
|
|
31245
|
+
cssClass: 'popover-large'
|
|
31246
|
+
})];
|
|
31124
31247
|
case 1:
|
|
31125
31248
|
popover = _b.sent();
|
|
31126
31249
|
return [4 /*yield*/, popover.present()];
|
|
@@ -31167,7 +31290,6 @@
|
|
|
31167
31290
|
_this.translate = translate;
|
|
31168
31291
|
_this.environment = environment;
|
|
31169
31292
|
_this.userEvents = [];
|
|
31170
|
-
_this.count$ = new rxjs.BehaviorSubject(0);
|
|
31171
31293
|
return _this;
|
|
31172
31294
|
}
|
|
31173
31295
|
UserEventTestService.prototype.fromObject = function (source) {
|
|
@@ -31177,15 +31299,8 @@
|
|
|
31177
31299
|
entity = this.processUserEvent(entity);
|
|
31178
31300
|
entity.id = this.userEvents.length + 1;
|
|
31179
31301
|
this.userEvents.push(entity);
|
|
31180
|
-
this.
|
|
31302
|
+
this._count$.next(this.userEvents.length);
|
|
31181
31303
|
};
|
|
31182
|
-
Object.defineProperty(UserEventTestService.prototype, "userEventCount", {
|
|
31183
|
-
get: function () {
|
|
31184
|
-
return this.count$.asObservable();
|
|
31185
|
-
},
|
|
31186
|
-
enumerable: false,
|
|
31187
|
-
configurable: true
|
|
31188
|
-
});
|
|
31189
31304
|
UserEventTestService.prototype.asFilter = function (filter) {
|
|
31190
31305
|
return filter;
|
|
31191
31306
|
};
|
|
@@ -31208,7 +31323,40 @@
|
|
|
31208
31323
|
return entity;
|
|
31209
31324
|
};
|
|
31210
31325
|
UserEventTestService.prototype.saveAll = function (data, opts) {
|
|
31211
|
-
return
|
|
31326
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31327
|
+
var _b, _c, entity, e_1_1;
|
|
31328
|
+
var e_1, _d;
|
|
31329
|
+
return __generator(this, function (_e) {
|
|
31330
|
+
switch (_e.label) {
|
|
31331
|
+
case 0:
|
|
31332
|
+
_e.trys.push([0, 5, 6, 7]);
|
|
31333
|
+
_b = __values((data || [])), _c = _b.next();
|
|
31334
|
+
_e.label = 1;
|
|
31335
|
+
case 1:
|
|
31336
|
+
if (!!_c.done) return [3 /*break*/, 4];
|
|
31337
|
+
entity = _c.value;
|
|
31338
|
+
return [4 /*yield*/, this.save(entity)];
|
|
31339
|
+
case 2:
|
|
31340
|
+
_e.sent();
|
|
31341
|
+
_e.label = 3;
|
|
31342
|
+
case 3:
|
|
31343
|
+
_c = _b.next();
|
|
31344
|
+
return [3 /*break*/, 1];
|
|
31345
|
+
case 4: return [3 /*break*/, 7];
|
|
31346
|
+
case 5:
|
|
31347
|
+
e_1_1 = _e.sent();
|
|
31348
|
+
e_1 = { error: e_1_1 };
|
|
31349
|
+
return [3 /*break*/, 7];
|
|
31350
|
+
case 6:
|
|
31351
|
+
try {
|
|
31352
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
31353
|
+
}
|
|
31354
|
+
finally { if (e_1) throw e_1.error; }
|
|
31355
|
+
return [7 /*endfinally*/];
|
|
31356
|
+
case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
|
|
31357
|
+
}
|
|
31358
|
+
});
|
|
31359
|
+
});
|
|
31212
31360
|
};
|
|
31213
31361
|
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
|
|
31214
31362
|
return rxjs.of({ data: this.userEvents });
|