service.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.MainServiceView = Em.View.extend({
  20. templateName:require('templates/main/service'),
  21. showAlertsPopup: function (event) {
  22. App.ModalPopup.show({
  23. header: this.t('services.alerts.headingOfList'),
  24. bodyClass: Ember.View.extend({
  25. service: event.context,
  26. warnAlerts: function () {
  27. var allAlerts = App.router.get('clusterController.alerts');
  28. var serviceId = this.get('service.serviceName');
  29. if (serviceId) {
  30. return allAlerts.filterProperty('serviceType', serviceId).filterProperty('isOk', false);
  31. }
  32. return 0;
  33. }.property('App.router.clusterController.alerts'),
  34. warnAlertsCount: function () {
  35. return this.get('warnAlerts').length;
  36. }.property('warnAlerts'),
  37. nagiosUrl: function () {
  38. return App.router.get('clusterController.nagiosUrl');
  39. }.property('App.router.clusterController.nagiosUrl'),
  40. closePopup: function () {
  41. this.get('parentView').hide();
  42. },
  43. selectService: function () {
  44. App.router.transitionTo('services.service.summary', event.context)
  45. this.closePopup();
  46. },
  47. templateName: require('templates/main/service/alert_notification_popup')
  48. }),
  49. primary: 'Close',
  50. onPrimary: function() {
  51. this.hide();
  52. },
  53. secondary : null,
  54. didInsertElement: function () {
  55. this.$().find('.modal-footer').addClass('align-center');
  56. }
  57. });
  58. }
  59. });