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
/*
* Copyright 2015 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.
*/
package org.onosproject.ui;
import com.google.common.base.MoreObjects;
/**
* Represents user interface view addition, except that this one should not
* have an entry in the navigation panel.
*/
public class UiViewHidden extends UiView {
/**
* Creates a new user interface hidden view descriptor.
*
* @param id view identifier
*/
public UiViewHidden(String id) {
super(id, null);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", id())
.toString();
}
}
......@@ -18,6 +18,7 @@ package org.onosproject.ui.impl;
import org.onosproject.ui.UiExtension;
import org.onosproject.ui.UiExtensionService;
import org.onosproject.ui.UiView;
import org.onosproject.ui.UiViewHidden;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
......@@ -71,7 +72,9 @@ public class MainNavResource extends AbstractInjectionResource {
StringBuilder sb = new StringBuilder("\n");
for (UiExtension extension : service.getExtensions()) {
for (UiView view : extension.views()) {
sb.append(String.format(NAV_FORMAT, view.id(), view.label()));
if (!(view instanceof UiViewHidden)) {
sb.append(String.format(NAV_FORMAT, view.id(), view.label()));
}
}
}
return new ByteArrayInputStream(sb.toString().getBytes());
......
......@@ -28,6 +28,7 @@ import org.onosproject.ui.UiExtension;
import org.onosproject.ui.UiExtensionService;
import org.onosproject.ui.UiMessageHandlerFactory;
import org.onosproject.ui.UiView;
import org.onosproject.ui.UiViewHidden;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -59,13 +60,15 @@ public class UiExtensionManager implements UiExtensionService, SpriteService {
// Creates core UI extension
private static UiExtension createCoreExtension() {
List<UiView> coreViews = of(new UiView("topo", "Topology View"),
List<UiView> coreViews = of(new UiView("topo", "Topology"),
new UiView("device", "Devices"),
new UiViewHidden("flow"),
new UiView("link", "Links"),
new UiView("host", "Hosts"),
new UiView("intent", "Intents"),
new UiView("app", "Applications"),
new UiView("cluster", "Cluster Nodes"));
UiMessageHandlerFactory messageHandlerFactory =
() -> ImmutableList.of(
new TopologyViewMessageHandler(),
......@@ -76,6 +79,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService {
new ApplicationViewMessageHandler(),
new ClusterViewMessageHandler()
);
return new UiExtension(coreViews, messageHandlerFactory, "core",
UiExtensionManager.class.getClassLoader());
}
......
/*
* Copyright 2015 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.
*/
/*
ONOS GUI -- Flow View -- CSS file
*/
#ov-flow td {
}
\ No newline at end of file
<!-- Host partial HTML -->
<div id="ov-flow">
<h1> Flows are here </h1>
</div>
/*
* Copyright 2015 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.
*/
/*
ONOS GUI -- Flow View Module
*/
(function () {
'use strict';
angular.module('ovFlow', [])
.controller('OvFlowCtrl',
['$log', '$scope', 'TableBuilderService',
function ($log, $scope, tbs) {
//tbs.buildTable({
// self: this,
// scope: $scope,
// tag: 'flow'
//});
$log.log('OvFlowCtrl has been created');
}]);
}());
......@@ -110,6 +110,7 @@
<script src="app/view/topo/topoTraffic.js"></script>
<script src="app/view/topo/topoToolbar.js"></script>
<script src="app/view/device/device.js"></script>
<script src="app/view/flow/flow.js"></script>
<script src="app/view/link/link.js"></script>
<script src="app/view/host/host.js"></script>
<script src="app/view/intent/intent.js"></script>
......@@ -123,6 +124,7 @@
<!-- Builtin views stylesheets. -->
<link rel="stylesheet" href="app/view/topo/topo.css">
<link rel="stylesheet" href="app/view/device/device.css">
<link rel="stylesheet" href="app/view/flow/flow.css">
<link rel="stylesheet" href="app/view/link/link.css">
<link rel="stylesheet" href="app/view/host/host.css">
<link rel="stylesheet" href="app/view/intent/intent.css">
......
......@@ -38,6 +38,7 @@
// {INJECTED-VIEW-IDS-START}
'topo',
'device',
'flow',
'host',
'app',
'intent',
......