@provoly/hypervisor 0.0.8 → 0.0.10

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.
Files changed (94) hide show
  1. package/esm2022/public-api.mjs +3 -1
  2. package/esm2022/src/lib/event/detail/event-detail.component.mjs +132 -10
  3. package/esm2022/src/lib/event/list/event-list.component.mjs +26 -10
  4. package/esm2022/src/lib/event-summary/item/event-summary-item.component.mjs +13 -13
  5. package/esm2022/src/lib/event-summary/list/event-summary-list.component.mjs +1 -1
  6. package/esm2022/src/lib/event-summary/page/event-summary-page.component.mjs +3 -3
  7. package/esm2022/src/lib/general/for-datetime-local-pipe/for-datetime-local.pipe.mjs +20 -0
  8. package/esm2022/src/lib/general/i18n/en.translations.mjs +46 -9
  9. package/esm2022/src/lib/general/i18n/fr.translations.mjs +56 -12
  10. package/esm2022/src/lib/general/icon-display/icon-display.component.mjs +1 -1
  11. package/esm2022/src/lib/general/icon-pipe/event-icon.pipe.mjs +2 -2
  12. package/esm2022/src/lib/general/progress-display/progress-display.component.mjs +16 -0
  13. package/esm2022/src/lib/general/public-api.mjs +5 -1
  14. package/esm2022/src/lib/general/status-display/status-display.component.mjs +48 -0
  15. package/esm2022/src/lib/hypervisor.module.mjs +26 -9
  16. package/esm2022/src/lib/model/event/hyp-event-category.type.mjs +2 -0
  17. package/esm2022/src/lib/model/event/hyp-event-criticality.type.mjs +2 -0
  18. package/esm2022/src/lib/model/event/hyp-event-detail.interface.mjs +2 -0
  19. package/esm2022/src/lib/model/event/hyp-event-status.type.mjs +2 -0
  20. package/esm2022/src/lib/model/event/hyp-event-summary.interface.mjs +2 -0
  21. package/esm2022/src/lib/model/event/hyp-event-type.mjs +7 -0
  22. package/esm2022/src/lib/model/event/hyp-event.interface.mjs +2 -0
  23. package/esm2022/src/lib/model/hyp-action.interface.mjs +1 -1
  24. package/esm2022/src/lib/model/hyp-equipment.interface.mjs +2 -0
  25. package/esm2022/src/lib/model/hyp-procedure.interface.mjs +1 -1
  26. package/esm2022/src/lib/model/public-api.mjs +9 -8
  27. package/esm2022/src/lib/store/equipment/equipment.service.mjs +31 -0
  28. package/esm2022/src/lib/store/equipment/public-api.mjs +2 -0
  29. package/esm2022/src/lib/store/event/event.actions.mjs +6 -2
  30. package/esm2022/src/lib/store/event/event.effects.mjs +11 -5
  31. package/esm2022/src/lib/store/event/event.reducer.mjs +17 -13
  32. package/esm2022/src/lib/store/event/event.selectors.mjs +4 -2
  33. package/esm2022/src/lib/store/event/event.service.mjs +19 -3
  34. package/esm2022/src/lib/store/event/public-api.mjs +2 -1
  35. package/esm2022/src/lib/store/event-summary/event-summary.actions.mjs +1 -1
  36. package/esm2022/src/lib/store/event-summary/event-summary.reducer.mjs +1 -1
  37. package/esm2022/src/lib/store/hypervisor/public-api.mjs +6 -0
  38. package/fesm2022/provoly-hypervisor.mjs +521 -176
  39. package/fesm2022/provoly-hypervisor.mjs.map +1 -1
  40. package/package.json +2 -2
  41. package/public-api.d.ts +2 -0
  42. package/src/lib/event/detail/event-detail.component.d.ts +38 -5
  43. package/src/lib/event/list/event-list.component.d.ts +10 -5
  44. package/src/lib/event-summary/item/event-summary-item.component.d.ts +7 -3
  45. package/src/lib/event-summary/list/event-summary-list.component.d.ts +1 -1
  46. package/src/lib/event-summary/page/event-summary-page.component.d.ts +1 -1
  47. package/src/lib/general/for-datetime-local-pipe/for-datetime-local.pipe.d.ts +10 -0
  48. package/src/lib/general/i18n/en.translations.d.ts +39 -2
  49. package/src/lib/general/i18n/fr.translations.d.ts +47 -3
  50. package/src/lib/general/icon-display/icon-display.component.d.ts +1 -1
  51. package/src/lib/general/icon-pipe/event-icon.pipe.d.ts +5 -4
  52. package/src/lib/general/progress-display/progress-display.component.d.ts +6 -0
  53. package/src/lib/general/public-api.d.ts +4 -0
  54. package/src/lib/general/status-display/status-display.component.d.ts +19 -0
  55. package/src/lib/hypervisor.module.d.ts +12 -9
  56. package/src/lib/model/event/hyp-event-category.type.d.ts +1 -0
  57. package/src/lib/model/event/hyp-event-criticality.type.d.ts +1 -0
  58. package/src/lib/model/event/hyp-event-detail.interface.d.ts +22 -0
  59. package/src/lib/model/event/hyp-event-status.type.d.ts +1 -0
  60. package/src/lib/model/{hyp-event-summary.interface.d.ts → event/hyp-event-summary.interface.d.ts} +5 -4
  61. package/src/lib/model/event/hyp-event.interface.d.ts +6 -0
  62. package/src/lib/model/hyp-action.interface.d.ts +1 -1
  63. package/src/lib/model/hyp-equipment.interface.d.ts +5 -0
  64. package/src/lib/model/hyp-procedure.interface.d.ts +1 -1
  65. package/src/lib/model/public-api.d.ts +8 -7
  66. package/src/lib/store/equipment/equipment.service.d.ts +13 -0
  67. package/src/lib/store/equipment/public-api.d.ts +1 -0
  68. package/src/lib/store/event/event.actions.d.ts +30 -2
  69. package/src/lib/store/event/event.effects.d.ts +16 -1
  70. package/src/lib/store/event/event.reducer.d.ts +2 -1
  71. package/src/lib/store/event/event.selectors.d.ts +1 -0
  72. package/src/lib/store/event/event.service.d.ts +4 -2
  73. package/src/lib/store/event/public-api.d.ts +1 -0
  74. package/src/lib/store/event-summary/event-summary.actions.d.ts +1 -1
  75. package/src/lib/store/event-summary/event-summary.reducer.d.ts +1 -1
  76. package/src/lib/store/hypervisor/public-api.d.ts +5 -0
  77. package/styles/components/_a-chip-status.scss +46 -0
  78. package/styles/components/_index.scss +3 -0
  79. package/styles/components/_o-hvy-event-detail.scss +156 -0
  80. package/styles/components/_o-hvy-events-table.scss +39 -2
  81. package/styles/components/_o-progressbar.scss +46 -0
  82. package/esm2022/src/lib/model/hyp-event-category.type.mjs +0 -2
  83. package/esm2022/src/lib/model/hyp-event-criticality.type.mjs +0 -7
  84. package/esm2022/src/lib/model/hyp-event-detail.interface.mjs +0 -2
  85. package/esm2022/src/lib/model/hyp-event-status.type.mjs +0 -2
  86. package/esm2022/src/lib/model/hyp-event-summary.interface.mjs +0 -2
  87. package/esm2022/src/lib/model/hyp-event-type.mjs +0 -7
  88. package/esm2022/src/lib/model/hyp-event.interface.mjs +0 -2
  89. package/src/lib/model/hyp-event-category.type.d.ts +0 -2
  90. package/src/lib/model/hyp-event-criticality.type.d.ts +0 -5
  91. package/src/lib/model/hyp-event-detail.interface.d.ts +0 -14
  92. package/src/lib/model/hyp-event-status.type.d.ts +0 -1
  93. package/src/lib/model/hyp-event.interface.d.ts +0 -6
  94. /package/src/lib/model/{hyp-event-type.d.ts → event/hyp-event-type.d.ts} +0 -0
@@ -1,45 +1,314 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, Pipe, InjectionToken, Injectable, NgModule, Inject } from '@angular/core';
3
- import * as i1 from '@ngrx/store';
2
+ import { Injectable, Pipe, Component, Input, EventEmitter, Output, InjectionToken, NgModule, Inject } from '@angular/core';
3
+ import * as i3 from '@provoly/dashboard';
4
+ import { DEFAULT_ICON_URL, SubscriptionnerDirective, PryI18nModule, PryCoreModule, PryIconModule, PrySelectModule, PryDatePickerModule } from '@provoly/dashboard';
5
+ import * as i1 from '@angular/common/http';
6
+ import { HttpParams } from '@angular/common/http';
7
+ import { mergeMap, of, fromEvent, map, withLatestFrom, filter, auditTime } from 'rxjs';
8
+ import * as i1$1 from '@ngrx/store';
4
9
  import { createAction, props, createReducer, on, createFeatureSelector, createSelector, StoreModule } from '@ngrx/store';
5
- import * as i1$1 from '@angular/common';
6
- import { NgForOf, AsyncPipe, NgStyle, DatePipe, KeyValuePipe } from '@angular/common';
7
- import * as i3$1 from '@provoly/dashboard/components/checkbox';
10
+ import * as i2 from '@provoly/dashboard/components/checkbox';
8
11
  import { PryCheckboxModule } from '@provoly/dashboard/components/checkbox';
9
- import * as i4 from '@angular/forms';
12
+ import * as i3$1 from '@angular/forms';
10
13
  import { FormsModule } from '@angular/forms';
11
- import * as i2 from '@angular/router';
14
+ import * as i1$2 from '@angular/common';
15
+ import { NgForOf, AsyncPipe, NgStyle, DatePipe, KeyValuePipe, JsonPipe } from '@angular/common';
16
+ import * as i2$1 from '@angular/router';
12
17
  import { RouterLink } from '@angular/router';
13
- import * as i3 from '@provoly/dashboard';
14
- import { DEFAULT_ICON_URL, SubscriptionnerDirective, PryI18nModule, PryCoreModule, PryIconModule, PrySelectModule } from '@provoly/dashboard';
15
- import { of, withLatestFrom, mergeMap } from 'rxjs';
16
- import * as i8 from '@provoly/dashboard/components/sinceDate';
18
+ import * as i9 from '@provoly/dashboard/components/sinceDate';
17
19
  import { PrySinceDateModule } from '@provoly/dashboard/components/sinceDate';
18
- import { map, debounceTime, mergeMap as mergeMap$1, catchError } from 'rxjs/operators';
20
+ import { map as map$1, debounceTime, mergeMap as mergeMap$1, catchError } from 'rxjs/operators';
19
21
  import * as i1$3 from '@ngrx/effects';
20
22
  import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
21
- import * as i1$2 from '@angular/common/http';
22
- import { HttpParams } from '@angular/common/http';
23
23
 
