pluginsCtrl.js 686 B

123456789101112131415161718192021222324252627282930313233
  1. define([
  2. 'angular',
  3. 'app/core/config',
  4. ],
  5. function (angular, config) {
  6. 'use strict';
  7. var module = angular.module('grafana.controllers');
  8. module.controller('PluginsCtrl', function($scope, $location, pluginSrv) {
  9. $scope.init = function() {
  10. $scope.plugins = {};
  11. $scope.getPlugins();
  12. };
  13. $scope.getPlugins = function() {
  14. pluginSrv.getAll().then(function(result) {
  15. console.log(result);
  16. $scope.plugins = result;
  17. });
  18. };
  19. $scope.update = function(plugin) {
  20. pluginSrv.update(plugin).then(function() {
  21. window.location.href = config.appSubUrl + $location.path();
  22. });
  23. };
  24. $scope.init();
  25. });
  26. });