@hestia-earth/ui-components 0.32.13 → 0.32.14

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.
@@ -5812,7 +5812,10 @@ const nodeDataState = (node) =>
5812
5812
  node.aggregated && node?.['@type'] === NodeType.ImpactAssessment
5813
5813
  ? DataState.recalculated
5814
5814
  : DataState.original;
5815
- const urlParams = (dataState, dataVersion) => [dataState !== DataState.original ? `dataState=${dataState}` : '', dataVersion ? `dataVersion=${dataVersion}` : '']
5815
+ const urlParams = (dataState, dataVersion) => [
5816
+ !!dataState && dataState !== DataState.original ? `dataState=${dataState}` : '',
5817
+ dataVersion ? `dataVersion=${dataVersion}` : ''
5818
+ ]
5816
5819
  .filter(Boolean)
5817
5820
  .join('&');
5818
5821
  const nodeLink = (node, dataState, dataVersion) => [[node?.['@type']?.toLowerCase(), node?.['@id']].filter(Boolean).join('/'), urlParams(dataState, dataVersion)]
@@ -6056,7 +6059,7 @@ const groupLogsByModel = (data = '') => data
6056
6059
  .map(parseMessage)
6057
6060
  .filter(v => [hasValue(v?.model), hasValue(v?.term) || hasValue(v?.key)].every(Boolean))
6058
6061
  .reduce((group, log) => {
6059
- const subValue = subValueKeys.find(v => !!log[v]);
6062
+ const subValue = subValueKeys.find(v => !!log[v] && log[v] != 'None');
6060
6063
  return subValue && !log.cycle ? groupLogSubValue(group, log, subValue) : groupLog(group, log);
6061
6064
  }, {});
6062
6065
  const asArray = (values) => (Array.isArray(values) ? values : []);
@@ -7700,6 +7703,9 @@ class NodeAggregatedQualityScoreComponent {
7700
7703
  this.searchService = inject(HeSearchService);
7701
7704
  this.nodeService = inject(HeNodeService);
7702
7705
  this.node = input.required();
7706
+ /**
7707
+ * Load and show info tooltip.
7708
+ */
7703
7709
  this.showInfo = input(false);
7704
7710
  this.mode = input('tag');
7705
7711
  this.placement = input('bottom');
@@ -7707,13 +7713,14 @@ class NodeAggregatedQualityScoreComponent {
7707
7713
  this.countryName = computed(() => getCountryName(this.node()));
7708
7714
  this.countryResource = rxResource({
7709
7715
  request: () => ({
7716
+ showInfo: this.showInfo(),
7710
7717
  nodeCountry: this.nodeCountry(),
7711
7718
  countryName: this.countryName(),
7712
7719
  node: this.node()
7713
7720
  }),
7714
- loader: ({ request: { nodeCountry, countryName, node } }) => nodeCountry
7721
+ loader: ({ request: { showInfo, nodeCountry, countryName, node } }) => nodeCountry
7715
7722
  ? of(nodeCountry)
7716
- : countryName
7723
+ : showInfo && countryName
7717
7724
  ? this.searchService
7718
7725
  .search$({
7719
7726
  limit: 1,
@@ -7734,20 +7741,28 @@ class NodeAggregatedQualityScoreComponent {
7734
7741
  this.countryId = computed(() => this.countryResource.value()?.['@id']);
7735
7742
  this.aggregationId = computed(() => [!!this.node(), !!this.countryId()].every(Boolean) ? nodeToAggregationFilename(this.node(), this.countryId()) : null);
7736
7743
  this.logsResource = rxResource({
7737
- request: () => ({ node: this.node(), aggregationId: this.aggregationId() }),
7738
- loader: ({ request: { node, aggregationId } }) => this.nodeService
7739
- .getLog$({
7740
- '@type': node['@type'],
7741
- '@id': aggregationId,
7742
- aggregated: true
7743
- })
7744
- .pipe(map(value => (value ? parseLines(value) : [])), mergeAll(), filter(({ data: { message } }) => !!message), map(({ data: { message } }) => parseMessage$1(message)), filter(({ id }) => id === this.node()['@id']), reduce((a, b) => ({ ...a, ...b }), {}))
7744
+ request: () => ({
7745
+ showInfo: this.showInfo(),
7746
+ node: this.node(),
7747
+ aggregationId: this.aggregationId()
7748
+ }),
7749
+ loader: ({ request: { showInfo, node, aggregationId } }) => showInfo && aggregationId
7750
+ ? this.nodeService
7751
+ .getLog$({
7752
+ '@type': node['@type'],
7753
+ '@id': aggregationId,
7754
+ aggregated: true
7755
+ })
7756
+ .pipe(map(value => (value ? parseLines(value) : [])), mergeAll(), filter(({ data: { message } }) => !!message), map(({ data: { message } }) => parseMessage$1(message)), filter(({ id }) => id === this.node()['@id']), reduce((a, b) => ({ ...a, ...b }), {}))
7757
+ : of({})
7745
7758
  });
7746
7759
  this.logs = computed(() => this.logsResource.value() ?? {});
7747
7760
  this.validScores = computed(() => Object.fromEntries(Object.entries(isScoreValid).map(([key, value]) => [key, value(this.logs())])));
7748
7761
  this.missingEmissionIds = computed(() => this.logs().missing_emissions?.split(';') ?? []);
7749
7762
  this.missingEmissionsResource = rxResource({
7750
- request: () => ({ missingEmissionIds: this.missingEmissionIds() }),
7763
+ request: () => ({
7764
+ missingEmissionIds: this.missingEmissionIds()
7765
+ }),
7751
7766
  loader: ({ request: { missingEmissionIds } }) => missingEmissionIds?.length
7752
7767
  ? this.searchService
7753
7768
  .search$({
@@ -9229,10 +9244,15 @@ const propertyId = () => v4();
9229
9244
  const isGeojson = (schema) => schema.geojson;
9230
9245
  const propertyUrl = (node, key) => ['@id', 'id', 'name'].includes(key) && nodeLinkTypeEnabled(node['@type'] || node.type)
9231
9246
  ? node['@id'] ||
9232
- // handle links on Community Edition
9247
+ // handle old links on Community Edition
9233
9248
  (isExternal() && node.id)
9234
9249
  ? {
9235
- url: `/${(node['@type'] || node.type).toLowerCase()}/${node['@id'] || node.id}`,
9250
+ url: [
9251
+ node['@type'] === SchemaType.Term ? baseUrl(false) : null,
9252
+ nodeLink({ '@type': node['@type'] || node.type, '@id': node['@id'] || node.id })
9253
+ ]
9254
+ .filter(Boolean)
9255
+ .join('/'),
9236
9256
  title: 'Open'
9237
9257
  }
9238
9258
  : node['@type'] === SchemaType.Term