24
- class EventDetailComponent {
24
+ const HypEventCategory = ['ALERT_MALFUNCTION', 'REPORT', 'OPERATOR_EVENT', 'ALERT_LIMIT', 'MANIFESTATION'];
25
+
26
+ const HypEventCriticality = ['LOW', 'MEDIUM', 'HIGH'];
27
+
28
+ const HypervisorActions = {
29
+ setUrl: createAction('[Event] Set Backend Url', props())
30
+ };
31
+
32
+ const hypFeatureKey = '@hvy/general';
33
+ const hypInitialState = {
34
+ url: '/api/hypervisor',
35
+ };
36
+ const internalReducer$2 = createReducer(hypInitialState, on(HypervisorActions.setUrl, (state, action) => ({
37
+ ...state,
38
+ url: action.url ?? state.url,
39
+ })));
40
+ function hypervisorReducer(state, action) {
41
+ return internalReducer$2(state, action);
42
+ }
43
+
44
+ const feature$2 = createFeatureSelector(hypFeatureKey);
45
+ const url = createSelector(feature$2, (state) => state.url);
46
+ const HypSelectors = {
47
+ feature: feature$2,
48
+ url
49
+ };
50
+
51
+ class EquipmentService {
52
+ constructor(httpClient, store) {
53
+ this.httpClient = httpClient;
54
+ this.store = store;
55
+ }
56
+ findByName(name) {
57
+ return this.store
58
+ .select(HypSelectors.url)
59
+ .pipe(mergeMap((url) => {
60
+ let params = new HttpParams();
61
+ params = params.set('name', name);
62
+ return this.httpClient.get(encodeURI(`${url}/equipment`), { params });
63
+ }));
64
+ }
65
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EquipmentService, deps: [{ token: i1.HttpClient }, { token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
66
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EquipmentService, providedIn: 'root' }); }
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EquipmentService, decorators: [{
69
+ type: Injectable,
70
+ args: [{
71
+ providedIn: 'root',
72
+ }]
73
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Store }] });
74
+
75
+ const EVENT_TO_ICON = {
76
+ fn: (event, store) => of(DEFAULT_ICON_URL),
77
+ };
78
+ class EventIconPipe {
79
+ constructor(store) {
80
+ this.store = store;
81
+ }
82
+ transform(value, ...args) {
83
+ return EVENT_TO_ICON.fn(value, this.store);
84
+ }
85
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventIconPipe, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Pipe }); }
86
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: EventIconPipe, name: "eventIcon" }); }
87
+ }
88
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventIconPipe, decorators: [{
89
+ type: Pipe,
90
+ args: [{
91
+ name: 'eventIcon',
92
+ }]
93
+ }], ctorParameters: () => [{ type: i1$1.Store }] });
94
+
95
+ class IconDisplayComponent {
96
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: IconDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
97
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: { event: "event" }, ngImport: i0, template: "<div class=\"\n m-hvy-event-summary-item__event-icon-container\n -hvy-{{ event.criticality.toString().toLowerCase()}}\n -hvy-{{event.type.toString().toLowerCase()}}\n \">\n <span\n class=\"m-hvy-event-summary-item__event-icon a-icon\"\n [ngStyle]=\"{\n 'mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')',\n '-webkit-mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')'\n }\"\n aria-hidden=\"true\"\n focusable=\"false\"\n ></span>\n</div>\n", dependencies: [{ kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.GetSecuredImagePipe, name: "getSecuredImage" }, { kind: "pipe", type: EventIconPipe, name: "eventIcon" }] }); }
98
+ }
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: IconDisplayComponent, decorators: [{
100
+ type: Component,
101
+ args: [{ selector: 'hvy-icon-display', template: "<div class=\"\n m-hvy-event-summary-item__event-icon-container\n -hvy-{{ event.criticality.toString().toLowerCase()}}\n -hvy-{{event.type.toString().toLowerCase()}}\n \">\n <span\n class=\"m-hvy-event-summary-item__event-icon a-icon\"\n [ngStyle]=\"{\n 'mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')',\n '-webkit-mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')'\n }\"\n aria-hidden=\"true\"\n focusable=\"false\"\n ></span>\n</div>\n" }]
102
+ }], propDecorators: { event: [{
103
+ type: Input
104
+ }] } });
105
+
106
+ class StatusDisplayComponent {
25
107
  constructor() {
26
- this.events = [];
27
- this.procedure = undefined;
108
+ this.modified = new EventEmitter();
109
+ this.targetStatuses = [];
110
+ this.targetsDisplayed = false;
111
+ this._modifiable = false;
112
+ }
113
+ set event(event) {
114
+ this._event = event;
115
+ this.updateTargetStatuses();
116
+ }
117
+ set modifiable(modifiable) {
118
+ this._modifiable = modifiable;
119
+ this.updateTargetStatuses();
120
+ }
121
+ get modifiable() {
122
+ return this._modifiable;
123
+ }
124
+ get event() {
125
+ return this._event;
126
+ }
127
+ trigger(status) {
128
+ this.modified.next(status);
129
+ this.targetsDisplayed = false;
130
+ }
131
+ updateTargetStatuses() {
132
+ this.targetStatuses = (this.modifiable && this.event.status !== 'DONE') ? ['DONE'] : [];
133
+ }
134
+ toggle() {
135
+ this.targetsDisplayed = this.targetStatuses.length > 0 && !this.targetsDisplayed;
136
+ }
137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: StatusDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
138
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: StatusDisplayComponent, selector: "hvy-status-display", inputs: { event: "event", modifiable: "modifiable" }, outputs: { modified: "modified" }, ngImport: i0, template: "<span class=\"a-chip -md -{{event.status}} a-chip-status\" (click)=\"toggle()\" >\n {{ '@hvy.event.status.' + event.status | i18n }}\n @if (targetStatuses.length > 0) {\n <pry-icon iconSvg=\"chevron_bottom\" [width]=\"10\" [height]=\"10\"></pry-icon>\n }\n</span>\n@if (targetsDisplayed) {\n <div class=\"a-chip-status__target\">\n <div class=\"a-chip-status__target__filler\"></div>\n @for (status of targetStatuses;track status) {\n <div class=\"a-chip-status__target__item\" (click)=\"trigger(status)\">{{ '@hvy.event.status.' + status | i18n }}</div>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: i3.PryIconComponent, selector: "pry-icon", inputs: ["color", "iconSvg", "animation", "iconImage", "alt", "width", "height", "classes"] }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }] }); }
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: StatusDisplayComponent, decorators: [{
141
+ type: Component,
142
+ args: [{ selector: 'hvy-status-display', template: "<span class=\"a-chip -md -{{event.status}} a-chip-status\" (click)=\"toggle()\" >\n {{ '@hvy.event.status.' + event.status | i18n }}\n @if (targetStatuses.length > 0) {\n <pry-icon iconSvg=\"chevron_bottom\" [width]=\"10\" [height]=\"10\"></pry-icon>\n }\n</span>\n@if (targetsDisplayed) {\n <div class=\"a-chip-status__target\">\n <div class=\"a-chip-status__target__filler\"></div>\n @for (status of targetStatuses;track status) {\n <div class=\"a-chip-status__target__item\" (click)=\"trigger(status)\">{{ '@hvy.event.status.' + status | i18n }}</div>\n }\n </div>\n}\n" }]
143
+ }], propDecorators: { modified: [{
144
+ type: Output
145
+ }], event: [{
146
+ type: Input
147
+ }], modifiable: [{
148
+ type: Input
149
+ }] } });
150
+
151
+ class ProgressDisplayComponent {
152
+ constructor() {
153
+ this.progress = 50;
154
+ }
155
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ProgressDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
156
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: ProgressDisplayComponent, selector: "hvy-progress-display", inputs: { progress: "progress" }, ngImport: i0, template: "<div class=\"o-progressbar\">\n <div class=\"o-progressbar__header\">\n <div>0%</div>\n @if (progress > 0 && progress < 100) {\n <div [style.flex-grow]=\"progress\" class=\"-value\">{{ progress }}%</div>\n }\n <div [style.flex-grow]=\"progress === 100 ? 100 : 100 - progress\">100%</div>\n </div>\n <div class=\"o-progressbar__value\">\n <div [style.flex-grow]=\"progress\" class=\"-filled\"></div>\n <div [style.flex-grow]=\"100 - progress\" class=\"-empty\"></div>\n </div>\n</div>\n" }); }
157
+ }
158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ProgressDisplayComponent, decorators: [{
159
+ type: Component,
160
+ args: [{ selector: 'hvy-progress-display', template: "<div class=\"o-progressbar\">\n <div class=\"o-progressbar__header\">\n <div>0%</div>\n @if (progress > 0 && progress < 100) {\n <div [style.flex-grow]=\"progress\" class=\"-value\">{{ progress }}%</div>\n }\n <div [style.flex-grow]=\"progress === 100 ? 100 : 100 - progress\">100%</div>\n </div>\n <div class=\"o-progressbar__value\">\n <div [style.flex-grow]=\"progress\" class=\"-filled\"></div>\n <div [style.flex-grow]=\"100 - progress\" class=\"-empty\"></div>\n </div>\n</div>\n" }]
161
+ }], propDecorators: { progress: [{
162
+ type: Input
163
+ }] } });
164
+
165
+ class ForDatetimeLocalPipe {
166
+ constructor(store) {
167
+ this.store = store;
28
168
  }
29
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
30
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: EventDetailComponent, selector: "hvy-event-detail", inputs: { events: "events", procedure: "procedure" }, ngImport: i0, template: "<h1> TODO </h1>\n<p>Events: {{ events.length }}</p>\n<p>Procedure: {{ procedure }}</p>\n" }); }
169
+ transform(completeDate, ...args) {
170
+ return completeDate ? completeDate.substring(0, completeDate.lastIndexOf(':')) : '';
171
+ }
172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ForDatetimeLocalPipe, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Pipe }); }
173
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: ForDatetimeLocalPipe, name: "forDateTimeLocal" }); }
174
+ }
175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ForDatetimeLocalPipe, decorators: [{
176
+ type: Pipe,
177
+ args: [{
178
+ name: 'forDateTimeLocal',
179
+ }]
180
+ }], ctorParameters: () => [{ type: i1$1.Store }] });
181
+
182
+ class EventDetailComponent extends SubscriptionnerDirective {
183
+ set events(events) {
184
+ this._events = events.filter(ev => !!ev);
185
+ this.eventModifications = new Array(this._events.length);
186
+ this.opened = events.length === 1 ? [true] : [];
187
+ }
188
+ ;
189
+ set procedure(procedure) {
190
+ this._procedure = procedure;
191
+ this.procedureModifications = {};
192
+ }
193
+ set cancelModifications(evt) {
194
+ this.eventModifications = new Array(this._events.length);
195
+ this.procedureModifications = {};
196
+ this._outputModifications();
197
+ }
198
+ constructor(equipmentService) {
199
+ super();
200
+ this.equipmentService = equipmentService;
201
+ this.opened = [];
202
+ this.categories = HypEventCategory;
203
+ this.criticalities = HypEventCriticality;
204
+ this._events = [];
205
+ this.eventModifications = [];
206
+ this.modifiedEvents = new EventEmitter();
207
+ this.procedureModifications = {};
208
+ this.modifiedProcedure = new EventEmitter();
209
+ }
210
+ get events() {
211
+ return this._events.map((evt, idx) => ({ ...evt, ...(this.eventModifications[idx] ?? {}) }));
212
+ }
213
+ get procedure() {
214
+ return this._procedure ? ({ ...this._procedure, ...(this.procedureModifications ?? {}), events: this.events }) : undefined;
215
+ }
216
+ toggle(i) {
217
+ this.opened[i] = !this.opened[i];
218
+ }
219
+ modifyEvent(index, prop, $event) {
220
+ // @ts-ignore
221
+ const newValue = $event instanceof Event ? $event.target?.value : $event;
222
+ // @ts-ignore
223
+ if (this._events[index][prop] !== newValue) {
224
+ if (!this.eventModifications[index]) {
225
+ this.eventModifications[index] = {};
226
+ }
227
+ // @ts-ignore
228
+ this.eventModifications[index][prop] = newValue;
229
+ this._outputModifications();
230
+ }
231
+ }
232
+ access(event) {
233
+ switch (event.type) {
234
+ case 'ALERT':
235
+ default:
236
+ return {
237
+ name: true,
238
+ category: true,
239
+ criticality: true,
240
+ description: true,
241
+ address: true,
242
+ source: true,
243
+ eqName: true,
244
+ eqEntity: true,
245
+ startDate: true,
246
+ endDate: true,
247
+ };
248
+ case 'REPORT':
249
+ return {
250
+ name: false,
251
+ category: true,
252
+ criticality: false,
253
+ description: true,
254
+ address: false,
255
+ source: true,
256
+ eqName: false,
257
+ eqEntity: true,
258
+ startDate: true,
259
+ endDate: true,
260
+ };
261
+ case 'OPERATOR':
262
+ return {
263
+ name: false,
264
+ category: false,
265
+ criticality: false,
266
+ description: false,
267
+ address: false,
268
+ source: false,
269
+ eqName: false,
270
+ eqEntity: false,
271
+ startDate: false,
272
+ endDate: false,
273
+ };
274
+ }
275
+ }
276
+ changeEquipment(index, $event) {
277
+ this.equipmentService.findByName($event.target.value).subscribe((equipment) => {
278
+ if (equipment && this._events[index].name !== equipment.name) {
279
+ if (!this.eventModifications[index]) {
280
+ this.eventModifications[index] = {};
281
+ }
282
+ // @ts-ignore
283
+ this.eventModifications[index].equipment = equipment;
284
+ this._outputModifications();
285
+ }
286
+ });
287
+ }
288
+ _outputModifications() {
289
+ this.modifiedEvents.next(this._events.map((ev, idx) => [this.eventModifications[idx], ev]));
290
+ this.modifiedProcedure.next(this.procedure ? [this.procedureModifications, this.procedure] : undefined);
291
+ }
292
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventDetailComponent, deps: [{ token: EquipmentService }], target: i0.ɵɵFactoryTarget.Component }); }
293
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: EventDetailComponent, selector: "hvy-event-detail", inputs: { events: "events", procedure: "procedure", cancelModifications: "cancelModifications" }, outputs: { modifiedEvents: "modifiedEvents", modifiedProcedure: "modifiedProcedure" }, usesInheritance: true, ngImport: i0, template: "<div class=\"o-hvy-events-detail\">\n <div class=\"o-hvy-events-detail__header\">\n <div class=\"o-hvy-events-detail__header__split\">\n <h1>{{ '@hvy.event.log.name' | i18n }}</h1>\n <button class=\"a-btn a-btn--secondary -fix-right\">{{ '@hvy.event.log.event.close' | i18n }}</button>\n </div>\n <div class=\"o-hvy-events-detail__header__split\">\n <button class=\"a-btn a-btn--secondary\">{{ '@hvy.event.log.procedure.delete' | i18n }}</button>\n </div>\n </div>\n <div class=\"o-hvy-events-detail__container\">\n <div class=\"o-hvy-events-detail__container__scrollable\">\n <div class=\"o-hvy-events-detail__events\">\n @for (event of events;track event.id;let idx = $index) {\n <div class=\"o-hvy-events-detail__events__event\">\n <div class=\"o-hvy-events-detail__events__event__header\">\n <pry-icon [iconSvg]=\"!opened[idx] ? 'chevron_bottom' : 'chevron_top'\" (click)=\"toggle(idx)\"></pry-icon>\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n <h2>{{ event.name }}</h2>\n <hvy-status-display [event]=\"event\" [modifiable]=\"true\"></hvy-status-display>\n </div>\n <div class=\"o-hvy-events-detail__events__event__content\">\n <div>{{ '@hvy.event.log.event.description' | i18n }}: {{ event.description }}</div>\n <div>{{ '@hvy.event.log.event.address' | i18n }}: {{ event.address }}</div>\n @if (opened[idx]) {\n @if (access(event);as accessValue) {\n <h3>{{ '@hvy.event.log.event.detail' | i18n }}</h3>\n <table>\n <tbody>\n <tr>\n <td>{{ '@hvy.event.log.event.name' | i18n }}<span class=\"required\">*</span></td>\n <td><input type=\"text\" class=\"a-form-field\" [value]=\"event.name\"\n (change)=\"modifyEvent(idx, 'name', $event)\" [readonly]=\"accessValue.name\"></td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.log.event.category' | i18n }}<span class=\"required\">*</span></td>\n <td>\n <pry-select [ngModel]=\"event.category\" [items]=\"categories\"\n (ngModelChange)=\"modifyEvent(idx, 'category', $event)\"\n i18nPrefix=\"@hvy.event.category.\" [disabled]=\"accessValue.category\"></pry-select>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.criticality.name' | i18n }}<span class=\"required\">*</span></td>\n <td>\n <pry-select [ngModel]=\"event.criticality\" [items]=\"criticalities\"\n i18nPrefix=\"@hvy.event.criticality.\"\n [disabled]=\"accessValue.criticality\"\n (ngModelChange)=\"modifyEvent(idx, 'criticality', $event)\"></pry-select>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.log.event.description' | i18n }}<span class=\"required\">*</span></td>\n <td><textarea [ngModel]=\"event.description\" class=\"a-form-field\"\n [readonly]=\"accessValue.description\"\n (ngModelChange)=\"modifyEvent(idx, 'description', $event)\"></textarea></td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.log.event.address' | i18n }}</td>\n <td><textarea [ngModel]=\"event.address\" class=\"a-form-field\"\n [readonly]=\"accessValue.address\"\n (ngModelChange)=\"modifyEvent(idx, 'address', $event)\"></textarea></td>\n </tr>\n @if (['ALERT', 'REPORT'].includes(event.type)) {\n <tr>\n <td>{{ '@hvy.event.source' | i18n }}</td>\n <td><input type=\"text\" class=\"a-form-field\" [value]=\"event.externalSourceRef ?? ''\"\n [readonly]=\"accessValue.source\" (change)=\"modifyEvent(idx, 'source', $event)\"></td>\n </tr>\n }\n <tr>\n <td>{{ '@hvy.event.equipment' | i18n }}</td>\n <td>\n <input type=\"text\" class=\"a-form-field\"\n [value]=\"event.equipment?.name ?? ''\"\n [readonly]=\"accessValue.eqName\"\n (change)=\"changeEquipment(idx, $event)\">\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.equipmentEntity' | i18n }}</td>\n <td><input type=\"text\" class=\"a-form-field\" [value]=\"event.equipment?.entity ?? ''\"\n readonly></td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.startDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\" [value]=\"event.startDate | forDateTimeLocal\"\n [readonly]=\"accessValue.startDate\" (change)=\"modifyEvent(idx, 'startDate', $event)\">\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.endDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\" [value]=\"event.endDate | forDateTimeLocal\"\n [readonly]=\"accessValue.endDate\" (change)=\"modifyEvent(idx, 'endDate', $event)\">\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.creationDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\"\n [value]=\"event.creationDate | forDateTimeLocal\"\n readonly>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.lastModificationDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\"\n [value]=\"event.lastModificationDate | forDateTimeLocal\" readonly>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.closeDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\" [value]=\"event.closeDate | forDateTimeLocal\"\n readonly>\n </td>\n </tr>\n </tbody>\n </table>\n <div class=\"o-hvy-events-detail__events__event__content__comments\">\n <h3>{{ '@hvy.event.log.event.comments.name' | i18n }}</h3>\n <textarea [placeholder]=\"('@hvy.event.log.event.comments.placeholder' | i18n) + '...'\"></textarea>\n <div class=\"o-hvy-events-detail__events__event__content__comments__button\">\n <button class=\"a-btn a-btn--primary\">{{ '@hvy.action.send' | i18n }}</button>\n </div>\n </div>\n }\n }\n </div>\n </div>\n }\n </div>\n <div class=\"o-hvy-events-detail__procedure\">\n @if (procedure) {\n <div class=\"o-hvy-events-detail__procedure__header\">\n <h2>{{ '@hvy.event.log.procedure.name' | i18n }}</h2>\n </div>\n <div>\n <p>{{ procedure.name }}</p>\n </div>\n <div class=\"o-hvy-events-detail__procedure__progress\">\n <p>{{ '@hvy.event.log.procedure.progress' | i18n }}</p>\n <hvy-progress-display [progress]=\"procedure.progress\"></hvy-progress-display>\n </div>\n <div class=\"o-hvy-events-detail__procedure__actions\">\n @for (action of procedure.actions;track action.id) {\n <div class=\"o-hvy-events-detail__procedure__actions__action\">\n <pry-icon iconSvg=\"six_dot\"></pry-icon>\n <pry-checkbox [ngModel]=\"action.status === 'DONE'\"></pry-checkbox>\n <div>{{ action.name }}</div>\n <pry-icon iconSvg=\"more_horiz\"></pry-icon>\n </div>\n } @empty {\n <div>\n {{ '@hvy.event.log.procedure.noAction' | i18n }}\n </div>\n }\n </div>\n <div>\n <button class=\"a-btn a-btn--primary\">\n <pry-icon iconSvg=\"add\"></pry-icon>\n {{ '@hvy.event.log.procedure.addAction' | i18n }}\n </button>\n </div>\n }\n </div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: i2.PryCheckboxComponent, selector: "pry-checkbox", inputs: ["circle"] }, { kind: "directive", type: i3$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.PryIconComponent, selector: "pry-icon", inputs: ["color", "iconSvg", "animation", "iconImage", "alt", "width", "height", "classes"] }, { kind: "component", type: i3.PrySelectComponent, selector: "pry-select", inputs: ["items", "clearable", "multiple", "closeOnSelect", "placeholder", "isForm", "required", "name", "readonly", "autocomplete", "bindValue", "bindLabel", "iconSize", "bindIcon", "template", "i18nPrefix", "bindClasses", "loading", "elementRef"], outputs: ["searched", "cleared"] }, { kind: "component", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: ["event"] }, { kind: "component", type: StatusDisplayComponent, selector: "hvy-status-display", inputs: ["event", "modifiable"], outputs: ["modified"] }, { kind: "component", type: ProgressDisplayComponent, selector: "hvy-progress-display", inputs: ["progress"] }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }, { kind: "pipe", type: ForDatetimeLocalPipe, name: "forDateTimeLocal" }] }); }
31
294
  }
