Commit ca3405af by Torkel Ödegaard

feat(plugins): moved http settings to directive instad of just ng-include partial

parent 36ebfc74
define([
'./list_ctrl',
'./edit_ctrl',
], function () {});
...@@ -9,9 +9,11 @@ function (angular, _, config) { ...@@ -9,9 +9,11 @@ function (angular, _, config) {
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
var datasourceTypes = []; var datasourceTypes = [];
module.controller('DataSourceEditCtrl', function($scope, $q, backendSrv, $routeParams, $location, datasourceSrv) { module.directive('datasourceHttpSettings', function() {
return {templateUrl: 'app/features/datasources/partials/http_settings.html'};
});
$scope.httpConfigPartialSrc = 'app/features/org/partials/datasourceHttpConfig.html'; module.controller('DataSourceEditCtrl', function($scope, $q, backendSrv, $routeParams, $location, datasourceSrv) {
var defaults = {name: '', type: 'graphite', url: '', access: 'proxy', jsonData: {}}; var defaults = {name: '', type: 'graphite', url: '', access: 'proxy', jsonData: {}};
...@@ -114,6 +116,5 @@ function (angular, _, config) { ...@@ -114,6 +116,5 @@ function (angular, _, config) {
}; };
$scope.init(); $scope.init();
}); });
}); });
...@@ -53,3 +53,5 @@ ...@@ -53,3 +53,5 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</div> </div>
<br>
define([ define([
'./datasourcesCtrl',
'./datasourceEditCtrl',
'./orgUsersCtrl', './orgUsersCtrl',
'./newOrgCtrl', './newOrgCtrl',
'./userInviteCtrl', './userInviteCtrl',
'./orgApiKeysCtrl', './orgApiKeysCtrl',
'./orgDetailsCtrl', './orgDetailsCtrl',
'../datasources/all',
], function () {}); ], function () {});
<div ng-include="httpConfigPartialSrc"></div> <datasource-http-settings></datasource-http-settings>
<br>
<h5>Elasticsearch details</h5> <h5>Elasticsearch details</h5>
......
declare var Datasource: any; declare var Datasource: any;
export {Datasource}; export default Datasource;
...@@ -4,7 +4,6 @@ define([ ...@@ -4,7 +4,6 @@ define([
'jquery', 'jquery',
'app/core/config', 'app/core/config',
'app/core/utils/datemath', 'app/core/utils/datemath',
'./directives',
'./query_ctrl', './query_ctrl',
'./func_editor', './func_editor',
'./add_graphite_func', './add_graphite_func',
...@@ -293,7 +292,5 @@ function (angular, _, $, config, dateMath) { ...@@ -293,7 +292,5 @@ function (angular, _, $, config, dateMath) {
}; };
} }
return { return GraphiteDatasource;
Datasource: GraphiteDatasource
};
}); });
define([ define([
'angular', 'angular',
'./datasource',
], ],
function (angular) { function (angular, GraphiteDatasource) {
'use strict'; 'use strict';
var module = angular.module('grafana.directives'); var module = angular.module('grafana.directives');
...@@ -18,4 +19,7 @@ function (angular) { ...@@ -18,4 +19,7 @@ function (angular) {
return {templateUrl: 'app/plugins/datasource/graphite/partials/annotations.editor.html'}; return {templateUrl: 'app/plugins/datasource/graphite/partials/annotations.editor.html'};
}); });
return {
Datasource: GraphiteDatasource,
};
}); });
<div ng-include="httpConfigPartialSrc"></div> <datasource-http-settings></datasource-http-settings>
...@@ -3,11 +3,7 @@ ...@@ -3,11 +3,7 @@
"type": "datasource", "type": "datasource",
"id": "graphite", "id": "graphite",
"module": "app/plugins/datasource/graphite/datasource", "module": "app/plugins/datasource/graphite/module",
"partials": {
"config": "app/plugins/datasource/graphite/partials/config.html"
},
"defaultMatchFormat": "glob", "defaultMatchFormat": "glob",
"metrics": true, "metrics": true,
......
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import helpers from 'test/specs/helpers'; import helpers from 'test/specs/helpers';
import {Datasource} from "../datasource"; import Datasource from "../datasource";
describe('graphiteDatasource', function() { describe('graphiteDatasource', function() {
var ctx = new helpers.ServiceTestContext(); var ctx = new helpers.ServiceTestContext();
......
<div ng-include="httpConfigPartialSrc"></div> <datasource-http-settings></datasource-http-settings>
<br>
<h5>InfluxDB Details</h5> <h5>InfluxDB Details</h5>
......
<div ng-include="httpConfigPartialSrc"></div> <datasource-http-settings></datasource-http-settings>
<br>
<div ng-include="httpConfigPartialSrc"></div> <datasource-http-settings></datasource-http-settings>
<br>
...@@ -6,7 +6,7 @@ module.exports = function(config, grunt) { ...@@ -6,7 +6,7 @@ module.exports = function(config, grunt) {
grunt.log.writeln('File Changed: ' + filepath); grunt.log.writeln('File Changed: ' + filepath);
if (/(\.html)$/.test(filepath)) { if (/(\.html)|(\.json)$/.test(filepath)) {
newPath = filepath.replace(/^public/, 'public_gen'); newPath = filepath.replace(/^public/, 'public_gen');
grunt.log.writeln('Copying to ' + newPath); grunt.log.writeln('Copying to ' + newPath);
grunt.file.copy(filepath, newPath); grunt.file.copy(filepath, newPath);
......
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