[ONOS-3526]Web UI - Provide a 'Navigate to help page' link or button
Change-Id: I5260e625bb8890b31606dc31b43d4df84bd7eaf4
diff --git a/core/api/src/main/java/org/onosproject/ui/UiView.java b/core/api/src/main/java/org/onosproject/ui/UiView.java
index 63cd468..4234e98 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiView.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiView.java
@@ -24,6 +24,9 @@
*/
public class UiView {
+ private static final String DEFAULT_HELP_PAGE_URL =
+ "https://wiki.onosproject.org/display/ONOS/The+ONOS+Web+GUI";
+
/**
* Designates the navigation menu category.
*/
@@ -70,6 +73,7 @@
private final String id;
private final String label;
private final String iconId;
+ private final String helpPageUrl;
/**
* Creates a new user interface view descriptor. The navigation item
@@ -80,7 +84,7 @@
* @param label view label
*/
public UiView(Category category, String id, String label) {
- this(category, id, label, null);
+ this(category, id, label, null, null);
}
/**
@@ -97,10 +101,31 @@
* @param iconId icon id
*/
public UiView(Category category, String id, String label, String iconId) {
+ this(category, id, label, iconId, null);
+ }
+
+ /**
+ * Creates a new user interface view descriptor. The navigation item
+ * will appear in the navigation menu under the specified category,
+ * with the specified icon adornment and specified help page.
+ * <p>
+ * Note: see the {@code glyphMapping} structure in {@code icon.js} for
+ * valid icon identifiers.
+ *
+ * @param category view category
+ * @param id view identifier
+ * @param label view label
+ * @param iconId icon id
+ * @param helpPageUrl help page URL
+ */
+ public UiView(Category category, String id, String label, String iconId,
+ String helpPageUrl) {
this.category = category;
this.id = id;
this.label = label;
this.iconId = iconId;
+ this.helpPageUrl = (helpPageUrl == null) ?
+ DEFAULT_HELP_PAGE_URL : helpPageUrl;
}
/**
@@ -139,6 +164,15 @@
return iconId;
}
+ /**
+ * Returns the help page URL for a specific view.
+ *
+ * @return help page URL
+ */
+ public String helpPageUrl() {
+ return helpPageUrl;
+ }
+
@Override
public int hashCode() {
return id.hashCode();