appsCtrl.js 627 B

1234567891011121314151617181920212223242526272829303132
  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('AppsCtrl', function($scope, $location, appSrv) {
  9. $scope.init = function() {
  10. $scope.apps = {};
  11. $scope.getApps();
  12. };
  13. $scope.getApps = function() {
  14. appSrv.getAll().then(function(result) {
  15. $scope.apps = result;
  16. });
  17. };
  18. $scope.update = function(app) {
  19. appSrv.update(app).then(function() {
  20. window.location.href = config.appSubUrl + $location.path();
  21. });
  22. };
  23. $scope.init();
  24. });
  25. });