app_list_ctrl.ts 717 B

1234567891011121314151617181920212223242526272829303132
  1. ///<reference path="../../headers/common.d.ts" />
  2. import config = require('app/core/config');
  3. import angular from 'angular';
  4. export class AppListCtrl {
  5. /** @ngInject */
  6. constructor($scope: any, appSrv: any, $location: any) {
  7. $scope.init = function() {
  8. $scope.apps = {};
  9. $scope.getApps();
  10. };
  11. $scope.getApps = function() {
  12. appSrv.getAll().then(function(result) {
  13. $scope.apps = result;
  14. });
  15. };
  16. $scope.update = function(app) {
  17. appSrv.update(app).then(function() {
  18. window.location.href = config.appSubUrl + $location.path();
  19. });
  20. };
  21. $scope.init();
  22. }
  23. }
  24. angular.module('grafana.controllers').controller('AppListCtrl', AppListCtrl);