| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 nav_bar_element; | 5 library nav_bar_element; |
| 6 | 6 |
| 7 import 'dart:html' hide Notification; | |
| 8 import 'observatory_element.dart'; | 7 import 'observatory_element.dart'; |
| 9 import 'package:observatory/service.dart'; | 8 import 'package:observatory/service.dart'; |
| 10 import 'package:observatory/app.dart' show Notification; | |
| 11 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 12 | 10 |
| 13 @CustomTag('library-nav-menu') | 11 @CustomTag('library-nav-menu') |
| 14 class LibraryNavMenuElement extends ObservatoryElement { | 12 class LibraryNavMenuElement extends ObservatoryElement { |
| 15 @published Library library; | 13 @published Library library; |
| 16 @published bool last = false; | 14 @published bool last = false; |
| 17 | 15 |
| 18 LibraryNavMenuElement.created() : super.created(); | 16 LibraryNavMenuElement.created() : super.created(); |
| 19 } | 17 } |
| 20 | |
| 21 @CustomTag('nav-notify') | |
| 22 class NavNotifyElement extends ObservatoryElement { | |
| 23 @published ObservableList<Notification> notifications; | |
| 24 @published bool notifyOnPause = true; | |
| 25 | |
| 26 NavNotifyElement.created() : super.created(); | |
| 27 } | |
| 28 | |
| 29 @CustomTag('nav-notify-event') | |
| 30 class NavNotifyEventElement extends ObservatoryElement { | |
| 31 @published ObservableList<Notification> notifications; | |
| 32 @published Notification notification; | |
| 33 @published ServiceEvent event; | |
| 34 @published bool notifyOnPause = true; | |
| 35 | |
| 36 void closeItem(MouseEvent e, var detail, Element target) { | |
| 37 notifications.remove(notification); | |
| 38 } | |
| 39 | |
| 40 NavNotifyEventElement.created() : super.created(); | |
| 41 } | |
| 42 | |
| 43 @CustomTag('nav-notify-exception') | |
| 44 class NavNotifyExceptionElement extends ObservatoryElement { | |
| 45 @published ObservableList<Notification> notifications; | |
| 46 @published Notification notification; | |
| 47 @published var exception; | |
| 48 @published var stacktrace; | |
| 49 | |
| 50 exceptionChanged() { | |
| 51 notifyPropertyChange(#isNetworkError, true, false); | |
| 52 notifyPropertyChange(#isUnexpectedError, true, false); | |
| 53 } | |
| 54 | |
| 55 @observable get isNetworkError { | |
| 56 return (exception is NetworkRpcException); | |
| 57 } | |
| 58 | |
| 59 @observable get isUnexpectedError { | |
| 60 return (exception is! NetworkRpcException); | |
| 61 } | |
| 62 | |
| 63 void closeItem(MouseEvent e, var detail, Element target) { | |
| 64 notifications.remove(notification); | |
| 65 } | |
| 66 | |
| 67 NavNotifyExceptionElement.created() : super.created(); | |
| 68 } | |
| OLD | NEW |