ONOS-2851 - Web UI - create archetype for table view based app.
- added uitab overlay archetype.
- renamed stuff so ui apps can coexist.
- WIP ... custom view source needs to be pared down.
Change-Id: I196e10d69ddc231eb0bc9cc5923f29872035b4fd
diff --git a/tools/package/archetypes/ui/pom.xml b/tools/package/archetypes/ui/pom.xml
index 8dd3a8e..9bebe9d 100644
--- a/tools/package/archetypes/ui/pom.xml
+++ b/tools/package/archetypes/ui/pom.xml
@@ -26,6 +26,6 @@
<artifactId>onos-ui-archetype</artifactId>
<packaging>maven-archetype</packaging>
- <description>ONOS UI overlay archetype</description>
+ <description>ONOS UI Custom-View overlay archetype</description>
</project>
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
index 2e1f091..d67c181 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
@@ -22,7 +22,7 @@
<version>${version}</version>
<packaging>bundle</packaging>
- <description>ONOS OSGi UI bundle archetype</description>
+ <description>ONOS OSGi UI Custom-View bundle archetype</description>
<url>http://onosproject.org</url>
<properties>
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
index f40bcb5..93003a1 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
@@ -34,7 +34,7 @@
import java.util.List;
/**
- * Skeletal ONOS UI application component.
+ * Skeletal ONOS UI Custom-View application component.
*/
@Component(immediate = true)
public class AppUiComponent {
@@ -46,7 +46,7 @@
// List of application views
private final List<UiView> uiViews = ImmutableList.of(
- new UiView(UiView.Category.OTHER, "sample", "Sample")
+ new UiView(UiView.Category.OTHER, "sampleCustom", "Sample Custom")
);
// Factory for UI message handlers
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java
index d9d68b5..e996444 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiMessageHandler.java
@@ -33,18 +33,17 @@
import java.util.List;
/**
- * Skeletal ONOS UI message handler.
- * <p>
- * This example specifically supporting a "table" view.
+ * Skeletal ONOS UI Custom-View message handler.
*/
public class AppUiMessageHandler extends UiMessageHandler {
+ // TODO: reduce the code down to just the custom view example
- private static final String SAMPLE_DATA_REQ = "sampleDataRequest";
- private static final String SAMPLE_DATA_RESP = "sampleDataResponse";
- private static final String SAMPLES = "samples";
+ private static final String SAMPLE_CUSTOM_DATA_REQ = "sampleCustomDataRequest";
+ private static final String SAMPLE_CUSTOM_DATA_RESP = "sampleCustomDataResponse";
+ private static final String SAMPLE_CUSTOMS = "sampleCustoms";
- private static final String SAMPLE_DETAIL_REQ = "sampleDetailsRequest";
- private static final String SAMPLE_DETAIL_RESP = "sampleDetailsResponse";
+ private static final String SAMPLE_CUSTOM_DETAIL_REQ = "sampleCustomDetailsRequest";
+ private static final String SAMPLE_CUSTOM_DETAIL_RESP = "sampleCustomDetailsResponse";
private static final String DETAILS = "details";
private static final String ID = "id";
@@ -61,20 +60,18 @@
@Override
protected Collection<RequestHandler> createRequestHandlers() {
return ImmutableSet.of(
- new SampleDataRequestHandler(),
- new SampleDetailRequestHandler()
+ new SampleCustomDataRequestHandler(),
+ new SampleCustomDetailRequestHandler()
);
}
// handler for sample table requests
- private final class SampleDataRequestHandler extends TableRequestHandler {
+ private final class SampleCustomDataRequestHandler extends TableRequestHandler {
- private SampleDataRequestHandler() {
- super(SAMPLE_DATA_REQ, SAMPLE_DATA_RESP, SAMPLES);
+ private SampleCustomDataRequestHandler() {
+ super(SAMPLE_CUSTOM_DATA_REQ, SAMPLE_CUSTOM_DATA_RESP, SAMPLE_CUSTOMS);
}
- // if necessary, override defaultColumnId() -- if it isn't "id"
-
@Override
protected String[] getColumnIds() {
return COLUMN_IDS;
@@ -106,10 +103,10 @@
// handler for sample item details requests
- private final class SampleDetailRequestHandler extends RequestHandler {
+ private final class SampleCustomDetailRequestHandler extends RequestHandler {
- private SampleDetailRequestHandler() {
- super(SAMPLE_DETAIL_REQ);
+ private SampleCustomDetailRequestHandler() {
+ super(SAMPLE_CUSTOM_DETAIL_REQ);
}
@Override
@@ -139,7 +136,7 @@
data.put(COMMENT, "Some arbitrary comment");
}
- sendMessage(SAMPLE_DETAIL_RESP, 0, rootNode);
+ sendMessage(SAMPLE_CUSTOM_DETAIL_RESP, 0, rootNode);
}
}
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.css b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.css
deleted file mode 100644
index c492e20..0000000
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/* css for sample app view */
-
-#ov-sample h2 {
- display: inline-block;
-}
-
-/* Panel Styling */
-#item-details-panel.floatpanel {
- position: absolute;
- top: 115px;
-}
-
-.light #item-details-panel.floatpanel {
- background-color: rgb(229, 234, 237);
-}
-.dark #item-details-panel.floatpanel {
- background-color: #3A4042;
-}
-
-#item-details-panel h3 {
- margin: 0;
- font-size: large;
-}
-
-#item-details-panel h4 {
- margin: 0;
-}
-
-#item-details-panel td {
- padding: 5px;
-}
-#item-details-panel td.label {
- font-style: italic;
- opacity: 0.8;
-}
\ No newline at end of file
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.css b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.css
new file mode 100644
index 0000000..72b7085
--- /dev/null
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.css
@@ -0,0 +1,35 @@
+/* css for sample app view */
+
+#ov-sample h2 {
+ display: inline-block;
+}
+
+/* Panel Styling */
+#ov-sample-custom-item-details-panel.floatpanel {
+ position: absolute;
+ top: 115px;
+}
+
+.light #ov-sample-custom-item-details-panel.floatpanel {
+ background-color: rgb(229, 234, 237);
+}
+.dark #ov-sample-custom-item-details-panel.floatpanel {
+ background-color: #3A4042;
+}
+
+#ov-sample-custom-item-details-panel h3 {
+ margin: 0;
+ font-size: large;
+}
+
+#ov-sample-custom-item-details-panel h4 {
+ margin: 0;
+}
+
+#ov-sample-custom-item-details-panel td {
+ padding: 5px;
+}
+#ov-sample-custom-item-details-panel td.label {
+ font-style: italic;
+ opacity: 0.8;
+}
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.html b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.html
similarity index 92%
rename from tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.html
rename to tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.html
index 03a7383..05f6d58 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.html
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.html
@@ -1,5 +1,5 @@
<!-- partial HTML -->
-<div id="ov-sample">
+<div id="ov-sample-custom">
<div class="tabular-header">
<h2>Items ({{tableData.length}} total)</h2>
<div class="ctrl-btns">
@@ -42,5 +42,5 @@
</div>
- <item-details-panel></item-details-panel>
+ <ov-sample-custom-item-details-panel></ov-sample-custom-item-details-panel>
</div>
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.js b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.js
similarity index 84%
rename from tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.js
rename to tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.js
index 2d4aed4..7f37c5d 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sample/sample.js
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/app/view/sampleCustom/sampleCustom.js
@@ -1,14 +1,14 @@
-// js for sample app view
+// js for sample app custom view
(function () {
'use strict';
// injected refs
- var $log, $scope, fs, wss, ps;
+ var $log, $scope, fs, wss;
// constants
- var detailsReq = 'sampleDetailsRequest',
- detailsResp = 'sampleDetailsResponse',
- pName = 'item-details-panel',
+ var detailsReq = 'sampleCustomDetailsRequest',
+ detailsResp = 'sampleCustomDetailsResponse',
+ pName = 'ov-sample-custom-item-details-panel',
propOrder = ['id', 'label', 'code'],
friendlyProps = ['Item ID', 'Item Label', 'Special Code'];
@@ -44,8 +44,8 @@
$scope.$apply();
}
- angular.module('ovSample', [])
- .controller('OvSampleCtrl',
+ angular.module('ovSampleCustom', [])
+ .controller('OvSampleCustomCtrl',
['$log', '$scope', 'TableBuilderService',
'FnService', 'WebSocketService',
@@ -75,24 +75,24 @@
// TableBuilderService creating a table for us
tbs.buildTable({
scope: $scope,
- tag: 'sample',
+ tag: 'sampleCustom',
selCb: selCb
});
// cleanup
$scope.$on('$destroy', function () {
wss.unbindHandlers(handlers);
+ $log.log('OvSampleCustomCtrl has been destroyed');
});
- $log.log('OvSampleCtrl has been created');
+ $log.log('OvSampleCustomCtrl has been created');
}])
- .directive('itemDetailsPanel', ['PanelService', 'KeyService',
- function (_ps_, ks) {
+ .directive('ovSampleCustomItemDetailsPanel', ['PanelService', 'KeyService',
+ function (ps, ks) {
return {
restrict: 'E',
link: function (scope, element, attrs) {
- ps = _ps_;
// insert details panel with PanelService
// create the panel
var panel = ps.createPanel(pName, {
@@ -107,7 +107,9 @@
if (panel.isVisible()) {
$scope.selId = null;
panel.hide();
+ return true;
}
+ return false;
}
// create key bindings to handle panel
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html
index c469725..4e7b709 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html
@@ -1 +1 @@
-<link rel="stylesheet" href="app/view/sample/sample.css">
\ No newline at end of file
+<link rel="stylesheet" href="app/view/sampleCustom/sampleCustom.css">
\ No newline at end of file
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html
index 7cacc70..6550b85 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html
@@ -1 +1 @@
-<script src="app/view/sample/sample.js"></script>
\ No newline at end of file
+<script src="app/view/sampleCustom/sampleCustom.js"></script>
\ No newline at end of file