32
295
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventDetailComponent, decorators: [{
33
296
  type: Component,
34
- args: [{ selector: 'hvy-event-detail', template: "<h1> TODO </h1>\n<p>Events: {{ events.length }}</p>\n<p>Procedure: {{ procedure }}</p>\n" }]
35
- }], propDecorators: { events: [{
297
+ args: [{ selector: 'hvy-event-detail', template: "<div class=\"o-hvy-events-detail\">\n <div class=\"o-hvy-events-detail__header\">\n <div class=\"o-hvy-events-detail__header__split\">\n <h1>{{ '@hvy.event.log.name' | i18n }}</h1>\n <button class=\"a-btn a-btn--secondary -fix-right\">{{ '@hvy.event.log.event.close' | i18n }}</button>\n </div>\n <div class=\"o-hvy-events-detail__header__split\">\n <button class=\"a-btn a-btn--secondary\">{{ '@hvy.event.log.procedure.delete' | i18n }}</button>\n </div>\n </div>\n <div class=\"o-hvy-events-detail__container\">\n <div class=\"o-hvy-events-detail__container__scrollable\">\n <div class=\"o-hvy-events-detail__events\">\n @for (event of events;track event.id;let idx = $index) {\n <div class=\"o-hvy-events-detail__events__event\">\n <div class=\"o-hvy-events-detail__events__event__header\">\n <pry-icon [iconSvg]=\"!opened[idx] ? 'chevron_bottom' : 'chevron_top'\" (click)=\"toggle(idx)\"></pry-icon>\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n <h2>{{ event.name }}</h2>\n <hvy-status-display [event]=\"event\" [modifiable]=\"true\"></hvy-status-display>\n </div>\n <div class=\"o-hvy-events-detail__events__event__content\">\n <div>{{ '@hvy.event.log.event.description' | i18n }}: {{ event.description }}</div>\n <div>{{ '@hvy.event.log.event.address' | i18n }}: {{ event.address }}</div>\n @if (opened[idx]) {\n @if (access(event);as accessValue) {\n <h3>{{ '@hvy.event.log.event.detail' | i18n }}</h3>\n <table>\n <tbody>\n <tr>\n <td>{{ '@hvy.event.log.event.name' | i18n }}<span class=\"required\">*</span></td>\n <td><input type=\"text\" class=\"a-form-field\" [value]=\"event.name\"\n (change)=\"modifyEvent(idx, 'name', $event)\" [readonly]=\"accessValue.name\"></td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.log.event.category' | i18n }}<span class=\"required\">*</span></td>\n <td>\n <pry-select [ngModel]=\"event.category\" [items]=\"categories\"\n (ngModelChange)=\"modifyEvent(idx, 'category', $event)\"\n i18nPrefix=\"@hvy.event.category.\" [disabled]=\"accessValue.category\"></pry-select>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.criticality.name' | i18n }}<span class=\"required\">*</span></td>\n <td>\n <pry-select [ngModel]=\"event.criticality\" [items]=\"criticalities\"\n i18nPrefix=\"@hvy.event.criticality.\"\n [disabled]=\"accessValue.criticality\"\n (ngModelChange)=\"modifyEvent(idx, 'criticality', $event)\"></pry-select>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.log.event.description' | i18n }}<span class=\"required\">*</span></td>\n <td><textarea [ngModel]=\"event.description\" class=\"a-form-field\"\n [readonly]=\"accessValue.description\"\n (ngModelChange)=\"modifyEvent(idx, 'description', $event)\"></textarea></td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.log.event.address' | i18n }}</td>\n <td><textarea [ngModel]=\"event.address\" class=\"a-form-field\"\n [readonly]=\"accessValue.address\"\n (ngModelChange)=\"modifyEvent(idx, 'address', $event)\"></textarea></td>\n </tr>\n @if (['ALERT', 'REPORT'].includes(event.type)) {\n <tr>\n <td>{{ '@hvy.event.source' | i18n }}</td>\n <td><input type=\"text\" class=\"a-form-field\" [value]=\"event.externalSourceRef ?? ''\"\n [readonly]=\"accessValue.source\" (change)=\"modifyEvent(idx, 'source', $event)\"></td>\n </tr>\n }\n <tr>\n <td>{{ '@hvy.event.equipment' | i18n }}</td>\n <td>\n <input type=\"text\" class=\"a-form-field\"\n [value]=\"event.equipment?.name ?? ''\"\n [readonly]=\"accessValue.eqName\"\n (change)=\"changeEquipment(idx, $event)\">\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.equipmentEntity' | i18n }}</td>\n <td><input type=\"text\" class=\"a-form-field\" [value]=\"event.equipment?.entity ?? ''\"\n readonly></td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.startDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\" [value]=\"event.startDate | forDateTimeLocal\"\n [readonly]=\"accessValue.startDate\" (change)=\"modifyEvent(idx, 'startDate', $event)\">\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.endDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\" [value]=\"event.endDate | forDateTimeLocal\"\n [readonly]=\"accessValue.endDate\" (change)=\"modifyEvent(idx, 'endDate', $event)\">\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.creationDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\"\n [value]=\"event.creationDate | forDateTimeLocal\"\n readonly>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.lastModificationDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\"\n [value]=\"event.lastModificationDate | forDateTimeLocal\" readonly>\n </td>\n </tr>\n <tr>\n <td>{{ '@hvy.event.closeDate' | i18n }}</td>\n <td>\n <input type=\"datetime-local\" class=\"a-form-field\" [value]=\"event.closeDate | forDateTimeLocal\"\n readonly>\n </td>\n </tr>\n </tbody>\n </table>\n <div class=\"o-hvy-events-detail__events__event__content__comments\">\n <h3>{{ '@hvy.event.log.event.comments.name' | i18n }}</h3>\n <textarea [placeholder]=\"('@hvy.event.log.event.comments.placeholder' | i18n) + '...'\"></textarea>\n <div class=\"o-hvy-events-detail__events__event__content__comments__button\">\n <button class=\"a-btn a-btn--primary\">{{ '@hvy.action.send' | i18n }}</button>\n </div>\n </div>\n }\n }\n </div>\n </div>\n }\n </div>\n <div class=\"o-hvy-events-detail__procedure\">\n @if (procedure) {\n <div class=\"o-hvy-events-detail__procedure__header\">\n <h2>{{ '@hvy.event.log.procedure.name' | i18n }}</h2>\n </div>\n <div>\n <p>{{ procedure.name }}</p>\n </div>\n <div class=\"o-hvy-events-detail__procedure__progress\">\n <p>{{ '@hvy.event.log.procedure.progress' | i18n }}</p>\n <hvy-progress-display [progress]=\"procedure.progress\"></hvy-progress-display>\n </div>\n <div class=\"o-hvy-events-detail__procedure__actions\">\n @for (action of procedure.actions;track action.id) {\n <div class=\"o-hvy-events-detail__procedure__actions__action\">\n <pry-icon iconSvg=\"six_dot\"></pry-icon>\n <pry-checkbox [ngModel]=\"action.status === 'DONE'\"></pry-checkbox>\n <div>{{ action.name }}</div>\n <pry-icon iconSvg=\"more_horiz\"></pry-icon>\n </div>\n } @empty {\n <div>\n {{ '@hvy.event.log.procedure.noAction' | i18n }}\n </div>\n }\n </div>\n <div>\n <button class=\"a-btn a-btn--primary\">\n <pry-icon iconSvg=\"add\"></pry-icon>\n {{ '@hvy.event.log.procedure.addAction' | i18n }}\n </button>\n </div>\n }\n </div>\n </div>\n </div>\n</div>\n" }]
298
+ }], ctorParameters: () => [{ type: EquipmentService }], propDecorators: { modifiedEvents: [{
299
+ type: Output
300
+ }], modifiedProcedure: [{
301
+ type: Output
302
+ }], events: [{
36
303
  type: Input
37
304
  }], procedure: [{
38
305
  type: Input
306
+ }], cancelModifications: [{
307
+ type: Input
39
308
  }] } });
