ONOS-6725: UI-Lion: NavItems.
Change-Id: I5fc8dd5a0d93a4315dfc0d012a3875ee41c7da23
diff --git a/cli/src/main/java/org/onosproject/cli/UiViewListCommand.java b/cli/src/main/java/org/onosproject/cli/UiViewListCommand.java
index 92d365b..c23b642 100644
--- a/cli/src/main/java/org/onosproject/cli/UiViewListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/UiViewListCommand.java
@@ -25,10 +25,10 @@
import java.util.List;
/**
- * Lists all UI views.
+ * Lists all registered UI views.
*/
@Command(scope = "onos", name = "ui-views",
- description = "Lists all UI views")
+ description = "Lists all registered UI views")
public class UiViewListCommand extends AbstractShellCommand {
private static final String FMT = "id=%s, category=%s, label=%s, icon=%s";
@@ -40,7 +40,7 @@
print("%s", json(service.getExtensions()));
} else {
service.getExtensions().forEach(ext -> ext.views()
- .forEach(v -> print(FMT, v.id(), v.category().label(),
+ .forEach(v -> print(FMT, v.id(), v.category(),
v.label(), v.iconId())));
}
}
@@ -51,7 +51,7 @@
extensions.forEach(ext -> ext.views()
.forEach(v -> node.add(mapper.createObjectNode()
.put("id", v.id())
- .put("category", v.category().label())
+ .put("category", v.category().toString())
.put("label", v.label())
.put("icon", v.iconId()))));
return node;
diff --git a/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java b/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java
index 79114e0..7946fe5 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.ui;
+import org.onosproject.ui.lion.LionBundle;
+
import java.util.List;
/**
@@ -50,4 +52,11 @@
* @return contributing user interface extension
*/
UiExtension getViewExtension(String viewId);
+
+ /**
+ * Returns the navigation pane localization bundle.
+ *
+ * @return the navigation localization bundle
+ */
+ LionBundle getNavLionBundle();
}
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 4234e98..26ec73c 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiView.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiView.java
@@ -31,42 +31,29 @@
* Designates the navigation menu category.
*/
public enum Category {
+ // NOTE: human readable strings for the categories are now applied
+ // externally, with the appropriate localization bundle.
/**
* Represents platform related views.
*/
- PLATFORM("Platform"),
+ PLATFORM,
/**
* Represents network-control related views.
*/
- NETWORK("Network"),
+ NETWORK,
/**
* Represents miscellaneous views.
*/
- OTHER("Other"),
+ OTHER,
/**
* Represents views that do not show in the navigation menu.
* This category should not be specified directly; rather, use
* the {@link UiViewHidden} constructor instead of {@link UiView}.
*/
- HIDDEN("(hidden)");
-
- private final String label;
-
- Category(String label) {
- this.label = label;
- }
-
- /**
- * Returns the display label for the category.
- *
- * @return display label
- */
- public String label() {
- return label;
- }
+ HIDDEN
}
private final Category category;
diff --git a/core/api/src/test/java/org/onosproject/ui/UiExtensionServiceAdapter.java b/core/api/src/test/java/org/onosproject/ui/UiExtensionServiceAdapter.java
index 76b6f52..3555eaa 100644
--- a/core/api/src/test/java/org/onosproject/ui/UiExtensionServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/ui/UiExtensionServiceAdapter.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.ui;
+import org.onosproject.ui.lion.LionBundle;
+
import java.util.List;
/**
@@ -38,4 +40,9 @@
public UiExtension getViewExtension(String viewId) {
return null;
}
+
+ @Override
+ public LionBundle getNavLionBundle() {
+ return null;
+ }
}
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/MainNavResource.java b/web/gui/src/main/java/org/onosproject/ui/impl/MainNavResource.java
index a8fed5f..cbc173f 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/MainNavResource.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/MainNavResource.java
@@ -19,6 +19,7 @@
import org.onosproject.ui.UiExtension;
import org.onosproject.ui.UiExtensionService;
import org.onosproject.ui.UiView;
+import org.onosproject.ui.lion.LionBundle;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -81,6 +82,7 @@
// Produces an input stream of nav item injections from all extensions.
private InputStream includeNavItems(UiExtensionService service) {
List<UiExtension> extensions = service.getExtensions();
+ LionBundle navLion = service.getNavLionBundle();
StringBuilder sb = new StringBuilder("\n");
for (UiView.Category cat : UiView.Category.values()) {
@@ -90,7 +92,7 @@
List<UiView> catViews = getViewsForCat(extensions, cat);
if (!catViews.isEmpty()) {
- addCatHeader(sb, cat);
+ addCatHeader(sb, cat, navLion);
addCatItems(sb, catViews);
}
}
@@ -109,8 +111,10 @@
return views;
}
- private void addCatHeader(StringBuilder sb, UiView.Category cat) {
- sb.append(String.format(HDR_FORMAT, cat.label()));
+ private void addCatHeader(StringBuilder sb, UiView.Category cat,
+ LionBundle navLion) {
+ String key = "cat_" + cat.name().toLowerCase();
+ sb.append(String.format(HDR_FORMAT, navLion.getValue(key)));
}
private void addCatItems(StringBuilder sb, List<UiView> catViews) {
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
index 7909498..7895751 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiExtensionManager.java
@@ -61,6 +61,7 @@
import org.onosproject.ui.impl.topo.Topo2TrafficMessageHandler;
import org.onosproject.ui.impl.topo.Topo2ViewMessageHandler;
import org.onosproject.ui.impl.topo.Traffic2Overlay;
+import org.onosproject.ui.lion.LionBundle;
import org.onosproject.ui.lion.LionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -160,25 +161,43 @@
Executors.newSingleThreadExecutor(
Tools.groupedThreads("onos/ui-ext-manager", "event-handler", log));
- // Creates core UI extension
+ private LionBundle navLion;
+
+
+ private String lionNavText(String id) {
+ return navLion.getValue("nav_item_" + id);
+ }
+
+ private UiView mkView(UiView.Category cat, String id, String iconId) {
+ return new UiView(cat, id, lionNavText(id), iconId);
+ }
+
private UiExtension createCoreExtension() {
+ List<LionBundle> lionBundles = generateBundles(LION_BASE, LION_TAGS);
+
+ navLion = lionBundles.stream()
+ .filter(f -> f.id().equals("core.fw.Nav")).findFirst().get();
+
List<UiView> coreViews = of(
- new UiView(PLATFORM, "app", "Applications", "nav_apps"),
- new UiView(PLATFORM, "settings", "Settings", "nav_settings"),
- new UiView(PLATFORM, "cluster", "Cluster Nodes", "nav_cluster"),
- new UiView(PLATFORM, "processor", "Packet Processors", "nav_processors"),
- new UiView(PLATFORM, "partition", "Partitions", "nav_partitions"),
- new UiView(NETWORK, "topo", "Topology", "nav_topo"),
- new UiView(NETWORK, "topo2", "Topology 2", "nav_topo2"),
- new UiView(NETWORK, "device", "Devices", "nav_devs"),
+ mkView(PLATFORM, "app", "nav_apps"),
+ mkView(PLATFORM, "settings", "nav_settings"),
+ mkView(PLATFORM, "cluster", "nav_cluster"),
+ mkView(PLATFORM, "processor", "nav_processors"),
+ mkView(PLATFORM, "partition", "nav_partitions"),
+
+ mkView(NETWORK, "topo", "nav_topo"),
+ mkView(NETWORK, "topo2", "nav_topo2"),
+ mkView(NETWORK, "device", "nav_devs"),
+
new UiViewHidden("flow"),
new UiViewHidden("port"),
new UiViewHidden("group"),
new UiViewHidden("meter"),
- new UiView(NETWORK, "link", "Links", "nav_links"),
- new UiView(NETWORK, "host", "Hosts", "nav_hosts"),
- new UiView(NETWORK, "intent", "Intents", "nav_intents"),
- new UiView(NETWORK, "tunnel", "Tunnels", "nav_tunnels")
+
+ mkView(NETWORK, "link", "nav_links"),
+ mkView(NETWORK, "host", "nav_hosts"),
+ mkView(NETWORK, "intent", "nav_intents"),
+ mkView(NETWORK, "tunnel", "nav_tunnels")
);
UiMessageHandlerFactory messageHandlerFactory =
@@ -235,7 +254,7 @@
);
return new UiExtension.Builder(CL, coreViews)
- .lionBundles(generateBundles(LION_BASE, LION_TAGS))
+ .lionBundles(lionBundles)
.messageHandlerFactory(messageHandlerFactory)
.topoOverlayFactory(topoOverlayFactory)
.topo2OverlayFactory(topo2OverlayFactory)
@@ -317,6 +336,11 @@
}
@Override
+ public synchronized LionBundle getNavLionBundle() {
+ return navLion;
+ }
+
+ @Override
public Set<String> getUserNames() {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
prefs.keySet().forEach(k -> builder.add(userName(k)));
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Device.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Device.properties
new file mode 100644
index 0000000..b9080bb
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Device.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_device=Devices
+
+# View title
+title_devices=Devices
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Host.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Host.properties
new file mode 100644
index 0000000..b81faca
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Host.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_host=Hosts
+
+# View title
+title_hosts=Hosts
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Intent.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Intent.properties
new file mode 100644
index 0000000..a06c2f9c
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Intent.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_intent=Intents
+
+# View title
+title_intents=Intents
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Link.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Link.properties
new file mode 100644
index 0000000..75f14b7
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Link.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_link=Links
+
+# View title
+title_links=Links
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Partition.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Partition.properties
new file mode 100644
index 0000000..00a1efd
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Partition.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_partition=Partitions
+
+# View title
+title_partitions=Partitions
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Processor.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Processor.properties
new file mode 100644
index 0000000..d6fca03
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Processor.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_processor=Packet Processors
+
+# View title
+title_packet_processors=Packet Processors
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Settings.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Settings.properties
new file mode 100644
index 0000000..5873422
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Settings.properties
@@ -0,0 +1,28 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_settings=Settings
+
+# View title
+title_component_settings=Component Settings
+
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
new file mode 100644
index 0000000..21861cc
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
@@ -0,0 +1,25 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_topo=Topology
+
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo2.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo2.properties
new file mode 100644
index 0000000..678cf5d
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo2.properties
@@ -0,0 +1,24 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_topo2=Topology 2
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Tunnel.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Tunnel.properties
new file mode 100644
index 0000000..e3dcc36
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Tunnel.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+
+# ==========================================
+# | WIP -- Not Yet Ready For Translation |
+# ==========================================
+
+# Text that appears in the navigation panel
+nav_item_tunnel=Tunnels
+
+# View title
+title_tunnels=Tunnels