utilSrv.js 645 B

1234567891011121314151617181920212223242526272829303132
  1. define([
  2. 'angular',
  3. ],
  4. function (angular) {
  5. 'use strict';
  6. var module = angular.module('grafana.services');
  7. module.service('utilSrv', function($rootScope, $modal, $q) {
  8. this.init = function() {
  9. $rootScope.onAppEvent('show-modal', this.showModal, $rootScope);
  10. };
  11. this.showModal = function(e, options) {
  12. var modal = $modal({
  13. modalClass: options.modalClass,
  14. template: options.src,
  15. persist: false,
  16. show: false,
  17. scope: options.scope,
  18. keyboard: false
  19. });
  20. $q.when(modal).then(function(modalEl) {
  21. modalEl.modal('show');
  22. });
  23. };
  24. });
  25. });