GUI -- Cycling through icons in table headers:
- An object is returned that has the current column ID and which icon/sorting needs to take place when sent to the server - clicking on each header will display to the debug console which way it will be sorted Change-Id: I686d417a5b9b0e5c9b591380b8a6166c70c3c401
Showing
4 changed files
with
46 additions
and
12 deletions
... | @@ -59,10 +59,12 @@ div.inline-icon { | ... | @@ -59,10 +59,12 @@ div.inline-icon { |
59 | fill: #ccc; | 59 | fill: #ccc; |
60 | } | 60 | } |
61 | 61 | ||
62 | -svg.embeddedIcon .icon.tableColSortAsc rect { | 62 | +svg.embeddedIcon .icon.tableColSortAsc rect, |
63 | +svg.embeddedIcon .icon.tableColSortDesc rect { | ||
63 | stroke: none; | 64 | stroke: none; |
64 | fill: none; | 65 | fill: none; |
65 | } | 66 | } |
67 | + | ||
66 | svg.embeddedIcon .icon rect { | 68 | svg.embeddedIcon .icon rect { |
67 | stroke: black; | 69 | stroke: black; |
68 | stroke-width: 1px; | 70 | stroke-width: 1px; |
... | @@ -70,6 +72,10 @@ svg.embeddedIcon .icon rect { | ... | @@ -70,6 +72,10 @@ svg.embeddedIcon .icon rect { |
70 | .dark svg.embeddedIcon .icon rect { | 72 | .dark svg.embeddedIcon .icon rect { |
71 | stroke: #ccc; | 73 | stroke: #ccc; |
72 | } | 74 | } |
75 | +.dark svg.embeddedIcon .icon.tableColSortAsc rect, | ||
76 | +.dark svg.embeddedIcon .icon.tableColSortDesc rect { | ||
77 | + stroke: none; | ||
78 | +} | ||
73 | 79 | ||
74 | svg .svgIcon { | 80 | svg .svgIcon { |
75 | fill-rule: evenodd; | 81 | fill-rule: evenodd; | ... | ... |
... | @@ -15,9 +15,9 @@ | ... | @@ -15,9 +15,9 @@ |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* | 17 | /* |
18 | - ONOS GUI -- Sample View -- CSS file | 18 | + ONOS GUI -- Device View -- CSS file |
19 | */ | 19 | */ |
20 | 20 | ||
21 | -#ov-device { | 21 | +#ov-device th { |
22 | - /* placeholder */ | 22 | + cursor: pointer; |
23 | } | 23 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -6,18 +6,18 @@ | ... | @@ -6,18 +6,18 @@ |
6 | ng-style="setTableHW()"> | 6 | ng-style="setTableHW()"> |
7 | <thead> | 7 | <thead> |
8 | <tr> | 8 | <tr> |
9 | - <th></th> | 9 | + <th colId="available"></th> |
10 | - <th>URI | 10 | + <th colId="id">URI |
11 | <div class="inline-icon" | 11 | <div class="inline-icon" |
12 | icon icon-id="tableColSortAsc" | 12 | icon icon-id="tableColSortAsc" |
13 | icon-size="10"> | 13 | icon-size="10"> |
14 | </div> | 14 | </div> |
15 | </th> | 15 | </th> |
16 | - <th>Vendor</th> | 16 | + <th colId="mfr">Vendor</th> |
17 | - <th>Hardware Version</th> | 17 | + <th colId="hw">Hardware Version</th> |
18 | - <th>Software Version</th> | 18 | + <th colId="sw">Software Version</th> |
19 | - <th>Serial Number</th> | 19 | + <th colId="serial">Serial Number</th> |
20 | - <th>Protocol</th> | 20 | + <th colId="protocol">Protocol</th> |
21 | </tr> | 21 | </tr> |
22 | </thead> | 22 | </thead> |
23 | 23 | ... | ... |
... | @@ -15,11 +15,14 @@ | ... | @@ -15,11 +15,14 @@ |
15 | */ | 15 | */ |
16 | 16 | ||
17 | /* | 17 | /* |
18 | - ONOS GUI -- Sample View Module | 18 | + ONOS GUI -- Device View Module |
19 | */ | 19 | */ |
20 | 20 | ||
21 | (function () { | 21 | (function () { |
22 | 'use strict'; | 22 | 'use strict'; |
23 | + var currCol = {}, | ||
24 | + prevCol = {}; | ||
25 | + | ||
23 | 26 | ||
24 | angular.module('ovDevice', []) | 27 | angular.module('ovDevice', []) |
25 | .controller('OvDeviceCtrl', ['$log', '$location', 'RestService', | 28 | .controller('OvDeviceCtrl', ['$log', '$location', 'RestService', |
... | @@ -35,6 +38,31 @@ | ... | @@ -35,6 +38,31 @@ |
35 | self.deviceData = data.devices; | 38 | self.deviceData = data.devices; |
36 | }); | 39 | }); |
37 | 40 | ||
41 | + d3.selectAll('th').on('click', function(d) { | ||
42 | + var thElem = d3.select(this); | ||
43 | + currCol.colId = thElem.attr('colId'); | ||
44 | + | ||
45 | + if(currCol.colId === prevCol.colId) { | ||
46 | + (currCol.icon === 'tableColSortDesc') ? | ||
47 | + currCol.icon = 'tableColSortAsc' : | ||
48 | + currCol.icon = 'tableColSortDesc'; | ||
49 | + prevCol.icon = currCol.icon; | ||
50 | + } else { | ||
51 | + currCol.icon = 'tableColSortAsc'; | ||
52 | + prevCol.icon = 'tableColSortNone'; | ||
53 | + } | ||
54 | + | ||
55 | + $log.debug('currCol clicked: ' + currCol.colId + | ||
56 | + ', with sorting icon: ' + currCol.icon); | ||
57 | + $log.debug('prevCol clicked: ' + prevCol.colId + | ||
58 | + ', with its current sorting icon as ' + prevCol.icon); | ||
59 | + | ||
60 | + // TODO: send the prev and currCol info to the server to use in sorting table here | ||
61 | + | ||
62 | + prevCol.colId = currCol.colId; | ||
63 | + | ||
64 | + }); | ||
65 | + | ||
38 | $log.log('OvDeviceCtrl has been created'); | 66 | $log.log('OvDeviceCtrl has been created'); |
39 | }]); | 67 | }]); |
40 | }()); | 68 | }()); | ... | ... |
-
Please register or login to post a comment