| 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 | 18 |
| 21 @CustomTag('class-nav-menu') | 19 @CustomTag('class-nav-menu') |
| 22 class ClassNavMenuElement extends ObservatoryElement { | 20 class ClassNavMenuElement extends ObservatoryElement { |
| 23 @published Class cls; | 21 @published Class cls; |
| 24 @published bool last = false; | 22 @published bool last = false; |
| 25 | 23 |
| 26 ClassNavMenuElement.created() : super.created(); | 24 ClassNavMenuElement.created() : super.created(); |
| 27 } | 25 } |
| 28 | |
| 29 @CustomTag('nav-notify') | |
| 30 class NavNotifyElement extends ObservatoryElement { | |
| 31 @published ObservableList<Notification> notifications; | |
| 32 @published bool notifyOnPause = true; | |
| 33 | |
| 34 NavNotifyElement.created() : super.created(); | |
| 35 } | |
| 36 | |
| 37 @CustomTag('nav-notify-event') | |
| 38 class NavNotifyEventElement extends ObservatoryElement { | |
| 39 @published ObservableList<Notification> notifications; | |
| 40 @published Notification notification; | |
| 41 @published ServiceEvent event; | |
| 42 @published bool notifyOnPause = true; | |
| 43 | |
| 44 void closeItem(MouseEvent e, var detail, Element target) { | |
| 45 notifications.remove(notification); | |
| 46 } | |
| 47 | |
| 48 NavNotifyEventElement.created() : super.created(); | |
| 49 } | |
| 50 | |
| 51 @CustomTag('nav-notify-exception') | |
| 52 class NavNotifyExceptionElement extends ObservatoryElement { | |
| 53 @published ObservableList<Notification> notifications; | |
| 54 @published Notification notification; | |
| 55 @published var exception; | |
| 56 @published var stacktrace; | |
| 57 | |
| 58 exceptionChanged() { | |
| 59 notifyPropertyChange(#isNetworkError, true, false); | |
| 60 notifyPropertyChange(#isUnexpectedError, true, false); | |
| 61 } | |
| 62 | |
| 63 @observable get isNetworkError { | |
| 64 return (exception is NetworkRpcException); | |
| 65 } | |
| 66 | |
| 67 @observable get isUnexpectedError { | |
| 68 return (exception is! NetworkRpcException); | |
| 69 } | |
| 70 | |
| 71 void closeItem(MouseEvent e, var detail, Element target) { | |
| 72 notifications.remove(notification); | |
| 73 } | |
| 74 | |
| 75 NavNotifyExceptionElement.created() : super.created(); | |
| 76 } | |
| OLD | NEW |