feat(apps): changed edit apps view to use plugin-component for apps config view

This commit is contained in:
Torkel Ödegaard 2016-02-05 12:13:59 +01:00
parent 9fc0a83b83
commit 0fab210ad2
5 changed files with 14 additions and 27 deletions

View File

@ -141,6 +141,17 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
};
});
}
// AppConfigCtrl
case 'app-config-ctrl': {
return System.import(scope.ctrl.appModel.module).then(function(appModule) {
return {
name: 'app-config-' + scope.ctrl.appModel.appId,
bindings: {appModel: "=", appEditCtrl: "="},
attrs: {"app-model": "ctrl.appModel", "app-edit-ctrl": "ctrl"},
Component: appModule.ConfigCtrl,
};
});
}
// Panel
case 'panel': {
return loadPanelComponentInfo(scope, attrs);

View File

@ -1,3 +1,2 @@
import './edit_ctrl';
import './list_ctrl';
import './config_view';

View File

@ -1,23 +0,0 @@
///<reference path="../../headers/common.d.ts" />
import angular from 'angular';
/** @ngInject */
function appConfigView(dynamicDirectiveSrv) {
return dynamicDirectiveSrv.create({
scope: {
appModel: "="
},
directive: scope => {
return System.import(scope.appModel.module).then(function(appModule) {
return {
name: 'app-config-' + scope.appModel.appId,
fn: appModule.configView,
};
});
},
});
}
angular.module('grafana.directives').directive('appConfigView', appConfigView);

View File

@ -97,7 +97,7 @@
<h3 class="simple-box-header">Configuration:</h3>
<div class="simple-box-body">
<div ng-if="ctrl.appModel.appId">
<app-config-view app-model="ctrl.appModel"></app-config-view>
<plugin-component type="app-config-ctrl"></plugin-component>
<div class="clearfix"></div>
<button type="submit" class="btn btn-success" ng-click="ctrl.update()">Save</button>
</div>

View File

@ -6,8 +6,8 @@ import _ from 'lodash';
import kbn from 'app/core/utils/kbn';
import {PanelCtrl} from './panel_ctrl';
import * as rangeUtil from '../../core/utils/rangeutil';
import * as dateMath from '../../core/utils/datemath';
import * as rangeUtil from 'app/core/utils/rangeutil';
import * as dateMath from 'app/core/utils/datemath';
class MetricsPanelCtrl extends PanelCtrl {
error: boolean;