Remove Associations property from inventory item

If the inventory item had a Assocations interface, it would have
a Assocations property. This Assocations property showed
on the inventory panel under the individual inventory item
dropdown.

There can be a lot of Associations, the chassis for example associates
to a lot of sensors, and they are long, full D-Bus paths. Not
very useful and can overwhelm the dropdown so remove the property.

One day we might want something to associate an inventory item to
an object (e.g. sensors). This would require design changes to
accommodate this.

Support both the old and new Associations interface.
See https://github.com/openbmc/openbmc/issues/3584

Tested: Built an image and loaded on a Witherspoon. No longer see
        this property.
Change-Id: Ib67e36c7536a42eb56e65b6dbe6fd8798976ee08
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 0b1aa46..d485016 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -1458,17 +1458,37 @@
             for (var key in content.data) {
               if (content.data.hasOwnProperty(key) &&
                   key.indexOf(Constants.HARDWARE.component_key_filter) == 0) {
-                data = camelcaseToLabel(content.data[key]);
-                searchText = getSearchText(data);
-                title = key.split('/').pop();
                 // All and only associations have the property "endpoints".
-                // We don't want to show associations on the hardware page.
+                // We don't want to show forward/reverse association objects
+                // that the mapper created on the inventory panel.
                 // Example: An association from the BMC inventory item to the
-                // BMC firmware images.
+                // BMC firmware images. See:
+                // https://github.com/openbmc/docs/blob/master/object-mapper.md#associations
                 if (content.data[key].hasOwnProperty('endpoints')) {
                   continue;
                 }
+                // There is also an "Associations" property created by the
+                // Association interface. These would show on the inventory
+                // panel under the individual inventory item dropdown. There
+                // can be a lot of associations in this property and they are
+                // long, full D-Bus paths. Not particularly useful. Remove
+                // for now.
 
+                if (content.data[key].hasOwnProperty('Associations')) {
+                  delete content.data[key].Associations;
+                }
+
+                // Support old Associations interface property
+                // https://github.com/openbmc/phosphor-logging/blob/master/org/openbmc/Associations.interface.yaml
+                // Remove when we move to new Associations interface
+                // openbmc/openbmc#3584
+                if (content.data[key].hasOwnProperty('associations')) {
+                  delete content.data[key].associations;
+                }
+
+                data = camelcaseToLabel(content.data[key]);
+                searchText = getSearchText(data);
+                title = key.split('/').pop();
                 title = titlelize(title);
                 // e.g. /xyz/openbmc_project/inventory/system and
                 // /xyz/openbmc_project/inventory/system/chassis are depths of 5
@@ -1492,6 +1512,7 @@
                       },
                       {items: data}));
 
+
                   keyIndexMap[key] = hardwareData.length - 1;
                 } else {
                   parent = determineParent(key)