OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library metrics; | 5 library metrics; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
| 10 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 11 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | 13 import 'package:observatory/src/elements/helpers/tag.dart'; |
12 import 'package:observatory/src/elements/metric/details.dart'; | 14 import 'package:observatory/src/elements/metric/details.dart'; |
13 import 'package:observatory/src/elements/metric/graph.dart'; | 15 import 'package:observatory/src/elements/metric/graph.dart'; |
14 import 'package:observatory/src/elements/nav/bar.dart'; | |
15 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
16 import 'package:observatory/src/elements/nav/menu.dart'; | |
17 import 'package:observatory/src/elements/nav/notify.dart'; | 17 import 'package:observatory/src/elements/nav/notify.dart'; |
18 import 'package:observatory/src/elements/nav/refresh.dart'; | 18 import 'package:observatory/src/elements/nav/refresh.dart'; |
19 import 'package:observatory/src/elements/nav/top_menu.dart'; | 19 import 'package:observatory/src/elements/nav/top_menu.dart'; |
20 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 20 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
21 | 21 |
22 class MetricsPageElement extends HtmlElement implements Renderable { | 22 class MetricsPageElement extends HtmlElement implements Renderable { |
23 static const tag = const Tag<MetricsPageElement>('metrics-page', | 23 static const tag = const Tag<MetricsPageElement>('metrics-page', |
24 dependencies: const [ | 24 dependencies: const [ |
25 MetricDetailsElement.tag, | 25 MetricDetailsElement.tag, |
26 MetricGraphElement.tag, | 26 MetricGraphElement.tag, |
27 NavBarElement.tag, | |
28 NavTopMenuElement.tag, | 27 NavTopMenuElement.tag, |
29 NavVMMenuElement.tag, | 28 NavVMMenuElement.tag, |
30 NavIsolateMenuElement.tag, | 29 NavIsolateMenuElement.tag, |
31 NavMenuElement.tag, | |
32 NavRefreshElement.tag, | 30 NavRefreshElement.tag, |
33 NavNotifyElement.tag, | 31 NavNotifyElement.tag, |
34 ]); | 32 ]); |
35 | 33 |
36 RenderingScheduler<MetricsPageElement> _r; | 34 RenderingScheduler<MetricsPageElement> _r; |
37 | 35 |
38 Stream<RenderedEvent<MetricsPageElement>> get onRendered => _r.onRendered; | 36 Stream<RenderedEvent<MetricsPageElement>> get onRendered => _r.onRendered; |
39 | 37 |
40 M.VM _vm; | 38 M.VM _vm; |
41 M.IsolateRef _isolate; | 39 M.IsolateRef _isolate; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 78 |
81 @override | 79 @override |
82 detached() { | 80 detached() { |
83 super.detached(); | 81 super.detached(); |
84 _r.disable(notify: true); | 82 _r.disable(notify: true); |
85 children = []; | 83 children = []; |
86 } | 84 } |
87 | 85 |
88 void render() { | 86 void render() { |
89 children = [ | 87 children = [ |
90 new NavBarElement(queue: _r.queue) | 88 navBar([ |
91 ..children = [ | 89 new NavTopMenuElement(queue: _r.queue), |
92 new NavTopMenuElement(queue: _r.queue), | 90 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
93 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 91 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
94 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 92 navMenu('metrics'), |
95 new NavMenuElement('metrics', last: true, queue: _r.queue), | 93 new NavRefreshElement(queue: _r.queue) |
96 new NavRefreshElement(queue: _r.queue) | 94 ..onRefresh.listen((e) { |
97 ..onRefresh.listen((e) { | 95 e.element.disabled = true; |
98 e.element.disabled = true; | 96 _refresh(); |
99 _refresh(); | 97 }), |
100 }), | 98 new NavNotifyElement(_notifications, queue: _r.queue) |
101 new NavNotifyElement(_notifications, queue: _r.queue) | 99 ]), |
102 ], | |
103 new DivElement()..classes = ['content-centered-big'] | 100 new DivElement()..classes = ['content-centered-big'] |
104 ..children = [ | 101 ..children = [ |
105 new HeadingElement.h2()..text = 'Metrics', | 102 new HeadingElement.h2()..text = 'Metrics', |
106 new HRElement(), | 103 new HRElement(), |
107 new DivElement()..classes = ['memberList'] | 104 new DivElement()..classes = ['memberList'] |
108 ..children = [ | 105 ..children = [ |
109 new DivElement()..classes = ['memberItem'] | 106 new DivElement()..classes = ['memberItem'] |
110 ..children = [ | 107 ..children = [ |
111 new DivElement()..classes = ['memberName'] | 108 new DivElement()..classes = ['memberName'] |
112 ..text = 'Metric', | 109 ..text = 'Metric', |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 selected: _selected == metric) | 149 selected: _selected == metric) |
153 ..text = metric.name; | 150 ..text = metric.name; |
154 }).toList(growable: false) | 151 }).toList(growable: false) |
155 ..onChange.listen((_) { | 152 ..onChange.listen((_) { |
156 _selected = _available[s.selectedIndex]; | 153 _selected = _available[s.selectedIndex]; |
157 _r.dirty(); | 154 _r.dirty(); |
158 }) | 155 }) |
159 ]; | 156 ]; |
160 } | 157 } |
161 } | 158 } |
OLD | NEW |