@hestia-earth/ui-components 0.2.1 → 0.2.4

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.
@@ -457,12 +457,7 @@
457
457
  });
458
458
  return res;
459
459
  };
460
- var waitFor = function (variable, callback) {
461
- if (variable in window) {
462
- return callback();
463
- }
464
- setTimeout(function () { return waitFor(variable, callback); }, 100);
465
- };
460
+ var waitFor = function (variable, callback) { return get$6(window, variable, false) ? callback() : setTimeout(function () { return waitFor(variable, callback); }, 100); };
466
461
  var bottom = function (element) { return element.offsetTop + element.getBoundingClientRect().height; };
467
462
  var isScrolledBelow = function (element) { return element ? window.scrollY > bottom(element) : false; };
468
463
  var scrollToEl = function (id, retries) {
@@ -1990,7 +1985,7 @@
1990
1985
  return LinkKeyValueComponent;
1991
1986
  }());
1992
1987
  LinkKeyValueComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LinkKeyValueComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1993
- LinkKeyValueComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: { node: "node", nodeType: "nodeType", dataKey: "dataKey", key: "key" }, ngImport: i0__namespace, template: "<ng-container *ngIf=\"!isUndefined\">\n <ng-container *bindOnce=\"node\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n <span class=\"pr-2\">:</span>\n <a class=\"pr-1\" [href]=\"valueLink\" *ngIf=\"valueLink; else showString\">{{valueString}}</a>\n <he-blank-node-state\n [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"\n ></he-blank-node-state>\n </ng-container>\n</ng-container>\n\n<ng-template #showString>\n <ng-container *ngIf=\"isArray\">\n <p *ngFor=\"let v of value\">{{toString(v) | precision:3}}</p>\n </ng-container>\n <ng-container *ngIf=\"!isArray\">\n <span class=\"pr-1\">{{valueString | precision:3}}</span>\n </ng-container>\n</ng-template>\n", styles: [":host{display:block}\n"], components: [{ type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "precision": PrecisionPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1988
+ LinkKeyValueComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: { node: "node", nodeType: "nodeType", dataKey: "dataKey", key: "key" }, ngImport: i0__namespace, template: "<ng-container *ngIf=\"!isUndefined\">\n <ng-container *bindOnce=\"node\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n <span class=\"pr-2\">:</span>\n <a class=\"pr-1\" [href]=\"valueLink\" *ngIf=\"valueLink; else showString\">{{valueString}}</a>\n <he-blank-node-state\n [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"\n ></he-blank-node-state>\n </ng-container>\n</ng-container>\n\n<ng-template #showString>\n <ng-container *ngIf=\"isArray\">\n <div class=\"array-container\">\n <p *ngFor=\"let v of value\">{{toString(v) | precision:3}}</p>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!isArray\">\n <span class=\"pr-1\">{{valueString | precision:3}}</span>\n </ng-container>\n</ng-template>\n", styles: [":host{display:block}.array-container{max-height:100px;overflow-y:auto}\n"], components: [{ type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "precision": PrecisionPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1994
1989
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LinkKeyValueComponent, decorators: [{
1995
1990
  type: i0.Component,
1996
1991
  args: [{
@@ -2097,20 +2092,24 @@
2097
2092
  ]);
2098
2093
  })[0]; };
2099
2094
  var coordinatesToPolygon = function (coordinates) { return new google.maps.Polygon(Object.assign({ paths: coordinates.map(coordinatesToPoint).filter(Boolean) }, strokeStyle)); };
2100
- var addPolygonToFeature = function (feat, polygon) {
2101
- var _a;
2102
- return feat.type === 'FeatureCollection' ?
2103
- feat.features.push(addPolygonToFeature(defaultFeature(), polygon)) : (feat.type === 'GeometryCollection' ?
2104
- feat.geometries.map(function (geometry) { return (geometry.coordinates || []).push(polygonToCoordinates(polygon)); }) :
2105
- (((_a = feat.geometry) === null || _a === void 0 ? void 0 : _a.coordinates) || []).push(polygonToCoordinates(polygon)));
2106
- };
2107
- var polygonsFromFeature = function (feat) {
2095
+ var getCoordinates = function (feat) {
2108
2096
  var _a;
2109
- return feat.type === 'FeatureCollection' ?
2110
- feat.features.flatMap(polygonsFromFeature) : (feat.type === 'GeometryCollection' ?
2111
- feat.geometries.flatMap(function (geometry) { return (geometry.coordinates || []).map(coordinatesToPolygon); }) :
2112
- (((_a = feat.geometry) === null || _a === void 0 ? void 0 : _a.coordinates) || []).map(coordinatesToPolygon));
2113
- };
2097
+ return feat.type === 'Polygon' || feat.type === 'MultiPolygon'
2098
+ ? feat.coordinates
2099
+ : feat.type === 'Feature'
2100
+ ? (_a = feat.geometry) === null || _a === void 0 ? void 0 : _a.coordinates
2101
+ : [];
2102
+ };
2103
+ var addPolygonToFeature = function (feat, polygon) { return feat.type === 'FeatureCollection'
2104
+ ? feat.features.push(addPolygonToFeature(defaultFeature(), polygon))
2105
+ : feat.type === 'GeometryCollection'
2106
+ ? feat.geometries.map(function (geometry) { return ((geometry === null || geometry === void 0 ? void 0 : geometry.coordinates) || []).push(polygonToCoordinates(polygon)); })
2107
+ : (getCoordinates(feat) || []).push(polygonToCoordinates(polygon)); };
2108
+ var polygonsFromFeature = function (feat) { return feat.type === 'FeatureCollection'
2109
+ ? feat.features.flatMap(polygonsFromFeature)
2110
+ : feat.type === 'GeometryCollection'
2111
+ ? feat.geometries.flatMap(function (geometry) { return (geometry.coordinates || []).map(coordinatesToPolygon); })
2112
+ : (getCoordinates(feat) || []).map(coordinatesToPolygon); };
2114
2113
  var polygonBounds = function (polygon) {
2115
2114
  var _a;
2116
2115
  return polygon ?
@@ -5852,9 +5851,11 @@
5852
5851
  ? (this.isRunOrchestrator(log)
5853
5852
  ? (!node.isRequired
5854
5853
  ? LogStatus.notRequired
5855
- : log.shouldRun
5856
- ? LogStatus.success
5857
- : LogStatus.error) : (node.isRecalculated
5854
+ : 'shouldRun' in log
5855
+ ? log.shouldRun
5856
+ ? LogStatus.success
5857
+ : LogStatus.error
5858
+ : LogStatus.dataProvided) : (node.isRecalculated
5858
5859
  ? LogStatus.skipHierarchy
5859
5860
  : LogStatus.dataProvided))
5860
5861
  : LogStatus.skipHierarchy);
@@ -5868,7 +5869,7 @@
5868
5869
  return NodeLogsModelsComponent;
5869
5870
  }());
5870
5871
  NodeLogsModelsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeLogsModelsComponent, deps: [{ token: HeSearchService }, { token: HeEngineService }], target: i0__namespace.ɵɵFactoryTarget.Component });
