@hestia-earth/ui-components 0.3.2 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/hestia-earth-ui-components.umd.js +140 -80
- package/bundles/hestia-earth-ui-components.umd.js.map +1 -1
- package/common/link-key-value/link-key-value.component.d.ts +1 -0
- package/esm2015/common/link-key-value/link-key-value.component.js +9 -3
- package/esm2015/common/node-utils.js +3 -3
- package/esm2015/cycles/cycles-practices/cycles-practices.component.js +3 -2
- package/esm2015/files/files-error.model.js +5 -3
- package/esm2015/impact-assessments/impact-assessments-indicator-breakdown-chart/impact-assessments-indicator-breakdown-chart.component.js +3 -3
- package/esm2015/node/node-link/node-link.component.js +6 -2
- package/esm2015/node/node-logs-models/node-logs-models.component.js +7 -3
- package/esm2015/node/node-logs-models/node-logs-models.model.js +41 -15
- package/esm2015/node/node-value-details/node-value-details.component.js +8 -4
- package/esm2015/node/node.service.js +3 -3
- package/fesm2015/hestia-earth-ui-components.js +76 -30
- package/fesm2015/hestia-earth-ui-components.js.map +1 -1
- package/node/node-logs-models/node-logs-models.component.d.ts +2 -0
- package/node/node-logs-models/node-logs-models.model.d.ts +2 -1
- package/node/node-value-details/node-value-details.component.d.ts +2 -1
- package/node/node.service.d.ts +5 -1
- package/package.json +2 -2
|
@@ -1091,7 +1091,7 @@
|
|
|
1091
1091
|
}] });
|
|
1092
1092
|
|
|
1093
1093
|
var get$5 = require('lodash.get');
|
|
1094
|
-
var isMethodModelAllowed = function (filterMethod) { return function (node) { var _a, _b; return ((_a = node.methodModel) === null || _a === void 0 ? void 0 : _a['@id']) === (filterMethod ? filterMethod['@id'] : glossary.
|
|
1094
|
+
var isMethodModelAllowed = function (filterMethod) { return function (node) { var _a, _b; return ((_a = node.methodModel) === null || _a === void 0 ? void 0 : _a['@id']) === (filterMethod ? filterMethod['@id'] : glossary.getDefaultModelId((_b = node.term) === null || _b === void 0 ? void 0 : _b['@id'])); }; };
|
|
1095
1095
|
var NodeKeyState;
|
|
1096
1096
|
(function (NodeKeyState) {
|
|
1097
1097
|
NodeKeyState["added"] = "added";
|
|
@@ -1252,9 +1252,9 @@
|
|
|
1252
1252
|
params: filterParams({ dataState: dataState })
|
|
1253
1253
|
}).toPromise().catch(handleAPIError);
|
|
1254
1254
|
};
|
|
1255
|
-
HeNodeService.prototype.
|
|
1255
|
+
HeNodeService.prototype.getErrorLog = function (_a) {
|
|
1256
1256
|
var dataState = _a.dataState, node = __rest(_a, ["dataState"]);
|
|
1257
|
-
return this.http.get(this.nodeUrl(node) + "/log/
|
|
1257
|
+
return this.http.get(this.nodeUrl(node) + "/log/error", {
|
|
1258
1258
|
headers: this.authService.headers,
|
|
1259
1259
|
params: filterParams({ dataState: dataState })
|
|
1260
1260
|
}).toPromise().catch(handleAPIError);
|
|
@@ -1939,6 +1939,13 @@
|
|
|
1939
1939
|
this.baseUrl = baseUrl();
|
|
1940
1940
|
this.toString = toString;
|
|
1941
1941
|
}
|
|
1942
|
+
Object.defineProperty(LinkKeyValueComponent.prototype, "isInlineBlock", {
|
|
1943
|
+
get: function () {
|
|
1944
|
+
return this.isArray;
|
|
1945
|
+
},
|
|
1946
|
+
enumerable: false,
|
|
1947
|
+
configurable: true
|
|
1948
|
+
});
|
|
1942
1949
|
Object.defineProperty(LinkKeyValueComponent.prototype, "type", {
|
|
1943
1950
|
get: function () {
|
|
1944
1951
|
return this.node['@type'] || this.node.type;
|
|
@@ -1984,7 +1991,7 @@
|
|
|
1984
1991
|
return LinkKeyValueComponent;
|
|
1985
1992
|
}());
|
|
1986
1993
|
LinkKeyValueComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LinkKeyValueComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1987
|
-
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\n <ng-container *ngIf=\"isArray; else singleValue\">\n <div class=\"array-container pl-2\">\n <p *ngFor=\"let v of value\" [innerHtml]=\"toString(v) | precision:3\"></p>\n </div>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #singleValue>\n <div class=\"is-inline-block pr-1\" [innerHtml]=\"valueString | precision:3\"></div>\n\n <he-blank-node-state\n [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"\n ></he-blank-node-state>\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
|
+
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" }, host: { properties: { "class.is-inline-block": "this.isInlineBlock" } }, 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\n <ng-container *ngIf=\"isArray; else singleValue\">\n <div class=\"array-container pl-2\">\n <p *ngFor=\"let v of value\" [innerHtml]=\"toString(v) | precision:3\"></p>\n </div>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #singleValue>\n <div class=\"is-inline-block pr-1\" [innerHtml]=\"valueString | precision:3\"></div>\n\n <he-blank-node-state\n [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"\n ></he-blank-node-state>\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 });
|
|
1988
1995
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: LinkKeyValueComponent, decorators: [{
|
|
1989
1996
|
type: i0.Component,
|
|
1990
1997
|
args: [{
|
|
@@ -2001,6 +2008,9 @@
|
|
|
2001
2008
|
type: i0.Input
|
|
2002
2009
|
}], key: [{
|
|
2003
2010
|
type: i0.Input
|
|
2011
|
+
}], isInlineBlock: [{
|
|
2012
|
+
type: i0.HostBinding,
|
|
2013
|
+
args: ['class.is-inline-block']
|
|
2004
2014
|
}] } });
|
|
2005
2015
|
|
|
2006
2016
|
var locationQuery = function (bounds, searchField) {
|
|
@@ -5370,6 +5380,9 @@
|
|
|
5370
5380
|
type: i0.Input
|
|
5371
5381
|
}] } });
|
|
5372
5382
|
|
|
5383
|
+
var skipState = [
|
|
5384
|
+
schema.NodeType.Term
|
|
5385
|
+
];
|
|
5373
5386
|
var NodeLinkComponent = /** @class */ (function () {
|
|
5374
5387
|
function NodeLinkComponent() {
|
|
5375
5388
|
this.showExternalLink = false;
|
|
@@ -5388,7 +5401,7 @@
|
|
|
5388
5401
|
this.node['@type'].toLowerCase(),
|
|
5389
5402
|
this.id
|
|
5390
5403
|
].filter(Boolean).join('/');
|
|
5391
|
-
return url + "?dataState=" + api.DataState.recalculated;
|
|
5404
|
+
return "" + url + (skipState.includes(this.node['@type']) ? '' : "?dataState=" + api.DataState.recalculated);
|
|
5392
5405
|
},
|
|
5393
5406
|
enumerable: false,
|
|
5394
5407
|
configurable: true
|
|
@@ -5508,12 +5521,12 @@
|
|
|
5508
5521
|
var blankNodeTypesLowerCase = blankNodeTypes.map(function (v) { return v.toLowerCase(); });
|
|
5509
5522
|
var missingLookupPrefix = 'Missing lookup';
|
|
5510
5523
|
var parseFilename = function (filepath) {
|
|
5511
|
-
var
|
|
5524
|
+
var _b = __read(filepath.split('.'), 1), filename = _b[0];
|
|
5512
5525
|
var ext = termTypes.includes(filename) ? api.SupportedExtensions.xlsx : api.SupportedExtensions.csv;
|
|
5513
5526
|
return api.fileToExt(filename, ext);
|
|
5514
5527
|
};
|
|
5515
|
-
var parseLookup = function (
|
|
5516
|
-
var column =
|
|
5528
|
+
var parseLookup = function (_b) {
|
|
5529
|
+
var column = _b.column, termid = _b.termid, _c = missingLookupPrefix, missingLookup = _b[_c];
|
|
5517
5530
|
return ({
|
|
5518
5531
|
filename: parseFilename(missingLookup), termId: termid,
|
|
5519
5532
|
column: column
|
|
@@ -5524,10 +5537,10 @@
|
|
|
5524
5537
|
try {
|
|
5525
5538
|
var data = JSON.parse(message);
|
|
5526
5539
|
return data.message.split(',').reduce(function (prev, parts) {
|
|
5527
|
-
var
|
|
5528
|
-
var
|
|
5540
|
+
var _b;
|
|
5541
|
+
var _c = __read(parts.split('='), 2), key = _c[0], value = _c[1];
|
|
5529
5542
|
var val = csvValue(value);
|
|
5530
|
-
return Object.assign(Object.assign({}, prev), (key && val ? (
|
|
5543
|
+
return Object.assign(Object.assign({}, prev), (key && val ? (_b = {}, _b[key.trim()] = val, _b) : {}));
|
|
5531
5544
|
}, { logger: data.logger });
|
|
5532
5545
|
}
|
|
5533
5546
|
catch (err) {
|
|
@@ -5535,29 +5548,31 @@
|
|
|
5535
5548
|
return {};
|
|
5536
5549
|
}
|
|
5537
5550
|
};
|
|
5538
|
-
var omitLogKeys = function (log) { return Object.fromEntries(Object.entries(log).filter(function (
|
|
5539
|
-
var
|
|
5551
|
+
var omitLogKeys = function (log) { return Object.fromEntries(Object.entries(log).filter(function (_b) {
|
|
5552
|
+
var _c = __read(_b, 1), key = _c[0];
|
|
5540
5553
|
return !schemaTypesLowerCase.includes(key);
|
|
5541
5554
|
})); };
|
|
5542
5555
|
var includeBlankNodes = function (logs, log) { return Object
|
|
5543
5556
|
.keys(log)
|
|
5544
5557
|
.filter(function (key) { return blankNodeTypesLowerCase.includes(key); })
|
|
5545
5558
|
.reduce(function (prev, key) {
|
|
5546
|
-
var
|
|
5547
|
-
return (Object.assign(Object.assign({}, prev), (
|
|
5559
|
+
var _b;
|
|
5560
|
+
return (Object.assign(Object.assign({}, prev), (_b = {}, _b[key] = utils.unique(__spreadArray(__spreadArray([], __read(((typeof prev[key] === 'string' ? [prev[key]] : prev[key]) || []))), [
|
|
5548
5561
|
log[key]
|
|
5549
|
-
])),
|
|
5562
|
+
])), _b)));
|
|
5550
5563
|
}, logs); };
|
|
5551
5564
|
var groupLog = function (group, _a) {
|
|
5552
5565
|
var logger = _a.logger, term = _a.term, model = _a.model, key = _a.key, should_run = _a.should_run, run_required = _a.run_required, property = _a.property, log = __rest(_a, ["logger", "term", "model", "key", "should_run", "run_required", "property"]);
|
|
5553
5566
|
var isOrchestrator = logger.includes('orchestrator');
|
|
5554
5567
|
var isKey = !isOrchestrator && !!key;
|
|
5568
|
+
var isProperty = !isOrchestrator && !!property;
|
|
5555
5569
|
var parentLogKey = ["[\"" + term + "\"]", !isOrchestrator && key || property].filter(Boolean).join('.');
|
|
5556
5570
|
var logModelKey = [parentLogKey, model].filter(Boolean).join('.');
|
|
5557
5571
|
set$1(group, parentLogKey + ".models", utils.unique(__spreadArray(__spreadArray([], __read(get$3(group, parentLogKey + ".models", []))), [
|
|
5558
5572
|
model
|
|
5559
5573
|
])));
|
|
5560
5574
|
set$1(group, parentLogKey + ".isKey", isKey);
|
|
5575
|
+
set$1(group, parentLogKey + ".isProperty", isProperty);
|
|
5561
5576
|
var data = get$3(group, logModelKey, {});
|
|
5562
5577
|
data = includeBlankNodes(data, log);
|
|
5563
5578
|
if (typeof should_run !== 'undefined') {
|
|
@@ -5591,8 +5606,8 @@
|
|
|
5591
5606
|
group[id] = data;
|
|
5592
5607
|
if (key === 'transformation') {
|
|
5593
5608
|
// add value to the same term/model on parent group
|
|
5594
|
-
Object.entries(group[id]).map(function (
|
|
5595
|
-
var
|
|
5609
|
+
Object.entries(group[id]).map(function (_b) {
|
|
5610
|
+
var _c = __read(_b, 2), term = _c[0], models = _c[1];
|
|
5596
5611
|
return Object.keys(models).map(function (model) {
|
|
5597
5612
|
var _a;
|
|
5598
5613
|
if ((_a = group === null || group === void 0 ? void 0 : group[term]) === null || _a === void 0 ? void 0 : _a[model]) {
|
|
@@ -5608,7 +5623,7 @@
|
|
|
5608
5623
|
var subValueKeys = [
|
|
5609
5624
|
'transformation'
|
|
5610
5625
|
];
|
|
5611
|
-
var groupLogsByModel = function (data) { return data.split('\n')
|
|
5626
|
+
var groupLogsByModel = function (data) { return data.trim().split('\n')
|
|
5612
5627
|
.map(parseMessage)
|
|
5613
5628
|
.filter(function (v) { return !!(v === null || v === void 0 ? void 0 : v.term) && (v === null || v === void 0 ? void 0 : v.term) !== 'None' && !!(v === null || v === void 0 ? void 0 : v.model); })
|
|
5614
5629
|
.reduce(function (group, log) {
|
|
@@ -5619,14 +5634,14 @@
|
|
|
5619
5634
|
groupLogSubValue(group, log, subValue) :
|
|
5620
5635
|
groupLog(groupLogSubValue(group, log, subValue), log)
|
|
5621
5636
|
: groupLog(group, log);
|
|
5622
|
-
}); };
|
|
5637
|
+
}, {}); };
|
|
5623
5638
|
var computeTerms = function (originalValues, recalculatedValues, terms, filterTermTypes) { return rxjs.from((terms === null || terms === void 0 ? void 0 : terms.length) ?
|
|
5624
5639
|
terms :
|
|
5625
|
-
__spreadArray(__spreadArray([], __read((originalValues || []).map(function (
|
|
5626
|
-
var term =
|
|
5640
|
+
__spreadArray(__spreadArray([], __read((originalValues || []).map(function (_b) {
|
|
5641
|
+
var term = _b.term;
|
|
5627
5642
|
return term;
|
|
5628
|
-
}))), __read((recalculatedValues || []).map(function (
|
|
5629
|
-
var term =
|
|
5643
|
+
}))), __read((recalculatedValues || []).map(function (_b) {
|
|
5644
|
+
var term = _b.term;
|
|
5630
5645
|
return term;
|
|
5631
5646
|
}))).filter(function (node) { return !(filterTermTypes === null || filterTermTypes === void 0 ? void 0 : filterTermTypes.length) || filterTermTypes.includes(node.termType); })).pipe(operators.distinct(function (v) { return v['@id']; }), operators.toArray(), operators.map(function (v) { return orderBy$5(v, ['name'], ['asc']); })).toPromise(); };
|
|
5632
5647
|
exports.LogStatus = void 0;
|
|
@@ -5664,10 +5679,20 @@
|
|
|
5664
5679
|
].every(Boolean)
|
|
5665
5680
|
? exports.LogStatus.skipHierarchy
|
|
5666
5681
|
: exports.LogStatus.dataProvided); };
|
|
5682
|
+
var mergeSubValues = function (values) { return Object.values(values.reduce(function (prev, _b) {
|
|
5683
|
+
var id = _b.id, key = _b.key, configModels = _b.configModels;
|
|
5684
|
+
var uniqueKey = [key, id].filter(Boolean).join('.');
|
|
5685
|
+
prev[uniqueKey] = {
|
|
5686
|
+
id: id,
|
|
5687
|
+
key: key,
|
|
5688
|
+
configModels: __spreadArray(__spreadArray([], __read(((prev[uniqueKey] || {}).configModels || []))), __read((configModels || [])))
|
|
5689
|
+
};
|
|
5690
|
+
return prev;
|
|
5691
|
+
}, {})); };
|
|
5667
5692
|
var reduceValues = function (values, termId) {
|
|
5668
5693
|
var propertyValues = values
|
|
5669
|
-
.map(function (
|
|
5670
|
-
var value =
|
|
5694
|
+
.map(function (_b) {
|
|
5695
|
+
var value = _b.value;
|
|
5671
5696
|
return term.propertyValue(value, termId);
|
|
5672
5697
|
})
|
|
5673
5698
|
// propertyValue may return null if the value is null or undefined, therefore remove them from total
|
|
@@ -5696,8 +5721,8 @@
|
|
|
5696
5721
|
input: function (values, _k, id) {
|
|
5697
5722
|
var _a;
|
|
5698
5723
|
return !!id && (values === null || values === void 0 ? void 0 : values.length)
|
|
5699
|
-
? term.propertyValue((_a = values.find(function (
|
|
5700
|
-
var inputs =
|
|
5724
|
+
? term.propertyValue((_a = values.find(function (_b) {
|
|
5725
|
+
var inputs = _b.inputs;
|
|
5701
5726
|
return (inputs || []).some(function (input) { return input['@id'] === id; });
|
|
5702
5727
|
})) === null || _a === void 0 ? void 0 : _a.value, id)
|
|
5703
5728
|
: '';
|
|
@@ -5715,33 +5740,48 @@
|
|
|
5715
5740
|
var logSubValue = function (logs, key, prop) { return logs[key][prop] ? (Array.isArray(logs[key][prop]) ?
|
|
5716
5741
|
logs[key][prop].map(function (id) { return ({ key: prop, id: id }); }) :
|
|
5717
5742
|
{ key: prop, id: logs[key][prop] }) : undefined; };
|
|
5718
|
-
var logProperties = function (nodes, models) { return nodes.flatMap(function (node) { return (node.properties || []).map(function (
|
|
5719
|
-
var term =
|
|
5743
|
+
var logProperties = function (nodes, models) { return nodes.flatMap(function (node) { return (node.properties || []).map(function (_b) {
|
|
5744
|
+
var term = _b.term;
|
|
5720
5745
|
return term['@id'];
|
|
5721
|
-
}); }).map(function (id) { return ({ key: 'property', id: id, configModels: findModels(models, id).map(function (
|
|
5722
|
-
var model =
|
|
5746
|
+
}); }).map(function (id) { return ({ key: 'property', id: id, configModels: findModels(models, id).map(function (_b) {
|
|
5747
|
+
var model = _b.model;
|
|
5723
5748
|
return model;
|
|
5724
5749
|
}) }); }); };
|
|
5725
|
-
var logSubValues = function (allLogs, logs, original, recalculated, models,
|
|
5726
|
-
var nodeType =
|
|
5727
|
-
return
|
|
5750
|
+
var logSubValues = function (allLogs, logs, original, recalculated, models, _b) {
|
|
5751
|
+
var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
|
|
5752
|
+
return mergeSubValues(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.keys(logs)
|
|
5753
|
+
.filter(function (id) { return logs[id].isProperty; })
|
|
5754
|
+
.map(function (id) { return ({
|
|
5755
|
+
id: id,
|
|
5756
|
+
key: 'property',
|
|
5757
|
+
configModels: (logs[id].models || []).filter(function (v) { return hasLog(logs[id][v]); })
|
|
5758
|
+
}); }))), __read(Object.keys(logs).flatMap(function (key) { return [
|
|
5728
5759
|
logSubValue(logs, key, 'input'),
|
|
5729
5760
|
logSubValue(logs, key, 'property')
|
|
5730
5761
|
]
|
|
5731
5762
|
.flat()
|
|
5732
5763
|
.filter(Boolean)
|
|
5733
|
-
.map(function (v) { return (Object.assign(Object.assign({}, v), { configModels: [key] })); }); }))), __read(logProperties(original, models))), __read(logProperties(recalculated, models))))
|
|
5734
|
-
.map(function (
|
|
5735
|
-
var
|
|
5736
|
-
var
|
|
5737
|
-
|
|
5764
|
+
.map(function (v) { return (Object.assign(Object.assign({}, v), { configModels: v.configModels || [key] })); }); }))), __read(logProperties(original, models))), __read(logProperties(recalculated, models))))
|
|
5765
|
+
.map(function (_b) {
|
|
5766
|
+
var key = _b.key, id = _b.id, configModels = _b.configModels;
|
|
5767
|
+
var originalValue = blankNodeValue(original, key, id);
|
|
5768
|
+
var recalculatedValue = blankNodeValue(recalculated, key, id);
|
|
5769
|
+
return {
|
|
5770
|
+
key: key,
|
|
5771
|
+
id: id,
|
|
5772
|
+
configModels: configModels.map(configModelWithDocs(models, { nodeType: nodeType, type: type, termId: termId }, { key: key, id: id })),
|
|
5773
|
+
originalValue: originalValue,
|
|
5774
|
+
recalculatedValue: recalculatedValue,
|
|
5775
|
+
isRecalculated: !utils.isUndefined(recalculatedValue) && recalculatedValue !== originalValue,
|
|
5776
|
+
isRequired: true
|
|
5777
|
+
};
|
|
5738
5778
|
})
|
|
5739
5779
|
.filter(function (v) { return v.configModels.length > 0; })
|
|
5740
|
-
.map(dataWithConfigModelLogs(allLogs));
|
|
5780
|
+
.map(function (v) { return v.key === 'property' ? dataWithConfigModelLogs(logs)(v) : dataWithConfigModelLogs(allLogs)(v); });
|
|
5741
5781
|
};
|
|
5742
5782
|
// const hasKey = (blankNodes: blankNode[], key: string) => (blankNodes || []).some(n => key in n);
|
|
5743
|
-
var logKeys = function (logs, original, recalculated, models,
|
|
5744
|
-
var nodeType =
|
|
5783
|
+
var logKeys = function (logs, original, recalculated, models, _b) {
|
|
5784
|
+
var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
|
|
5745
5785
|
return Object.keys(logs)
|
|
5746
5786
|
.filter(function (key) { return logs[key].isKey; })
|
|
5747
5787
|
.map(function (key) { return ({
|
|
@@ -5782,8 +5822,8 @@
|
|
|
5782
5822
|
}).filter(Boolean);
|
|
5783
5823
|
return indexes.length ? indexes[0] : '';
|
|
5784
5824
|
};
|
|
5785
|
-
var configModelWithDocs = function (models,
|
|
5786
|
-
var nodeType =
|
|
5825
|
+
var configModelWithDocs = function (models, _b, subValue) {
|
|
5826
|
+
var nodeType = _b.nodeType, type = _b.type, termId = _b.termId, termType = _b.termType;
|
|
5787
5827
|
return function (methodId) {
|
|
5788
5828
|
var node = {
|
|
5789
5829
|
'@type': nodeType,
|
|
@@ -5793,6 +5833,8 @@
|
|
|
5793
5833
|
return {
|
|
5794
5834
|
methodId: methodId,
|
|
5795
5835
|
model: findMatchingModel(models, modelParams(node)) ||
|
|
5836
|
+
// handle "liveAnimal"
|
|
5837
|
+
(termType && findMatchingModel(models, modelKeyParams(node, termType))) ||
|
|
5796
5838
|
findMatchingModel(models, modelKeyParams(node, (subValue === null || subValue === void 0 ? void 0 : subValue.key) + "." + methodId)) ||
|
|
5797
5839
|
// handle "input.price"
|
|
5798
5840
|
findMatchingModel(models, modelKeyParams(node, type.toLowerCase() + "." + (subValue === null || subValue === void 0 ? void 0 : subValue.key))) ||
|
|
@@ -5820,8 +5862,8 @@
|
|
|
5820
5862
|
order: modelConfigOrder(config.models, termId, modelKey, model.methodId)
|
|
5821
5863
|
}); });
|
|
5822
5864
|
return modelsWithOrder
|
|
5823
|
-
.reduce(function (prev,
|
|
5824
|
-
var model =
|
|
5865
|
+
.reduce(function (prev, _b) {
|
|
5866
|
+
var model = _b.model, order = _b.order;
|
|
5825
5867
|
var isArray = order.includes('.');
|
|
5826
5868
|
var arrayIndex = isArray ? order.split('.')[0] : prev.length;
|
|
5827
5869
|
prev[arrayIndex] = isArray ? __spreadArray(__spreadArray([], __read((prev[arrayIndex] || []))), [model]) : model;
|
|
@@ -5845,13 +5887,14 @@
|
|
|
5845
5887
|
undefined;
|
|
5846
5888
|
return function (term) {
|
|
5847
5889
|
var termId = term['@id'];
|
|
5890
|
+
var termType = term.termType;
|
|
5848
5891
|
var termLogs = get$3(logs, termId, {});
|
|
5849
5892
|
var original = originalValues.filter(function (v) { return termId === v.term['@id']; });
|
|
5850
5893
|
var recalculated = recalculatedValues.filter(function (v) { return termId === v.term['@id']; });
|
|
5851
5894
|
var hasData = !!original.length || !!recalculated.length || Object.keys(termLogs).length > 0;
|
|
5852
|
-
var configModelsData = { nodeType: nodeType, type: type, termId: termId };
|
|
5853
|
-
var configModels = groupParallelModels(config, termId, nodeKey, utils.unique(__spreadArray(__spreadArray([], __read((termLogs.models || []).filter(function (key) { return isModelLog(termLogs[key]); }))), __read(findConfigModels(config, termId, nodeKey, models).map(function (
|
|
5854
|
-
var model =
|
|
5895
|
+
var configModelsData = { nodeType: nodeType, type: type, termId: termId, termType: termType };
|
|
5896
|
+
var configModels = groupParallelModels(config, termId, nodeKey, utils.unique(__spreadArray(__spreadArray([], __read((termLogs.models || []).filter(function (key) { return isModelLog(termLogs[key]); }))), __read(findConfigModels(config, termId, nodeKey, models).map(function (_b) {
|
|
5897
|
+
var model = _b.model;
|
|
5855
5898
|
return model;
|
|
5856
5899
|
})))).map(configModelWithDocs(models, configModelsData)));
|
|
5857
5900
|
var keys = logKeys(termLogs, original, recalculated, models, configModelsData);
|
|
@@ -5889,9 +5932,7 @@
|
|
|
5889
5932
|
0
|
|
5890
5933
|
], __read(blankNodeLogs.flatMap(function (v) { return __spreadArray(__spreadArray([
|
|
5891
5934
|
v.configModels.length
|
|
5892
|
-
], __read(v.subValues.map(function (s) { var _a
|
|
5893
|
-
v.keys.length ? 1 : 0
|
|
5894
|
-
]); })))); };
|
|
5935
|
+
], __read((v.subValues.map(function (s) { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; })))), __read((v.keys.map(function (s) { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; })))); })))); };
|
|
5895
5936
|
|
|
5896
5937
|
var _b, _c$1;
|
|
5897
5938
|
var nodeTypesLowerCase = Object.values(schema.NodeType).map(function (v) { return v.toLowerCase(); });
|
|
@@ -5952,20 +5993,23 @@
|
|
|
5952
5993
|
}
|
|
5953
5994
|
NodeLogsModelsComponent.prototype.ngOnInit = function () {
|
|
5954
5995
|
return __awaiter(this, void 0, void 0, function () {
|
|
5955
|
-
var
|
|
5956
|
-
return __generator(this, function (
|
|
5957
|
-
switch (
|
|
5996
|
+
var _b, groupedLogs, logs, nodeType, config, models, _c, engineModels, _d, _e;
|
|
5997
|
+
return __generator(this, function (_f) {
|
|
5998
|
+
switch (_f.label) {
|
|
5958
5999
|
case 0:
|
|
5959
6000
|
this.logsUrl = this.nodeService.nodeLogsUrl(this.node);
|
|
5960
|
-
|
|
6001
|
+
// save as local variable to avoid "reserved yield keyword" issue
|
|
6002
|
+
_b = this;
|
|
6003
|
+
return [4 /*yield*/, this.getLogs()];
|
|
5961
6004
|
case 1:
|
|
5962
|
-
|
|
5963
|
-
|
|
6005
|
+
// save as local variable to avoid "reserved yield keyword" issue
|
|
6006
|
+
_b.logs = _f.sent();
|
|
6007
|
+
groupedLogs = groupLogsByModel(this.logs);
|
|
5964
6008
|
logs = this.logsKey ? groupedLogs[this.logsKey] : groupedLogs;
|
|
5965
6009
|
nodeType = this.node['@type'] || this.node.type;
|
|
5966
6010
|
return [4 /*yield*/, this.engineService.ochestratorConfig(nodeType)];
|
|
5967
6011
|
case 2:
|
|
5968
|
-
config =
|
|
6012
|
+
config = _f.sent();
|
|
5969
6013
|
return [4 /*yield*/, this.searchService.search({
|
|
5970
6014
|
fields: ['@type', '@id', 'name'],
|
|
5971
6015
|
limit: 1000,
|
|
@@ -5979,28 +6023,28 @@
|
|
|
5979
6023
|
}
|
|
5980
6024
|
})];
|
|
5981
6025
|
case 3:
|
|
5982
|
-
models = (
|
|
5983
|
-
|
|
6026
|
+
models = (_f.sent()).results;
|
|
6027
|
+
_c = this;
|
|
5984
6028
|
return [4 /*yield*/, rxjs.from(models).pipe(operators.filter(function (v) { return !!v; }), operators.distinct(function (v) { return v['@id']; }), operators.reduce(function (prev, curr) {
|
|
5985
6029
|
var _b;
|
|
5986
6030
|
return (Object.assign(Object.assign({}, prev), (_b = {}, _b[curr['@id']] = curr, _b)));
|
|
5987
6031
|
}, {})).toPromise()];
|
|
5988
6032
|
case 4:
|
|
5989
|
-
|
|
6033
|
+
_c.methodsById = _f.sent();
|
|
5990
6034
|
if (!this.includeAllModels) return [3 /*break*/, 6];
|
|
5991
6035
|
return [4 /*yield*/, this.engineService.models()];
|
|
5992
6036
|
case 5:
|
|
5993
|
-
|
|
6037
|
+
_d = _f.sent();
|
|
5994
6038
|
return [3 /*break*/, 7];
|
|
5995
6039
|
case 6:
|
|
5996
|
-
|
|
5997
|
-
|
|
6040
|
+
_d = [];
|
|
6041
|
+
_f.label = 7;
|
|
5998
6042
|
case 7:
|
|
5999
|
-
engineModels =
|
|
6000
|
-
|
|
6043
|
+
engineModels = _d;
|
|
6044
|
+
_e = this;
|
|
6001
6045
|
return [4 /*yield*/, computeTerms(this.originalValues, this.recalculatedValues, this.terms, this.filterTermTypes)];
|
|
6002
6046
|
case 8:
|
|
6003
|
-
|
|
6047
|
+
_e.allTerms = _f.sent();
|
|
6004
6048
|
this.allBlankNodes = this.allTerms.flatMap(groupLogsByTerm(nodeType, logs, engineModels, config, this.originalValues, this.recalculatedValues, this.nodeKey));
|
|
6005
6049
|
this.methodModelsCount = modelCount(this.allBlankNodes);
|
|
6006
6050
|
this.rowsCount = this.allBlankNodes.reduce(function (prev, curr) { return prev + 1 + curr.subValues.length + curr.keys.length; }, 0);
|
|
@@ -6011,6 +6055,9 @@
|
|
|
6011
6055
|
});
|
|
6012
6056
|
});
|
|
6013
6057
|
};
|
|
6058
|
+
NodeLogsModelsComponent.prototype.getLogs = function () {
|
|
6059
|
+
return this.nodeService.getLog(this.node).toPromise();
|
|
6060
|
+
};
|
|
6014
6061
|
NodeLogsModelsComponent.prototype.suggestByTerm = function (term) {
|
|
6015
6062
|
return rxjs.from(this.allTerms).pipe(operators.map(function (v) { return v.name; }), operators.filter(function (v) { return v.toLowerCase().includes(term.toLowerCase()); }), operators.toArray());
|
|
6016
6063
|
};
|
|
@@ -6126,6 +6173,10 @@
|
|
|
6126
6173
|
this.additionalKeys = additionalKeys;
|
|
6127
6174
|
this.tableKeys = tableKeys;
|
|
6128
6175
|
}
|
|
6176
|
+
NodeValueDetailsComponent.prototype.ngOnInit = function () {
|
|
6177
|
+
var _this = this;
|
|
6178
|
+
this.tableKeys = tableKeys.filter(function (key) { var _a; return (((_a = _this.data) === null || _a === void 0 ? void 0 : _a.nodes) || []).some(function (node) { return key in node; }); });
|
|
6179
|
+
};
|
|
6129
6180
|
Object.defineProperty(NodeValueDetailsComponent.prototype, "type", {
|
|
6130
6181
|
get: function () {
|
|
6131
6182
|
var _a;
|
|
@@ -6134,14 +6185,18 @@
|
|
|
6134
6185
|
enumerable: false,
|
|
6135
6186
|
configurable: true
|
|
6136
6187
|
});
|
|
6137
|
-
NodeValueDetailsComponent.prototype
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6188
|
+
Object.defineProperty(NodeValueDetailsComponent.prototype, "showInline", {
|
|
6189
|
+
get: function () {
|
|
6190
|
+
var _a, _b;
|
|
6191
|
+
return ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.length) === 1;
|
|
6192
|
+
},
|
|
6193
|
+
enumerable: false,
|
|
6194
|
+
configurable: true
|
|
6195
|
+
});
|
|
6141
6196
|
return NodeValueDetailsComponent;
|
|
6142
6197
|
}());
|
|
6143
6198
|
NodeValueDetailsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeValueDetailsComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
6144
|
-
NodeValueDetailsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: { data: "data", nodeType: "nodeType", dataKey: "dataKey" }, ngImport: i0__namespace, template: "<ng-container *bindOnce=\"data\">\n <ng-container *ngIf=\"
|
|
6199
|
+
NodeValueDetailsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: { data: "data", nodeType: "nodeType", dataKey: "dataKey" }, ngImport: i0__namespace, template: "<ng-container *bindOnce=\"data\">\n <ng-container *ngIf=\"showInline; else asTable\">\n <ng-container *ngFor=\"let key of keys\">\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </ng-container>\n <ng-container *ngFor=\"let key of additionalKeys\">\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </ng-container>\n </ng-container>\n</ng-container>\n\n<ng-template #asTable>\n <he-link-key-value [node]=\"data!.nodes[0]\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" key=\"term\"></he-link-key-value>\n\n <div class=\"table-container mt-2\">\n <table class=\"table is-narrow\">\n <thead>\n <th *ngFor=\"let key of tableKeys\">\n <a [href]=\"baseUrl + '/schema/' + type + '#' + key\" target=\"_blank\"><b>{{key}}</b></a>\n </th>\n </thead>\n <tbody>\n <tr *ngFor=\"let node of data!.nodes\">\n <td *ngFor=\"let key of tableKeys\">\n <he-link-key-value [node]=\"node\" [nodeType]=\"nodeType\" [dataKey]=\"dataKey\" [key]=\"key\"></he-link-key-value>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</ng-template>\n", styles: ["table{background-color:transparent;color:#fff}table::ng-deep he-link-key-value>a:first-child,table::ng-deep he-link-key-value>a:first-child+span{display:none}\n"], components: [{ type: LinkKeyValueComponent, selector: "he-link-key-value", inputs: ["node", "nodeType", "dataKey", "key"] }], directives: [{ type: BindOnceDirective, selector: "[bindOnce]", inputs: ["bindOnce"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
6145
6200
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeValueDetailsComponent, decorators: [{
|
|
6146
6201
|
type: i0.Component,
|
|
6147
6202
|
args: [{
|
|
@@ -6891,15 +6946,16 @@
|
|
|
6891
6946
|
};
|
|
6892
6947
|
Object.defineProperty(CyclesPracticesComponent.prototype, "showTimeline", {
|
|
6893
6948
|
get: function () {
|
|
6894
|
-
|
|
6949
|
+
var _a, _b;
|
|
6950
|
+
return (((_b = (_a = this.cycles) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.practices) || []).some(function (p) { var _a; return timelineTermType.includes((_a = p.term) === null || _a === void 0 ? void 0 : _a.termType); });
|
|
6895
6951
|
},
|
|
6896
6952
|
enumerable: false,
|
|
6897
6953
|
configurable: true
|
|
6898
6954
|
});
|
|
6899
6955
|
// Recalculation logs
|
|
6900
|
-
CyclesPracticesComponent.prototype.selectIndex = function (
|
|
6956
|
+
CyclesPracticesComponent.prototype.selectIndex = function (_c) {
|
|
6901
6957
|
var _this = this;
|
|
6902
|
-
var value =
|
|
6958
|
+
var value = _c.target.value;
|
|
6903
6959
|
this.selectedIndex = -1;
|
|
6904
6960
|
// force a refresh of the logs
|
|
6905
6961
|
setTimeout(function () { return (_this.selectedIndex = +value); });
|
|
@@ -7269,7 +7325,10 @@
|
|
|
7269
7325
|
var contactUsEmail = 'community@hestia.earth';
|
|
7270
7326
|
var externalLink = function (href, text) { return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>"; };
|
|
7271
7327
|
var glossaryLink = function (text) { return externalLink(baseUrl() + "/glossary", text); };
|
|
7272
|
-
var glossaryTypeLink = function (type
|
|
7328
|
+
var glossaryTypeLink = function (type, text) {
|
|
7329
|
+
if (text === void 0) { text = termTypeLabel(type); }
|
|
7330
|
+
return externalLink(baseUrl() + "/glossary?termType=" + type, text);
|
|
7331
|
+
};
|
|
7273
7332
|
var termLink = function (_g) {
|
|
7274
7333
|
var id = _g.id, name = _g.name;
|
|
7275
7334
|
return externalLink(baseUrl() + "/term/" + id, name);
|
|
@@ -7470,6 +7529,7 @@
|
|
|
7470
7529
|
var params = _g.params;
|
|
7471
7530
|
return (errorCount === 1 ? code(params === null || params === void 0 ? void 0 : params.term.name) + " exists" : 'Some Emissions exist') + " in both the Cycle and the Transformation but " + (errorCount === 1 ? 'it is' : 'they are') + " not linked using " + code('cycle.emissions.X.transformation.term') + ". This may be an error.";
|
|
7472
7531
|
},
|
|
7532
|
+
_g['should add an animal production system'] = function () { return "For animal production cycles, we recommend specifying the animal production " + glossaryTypeLink(schema.TermTermType.system) + " as a Practice.\n You can find a list of systems in the " + glossaryTypeLink(schema.TermTermType.system, 'Glossary') + "."; },
|
|
7473
7533
|
_g);
|
|
7474
7534
|
var formatCustomErrorMessage = function (message, error, errorCount) {
|
|
7475
7535
|
if (errorCount === void 0) { errorCount = 1; }
|
|
@@ -9242,11 +9302,11 @@
|
|
|
9242
9302
|
return __generator(this, function (_e) {
|
|
9243
9303
|
switch (_e.label) {
|
|
9244
9304
|
case 0:
|
|
9245
|
-
this.terms = utils.unique(this.indicators.map(function (_d) {
|
|
9305
|
+
this.terms = utils.unique((this.indicators || []).map(function (_d) {
|
|
9246
9306
|
var term = _d.term;
|
|
9247
9307
|
return term;
|
|
9248
9308
|
}).filter(Boolean));
|
|
9249
|
-
this.methods = utils.unique(this.indicators.map(function (_d) {
|
|
9309
|
+
this.methods = utils.unique((this.indicators || []).map(function (_d) {
|
|
9250
9310
|
var methodModel = _d.methodModel;
|
|
9251
9311
|
return methodModel;
|
|
9252
9312
|
}).filter(Boolean));
|