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 logging_page; | 5 library logging_page; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
10 import 'package:observatory/models.dart' as M; | 10 import 'package:observatory/models.dart' as M; |
| 11 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 12 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
12 import 'package:observatory/src/elements/helpers/tag.dart'; | 14 import 'package:observatory/src/elements/helpers/tag.dart'; |
13 import 'package:observatory/src/elements/logging_list.dart'; | 15 import 'package:observatory/src/elements/logging_list.dart'; |
14 import 'package:observatory/src/elements/nav/bar.dart'; | |
15 import 'package:observatory/src/elements/nav/class_menu.dart'; | 16 import 'package:observatory/src/elements/nav/class_menu.dart'; |
16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
17 import 'package:observatory/src/elements/nav/menu.dart'; | |
18 import 'package:observatory/src/elements/nav/notify.dart'; | 18 import 'package:observatory/src/elements/nav/notify.dart'; |
19 import 'package:observatory/src/elements/nav/refresh.dart'; | 19 import 'package:observatory/src/elements/nav/refresh.dart'; |
20 import 'package:observatory/src/elements/nav/top_menu.dart'; | 20 import 'package:observatory/src/elements/nav/top_menu.dart'; |
21 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 21 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
22 import 'package:observatory/src/elements/view_footer.dart'; | 22 import 'package:observatory/src/elements/view_footer.dart'; |
23 | 23 |
24 class LoggingPageElement extends HtmlElement implements Renderable { | 24 class LoggingPageElement extends HtmlElement implements Renderable { |
25 static const tag = const Tag<LoggingPageElement>('logging-page', | 25 static const tag = const Tag<LoggingPageElement>('logging-page', |
26 dependencies: const [ | 26 dependencies: const [ |
27 LoggingListElement.tag, | 27 LoggingListElement.tag, |
28 NavBarElement.tag, | |
29 NavClassMenuElement.tag, | 28 NavClassMenuElement.tag, |
30 NavTopMenuElement.tag, | 29 NavTopMenuElement.tag, |
31 NavVMMenuElement.tag, | 30 NavVMMenuElement.tag, |
32 NavIsolateMenuElement.tag, | 31 NavIsolateMenuElement.tag, |
33 NavMenuElement.tag, | |
34 NavRefreshElement.tag, | 32 NavRefreshElement.tag, |
35 NavNotifyElement.tag, | 33 NavNotifyElement.tag, |
36 ViewFooterElement.tag | 34 ViewFooterElement.tag |
37 ]); | 35 ]); |
38 | 36 |
39 RenderingScheduler<LoggingPageElement> _r; | 37 RenderingScheduler<LoggingPageElement> _r; |
40 | 38 |
41 Stream<RenderedEvent<LoggingPageElement>> get onRendered => _r.onRendered; | 39 Stream<RenderedEvent<LoggingPageElement>> get onRendered => _r.onRendered; |
42 | 40 |
43 M.VM _vm; | 41 M.VM _vm; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 _r.disable(notify: true); | 80 _r.disable(notify: true); |
83 children = []; | 81 children = []; |
84 } | 82 } |
85 | 83 |
86 LoggingListElement _logs; | 84 LoggingListElement _logs; |
87 | 85 |
88 void render() { | 86 void render() { |
89 _logs = _logs ?? new LoggingListElement(_isolate, _events); | 87 _logs = _logs ?? new LoggingListElement(_isolate, _events); |
90 _logs.level = _level; | 88 _logs.level = _level; |
91 children = [ | 89 children = [ |
92 new NavBarElement(queue: _r.queue) | 90 navBar([ |
93 ..children = [ | 91 new NavTopMenuElement(queue: _r.queue), |
94 new NavTopMenuElement(queue: _r.queue), | 92 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
95 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 93 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
96 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 94 navMenu('logging'), |
97 new NavMenuElement('logging', last: true, queue: _r.queue), | 95 new NavRefreshElement(label: 'clear', queue: _r.queue) |
98 new NavRefreshElement(label: 'clear', queue: _r.queue) | 96 ..onRefresh.listen((e) async { |
99 ..onRefresh.listen((e) async { | 97 e.element.disabled = true; |
100 e.element.disabled = true; | 98 _logs = null; |
101 _logs = null; | 99 _r.dirty(); |
102 _r.dirty(); | 100 }), |
103 }), | 101 new NavNotifyElement(_notifications, queue: _r.queue) |
104 new NavNotifyElement(_notifications, queue: _r.queue) | 102 ]), |
105 ], | |
106 new DivElement()..classes = ['content-centered-big'] | 103 new DivElement()..classes = ['content-centered-big'] |
107 ..children = [ | 104 ..children = [ |
108 new HeadingElement.h2()..text = 'Logging', | 105 new HeadingElement.h2()..text = 'Logging', |
109 new SpanElement() | 106 new SpanElement() |
110 ..text = 'Show messages with severity ', | 107 ..text = 'Show messages with severity ', |
111 _createLevelSelector(), | 108 _createLevelSelector(), |
112 new HRElement(), | 109 new HRElement(), |
113 _logs | 110 _logs |
114 ] | 111 ] |
115 ]; | 112 ]; |
116 } | 113 } |
117 | 114 |
118 Element _createLevelSelector() { | 115 Element _createLevelSelector() { |
119 var s = new SelectElement() | 116 var s = new SelectElement() |
120 ..value = _level.name | 117 ..value = _level.name |
121 ..children = Level.LEVELS.map((level) { | 118 ..children = Level.LEVELS.map((level) { |
122 return new OptionElement(value : level.name, | 119 return new OptionElement(value : level.name, |
123 selected: _level == level) | 120 selected: _level == level) |
124 ..text = level.name; | 121 ..text = level.name; |
125 }).toList(growable: false); | 122 }).toList(growable: false); |
126 s.onChange.listen((_) { | 123 s.onChange.listen((_) { |
127 _level = Level.LEVELS[s.selectedIndex]; | 124 _level = Level.LEVELS[s.selectedIndex]; |
128 _r.dirty(); | 125 _r.dirty(); |
129 }); | 126 }); |
130 return s; | 127 return s; |
131 } | 128 } |
132 } | 129 } |
OLD | NEW |