@hestia-earth/ui-components 0.5.0 → 0.5.2
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 +36 -32
- package/bundles/hestia-earth-ui-components.umd.js.map +1 -1
- package/esm2015/node/node-logs-models/node-logs-models.component.js +6 -10
- package/esm2015/node/node-logs-models/node-logs-models.model.js +32 -24
- package/fesm2015/hestia-earth-ui-components.js +36 -32
- package/fesm2015/hestia-earth-ui-components.js.map +1 -1
- package/package.json +1 -1
|
@@ -4697,28 +4697,34 @@ const hasLogDetails = (status, logs) => [
|
|
|
4697
4697
|
LogStatus.success,
|
|
4698
4698
|
LogStatus.error
|
|
4699
4699
|
].includes(status) && hasLogs(logs);
|
|
4700
|
-
const logStatus = (data, logs, index) =>
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
: isRunOrchestrator(logs)
|
|
4704
|
-
? ('shouldRun' in logs
|
|
4705
|
-
? logs.shouldRun
|
|
4706
|
-
? data.isRecalculated
|
|
4707
|
-
? LogStatus.success
|
|
4708
|
-
: LogStatus.dataProvided
|
|
4709
|
-
: data.isRecalculated && index > 0
|
|
4710
|
-
? LogStatus.skipHierarchy
|
|
4711
|
-
: LogStatus.error
|
|
4712
|
-
: LogStatus.dataProvided)
|
|
4713
|
-
: data.isRecalculated
|
|
4714
|
-
? LogStatus.skipHierarchy
|
|
4715
|
-
: LogStatus.dataProvided)
|
|
4716
|
-
: ([
|
|
4700
|
+
const logStatus = (data, logs, index) => {
|
|
4701
|
+
const withLogs = hasLog(logs);
|
|
4702
|
+
const isCalculated = [
|
|
4717
4703
|
typeof data.originalValue === 'undefined',
|
|
4718
4704
|
data.isRecalculated // is recalculated
|
|
4719
|
-
].every(Boolean)
|
|
4720
|
-
|
|
4721
|
-
|
|
4705
|
+
].every(Boolean);
|
|
4706
|
+
// can be not required for a specific model
|
|
4707
|
+
const isRequired = !!logs && 'runRequired' in logs ? logs.runRequired : data.isRequired;
|
|
4708
|
+
return withLogs
|
|
4709
|
+
? (!isRequired
|
|
4710
|
+
? LogStatus.notRequired
|
|
4711
|
+
: isRunOrchestrator(logs)
|
|
4712
|
+
? ('shouldRun' in logs
|
|
4713
|
+
? logs.shouldRun
|
|
4714
|
+
? data.isRecalculated
|
|
4715
|
+
? LogStatus.success
|
|
4716
|
+
: LogStatus.dataProvided
|
|
4717
|
+
: data.isRecalculated && index > 0
|
|
4718
|
+
? LogStatus.skipHierarchy
|
|
4719
|
+
: LogStatus.error
|
|
4720
|
+
: LogStatus.dataProvided)
|
|
4721
|
+
: data.isRecalculated
|
|
4722
|
+
? LogStatus.skipHierarchy
|
|
4723
|
+
: LogStatus.dataProvided)
|
|
4724
|
+
: (isCalculated
|
|
4725
|
+
? LogStatus.skipHierarchy
|
|
4726
|
+
: LogStatus.dataProvided);
|
|
4727
|
+
};
|
|
4722
4728
|
const mergeSubValues = (values) => Object.values(values.reduce((prev, { id, key, configModels }) => {
|
|
4723
4729
|
const uniqueKey = [key, id].filter(Boolean).join('.');
|
|
4724
4730
|
prev[uniqueKey] = {
|
|
@@ -4784,7 +4790,7 @@ const logProperties = (nodes, models) => nodes.flatMap(node => (node.properties
|
|
|
4784
4790
|
const logEmissionTransformations = (emissions) => emissions.filter(({ transformation }) => !!(transformation === null || transformation === void 0 ? void 0 : transformation['@id'])).map(({ transformation }) => ({
|
|
4785
4791
|
id: transformation === null || transformation === void 0 ? void 0 : transformation['@id'],
|
|
4786
4792
|
key: 'transformation',
|
|
4787
|
-
configModels: ['cycle']
|
|
4793
|
+
configModels: ['cycle/transformation']
|
|
4788
4794
|
}));
|
|
4789
4795
|
const includeCycleSubValue = (subValues) => subValues.some(v => v.key !== 'property');
|
|
4790
4796
|
const cycleSubValue = ({ termId, configModels, isRequired, subValues, original, recalculated }) => {
|
|
@@ -4891,7 +4897,9 @@ const configModelWithDocs = (models, { nodeType, type, termId, termType }, subVa
|
|
|
4891
4897
|
// handle "input.hestiaAggregatedData"
|
|
4892
4898
|
findMatchingModel(models, modelKeyParams(node, `${type === null || type === void 0 ? void 0 : type.toLowerCase()}.${methodId}`)) ||
|
|
4893
4899
|
// handle "transformation"
|
|
4894
|
-
findMatchingModel(models, modelKeyParams(node, subValue === null || subValue === void 0 ? void 0 : subValue.key))
|
|
4900
|
+
((subValue === null || subValue === void 0 ? void 0 : subValue.key) ? findMatchingModel(models, modelKeyParams(node, subValue === null || subValue === void 0 ? void 0 : subValue.key)) : undefined) ||
|
|
4901
|
+
// handle "transformation/excreta" and other models with "/"
|
|
4902
|
+
(methodId.includes('/') ? findMatchingModel(models, { model: methodId.split('/')[0], modelKey: methodId.split('/')[1] }) : undefined)
|
|
4895
4903
|
};
|
|
4896
4904
|
};
|
|
4897
4905
|
const configModelWithLogs = (data, logs) => (model, index = 0) => {
|
|
@@ -4994,7 +5002,7 @@ const modelCount = (blankNodeLogs) => Math.max.apply(Math.max, [
|
|
|
4994
5002
|
...(v.keys.map(s => { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; }))
|
|
4995
5003
|
])
|
|
4996
5004
|
]);
|
|
4997
|
-
const logValueArray = (value) => value.includes(
|
|
5005
|
+
const logValueArray = (value) => [';', ':'].some(v => value.includes(v)) ?
|
|
4998
5006
|
value.split(';').flatMap(v => {
|
|
4999
5007
|
const res = v.split('_').map(vv => vv.split(':'));
|
|
5000
5008
|
return res.length <= 1 ? res.flat() : Object.fromEntries(res);
|
|
@@ -5016,16 +5024,12 @@ const logColor = {
|
|
|
5016
5024
|
[LogStatus.dataProvided]: 'dark',
|
|
5017
5025
|
[LogStatus.notRequired]: 'grey'
|
|
5018
5026
|
};
|
|
5019
|
-
const methodIdLabel = (methodId, model) => (
|
|
5027
|
+
const methodIdLabel = (methodId, model) => (methodId
|
|
5020
5028
|
? ({
|
|
5021
|
-
transformation: 'Data From Transformation'
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
transformation: 'Data From Transformation',
|
|
5026
|
-
impact_assessment: 'Data From Cycle'
|
|
5027
|
-
})[methodId]
|
|
5028
|
-
: '') || keyToLabel(methodId);
|
|
5029
|
+
'cycle/transformation': 'Data From Transformation',
|
|
5030
|
+
impact_assessment: 'Data From Cycle'
|
|
5031
|
+
})[methodId]
|
|
5032
|
+
: '') || (methodId.includes('/') ? methodId.split('/')[0] : keyToLabel(methodId));
|
|
5029
5033
|
const getModelsAt = (log, index) => ('modelsInSubValues' in log ? !log.modelsInSubValues || !log.isOpen : true) && log.configModels[index];
|
|
5030
5034
|
const requirementKeys = (requirements) => Object.keys(requirements).filter(k => !nodeTypesLowerCase.includes(k));
|
|
5031
5035
|
const requirementColor = (value) => !value || ['None', 'False', '0', '0.0'].includes(value) ? 'danger' : 'white';
|