grafana/public/app/features/admin/AdminListOrgsCtrl.ts

35 lines
853 B
TypeScript
Raw Normal View History

2018-09-07 10:55:38 -05:00
export default class AdminListOrgsCtrl {
2017-11-23 10:05:08 -06:00
/** @ngInject */
constructor($scope, backendSrv, navModelSrv) {
$scope.init = () => {
2017-12-20 05:33:33 -06:00
$scope.navModel = navModelSrv.getNav('cfg', 'admin', 'global-orgs', 1);
$scope.getOrgs();
};
$scope.getOrgs = () => {
backendSrv.get('/api/orgs').then(orgs => {
$scope.orgs = orgs;
});
};
$scope.deleteOrg = org => {
2017-12-20 05:33:33 -06:00
$scope.appEvent('confirm-modal', {
title: 'Delete',
text: 'Do you want to delete organization ' + org.name + '?',
text2: 'All dashboards for this organization will be removed!',
icon: 'fa-trash',
yesText: 'Delete',
onConfirm: () => {
backendSrv.delete('/api/orgs/' + org.id).then(() => {
$scope.getOrgs();
});
2017-12-20 05:33:33 -06:00
},
});
};
$scope.init();
2017-11-23 10:05:08 -06:00
}
}