| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 library script_view_element; | |
| 6 | |
| 7 import 'dart:html'; | |
| 8 import 'package:logging/logging.dart'; | |
| 9 import 'package:polymer/polymer.dart'; | |
| 10 import 'observatory_element.dart'; | |
| 11 | |
| 12 /// Displays an Error response. | |
| 13 @CustomTag('script-view') | |
| 14 class ScriptViewElement extends ObservatoryElement { | |
| 15 @published Script script; | |
| 16 | |
| 17 String hitsStyle(ScriptLine line) { | |
| 18 if (line.hits == -1) { | |
| 19 return 'min-width:32px;'; | |
| 20 } else if (line.hits == 0) { | |
| 21 return 'min-width:32px;background-color:red'; | |
| 22 } | |
| 23 return 'min-width:32px;background-color:green'; | |
| 24 } | |
| 25 | |
| 26 void refreshCoverage(Event e, var detail, Node target) { | |
| 27 var isolateId = app.locationManager.currentIsolateId(); | |
| 28 var isolate = app.isolateManager.getIsolate(isolateId); | |
| 29 if (isolate == null) { | |
| 30 Logger.root.info('No isolate found.'); | |
| 31 return; | |
| 32 } | |
| 33 var request = '/$isolateId/coverage'; | |
| 34 app.requestManager.requestMap(request).then((Map coverage) { | |
| 35 assert(coverage['type'] == 'CodeCoverage'); | |
| 36 isolate.updateCoverage(coverage['coverage']); | |
| 37 notifyPropertyChange(#hitsStyle, "", hitsStyle); | |
| 38 }).catchError((e, st) { | |
| 39 print('refreshCoverage $e $st'); | |
| 40 }); | |
| 41 } | |
| 42 | |
| 43 ScriptViewElement.created() : super.created(); | |
| 44 } | |
| OLD | NEW |