OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:html'; | 5 import 'dart:html'; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 8 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 9 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 10 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
10 import 'package:observatory/src/elements/helpers/tag.dart'; | 12 import 'package:observatory/src/elements/helpers/tag.dart'; |
11 import 'package:observatory/src/elements/helpers/uris.dart'; | 13 import 'package:observatory/src/elements/helpers/uris.dart'; |
12 import 'package:observatory/src/elements/instance_ref.dart'; | 14 import 'package:observatory/src/elements/instance_ref.dart'; |
13 import 'package:observatory/src/elements/nav/bar.dart'; | |
14 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 15 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
15 import 'package:observatory/src/elements/nav/menu.dart'; | |
16 import 'package:observatory/src/elements/nav/notify.dart'; | 16 import 'package:observatory/src/elements/nav/notify.dart'; |
17 import 'package:observatory/src/elements/nav/refresh.dart'; | 17 import 'package:observatory/src/elements/nav/refresh.dart'; |
18 import 'package:observatory/src/elements/nav/top_menu.dart'; | 18 import 'package:observatory/src/elements/nav/top_menu.dart'; |
19 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 19 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
20 import 'package:observatory/src/elements/view_footer.dart'; | 20 import 'package:observatory/src/elements/view_footer.dart'; |
21 | 21 |
22 class PortsElement extends HtmlElement implements Renderable { | 22 class PortsElement extends HtmlElement implements Renderable { |
23 static const tag = const Tag<PortsElement>('ports-page', | 23 static const tag = const Tag<PortsElement>('ports-page', |
24 dependencies: const [ | 24 dependencies: const [ |
25 NavBarElement.tag, | |
26 NavTopMenuElement.tag, | 25 NavTopMenuElement.tag, |
27 NavVMMenuElement.tag, | 26 NavVMMenuElement.tag, |
28 NavIsolateMenuElement.tag, | 27 NavIsolateMenuElement.tag, |
29 NavMenuElement.tag, | |
30 NavRefreshElement.tag, | 28 NavRefreshElement.tag, |
31 NavNotifyElement.tag, | 29 NavNotifyElement.tag, |
32 InstanceRefElement.tag, | 30 InstanceRefElement.tag, |
33 ViewFooterElement.tag | 31 ViewFooterElement.tag |
34 ]); | 32 ]); |
35 | 33 |
36 RenderingScheduler<PortsElement> _r; | 34 RenderingScheduler<PortsElement> _r; |
37 | 35 |
38 Stream<RenderedEvent<PortsElement>> get onRendered => _r.onRendered; | 36 Stream<RenderedEvent<PortsElement>> get onRendered => _r.onRendered; |
39 | 37 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 83 |
86 @override | 84 @override |
87 void detached() { | 85 void detached() { |
88 super.detached(); | 86 super.detached(); |
89 children = []; | 87 children = []; |
90 _r.disable(notify: true); | 88 _r.disable(notify: true); |
91 } | 89 } |
92 | 90 |
93 void render() { | 91 void render() { |
94 children = [ | 92 children = [ |
95 new NavBarElement(queue: _r.queue) | 93 navBar([ |
96 ..children = [ | 94 new NavTopMenuElement(queue: _r.queue), |
97 new NavTopMenuElement(queue: _r.queue), | 95 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
98 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 96 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
99 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 97 navMenu('ports'), |
100 new NavMenuElement('ports', link: Uris.ports(_isolate), last: true, | 98 new NavRefreshElement(queue: _r.queue) |
101 queue: _r.queue), | 99 ..onRefresh.listen((_) => _refresh()), |
102 new NavRefreshElement(queue: _r.queue) | 100 new NavNotifyElement(_notifications, queue: _r.queue) |
103 ..onRefresh.listen((_) => _refresh()), | 101 ]), |
104 new NavNotifyElement(_notifications, queue: _r.queue) | |
105 ], | |
106 new DivElement() | 102 new DivElement() |
107 ..classes = ['content-centered'] | 103 ..classes = ['content-centered'] |
108 ..children = [ | 104 ..children = [ |
109 new HeadingElement.h1()..text = 'Ports', | 105 new HeadingElement.h1()..text = 'Ports', |
110 new BRElement(), new HRElement(), | 106 new BRElement(), new HRElement(), |
111 new DivElement() | 107 new DivElement() |
112 ..children = _createList(), | 108 ..children = _createList(), |
113 new HRElement() | 109 new HRElement() |
114 ], | 110 ], |
115 new ViewFooterElement(queue: _r.queue) | 111 new ViewFooterElement(queue: _r.queue) |
(...skipping 22 matching lines...) Expand all Loading... |
138 ).toList(); | 134 ).toList(); |
139 } | 135 } |
140 | 136 |
141 Future _refresh() async { | 137 Future _refresh() async { |
142 _isolatePorts = null; | 138 _isolatePorts = null; |
143 _r.dirty(); | 139 _r.dirty(); |
144 _isolatePorts = await _ports.get(_isolate); | 140 _isolatePorts = await _ports.get(_isolate); |
145 _r.dirty(); | 141 _r.dirty(); |
146 } | 142 } |
147 } | 143 } |
OLD | NEW |