Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: runtime/observatory/lib/src/elements/logging.dart

Issue 2345023003: Use dartfmt on Observatory code (Closed)
Patch Set: merge Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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'; 11 import 'package:observatory/src/elements/helpers/nav_bar.dart';
12 import 'package:observatory/src/elements/helpers/nav_menu.dart'; 12 import 'package:observatory/src/elements/helpers/nav_menu.dart';
13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
14 import 'package:observatory/src/elements/helpers/tag.dart'; 14 import 'package:observatory/src/elements/helpers/tag.dart';
15 import 'package:observatory/src/elements/logging_list.dart'; 15 import 'package:observatory/src/elements/logging_list.dart';
16 import 'package:observatory/src/elements/nav/class_menu.dart'; 16 import 'package:observatory/src/elements/nav/class_menu.dart';
17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; 17 import 'package:observatory/src/elements/nav/isolate_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 =
26 dependencies: const [ 26 const Tag<LoggingPageElement>('logging-page', dependencies: const [
27 LoggingListElement.tag, 27 LoggingListElement.tag,
28 NavClassMenuElement.tag, 28 NavClassMenuElement.tag,
29 NavTopMenuElement.tag, 29 NavTopMenuElement.tag,
30 NavVMMenuElement.tag, 30 NavVMMenuElement.tag,
31 NavIsolateMenuElement.tag, 31 NavIsolateMenuElement.tag,
32 NavRefreshElement.tag, 32 NavRefreshElement.tag,
33 NavNotifyElement.tag, 33 NavNotifyElement.tag,
34 ViewFooterElement.tag 34 ViewFooterElement.tag
35 ]); 35 ]);
36 36
37 RenderingScheduler<LoggingPageElement> _r; 37 RenderingScheduler<LoggingPageElement> _r;
38 38
39 Stream<RenderedEvent<LoggingPageElement>> get onRendered => _r.onRendered; 39 Stream<RenderedEvent<LoggingPageElement>> get onRendered => _r.onRendered;
40 40
41 M.VM _vm; 41 M.VM _vm;
42 M.IsolateRef _isolate; 42 M.IsolateRef _isolate;
43 M.EventRepository _events; 43 M.EventRepository _events;
44 M.NotificationRepository _notifications; 44 M.NotificationRepository _notifications;
45 Level _level = Level.ALL; 45 Level _level = Level.ALL;
46 46
47
48 M.VMRef get vm => _vm; 47 M.VMRef get vm => _vm;
49 M.IsolateRef get isolate => _isolate; 48 M.IsolateRef get isolate => _isolate;
50 M.NotificationRepository get notifications => _notifications; 49 M.NotificationRepository get notifications => _notifications;
51 50
52 factory LoggingPageElement(M.VM vm, M.IsolateRef isolate, 51 factory LoggingPageElement(M.VM vm, M.IsolateRef isolate,
53 M.EventRepository events, 52 M.EventRepository events, M.NotificationRepository notifications,
54 M.NotificationRepository notifications, 53 {RenderingQueue queue}) {
55 {RenderingQueue queue}) {
56 assert(vm != null); 54 assert(vm != null);
57 assert(isolate != null); 55 assert(isolate != null);
58 assert(events != null); 56 assert(events != null);
59 assert(notifications != null); 57 assert(notifications != null);
60 LoggingPageElement e = document.createElement(tag.name); 58 LoggingPageElement e = document.createElement(tag.name);
61 e._r = new RenderingScheduler(e, queue: queue); 59 e._r = new RenderingScheduler(e, queue: queue);
62 e._vm = vm; 60 e._vm = vm;
63 e._isolate = isolate; 61 e._isolate = isolate;
64 e._events = events; 62 e._events = events;
65 e._notifications = notifications; 63 e._notifications = notifications;
(...skipping 20 matching lines...) Expand all
86 void render() { 84 void render() {
87 _logs = _logs ?? new LoggingListElement(_isolate, _events); 85 _logs = _logs ?? new LoggingListElement(_isolate, _events);
88 _logs.level = _level; 86 _logs.level = _level;
89 children = [ 87 children = [
90 navBar([ 88 navBar([
91 new NavTopMenuElement(queue: _r.queue), 89 new NavTopMenuElement(queue: _r.queue),
92 new NavVMMenuElement(_vm, _events, queue: _r.queue), 90 new NavVMMenuElement(_vm, _events, queue: _r.queue),
93 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), 91 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
94 navMenu('logging'), 92 navMenu('logging'),
95 new NavRefreshElement(label: 'clear', queue: _r.queue) 93 new NavRefreshElement(label: 'clear', queue: _r.queue)
96 ..onRefresh.listen((e) async { 94 ..onRefresh.listen((e) async {
97 e.element.disabled = true; 95 e.element.disabled = true;
98 _logs = null; 96 _logs = null;
99 _r.dirty(); 97 _r.dirty();
100 }), 98 }),
101 new NavNotifyElement(_notifications, queue: _r.queue) 99 new NavNotifyElement(_notifications, queue: _r.queue)
102 ]), 100 ]),
103 new DivElement()..classes = ['content-centered-big'] 101 new DivElement()
102 ..classes = ['content-centered-big']
104 ..children = [ 103 ..children = [
105 new HeadingElement.h2()..text = 'Logging', 104 new HeadingElement.h2()..text = 'Logging',
106 new SpanElement() 105 new SpanElement()..text = 'Show messages with severity ',
107 ..text = 'Show messages with severity ',
108 _createLevelSelector(), 106 _createLevelSelector(),
109 new HRElement(), 107 new HRElement(),
110 _logs 108 _logs
111 ] 109 ]
112 ]; 110 ];
113 } 111 }
114 112
115 Element _createLevelSelector() { 113 Element _createLevelSelector() {
116 var s = new SelectElement() 114 var s = new SelectElement()
117 ..value = _level.name 115 ..value = _level.name
118 ..children = Level.LEVELS.map((level) { 116 ..children = Level.LEVELS.map((level) {
119 return new OptionElement(value : level.name, 117 return new OptionElement(value: level.name, selected: _level == level)
120 selected: _level == level) 118 ..text = level.name;
121 ..text = level.name; 119 }).toList(growable: false);
122 }).toList(growable: false);
123 s.onChange.listen((_) { 120 s.onChange.listen((_) {
124 _level = Level.LEVELS[s.selectedIndex]; 121 _level = Level.LEVELS[s.selectedIndex];
125 _r.dirty(); 122 _r.dirty();
126 }); 123 });
127 return s; 124 return s;
128 } 125 }
129 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698