edit_ctrl.ts 646 B

12345678910111213141516171819202122232425262728
  1. ///<reference path="../../headers/common.d.ts" />
  2. import config from 'app/core/config';
  3. import angular from 'angular';
  4. import _ from 'lodash';
  5. export class AppEditCtrl {
  6. appModel: any;
  7. /** @ngInject */
  8. constructor(private appSrv: any, private $routeParams: any) {}
  9. init() {
  10. this.appModel = {};
  11. this.appSrv.get(this.$routeParams.type).then(result => {
  12. this.appModel = _.clone(result);
  13. });
  14. }
  15. update() {
  16. this.appSrv.update(this.appModel).then(function() {
  17. window.location.href = config.appSubUrl + "org/apps";
  18. });
  19. }
  20. }
  21. angular.module('grafana.controllers').controller('AppEditCtrl', AppEditCtrl);