Commit 523cf21b by woodsaj

tune pluginConfig directive

parent 3c139016
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<br> <br>
<plugin-config-loader></plugin-config-loader> <plugin-config-loader plugin="current"></plugin-config-loader>
<div class="pull-right" style="margin-top: 35px"> <div class="pull-right" style="margin-top: 35px">
<button type="submit" class="btn btn-success" ng-click="update()">Save</button> <button type="submit" class="btn btn-success" ng-click="update()">Save</button>
<a class="btn btn-inverse" href="plugins">Cancel</a> <a class="btn btn-inverse" href="plugins">Cancel</a>
......
...@@ -11,15 +11,20 @@ function (angular) { ...@@ -11,15 +11,20 @@ function (angular) {
restrict: 'E', restrict: 'E',
link: function(scope, elem) { link: function(scope, elem) {
var directive = 'grafana-plugin-core'; var directive = 'grafana-plugin-core';
if (scope.current.module) { //wait for the parent scope to be applied.
directive = 'grafana-plugin-'+scope.current.type; scope.$watch("current", function(newVal) {
if (newVal) {
if (newVal.module) {
directive = 'grafana-plugin-'+newVal.type;
} }
scope.require([scope.current.module], function () { scope.require([newVal.module], function () {
var panelEl = angular.element(document.createElement(directive)); var panelEl = angular.element(document.createElement(directive));
elem.append(panelEl); elem.append(panelEl);
$compile(panelEl)(scope); $compile(panelEl)(scope);
}); });
} }
});
}
}; };
}); });
...@@ -28,8 +33,7 @@ function (angular) { ...@@ -28,8 +33,7 @@ function (angular) {
restrict: 'E', restrict: 'E',
templateUrl: 'app/features/org/partials/pluginConfigCore.html', templateUrl: 'app/features/org/partials/pluginConfigCore.html',
transclude: true, transclude: true,
link: function(scope, elem) { link: function(scope) {
console.log("grafana plugin core", scope, elem);
scope.update = function() { scope.update = function() {
//Perform custom save events to the plugins own backend if needed. //Perform custom save events to the plugins own backend if needed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment