Simon Hunt

ONOS-3129 : GUI Intents to Topo :: part 1 - making intent table rows selectable; adding topo button.

Change-Id: Iac53411c2a5af9f093d822d49a76b3cd5117fbf1
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
37 play: 'play', 37 play: 'play',
38 stop: 'stop', 38 stop: 'stop',
39 39
40 + topo: 'topo',
41 +
40 refresh: 'refresh', 42 refresh: 'refresh',
41 garbage: 'garbage', 43 garbage: 'garbage',
42 44
......
...@@ -81,7 +81,7 @@ div.summary-list tr.no-data td { ...@@ -81,7 +81,7 @@ div.summary-list tr.no-data td {
81 } 81 }
82 82
83 .light div.summary-list tr.selected { 83 .light div.summary-list tr.selected {
84 - background-color: deepskyblue; 84 + background-color: deepskyblue !important;
85 } 85 }
86 86
87 .dark div.summary-list tr.selected { 87 .dark div.summary-list tr.selected {
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
47 resp = o.tag + 'DataResponse', 47 resp = o.tag + 'DataResponse',
48 onSel = fs.isF(o.selCb), 48 onSel = fs.isF(o.selCb),
49 onResp = fs.isF(o.respCb), 49 onResp = fs.isF(o.respCb),
50 + idKey = o.idKey || 'id',
50 oldTableData = [], 51 oldTableData = [],
51 loaded = false, 52 loaded = false,
52 refreshPromise, loadingPromise; 53 refreshPromise, loadingPromise;
...@@ -104,7 +105,8 @@ ...@@ -104,7 +105,8 @@
104 105
105 // === selecting a row functions ---------------- 106 // === selecting a row functions ----------------
106 function selCb($event, selRow) { 107 function selCb($event, selRow) {
107 - o.scope.selId = (o.scope.selId === selRow.id) ? null : selRow.id; 108 + var selId = selRow[idKey];
109 + o.scope.selId = (o.scope.selId === selId) ? null : selId;
108 onSel && onSel($event, selRow); 110 onSel && onSel($event, selRow);
109 } 111 }
110 o.scope.selectCallback = selCb; 112 o.scope.selectCallback = selCb;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
23 } 23 }
24 24
25 #ov-intent div.ctrl-btns { 25 #ov-intent div.ctrl-btns {
26 - width: 45px;
27 } 26 }
28 27
29 .light #ov-intent tr:nth-child(6n + 1), 28 .light #ov-intent tr:nth-child(6n + 1),
......
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 <!-- Intent partial HTML --> 1 <!-- Intent partial HTML -->
18 <div id="ov-intent"> 2 <div id="ov-intent">
19 <div class="tabular-header"> 3 <div class="tabular-header">
20 <h2>Intents ({{tableData.length}} total)</h2> 4 <h2>Intents ({{tableData.length}} total)</h2>
21 <div class="ctrl-btns"> 5 <div class="ctrl-btns">
6 + <div ng-class="{active: !!selId}"
7 + icon icon-id="topo" icon-size="36"
8 + tooltip tt-msg="topoTip"
9 + ng-click="showIntent()"></div>
10 + <div class="separator"></div>
22 <div class="refresh" ng-class="{active: autoRefresh}" 11 <div class="refresh" ng-class="{active: autoRefresh}"
23 icon icon-size="36" icon-id="refresh" 12 icon icon-size="36" icon-id="refresh"
24 tooltip tt-msg="autoRefreshTip" 13 tooltip tt-msg="autoRefreshTip"
...@@ -51,6 +40,8 @@ ...@@ -51,6 +40,8 @@
51 </tr> 40 </tr>
52 41
53 <tr ng-repeat-start="intent in tableData track by $index" 42 <tr ng-repeat-start="intent in tableData track by $index"
43 + ng-click="selectCallback($event, intent)"
44 + ng-class="{selected: intent.key === selId}"
54 ng-repeat-complete row-id="{{intent.key}}"> 45 ng-repeat-complete row-id="{{intent.key}}">
55 <td>{{intent.appId}}</td> 46 <td>{{intent.appId}}</td>
56 <td>{{intent.key}}</td> 47 <td>{{intent.key}}</td>
...@@ -58,10 +49,14 @@ ...@@ -58,10 +49,14 @@
58 <td>{{intent.priority}}</td> 49 <td>{{intent.priority}}</td>
59 <td>{{intent.state}}</td> 50 <td>{{intent.state}}</td>
60 </tr> 51 </tr>
61 - <tr row-id="{{intent.key}}"> 52 + <tr ng-click="selectCallback($event, intent)"
53 + ng-class="{selected: intent.key === selId}"
54 + row-id="{{intent.key}}">
62 <td class="resources" colspan="5">{{intent.resources}}</td> 55 <td class="resources" colspan="5">{{intent.resources}}</td>
63 </tr> 56 </tr>
64 - <tr row-id="{{intent.key}}" ng-repeat-end> 57 + <tr ng-click="selectCallback($event, intent)"
58 + ng-class="{selected: intent.key === selId}"
59 + row-id="{{intent.key}}" ng-repeat-end>
65 <td class="details" colspan="5">{{intent.details}}</td> 60 <td class="details" colspan="5">{{intent.details}}</td>
66 </tr> 61 </tr>
67 </table> 62 </table>
......
...@@ -26,11 +26,25 @@ ...@@ -26,11 +26,25 @@
26 ['$log', '$scope', 'TableBuilderService', 26 ['$log', '$scope', 'TableBuilderService',
27 27
28 function ($log, $scope, tbs) { 28 function ($log, $scope, tbs) {
29 +
30 + function selCb($event, row) {
31 + $log.debug('Got a click on:', row);
32 + }
33 +
29 tbs.buildTable({ 34 tbs.buildTable({
30 scope: $scope, 35 scope: $scope,
31 - tag: 'intent' 36 + tag: 'intent',
37 + selCb: selCb,
38 + idKey: 'key'
32 }); 39 });
33 40
41 + $scope.topoTip = 'Show selected intent on topology view';
42 +
43 + $scope.showIntent = function () {
44 + // TODO: navigate to topology view with selected intent context
45 + $log.debug("+++ showIntent +++", $scope.selId);
46 + };
47 +
34 $log.log('OvIntentCtrl has been created'); 48 $log.log('OvIntentCtrl has been created');
35 }]); 49 }]);
36 }()); 50 }());
......