ONOS-1479 -- GUI - augmenting topology view for extensibility:
- Preliminary work in implementing installation of custom buttons to details panel for selected device.
Change-Id: Id26ac301f72b4521d2a388d34ee0a287f400c68c
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java b/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
index 87b6839..03ff2a3 100644
--- a/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
+++ b/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
@@ -35,6 +35,7 @@
private String typeId;
private String id;
private List<Prop> properties = new ArrayList<>();
+ private List<Button> buttons = new ArrayList<>();
/**
* Constructs a property panel model with the given title and
@@ -174,6 +175,16 @@
return properties;
}
+ /**
+ * Returns the list of button descriptors.
+ *
+ * @return the button list
+ */
+ // TODO: consider protecting this?
+ public List<Button> buttons() {
+ return buttons;
+ }
+
// == MUTATORS
/**
@@ -226,6 +237,17 @@
return this;
}
+ /**
+ * Adds a button descriptor with the given identifier, to the panel data.
+ *
+ * @param id button identifier
+ * @return self, for chaining
+ */
+ public PropertyPanel addButton(String id) {
+ buttons.add(new Button(id));
+ return this;
+ }
+
// ====================
@@ -300,4 +322,29 @@
}
}
+ /**
+ * Button descriptor. Note that these work in conjunction with
+ * "buttons" defined in the JavaScript code for the overlay.
+ */
+ public static class Button {
+ private final String id;
+
+ /**
+ * Constructs a button descriptor with the given identifier.
+ *
+ * @param id button identifier
+ */
+ public Button(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the identifier for this button.
+ *
+ * @return button identifier
+ */
+ public String id() {
+ return id;
+ }
+ }
}
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java b/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java
index ca3ce5f..d44ba9f 100644
--- a/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java
+++ b/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java
@@ -73,4 +73,37 @@
public static final String STOP = "stop";
public static final String CLOUD = "cloud";
}
+
+ /**
+ * Defines constants for property names on the default summary and
+ * details panels.
+ */
+ public static final class Properties {
+ // summary panel
+ public static final String DEVICES = "Devices";
+ public static final String LINKS = "Links";
+ public static final String HOSTS = "Hosts";
+ public static final String TOPOLOGY_SSCS = "Topology SCCs";
+ public static final String INTENTS = "Intents";
+ public static final String TUNNELS = "Tunnels";
+ public static final String FLOWS = "Flows";
+ public static final String VERSION = "Version";
+
+ // device details
+ public static final String URI = "URI";
+ public static final String VENDOR = "Vendor";
+ public static final String HW_VERSION = "H/W Version";
+ public static final String SW_VERSION = "S/W Version";
+ public static final String SERIAL_NUMBER = "Serial Number";
+ public static final String PROTOCOL = "Protocol";
+ public static final String LATITUDE = "Latitude";
+ public static final String LONGITUDE = "Longitude";
+ public static final String PORTS = "Ports";
+
+ // host details
+ public static final String MAC = "MAC";
+ public static final String IP = "IP";
+ public static final String VLAN = "VLAN";
+ }
+
}