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 library timeline_page_element; | 5 library timeline_page_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'package:observatory/service.dart' as S; | 10 import 'package:observatory/service.dart' as S; |
11 import 'package:observatory/service_html.dart' as SH; | 11 import 'package:observatory/service_html.dart' as SH; |
12 import 'package:observatory/models.dart' as M; | 12 import 'package:observatory/models.dart' as M; |
| 13 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 14 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
14 import 'package:observatory/src/elements/helpers/tag.dart'; | 15 import 'package:observatory/src/elements/helpers/tag.dart'; |
15 import 'package:observatory/src/elements/nav/bar.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 | 20 |
21 enum _Profile { | 21 enum _Profile { |
22 none, | 22 none, |
23 dart, | 23 dart, |
24 vm, | 24 vm, |
25 all, | 25 all, |
26 custom | 26 custom |
27 } | 27 } |
28 | 28 |
29 class TimelinePageElement extends HtmlElement implements Renderable { | 29 class TimelinePageElement extends HtmlElement implements Renderable { |
30 static const tag = const Tag<TimelinePageElement>('timeline-page', | 30 static const tag = const Tag<TimelinePageElement>('timeline-page', |
31 dependencies: const [ | 31 dependencies: const [ |
32 NavBarElement.tag, | |
33 NavTopMenuElement.tag, | 32 NavTopMenuElement.tag, |
34 NavVMMenuElement.tag, | 33 NavVMMenuElement.tag, |
35 NavRefreshElement.tag, | 34 NavRefreshElement.tag, |
36 NavNotifyElement.tag | 35 NavNotifyElement.tag |
37 ]); | 36 ]); |
38 | 37 |
39 RenderingScheduler<TimelinePageElement> _r; | 38 RenderingScheduler<TimelinePageElement> _r; |
40 | 39 |
41 Stream<RenderedEvent<TimelinePageElement>> get onRendered => _r.onRendered; | 40 Stream<RenderedEvent<TimelinePageElement>> get onRendered => _r.onRendered; |
42 | 41 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 new DivElement()..classes = ['memberName'] | 113 new DivElement()..classes = ['memberName'] |
115 ..text = 'Recorded Streams:', | 114 ..text = 'Recorded Streams:', |
116 new DivElement()..classes = ['memberValue'] | 115 new DivElement()..classes = ['memberValue'] |
117 ..children = | 116 ..children = |
118 _availableStreams.map(_makeStreamToggle).toList() | 117 _availableStreams.map(_makeStreamToggle).toList() |
119 ] | 118 ] |
120 ] | 119 ] |
121 ]; | 120 ]; |
122 if (children.isEmpty) { | 121 if (children.isEmpty) { |
123 children = [ | 122 children = [ |
124 new NavBarElement(queue: _r.queue) | 123 navBar([ |
125 ..children = [ | 124 new NavTopMenuElement(queue: _r.queue), |
126 new NavTopMenuElement(queue: _r.queue), | 125 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
127 new NavVMMenuElement(_vm, _events, last: true, queue: _r.queue), | 126 new NavRefreshElement(queue: _r.queue) |
128 new NavRefreshElement(queue: _r.queue) | 127 ..onRefresh.listen((e) async { |
129 ..onRefresh.listen((e) async { | 128 e.element.disabled = true; |
130 e.element.disabled = true; | 129 await _refresh(); |
131 await _refresh(); | 130 e.element.disabled = false; |
132 e.element.disabled = false; | 131 }), |
133 }), | 132 new NavRefreshElement(label: 'clear', queue: _r.queue) |
134 new NavRefreshElement(label: 'clear', queue: _r.queue) | 133 ..onRefresh.listen((e) async { |
135 ..onRefresh.listen((e) async { | 134 e.element.disabled = true; |
136 e.element.disabled = true; | 135 await _clear(); |
137 await _clear(); | 136 e.element.disabled = false; |
138 e.element.disabled = false; | 137 }), |
139 }), | 138 new NavRefreshElement(label: 'save', queue: _r.queue) |
140 new NavRefreshElement(label: 'save', queue: _r.queue) | 139 ..onRefresh.listen((e) async { |
141 ..onRefresh.listen((e) async { | 140 e.element.disabled = true; |
142 e.element.disabled = true; | 141 await _save(); |
143 await _save(); | 142 e.element.disabled = false; |
144 e.element.disabled = false; | 143 }), |
145 }), | 144 new NavRefreshElement(label: 'load', queue: _r.queue) |
146 new NavRefreshElement(label: 'load', queue: _r.queue) | 145 ..onRefresh.listen((e) async { |
147 ..onRefresh.listen((e) async { | 146 e.element.disabled = true; |
148 e.element.disabled = true; | 147 await _load(); |
149 await _load(); | 148 e.element.disabled = false; |
150 e.element.disabled = false; | 149 }), |
151 }), | 150 new NavNotifyElement(_notifications, queue: _r.queue) |
152 new NavNotifyElement(_notifications, queue: _r.queue) | 151 ]), |
153 ], | |
154 _content, | 152 _content, |
155 new DivElement()..classes = ['iframe'] | 153 new DivElement()..classes = ['iframe'] |
156 ..children = [ | 154 ..children = [ |
157 _frame | 155 _frame |
158 ] | 156 ] |
159 ]; | 157 ]; |
160 } | 158 } |
161 } | 159 } |
162 | 160 |
163 List<Element> _createProfileSelect() { | 161 List<Element> _createProfileSelect() { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 _availableStreams.clear(); | 309 _availableStreams.clear(); |
312 response['availableStreams'].forEach( | 310 response['availableStreams'].forEach( |
313 (String streamName) => _availableStreams.add(streamName)); | 311 (String streamName) => _availableStreams.add(streamName)); |
314 // Update the set of recorded streams. | 312 // Update the set of recorded streams. |
315 _recordedStreams.clear(); | 313 _recordedStreams.clear(); |
316 response['recordedStreams'].forEach( | 314 response['recordedStreams'].forEach( |
317 (String streamName) => _recordedStreams.add(streamName)); | 315 (String streamName) => _recordedStreams.add(streamName)); |
318 _r.dirty(); | 316 _r.dirty(); |
319 } | 317 } |
320 } | 318 } |
OLD | NEW |