5871
- NodeLogsModelsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeLogsModelsComponent, selector: "he-node-logs-models", inputs: { nodeType: "nodeType", nodeKey: "nodeKey", includeAllModels: "includeAllModels", logsUrl: "logsUrl", originalValues: "originalValues", recalculatedValues: "recalculatedValues", terms: "terms", logs: "logs", filteredType: "filteredType" }, ngImport: i0__namespace, template: "<div class=\"px-3 pb-3\">\n <div class=\"has-text-right mb-2\" *ngIf=\"!isExternal\">\n <a class=\"is-size-7\" *ngIf=\"logsUrl\" [href]=\"logsUrl\" target=\"_blank\">\n <fa-icon icon=\"external-link-alt\"></fa-icon>\n <span class=\"pl-2\">Open Full Logs</span>\n </a>\n </div>\n\n <he-data-table class=\"mb-1 is-small\" [small]=\"true\" [nbRows]=\"rowsCount\" maxHeight=\"320\">\n <table class=\"table is-narrow is-striped\">\n <thead>\n <tr>\n <th class=\"width-auto\">\n <div class=\"field\">\n <div class=\"control is-expanded has-icons-right\">\n <input class=\"input search-input is-small\"\n [(ngModel)]=\"term\" name=\"term\"\n placeholder=\"Filter by name\"\n [editable]=\"false\"\n [ngbTypeahead]=\"suggestTerm\"\n (selectItem)=\"filterResults()\"\n >\n <a class=\"icon is-small is-right\"\n [class.is-hidden]=\"!term\"\n (click)=\"term = ''; filterResults();\"\n >\n <fa-icon icon=\"times\"></fa-icon>\n </a>\n </div>\n </div>\n </th>\n <th>Original</th>\n <th>Recalculated</th>\n <th>Difference</th>\n <th *ngFor=\"let c of methodModelsCount | times; let i = index\">({{i + 1}})</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngIf=\"loading\">\n <td colspan=\"5\">\n <div class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n </div>\n </td>\n </tr>\n <tr *ngIf=\"!loading && blankNodes.length === 0\">\n <td class=\"has-text-centered\" colspan=\"5\">\n <span>No data</span>\n </td>\n </tr>\n <ng-container *ngFor=\"let blankNode of blankNodes; trackBy: trackByBlankNode\">\n <tr [class.has-sub-rows]=\"blankNode.canOpen\">\n <td class=\"width-auto\" [attr.title]=\"blankNode.term.name\">\n <a class=\"is-inline-block is-align-top pr-2 open-node\"\n (click)=\"blankNode.isOpen = !blankNode.isOpen\"\n *ngIf=\"blankNode.canOpen\"\n >\n <fa-icon icon=\"angle-down\" [class.is-hidden]=\"!blankNode.isOpen\"></fa-icon>\n <fa-icon icon=\"angle-right\" [class.is-hidden]=\"blankNode.isOpen\"></fa-icon>\n </a>\n <he-node-link class=\"is-inline-block\" [node]=\"blankNode.term\">\n <span class=\"is-nowrap has-text-ellipsis\">{{blankNode.term.name}}</span>\n </he-node-link>\n </td>\n <td>\n <span>{{blankNode.originalValue | precision:3 | default:'-'}}</span>\n </td>\n <td>\n <span *ngIf=\"!blankNode.isOriginal || blankNode.isRecalculated; else notRecalculated\">\n {{blankNode.recalculatedValue | precision:3 | default:'-'}}\n </span>\n </td>\n <td class=\"is-nowrap\">\n <he-blank-node-value-delta *ngIf=\"blankNode.original.length && blankNode.isRecalculated; else noValue\"\n [value]=\"blankNode.recalculatedValue\"\n [originalValue]=\"blankNode.originalValue\"\n ></he-blank-node-value-delta>\n </td>\n <ng-container *ngTemplateOutlet=\"blankNodeModels; context: {blankNode: blankNode}\"></ng-container>\n </tr>\n\n <ng-container *ngIf=\"blankNode.keys?.length\">\n <tr\n *ngFor=\"let subValue of blankNode.keys\"\n [class.is-hidden]=\"!blankNode.isOpen\"\n [class.has-sub-rows]=\"blankNode.subValues?.length\"\n >\n <td class=\"width-auto has-text-left\">\n <span class=\"is-inline-block is-align-top pl-3 pr-1 field-node\">Field:</span>\n\n <a class=\"is-inline-block\" *ngIf=\"blankNode.type\"\n [href]=\"baseUrl + '/schema/' + blankNode.type + '#' + subValue.key\" target=\"_blank\" [title]=\"subValue.key\"\n >\n <span class=\"is-nowrap has-text-ellipsis\">{{subValue.key}}</span>\n </a>\n <span class=\"is-inline-block is-align-top\" *ngIf=\"!blankNode.type\">{{subValue.key}}</span>\n </td>\n <td>\n <span *ngIf=\"subValue.originalValue !== null; else noValue\">{{subValue.originalValue | precision:3 | default:'-'}}</span>\n </td>\n <td>\n <span *ngIf=\"subValue.isRecalculated; else notRecalculated\">\n {{subValue.recalculatedValue | precision:3 | default:'-'}}\n </span>\n </td>\n <td>-</td>\n <td class=\"blank-node-index-key\">\n <ng-container *ngTemplateOutlet=\"blankNodeModel; context: {blankNode:blankNode, methodId:subValue.key, logs:getLogs(blankNode, subValue.key)}\"></ng-container>\n </td>\n <td *ngIf=\"methodModelsCount > 1\" [attr.colspan]=\"methodModelsCount - 1\"></td>\n </tr>\n </ng-container>\n\n <tr\n *ngFor=\"let subValue of blankNode.subValues\"\n [class.is-hidden]=\"!blankNode.isOpen\"\n >\n <td class=\"width-auto has-text-left\">\n <span class=\"is-inline-block is-align-top pl-3\">{{subValue.key | keyToLabel}}</span>\n\n <ng-container *ngIf=\"subValue.id\">\n <span class=\"is-inline-block\" class=\"is-inline-block is-align-top pr-1\">:</span>\n\n <ng-container [ngSwitch]=\"subValue.key\">\n <span class=\"is-inline-block\" *ngSwitchCase=\"'backgroundData'\">{{subValue.id | keyToLabel}}</span>\n <he-node-link *ngSwitchDefault class=\"is-block pl-4\" [node]=\"{'@type':'Term','@id':subValue.id}\" [attr.title]=\"subValue.id | keyToLabel\">\n <span class=\"is-nowrap has-text-ellipsis\">{{subValue.id | keyToLabel}}</span>\n </he-node-link>\n </ng-container>\n </ng-container>\n </td>\n <td>\n <span *ngIf=\"subValue.originalValue !== null; else noValue\">{{subValue.originalValue | precision:3 | default:'-'}}</span>\n </td>\n <td>\n <span *ngIf=\"subValue.isRecalculated; else notRecalculated\">\n {{subValue.recalculatedValue | precision:3 | default:'-'}}\n </span>\n </td>\n <td>-</td>\n <ng-container *ngTemplateOutlet=\"blankNodeModels; context: {blankNode: blankNode, subValue: subValue}\"></ng-container>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </he-data-table>\n\n <div class=\"is-size-7 is-italic\">\n <div class=\"columns is-variable is-1 my-0\">\n <div class=\"column is-narrow\">\n <p>\n <a class=\"is-inline-block pr-2\"\n (click)=\"showLegend = !showLegend\"\n >\n <fa-icon icon=\"angle-down\" [class.is-hidden]=\"!showLegend\"></fa-icon>\n <fa-icon icon=\"angle-right\" [class.is-hidden]=\"showLegend\"></fa-icon>\n </a>\n <span class=\"is-inline-block\">Legend:</span>\n </p>\n <ul class=\"content pl-2\" [class.is-hidden]=\"!showLegend\">\n <li\n class=\"has-text-{{logColor[status.value]}}\"\n *ngFor=\"let status of LogStatus | keys\"\n >\n <fa-icon [icon]=\"logIcon[status.value]\"></fa-icon>\n <span class=\"pl-1\">{{status.value}}</span>\n </li>\n </ul>\n </div>\n <div class=\"column has-text-right\" *ngIf=\"filteredType\">\n <label class=\"is-inline-block checkbox\">\n <input type=\"checkbox\" class=\"selector\"\n [(ngModel)]=\"onlyWithData\"\n (change)=\"filterResults()\"\n >\n <span class=\"ml-2\">Show only relevant {{filteredType | pluralize}}</span>\n </label>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #blankNodeModels let-blankNode=\"blankNode\" let-subValue=\"subValue\">\n <td class=\"blank-node-index-{{i}}\" *ngFor=\"let c of methodModelsCount | times; let i = index\">\n <ng-container *ngIf=\"validSubValue(blankNode, i, subValue); else noValue\">\n <ng-container *ngIf=\"getMethodIdAt(blankNode, i, subValue); let methodId; else noValue\">\n <ng-template #modelSerie>\n <ng-container *ngTemplateOutlet=\"blankNodeModel; context: {blankNode:blankNode, methodId:methodId, subValue:subValue, logs:getLogs(blankNode, methodId, subValue)}\"></ng-container>\n </ng-template>\n <div *ngIf=\"methodId | isArray; else modelSerie\">\n <p *ngFor=\"let value of methodId\">\n <ng-container *ngTemplateOutlet=\"blankNodeModel; context: {blankNode:blankNode, methodId:value, subValue:subValue, logs:getLogs(blankNode, methodId, subValue)}\"></ng-container>\n </p>\n </div>\n </ng-container>\n </ng-container>\n </td>\n</ng-template>\n\n<ng-template #blankNodeModel let-blankNode=\"blankNode\" let-methodId=\"methodId\" let-subValue=\"subValue\" let-logs=\"logs\">\n <span\n [class.trigger-popover]=\"hasLogDetails(blankNode, methodId, subValue)\"\n [ngbPopover]=\"logDetails\" [autoClose]=\"'outside'\"\n triggers=\"manual\" #p=\"ngbPopover\" placement=\"left\" container=\"body\"\n (click)=\"hasLogDetails(blankNode, methodId, subValue) ? togglePopover(p, { logs }) : null\"\n >\n <span class=\"is-capitalized\">{{methodName(blankNode, methodId, subValue)}}</span>\n <span class=\"pl-1\" *ngIf=\"hasLog(logs) && logs?.methodTier\">[{{logs.methodTier}}]</span>\n <span class=\"pl-1 has-text-{{logColor[logStatus(blankNode, methodId, subValue)]}}\">\n <fa-icon [icon]=\"logIcon[logStatus(blankNode, methodId, subValue)]\"></fa-icon>\n </span>\n </span>\n</ng-template>\n\n<ng-template #noValue>-</ng-template>\n\n<ng-template #notRecalculated>not recalculated</ng-template>\n\n<ng-template #logDetails let-logs=\"logs\">\n <ng-container *ngIf=\"logs.requirements\">\n <p class=\"is-requirement\" *ngFor=\"let key of requirementKeys(logs.requirements)\">\n {{key}}: {{logs.requirements[key]}}\n </p>\n </ng-container>\n <ng-container *ngIf=\"logs.logs\">\n <p class=\"is-log\" *ngFor=\"let key of logs.logs | keys\">\n {{key.key}}: {{key.value}}\n </p>\n </ng-container>\n <ng-container *ngIf=\"logs.missingLookups?.length\">\n <p class=\"mt-2\">Missing lookups:</p>\n\n <div class=\"table-container data-table-container\">\n <table class=\"table is-fullwidth mb-0\">\n <thead class=\"has-background-black\">\n <tr>\n <th>\n <span class=\"has-text-white\">Filename</span>\n </th>\n <th>\n <span class=\"has-text-white\">Column Title</span>\n </th>\n <th>\n <span class=\"has-text-white\">Row (term.id)</span>\n </th>\n </tr>\n </thead>\n <tbody class=\"has-background-black has-text-white\">\n <tr *ngFor=\"let data of logs.missingLookups\">\n <td>{{data.filename}}</td>\n <td>{{data.column}}</td>\n <td>{{data.termId}}</td>\n </tr>\n </tbody>\n </table>\n </div>\n </ng-container>\n</ng-template>\n", styles: [":host{display:block}::ng-deep tr.has-sub-rows td{border-bottom-style:dotted}::ng-deep td he-node-link{width:190px}::ng-deep td .open-node+he-node-link{width:170px}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: DataTableComponent, selector: "he-data-table", inputs: ["minHeight", "maxHeight", "nbRows", "small", "height", "width"] }, { type: NodeLinkComponent, selector: "he-node-link", inputs: ["node", "showExternalLink"] }, { type: BlankNodeValueDeltaComponent, selector: "he-blank-node-value-delta", inputs: ["value", "originalValue", "displayType"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$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]" }, { type: i11__namespace.NgbTypeahead, selector: "input[ngbTypeahead]", inputs: ["autocomplete", "placement", "container", "editable", "focusFirst", "showHint", "inputFormatter", "ngbTypeahead", "resultFormatter", "resultTemplate"], outputs: ["selectItem"], exportAs: ["ngbTypeahead"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i1__namespace$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i11__namespace.NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disablePopover", "popoverClass", "openDelay", "closeDelay", "ngbPopover", "popoverTitle"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }], pipes: { "times": TimesPipe, "default": DefaultPipe, "precision": PrecisionPipe, "keyToLabel": KeyToLabelPipe, "keys": KeysPipe, "pluralize": PluralizePipe, "isArray": IsArrayPipe } });
5872
+ NodeLogsModelsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeLogsModelsComponent, selector: "he-node-logs-models", inputs: { nodeType: "nodeType", nodeKey: "nodeKey", includeAllModels: "includeAllModels", logsUrl: "logsUrl", originalValues: "originalValues", recalculatedValues: "recalculatedValues", terms: "terms", logs: "logs", filteredType: "filteredType" }, ngImport: i0__namespace, template: "<div class=\"px-3 pb-3\">\n <div class=\"has-text-right mb-2\" *ngIf=\"!isExternal\">\n <a class=\"is-size-7\" *ngIf=\"logsUrl\" [href]=\"logsUrl\" target=\"_blank\">\n <fa-icon icon=\"external-link-alt\"></fa-icon>\n <span class=\"pl-2\">Open Full Logs</span>\n </a>\n </div>\n\n <he-data-table class=\"mb-1 is-small\" [small]=\"true\" [nbRows]=\"rowsCount\" maxHeight=\"320\">\n <table class=\"table is-narrow is-striped\">\n <thead>\n <tr>\n <th class=\"width-auto\">\n <div class=\"field\">\n <div class=\"control is-expanded has-icons-right\">\n <input class=\"input search-input is-small\"\n [(ngModel)]=\"term\" name=\"term\"\n placeholder=\"Filter by name\"\n [editable]=\"false\"\n [ngbTypeahead]=\"suggestTerm\"\n (selectItem)=\"filterResults()\"\n >\n <a class=\"icon is-small is-right\"\n [class.is-hidden]=\"!term\"\n (click)=\"term = ''; filterResults();\"\n >\n <fa-icon icon=\"times\"></fa-icon>\n </a>\n </div>\n </div>\n </th>\n <th class=\"has-border-right\">Units</th>\n <th>Original</th>\n <th>Recalculated</th>\n <th>Difference</th>\n <th *ngFor=\"let c of methodModelsCount | times; let i = index\">({{i + 1}})</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngIf=\"loading\">\n <td class=\"has-text-centered\" colspan=\"6\">\n <div class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n </div>\n </td>\n </tr>\n <tr *ngIf=\"!loading && blankNodes.length === 0\">\n <td class=\"has-text-centered\" colspan=\"6\">\n <span>No data</span>\n </td>\n </tr>\n <ng-container *ngFor=\"let blankNode of blankNodes; trackBy: trackByBlankNode\">\n <tr [class.has-sub-rows]=\"blankNode.canOpen\">\n <td class=\"width-auto\" [attr.title]=\"blankNode.term.name\">\n <a class=\"is-inline-block is-align-top pr-2 open-node\"\n (click)=\"blankNode.isOpen = !blankNode.isOpen\"\n *ngIf=\"blankNode.canOpen\"\n >\n <fa-icon icon=\"angle-down\" [class.is-hidden]=\"!blankNode.isOpen\"></fa-icon>\n <fa-icon icon=\"angle-right\" [class.is-hidden]=\"blankNode.isOpen\"></fa-icon>\n </a>\n <he-node-link class=\"is-inline-block\" [node]=\"blankNode.term\">\n <span class=\"is-nowrap has-text-ellipsis\">{{blankNode.term.name}}</span>\n </he-node-link>\n </td>\n <td class=\"has-border-right\">\n <span>{{blankNode.term?.units}}</span>\n </td>\n <td>\n <span>{{blankNode.originalValue | precision:3 | default:'-'}}</span>\n </td>\n <td>\n <span *ngIf=\"!blankNode.isOriginal || blankNode.isRecalculated; else notRecalculated\">\n {{blankNode.recalculatedValue | precision:3 | default:'-'}}\n </span>\n </td>\n <td class=\"is-nowrap\">\n <he-blank-node-value-delta *ngIf=\"blankNode.original.length && blankNode.isRecalculated; else noValue\"\n [value]=\"blankNode.recalculatedValue\"\n [originalValue]=\"blankNode.originalValue\"\n ></he-blank-node-value-delta>\n </td>\n <ng-container *ngTemplateOutlet=\"blankNodeModels; context: {blankNode: blankNode}\"></ng-container>\n </tr>\n\n <ng-container *ngIf=\"blankNode.keys?.length\">\n <tr\n *ngFor=\"let subValue of blankNode.keys\"\n [class.is-hidden]=\"!blankNode.isOpen\"\n [class.has-sub-rows]=\"blankNode.subValues?.length\"\n >\n <td class=\"width-auto has-text-left\">\n <span class=\"is-inline-block is-align-top pl-3 pr-1 field-node\">Field:</span>\n\n <a class=\"is-inline-block\" *ngIf=\"blankNode.type\"\n [href]=\"baseUrl + '/schema/' + blankNode.type + '#' + subValue.key\" target=\"_blank\" [title]=\"subValue.key\"\n >\n <span class=\"is-nowrap has-text-ellipsis\">{{subValue.key}}</span>\n </a>\n <span class=\"is-inline-block is-align-top\" *ngIf=\"!blankNode.type\">{{subValue.key}}</span>\n </td>\n <td class=\"has-border-right\"></td>\n <td>\n <span *ngIf=\"subValue.originalValue !== null; else noValue\">{{subValue.originalValue | precision:3 | default:'-'}}</span>\n </td>\n <td>\n <span *ngIf=\"subValue.isRecalculated; else notRecalculated\">\n {{subValue.recalculatedValue | precision:3 | default:'-'}}\n </span>\n </td>\n <td>-</td>\n <td class=\"blank-node-index-key\">\n <ng-container *ngTemplateOutlet=\"blankNodeModel; context: {blankNode:blankNode, methodId:subValue.key, logs:getLogs(blankNode, subValue.key)}\"></ng-container>\n </td>\n <td *ngIf=\"methodModelsCount > 1\" [attr.colspan]=\"methodModelsCount - 1\"></td>\n </tr>\n </ng-container>\n\n <tr\n *ngFor=\"let subValue of blankNode.subValues\"\n [class.is-hidden]=\"!blankNode.isOpen\"\n >\n <td class=\"width-auto has-text-left\">\n <span class=\"is-inline-block is-align-top pl-3\">{{subValue.key | keyToLabel}}</span>\n\n <ng-container *ngIf=\"subValue.id\">\n <span class=\"is-inline-block\" class=\"is-inline-block is-align-top pr-1\">:</span>\n\n <ng-container [ngSwitch]=\"subValue.key\">\n <span class=\"is-inline-block\" *ngSwitchCase=\"'backgroundData'\">{{subValue.id | keyToLabel}}</span>\n <he-node-link *ngSwitchDefault class=\"is-block pl-4\" [node]=\"{'@type':'Term','@id':subValue.id}\" [attr.title]=\"subValue.id | keyToLabel\">\n <span class=\"is-nowrap has-text-ellipsis\">{{subValue.id | keyToLabel}}</span>\n </he-node-link>\n </ng-container>\n </ng-container>\n </td>\n <td class=\"has-border-right\"></td>\n <td>\n <span *ngIf=\"subValue.originalValue !== null; else noValue\">{{subValue.originalValue | precision:3 | default:'-'}}</span>\n </td>\n <td>\n <span *ngIf=\"subValue.isRecalculated; else notRecalculated\">\n {{subValue.recalculatedValue | precision:3 | default:'-'}}\n </span>\n </td>\n <td>-</td>\n <ng-container *ngTemplateOutlet=\"blankNodeModels; context: {blankNode: blankNode, subValue: subValue}\"></ng-container>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </he-data-table>\n\n <div class=\"is-size-7 is-italic\">\n <div class=\"columns is-variable is-1 my-0\">\n <div class=\"column is-narrow\">\n <p>\n <a class=\"is-inline-block pr-2\"\n (click)=\"showLegend = !showLegend\"\n >\n <fa-icon icon=\"angle-down\" [class.is-hidden]=\"!showLegend\"></fa-icon>\n <fa-icon icon=\"angle-right\" [class.is-hidden]=\"showLegend\"></fa-icon>\n </a>\n <span class=\"is-inline-block\">Legend:</span>\n </p>\n <ul class=\"content pl-2\" [class.is-hidden]=\"!showLegend\">\n <li\n class=\"has-text-{{logColor[status.value]}}\"\n *ngFor=\"let status of LogStatus | keys\"\n >\n <fa-icon [icon]=\"logIcon[status.value]\"></fa-icon>\n <span class=\"pl-1\">{{status.value}}</span>\n </li>\n </ul>\n </div>\n <div class=\"column has-text-right\" *ngIf=\"filteredType\">\n <label class=\"is-inline-block checkbox\">\n <input type=\"checkbox\" class=\"selector\"\n [(ngModel)]=\"onlyWithData\"\n (change)=\"filterResults()\"\n >\n <span class=\"ml-2\">Show only relevant {{filteredType | pluralize}}</span>\n </label>\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #blankNodeModels let-blankNode=\"blankNode\" let-subValue=\"subValue\">\n <td class=\"blank-node-index-{{i}}\" *ngFor=\"let c of methodModelsCount | times; let i = index\">\n <ng-container *ngIf=\"validSubValue(blankNode, i, subValue); else noValue\">\n <ng-container *ngIf=\"getMethodIdAt(blankNode, i, subValue); let methodId; else noValue\">\n <ng-template #modelSerie>\n <ng-container *ngTemplateOutlet=\"blankNodeModel; context: {blankNode:blankNode, methodId:methodId, subValue:subValue, logs:getLogs(blankNode, methodId, subValue)}\"></ng-container>\n </ng-template>\n <div *ngIf=\"methodId | isArray; else modelSerie\">\n <p *ngFor=\"let value of methodId\">\n <ng-container *ngTemplateOutlet=\"blankNodeModel; context: {blankNode:blankNode, methodId:value, subValue:subValue, logs:getLogs(blankNode, methodId, subValue)}\"></ng-container>\n </p>\n </div>\n </ng-container>\n </ng-container>\n </td>\n</ng-template>\n\n<ng-template #blankNodeModel let-blankNode=\"blankNode\" let-methodId=\"methodId\" let-subValue=\"subValue\" let-logs=\"logs\">\n <span\n [class.trigger-popover]=\"hasLogDetails(blankNode, methodId, subValue)\"\n [ngbPopover]=\"logDetails\" [autoClose]=\"'outside'\"\n triggers=\"manual\" #p=\"ngbPopover\" placement=\"left\" container=\"body\"\n (click)=\"hasLogDetails(blankNode, methodId, subValue) ? togglePopover(p, { logs }) : null\"\n >\n <span class=\"is-capitalized\">{{methodName(blankNode, methodId, subValue)}}</span>\n <span class=\"pl-1\" *ngIf=\"hasLog(logs) && logs?.methodTier\">[{{logs.methodTier}}]</span>\n <span class=\"pl-1 has-text-{{logColor[logStatus(blankNode, methodId, subValue)]}}\">\n <fa-icon [icon]=\"logIcon[logStatus(blankNode, methodId, subValue)]\"></fa-icon>\n </span>\n </span>\n</ng-template>\n\n<ng-template #noValue>-</ng-template>\n\n<ng-template #notRecalculated>not recalculated</ng-template>\n\n<ng-template #logDetails let-logs=\"logs\">\n <ng-container *ngIf=\"logs.requirements\">\n <p class=\"is-requirement\" *ngFor=\"let key of requirementKeys(logs.requirements)\">\n {{key}}: {{logs.requirements[key]}}\n </p>\n </ng-container>\n <ng-container *ngIf=\"logs.logs\">\n <p class=\"is-log\" *ngFor=\"let key of logs.logs | keys\">\n {{key.key}}: {{key.value}}\n </p>\n </ng-container>\n <ng-container *ngIf=\"logs.missingLookups?.length\">\n <p class=\"mt-2\">Missing lookups:</p>\n\n <div class=\"table-container data-table-container\">\n <table class=\"table is-fullwidth mb-0\">\n <thead class=\"has-background-black\">\n <tr>\n <th>\n <span class=\"has-text-white\">Filename</span>\n </th>\n <th>\n <span class=\"has-text-white\">Column Title</span>\n </th>\n <th>\n <span class=\"has-text-white\">Row (term.id)</span>\n </th>\n </tr>\n </thead>\n <tbody class=\"has-background-black has-text-white\">\n <tr *ngFor=\"let data of logs.missingLookups\">\n <td>{{data.filename}}</td>\n <td>{{data.column}}</td>\n <td>{{data.termId}}</td>\n </tr>\n </tbody>\n </table>\n </div>\n </ng-container>\n</ng-template>\n", styles: [":host{display:block}::ng-deep tr.has-sub-rows td{border-bottom-style:dotted}::ng-deep td he-node-link{width:190px}::ng-deep td .open-node+he-node-link{width:170px}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: DataTableComponent, selector: "he-data-table", inputs: ["minHeight", "maxHeight", "nbRows", "small", "height", "width"] }, { type: NodeLinkComponent, selector: "he-node-link", inputs: ["node", "showExternalLink"] }, { type: BlankNodeValueDeltaComponent, selector: "he-blank-node-value-delta", inputs: ["value", "originalValue", "displayType"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$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]" }, { type: i11__namespace.NgbTypeahead, selector: "input[ngbTypeahead]", inputs: ["autocomplete", "placement", "container", "editable", "focusFirst", "showHint", "inputFormatter", "ngbTypeahead", "resultFormatter", "resultTemplate"], outputs: ["selectItem"], exportAs: ["ngbTypeahead"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i1__namespace$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i11__namespace.NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disablePopover", "popoverClass", "openDelay", "closeDelay", "ngbPopover", "popoverTitle"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }], pipes: { "times": TimesPipe, "default": DefaultPipe, "precision": PrecisionPipe, "keyToLabel": KeyToLabelPipe, "keys": KeysPipe, "pluralize": PluralizePipe, "isArray": IsArrayPipe } });
5872
5873
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeLogsModelsComponent, decorators: [{
5873
5874
  type: i0.Component,
5874
5875
  args: [{
@@ -6475,7 +6476,7 @@
6475
6476
  logs = _a.sent();
6476
6477
  this.logs = parseLogs(this.cycle, logs);
6477
6478
  return [4 /*yield*/, this.searchService.search({
6478
- fields: ['@type', '@id', 'name'],
6479
+ fields: ['@type', '@id', 'name', 'units'],
6479
6480
  limit: 1000,
6480
6481
  query: {
6481
6482
  bool: {
@@ -6603,10 +6604,13 @@
6603
6604
  function CyclesPracticesTimelineComponent(el) {
6604
6605
  this.el = el;
6605
6606
  this.now = new Date();
6607
+ this.TermTermType = schema.TermTermType;
6606
6608
  }
6607
6609
  Object.defineProperty(CyclesPracticesTimelineComponent.prototype, "practices", {
6608
6610
  get: function () {
6609
- return (this.cycle.practices || []).map(function (p) {
6611
+ var _this = this;
6612
+ var practices = (this.cycle.practices || []).filter(function (p) { var _a, _b; return !((_a = _this.filterTermTypes) === null || _a === void 0 ? void 0 : _a.length) || _this.filterTermTypes.includes((_b = p.term) === null || _b === void 0 ? void 0 : _b.termType); });
6613
+ return practices.map(function (p) {
6610
6614
  var _a;
6611
6615
  return !p.startDate && ((_a = p.dates) === null || _a === void 0 ? void 0 : _a.length) ? Object.assign(Object.assign({}, p), { startDate: p.dates[0] }) : p;
6612
6616
  });
@@ -6614,8 +6618,8 @@
6614
6618
  enumerable: false,
6615
6619
  configurable: true
6616
6620
  });
6617
- CyclesPracticesTimelineComponent.prototype.trackByPractice = function (_index, _b) {
6618
- var term = _b.term;
6621
+ CyclesPracticesTimelineComponent.prototype.trackByPractice = function (_index, _c) {
6622
+ var term = _c.term;
6619
6623
  return term['@id'];
6620
6624
  };
6621
6625
  Object.defineProperty(CyclesPracticesTimelineComponent.prototype, "lineWidth", {
@@ -6628,7 +6632,7 @@
6628
6632
  return CyclesPracticesTimelineComponent;
6629
6633
  }());
6630
6634
  CyclesPracticesTimelineComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CyclesPracticesTimelineComponent, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
6631
- CyclesPracticesTimelineComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CyclesPracticesTimelineComponent, selector: "he-cycles-practices-timeline", inputs: { cycle: "cycle" }, ngImport: i0__namespace, template: "<ul class=\"content pl-4 ml-4 pb-4\">\n <li class=\"is-relative m-0\"\n *ngFor=\"let practice of practices | sortBy:['startDate','endDate']:['asc','asc']; trackBy: trackByPractice\"\n >\n <div class=\"is-relative\"\n [style.width]=\"lineWidth + 'px'\"\n >\n <span *ngIf=\"practice.startDate; else noDate\">{{practice.startDate | date:'YYYY-MM-dd'}}</span>\n <span class=\"px-1\"\n [class.is-invisible]=\"!practice.startDate || !practice.endDate\"\n >-</span>\n <span\n [class.is-invisible]=\"!practice.endDate\"\n >{{(practice.endDate || now) | date:'YYYY-MM-dd'}}</span>\n <span class=\"pl-4\">{{practice.term.name}}</span>\n <he-blank-node-state class=\"ml-1\"\n [node]=\"practice\"\n key=\"value\"\n ></he-blank-node-state>\n </div>\n </li>\n</ul>\n\n<ng-template #noDate>\n <span>No date</span>\n</ng-template>\n", styles: ["ul{max-height:400px;overflow-y:auto}ul li{width:4px;padding-top:20px;background:#485fc7}ul li:after{content:\"\";position:absolute;left:50%;bottom:2px;transform:translate(-50%);width:20px;height:20px;border-radius:50%;background:inherit}ul li>div{width:600px;margin-left:24px}ul li>div>span{display:inline-block}ul li>div>span:nth-child(1),ul li>div>span:nth-child(3){width:94px}\n"], components: [{ type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }], directives: [{ type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "sortBy": SortByPipe, "date": i2__namespace.DatePipe } });
6635
+ CyclesPracticesTimelineComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CyclesPracticesTimelineComponent, selector: "he-cycles-practices-timeline", inputs: { filterTermTypes: "filterTermTypes", cycle: "cycle" }, ngImport: i0__namespace, template: "<ul class=\"content pl-4 ml-4 pb-4\">\n <li class=\"is-relative m-0\"\n *ngFor=\"let practice of practices | sortBy:['startDate','endDate']:['asc','asc']; trackBy: trackByPractice\"\n >\n <div class=\"is-relative\"\n [style.width]=\"lineWidth + 'px'\"\n >\n <span *ngIf=\"practice.startDate\">{{practice.startDate | date:'YYYY-MM-dd'}}</span>\n <span *ngIf=\"!practice.startDate\">\n <ng-container *ngIf=\"practice.term?.termType === TermTermType.operation\">No date</ng-container>\n </span>\n <span class=\"px-1\"\n [class.is-invisible]=\"!practice.startDate || !practice.endDate\"\n >-</span>\n <span\n [class.is-invisible]=\"!practice.endDate\"\n >{{(practice.endDate || now) | date:'YYYY-MM-dd'}}</span>\n <span class=\"pl-4\">{{practice.term.name}}</span>\n <he-blank-node-state class=\"ml-1\"\n [node]=\"practice\"\n key=\"value\"\n ></he-blank-node-state>\n </div>\n </li>\n</ul>\n", styles: ["ul{max-height:400px;overflow-y:auto}ul li{width:4px;padding-top:20px;background:#485fc7}ul li:after{content:\"\";position:absolute;left:50%;bottom:2px;transform:translate(-50%);width:20px;height:20px;border-radius:50%;background:inherit}ul li>div{width:600px;margin-left:24px}ul li>div>span{display:inline-block}ul li>div>span:nth-child(1),ul li>div>span:nth-child(3){width:94px}\n"], components: [{ type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }], directives: [{ type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "sortBy": SortByPipe, "date": i2__namespace.DatePipe } });
6632
6636
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CyclesPracticesTimelineComponent, decorators: [{
6633
6637
  type: i0.Component,
6634
6638
  args: [{
@@ -6636,7 +6640,9 @@
6636
6640
  templateUrl: './cycles-practices-timeline.component.html',
6637
6641
  styleUrls: ['./cycles-practices-timeline.component.scss']
6638
6642
  }]
6639
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { cycle: [{
6643
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { filterTermTypes: [{
6644
+ type: i0.Input
6645
+ }], cycle: [{
6640
6646
  type: i0.Input
6641
6647
  }] } });
6642
6648
 
@@ -6699,6 +6705,7 @@
6699
6705
  View["timeline"] = "timeline";
6700
6706
  View["logs"] = "logs";
6701
6707
  })(View$2 || (View$2 = {}));
6708
+ var timelineTermType = [schema.TermTermType.operation];
6702
6709
  var CyclesPracticesComponent = /** @class */ (function () {
6703
6710
  function CyclesPracticesComponent() {
6704
6711
  this.originalValues = [];
@@ -6707,6 +6714,7 @@
6707
6714
  this.baseUrl = baseUrl();
6708
6715
  this.propertyValue = term.propertyValue;
6709
6716
  this.defaultLabel = defaultLabel;
6717
+ this.timelineTermType = timelineTermType;
6710
6718
  this.showDownload = false;
6711
6719
  this.View = View$2;
6712
6720
  this.selectedView = View$2.table;
@@ -6740,10 +6748,17 @@
6740
6748
  CyclesPracticesComponent.prototype.isSelected = function (cycle) {
6741
6749
  return this.selected.length === 0 || this.selected.includes(cycle['@id']);
6742
6750
  };
6751
+ Object.defineProperty(CyclesPracticesComponent.prototype, "showTimeline", {
6752
+ get: function () {
6753
+ return (this.cycles[0].practices || []).some(function (p) { var _a; return timelineTermType.includes((_a = p.term) === null || _a === void 0 ? void 0 : _a.termType); });
6754
+ },
6755
+ enumerable: false,
6756
+ configurable: true
6757
+ });
6743
6758
  return CyclesPracticesComponent;
6744
6759
  }());
6745
6760
  CyclesPracticesComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CyclesPracticesComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
6746
- CyclesPracticesComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CyclesPracticesComponent, selector: "he-cycles-practices", inputs: { originalValues: "originalValues", cycles: "cycles", selected: "selected", dataState: "dataState" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"columns is-variable is-align-items-center is-2 m-0\">\n <div class=\"column is-hidden-mobile\"></div>\n <ng-container *ngIf=\"selectedView === View.table && practices.length\">\n <div class=\"column is-narrow\">\n <button class=\"button is-dark is-outlined is-small\" (click)=\"showDownload = true\">\n <fa-icon icon=\"download\"></fa-icon>\n <span class=\"pl-2\">Download (CSV)</span>\n </button>\n </div>\n <div class=\"column is-narrow col-sep\"></div>\n </ng-container>\n <div class=\"column is-narrow\" *ngIf=\"cycles.length === 1\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.table\" (click)=\"selectedView = View.table\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"list\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Table view</span>\n </button>\n </div>\n <div class=\"control\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.timeline\" (click)=\"selectedView = View.timeline\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"list-alt\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Timeline view</span>\n </button>\n </div>\n <div class=\"control\" *ngIf=\"!isOriginal\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.logs\" (click)=\"selectedView = View.logs\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"calculator\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Recalculations logs</span>\n </button>\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"px-3 pb-3\" [class.is-hidden]=\"selectedView !== View.table\">\n <ng-container *ngIf=\"practices.length; else emptyTable\">\n <he-data-table class=\"mb-1 is-small\" [small]=\"true\" [nbRows]=\"cycles.length\" maxHeight=\"320\">\n <table class=\"table is-narrow is-striped\">\n <thead>\n <tr>\n <th class=\"width-auto\"></th>\n <th class=\"has-border-right\"></th>\n <th *ngFor=\"let practice of practices\"\n [attr.title]=\"practice.value.term.name\"\n >\n <he-node-link [node]=\"practice.value.term\">\n <span>{{practice.value.term.name | ellipsis:30}}</span>\n </he-node-link>\n </th>\n </tr>\n <tr>\n <th class=\"width-auto\"></th>\n <th class=\"has-border-right\">\n <a [href]=\"baseUrl + '/schema/Cycle#functionalUnit'\" target=\"_blank\">Functional unit</a>\n </th>\n <th *ngFor=\"let practice of practices\"\n [attr.title]=\"practice.value.term.units\"\n >{{practice.value.term.units}}</th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let cycle of cycles; trackBy: trackById; let i = index\">\n <tr *ngIf=\"isSelected(cycle)\">\n <td class=\"width-auto\" [attr.title]=\"defaultLabel(cycle)\">\n <he-node-link [node]=\"cycle.term || cycle\">\n <span class=\"is-nowrap has-text-ellipsis\">{{i + 1}}. {{defaultLabel(cycle)}}</span>\n </he-node-link>\n </td>\n <td class=\"has-border-right\">\n <he-cycles-functional-unit-measure [cycle]=\"cycles[0]\"></he-cycles-functional-unit-measure>\n </td>\n <td class=\"is-nowrap\" *ngFor=\"let practice of practices\">\n <span *ngIf=\"practice.value.values[cycle['@id']]; else emptyValue\"\n class=\"trigger-popover\"\n [ngbPopover]=\"details\" [autoClose]=\"'outside'\"\n triggers=\"manual\" #p=\"ngbPopover\" placement=\"left\" container=\"body\"\n (click)=\"togglePopover(p, { data: practice.value.values[cycle['@id']], cycle: cycle, key: 'practices' })\"\n >\n <span pointer>{{propertyValue(practice.value.values[cycle['@id']].value, practice.value.term['@id']) | precision:3 | default:'-'}}</span>\n <he-blank-node-state class=\"ml-1\"\n [node]=\"practice.value.values[cycle['@id']].node\"\n key=\"value\"\n ></he-blank-node-state>\n </span>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </he-data-table>\n\n <he-blank-node-state-notice [dataState]=\"dataState\" [showDeleted]=\"true\"></he-blank-node-state-notice>\n </ng-container>\n</div>\n\n<div class=\"px-3 pb-3\" *ngIf=\"selectedView === View.timeline\">\n <he-cycles-practices-timeline\n [cycle]=\"cycles[0]\"\n ></he-cycles-practices-timeline>\n\n <he-blank-node-state-notice [dataState]=\"dataState\" [showDeleted]=\"true\"></he-blank-node-state-notice>\n</div>\n\n<he-cycles-practices-logs *ngIf=\"selectedView === View.logs && !isOriginal\"\n [cycle]=\"cycles[0]\"\n [originalValues]=\"originalValues[0]?.practices\"\n [recalculatedValues]=\"cycles[0]?.practices\"\n></he-cycles-practices-logs>\n\n<he-node-csv-export-confirm *ngIf=\"showDownload\"\n [nodes]=\"cycles\" filename=\"cycle-practices.csv\" [isUpload]=\"false\"\n [headerKeys]=\"['cycle.id', 'cycle.@id', 'cycle.practices.']\"\n (closed)=\"showDownload = false\"\n></he-node-csv-export-confirm>\n\n<ng-template #emptyTable>\n <div class=\"has-text-centered\">\n <span>No data</span>\n </div>\n</ng-template>\n\n<ng-template #emptyValue>\n <span>-</span>\n</ng-template>\n\n<ng-template #details let-node=\"cycle\" let-data=\"data\" let-key=\"key\">\n <p><b>{{defaultLabel(node)}}</b></p>\n <he-node-value-details\n [data]=\"data\" [nodeType]=\"node['@type']\" [dataKey]=\"key\"\n ></he-node-value-details>\n</ng-template>\n", styles: ["fa-icon{display:inline-block;width:10px}he-data-table ::ng-deep .table thead tr th:nth-child(2),he-data-table ::ng-deep .table tbody tr td:nth-child(2){max-width:102px;width:102px}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: DataTableComponent, selector: "he-data-table", inputs: ["minHeight", "maxHeight", "nbRows", "small", "height", "width"] }, { type: NodeLinkComponent, selector: "he-node-link", inputs: ["node", "showExternalLink"] }, { type: CyclesFunctionalUnitMeasureComponent, selector: "he-cycles-functional-unit-measure", inputs: ["cycle"] }, { type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }, { type: BlankNodeStateNoticeComponent, selector: "he-blank-node-state-notice", inputs: ["dataState", "showAggregated", "showDeleted", "showUnchanged"] }, { type: CyclesPracticesTimelineComponent, selector: "he-cycles-practices-timeline", inputs: ["cycle"] }, { type: CyclesPracticesLogsComponent, selector: "he-cycles-practices-logs", inputs: ["cycle", "originalValues", "recalculatedValues"] }, { type: NodeCsvExportConfirmComponent, selector: "he-node-csv-export-confirm", inputs: ["nodes", "filename", "headerKeys", "extension", "isUpload"], outputs: ["closed"] }, { type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: ["data", "nodeType", "dataKey"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11__namespace.NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disablePopover", "popoverClass", "openDelay", "closeDelay", "ngbPopover", "popoverTitle"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }], pipes: { "ellipsis": EllipsisPipe, "default": DefaultPipe, "precision": PrecisionPipe } });
6761
+ CyclesPracticesComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CyclesPracticesComponent, selector: "he-cycles-practices", inputs: { originalValues: "originalValues", cycles: "cycles", selected: "selected", dataState: "dataState" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"columns is-variable is-align-items-center is-2 m-0\">\n <div class=\"column is-hidden-mobile\"></div>\n <ng-container *ngIf=\"selectedView === View.table && practices.length\">\n <div class=\"column is-narrow\">\n <button class=\"button is-dark is-outlined is-small\" (click)=\"showDownload = true\">\n <fa-icon icon=\"download\"></fa-icon>\n <span class=\"pl-2\">Download (CSV)</span>\n </button>\n </div>\n <div class=\"column is-narrow col-sep\"></div>\n </ng-container>\n <div class=\"column is-narrow\" *ngIf=\"cycles.length === 1\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.table\" (click)=\"selectedView = View.table\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"list\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Table view</span>\n </button>\n </div>\n <div class=\"control\" *ngIf=\"showTimeline\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.timeline\" (click)=\"selectedView = View.timeline\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"list-alt\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Operations timeline</span>\n </button>\n </div>\n <div class=\"control\" *ngIf=\"!isOriginal\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.logs\" (click)=\"selectedView = View.logs\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"calculator\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Recalculations logs</span>\n </button>\n </div>\n </div>\n </div>\n</div>\n\n<div class=\"px-3 pb-3\" [class.is-hidden]=\"selectedView !== View.table\">\n <ng-container *ngIf=\"practices.length; else emptyTable\">\n <he-data-table class=\"mb-1 is-small\" [small]=\"true\" [nbRows]=\"cycles.length\" maxHeight=\"320\">\n <table class=\"table is-narrow is-striped\">\n <thead>\n <tr>\n <th class=\"width-auto\"></th>\n <th class=\"has-border-right\"></th>\n <th *ngFor=\"let practice of practices\"\n [attr.title]=\"practice.value.term.name\"\n >\n <he-node-link [node]=\"practice.value.term\">\n <span>{{practice.value.term.name | ellipsis:30}}</span>\n </he-node-link>\n </th>\n </tr>\n <tr>\n <th class=\"width-auto\"></th>\n <th class=\"has-border-right\">\n <a [href]=\"baseUrl + '/schema/Cycle#functionalUnit'\" target=\"_blank\">Functional unit</a>\n </th>\n <th *ngFor=\"let practice of practices\"\n [attr.title]=\"practice.value.term.units\"\n >{{practice.value.term.units}}</th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let cycle of cycles; trackBy: trackById; let i = index\">\n <tr *ngIf=\"isSelected(cycle)\">\n <td class=\"width-auto\" [attr.title]=\"defaultLabel(cycle)\">\n <he-node-link [node]=\"cycle.term || cycle\">\n <span class=\"is-nowrap has-text-ellipsis\">{{i + 1}}. {{defaultLabel(cycle)}}</span>\n </he-node-link>\n </td>\n <td class=\"has-border-right\">\n <he-cycles-functional-unit-measure [cycle]=\"cycles[0]\"></he-cycles-functional-unit-measure>\n </td>\n <td class=\"is-nowrap\" *ngFor=\"let practice of practices\">\n <span *ngIf=\"practice.value.values[cycle['@id']]; else emptyValue\"\n class=\"trigger-popover\"\n [ngbPopover]=\"details\" [autoClose]=\"'outside'\"\n triggers=\"manual\" #p=\"ngbPopover\" placement=\"left\" container=\"body\"\n (click)=\"togglePopover(p, { data: practice.value.values[cycle['@id']], cycle: cycle, key: 'practices' })\"\n >\n <span pointer>{{propertyValue(practice.value.values[cycle['@id']].value, practice.value.term['@id']) | precision:3 | default:'-'}}</span>\n <he-blank-node-state class=\"ml-1\"\n [node]=\"practice.value.values[cycle['@id']].node\"\n key=\"value\"\n ></he-blank-node-state>\n </span>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </he-data-table>\n\n <he-blank-node-state-notice [dataState]=\"dataState\" [showDeleted]=\"true\"></he-blank-node-state-notice>\n </ng-container>\n</div>\n\n<div class=\"px-3 pb-3\" *ngIf=\"selectedView === View.timeline\">\n <he-cycles-practices-timeline\n [cycle]=\"cycles[0]\" [filterTermTypes]=\"timelineTermType\"\n ></he-cycles-practices-timeline>\n\n <he-blank-node-state-notice [dataState]=\"dataState\" [showDeleted]=\"true\"></he-blank-node-state-notice>\n</div>\n\n<he-cycles-practices-logs *ngIf=\"selectedView === View.logs && !isOriginal\"\n [cycle]=\"cycles[0]\"\n [originalValues]=\"originalValues[0]?.practices\"\n [recalculatedValues]=\"cycles[0]?.practices\"\n></he-cycles-practices-logs>\n\n<he-node-csv-export-confirm *ngIf=\"showDownload\"\n [nodes]=\"cycles\" filename=\"cycle-practices.csv\" [isUpload]=\"false\"\n [headerKeys]=\"['cycle.id', 'cycle.@id', 'cycle.practices.']\"\n (closed)=\"showDownload = false\"\n></he-node-csv-export-confirm>\n\n<ng-template #emptyTable>\n <div class=\"has-text-centered\">\n <span>No data</span>\n </div>\n</ng-template>\n\n<ng-template #emptyValue>\n <span>-</span>\n</ng-template>\n\n<ng-template #details let-node=\"cycle\" let-data=\"data\" let-key=\"key\">\n <p><b>{{defaultLabel(node)}}</b></p>\n <he-node-value-details\n [data]=\"data\" [nodeType]=\"node['@type']\" [dataKey]=\"key\"\n ></he-node-value-details>\n</ng-template>\n", styles: ["fa-icon{display:inline-block;width:10px}he-data-table ::ng-deep .table thead tr th:nth-child(2),he-data-table ::ng-deep .table tbody tr td:nth-child(2){max-width:102px;width:102px}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: DataTableComponent, selector: "he-data-table", inputs: ["minHeight", "maxHeight", "nbRows", "small", "height", "width"] }, { type: NodeLinkComponent, selector: "he-node-link", inputs: ["node", "showExternalLink"] }, { type: CyclesFunctionalUnitMeasureComponent, selector: "he-cycles-functional-unit-measure", inputs: ["cycle"] }, { type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }, { type: BlankNodeStateNoticeComponent, selector: "he-blank-node-state-notice", inputs: ["dataState", "showAggregated", "showDeleted", "showUnchanged"] }, { type: CyclesPracticesTimelineComponent, selector: "he-cycles-practices-timeline", inputs: ["filterTermTypes", "cycle"] }, { type: CyclesPracticesLogsComponent, selector: "he-cycles-practices-logs", inputs: ["cycle", "originalValues", "recalculatedValues"] }, { type: NodeCsvExportConfirmComponent, selector: "he-node-csv-export-confirm", inputs: ["nodes", "filename", "headerKeys", "extension", "isUpload"], outputs: ["closed"] }, { type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: ["data", "nodeType", "dataKey"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i11__namespace.NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disablePopover", "popoverClass", "openDelay", "closeDelay", "ngbPopover", "popoverTitle"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }], pipes: { "ellipsis": EllipsisPipe, "default": DefaultPipe, "precision": PrecisionPipe } });
6747
6762
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CyclesPracticesComponent, decorators: [{
6748
6763
  type: i0.Component,
6749
6764
  args: [{
@@ -8053,7 +8068,7 @@
8053
8068
  }
8054
8069
  SitesMapsComponent.prototype.ngOnInit = function () {
8055
8070
  var _this = this;
8056
- waitFor('google', function () {
8071
+ waitFor('google.maps', function () {
8057
8072
  _this.googleLoaded = true;
8058
8073
  setTimeout(function () { return !_this.loaded && _this.map && _this.loadData(); });
8059
8074
  });
@@ -8118,17 +8133,19 @@
8118
8133
  });
8119
8134
  };
8120
8135
  SitesMapsComponent.prototype.centerMarker = function (marker) {
8136
+ var _this = this;
8121
8137
  var center = marker.getPosition();
8122
8138
  this.center = center ? { lat: center.lat(), lng: center.lng() } : defaultCenter;
8139
+ setTimeout(function () {
8140
+ _this.map.googleMap.setCenter(_this.center);
8141
+ });
8123
8142
  };
8124
8143
  SitesMapsComponent.prototype.centerPolygons = function (polygons) {
8125
8144
  try {
8126
- return polygons.length ? this.map.googleMap.fitBounds(polygonBounds(polygons)) : null;
8145
+ return (polygons === null || polygons === void 0 ? void 0 : polygons.length) ? this.map.googleMap.fitBounds(polygonBounds(polygons)) : null;
8127
8146
  }
8128
8147
  catch (err) {
8129
- if (polygons.length) {
8130
- this.map.googleMap.fitBounds(polygonBounds(polygons[0]));
8131
- }
8148
+ return (polygons === null || polygons === void 0 ? void 0 : polygons.length) ? this.map.googleMap.fitBounds(polygonBounds(polygons[0])) : null;
8132
8149
  }
8133
8150
  };
8134
8151
  SitesMapsComponent.prototype.addSiteMarkers = function (sites) {
@@ -8295,7 +8312,7 @@
8295
8312
  case 1:
8296
8313
  _a.logs = _b.sent();
8297
8314
  return [4 /*yield*/, this.searchService.search({
8298
- fields: ['@type', '@id', 'name'],
8315
+ fields: ['@type', '@id', 'name', 'units'],
8299
8316
  limit: 1000,
8300
8317
  query: {
8301
8318
  bool: {
@@ -9027,8 +9044,9 @@
9027
9044
  }] });
9028
9045
 
9029
9046
  var parseLog = function (data) { return ({
9030
- indicator: data['key/term'] || data.term || data.indicator,
9031
- emission: data.node,
9047
+ modelId: data.model,
9048
+ impactTermId: data['key/term'] || data.term || data.indicator,
9049
+ emissionsResourceUseTermId: data.node,
9032
9050
  coefficient: +data.coefficient,
9033
9051
  value: +data.value * +data.coefficient
9034
9052
  }); };
@@ -9036,23 +9054,31 @@
9036
9054
  schema.TermTermType.emission,
9037
9055
  schema.TermTermType.characterisedIndicator
9038
9056
  ];
9039
- var toCsv = function (logs) { return __spreadArray([
9057
+ var toCsv = function (logs, impact) { return __spreadArray([
9040
9058
  [
9041
- 'Model',
9042
9059
  'Impact',
9060
+ 'Impact Unit',
9061
+ 'Method',
9062
+ 'Emission',
9043
9063
  'Value',
9044
9064
  'Inputs',
9045
- 'Inputs value'
9065
+ 'Inputs value',
9066
+ 'Functional Unit'
9046
9067
  ].join(',')
9047
9068
  ], __read(logs
9048
- .sort(function (a, b) { return a.indicator.localeCompare(b.indicator); })
9069
+ .sort(function (a, b) { return a.impactTermId.localeCompare(b.impactTermId); })
9049
9070
  .flatMap(function (_d) {
9050
- var indicator = _d.indicator, emission = _d.emission, value = _d.value, inputs = _d.inputs;
9071
+ var impactTermId = _d.impactTermId, impactTermUnits = _d.impactTermUnits, modelId = _d.modelId, emissionsResourceUseTermId = _d.emissionsResourceUseTermId, value = _d.value, inputs = _d.inputs;
9051
9072
  return __spreadArray([
9052
- [indicator, emission, value, '', '']
9053
- ], __read((inputs.map(function (v) { return [indicator, emission, '', v.name, v.value]; }))));
9073
+ [impactTermId, impactTermUnits, modelId, emissionsResourceUseTermId, value, '', '']
9074
+ ], __read((inputs.map(function (v) { return [impactTermId, impactTermUnits, modelId, emissionsResourceUseTermId, '', v.name, v.value]; }))));
9054
9075
  })
9055
- .map(function (v) { return v.join(','); }))).join('\n'); };
9076
+ .map(function (v) {
9077
+ var _a;
9078
+ return __spreadArray(__spreadArray([], __read(v)), [
9079
+ (_a = impact.product) === null || _a === void 0 ? void 0 : _a.units
9080
+ ]).join(',');
9081
+ }))).join('\n'); };
9056
9082
  var ImpactAssessmentsIndicatorBreakdownChartComponent = /** @class */ (function () {
9057
9083
  function ImpactAssessmentsIndicatorBreakdownChartComponent(ngZone, domSanitizer, searchService, nodeService) {
9058
9084
  this.ngZone = ngZone;
@@ -9068,7 +9094,7 @@
9068
9094
  }
9069
9095
  ImpactAssessmentsIndicatorBreakdownChartComponent.prototype.ngOnInit = function () {
9070
9096
  return __awaiter(this, void 0, void 0, function () {
9071
- var _d, emissions;
9097
+ var _d, results;
9072
9098
  var _this = this;
9073
9099
  return __generator(this, function (_e) {
9074
9100
  switch (_e.label) {
@@ -9084,18 +9110,24 @@
9084
9110
  }), operators.map(function (_d) {
9085
9111
  var data = _d.data;
9086
9112
  return parseMessage(data.message);
9087
- }), operators.filter(function (message) { return 'node' in message; }), operators.map(parseLog), operators.filter(function (log) { return !!log.indicator && !!log.emission && !isNaN(log.value) && log.value > 0; }), operators.groupBy(function (log) { return [log.indicator, log.emission].join('/'); }), operators.mergeMap(function (group) { return group.pipe(operators.toArray()); }), operators.map(function (values) {
9113
+ }), operators.filter(function (message) { return 'node' in message; }), operators.map(parseLog), operators.filter(function (log) { return !!log.impactTermId && !!log.emissionsResourceUseTermId && !isNaN(log.value) && log.value > 0; }), operators.groupBy(function (log) { return [log.impactTermId, log.emissionsResourceUseTermId].join('/'); }), operators.mergeMap(function (group) { return group.pipe(operators.toArray()); }), operators.map(function (values) {
9114
+ var _a, _b;
9088
9115
  var log = values[0];
9089
9116
  var total = values.reduce(function (prev, curr) { return prev + curr.value; }, 0);
9090
- var inputs = (_this.impactAssessment.emissionsResourceUse || [])
9091
- .filter(function (v) { var _a; return v.term['@id'] === log.emission && ((_a = v.inputs) === null || _a === void 0 ? void 0 : _a.length); })
9117
+ var emissions = (_this.impactAssessment.emissionsResourceUse || [])
9118
+ .filter(function (v) { return v.term['@id'] === log.emissionsResourceUseTermId; });
9119
+ var inputs = emissions
9120
+ .filter(function (v) { var _a; return (_a = v.inputs) === null || _a === void 0 ? void 0 : _a.length; })
9092
9121
  .map(function (v) { return ({ name: v.inputs.map(function (i) { return i['@id']; }).join(';'), value: v.value * log.coefficient }); });
9093
9122
  var inputsValue = inputs.reduce(function (prev, curr) { return prev + curr.value; }, 0);
9094
- return Object.assign(Object.assign({}, log), { value: total, inputs: inputs, inputsValue: inputsValue });
9095
- }), operators.toArray()).toPromise()];
9123
+ var impacts = (_this.impactAssessment.impacts || [])
9124
+ .filter(function (v) { return v.term['@id'] === log.impactTermId; });
9125
+ // logs might exist but impact was not added => skip logs
9126
+ return impacts.length ? Object.assign(Object.assign({}, log), { impactTermUnits: (_b = (_a = impacts === null || impacts === void 0 ? void 0 : impacts[0]) === null || _a === void 0 ? void 0 : _a.term) === null || _b === void 0 ? void 0 : _b.units, value: total, inputs: inputs, inputsValue: inputsValue }) : null;
9127
+ }), operators.filter(function (log) { return !!log; }), operators.toArray()).toPromise()];
9096
9128
  case 1:
9097
9129
  _d.logs = (_e.sent());
9098
- this.csvContent = this.domSanitizer.bypassSecurityTrustResourceUrl("data:text/html;charset=utf-8," + encodeURIComponent(toCsv(this.logs)));
9130
+ this.csvContent = this.domSanitizer.bypassSecurityTrustResourceUrl("data:text/html;charset=utf-8," + encodeURIComponent(toCsv(this.logs, this.impactAssessment)));
9099
9131
  return [4 /*yield*/, this.searchService.search({
9100
9132
  fields: ['@type', '@id', 'name'],
9101
9133
  limit: 1000,
@@ -9110,8 +9142,8 @@
9110
9142
  }
9111
9143
  })];
9112
9144
  case 2:
9113
- emissions = (_e.sent()).results;
9114
- this.emissions = emissions;
9145
+ results = (_e.sent()).results;
9146
+ this.emissions = results;
9115
9147
  this.loading = false;
9116
9148
  this.selectedTerm = this.terms[0];
9117
9149
  this.updateChart();
@@ -9132,16 +9164,16 @@
9132
9164
  var _a, _b, _c;
9133
9165
  var logs = this.logs
9134
9166
  .filter(function (_d) {
9135
- var indicator = _d.indicator;
9136
- return indicator === _this.selectedTerm['@id'];
9167
+ var impactTermId = _d.impactTermId;
9168
+ return impactTermId === _this.selectedTerm['@id'];
9137
9169
  })
9138
9170
  .sort(function (a, b) { return b.value - a.value; });
9139
9171
  this.noData = logs.length === 0;
9140
9172
  var total = logs.reduce(function (prev, curr) { return prev + curr.value; }, 0);
9141
9173
  var labels = logs.map(function (_d) {
9142
- var emission = _d.emission;
9174
+ var emissionsResourceUseTermId = _d.emissionsResourceUseTermId;
9143
9175
  var _a;
9144
- return ((_a = _this.emissions.find(function (v) { return v['@id'] === emission; })) === null || _a === void 0 ? void 0 : _a.name) || emission;
9176
+ return ((_a = _this.emissions.find(function (v) { return v['@id'] === emissionsResourceUseTermId; })) === null || _a === void 0 ? void 0 : _a.name) || emissionsResourceUseTermId;
9145
9177
  });
9146
9178
  // display the breakdown by input
9147
9179
  // const inputs = logs.flatMap(v => v.inputs.map(i => i.name));
@@ -9377,18 +9409,17 @@
9377
9409
  }
9378
9410
  ImpactAssessmentsProductsLogsComponent.prototype.ngOnInit = function () {
9379
9411
  return __awaiter(this, void 0, void 0, function () {
9380
- var _a, emissions, _b;
9381
- return __generator(this, function (_c) {
9382
- switch (_c.label) {
9412
+ var _a, emissions;
9413
+ return __generator(this, function (_b) {
9414
+ switch (_b.label) {
9383
9415
  case 0:
9384
9416
  this.logsUrl = this.nodeService.nodeLogsUrl(this.node);
9385
9417
  _a = this;
9386
9418
  return [4 /*yield*/, this.nodeService.getModelsLog(this.node)];
9387
9419
  case 1:
9388
- _a.logs = _c.sent();
9389
- if (!this.includeAllModels) return [3 /*break*/, 3];
9420
+ _a.logs = _b.sent();
9390
9421
  return [4 /*yield*/, this.searchService.search({
9391
- fields: ['@type', '@id', 'name'],
9422
+ fields: ['@type', '@id', 'name', 'units'],
9392
9423
  limit: 1000,
9393
9424
  query: {
9394
9425
  bool: {
@@ -9401,14 +9432,7 @@
9401
9432
  }
9402
9433
  })];
9403
9434
  case 2:
9404
- _b = _c.sent();
9405
- return [3 /*break*/, 4];
9406
- case 3:
9407
- // Emissions are added from Cycle not from models, only show the ones included
9408
- _b = { results: [] };
9409
- _c.label = 4;
9410
- case 4:
9411
- emissions = (_b).results;
9435
+ emissions = (_b.sent()).results;
9412
9436
  this.emissions = emissions;
9413
9437
  this.loading = false;
9414
9438
  return [2 /*return*/];