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

pull/3990/head
Torkel Ödegaard 10 years ago
parent 9fc0a83b83
commit 0fab210ad2
  1. 11
      public/app/core/directives/plugin_component.ts
  2. 1
      public/app/features/apps/all.ts
  3. 23
      public/app/features/apps/config_view.ts
  4. 2
      public/app/features/apps/partials/edit.html
  5. 4
      public/app/features/panel/metrics_panel_ctrl.ts

@ -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);

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

@ -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);

@ -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>

@ -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;

Loading…
Cancel
Save