40
309
 
41
310
  const EventActions = {
42
- load: createAction('[Event] Load Events'),
311
+ load: createAction('[Event] Load Events', props()),
43
312
  loadSuccess: createAction('[Event Api] (bus) Load Events Success', props()),
44
313
  loadFailure: createAction('[Event Api] Load Events Failure', props()),
45
314
  filter: createAction('[Event Api] Set filters', props()),
@@ -48,114 +317,106 @@ const EventActions = {
48
317
  getForProcedure: createAction('[Event] Load specific Event for procedure', props()),
49
318
  getSuccess: createAction('[Event Api] (bus) Get Events/Procedure Success', props()),
50
319
  getFailure: createAction('[Event Api] Get Events/Procedure Failure', props()),
320
+ save: createAction('[Event] Save Event', props()),
321
+ saveProcedure: createAction('[Event] Save Procedure and linked Events', props()),
322
+ saveSuccess: createAction('[Event] Save success', props()),
323
+ saveFailure: createAction('[Event] Save failure', props()),
51
324
  };
52
325
 
53
326
  const eventFeatureKey = '@hvy/event';
54
327
  const eventInitialState = {
55
328
  events: [],
329
+ noMoreEvents: false,
56
330
  loading: false,
57
331
  filters: {},
58
332
  selectedIds: [],
59
- details: {}
333
+ details: {},
60
334
  };
61
- const internalReducer$2 = createReducer(eventInitialState, on(EventActions.load, (state, action) => ({
62
- ...state,
63
- loading: true
64
- })), on(EventActions.loadSuccess, (state, { events }) => ({
335
+ const internalReducer$1 = createReducer(eventInitialState, on(EventActions.load, (state, action) => ({
65
336
  ...state,
66
- loading: false,
67
- events
68
- })), on(EventActions.loadFailure, (state, action) => ({
337
+ loading: true,
338
+ })), on(EventActions.loadSuccess, (state, { events, startingFrom }) => {
339
+ return ({
340
+ ...state,
341
+ loading: false,
342
+ noMoreEvents: events.length < 20,
343
+ events: [...state.events.slice(0, startingFrom), ...events],
344
+ });
345
+ }), on(EventActions.loadFailure, (state, action) => ({
69
346
  ...state,
70
347
  loading: false,
71
- events: []
348
+ events: [],
72
349
  })), on(EventActions.filter, (state, { filters }) => ({
73
350
  ...state,
74
- filters
351
+ filters,
75
352
  })), on(EventActions.select, (state, { ids, cumulative }) => ({
76
353
  ...state,
77
- selectedIds: !cumulative ? ids : [...state.selectedIds, ...ids].reduce((p, c) => p.indexOf(c) === -1 ? [...p, c] : p.filter(p1 => p1 !== c), [])
354
+ selectedIds: !cumulative ? ids : [...state.selectedIds, ...ids].reduce((p, c) => p.indexOf(c) === -1 ? [...p, c] : p.filter(p1 => p1 !== c), []),
78
355
  })), on(EventActions.get, EventActions.getForProcedure, (state, _) => ({
79
356
  ...state,
80
- details: {}
357
+ details: {},
81
358
  })), on(EventActions.getSuccess, (state, { event, procedure }) => ({
82
359
  ...state,
83
- details: { event, procedure }
360
+ details: { event, procedure },
84
361
  })));
85
362
  function eventReducer(state, action) {
86
- return internalReducer$2(state, action);
363
+ return internalReducer$1(state, action);
87
364
  }
88
365
 
89
- const feature$2 = createFeatureSelector(eventFeatureKey);
90
- const events = createSelector(feature$2, (state) => state.events);
91
- const selectedIds = createSelector(feature$2, (state) => state.selectedIds);
92
- const loading$1 = createSelector(feature$2, (state) => state.loading);
93
- const filters = createSelector(feature$2, (state) => state.filters);
94
- const details = createSelector(feature$2, (state) => state.details);
366
+ const feature$1 = createFeatureSelector(eventFeatureKey);
367
+ const events = createSelector(feature$1, (state) => state.events);
368
+ const noMoreEvents = createSelector(feature$1, (state) => state.noMoreEvents);
369
+ const selectedIds = createSelector(feature$1, (state) => state.selectedIds);
370
+ const loading$1 = createSelector(feature$1, (state) => state.loading);
371
+ const filters = createSelector(feature$1, (state) => state.filters);
372
+ const details = createSelector(feature$1, (state) => state.details);
95
373
  const EventSelectors = {
96
- feature: feature$2,
374
+ feature: feature$1,
97
375
  events,
98
376
  selectedIds,
99
377
  loading: loading$1,
100
378
  filters,
101
- details
379
+ details,
380
+ noMoreEvents
102
381
  };
103
382
 
104
- const EVENT_TO_ICON = {
105
- fn: (event, store) => of(DEFAULT_ICON_URL),
106
- };
107
- class EventIconPipe {
108
- constructor(store) {
109
- this.store = store;
110
- }
111
- transform(value, ...args) {
112
- return EVENT_TO_ICON.fn(value, this.store);
113
- }
114
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventIconPipe, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Pipe }); }
115
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: EventIconPipe, name: "eventIcon" }); }
116
- }
117
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventIconPipe, decorators: [{
118
- type: Pipe,
119
- args: [{
120
- name: 'eventIcon'
121
- }]
122
- }], ctorParameters: () => [{ type: i1.Store }] });
123
-
124
- class IconDisplayComponent {
125
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: IconDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
126
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: { event: "event" }, ngImport: i0, template: "<div class=\"\n m-hvy-event-summary-item__event-icon-container\n -hvy-{{ event.criticality.toString().toLowerCase()}}\n -hvy-{{event.type.toString().toLowerCase()}}\n \">\n <span\n class=\"m-hvy-event-summary-item__event-icon a-icon\"\n [ngStyle]=\"{\n 'mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')',\n '-webkit-mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')'\n }\"\n aria-hidden=\"true\"\n focusable=\"false\"\n ></span>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.GetSecuredImagePipe, name: "getSecuredImage" }, { kind: "pipe", type: EventIconPipe, name: "eventIcon" }] }); }
127
- }
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: IconDisplayComponent, decorators: [{
129
- type: Component,
130
- args: [{ selector: 'hvy-icon-display', template: "<div class=\"\n m-hvy-event-summary-item__event-icon-container\n -hvy-{{ event.criticality.toString().toLowerCase()}}\n -hvy-{{event.type.toString().toLowerCase()}}\n \">\n <span\n class=\"m-hvy-event-summary-item__event-icon a-icon\"\n [ngStyle]=\"{\n 'mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')',\n '-webkit-mask-image': 'url(' + (event | eventIcon | async | getSecuredImage | async) + ')'\n }\"\n aria-hidden=\"true\"\n focusable=\"false\"\n ></span>\n</div>\n" }]
131
- }], propDecorators: { event: [{
132
- type: Input
133
- }] } });
134
-
135
383
  const EVENT_LINK = {
136
384
  fn: (event, store) => ['./', event.id],
137
385
  };
