Simon Hunt
Committed by Gerrit Code Review

GUI -- Added UiViewHidden subclass of UiView to allow for views that do not have…

… an entry in the navigation panel.
- Added placeholder "flow" view.

Change-Id: I3a969d16baf608b132c10cfc7f154d0ce51c765e
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.ui;
17 +
18 +import com.google.common.base.MoreObjects;
19 +
20 +/**
21 + * Represents user interface view addition, except that this one should not
22 + * have an entry in the navigation panel.
23 + */
24 +public class UiViewHidden extends UiView {
25 +
26 + /**
27 + * Creates a new user interface hidden view descriptor.
28 + *
29 + * @param id view identifier
30 + */
31 + public UiViewHidden(String id) {
32 + super(id, null);
33 + }
34 +
35 + @Override
36 + public String toString() {
37 + return MoreObjects.toStringHelper(this)
38 + .add("id", id())
39 + .toString();
40 + }
41 +}
...@@ -18,6 +18,7 @@ package org.onosproject.ui.impl; ...@@ -18,6 +18,7 @@ package org.onosproject.ui.impl;
18 import org.onosproject.ui.UiExtension; 18 import org.onosproject.ui.UiExtension;
19 import org.onosproject.ui.UiExtensionService; 19 import org.onosproject.ui.UiExtensionService;
20 import org.onosproject.ui.UiView; 20 import org.onosproject.ui.UiView;
21 +import org.onosproject.ui.UiViewHidden;
21 22
22 import javax.ws.rs.GET; 23 import javax.ws.rs.GET;
23 import javax.ws.rs.Path; 24 import javax.ws.rs.Path;
...@@ -71,9 +72,11 @@ public class MainNavResource extends AbstractInjectionResource { ...@@ -71,9 +72,11 @@ public class MainNavResource extends AbstractInjectionResource {
71 StringBuilder sb = new StringBuilder("\n"); 72 StringBuilder sb = new StringBuilder("\n");
72 for (UiExtension extension : service.getExtensions()) { 73 for (UiExtension extension : service.getExtensions()) {
73 for (UiView view : extension.views()) { 74 for (UiView view : extension.views()) {
75 + if (!(view instanceof UiViewHidden)) {
74 sb.append(String.format(NAV_FORMAT, view.id(), view.label())); 76 sb.append(String.format(NAV_FORMAT, view.id(), view.label()));
75 } 77 }
76 } 78 }
79 + }
77 return new ByteArrayInputStream(sb.toString().getBytes()); 80 return new ByteArrayInputStream(sb.toString().getBytes());
78 } 81 }
79 } 82 }
......
...@@ -28,6 +28,7 @@ import org.onosproject.ui.UiExtension; ...@@ -28,6 +28,7 @@ import org.onosproject.ui.UiExtension;
28 import org.onosproject.ui.UiExtensionService; 28 import org.onosproject.ui.UiExtensionService;
29 import org.onosproject.ui.UiMessageHandlerFactory; 29 import org.onosproject.ui.UiMessageHandlerFactory;
30 import org.onosproject.ui.UiView; 30 import org.onosproject.ui.UiView;
31 +import org.onosproject.ui.UiViewHidden;
31 import org.slf4j.Logger; 32 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory; 33 import org.slf4j.LoggerFactory;
33 34
...@@ -59,13 +60,15 @@ public class UiExtensionManager implements UiExtensionService, SpriteService { ...@@ -59,13 +60,15 @@ public class UiExtensionManager implements UiExtensionService, SpriteService {
59 60
60 // Creates core UI extension 61 // Creates core UI extension
61 private static UiExtension createCoreExtension() { 62 private static UiExtension createCoreExtension() {
62 - List<UiView> coreViews = of(new UiView("topo", "Topology View"), 63 + List<UiView> coreViews = of(new UiView("topo", "Topology"),
63 new UiView("device", "Devices"), 64 new UiView("device", "Devices"),
65 + new UiViewHidden("flow"),
64 new UiView("link", "Links"), 66 new UiView("link", "Links"),
65 new UiView("host", "Hosts"), 67 new UiView("host", "Hosts"),
66 new UiView("intent", "Intents"), 68 new UiView("intent", "Intents"),
67 new UiView("app", "Applications"), 69 new UiView("app", "Applications"),
68 new UiView("cluster", "Cluster Nodes")); 70 new UiView("cluster", "Cluster Nodes"));
71 +
69 UiMessageHandlerFactory messageHandlerFactory = 72 UiMessageHandlerFactory messageHandlerFactory =
70 () -> ImmutableList.of( 73 () -> ImmutableList.of(
71 new TopologyViewMessageHandler(), 74 new TopologyViewMessageHandler(),
...@@ -76,6 +79,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService { ...@@ -76,6 +79,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService {
76 new ApplicationViewMessageHandler(), 79 new ApplicationViewMessageHandler(),
77 new ClusterViewMessageHandler() 80 new ClusterViewMessageHandler()
78 ); 81 );
82 +
79 return new UiExtension(coreViews, messageHandlerFactory, "core", 83 return new UiExtension(coreViews, messageHandlerFactory, "core",
80 UiExtensionManager.class.getClassLoader()); 84 UiExtensionManager.class.getClassLoader());
81 } 85 }
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- Flow View -- CSS file
19 + */
20 +
21 +#ov-flow td {
22 +}
...\ No newline at end of file ...\ No newline at end of file
1 +<!-- Host partial HTML -->
2 +<div id="ov-flow">
3 + <h1> Flows are here </h1>
4 +</div>
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- Flow View Module
19 + */
20 +
21 +(function () {
22 + 'use strict';
23 +
24 + angular.module('ovFlow', [])
25 + .controller('OvFlowCtrl',
26 + ['$log', '$scope', 'TableBuilderService',
27 +
28 + function ($log, $scope, tbs) {
29 + //tbs.buildTable({
30 + // self: this,
31 + // scope: $scope,
32 + // tag: 'flow'
33 + //});
34 +
35 + $log.log('OvFlowCtrl has been created');
36 + }]);
37 +}());
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
110 <script src="app/view/topo/topoTraffic.js"></script> 110 <script src="app/view/topo/topoTraffic.js"></script>
111 <script src="app/view/topo/topoToolbar.js"></script> 111 <script src="app/view/topo/topoToolbar.js"></script>
112 <script src="app/view/device/device.js"></script> 112 <script src="app/view/device/device.js"></script>
113 + <script src="app/view/flow/flow.js"></script>
113 <script src="app/view/link/link.js"></script> 114 <script src="app/view/link/link.js"></script>
114 <script src="app/view/host/host.js"></script> 115 <script src="app/view/host/host.js"></script>
115 <script src="app/view/intent/intent.js"></script> 116 <script src="app/view/intent/intent.js"></script>
...@@ -123,6 +124,7 @@ ...@@ -123,6 +124,7 @@
123 <!-- Builtin views stylesheets. --> 124 <!-- Builtin views stylesheets. -->
124 <link rel="stylesheet" href="app/view/topo/topo.css"> 125 <link rel="stylesheet" href="app/view/topo/topo.css">
125 <link rel="stylesheet" href="app/view/device/device.css"> 126 <link rel="stylesheet" href="app/view/device/device.css">
127 + <link rel="stylesheet" href="app/view/flow/flow.css">
126 <link rel="stylesheet" href="app/view/link/link.css"> 128 <link rel="stylesheet" href="app/view/link/link.css">
127 <link rel="stylesheet" href="app/view/host/host.css"> 129 <link rel="stylesheet" href="app/view/host/host.css">
128 <link rel="stylesheet" href="app/view/intent/intent.css"> 130 <link rel="stylesheet" href="app/view/intent/intent.css">
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
38 // {INJECTED-VIEW-IDS-START} 38 // {INJECTED-VIEW-IDS-START}
39 'topo', 39 'topo',
40 'device', 40 'device',
41 + 'flow',
41 'host', 42 'host',
42 'app', 43 'app',
43 'intent', 44 'intent',
......