@meshmakers/octo-ui 3.4.1240 → 3.4.1260

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.
@@ -5974,6 +5974,7 @@ const GetTreeAssociationTargetsDocumentDto = gql `
5974
5974
  runtime {
5975
5975
  runtimeEntities(rtId: $rtId, ckId: $ckTypeId, first: 1) {
5976
5976
  items {
5977
+ rtId
5977
5978
  associations {
5978
5979
  targets(
5979
5980
  roleId: $roleId
@@ -5986,7 +5987,14 @@ const GetTreeAssociationTargetsDocumentDto = gql `
5986
5987
  rtId
5987
5988
  rtDisplayName
5988
5989
  rtDisplayDescription
5990
+ rtWellKnownName
5989
5991
  ckTypeId
5992
+ attributes(attributeNames: ["name"]) {
5993
+ items {
5994
+ attributeName
5995
+ value
5996
+ }
5997
+ }
5990
5998
  }
5991
5999
  }
5992
6000
  }
@@ -6018,7 +6026,14 @@ const GetTreesDocumentDto = gql `
6018
6026
  rtId
6019
6027
  rtDisplayName
6020
6028
  rtDisplayDescription
6029
+ rtWellKnownName
6021
6030
  ckTypeId
6031
+ attributes(attributeNames: ["name"]) {
6032
+ items {
6033
+ attributeName
6034
+ value
6035
+ }
6036
+ }
6022
6037
  associations {
6023
6038
  targets(
6024
6039
  roleId: "System/ParentChild"
@@ -6924,6 +6939,13 @@ const GET_ROOT_ENTITIES_BY_CK_TYPE = gql `
6924
6939
  ckTypeId
6925
6940
  rtDisplayName
6926
6941
  rtDisplayDescription
6942
+ rtWellKnownName
6943
+ attributes(attributeNames: ["name"]) {
6944
+ items {
6945
+ attributeName
6946
+ value
6947
+ }
6948
+ }
6927
6949
  }
6928
6950
  }
6929
6951
  }
@@ -7450,12 +7472,34 @@ class RuntimeBrowserDataSource extends OctoGraphQlHierarchyDataSource {
7450
7472
  return `assoc:${parentCkTypeId}@${parentRtId}:${role.roleId}:${role.targetCkTypeId}`;
7451
7473
  }
7452
7474
  /**
7453
- * Resolves the display label of an entity: the engine-computed rtDisplayName (AB#4813).
7454
- * The backend guarantees a value ("<ckTypeId>@<rtId>" fallback when the CK type declares
7455
- * no displayNameRule).
7475
+ * Resolves the display label of an entity.
7476
+ *
7477
+ * The engine-computed rtDisplayName (AB#4813) wins when it carries a real value, but it is
7478
+ * written when the entity is stored, so an entity that predates the feature or arrived
7479
+ * through an import has none. The backend then answers with the synthetic
7480
+ * "<ckTypeId>@<rtId>" form, which is indistinguishable from a genuine label to a caller that
7481
+ * only checks for null - and a whole tree of "Basic/Tree@3ef2ac82..." is what the browser
7482
+ * used to render. So the synthetic form is recognised and treated as absent, and the entity's
7483
+ * own name attribute is used instead.
7456
7484
  */
7457
7485
  extractDisplayName(entity) {
7458
- return entity.rtDisplayName || 'Unknown';
7486
+ const fallback = `${entity.ckTypeId}@${entity.rtId}`;
7487
+ const computed = entity.rtDisplayName?.trim();
7488
+ if (computed && computed !== fallback) {
7489
+ return computed;
7490
+ }
7491
+ const name = entity.attributes?.items
7492
+ ?.find((a) => a?.attributeName === 'name')
7493
+ ?.value;
7494
+ // A name attribute is a scalar, not necessarily a string - a numeric name reads better
7495
+ // than the id it would otherwise fall through to.
7496
+ if (typeof name === 'string' || typeof name === 'number') {
7497
+ const text = String(name).trim();
7498
+ if (text !== '') {
7499
+ return text;
7500
+ }
7501
+ }
7502
+ return entity.rtWellKnownName?.trim() || fallback;
7459
7503
  }
7460
7504
  /** Resolves the tooltip of an entity: the engine-computed rtDisplayDescription. */
7461
7505
  extractTooltip(entity) {
@@ -7496,10 +7540,8 @@ class RuntimeBrowserDataSource extends OctoGraphQlHierarchyDataSource {
7496
7540
  if (!metaData) {
7497
7541
  metaData = new CkTypeMetaData(item?.ckTypeId || 'Unknown', item?.ckTypeId || 'Unknown', item?.ckTypeId || 'Unknown', code);
7498
7542
  }
7499
- // Engine-computed display fields (AB#4813); backend guarantees a display name
7500
- const text = item.rtDisplayName || item.ckTypeId || 'Unknown';
7501
- const tooltip = item.rtDisplayDescription ||
7502
- `${item.ckTypeId} - ${item.rtId}`;
7543
+ const text = this.extractDisplayName(item);
7544
+ const tooltip = this.extractTooltip(item);
7503
7545
  result.push(new TreeItemDataTyped(`${item.ckTypeId}@${item.rtId}`, text, tooltip, item, metaData.svgIcon, (item?.associations?.targets?.totalCount ?? 0) > 0));
7504
7546
  }
7505
7547
  }
@@ -7933,8 +7975,10 @@ class EntitySelectorDialogComponent {
7933
7975
  this.selectedEntity = {
7934
7976
  rtId: entity.rtId,
7935
7977
  ckTypeId: entity.ckTypeId,
7936
- // Engine-computed display name (AB#4813); the backend guarantees a value
7937
- name: entity.rtDisplayName,
7978
+ // The node's text, not the raw rtDisplayName: the backend answers "<ckTypeId>@<rtId>"
7979
+ // for entities that carry no computed name, and handing that id back as the label
7980
+ // would undo what the tree already resolved (see extractDisplayName, AB#5285).
7981
+ name: node.text,
7938
7982
  };
7939
7983
  }
7940
7984
  else {
@@ -11015,7 +11059,10 @@ class EntityDetailComponent {
11015
11059
  getEntityDisplayName() {
11016
11060
  if (!this.entity)
11017
11061
  return 'Unknown Entity';
11018
- // Engine-computed display name (AB#4813); the backend guarantees a value
11062
+ // Engine-computed display name (AB#4813). The backend never answers null - it falls back
11063
+ // to "<ckTypeId>@<rtId>", so this header shows an id for entities written before the
11064
+ // feature or imported. The tree resolves that through
11065
+ // RuntimeBrowserDataSource.extractDisplayName; this header reads the raw field.
11019
11066
  return this.entity.rtDisplayName || 'Unknown Entity';
11020
11067
  }
11021
11068
  onPropertyChange(event) {