138
- class EventListComponent {
139
- constructor(store) {
386
+ class EventListComponent extends SubscriptionnerDirective {
387
+ constructor(store, el) {
388
+ super();
140
389
  this.store = store;
390
+ this.el = el;
141
391
  this.EVENT_LINK = EVENT_LINK;
142
392
  this._store = this.store;
143
- this.store.dispatch(EventActions.load());
393
+ this.store.dispatch(EventActions.load({}));
144
394
  this.events$ = this.store.select(EventSelectors.events);
145
395
  this.selectedIds$ = this.store.select(EventSelectors.selectedIds);
146
396
  }
397
+ ngAfterViewInit() {
398
+ this.subscriptions.add(fromEvent(this.el.nativeElement, 'scroll')
399
+ .pipe(
400
+ // Are we close to end
401
+ map((e) => {
402
+ const target = e.currentTarget;
403
+ return target.scrollHeight - target.offsetHeight - target.scrollTop;
404
+ }), withLatestFrom(this.store.select(EventSelectors.noMoreEvents)), filter(([remaningScroll, noMore]) => !noMore && remaningScroll < 200), auditTime(200)).subscribe(() => {
405
+ this.store.dispatch(EventActions.load({ next: true }));
406
+ }));
407
+ }
147
408
  select(event, $event) {
148
409
  this.store.dispatch(EventActions.select({ ids: [event.id], cumulative: true }));
149
410
  $event.preventDefault();
150
411
  $event.stopPropagation();
151
412
  }
152
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventListComponent, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Component }); }
153
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: EventListComponent, selector: "hvy-event-list", ngImport: i0, template: "<table class=\"o-hvy-events-table\">\n <thead>\n <tr class=\"o-hvy-events-table__header\">\n <th></th>\n <th>{{ '@hvy.event.criticality.name' | i18n }}</th>\n <th>{{ '@hvy.event.name' | i18n }}</th>\n <th>{{ '@hvy.event.type.name' | i18n }}</th>\n <th>{{ '@hvy.event.address' | i18n }}</th>\n <th>{{ '@hvy.event.date' | i18n }}</th>\n <th>{{ '@hvy.event.dateM' | i18n }}</th>\n <th>{{ '@hvy.event.status.name' | i18n }}</th>\n <th>{{ '@hvy.procedure.name' | i18n }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr class=\"o-hvy-events-table__line\" *ngFor=\"let event of events$|async\">\n <td class=\"o-hvy-events-table__line__cell\" (click)=\"select(event, $event)\">\n <pry-checkbox [ngModel]=\"(selectedIds$|async)!.includes(event.id)\"></pry-checkbox>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </td>\n <td class=\"o-hvy-events-table__line__cell\">\n <div class=\"o-hvy-events-table__line__name__main\">{{ event.name }}</div>\n <div>{{ event.equipmentReference ? event.equipmentReference : '' }}</div>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">{{ '@hvy.event.type.' + event.type | i18n }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.address }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.creationDate| sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.lastModificationDate | sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell -centered\">{{ '@hvy.event.status.' + event.status | i18n }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.procedureProgress }} %</td>\n <td class=\"o-hvy-events-table__line__cell\">\n <a [routerLink]=\"EVENT_LINK.fn(event, _store)\"><th>{{ '@hvy.action.consult' | i18n }}</th></a>\n </td>\n </tr>\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3$1.PryCheckboxComponent, selector: "pry-checkbox", inputs: ["circle"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: ["event"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }, { kind: "pipe", type: i8.PrySinceDatePipe, name: "sinceDate" }] }); }
413
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventListComponent, deps: [{ token: i1$1.Store }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
414
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: EventListComponent, selector: "hvy-event-list", usesInheritance: true, ngImport: i0, template: "<table class=\"o-hvy-events-table\">\n <thead>\n <tr class=\"o-hvy-events-table__header\">\n <th></th>\n <th>{{ '@hvy.event.criticality.name' | i18n }}</th>\n <th>{{ '@hvy.event.name' | i18n }}</th>\n <th>{{ '@hvy.event.category.name' | i18n }}</th>\n <th>{{ '@hvy.event.address' | i18n }}</th>\n <th>{{ '@hvy.event.creationDate' | i18n }}</th>\n <th>{{ '@hvy.event.lastModificationDate' | i18n }}</th>\n <th>{{ '@hvy.event.status.name' | i18n }}</th>\n <th>{{ '@hvy.procedure.progress' | i18n }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr class=\"o-hvy-events-table__line\" *ngFor=\"let event of events$|async\" (click)=\"select(event, $event)\">\n <td class=\"o-hvy-events-table__line__cell\">\n <pry-checkbox [ngModel]=\"(selectedIds$|async)!.includes(event.id)\"></pry-checkbox>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </td>\n <td class=\"o-hvy-events-table__line__cell\">\n <div class=\"o-hvy-events-table__line__cell__name__main\">{{ event.name }}</div>\n <div\n class=\"o-hvy-events-table__line__cell__name__sub\">{{ event.equipment?.name ? event.equipment?.name : '' }}\n </div>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">{{ '@hvy.event.category.' + event.category | i18n }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.address }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.creationDate| sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.lastModificationDate | sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n <hvy-status-display [event]=\"event\"></hvy-status-display>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n {{ event.procedureProgress }} %\n </td>\n <td class=\"o-hvy-events-table__line__cell\">\n <a [routerLink]=\"EVENT_LINK.fn(event, _store)\">\n > {{ '@hvy.action.consult' | i18n }} @if (event.linkedEvents > 1) {\n ({{ event.linkedEvents }})\n }\n </a>\n </td>\n </tr>\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: i1$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2.PryCheckboxComponent, selector: "pry-checkbox", inputs: ["circle"] }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: ["event"] }, { kind: "component", type: StatusDisplayComponent, selector: "hvy-status-display", inputs: ["event", "modifiable"], outputs: ["modified"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }, { kind: "pipe", type: i9.PrySinceDatePipe, name: "sinceDate" }] }); }
154
415
  }
155
416
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventListComponent, decorators: [{
156
417
  type: Component,
157
- args: [{ selector: 'hvy-event-list', template: "<table class=\"o-hvy-events-table\">\n <thead>\n <tr class=\"o-hvy-events-table__header\">\n <th></th>\n <th>{{ '@hvy.event.criticality.name' | i18n }}</th>\n <th>{{ '@hvy.event.name' | i18n }}</th>\n <th>{{ '@hvy.event.type.name' | i18n }}</th>\n <th>{{ '@hvy.event.address' | i18n }}</th>\n <th>{{ '@hvy.event.date' | i18n }}</th>\n <th>{{ '@hvy.event.dateM' | i18n }}</th>\n <th>{{ '@hvy.event.status.name' | i18n }}</th>\n <th>{{ '@hvy.procedure.name' | i18n }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr class=\"o-hvy-events-table__line\" *ngFor=\"let event of events$|async\">\n <td class=\"o-hvy-events-table__line__cell\" (click)=\"select(event, $event)\">\n <pry-checkbox [ngModel]=\"(selectedIds$|async)!.includes(event.id)\"></pry-checkbox>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </td>\n <td class=\"o-hvy-events-table__line__cell\">\n <div class=\"o-hvy-events-table__line__name__main\">{{ event.name }}</div>\n <div>{{ event.equipmentReference ? event.equipmentReference : '' }}</div>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">{{ '@hvy.event.type.' + event.type | i18n }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.address }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.creationDate| sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.lastModificationDate | sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell -centered\">{{ '@hvy.event.status.' + event.status | i18n }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.procedureProgress }} %</td>\n <td class=\"o-hvy-events-table__line__cell\">\n <a [routerLink]=\"EVENT_LINK.fn(event, _store)\"><th>{{ '@hvy.action.consult' | i18n }}</th></a>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
158
- }], ctorParameters: () => [{ type: i1.Store }] });
418
+ args: [{ selector: 'hvy-event-list', template: "<table class=\"o-hvy-events-table\">\n <thead>\n <tr class=\"o-hvy-events-table__header\">\n <th></th>\n <th>{{ '@hvy.event.criticality.name' | i18n }}</th>\n <th>{{ '@hvy.event.name' | i18n }}</th>\n <th>{{ '@hvy.event.category.name' | i18n }}</th>\n <th>{{ '@hvy.event.address' | i18n }}</th>\n <th>{{ '@hvy.event.creationDate' | i18n }}</th>\n <th>{{ '@hvy.event.lastModificationDate' | i18n }}</th>\n <th>{{ '@hvy.event.status.name' | i18n }}</th>\n <th>{{ '@hvy.procedure.progress' | i18n }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr class=\"o-hvy-events-table__line\" *ngFor=\"let event of events$|async\" (click)=\"select(event, $event)\">\n <td class=\"o-hvy-events-table__line__cell\">\n <pry-checkbox [ngModel]=\"(selectedIds$|async)!.includes(event.id)\"></pry-checkbox>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </td>\n <td class=\"o-hvy-events-table__line__cell\">\n <div class=\"o-hvy-events-table__line__cell__name__main\">{{ event.name }}</div>\n <div\n class=\"o-hvy-events-table__line__cell__name__sub\">{{ event.equipment?.name ? event.equipment?.name : '' }}\n </div>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">{{ '@hvy.event.category.' + event.category | i18n }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.address }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.creationDate| sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell\">{{ event.lastModificationDate | sinceDate: { onlyLocale: true } }}</td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n <hvy-status-display [event]=\"event\"></hvy-status-display>\n </td>\n <td class=\"o-hvy-events-table__line__cell -centered\">\n {{ event.procedureProgress }} %\n </td>\n <td class=\"o-hvy-events-table__line__cell\">\n <a [routerLink]=\"EVENT_LINK.fn(event, _store)\">\n > {{ '@hvy.action.consult' | i18n }} @if (event.linkedEvents > 1) {\n ({{ event.linkedEvents }})\n }\n </a>\n </td>\n </tr>\n </tbody>\n</table>\n" }]
419
+ }], ctorParameters: () => [{ type: i1$1.Store }, { type: i0.ElementRef }] });
159
420
 
