Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 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 | /* |
| 18 | ONOS GUI -- Topology Panel Module. |
| 19 | Defines functions for manipulating the summary, detail, and instance panels. |
| 20 | */ |
| 21 | |
| 22 | (function () { |
| 23 | 'use strict'; |
| 24 | |
| 25 | // injected refs |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 26 | var $log, $window, $rootScope, fs, ps, gs, flash, wss, bns, mast, ns; |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 27 | |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 28 | // function to be replaced by the localization bundle function |
| 29 | var topoLion = function (x) { |
| 30 | return '#tps#' + x + '#'; |
| 31 | }; |
| 32 | |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 33 | // constants |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 34 | var pCls = 'topo-p', |
| 35 | idSum = 'topo-p-summary', |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 36 | idDet = 'topo-p-detail', |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 37 | panelOpts = { |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 38 | width: 260, // summary and detail panel width |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 39 | }, |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 40 | sumMax = 226, // summary panel max height |
| 41 | padTop = 16, // summary panel padding below masthead |
| 42 | padding = 16, // panel internal padding |
Simon Hunt | 10618f6 | 2017-06-15 19:30:52 -0700 | [diff] [blame] | 43 | padFudge = padTop + 2 * padding; |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 44 | |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 45 | // internal state |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 46 | var useDetails = true, // should we show details if we have 'em? |
| 47 | haveDetails = false, // do we have details that we could show? |
| 48 | sumFromTop, // summary panel distance from top of screen |
Bri Prebilic Cole | 0a6ffb6 | 2015-06-04 09:32:12 -0700 | [diff] [blame] | 49 | unbindWatch; |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 50 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 51 | // panels |
| 52 | var summary, detail; |
| 53 | |
| 54 | // === ----------------------------------------------------- |
| 55 | // Panel API |
| 56 | function createTopoPanel(id, opts) { |
| 57 | var p = ps.createPanel(id, opts), |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 58 | pid = id, |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 59 | header, body, footer; |
| 60 | p.classed(pCls, true); |
| 61 | |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 62 | function panel() { |
| 63 | return p; |
| 64 | } |
| 65 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 66 | function hAppend(x) { |
| 67 | return header.append(x); |
| 68 | } |
| 69 | |
| 70 | function bAppend(x) { |
| 71 | return body.append(x); |
| 72 | } |
| 73 | |
| 74 | function fAppend(x) { |
| 75 | return footer.append(x); |
| 76 | } |
| 77 | |
| 78 | function setup() { |
| 79 | p.empty(); |
| 80 | |
| 81 | p.append('div').classed('header', true); |
| 82 | p.append('div').classed('body', true); |
| 83 | p.append('div').classed('footer', true); |
| 84 | |
| 85 | header = p.el().select('.header'); |
| 86 | body = p.el().select('.body'); |
| 87 | footer = p.el().select('.footer'); |
| 88 | } |
| 89 | |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 90 | function destroy() { |
| 91 | ps.destroyPanel(pid); |
| 92 | } |
| 93 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 94 | // fromTop is how many pixels from the top of the page the panel is |
| 95 | // max is the max height of the panel in pixels |
| 96 | // only adjusts if the body content would be 10px or larger |
| 97 | function adjustHeight(fromTop, max) { |
| 98 | var totalPHeight, avSpace, |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 99 | overflow = 0; |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 100 | |
| 101 | if (!fromTop) { |
| 102 | $log.warn('adjustHeight: height from top of page not given'); |
| 103 | return null; |
| 104 | } else if (!body || !p) { |
Simon Hunt | 5b024d7 | 2016-01-29 11:02:43 -0800 | [diff] [blame] | 105 | // panel contents are not defined |
| 106 | // this may happen when window is resizing but panel has |
| 107 | // been cleared or removed |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 108 | return null; |
| 109 | } |
| 110 | |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 111 | p.el().style('top', fromTop + 'px'); |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 112 | p.el().style('height', null); |
| 113 | body.style('height', null); |
| 114 | |
| 115 | totalPHeight = fromTop + p.height(); |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 116 | avSpace = fs.windowSize(padFudge).height; |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 117 | |
| 118 | if (totalPHeight >= avSpace) { |
| 119 | overflow = totalPHeight - avSpace; |
| 120 | } |
| 121 | |
| 122 | function _adjustBody(height) { |
| 123 | if (height < 10) { |
| 124 | return false; |
| 125 | } else { |
| 126 | body.style('height', height + 'px'); |
| 127 | } |
| 128 | return true; |
| 129 | } |
| 130 | |
| 131 | if (!_adjustBody(fs.noPxStyle(body, 'height') - overflow)) { |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 132 | return p.height(); |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | if (max && p.height() > max) { |
| 136 | _adjustBody(fs.noPxStyle(body, 'height') - (p.height() - max)); |
| 137 | } |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 138 | return p.height(); |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | return { |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 142 | panel: panel, |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 143 | setup: setup, |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 144 | destroy: destroy, |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 145 | appendHeader: hAppend, |
| 146 | appendBody: bAppend, |
| 147 | appendFooter: fAppend, |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 148 | adjustHeight: adjustHeight, |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 149 | }; |
| 150 | } |
| 151 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 152 | // === ----------------------------------------------------- |
| 153 | // Utility functions |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 154 | |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 155 | function addSep(tbody) { |
| 156 | tbody.append('tr').append('td').attr('colspan', 2).append('hr'); |
| 157 | } |
| 158 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 159 | function addBtnFooter() { |
| 160 | detail.appendFooter('hr'); |
| 161 | detail.appendFooter('div').classed('actionBtns', true); |
| 162 | } |
| 163 | |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 164 | function addProp(tbody, label, value) { |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 165 | var tr = tbody.append('tr'), |
Bri Prebilic Cole | f5e48b1 | 2015-04-21 14:52:36 -0700 | [diff] [blame] | 166 | lab; |
| 167 | if (typeof label === 'string') { |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 168 | lab = label.replace(/_/g, ' '); |
Bri Prebilic Cole | f5e48b1 | 2015-04-21 14:52:36 -0700 | [diff] [blame] | 169 | } else { |
| 170 | lab = label; |
| 171 | } |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 172 | |
| 173 | function addCell(cls, txt) { |
Simon Hunt | 239f09e | 2017-05-18 13:10:09 -0700 | [diff] [blame] | 174 | tr.append('td').attr('class', cls).text(txt); |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 175 | } |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 176 | addCell('label', lab + ' :'); |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 177 | addCell('value', value); |
| 178 | } |
| 179 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 180 | function listProps(tbody, data) { |
Steven Burrows | cdf6b33 | 2017-05-05 11:29:29 -0400 | [diff] [blame] | 181 | |
| 182 | // Suppress Lat Long in details panel if null |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 183 | if (data.propLabels.latitude === null || |
| 184 | data.propLabels.longitude === null) { |
| 185 | var idx = data.propOrder.indexOf('latitude'); |
Steven Burrows | cdf6b33 | 2017-05-05 11:29:29 -0400 | [diff] [blame] | 186 | data.propOrder.splice(idx, 3); |
| 187 | } |
| 188 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 189 | data.propOrder.forEach(function (p) { |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 190 | // TODO: remove after topo view fully i18n'd |
| 191 | var foo = data.props && data.props[p]; |
| 192 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 193 | if (p === '-') { |
| 194 | addSep(tbody); |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 195 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 196 | } else { |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 197 | // TODO: remove this if/else once DETAILS panel fixed for i18n |
| 198 | if (foo !== undefined) { |
| 199 | addProp(tbody, p, foo); |
| 200 | } else { |
| 201 | addProp(tbody, data.propLabels[p], data.propValues[p]); |
| 202 | } |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 203 | } |
| 204 | }); |
| 205 | } |
| 206 | |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 207 | function watchWindow() { |
Bri Prebilic Cole | 0a6ffb6 | 2015-06-04 09:32:12 -0700 | [diff] [blame] | 208 | unbindWatch = $rootScope.$watchCollection( |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 209 | function () { |
| 210 | return { |
| 211 | h: $window.innerHeight, |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 212 | w: $window.innerWidth, |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 213 | }; |
| 214 | }, function () { |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 215 | var h = summary.adjustHeight(sumFromTop, sumMax), |
| 216 | ss = summary.panel().isVisible(), |
| 217 | dtop = h && ss ? sumFromTop + h + padFudge : 0, |
| 218 | dy = dtop || ss ? detail.ypos.current : sumFromTop; |
| 219 | detail.adjustHeight(dy); |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 220 | } |
| 221 | ); |
| 222 | } |
| 223 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 224 | // === ----------------------------------------------------- |
| 225 | // Functions for populating the summary panel |
| 226 | |
| 227 | function populateSummary(data) { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 228 | summary.setup(); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 229 | |
Bri Prebilic Cole | 8d3de3d | 2015-05-15 16:02:59 -0700 | [diff] [blame] | 230 | var svg = summary.appendHeader('div') |
| 231 | .classed('icon', true) |
| 232 | .append('svg'), |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 233 | title = summary.appendHeader('h2'), |
| 234 | table = summary.appendBody('table'), |
Simon Hunt | 8f907cc | 2016-06-15 18:04:01 -0700 | [diff] [blame] | 235 | tbody = table.append('tbody'); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 236 | |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 237 | gs.addGlyph(svg, 'bird', 24, 0, [1, 1]); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 238 | |
Simon Hunt | 0af1ec3 | 2015-07-24 12:17:55 -0700 | [diff] [blame] | 239 | title.text(data.title); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 240 | listProps(tbody, data); |
| 241 | } |
| 242 | |
| 243 | // === ----------------------------------------------------- |
| 244 | // Functions for populating the detail panel |
| 245 | |
Simon Hunt | 10618f6 | 2017-06-15 19:30:52 -0700 | [diff] [blame] | 246 | var navPathIdKey = { |
| 247 | device: 'devId', |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 248 | host: 'hostId', |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 249 | }; |
| 250 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 251 | function displaySingle(data) { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 252 | detail.setup(); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 253 | |
Bri Prebilic Cole | 8d3de3d | 2015-05-15 16:02:59 -0700 | [diff] [blame] | 254 | var svg = detail.appendHeader('div') |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 255 | .classed('icon clickable', true) |
Bri Prebilic Cole | 8d3de3d | 2015-05-15 16:02:59 -0700 | [diff] [blame] | 256 | .append('svg'), |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 257 | title = detail.appendHeader('h2') |
| 258 | .classed('clickable', true), |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 259 | table = detail.appendBody('table'), |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 260 | tbody = table.append('tbody'), |
Simon Hunt | 10618f6 | 2017-06-15 19:30:52 -0700 | [diff] [blame] | 261 | navFn, |
| 262 | navPath; |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 263 | |
Simon Hunt | 8f907cc | 2016-06-15 18:04:01 -0700 | [diff] [blame] | 264 | gs.addGlyph(svg, (data.type || 'unknown'), 26); |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 265 | title.text(data.title); |
| 266 | |
Simon Hunt | 10618f6 | 2017-06-15 19:30:52 -0700 | [diff] [blame] | 267 | // add navigation hot-link if defined |
| 268 | navPath = data.navPath; |
| 269 | if (navPath) { |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 270 | navFn = function () { |
Simon Hunt | 10618f6 | 2017-06-15 19:30:52 -0700 | [diff] [blame] | 271 | var arg = {}; |
| 272 | arg[navPathIdKey[navPath]] = data.id; |
| 273 | ns.navTo(navPath, arg); |
Simon Hunt | b745ca6 | 2015-07-28 15:37:11 -0700 | [diff] [blame] | 274 | }; |
| 275 | |
| 276 | svg.on('click', navFn); |
| 277 | title.on('click', navFn); |
| 278 | } |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 279 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 280 | listProps(tbody, data); |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 281 | addBtnFooter(); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | function displayMulti(ids) { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 285 | detail.setup(); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 286 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 287 | var title = detail.appendHeader('h3'), |
| 288 | table = detail.appendBody('table'), |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 289 | tbody = table.append('tbody'); |
| 290 | |
Prince Pereira | 46c82d4 | 2016-09-19 13:30:50 +0530 | [diff] [blame] | 291 | title.text('Selected Items'); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 292 | ids.forEach(function (d, i) { |
| 293 | addProp(tbody, i+1, d); |
| 294 | }); |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 295 | addBtnFooter(); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 296 | } |
| 297 | |
Bri Prebilic Cole | f5e48b1 | 2015-04-21 14:52:36 -0700 | [diff] [blame] | 298 | function addAction(o) { |
| 299 | var btnDiv = d3.select('#' + idDet) |
| 300 | .select('.actionBtns') |
| 301 | .append('div') |
| 302 | .classed('actionBtn', true); |
Simon Hunt | 3a0598f | 2015-08-04 19:59:04 -0700 | [diff] [blame] | 303 | bns.button(btnDiv, idDet + '-' + o.id, o.gid, o.cb, o.tt); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 304 | } |
| 305 | |
Simon Hunt | a36f03b | 2015-04-01 15:22:49 -0700 | [diff] [blame] | 306 | var friendlyIndex = { |
| 307 | device: 1, |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 308 | host: 0, |
Simon Hunt | a36f03b | 2015-04-01 15:22:49 -0700 | [diff] [blame] | 309 | }; |
| 310 | |
| 311 | function friendly(d) { |
| 312 | var i = friendlyIndex[d.class] || 0; |
| 313 | return (d.labels && d.labels[i]) || ''; |
| 314 | } |
| 315 | |
| 316 | function linkSummary(d) { |
| 317 | var o = d && d.online ? 'online' : 'offline'; |
| 318 | return d ? d.type + ' / ' + o : '-'; |
| 319 | } |
| 320 | |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 321 | // provided to change presentation of internal type name |
| 322 | var linkTypePres = { |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 323 | hostLink: 'edge link', |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 324 | }; |
| 325 | |
| 326 | function linkType(d) { |
| 327 | return linkTypePres[d.type()] || d.type(); |
| 328 | } |
| 329 | |
Ray Milkey | b7f0f64 | 2016-01-22 16:08:14 -0800 | [diff] [blame] | 330 | function linkExpected(d) { |
| 331 | return d.expected(); |
| 332 | } |
| 333 | |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 334 | var coreOrder = [ |
Ray Milkey | b7f0f64 | 2016-01-22 16:08:14 -0800 | [diff] [blame] | 335 | 'Type', 'Expected', '-', |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 336 | 'A_type', 'A_id', 'A_label', 'A_port', '-', |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 337 | 'B_type', 'B_id', 'B_label', 'B_port', |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 338 | ], |
| 339 | edgeOrder = [ |
| 340 | 'Type', '-', |
| 341 | 'A_type', 'A_id', 'A_label', '-', |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 342 | 'B_type', 'B_id', 'B_label', 'B_port', |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 343 | ]; |
| 344 | |
Simon Hunt | 5c1a938 | 2016-06-01 19:35:35 -0700 | [diff] [blame] | 345 | function displayLink(data, modifyCb) { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 346 | detail.setup(); |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 347 | |
Bri Prebilic Cole | 8d3de3d | 2015-05-15 16:02:59 -0700 | [diff] [blame] | 348 | var svg = detail.appendHeader('div') |
| 349 | .classed('icon', true) |
| 350 | .append('svg'), |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 351 | title = detail.appendHeader('h2'), |
| 352 | table = detail.appendBody('table'), |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 353 | tbody = table.append('tbody'), |
| 354 | edgeLink = data.type() === 'hostLink', |
| 355 | order = edgeLink ? edgeOrder : coreOrder; |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 356 | |
Simon Hunt | f29d8e6 | 2016-06-20 11:09:25 -0700 | [diff] [blame] | 357 | gs.addGlyph(svg, 'ports', 26); |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 358 | title.text('Link'); |
Simon Hunt | a36f03b | 2015-04-01 15:22:49 -0700 | [diff] [blame] | 359 | |
Simon Hunt | 5c1a938 | 2016-06-01 19:35:35 -0700 | [diff] [blame] | 360 | var linkData = { |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 361 | propOrder: order.slice(0), // makes a copy of the array |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 362 | props: { |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 363 | Type: linkType(data), |
Ray Milkey | b7f0f64 | 2016-01-22 16:08:14 -0800 | [diff] [blame] | 364 | Expected: linkExpected(data), |
Simon Hunt | a36f03b | 2015-04-01 15:22:49 -0700 | [diff] [blame] | 365 | |
| 366 | A_type: data.source.class, |
| 367 | A_id: data.source.id, |
| 368 | A_label: friendly(data.source), |
| 369 | A_port: data.srcPort, |
| 370 | |
| 371 | B_type: data.target.class, |
| 372 | B_id: data.target.id, |
| 373 | B_label: friendly(data.target), |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 374 | B_port: data.tgtPort, |
| 375 | }, |
Simon Hunt | 5c1a938 | 2016-06-01 19:35:35 -0700 | [diff] [blame] | 376 | }; |
| 377 | listProps(tbody, modifyCb(linkData, data.extra)); |
Simon Hunt | a36f03b | 2015-04-01 15:22:49 -0700 | [diff] [blame] | 378 | |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 379 | if (!edgeLink) { |
Simon Hunt | 5c1a938 | 2016-06-01 19:35:35 -0700 | [diff] [blame] | 380 | addSep(tbody); |
Simon Hunt | e25c5a2 | 2015-04-02 14:37:12 -0700 | [diff] [blame] | 381 | addProp(tbody, 'A → B', linkSummary(data.fromSource)); |
| 382 | addProp(tbody, 'B → A', linkSummary(data.fromTarget)); |
| 383 | } |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | function displayNothing() { |
| 387 | haveDetails = false; |
| 388 | hideDetailPanel(); |
| 389 | } |
| 390 | |
| 391 | function displaySomething() { |
| 392 | haveDetails = true; |
| 393 | if (useDetails) { |
| 394 | showDetailPanel(); |
| 395 | } |
| 396 | } |
| 397 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 398 | // === ----------------------------------------------------- |
| 399 | // Event Handlers |
| 400 | |
| 401 | function showSummary(data) { |
| 402 | populateSummary(data); |
| 403 | showSummaryPanel(); |
| 404 | } |
| 405 | |
Simon Hunt | 36a58c6 | 2015-04-08 11:00:07 -0700 | [diff] [blame] | 406 | function toggleSummary(x) { |
Simon Hunt | ee7a3ce | 2015-04-09 13:28:37 -0700 | [diff] [blame] | 407 | var kev = (x === 'keyev'), |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 408 | on = kev ? !summary.panel().isVisible() : !!x, |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 409 | verb = on ? topoLion('show') : topoLion('hide'), |
| 410 | sumpan = topoLion('fl_panel_summary'); |
Simon Hunt | 36a58c6 | 2015-04-08 11:00:07 -0700 | [diff] [blame] | 411 | |
| 412 | if (on) { |
Simon Hunt | a0eb0a8 | 2015-02-11 12:30:06 -0800 | [diff] [blame] | 413 | // ask server to start sending summary data. |
Simon Hunt | 237676b5 | 2015-03-10 19:04:26 -0700 | [diff] [blame] | 414 | wss.sendEvent('requestSummary'); |
Simon Hunt | a0eb0a8 | 2015-02-11 12:30:06 -0800 | [diff] [blame] | 415 | // note: the summary panel will appear, once data arrives |
Simon Hunt | 36a58c6 | 2015-04-08 11:00:07 -0700 | [diff] [blame] | 416 | } else { |
| 417 | hideSummaryPanel(); |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 418 | } |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 419 | flash.flash(verb + ' ' + sumpan); |
Simon Hunt | ee7a3ce | 2015-04-09 13:28:37 -0700 | [diff] [blame] | 420 | return on; |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 421 | } |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 422 | |
| 423 | // === ----------------------------------------------------- |
| 424 | // === LOGIC For showing/hiding summary and detail panels... |
| 425 | |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 426 | function showSummaryPanel() { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 427 | function _show() { |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 428 | summary.panel().show(); |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 429 | summary.adjustHeight(sumFromTop, sumMax); |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 430 | } |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 431 | if (detail.panel().isVisible()) { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 432 | detail.down(_show); |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 433 | } else { |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 434 | _show(); |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 435 | } |
Simon Hunt | c252aa6 | 2015-02-10 16:45:39 -0800 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | function hideSummaryPanel() { |
Simon Hunt | a0eb0a8 | 2015-02-11 12:30:06 -0800 | [diff] [blame] | 439 | // instruct server to stop sending summary data |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 440 | wss.sendEvent('cancelSummary'); |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 441 | summary.panel().hide(detail.up); |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 442 | } |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 443 | |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 444 | function showDetailPanel() { |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 445 | if (summary.panel().isVisible()) { |
| 446 | detail.down(detail.panel().show); |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 447 | } else { |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 448 | detail.up(detail.panel().show); |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 449 | } |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | function hideDetailPanel() { |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 453 | detail.panel().hide(); |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 454 | } |
| 455 | |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 456 | // ========================== |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 457 | |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 458 | function augmentDetailPanel() { |
Bri Prebilic Cole | d874546 | 2015-06-01 16:08:57 -0700 | [diff] [blame] | 459 | var d = detail, |
Simon Hunt | 8d47a5c | 2016-06-15 12:56:50 -0700 | [diff] [blame] | 460 | downPos = sumFromTop + sumMax + padFudge; |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 461 | d.ypos = { up: sumFromTop, down: downPos, current: downPos }; |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 462 | |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 463 | d._move = function (y, cb) { |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 464 | var yp = d.ypos, |
| 465 | endCb; |
| 466 | |
| 467 | if (fs.isF(cb)) { |
| 468 | endCb = function () { |
| 469 | cb(); |
| 470 | d.adjustHeight(d.ypos.current); |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 471 | }; |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 472 | } else { |
| 473 | endCb = function () { |
| 474 | d.adjustHeight(d.ypos.current); |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 475 | }; |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 476 | } |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 477 | if (yp.current !== y) { |
| 478 | yp.current = y; |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 479 | d.panel().el().transition().duration(300) |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 480 | .each('end', endCb) |
| 481 | .style('top', yp.current + 'px'); |
| 482 | } else { |
| 483 | endCb(); |
| 484 | } |
| 485 | }; |
| 486 | |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 487 | d.down = function (cb) { d._move(d.ypos.down, cb); }; |
| 488 | d.up = function (cb) { d._move(d.ypos.up, cb); }; |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 489 | } |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 490 | |
Simon Hunt | 239e588 | 2015-04-23 15:07:04 -0700 | [diff] [blame] | 491 | function toggleUseDetailsFlag(x) { |
Simon Hunt | ee7a3ce | 2015-04-09 13:28:37 -0700 | [diff] [blame] | 492 | var kev = (x === 'keyev'), |
| 493 | verb; |
| 494 | |
| 495 | useDetails = kev ? !useDetails : !!x; |
| 496 | verb = useDetails ? 'Enable' : 'Disable'; |
| 497 | |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 498 | if (useDetails) { |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 499 | if (haveDetails) { |
| 500 | showDetailPanel(); |
| 501 | } |
| 502 | } else { |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 503 | hideDetailPanel(); |
| 504 | } |
Simon Hunt | ee7a3ce | 2015-04-09 13:28:37 -0700 | [diff] [blame] | 505 | flash.flash(verb + ' details panel'); |
| 506 | return useDetails; |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 507 | } |
| 508 | |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 509 | // ========================== |
| 510 | |
Simon Hunt | 237676b5 | 2015-03-10 19:04:26 -0700 | [diff] [blame] | 511 | function initPanels() { |
Bri Prebilic Cole | d874546 | 2015-06-01 16:08:57 -0700 | [diff] [blame] | 512 | sumFromTop = mast.mastHeight() + padTop; |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 513 | summary = createTopoPanel(idSum, panelOpts); |
| 514 | detail = createTopoPanel(idDet, panelOpts); |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 515 | |
| 516 | augmentDetailPanel(); |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 517 | watchWindow(); |
Simon Hunt | 4b66859 | 2015-01-29 17:33:53 -0800 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | function destroyPanels() { |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 521 | summary.destroy(); |
| 522 | summary = null; |
| 523 | |
| 524 | detail.destroy(); |
| 525 | detail = null; |
Simon Hunt | 239e588 | 2015-04-23 15:07:04 -0700 | [diff] [blame] | 526 | haveDetails = false; |
Bri Prebilic Cole | 0a6ffb6 | 2015-06-04 09:32:12 -0700 | [diff] [blame] | 527 | unbindWatch(); |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | // ========================== |
| 531 | |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 532 | angular.module('ovTopo') |
| 533 | .factory('TopoPanelService', |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 534 | ['$log', '$window', '$rootScope', 'FnService', 'PanelService', 'GlyphService', |
Bri Prebilic Cole | d874546 | 2015-06-01 16:08:57 -0700 | [diff] [blame] | 535 | 'FlashService', 'WebSocketService', 'ButtonService', 'MastService', |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 536 | 'NavService', |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 537 | |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 538 | function (_$log_, _$window_, _$rootScope_, |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 539 | _fs_, _ps_, _gs_, _flash_, _wss_, _bns_, _mast_, _ns_) { |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 540 | $log = _$log_; |
Bri Prebilic Cole | 69d5f4e | 2015-05-19 15:59:55 -0700 | [diff] [blame] | 541 | $window = _$window_; |
| 542 | $rootScope = _$rootScope_; |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 543 | fs = _fs_; |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 544 | ps = _ps_; |
Simon Hunt | c9b7316 | 2015-01-29 14:02:15 -0800 | [diff] [blame] | 545 | gs = _gs_; |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 546 | flash = _flash_; |
Simon Hunt | 237676b5 | 2015-03-10 19:04:26 -0700 | [diff] [blame] | 547 | wss = _wss_; |
Bri Prebilic Cole | f5e48b1 | 2015-04-21 14:52:36 -0700 | [diff] [blame] | 548 | bns = _bns_; |
Bri Prebilic Cole | d874546 | 2015-06-01 16:08:57 -0700 | [diff] [blame] | 549 | mast = _mast_; |
Bri Prebilic Cole | 17c6d0a | 2015-07-16 14:56:40 -0700 | [diff] [blame] | 550 | ns = _ns_; |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 551 | |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 552 | return { |
| 553 | initPanels: initPanels, |
Simon Hunt | 626d210 | 2015-01-29 11:54:50 -0800 | [diff] [blame] | 554 | destroyPanels: destroyPanels, |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 555 | createTopoPanel: createTopoPanel, |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 556 | |
| 557 | showSummary: showSummary, |
Simon Hunt | 6036b19 | 2015-02-11 11:20:26 -0800 | [diff] [blame] | 558 | toggleSummary: toggleSummary, |
Thomas Vachuska | 0af2691 | 2016-03-21 21:37:30 -0700 | [diff] [blame] | 559 | hideSummary: hideSummaryPanel, |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 560 | |
Simon Hunt | 239e588 | 2015-04-23 15:07:04 -0700 | [diff] [blame] | 561 | toggleUseDetailsFlag: toggleUseDetailsFlag, |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 562 | displaySingle: displaySingle, |
| 563 | displayMulti: displayMulti, |
Simon Hunt | 0c6b2d3 | 2015-03-26 17:46:29 -0700 | [diff] [blame] | 564 | displayLink: displayLink, |
| 565 | displayNothing: displayNothing, |
| 566 | displaySomething: displaySomething, |
Bri Prebilic Cole | 684bcb7 | 2015-05-11 12:00:24 -0700 | [diff] [blame] | 567 | addAction: addAction, |
Simon Hunt | 08f841d0 | 2015-02-10 14:39:20 -0800 | [diff] [blame] | 568 | |
Bri Prebilic Cole | 35d2971 | 2015-05-11 16:01:32 -0700 | [diff] [blame] | 569 | detailVisible: function () { return detail.panel().isVisible(); }, |
Steven Burrows | 1c2a968 | 2017-07-14 16:52:46 +0100 | [diff] [blame] | 570 | summaryVisible: function () { return summary.panel().isVisible(); }, |
Simon Hunt | 879ce45 | 2017-08-10 23:32:00 -0700 | [diff] [blame] | 571 | |
| 572 | setLionBundle: function (bundle) { topoLion = bundle; }, |
Simon Hunt | b0ec1e5 | 2015-01-28 18:13:49 -0800 | [diff] [blame] | 573 | }; |
| 574 | }]); |
| 575 | }()); |