Preparing for dynamic GUI extensibility.
Change-Id: Ic25143bb9ad8919d7c9e70d932dde528a9227e6a
Showing
14 changed files
with
222 additions
and
153 deletions
| ... | @@ -92,7 +92,7 @@ public class UiExtension { | ... | @@ -92,7 +92,7 @@ public class UiExtension { |
| 92 | * @return resource input stream | 92 | * @return resource input stream |
| 93 | */ | 93 | */ |
| 94 | public InputStream resource(String viewId, String path) { | 94 | public InputStream resource(String viewId, String path) { |
| 95 | - InputStream is = classLoader.getResourceAsStream(prefix + "views/" + viewId + "/" + path); | 95 | + InputStream is = classLoader.getResourceAsStream(viewId + "/" + path); |
| 96 | return is; | 96 | return is; |
| 97 | } | 97 | } |
| 98 | 98 | ... | ... |
| ... | @@ -57,32 +57,44 @@ | ... | @@ -57,32 +57,44 @@ |
| 57 | <build> | 57 | <build> |
| 58 | <plugins> | 58 | <plugins> |
| 59 | <plugin> | 59 | <plugin> |
| 60 | - <artifactId>maven-resources-plugin</artifactId> | 60 | + <groupId>org.apache.felix</groupId> |
| 61 | - <version>2.7</version> | 61 | + <artifactId>maven-bundle-plugin</artifactId> |
| 62 | - <executions> | 62 | + <extensions>true</extensions> |
| 63 | - <execution> | 63 | + <configuration> |
| 64 | - <id>copy-resources</id> | 64 | + <instructions> |
| 65 | - <phase>prepare-package</phase> | 65 | + <_wab>src/main/webapp/</_wab> |
| 66 | - <goals> | 66 | + <Include-Resource>src/main/webapp/app/view,{maven-resources}</Include-Resource> |
| 67 | - <goal>copy-resources</goal> | 67 | + <Bundle-SymbolicName> |
| 68 | - </goals> | 68 | + ${project.groupId}.${project.artifactId} |
| 69 | - <configuration> | 69 | + </Bundle-SymbolicName> |
| 70 | - <outputDirectory>${basedir}/target/classes/WEB-INF/classes/app/view</outputDirectory> | 70 | + <Import-Package> |
| 71 | - <resources> | 71 | + org.slf4j, |
| 72 | - <resource> | 72 | + org.osgi.framework, |
| 73 | - <directory>src/main/webapp/app/view</directory> | 73 | + javax.ws.rs,javax.ws.rs.core,javax.ws.rs.ext, |
| 74 | - <filtering>true</filtering> | 74 | + com.sun.jersey.api, |
| 75 | - <excludes> | 75 | + com.sun.jersey.spi.container.servlet, |
| 76 | - <exclude>_sdh/**</exclude> | 76 | + com.sun.jersey.server.impl.container.servlet, |
| 77 | - <exclude>test/**</exclude> | 77 | + com.fasterxml.jackson.databind, |
| 78 | - </excludes> | 78 | + com.fasterxml.jackson.databind.node, |
| 79 | - </resource> | 79 | + com.google.common.base.*, |
| 80 | - </resources> | 80 | + com.google.common.collect.*, |
| 81 | - </configuration> | 81 | + com.google.common.io.*, |
| 82 | - </execution> | 82 | + org.eclipse.jetty.websocket.*, |
| 83 | - </executions> | 83 | + org.onlab.util.*, |
| 84 | + org.onlab.osgi.*, | ||
| 85 | + org.onlab.packet.*, | ||
| 86 | + org.onlab.rest.*, | ||
| 87 | + org.onosproject.* | ||
| 88 | + </Import-Package> | ||
| 89 | + <Web-ContextPath>${web.context}</Web-ContextPath> | ||
| 90 | + </instructions> | ||
| 91 | + </configuration> | ||
| 84 | </plugin> | 92 | </plugin> |
| 93 | + | ||
| 85 | </plugins> | 94 | </plugins> |
| 86 | </build> | 95 | </build> |
| 96 | + <!-- | ||
| 97 | + | ||
| 98 | +--> | ||
| 87 | 99 | ||
| 88 | </project> | 100 | </project> | ... | ... |
| ... | @@ -31,6 +31,7 @@ import java.io.SequenceInputStream; | ... | @@ -31,6 +31,7 @@ import java.io.SequenceInputStream; |
| 31 | 31 | ||
| 32 | import static com.google.common.collect.ImmutableList.of; | 32 | import static com.google.common.collect.ImmutableList.of; |
| 33 | import static com.google.common.io.ByteStreams.toByteArray; | 33 | import static com.google.common.io.ByteStreams.toByteArray; |
| 34 | +import static org.onosproject.ui.impl.MainViewResource.SCRIPT; | ||
| 34 | 35 | ||
| 35 | /** | 36 | /** |
| 36 | * Resource for serving the dynamically composed onos.js. | 37 | * Resource for serving the dynamically composed onos.js. |
| ... | @@ -38,30 +39,35 @@ import static com.google.common.io.ByteStreams.toByteArray; | ... | @@ -38,30 +39,35 @@ import static com.google.common.io.ByteStreams.toByteArray; |
| 38 | @Path("/") | 39 | @Path("/") |
| 39 | public class MainExtResource extends AbstractInjectionResource { | 40 | public class MainExtResource extends AbstractInjectionResource { |
| 40 | 41 | ||
| 41 | - private static final String MAIN_JS = "/onos-template.js"; | 42 | + private static final String MAIN_JS = "templates/onos-template.js"; |
| 42 | - private static final String NAV_HTML = "/nav-template.html"; | 43 | + private static final String NAV_HTML = "templates/nav-template.html"; |
| 44 | + | ||
| 45 | + private static final String INJECT_VIEW_IDS_START = "// {INJECTED-VIEW-IDS-START}"; | ||
| 46 | + private static final String INJECT_VIEW_IDS_END = "// {INJECTED-VIEW-IDS-END}"; | ||
| 47 | + | ||
| 48 | + private static final String INJECT_VIEW_ITEMS_START = "<!-- {INJECTED-VIEW-NAV-START} -->"; | ||
| 49 | + private static final String INJECT_VIEW_ITEMS_END = "<!-- {INJECTED-VIEW-NAV-END} -->"; | ||
| 43 | 50 | ||
| 44 | - private static final String INJECT_VIEW_IDS = "// {INJECTED-VIEW-IDS}"; | ||
| 45 | - private static final String INJECT_VIEW_ITEMS = "<!-- {INJECTED-VIEW-NAV} -->"; | ||
| 46 | 51 | ||
| 47 | private static final String NAV_FORMAT = | 52 | private static final String NAV_FORMAT = |
| 48 | " <li> <a ng-click=\"navCtrl.hideNav()\" href=\"#/%s\">%s</a></li>"; | 53 | " <li> <a ng-click=\"navCtrl.hideNav()\" href=\"#/%s\">%s</a></li>"; |
| 49 | 54 | ||
| 50 | @Path("/onos.js") | 55 | @Path("/onos.js") |
| 51 | @GET | 56 | @GET |
| 52 | - @Produces(MediaType.TEXT_HTML) | 57 | + @Produces(SCRIPT) |
| 53 | public Response getMainModule() throws IOException { | 58 | public Response getMainModule() throws IOException { |
| 54 | UiExtensionService service = get(UiExtensionService.class); | 59 | UiExtensionService service = get(UiExtensionService.class); |
| 55 | InputStream jsTemplate = getClass().getClassLoader().getResourceAsStream(MAIN_JS); | 60 | InputStream jsTemplate = getClass().getClassLoader().getResourceAsStream(MAIN_JS); |
| 56 | String js = new String(toByteArray(jsTemplate)); | 61 | String js = new String(toByteArray(jsTemplate)); |
| 57 | 62 | ||
| 58 | - int p1 = split(js, 0, INJECT_VIEW_IDS); | 63 | + int p1s = split(js, 0, INJECT_VIEW_IDS_START); |
| 59 | - int p2 = split(js, p1, null); | 64 | + int p1e = split(js, 0, INJECT_VIEW_IDS_END); |
| 65 | + int p2s = split(js, p1e, null); | ||
| 60 | 66 | ||
| 61 | StreamEnumeration streams = | 67 | StreamEnumeration streams = |
| 62 | - new StreamEnumeration(of(stream(js, 0, p1), | 68 | + new StreamEnumeration(of(stream(js, 0, p1s), |
| 63 | includeViewIds(service), | 69 | includeViewIds(service), |
| 64 | - stream(js, p1, p2))); | 70 | + stream(js, p1e, p2s))); |
| 65 | 71 | ||
| 66 | return Response.ok(new SequenceInputStream(streams)).build(); | 72 | return Response.ok(new SequenceInputStream(streams)).build(); |
| 67 | } | 73 | } |
| ... | @@ -85,13 +91,14 @@ public class MainExtResource extends AbstractInjectionResource { | ... | @@ -85,13 +91,14 @@ public class MainExtResource extends AbstractInjectionResource { |
| 85 | InputStream navTemplate = getClass().getClassLoader().getResourceAsStream(NAV_HTML); | 91 | InputStream navTemplate = getClass().getClassLoader().getResourceAsStream(NAV_HTML); |
| 86 | String js = new String(toByteArray(navTemplate)); | 92 | String js = new String(toByteArray(navTemplate)); |
| 87 | 93 | ||
| 88 | - int p1 = split(js, 0, INJECT_VIEW_ITEMS); | 94 | + int p1s = split(js, 0, INJECT_VIEW_ITEMS_START); |
| 89 | - int p2 = split(js, p1, null); | 95 | + int p1e = split(js, 0, INJECT_VIEW_ITEMS_END); |
| 96 | + int p2s = split(js, p1e, null); | ||
| 90 | 97 | ||
| 91 | StreamEnumeration streams = | 98 | StreamEnumeration streams = |
| 92 | - new StreamEnumeration(of(stream(js, 0, p1), | 99 | + new StreamEnumeration(of(stream(js, 0, p1s), |
| 93 | includeNavItems(service), | 100 | includeNavItems(service), |
| 94 | - stream(js, p1, p2))); | 101 | + stream(js, p1e, p2s))); |
| 95 | 102 | ||
| 96 | return Response.ok(new SequenceInputStream(streams)).build(); | 103 | return Response.ok(new SequenceInputStream(streams)).build(); |
| 97 | } | 104 | } | ... | ... |
| ... | @@ -37,12 +37,14 @@ import static com.google.common.io.ByteStreams.toByteArray; | ... | @@ -37,12 +37,14 @@ import static com.google.common.io.ByteStreams.toByteArray; |
| 37 | @Path("/") | 37 | @Path("/") |
| 38 | public class MainIndexResource extends AbstractInjectionResource { | 38 | public class MainIndexResource extends AbstractInjectionResource { |
| 39 | 39 | ||
| 40 | - private static final String INDEX = "/index-template.html"; | 40 | + private static final String INDEX = "templates/index-template.html"; |
| 41 | 41 | ||
| 42 | - private static final String INJECT_CSS = "<!-- {INJECTED-STYLESHEETS} -->"; | 42 | + private static final String INJECT_CSS_START = "<!-- {INJECTED-STYLESHEETS-START} -->"; |
| 43 | - private static final String INJECT_JS = "<!-- {INJECTED-JAVASCRIPT} -->"; | 43 | + private static final String INJECT_CSS_END = "<!-- {INJECTED-STYLESHEETS-END} -->"; |
| 44 | + | ||
| 45 | + private static final String INJECT_JS_START = "<!-- {INJECTED-JAVASCRIPT-START} -->"; | ||
| 46 | + private static final String INJECT_JS_END = "<!-- {INJECTED-JAVASCRIPT-END} -->"; | ||
| 44 | 47 | ||
| 45 | - @Path("/") | ||
| 46 | @GET | 48 | @GET |
| 47 | @Produces(MediaType.TEXT_HTML) | 49 | @Produces(MediaType.TEXT_HTML) |
| 48 | public Response getMainIndex() throws IOException { | 50 | public Response getMainIndex() throws IOException { |
| ... | @@ -50,16 +52,18 @@ public class MainIndexResource extends AbstractInjectionResource { | ... | @@ -50,16 +52,18 @@ public class MainIndexResource extends AbstractInjectionResource { |
| 50 | InputStream indexTemplate = getClass().getClassLoader().getResourceAsStream(INDEX); | 52 | InputStream indexTemplate = getClass().getClassLoader().getResourceAsStream(INDEX); |
| 51 | String index = new String(toByteArray(indexTemplate)); | 53 | String index = new String(toByteArray(indexTemplate)); |
| 52 | 54 | ||
| 53 | - int p1 = split(index, 0, INJECT_JS); | 55 | + int p1s = split(index, 0, INJECT_JS_START); |
| 54 | - int p2 = split(index, p1, INJECT_CSS); | 56 | + int p1e = split(index, p1s, INJECT_JS_END); |
| 55 | - int p3 = split(index, p2, null); | 57 | + int p2s = split(index, p1e, INJECT_CSS_START); |
| 58 | + int p2e = split(index, p2s, INJECT_CSS_END); | ||
| 59 | + int p3s = split(index, p2e, null); | ||
| 56 | 60 | ||
| 57 | StreamEnumeration streams = | 61 | StreamEnumeration streams = |
| 58 | - new StreamEnumeration(of(stream(index, 0, p1), | 62 | + new StreamEnumeration(of(stream(index, 0, p1s), |
| 59 | includeJs(service), | 63 | includeJs(service), |
| 60 | - stream(index, p1, p2), | 64 | + stream(index, p1e, p2s), |
| 61 | includeCss(service), | 65 | includeCss(service), |
| 62 | - stream(index, p2, p3))); | 66 | + stream(index, p2e, p3s))); |
| 63 | 67 | ||
| 64 | return Response.ok(new SequenceInputStream(streams)).build(); | 68 | return Response.ok(new SequenceInputStream(streams)).build(); |
| 65 | } | 69 | } | ... | ... |
| ... | @@ -33,9 +33,9 @@ import static javax.ws.rs.core.MediaType.TEXT_HTML; | ... | @@ -33,9 +33,9 @@ import static javax.ws.rs.core.MediaType.TEXT_HTML; |
| 33 | @Path("/") | 33 | @Path("/") |
| 34 | public class MainViewResource extends AbstractInjectionResource { | 34 | public class MainViewResource extends AbstractInjectionResource { |
| 35 | 35 | ||
| 36 | - private static final String CONTENT_TYPE = "Content-Type"; | 36 | + static final String CONTENT_TYPE = "Content-Type"; |
| 37 | - private static final String STYLESHEET = "text/css"; | 37 | + static final String STYLESHEET = "text/css"; |
| 38 | - private static final String SCRIPT = "text/javascript"; | 38 | + static final String SCRIPT = "text/javascript"; |
| 39 | 39 | ||
| 40 | @Path("{view}/{resource}") | 40 | @Path("{view}/{resource}") |
| 41 | @GET | 41 | @GET | ... | ... |
| ... | @@ -54,7 +54,8 @@ public class UiExtensionManager implements UiExtensionService { | ... | @@ -54,7 +54,8 @@ public class UiExtensionManager implements UiExtensionService { |
| 54 | new UiView("topo", "Topology View"), | 54 | new UiView("topo", "Topology View"), |
| 55 | new UiView("device", "Devices")); | 55 | new UiView("device", "Devices")); |
| 56 | 56 | ||
| 57 | - private final UiExtension core = new UiExtension(coreViews, getClass().getClassLoader()); | 57 | + private final UiExtension core = new UiExtension(coreViews, "core", |
| 58 | + getClass().getClassLoader()); | ||
| 58 | 59 | ||
| 59 | @Activate | 60 | @Activate |
| 60 | public void activate() { | 61 | public void activate() { | ... | ... |
File moved
File moved
| 1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
| 2 | <!-- | 2 | <!-- |
| 3 | - ~ Copyright 2015 Open Networking Laboratory | 3 | +~ Copyright 2014,2015 Open Networking Laboratory |
| 4 | - ~ | 4 | +~ |
| 5 | - ~ Licensed under the Apache License, Version 2.0 (the "License"); | 5 | +~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | - ~ you may not use this file except in compliance with the License. | 6 | +~ you may not use this file except in compliance with the License. |
| 7 | - ~ You may obtain a copy of the License at | 7 | +~ You may obtain a copy of the License at |
| 8 | - ~ | 8 | +~ |
| 9 | - ~ http://www.apache.org/licenses/LICENSE-2.0 | 9 | +~ http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | - ~ | 10 | +~ |
| 11 | - ~ Unless required by applicable law or agreed to in writing, software | 11 | +~ Unless required by applicable law or agreed to in writing, software |
| 12 | - ~ distributed under the License is distributed on an "AS IS" BASIS, | 12 | +~ distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 | +~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | - ~ See the License for the specific language governing permissions and | 14 | +~ See the License for the specific language governing permissions and |
| 15 | - ~ limitations under the License. | 15 | +~ limitations under the License. |
| 16 | - --> | 16 | +--> |
| 17 | <html> | 17 | <html> |
| 18 | <head> | 18 | <head> |
| 19 | <meta charset="utf-8"> | 19 | <meta charset="utf-8"> |
| 20 | - <link rel="shortcut icon" href="data/img/onos-logo.png"> | 20 | + <link rel="shortcut icon" href="../data/img/onos-logo.png"> |
| 21 | <title>ONOS Angular</title> | 21 | <title>ONOS Angular</title> |
| 22 | 22 | ||
| 23 | <!-- Third party library code included here --> | 23 | <!-- Third party library code included here --> |
| ... | @@ -35,6 +35,7 @@ | ... | @@ -35,6 +35,7 @@ |
| 35 | 35 | ||
| 36 | <script src="app/fw/util/util.js"></script> | 36 | <script src="app/fw/util/util.js"></script> |
| 37 | <script src="app/fw/util/fn.js"></script> | 37 | <script src="app/fw/util/fn.js"></script> |
| 38 | + <script src="app/fw/util/random.js"></script> | ||
| 38 | <script src="app/fw/util/theme.js"></script> | 39 | <script src="app/fw/util/theme.js"></script> |
| 39 | <script src="app/fw/util/keys.js"></script> | 40 | <script src="app/fw/util/keys.js"></script> |
| 40 | 41 | ||
| ... | @@ -57,9 +58,14 @@ | ... | @@ -57,9 +58,14 @@ |
| 57 | 58 | ||
| 58 | <script src="app/fw/widget/widget.js"></script> | 59 | <script src="app/fw/widget/widget.js"></script> |
| 59 | <script src="app/fw/widget/table.js"></script> | 60 | <script src="app/fw/widget/table.js"></script> |
| 61 | + <script src="app/fw/widget/toolbar.js"></script> | ||
| 62 | + <script src="app/fw/widget/button.js"></script> | ||
| 60 | 63 | ||
| 61 | <script src="app/fw/layer/layer.js"></script> | 64 | <script src="app/fw/layer/layer.js"></script> |
| 62 | <script src="app/fw/layer/panel.js"></script> | 65 | <script src="app/fw/layer/panel.js"></script> |
| 66 | + <script src="app/fw/layer/flash.js"></script> | ||
| 67 | + <script src="app/fw/layer/quickhelp.js"></script> | ||
| 68 | + <script src="app/fw/layer/veil.js"></script> | ||
| 63 | 69 | ||
| 64 | <!-- Framework and library stylesheets included here --> | 70 | <!-- Framework and library stylesheets included here --> |
| 65 | <!-- TODO: use a single catenated-minified file here --> | 71 | <!-- TODO: use a single catenated-minified file here --> |
| ... | @@ -69,31 +75,56 @@ | ... | @@ -69,31 +75,56 @@ |
| 69 | <link rel="stylesheet" href="app/fw/svg/glyph.css"> | 75 | <link rel="stylesheet" href="app/fw/svg/glyph.css"> |
| 70 | <link rel="stylesheet" href="app/fw/svg/icon.css"> | 76 | <link rel="stylesheet" href="app/fw/svg/icon.css"> |
| 71 | <link rel="stylesheet" href="app/fw/layer/panel.css"> | 77 | <link rel="stylesheet" href="app/fw/layer/panel.css"> |
| 78 | + <link rel="stylesheet" href="app/fw/layer/flash.css"> | ||
| 79 | + <link rel="stylesheet" href="app/fw/layer/quickhelp.css"> | ||
| 80 | + <link rel="stylesheet" href="app/fw/layer/veil.css"> | ||
| 72 | <link rel="stylesheet" href="app/fw/nav/nav.css"> | 81 | <link rel="stylesheet" href="app/fw/nav/nav.css"> |
| 73 | 82 | ||
| 74 | <!-- This is where contributed javascript will get injected --> | 83 | <!-- This is where contributed javascript will get injected --> |
| 75 | - <!-- {INJECTED-JAVASCRIPT} --> | 84 | + <!-- {INJECTED-JAVASCRIPT-START} --> |
| 85 | + <script src="app/view/sample/sample.js"></script> | ||
| 86 | + <script src="app/view/topo/topo.js"></script> | ||
| 87 | + <script src="app/view/topo/topoEvent.js"></script> | ||
| 88 | + <script src="app/view/topo/topoFilter.js"></script> | ||
| 89 | + <script src="app/view/topo/topoForce.js"></script> | ||
| 90 | + <script src="app/view/topo/topoInst.js"></script> | ||
| 91 | + <script src="app/view/topo/topoModel.js"></script> | ||
| 92 | + <script src="app/view/topo/topoOblique.js"></script> | ||
| 93 | + <script src="app/view/topo/topoPanel.js"></script> | ||
| 94 | + <script src="app/view/topo/topoSelect.js"></script> | ||
| 95 | + <script src="app/view/topo/topoTraffic.js"></script> | ||
| 96 | + <script src="app/view/device/device.js"></script> | ||
| 97 | + <!-- {INJECTED-JAVASCRIPT-END} --> | ||
| 98 | + | ||
| 76 | 99 | ||
| 77 | <!-- This is where contributed stylesheets will get injected --> | 100 | <!-- This is where contributed stylesheets will get injected --> |
| 78 | - <!-- {INJECTED-STYLESHEETS} --> | 101 | + <!-- {INJECTED-STYLESHEETS-START} --> |
| 102 | + <link rel="stylesheet" href="app/view/sample/sample.css"> | ||
| 103 | + <link rel="stylesheet" href="app/view/topo/topo.css"> | ||
| 104 | + <link rel="stylesheet" href="app/view/device/device.css"> | ||
| 105 | + <!-- TODO: inject style-sheet refs server-side --> | ||
| 106 | + <!-- {INJECTED-STYLESHEETS-END} --> | ||
| 107 | + | ||
| 79 | </head> | 108 | </head> |
| 80 | <body class="light" ng-app="onosApp"> | 109 | <body class="light" ng-app="onosApp"> |
| 81 | - <div id="frame" ng-controller="OnosCtrl as onosCtrl"> | 110 | +<div id="frame" ng-controller="OnosCtrl as onosCtrl"> |
| 82 | - <div id="mast" | 111 | + <div id="mast" |
| 83 | - ng-controller="MastCtrl as mastCtrl" | 112 | + ng-controller="MastCtrl as mastCtrl" |
| 84 | - ng-include="'app/fw/mast/mast.html'"></div> | 113 | + ng-include="'app/fw/mast/mast.html'"></div> |
| 85 | - | 114 | + |
| 86 | - <div id="view" ng-view></div> | 115 | + <div id="view" ng-view></div> |
| 87 | - | 116 | + |
| 88 | - <div id="nav" | 117 | + <div id="nav" |
| 89 | - ng-controller="NavCtrl as navCtrl" | 118 | + ng-controller="NavCtrl as navCtrl" |
| 90 | - ng-include="'dyn/nav/nav.html'"></div> | 119 | + ng-include="'dyn/nav/nav.html'"></div> |
| 91 | - | 120 | + |
| 92 | - <div id="floatpanels"></div> | 121 | + <div id="floatpanels"></div> |
| 93 | - <div id="alerts"></div> | 122 | + <div id="alerts"></div> |
| 94 | - <div id="flash"></div> | 123 | + <div id="flash"></div> |
| 95 | - <div id="quickhelp"></div> | 124 | + <div id="quickhelp"></div> |
| 96 | - <div id="deathmask"></div> | 125 | + <div id="veil" |
| 97 | - </div> | 126 | + resize |
| 127 | + ng-style="resizeWithOffset(0, 0)"></div> | ||
| 128 | +</div> | ||
| 98 | </body> | 129 | </body> |
| 99 | </html> | 130 | </html> | ... | ... |
| 1 | /* | 1 | /* |
| 2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2014,2015 Open Networking Laboratory |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| ... | @@ -36,8 +36,11 @@ | ... | @@ -36,8 +36,11 @@ |
| 36 | // view IDs.. note the first view listed is loaded at startup | 36 | // view IDs.. note the first view listed is loaded at startup |
| 37 | var viewIds = [ | 37 | var viewIds = [ |
| 38 | // TODO: inject view IDs server side | 38 | // TODO: inject view IDs server side |
| 39 | - // {INJECTED-VIEW-IDS} | 39 | + // {INJECTED-VIEW-IDS-START} |
| 40 | - // (end of injected views) | 40 | + 'sample', |
| 41 | + 'topo', | ||
| 42 | + 'device', | ||
| 43 | + // {INJECTED-VIEW-IDS-END} | ||
| 41 | 44 | ||
| 42 | // dummy entry | 45 | // dummy entry |
| 43 | '' | 46 | '' |
| ... | @@ -62,27 +65,32 @@ | ... | @@ -62,27 +65,32 @@ |
| 62 | .controller('OnosCtrl', [ | 65 | .controller('OnosCtrl', [ |
| 63 | '$log', '$route', '$routeParams', '$location', | 66 | '$log', '$route', '$routeParams', '$location', |
| 64 | 'KeyService', 'ThemeService', 'GlyphService', 'PanelService', | 67 | 'KeyService', 'ThemeService', 'GlyphService', 'PanelService', |
| 68 | + 'FlashService', 'QuickHelpService', | ||
| 65 | 69 | ||
| 66 | - function ($log, $route, $routeParams, $location, ks, ts, gs, ps) { | 70 | + function ($log, $route, $routeParams, $location, |
| 67 | - var self = this; | 71 | + ks, ts, gs, ps, flash, qhs) { |
| 72 | + var self = this; | ||
| 68 | 73 | ||
| 69 | - self.$route = $route; | 74 | + self.$route = $route; |
| 70 | - self.$routeParams = $routeParams; | 75 | + self.$routeParams = $routeParams; |
| 71 | - self.$location = $location; | 76 | + self.$location = $location; |
| 72 | - self.version = '1.1.0'; | 77 | + self.version = '1.1.0'; |
| 73 | 78 | ||
| 74 | - // initialize services... | 79 | + // initialize services... |
| 75 | - ts.init(); | 80 | + ts.init(); |
| 76 | - ks.installOn(d3.select('body')); | 81 | + ks.installOn(d3.select('body')); |
| 77 | - gs.init(); | 82 | + ks.bindQhs(qhs); |
| 78 | - ps.init(); | 83 | + gs.init(); |
| 84 | + ps.init(); | ||
| 85 | + flash.initFlash(); | ||
| 86 | + qhs.initQuickHelp(); | ||
| 79 | 87 | ||
| 80 | - $log.log('OnosCtrl has been created'); | 88 | + $log.log('OnosCtrl has been created'); |
| 81 | 89 | ||
| 82 | - $log.debug('route: ', self.$route); | 90 | + $log.debug('route: ', self.$route); |
| 83 | - $log.debug('routeParams: ', self.$routeParams); | 91 | + $log.debug('routeParams: ', self.$routeParams); |
| 84 | - $log.debug('location: ', self.$location); | 92 | + $log.debug('location: ', self.$location); |
| 85 | - }]) | 93 | + }]) |
| 86 | 94 | ||
| 87 | .config(['$routeProvider', function ($routeProvider) { | 95 | .config(['$routeProvider', function ($routeProvider) { |
| 88 | // If view ID not provided, route to the first view in the list. | 96 | // If view ID not provided, route to the first view in the list. |
| ... | @@ -94,8 +102,9 @@ | ... | @@ -94,8 +102,9 @@ |
| 94 | function viewCtrlName(vid) { | 102 | function viewCtrlName(vid) { |
| 95 | return 'Ov' + capitalize(vid) + 'Ctrl'; | 103 | return 'Ov' + capitalize(vid) + 'Ctrl'; |
| 96 | } | 104 | } |
| 105 | + | ||
| 97 | function viewTemplateUrl(vid) { | 106 | function viewTemplateUrl(vid) { |
| 98 | - return 'view/' + vid + '/' + vid + '.html'; | 107 | + return 'app/view/' + vid + '/' + vid + '.html'; |
| 99 | } | 108 | } |
| 100 | 109 | ||
| 101 | // Add routes for each defined view. | 110 | // Add routes for each defined view. | ... | ... |
| ... | @@ -59,7 +59,7 @@ | ... | @@ -59,7 +59,7 @@ |
| 59 | </init-param> | 59 | </init-param> |
| 60 | <init-param> | 60 | <init-param> |
| 61 | <param-name>com.sun.jersey.config.property.classnames</param-name> | 61 | <param-name>com.sun.jersey.config.property.classnames</param-name> |
| 62 | - <param-value>org.onosproject.gui.impl.MainIndexResource</param-value> | 62 | + <param-value>org.onosproject.ui.impl.MainIndexResource</param-value> |
| 63 | </init-param> | 63 | </init-param> |
| 64 | <load-on-startup>1</load-on-startup> | 64 | <load-on-startup>1</load-on-startup> |
| 65 | </servlet> | 65 | </servlet> |
| ... | @@ -78,7 +78,7 @@ | ... | @@ -78,7 +78,7 @@ |
| 78 | </init-param> | 78 | </init-param> |
| 79 | <init-param> | 79 | <init-param> |
| 80 | <param-name>com.sun.jersey.config.property.classnames</param-name> | 80 | <param-name>com.sun.jersey.config.property.classnames</param-name> |
| 81 | - <param-value>org.onosproject.gui.impl.MainExtResource</param-value> | 81 | + <param-value>org.onosproject.ui.impl.MainExtResource</param-value> |
| 82 | </init-param> | 82 | </init-param> |
| 83 | <load-on-startup>1</load-on-startup> | 83 | <load-on-startup>1</load-on-startup> |
| 84 | </servlet> | 84 | </servlet> | ... | ... |
| ... | @@ -81,7 +81,7 @@ | ... | @@ -81,7 +81,7 @@ |
| 81 | <link rel="stylesheet" href="fw/nav/nav.css"> | 81 | <link rel="stylesheet" href="fw/nav/nav.css"> |
| 82 | 82 | ||
| 83 | <!-- This is where contributed javascript will get injected --> | 83 | <!-- This is where contributed javascript will get injected --> |
| 84 | - <!-- {INJECTED-JAVASCRIPT} --> | 84 | + <!-- {INJECTED-JAVASCRIPT-START} --> |
| 85 | <script src="view/sample/sample.js"></script> | 85 | <script src="view/sample/sample.js"></script> |
| 86 | <script src="view/topo/topo.js"></script> | 86 | <script src="view/topo/topo.js"></script> |
| 87 | <script src="view/topo/topoEvent.js"></script> | 87 | <script src="view/topo/topoEvent.js"></script> |
| ... | @@ -94,34 +94,37 @@ | ... | @@ -94,34 +94,37 @@ |
| 94 | <script src="view/topo/topoSelect.js"></script> | 94 | <script src="view/topo/topoSelect.js"></script> |
| 95 | <script src="view/topo/topoTraffic.js"></script> | 95 | <script src="view/topo/topoTraffic.js"></script> |
| 96 | <script src="view/device/device.js"></script> | 96 | <script src="view/device/device.js"></script> |
| 97 | - <!-- TODO: inject javascript refs server-side --> | 97 | + <!-- {INJECTED-JAVASCRIPT-END} --> |
| 98 | + | ||
| 98 | 99 | ||
| 99 | <!-- This is where contributed stylesheets will get injected --> | 100 | <!-- This is where contributed stylesheets will get injected --> |
| 100 | - <!-- {INJECTED-STYLESHEETS} --> | 101 | + <!-- {INJECTED-STYLESHEETS-START} --> |
| 101 | <link rel="stylesheet" href="view/sample/sample.css"> | 102 | <link rel="stylesheet" href="view/sample/sample.css"> |
| 102 | <link rel="stylesheet" href="view/topo/topo.css"> | 103 | <link rel="stylesheet" href="view/topo/topo.css"> |
| 103 | <link rel="stylesheet" href="view/device/device.css"> | 104 | <link rel="stylesheet" href="view/device/device.css"> |
| 104 | <!-- TODO: inject style-sheet refs server-side --> | 105 | <!-- TODO: inject style-sheet refs server-side --> |
| 106 | + <!-- {INJECTED-STYLESHEETS-END} --> | ||
| 107 | + | ||
| 105 | </head> | 108 | </head> |
| 106 | <body class="light" ng-app="onosApp"> | 109 | <body class="light" ng-app="onosApp"> |
| 107 | - <div id="frame" ng-controller="OnosCtrl as onosCtrl"> | 110 | +<div id="frame" ng-controller="OnosCtrl as onosCtrl"> |
| 108 | - <div id="mast" | 111 | + <div id="mast" |
| 109 | - ng-controller="MastCtrl as mastCtrl" | 112 | + ng-controller="MastCtrl as mastCtrl" |
| 110 | - ng-include="'fw/mast/mast.html'"></div> | 113 | + ng-include="'fw/mast/mast.html'"></div> |
| 111 | - | 114 | + |
| 112 | - <div id="view" ng-view></div> | 115 | + <div id="view" ng-view></div> |
| 113 | - | 116 | + |
| 114 | - <div id="nav" | 117 | + <div id="nav" |
| 115 | - ng-controller="NavCtrl as navCtrl" | 118 | + ng-controller="NavCtrl as navCtrl" |
| 116 | - ng-include="'fw/nav/nav.html'"></div> | 119 | + ng-include="'fw/nav/nav.html'"></div> |
| 117 | - | 120 | + |
| 118 | - <div id="floatpanels"></div> | 121 | + <div id="floatpanels"></div> |
| 119 | - <div id="alerts"></div> | 122 | + <div id="alerts"></div> |
| 120 | - <div id="flash"></div> | 123 | + <div id="flash"></div> |
| 121 | - <div id="quickhelp"></div> | 124 | + <div id="quickhelp"></div> |
| 122 | - <div id="veil" | 125 | + <div id="veil" |
| 123 | - resize | 126 | + resize |
| 124 | - ng-style="resizeWithOffset(0, 0)"></div> | 127 | + ng-style="resizeWithOffset(0, 0)"></div> |
| 125 | - </div> | 128 | +</div> |
| 126 | </body> | 129 | </body> |
| 127 | </html> | 130 | </html> | ... | ... |
| ... | @@ -36,11 +36,11 @@ | ... | @@ -36,11 +36,11 @@ |
| 36 | // view IDs.. note the first view listed is loaded at startup | 36 | // view IDs.. note the first view listed is loaded at startup |
| 37 | var viewIds = [ | 37 | var viewIds = [ |
| 38 | // TODO: inject view IDs server side | 38 | // TODO: inject view IDs server side |
| 39 | - // {INJECTED-VIEW-IDS} | 39 | + // {INJECTED-VIEW-IDS-START} |
| 40 | 'sample', | 40 | 'sample', |
| 41 | 'topo', | 41 | 'topo', |
| 42 | 'device', | 42 | 'device', |
| 43 | - // (end of injected views) | 43 | + // {INJECTED-VIEW-IDS-END} |
| 44 | 44 | ||
| 45 | // dummy entry | 45 | // dummy entry |
| 46 | '' | 46 | '' |
| ... | @@ -67,30 +67,30 @@ | ... | @@ -67,30 +67,30 @@ |
| 67 | 'KeyService', 'ThemeService', 'GlyphService', 'PanelService', | 67 | 'KeyService', 'ThemeService', 'GlyphService', 'PanelService', |
| 68 | 'FlashService', 'QuickHelpService', | 68 | 'FlashService', 'QuickHelpService', |
| 69 | 69 | ||
| 70 | - function ($log, $route, $routeParams, $location, | 70 | + function ($log, $route, $routeParams, $location, |
| 71 | - ks, ts, gs, ps, flash, qhs) { | 71 | + ks, ts, gs, ps, flash, qhs) { |
| 72 | - var self = this; | 72 | + var self = this; |
| 73 | 73 | ||
| 74 | - self.$route = $route; | 74 | + self.$route = $route; |
| 75 | - self.$routeParams = $routeParams; | 75 | + self.$routeParams = $routeParams; |
| 76 | - self.$location = $location; | 76 | + self.$location = $location; |
| 77 | - self.version = '1.1.0'; | 77 | + self.version = '1.1.0'; |
| 78 | 78 | ||
| 79 | - // initialize services... | 79 | + // initialize services... |
| 80 | - ts.init(); | 80 | + ts.init(); |
| 81 | - ks.installOn(d3.select('body')); | 81 | + ks.installOn(d3.select('body')); |
| 82 | - ks.bindQhs(qhs); | 82 | + ks.bindQhs(qhs); |
| 83 | - gs.init(); | 83 | + gs.init(); |
| 84 | - ps.init(); | 84 | + ps.init(); |
| 85 | - flash.initFlash(); | 85 | + flash.initFlash(); |
| 86 | - qhs.initQuickHelp(); | 86 | + qhs.initQuickHelp(); |
| 87 | 87 | ||
| 88 | - $log.log('OnosCtrl has been created'); | 88 | + $log.log('OnosCtrl has been created'); |
| 89 | 89 | ||
| 90 | - $log.debug('route: ', self.$route); | 90 | + $log.debug('route: ', self.$route); |
| 91 | - $log.debug('routeParams: ', self.$routeParams); | 91 | + $log.debug('routeParams: ', self.$routeParams); |
| 92 | - $log.debug('location: ', self.$location); | 92 | + $log.debug('location: ', self.$location); |
| 93 | - }]) | 93 | + }]) |
| 94 | 94 | ||
| 95 | .config(['$routeProvider', function ($routeProvider) { | 95 | .config(['$routeProvider', function ($routeProvider) { |
| 96 | // If view ID not provided, route to the first view in the list. | 96 | // If view ID not provided, route to the first view in the list. |
| ... | @@ -102,6 +102,7 @@ | ... | @@ -102,6 +102,7 @@ |
| 102 | function viewCtrlName(vid) { | 102 | function viewCtrlName(vid) { |
| 103 | return 'Ov' + capitalize(vid) + 'Ctrl'; | 103 | return 'Ov' + capitalize(vid) + 'Ctrl'; |
| 104 | } | 104 | } |
| 105 | + | ||
| 105 | function viewTemplateUrl(vid) { | 106 | function viewTemplateUrl(vid) { |
| 106 | return 'view/' + vid + '/' + vid + '.html'; | 107 | return 'view/' + vid + '/' + vid + '.html'; |
| 107 | } | 108 | } | ... | ... |
-
Please register or login to post a comment