160
421
  const EventSummaryActions = {
161
422
  load: createAction('[Event] Load Summaries'),
@@ -174,7 +435,7 @@ const eventSummaryInitialState = {
174
435
  summaries: { ...emptySummaries },
175
436
  loading: false,
176
437
  };
177
- const internalReducer$1 = createReducer(eventSummaryInitialState, on(EventSummaryActions.load, (state, action) => ({
438
+ const internalReducer = createReducer(eventSummaryInitialState, on(EventSummaryActions.load, (state, action) => ({
178
439
  ...state,
179
440
  loading: true
180
441
  })), on(EventSummaryActions.loadSuccess, (state, { summaries }) => ({
@@ -186,33 +447,31 @@ const internalReducer$1 = createReducer(eventSummaryInitialState, on(EventSummar
186
447
  loading: false
187
448
  })));
188
449
  function eventSummaryReducer(state, action) {
189
- return internalReducer$1(state, action);
450
+ return internalReducer(state, action);
190
451
  }
191
452
 
192
- const feature$1 = createFeatureSelector(eventSummaryFeatureKey);
193
- const summaries = createSelector(feature$1, (state) => state.summaries);
194
- const loading = createSelector(feature$1, (state) => state.loading);
453
+ const feature = createFeatureSelector(eventSummaryFeatureKey);
454
+ const summaries = createSelector(feature, (state) => state.summaries);
455
+ const loading = createSelector(feature, (state) => state.loading);
195
456
  const EventSummarySelectors = {
196
- feature: feature$1,
457
+ feature,
197
458
  summaries,
198
459
  loading
199
460
  };
200
461
 
201
462
  class EventSummaryItemComponent {
202
- constructor() {
463
+ constructor(store) {
464
+ this.store = store;
203
465
  this.linkBase = [];
204
- this.linkFragments = [];
205
- }
206
- ngOnInit() {
207
- this.linkFragments = this.linkFragments.length > 0 ? [...this.linkBase, this.event.id] : ['list', this.event.id];
466
+ this.EVENT_LINK = EVENT_LINK;
208
467
  }
209
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
210
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: EventSummaryItemComponent, selector: "hvy-event-summary-item", inputs: { event: "event", linkBase: "linkBase" }, ngImport: i0, template: "<div class=\"m-hvy-event-summary-item\" [routerLink]=\"linkFragments\">\n <div class=\"m-hvy-event-summary-item__title\">\n <h4>\n {{ event.name }}\n </h4>\n </div>\n <div class=\"m-hvy-event-summary-item__content\">\n <span>\n {{\n event.manifestation ?\n (event.manifestation.startDate | date : 'dd/MM HH:MM') + ' - ' + (event.manifestation.endDate | date : 'dd/MM HH:MM') :\n event.interventionRequestTitle\n }}\n </span>\n </div>\n <div class=\"m-hvy-event-summary-item__footer\">\n <div class=\"m-hvy-event-summary-item__icons\">\n <span class=\"m-hvy-event-summary-item__intervention-counter\">{{ event.interventionRequestCount }}</span>\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </div>\n <div class=\"m-hvy-event-summary-item__date\">\n <span>\n {{ event.lastModificationDate | date : 'd MMMM . HH:MM' }}\n </span>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: ["event"] }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }] }); }
468
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryItemComponent, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Component }); }
469
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: EventSummaryItemComponent, selector: "hvy-event-summary-item", inputs: { event: "event", linkBase: "linkBase" }, ngImport: i0, template: "<div class=\"m-hvy-event-summary-item\" [routerLink]=\"EVENT_LINK.fn(event, store)\">\n <div class=\"m-hvy-event-summary-item__title\">\n <h4>\n {{ event.name }}\n </h4>\n </div>\n <div class=\"m-hvy-event-summary-item__content\">\n <span>\n {{\n event.manifestation ?\n (event.manifestation.startDate | date : 'dd/MM HH:MM') + ' - ' + (event.manifestation.endDate | date : 'dd/MM HH:MM') :\n event.interventionRequestTitle\n }}\n </span>\n </div>\n <div class=\"m-hvy-event-summary-item__footer\">\n <div class=\"m-hvy-event-summary-item__icons\">\n <span class=\"m-hvy-event-summary-item__intervention-counter\">{{ event.interventionRequestCount }}</span>\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </div>\n <div class=\"m-hvy-event-summary-item__date\">\n <span>\n {{ event.lastModificationDate | date : 'd MMMM . HH:MM' }}\n </span>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: IconDisplayComponent, selector: "hvy-icon-display", inputs: ["event"] }, { kind: "pipe", type: i1$2.DatePipe, name: "date" }] }); }
211
470
  }
212
471
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryItemComponent, decorators: [{
213
472
  type: Component,
214
- args: [{ selector: 'hvy-event-summary-item', template: "<div class=\"m-hvy-event-summary-item\" [routerLink]=\"linkFragments\">\n <div class=\"m-hvy-event-summary-item__title\">\n <h4>\n {{ event.name }}\n </h4>\n </div>\n <div class=\"m-hvy-event-summary-item__content\">\n <span>\n {{\n event.manifestation ?\n (event.manifestation.startDate | date : 'dd/MM HH:MM') + ' - ' + (event.manifestation.endDate | date : 'dd/MM HH:MM') :\n event.interventionRequestTitle\n }}\n </span>\n </div>\n <div class=\"m-hvy-event-summary-item__footer\">\n <div class=\"m-hvy-event-summary-item__icons\">\n <span class=\"m-hvy-event-summary-item__intervention-counter\">{{ event.interventionRequestCount }}</span>\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </div>\n <div class=\"m-hvy-event-summary-item__date\">\n <span>\n {{ event.lastModificationDate | date : 'd MMMM . HH:MM' }}\n </span>\n </div>\n </div>\n</div>\n" }]
215
- }], propDecorators: { event: [{
473
+ args: [{ selector: 'hvy-event-summary-item', template: "<div class=\"m-hvy-event-summary-item\" [routerLink]=\"EVENT_LINK.fn(event, store)\">\n <div class=\"m-hvy-event-summary-item__title\">\n <h4>\n {{ event.name }}\n </h4>\n </div>\n <div class=\"m-hvy-event-summary-item__content\">\n <span>\n {{\n event.manifestation ?\n (event.manifestation.startDate | date : 'dd/MM HH:MM') + ' - ' + (event.manifestation.endDate | date : 'dd/MM HH:MM') :\n event.interventionRequestTitle\n }}\n </span>\n </div>\n <div class=\"m-hvy-event-summary-item__footer\">\n <div class=\"m-hvy-event-summary-item__icons\">\n <span class=\"m-hvy-event-summary-item__intervention-counter\">{{ event.interventionRequestCount }}</span>\n <hvy-icon-display [event]=\"event\"></hvy-icon-display>\n </div>\n <div class=\"m-hvy-event-summary-item__date\">\n <span>\n {{ event.lastModificationDate | date : 'd MMMM . HH:MM' }}\n </span>\n </div>\n </div>\n</div>\n" }]
474
+ }], ctorParameters: () => [{ type: i1$1.Store }], propDecorators: { event: [{
216
475
  type: Input,
217
476
  args: [{ required: true }]
218
477
  }], linkBase: [{
@@ -237,13 +496,13 @@ class EventSummaryListComponent {
237
496
  this.router.navigate([...this.consultLink]);
238
497
  this.store.dispatch(EventActions.filter({ filters: { status: [status] } }));
239
498
  }
240
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryListComponent, deps: [{ token: i1.Store }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component }); }
499
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryListComponent, deps: [{ token: i1$1.Store }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
241
500
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: EventSummaryListComponent, selector: "hvy-event-summary-list", inputs: { events: "events", totalEventCount: "totalEventCount", status: "status", consultLink: "consultLink", itemLinkBase: "itemLinkBase" }, ngImport: i0, template: "<div class=\"o-hvy-event-summary-list -hvy-{{status.toLowerCase()}}\">\n <div class=\"o-hvy-event-summary-list__header\">\n <h3 class=\"o-hvy-event-summary-list__title\">\n {{ '@hvy.eventSummary.statusLabels.' + status | i18n }}\n </h3>\n <span class=\"o-hvy-event-summary-list__counter\">\n {{ totalEventCount }}\n </span>\n </div>\n <div class=\"o-hvy-event-summary-list__content\">\n @for (event of events; track event.id) {\n <hvy-event-summary-item\n [event]=\"event\"\n [linkBase]=\"itemLinkBase\">\n </hvy-event-summary-item>\n } @empty {\n <span class=\"o-hvy-event-summary-list__no-content\">\n {{ '@hvy.eventSummary.noContent' | i18n }}\n </span>\n }\n </div>\n <div class=\"o-hvy-event-summary-list__footer\">\n <button class=\"o-hvy-event-summary-list__footer-button\" (click)=\"filterAndRoute(status)\">\n Consulter\n <pry-icon iconSvg=\"arrow\"></pry-icon>\n </button>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: i3.PryIconComponent, selector: "pry-icon", inputs: ["color", "iconSvg", "animation", "iconImage", "alt", "width", "height", "classes"] }, { kind: "component", type: EventSummaryItemComponent, selector: "hvy-event-summary-item", inputs: ["event", "linkBase"] }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }] }); }
242
501
  }
243
502
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryListComponent, decorators: [{
244
503
  type: Component,
245
504
  args: [{ selector: 'hvy-event-summary-list', template: "<div class=\"o-hvy-event-summary-list -hvy-{{status.toLowerCase()}}\">\n <div class=\"o-hvy-event-summary-list__header\">\n <h3 class=\"o-hvy-event-summary-list__title\">\n {{ '@hvy.eventSummary.statusLabels.' + status | i18n }}\n </h3>\n <span class=\"o-hvy-event-summary-list__counter\">\n {{ totalEventCount }}\n </span>\n </div>\n <div class=\"o-hvy-event-summary-list__content\">\n @for (event of events; track event.id) {\n <hvy-event-summary-item\n [event]=\"event\"\n [linkBase]=\"itemLinkBase\">\n </hvy-event-summary-item>\n } @empty {\n <span class=\"o-hvy-event-summary-list__no-content\">\n {{ '@hvy.eventSummary.noContent' | i18n }}\n </span>\n }\n </div>\n <div class=\"o-hvy-event-summary-list__footer\">\n <button class=\"o-hvy-event-summary-list__footer-button\" (click)=\"filterAndRoute(status)\">\n Consulter\n <pry-icon iconSvg=\"arrow\"></pry-icon>\n </button>\n </div>\n</div>\n" }]
246
- }], ctorParameters: () => [{ type: i1.Store }, { type: i2.Router }], propDecorators: { events: [{
505
+ }], ctorParameters: () => [{ type: i1$1.Store }, { type: i2$1.Router }], propDecorators: { events: [{
247
506
  type: Input
248
507
  }], totalEventCount: [{
249
508
  type: Input
@@ -267,7 +526,7 @@ class EventSummaryPageComponent extends SubscriptionnerDirective {
267
526
  };
268
527
  this.criticalityList = ["LOW", "MEDIUM", "HIGH", "ALL"];
269
528
  this.store.dispatch(EventSummaryActions.load());
270
- this.selectedCriticality$ = this.store.select(EventSelectors.filters).pipe(map((filters) => filters['criticality']?.[0] ?? 'ALL'));
529
+ this.selectedCriticality$ = this.store.select(EventSelectors.filters).pipe(map$1((filters) => filters['criticality']?.[0] ?? 'ALL'));
271
530
  this.subscriptions.add(this.store.select(EventSummarySelectors.summaries).subscribe((summaries) => {
272
531
  this.summaries = summaries;
273
532
  }));
@@ -280,13 +539,13 @@ class EventSummaryPageComponent extends SubscriptionnerDirective {
280
539
  asIsOrder() {
281
540
  return 0;
282
541
  }
283
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryPageComponent, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Component }); }
284
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: EventSummaryPageComponent, selector: "hvy-event-summary-page", inputs: { pageTitle: "pageTitle" }, usesInheritance: true, ngImport: i0, template: "<div class=\"o-hvy-event-summary-page\">\n <div class=\"o-hvy-event-summary-page__header\">\n @if (pageTitle) {\n <h3 class=\"o-hvy-event-summary-page__title\">{{ pageTitle }}</h3>\n }\n <div class=\"m-filter__input-wrapper m-filter__input-wrapper--dropdown\">\n <label class=\"a-label m-filter__label\" for=\"criticality-filter\">{{ '@hvy.event.criticality' | i18n }} :&nbsp;</label>\n <pry-select\n id=\"criticality-filter\"\n class=\"o-hvy-event-summary-page__filter\"\n [items]=\"criticalityList\"\n [ngModel]=\"selectedCriticality$ | async\"\n (ngModelChange)=\"filterByCriticality($event)\"\n [translate]=\"true\"\n i18nPrefix=\"@hvy.eventSummary.criticalityLabels.\"\n >\n </pry-select>\n </div>\n </div>\n <div class=\"o-hvy-event-summary-page__content\">\n @for (summaryList of summaries | keyvalue: asIsOrder; track summaryList.key) {\n <hvy-event-summary-list\n class=\"o-hvy-event-summary-page__summary-list\"\n [status]=\"summaryList.key\"\n [totalEventCount]=\"summaryList.value.count\"\n [events]=\"summaryList.value.events\">\n </hvy-event-summary-list>\n }\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.PrySelectComponent, selector: "pry-select", inputs: ["items", "clearable", "multiple", "closeOnSelect", "placeholder", "isForm", "required", "name", "readonly", "autocomplete", "bindValue", "bindLabel", "iconSize", "bindIcon", "template", "i18nPrefix", "bindClasses", "loading", "elementRef"], outputs: ["searched", "cleared"] }, { kind: "component", type: EventSummaryListComponent, selector: "hvy-event-summary-list", inputs: ["events", "totalEventCount", "status", "consultLink", "itemLinkBase"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }, { kind: "pipe", type: i1$1.KeyValuePipe, name: "keyvalue" }] }); }
542
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryPageComponent, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Component }); }
543
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: EventSummaryPageComponent, selector: "hvy-event-summary-page", inputs: { pageTitle: "pageTitle" }, usesInheritance: true, ngImport: i0, template: "<div class=\"o-hvy-event-summary-page\">\n <div class=\"o-hvy-event-summary-page__header\">\n @if (pageTitle) {\n <h3 class=\"o-hvy-event-summary-page__title\">{{ pageTitle }}</h3>\n }\n <div class=\"m-filter__input-wrapper m-filter__input-wrapper--dropdown\">\n <label class=\"a-label m-filter__label\" for=\"criticality-filter\">{{ '@hvy.event.criticality.name' | i18n }} :&nbsp;</label>\n <pry-select\n id=\"criticality-filter\"\n class=\"o-hvy-event-summary-page__filter\"\n [items]=\"criticalityList\"\n [ngModel]=\"selectedCriticality$ | async\"\n (ngModelChange)=\"filterByCriticality($event)\"\n [translate]=\"true\"\n i18nPrefix=\"@hvy.eventSummary.criticalityLabels.\"\n >\n </pry-select>\n </div>\n </div>\n <div class=\"o-hvy-event-summary-page__content\">\n @for (summaryList of summaries | keyvalue: asIsOrder; track summaryList.key) {\n <hvy-event-summary-list\n class=\"o-hvy-event-summary-page__summary-list\"\n [status]=\"summaryList.key\"\n [totalEventCount]=\"summaryList.value.count\"\n [events]=\"summaryList.value.events\">\n </hvy-event-summary-list>\n }\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.PrySelectComponent, selector: "pry-select", inputs: ["items", "clearable", "multiple", "closeOnSelect", "placeholder", "isForm", "required", "name", "readonly", "autocomplete", "bindValue", "bindLabel", "iconSize", "bindIcon", "template", "i18nPrefix", "bindClasses", "loading", "elementRef"], outputs: ["searched", "cleared"] }, { kind: "component", type: EventSummaryListComponent, selector: "hvy-event-summary-list", inputs: ["events", "totalEventCount", "status", "consultLink", "itemLinkBase"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.I18nPipe, name: "i18n" }, { kind: "pipe", type: i1$2.KeyValuePipe, name: "keyvalue" }] }); }
285
544
  }
286
545
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryPageComponent, decorators: [{
287
546
  type: Component,
288
- args: [{ selector: 'hvy-event-summary-page', template: "<div class=\"o-hvy-event-summary-page\">\n <div class=\"o-hvy-event-summary-page__header\">\n @if (pageTitle) {\n <h3 class=\"o-hvy-event-summary-page__title\">{{ pageTitle }}</h3>\n }\n <div class=\"m-filter__input-wrapper m-filter__input-wrapper--dropdown\">\n <label class=\"a-label m-filter__label\" for=\"criticality-filter\">{{ '@hvy.event.criticality' | i18n }} :&nbsp;</label>\n <pry-select\n id=\"criticality-filter\"\n class=\"o-hvy-event-summary-page__filter\"\n [items]=\"criticalityList\"\n [ngModel]=\"selectedCriticality$ | async\"\n (ngModelChange)=\"filterByCriticality($event)\"\n [translate]=\"true\"\n i18nPrefix=\"@hvy.eventSummary.criticalityLabels.\"\n >\n </pry-select>\n </div>\n </div>\n <div class=\"o-hvy-event-summary-page__content\">\n @for (summaryList of summaries | keyvalue: asIsOrder; track summaryList.key) {\n <hvy-event-summary-list\n class=\"o-hvy-event-summary-page__summary-list\"\n [status]=\"summaryList.key\"\n [totalEventCount]=\"summaryList.value.count\"\n [events]=\"summaryList.value.events\">\n </hvy-event-summary-list>\n }\n </div>\n</div>\n" }]
289
- }], ctorParameters: () => [{ type: i1.Store }], propDecorators: { pageTitle: [{
547
+ args: [{ selector: 'hvy-event-summary-page', template: "<div class=\"o-hvy-event-summary-page\">\n <div class=\"o-hvy-event-summary-page__header\">\n @if (pageTitle) {\n <h3 class=\"o-hvy-event-summary-page__title\">{{ pageTitle }}</h3>\n }\n <div class=\"m-filter__input-wrapper m-filter__input-wrapper--dropdown\">\n <label class=\"a-label m-filter__label\" for=\"criticality-filter\">{{ '@hvy.event.criticality.name' | i18n }} :&nbsp;</label>\n <pry-select\n id=\"criticality-filter\"\n class=\"o-hvy-event-summary-page__filter\"\n [items]=\"criticalityList\"\n [ngModel]=\"selectedCriticality$ | async\"\n (ngModelChange)=\"filterByCriticality($event)\"\n [translate]=\"true\"\n i18nPrefix=\"@hvy.eventSummary.criticalityLabels.\"\n >\n </pry-select>\n </div>\n </div>\n <div class=\"o-hvy-event-summary-page__content\">\n @for (summaryList of summaries | keyvalue: asIsOrder; track summaryList.key) {\n <hvy-event-summary-list\n class=\"o-hvy-event-summary-page__summary-list\"\n [status]=\"summaryList.key\"\n [totalEventCount]=\"summaryList.value.count\"\n [events]=\"summaryList.value.events\">\n </hvy-event-summary-list>\n }\n </div>\n</div>\n" }]
548
+ }], ctorParameters: () => [{ type: i1$1.Store }], propDecorators: { pageTitle: [{
290
549
  type: Input
291
550
  }] } });
292
551
 
@@ -299,9 +558,9 @@ const enTranslations = {
299
558
  name: 'Event',
300
559
  type: {
301
560
  name: 'Event type',
302
- ALERT: "Alert",
303
- REPORT: "Report",
304
- OPERATOR: "Operator",
561
+ ALERT: 'Alert',
562
+ REPORT: 'Report',
563
+ OPERATOR: 'Operator',
305
564
  },
306
565
  status: {
307
566
  name: 'Status',
@@ -310,8 +569,42 @@ const enTranslations = {
310
569
  DONE: 'Done',
311
570
  },
312
571
  address: 'Address',
313
- date: 'Effect date',
314
- dateM: 'Modification date',
572
+ source: 'External reference',
573
+ equipment: 'Equipment reference',
574
+ equipmentEntity: 'Equipment entity',
575
+ startDate: 'Start date',
576
+ endDate: 'End date',
577
+ creationDate: 'Creation date',
578
+ lastModificationDate: 'Modification date',
579
+ closeDate: 'Close date',
580
+ log: {
581
+ name: 'Events log',
582
+ event: {
583
+ description: 'Description',
584
+ address: 'Address',
585
+ detail: 'Information',
586
+ name: 'Name',
587
+ category: 'Category',
588
+ comments: {
589
+ name: 'Event comments',
590
+ placeholder: 'Write your comment',
591
+ },
592
+ },
593
+ procedure: {
594
+ delete: 'Delete procedure',
595
+ progress: 'Progress',
596
+ noAction: 'No actions',
597
+ name: 'Common procedure',
598
+ addAction: 'Add action'
599
+ },
600
+ },
601
+ category: {
602
+ ALERT: 'Dysfunction alert',
603
+ REPORT: 'GRC report',
604
+ OPERATOR_EVENT: 'Operator event',
605
+ ALERT_LIMIT: 'Limit alert',
606
+ MANIFESTATION: 'Manifestation',
607
+ },
315
608
  },
316
609
  eventSummary: {
317
610
  noContent: 'No event with given criticality',
@@ -324,38 +617,82 @@ const enTranslations = {
324
617
  LOW: 'Low',
325
618
  MEDIUM: 'Medium',
326
619
  HIGH: 'High',
327
- ALL: 'All'
620
+ ALL: 'All',
328
621
  },
329
622
  },
330
623
  procedure: {
331
624
  name: 'Procedure',
625
+ progress: 'Procedure progress %',
332
626
  },
333
627
  action: {
334
- consult: "Consult"
335
- }
628
+ consult: 'Consult',
629
+ close: 'Close',
630
+ send: 'Send',
631
+ },
336
632
  },
337
633
  };
338
634
 
339
635
  const frTranslations = {
340
636
  '@hvy': {
341
637
  event: {
342
- criticality: 'Criticité',
343
638
  name: 'Évènement',
344
639
  type: {
345
640
  name: 'Type d\'évènement',
346
- ALERT: "Alerte",
347
- REPORT: "Signalement",
348
- OPERATOR: "Opérateur",
641
+ ALERT: 'Alerte',
642
+ REPORT: 'Signalement',
643
+ OPERATOR: 'Opérateur',
349
644
  },
350
645
  status: {
351
- name: 'Statut',
646
+ name: 'Statut évènement',
352
647
  NEW: 'Nouveau',
353
648
  IN_PROGRESS: 'En cours',
354
649
  DONE: 'Clôturé',
355
650
  },
356
651
  address: 'Adresse',
357
- date: 'Date d\'effet',
358
- dateM: 'Date de modification',
652
+ source: 'Référence externe',
653
+ equipment: 'Référence matériel',
654
+ equipmentEntity: 'Entité de l\'équipement',
655
+ startDate: 'Date de début',
656
+ endDate: 'Date de fin',
657
+ creationDate: 'Date de création',
658
+ lastModificationDate: 'Date dernières modifications',
659
+ closeDate: 'Date de clotûre',
660
+ log: {
661
+ name: 'Journal des évènements',
662
+ event: {
663
+ description: 'Description',
664
+ address: 'Adresse',
665
+ detail: 'Informations',
666
+ name: 'Nom',
667
+ category: 'Catégorie',
668
+ close: 'Clôturer tous ces évènements',
669
+ comments: {
670
+ name: 'Commentaires de l\'évènement',
671
+ placeholder: 'Écrivez votre commentaire'
672
+ }
673
+ },
674
+ procedure: {
675
+ delete: 'Supprimer la procédure',
676
+ progress: 'Progression',
677
+ noAction: 'Pas d\'action',
678
+ name: 'Procédure commune',
679
+ addAction: 'Ajouter une action'
680
+ },
681
+ },
682
+ category: {
683
+ name: "Catégorie d'évènement",
684
+ ALERT_MALFUNCTION: 'Alerte Dysfonctionnement',
685
+ REPORT: 'Signalement GRC',
686
+ OPERATOR_EVENT: 'Evènement Opérateur',
687
+ ALERT_LIMIT: 'Alerte Seuil',
688
+ MANIFESTATION: 'Manifestation',
689
+ },
690
+ criticality: {
691
+ name: 'Criticité',
692
+ LOW: 'Bas',
693
+ MEDIUM: 'Moyen',
694
+ HIGH: 'Haut',
695
+ },
359
696
  },
360
697
  eventSummary: {
361
698
  noContent: 'Aucun évènement avec la criticité donnée',
@@ -368,24 +705,22 @@ const frTranslations = {
368
705
  LOW: 'Bas',
369
706
  MEDIUM: 'Moyen',
370
707
  HIGH: 'Haut',
371
- ALL: 'Tous'
708
+ ALL: 'Tous',
372
709
  },
373
710
  },
374
711
  procedure: {
375
712
  name: 'Procédure',
713
+ progress: '% avancement procédure'
376
714
  },
377
715
  action: {
378
- consult: "Consulter"
379
- }
380
- }
716
+ consult: 'Consulter',
717
+ close: 'Clotûrer',
718
+ send: 'Envoyer'
719
+ },
720
+ },
381
721
  };
