mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(apps): rewrote appsCtrl to app_list_ctrl and to typescript
This commit is contained in:
@@ -132,12 +132,12 @@ define([
|
||||
controller : 'ResetPasswordCtrl',
|
||||
})
|
||||
.when('/org/apps', {
|
||||
templateUrl: 'app/features/org/partials/apps.html',
|
||||
controller: 'AppsCtrl',
|
||||
templateUrl: 'app/features/org/partials/app_list.html',
|
||||
controller: 'AppListCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/org/apps/edit/:type', {
|
||||
templateUrl: 'app/features/org/partials/appEdit.html',
|
||||
templateUrl: 'app/features/org/partials/app_edit.html',
|
||||
controller: 'AppEditCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
|
||||
@@ -6,8 +6,8 @@ define([
|
||||
'./userInviteCtrl',
|
||||
'./orgApiKeysCtrl',
|
||||
'./orgDetailsCtrl',
|
||||
'./appsCtrl',
|
||||
'./appEditCtrl',
|
||||
'./app_list_ctrl',
|
||||
'./app_edit_ctrl',
|
||||
'./app_srv',
|
||||
'./app_directive',
|
||||
], function () {});
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
define([
|
||||
'angular',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular, config) {
|
||||
'use strict';
|
||||
///<reference path="../../headers/common.d.ts" />
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
import config = require('app/core/config');
|
||||
import angular from 'angular';
|
||||
|
||||
module.controller('AppsCtrl', function($scope, $location, appSrv) {
|
||||
export class AppListCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope: any, appSrv: any, $location: any) {
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.apps = {};
|
||||
@@ -27,6 +26,7 @@ function (angular, config) {
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
angular.module('grafana.controllers').controller('AppListCtrl', AppListCtrl);
|
||||
@@ -30,10 +30,10 @@ export class AppSrv {
|
||||
}
|
||||
|
||||
return this.backendSrv.get('api/org/apps').then(results => {
|
||||
this.apps = results.reduce((prev, current) => {
|
||||
return results.reduce((prev, current) => {
|
||||
prev[current.type] = current;
|
||||
}, {});
|
||||
return this.apps;
|
||||
return prev;
|
||||
}, this.apps);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,28 +14,23 @@
|
||||
|
||||
<table class="grafana-options-table" ng-if="apps">
|
||||
<tr>
|
||||
<td><strong>Type</strong></td>
|
||||
<td><strong>Name</strong></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr ng-repeat="(type, p) in apps">
|
||||
<td style="width:1%">
|
||||
<td style="width:99%">
|
||||
<i class="fa fa-cubes"></i>
|
||||
{{p.type}}
|
||||
</td>
|
||||
<td style="width: 1%">
|
||||
<a href="org/apps/edit/{{p.type}}" class="btn btn-inverse btn-mini">
|
||||
<i class="fa fa-edit"></i>
|
||||
Edit
|
||||
Configure
|
||||
</a>
|
||||
</td>
|
||||
<td style="width: 1%">
|
||||
Enabled
|
||||
<input id="p.enabled" type="checkbox" ng-model="p.enabled" ng-checked="p.enabled" ng-change="update(p)">
|
||||
<label for="p.enabled"></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user