Change GUI and GUI2 to be apps rather than core features

Change-Id: I862e5bdbccc29fd78716159e168e7a14bc5053e1
diff --git a/web/gui/BUILD b/web/gui/BUILD
index ab4d983..31c83e1 100644
--- a/web/gui/BUILD
+++ b/web/gui/BUILD
@@ -241,7 +241,7 @@
 """
 
 genrule(
-    name = "onos-gui",
+    name = "onos-web-gui",
     srcs = [
         ":_onos-gui-npm-build",
         ":onos-gui-jar",
@@ -266,3 +266,11 @@
     output_to_bindir = 1,
     visibility = ["//visibility:public"],
 )
+
+onos_app(
+    category = "Graphical User Interface",
+    description = "ONOS GUI - the original ONOS GUI based " +
+                  "on the latest AngularJS - new development should be on GUI2",
+    title = "ONOS Legacy GUI",
+    url = "http://onosproject.org",
+)
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.spec.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.spec.ts
index 37a0cbd..2c31610 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.spec.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.spec.ts
@@ -71,7 +71,7 @@
         windowMock.location.port = p;
         windowMock.location.protocol = prot;
         windowMock.location.href = prot + '://' + h + ':' + p +
-            ctx + '/onos/ui2/';
+            ctx + '/onos/ui/';
     }
 
     it('should define UrlFnService', () => {
@@ -87,37 +87,37 @@
 
     it('should return the correct (http) RS url', () => {
         setLoc('http', 'foo', '123');
-        expect(ufs.rsUrl('path')).toEqual('http://foo:123/onos/ui2/rs/path');
+        expect(ufs.rsUrl('path')).toEqual('http://foo:123/onos/ui/rs/path');
     });
 
     it('should return the correct (https) RS url', () => {
         setLoc('https', 'foo', '123');
-        expect(ufs.rsUrl('path')).toEqual('https://foo:123/onos/ui2/rs/path');
+        expect(ufs.rsUrl('path')).toEqual('https://foo:123/onos/ui/rs/path');
     });
 
     it('should return the correct (ws) WS url', () => {
         setLoc('http', 'foo', '123');
-        expect(ufs.wsUrl('path')).toEqual('ws://foo:123/onos/ui2/websock/path');
+        expect(ufs.wsUrl('path')).toEqual('ws://foo:123/onos/ui/websock/path');
     });
 
     it('should return the correct (wss) WS url', () => {
         setLoc('https', 'foo', '123');
-        expect(ufs.wsUrl('path')).toEqual('wss://foo:123/onos/ui2/websock/path');
+        expect(ufs.wsUrl('path')).toEqual('wss://foo:123/onos/ui/websock/path');
     });
 
     it('should allow us to define an alternate WS port', () => {
         setLoc('http', 'foo', '123');
-        expect(ufs.wsUrl('xyyzy', '456')).toEqual('ws://foo:456/onos/ui2/websock/xyyzy');
+        expect(ufs.wsUrl('xyyzy', '456')).toEqual('ws://foo:456/onos/ui/websock/xyyzy');
     });
 
     it('should allow us to define an alternate host', () => {
         setLoc('http', 'foo', '123');
-        expect(ufs.wsUrl('core', '456', 'bar')).toEqual('ws://bar:456/onos/ui2/websock/core');
+        expect(ufs.wsUrl('core', '456', 'bar')).toEqual('ws://bar:456/onos/ui/websock/core');
     });
 
     it('should allow us to inject an app context', () => {
         setLoc('http', 'foo', '123', '/my/app');
-        expect(ufs.wsUrl('path')).toEqual('ws://foo:123/my/app/onos/ui2/websock/path');
+        expect(ufs.wsUrl('path')).toEqual('ws://foo:123/my/app/onos/ui/websock/path');
     });
 
 });
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.ts
index 12ca11c..a7576c0 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/urlfn.service.ts
@@ -16,7 +16,7 @@
 import { Injectable, Inject } from '@angular/core';
 import { LogService } from '../log.service';
 
-const UICONTEXT = '/onos/ui2/';
+const UICONTEXT = '/onos/ui/';
 const RSSUFFIX = UICONTEXT + 'rs/';
 const WSSUFFIX = UICONTEXT + 'websock/';
 
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/websocket.service.spec.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/websocket.service.spec.ts
index 6c6ade8..7695e13 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/websocket.service.spec.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/remote/websocket.service.spec.ts
@@ -64,8 +64,8 @@
                 port: '80',
                 protocol: 'http',
                 search: { debug: 'true'},
-                href: 'ws://foo:123/onos/ui2/websock/path',
-                absUrl: 'ws://foo:123/onos/ui2/websock/path'
+                href: 'ws://foo:123/onos/ui/websock/path',
+                absUrl: 'ws://foo:123/onos/ui/websock/path'
             }
         };
         fs = new FnService(ar, logSpy, windowMock);
@@ -108,13 +108,13 @@
 
     it('should use the appropriate URL, createWebsocket', () => {
         const url = wss.createWebSocket();
-        expect(url).toEqual('ws://foo:80/onos/ui2/websock/core');
+        expect(url).toEqual('ws://foo:80/onos/ui/websock/core');
     });
 
     it('should use the appropriate URL with modified port, createWebsocket',
         () => {
             const url = wss.createWebSocket(<WsOptions>{ wsport: 1243 });
-            expect(url).toEqual('ws://foo:1243/onos/ui2/websock/core');
+            expect(url).toEqual('ws://foo:1243/onos/ui/websock/core');
     });
 
     it('should verify websocket event handlers, createWebsocket', () => {
diff --git a/web/gui2/BUILD b/web/gui2/BUILD
index 2e62895..16f4280 100644
--- a/web/gui2/BUILD
+++ b/web/gui2/BUILD
@@ -153,7 +153,7 @@
           " npm -v >> ../../$(location onos-gui2-ng-build-prod.log) &&" +
           " ng version >> ../../$(location onos-gui2-ng-build-prod.log) &&" +
           " ng build --extract-css --prod --preserve-symlinks" +
-          "   --base-href /onos/ui2/ --deploy-url /onos/ui2/ >> $$ROOT/$(location onos-gui2-ng-build-prod.log) 2>&1 ||" +
+          "   --base-href /onos/ui/ --deploy-url /onos/ui/ >> $$ROOT/$(location onos-gui2-ng-build-prod.log) 2>&1 ||" +
           " if [ $$? -eq 0 ]; then echo 'Successfully ran build';" +
           " else " +
           "   echo 'Error running \'ng build\' on \'//web/gui2:_onos-gui2-ng-build\'. \\\n" +
@@ -327,7 +327,7 @@
     ],
     suppress_checkstyle = True,
     test_deps = TEST_DEPS,
-    web_context = "/onos/ui2",
+    web_context = "/onos/ui",
     deps = COMPILE_DEPS,
 )
 
@@ -336,7 +336,7 @@
 """
 
 genrule(
-    name = "onos-gui2",
+    name = "onos-web-gui2",
     srcs = [
         ":_onos-gui2-ng-build",
         ":_onos-gui2-base-jar",
@@ -381,3 +381,11 @@
         "@bazel_tools//tools/bash/runfiles",
     ],
 )
+
+onos_app(
+    category = "Graphical User Interface",
+    description = "ONOS GUI2 - a reengineered version of the original ONOS GUI " +
+                  "based on the latest Angular framework components",
+    title = "ONOS GUI2",
+    url = "http://onosproject.org",
+)
diff --git a/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java b/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java
index 19c606d..ad96c1f 100644
--- a/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java
+++ b/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java
@@ -39,7 +39,7 @@
     public Response logout() throws IOException, URISyntaxException {
         servletRequest.getSession().invalidate();
         String url = servletRequest.getRequestURL().toString();
-        url = url.replaceFirst("/onos/ui2/.*", "/onos/ui2/login.html");
+        url = url.replaceFirst("/onos/ui/.*", "/onos/ui/login.html");
         return Response.temporaryRedirect(new URI(url)).build();
     }