382
722
 
383
- var HypEventCriticality;
384
- (function (HypEventCriticality) {
385
- HypEventCriticality[HypEventCriticality["LOW"] = 0] = "LOW";
386
- HypEventCriticality[HypEventCriticality["MEDIUM"] = 1] = "MEDIUM";
387
- HypEventCriticality[HypEventCriticality["HIGH"] = 2] = "HIGH";
388
- })(HypEventCriticality || (HypEventCriticality = {}));
723
+ const HypEventStatus = ['NEW', 'IN_PROGRESS', 'DONE'];
389
724
 
390
725
  var HypEventType;
391
726
  (function (HypEventType) {
@@ -398,35 +733,12 @@ var HypEventType;
398
733
  * Public API Surface of hypervisor
399
734
  */
400
735
 
401
- const HypervisorActions = {
402
- setUrl: createAction('[Event] Set Backend Url', props())
403
- };
404
-
405
- const hypFeatureKey = '@hvy/general';
406
- const hypInitialState = {
407
- url: '/api/hypervisor',
408
- };
409
- const internalReducer = createReducer(hypInitialState, on(HypervisorActions.setUrl, (state, action) => ({
410
- ...state,
411
- url: action.url ?? state.url,
412
- })));
413
- function hypervisorReducer(state, action) {
414
- return internalReducer(state, action);
415
- }
416
-
417
- const feature = createFeatureSelector(hypFeatureKey);
418
- const url = createSelector(feature, (state) => state.url);
419
- const HypSelectors = {
420
- feature,
421
- url
422
- };
423
-
424
736
  class EventService {
425
737
  constructor(httpClient, store) {
426
738
  this.httpClient = httpClient;
427
739
  this.store = store;
428
740
  }
429
- list() {
741
+ list(startWith = 0) {
430
742
  return this.store
431
743
  .select(HypSelectors.url)
432
744
  .pipe(withLatestFrom(this.store.select(EventSelectors.filters)), mergeMap(([url, filters]) => {
@@ -436,6 +748,8 @@ class EventService {
436
748
  params = params.set(filter, filterValue);
437
749
  });
438
750
  });
751
+ const pageSize = 20;
752
+ params = params.set('page', (startWith / pageSize) + 1);
439
753
  return this.httpClient.get(encodeURI(`${url}/events`), { params });
440
754
  }));
441
755
  }
@@ -453,37 +767,54 @@ class EventService {
453
767
  return this.httpClient.get(encodeURI(`${url}/procedures/id/${id}`));
454
768
  }));
455
769
  }
456
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventService, deps: [{ token: i1$2.HttpClient }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
770
+ save(event) {
771
+ return this.store
772
+ .select(HypSelectors.url)
773
+ .pipe(mergeMap((url) => {
774
+ return this.httpClient.post(encodeURI(`${url}/events/${event.type.toLowerCase()}`), event);
775
+ }));
776
+ }
777
+ saveProcedure(procedure) {
778
+ return this.store
779
+ .select(HypSelectors.url)
780
+ .pipe(mergeMap((url) => {
781
+ return this.httpClient.post(encodeURI(`${url}/procedures`), procedure);
782
+ }));
783
+ }
784
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventService, deps: [{ token: i1.HttpClient }, { token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
457
785
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventService, providedIn: 'root' }); }
458
786
  }
