feat(apps): rewrote appsCtrl to app_list_ctrl and to typescript
This commit is contained in:
@@ -132,12 +132,12 @@ define([
|
|||||||
controller : 'ResetPasswordCtrl',
|
controller : 'ResetPasswordCtrl',
|
||||||
})
|
})
|
||||||
.when('/org/apps', {
|
.when('/org/apps', {
|
||||||
templateUrl: 'app/features/org/partials/apps.html',
|
templateUrl: 'app/features/org/partials/app_list.html',
|
||||||
controller: 'AppsCtrl',
|
controller: 'AppListCtrl',
|
||||||
resolve: loadOrgBundle,
|
resolve: loadOrgBundle,
|
||||||
})
|
})
|
||||||
.when('/org/apps/edit/:type', {
|
.when('/org/apps/edit/:type', {
|
||||||
templateUrl: 'app/features/org/partials/appEdit.html',
|
templateUrl: 'app/features/org/partials/app_edit.html',
|
||||||
controller: 'AppEditCtrl',
|
controller: 'AppEditCtrl',
|
||||||
resolve: loadOrgBundle,
|
resolve: loadOrgBundle,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ define([
|
|||||||
'./userInviteCtrl',
|
'./userInviteCtrl',
|
||||||
'./orgApiKeysCtrl',
|
'./orgApiKeysCtrl',
|
||||||
'./orgDetailsCtrl',
|
'./orgDetailsCtrl',
|
||||||
'./appsCtrl',
|
'./app_list_ctrl',
|
||||||
'./appEditCtrl',
|
'./app_edit_ctrl',
|
||||||
'./app_srv',
|
'./app_srv',
|
||||||
'./app_directive',
|
'./app_directive',
|
||||||
], function () {});
|
], function () {});
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
define([
|
///<reference path="../../headers/common.d.ts" />
|
||||||
'angular',
|
|
||||||
'app/core/config',
|
|
||||||
],
|
|
||||||
function (angular, config) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
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.init = function() {
|
||||||
$scope.apps = {};
|
$scope.apps = {};
|
||||||
@@ -27,6 +26,7 @@ function (angular, config) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.init();
|
$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 => {
|
return this.backendSrv.get('api/org/apps').then(results => {
|
||||||
this.apps = results.reduce((prev, current) => {
|
return results.reduce((prev, current) => {
|
||||||
prev[current.type] = current;
|
prev[current.type] = current;
|
||||||
}, {});
|
return prev;
|
||||||
return this.apps;
|
}, this.apps);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,28 +14,23 @@
|
|||||||
|
|
||||||
<table class="grafana-options-table" ng-if="apps">
|
<table class="grafana-options-table" ng-if="apps">
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>Type</strong></td>
|
<td><strong>Name</strong></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-repeat="(type, p) in apps">
|
<tr ng-repeat="(type, p) in apps">
|
||||||
<td style="width:1%">
|
<td style="width:99%">
|
||||||
<i class="fa fa-cubes"></i>
|
<i class="fa fa-cubes"></i>
|
||||||
{{p.type}}
|
{{p.type}}
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 1%">
|
<td style="width: 1%">
|
||||||
<a href="org/apps/edit/{{p.type}}" class="btn btn-inverse btn-mini">
|
<a href="org/apps/edit/{{p.type}}" class="btn btn-inverse btn-mini">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
Edit
|
Configure
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</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>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user