utilSrv.js 593 B

12345678910111213141516171819202122232425262728293031
  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);
  10. };
  11. this.showModal = function(e, options) {
  12. var modal = $modal({
  13. template: options.src,
  14. persist: false,
  15. show: false,
  16. scope: options.scope,
  17. keyboard: false
  18. });
  19. $q.when(modal).then(function(modalEl) {
  20. modalEl.modal('show');
  21. });
  22. };
  23. });
  24. });