459
787
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventService, decorators: [{
460
788
  type: Injectable,
461
789
  args: [{
462
- providedIn: 'root'
790
+ providedIn: 'root',
463
791
  }]
464
- }], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: i1.Store }] });
792
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Store }] });
465
793
 
466
794
  class EventEffects {
467
- constructor(actions$, eventService) {
795
+ constructor(actions$, eventService, store) {
468
796
  this.actions$ = actions$;
469
797
  this.eventService = eventService;
470
- this.loadEvents$ = createEffect(() => this.actions$.pipe(ofType(EventActions.load), debounceTime(200), mergeMap$1((action) => this.eventService.list().pipe(map((events) => EventActions.loadSuccess({ events })), catchError((error) => [EventActions.loadFailure({ error: error })])))));
471
- this.getEvent$ = createEffect(() => this.actions$.pipe(ofType(EventActions.get), debounceTime(200), mergeMap$1((action) => this.eventService.get(action.id).pipe(map((event) => EventActions.getSuccess({ event })), catchError((error) => [EventActions.getFailure({ error: error })])))));
472
- this.getForProcedureEvent$ = createEffect(() => this.actions$.pipe(ofType(EventActions.getForProcedure), debounceTime(200), mergeMap$1((action) => this.eventService.getProcedure(action.id).pipe(map((procedure) => EventActions.getSuccess({ procedure })), catchError((error) => [EventActions.getFailure({ error: error })])))));
798
+ this.store = store;
799
+ this.loadEvents$ = createEffect(() => this.actions$.pipe(ofType(EventActions.load), debounceTime(200), withLatestFrom(this.store.select(EventSelectors.events), this.store.select(EventSelectors.noMoreEvents)), filter(([action, events, noMore]) => !noMore), mergeMap$1(([action, stateEvents]) => this.eventService.list(action.next ? stateEvents.length : 0).pipe(map$1((events) => EventActions.loadSuccess({ events, startingFrom: action.next ? stateEvents.length : 0 })), catchError((error) => [EventActions.loadFailure({ error: error })])))));
800
+ this.getEvent$ = createEffect(() => this.actions$.pipe(ofType(EventActions.get), debounceTime(200), mergeMap$1((action) => this.eventService.get(action.id).pipe(map$1((event) => EventActions.getSuccess({ event })), catchError((error) => [EventActions.getFailure({ error: error })])))));
801
+ this.getForProcedureEvent$ = createEffect(() => this.actions$.pipe(ofType(EventActions.getForProcedure), debounceTime(200), mergeMap$1((action) => this.eventService.getProcedure(action.id).pipe(map$1((procedure) => EventActions.getSuccess({ procedure })), catchError((error) => [EventActions.getFailure({ error: error })])))));
802
+ this.saveEvent$ = createEffect(() => this.actions$.pipe(ofType(EventActions.save), debounceTime(200), mergeMap$1((action) => this.eventService.save(action.event).pipe(map$1((event) => EventActions.saveSuccess({ event })), catchError((error) => [EventActions.saveFailure({ error: error })])))));
803
+ this.saveProcedure$ = createEffect(() => this.actions$.pipe(ofType(EventActions.saveProcedure), debounceTime(200), mergeMap$1((action) => this.eventService.saveProcedure(action.procedure).pipe(map$1((procedure) => EventActions.saveSuccess({ procedure })), catchError((error) => [EventActions.saveFailure({ error: error })])))));
473
804
  }
474
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventEffects, deps: [{ token: i1$3.Actions }, { token: EventService }], target: i0.ɵɵFactoryTarget.Injectable }); }
805
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventEffects, deps: [{ token: i1$3.Actions }, { token: EventService }, { token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
475
806
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventEffects }); }
476
807
  }
477
808
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventEffects, decorators: [{
478
809
  type: Injectable
479
- }], ctorParameters: () => [{ type: i1$3.Actions }, { type: EventService }] });
810
+ }], ctorParameters: () => [{ type: i1$3.Actions }, { type: EventService }, { type: i1$1.Store }] });
480
811
 
481
812
  class HypervisorService {
482
813
  constructor(httpClient, store) {
483
814
  this.httpClient = httpClient;
484
815
  this.store = store;
485
816
  }
486
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HypervisorService, deps: [{ token: i1$2.HttpClient }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
817
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HypervisorService, deps: [{ token: i1.HttpClient }, { token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
487
818
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HypervisorService, providedIn: 'root' }); }
488
819
  }
489
820
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HypervisorService, decorators: [{
@@ -491,7 +822,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
491
822
  args: [{
492
823
  providedIn: 'root'
493
824
  }]
494
- }], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: i1.Store }] });
825
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Store }] });
495
826
 
496
827
  class HypervisorEffects {
497
828
  constructor(actions$, eventService) {
@@ -523,7 +854,7 @@ class EventSummaryService {
523
854
  return this.httpClient.get(encodeURI(`${url}/events/summary`), { params });
524
855
  }));
525
856
  }
526
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryService, deps: [{ token: i1$2.HttpClient }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
857
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryService, deps: [{ token: i1.HttpClient }, { token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
527
858
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryService, providedIn: 'root' }); }
528
859
  }
529
860
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryService, decorators: [{
@@ -531,13 +862,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
531
862
  args: [{
532
863
  providedIn: 'root'
533
864
  }]
534
- }], ctorParameters: () => [{ type: i1$2.HttpClient }, { type: i1.Store }] });
865
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i1$1.Store }] });
535
866
 
536
867
  class EventSummaryEffects {
537
868
  constructor(actions$, eventSummaryService) {
538
869
  this.actions$ = actions$;
539
870
  this.eventSummaryService = eventSummaryService;
540
- this.loadSummaries$ = createEffect(() => this.actions$.pipe(ofType(EventSummaryActions.load), debounceTime(200), mergeMap$1((action) => this.eventSummaryService.list().pipe(map((summaries) => EventSummaryActions.loadSuccess({ summaries })), catchError((error) => [EventSummaryActions.loadFailure({ error: error })])))));
871
+ this.loadSummaries$ = createEffect(() => this.actions$.pipe(ofType(EventSummaryActions.load), debounceTime(200), mergeMap$1((action) => this.eventSummaryService.list().pipe(map$1((summaries) => EventSummaryActions.loadSuccess({ summaries })), catchError((error) => [EventSummaryActions.loadFailure({ error: error })])))));
541
872
  }
542
873
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryEffects, deps: [{ token: i1$3.Actions }, { token: EventSummaryService }], target: i0.ɵɵFactoryTarget.Injectable }); }
543
874
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: EventSummaryEffects }); }
@@ -553,7 +884,10 @@ const components = [
553
884
  EventSummaryItemComponent,
554
885
  EventSummaryListComponent,
555
886
  EventSummaryPageComponent,
556
- EventIconPipe
887
+ EventIconPipe,
888
+ ForDatetimeLocalPipe,
889
+ StatusDisplayComponent,
890
+ ProgressDisplayComponent
557
891
  ];
558
892
  class PvyHypervisorModule {
559
893
  static forRoot(options) {
@@ -572,14 +906,17 @@ class PvyHypervisorModule {
572
906
  this.i18nService.addLangObject('en', '@hvy', enTranslations);
573
907
  this.i18nService.addLangObject('fr', '@hvy', frTranslations);
574
908
  }
575
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PvyHypervisorModule, deps: [{ token: HYP_BASE_CONFIG }, { token: i1.Store }, { token: i3.PryI18nService }], target: i0.ɵɵFactoryTarget.NgModule }); }
909
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PvyHypervisorModule, deps: [{ token: HYP_BASE_CONFIG }, { token: i1$1.Store }, { token: i3.PryI18nService }], target: i0.ɵɵFactoryTarget.NgModule }); }
576
910
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.3", ngImport: i0, type: PvyHypervisorModule, declarations: [EventDetailComponent,
577
911
  EventListComponent,
578
912
  IconDisplayComponent,
579
913
  EventSummaryItemComponent,
580
914
  EventSummaryListComponent,
581
915
  EventSummaryPageComponent,
582
- EventIconPipe], imports: [i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1$3.EffectsFeatureModule, NgForOf,
916
+ EventIconPipe,
917
+ ForDatetimeLocalPipe,
918
+ StatusDisplayComponent,
919
+ ProgressDisplayComponent], imports: [i1$1.StoreFeatureModule, i1$1.StoreFeatureModule, i1$1.StoreFeatureModule, i1$3.EffectsFeatureModule, NgForOf,
583
920
  AsyncPipe,
584
921
  PryI18nModule,
585
922
  PryCoreModule,
@@ -594,13 +931,18 @@ class PvyHypervisorModule {
594
931
  PryIconModule,
595
932
  KeyValuePipe,
596
933
  PrySelectModule,
597
- FormsModule], exports: [EventDetailComponent,
934
+ FormsModule,
935
+ JsonPipe,
936
+ PryDatePickerModule], exports: [EventDetailComponent,
598
937
  EventListComponent,
599
938
  IconDisplayComponent,
600
939
  EventSummaryItemComponent,
601
940
  EventSummaryListComponent,
602
941
  EventSummaryPageComponent,
603
- EventIconPipe] }); }
942
+ EventIconPipe,
943
+ ForDatetimeLocalPipe,
944
+ StatusDisplayComponent,
945
+ ProgressDisplayComponent] }); }
604
946
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PvyHypervisorModule, imports: [StoreModule.forFeature(hypFeatureKey, hypervisorReducer),
605
947
  StoreModule.forFeature(eventFeatureKey, eventReducer),
606
948
  StoreModule.forFeature(eventSummaryFeatureKey, eventSummaryReducer),
@@ -613,7 +955,8 @@ class PvyHypervisorModule {
613
955
  PrySinceDateModule,
614
956
  PryIconModule,
615
957
  PrySelectModule,
616
- FormsModule] }); }
958
+ FormsModule,
959
+ PryDatePickerModule] }); }
617
960
  }
618
961
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: PvyHypervisorModule, decorators: [{
619
962
  type: NgModule,
@@ -641,7 +984,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
641
984
  PryIconModule,
642
985
  KeyValuePipe,
643
986
  PrySelectModule,
644
- FormsModule
987
+ FormsModule,
988
+ JsonPipe,
989
+ PryDatePickerModule,
645
990
  ],
646
991
  exports: [
647
992
  ...components
@@ -650,7 +995,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
650
995
  }], ctorParameters: () => [{ type: undefined, decorators: [{
651
996
  type: Inject,
652
997
  args: [HYP_BASE_CONFIG]
653
- }] }, { type: i1.Store }, { type: i3.PryI18nService }] });
998
+ }] }, { type: i1$1.Store }, { type: i3.PryI18nService }] });
654
999
 
655
1000
  /*
656
1001
  * Public API Surface of hypervisor
@@ -660,5 +1005,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
660
1005
  * Generated bundle index. Do not edit.
661
1006
  */
662
1007
 
663
- export { EVENT_LINK, EVENT_TO_ICON, EventActions, EventDetailComponent, EventEffects, EventIconPipe, EventListComponent, EventSelectors, EventSummaryActions, EventSummaryEffects, EventSummaryItemComponent, EventSummaryListComponent, EventSummaryPageComponent, EventSummarySelectors, HYP_BASE_CONFIG, HypEventCriticality, HypEventType, IconDisplayComponent, PvyHypervisorModule, enTranslations, eventFeatureKey, eventInitialState, eventReducer, eventSummaryFeatureKey, eventSummaryInitialState, eventSummaryReducer, frTranslations };
1008
+ export { EVENT_LINK, EVENT_TO_ICON, EquipmentService, EventActions, EventDetailComponent, EventEffects, EventIconPipe, EventListComponent, EventSelectors, EventService, EventSummaryActions, EventSummaryEffects, EventSummaryItemComponent, EventSummaryListComponent, EventSummaryPageComponent, EventSummarySelectors, ForDatetimeLocalPipe, HYP_BASE_CONFIG, HypEventCategory, HypEventCriticality, HypEventStatus, HypEventType, HypSelectors, HypervisorActions, HypervisorEffects, HypervisorService, IconDisplayComponent, ProgressDisplayComponent, PvyHypervisorModule, StatusDisplayComponent, enTranslations, eventFeatureKey, eventInitialState, eventReducer, eventSummaryFeatureKey, eventSummaryInitialState, eventSummaryReducer, frTranslations, hypFeatureKey, hypInitialState, hypervisorReducer };
664
1009
  //# sourceMappingURL=provoly-hypervisor.mjs.map