Commit bbf4d003 by Torkel Ödegaard

fix(query editors): added select style to segment, used by data source selector

parent 6b813b4e
...@@ -11,7 +11,10 @@ function (_, $, coreModule) { ...@@ -11,7 +11,10 @@ function (_, $, coreModule) {
' class="gf-form-input input-medium"' + ' class="gf-form-input input-medium"' +
' spellcheck="false" style="display:none"></input>'; ' spellcheck="false" style="display:none"></input>';
var buttonTemplate = '<a class="gf-form-label" ng-class="segment.cssClass" ' + var linkTemplate = '<a class="gf-form-label" ng-class="segment.cssClass" ' +
'tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>';
var selectTemplate = '<a class="gf-form-input gf-form-input--dropdown" ng-class="segment.cssClass" ' +
'tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>'; 'tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>';
return { return {
...@@ -20,9 +23,9 @@ function (_, $, coreModule) { ...@@ -20,9 +23,9 @@ function (_, $, coreModule) {
getOptions: "&", getOptions: "&",
onChange: "&", onChange: "&",
}, },
link: function($scope, elem) { link: function($scope, elem, attrs) {
var $input = $(inputTemplate); var $input = $(inputTemplate);
var $button = $(buttonTemplate); var $button = $(attrs.styleMode === 'select' ? selectTemplate : linkTemplate);
var segment = $scope.segment; var segment = $scope.segment;
var options = null; var options = null;
var cancelBlur = null; var cancelBlur = null;
......
...@@ -13,10 +13,10 @@ var template = ` ...@@ -13,10 +13,10 @@ var template = `
<i class="icon-gf icon-gf-datasource"></i> <i class="icon-gf icon-gf-datasource"></i>
</label> </label>
<label class="gf-form-label"> <label class="gf-form-label">
Data source Panel data source
</label> </label>
<metric-segment segment="ctrl.dsSegment" <metric-segment segment="ctrl.dsSegment" style-mode="select"
get-options="ctrl.getOptions()" get-options="ctrl.getOptions()"
on-change="ctrl.datasourceChanged()"></metric-segment> on-change="ctrl.datasourceChanged()"></metric-segment>
</div> </div>
......
...@@ -124,7 +124,6 @@ function (angular, _, queryDef) { ...@@ -124,7 +124,6 @@ function (angular, _, queryDef) {
} }
} }
console.log(settingsLinkText);
$scope.settingsLinkText = settingsLinkText; $scope.settingsLinkText = settingsLinkText;
$scope.agg.settings = settings; $scope.agg.settings = settings;
return true; return true;
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<div class="gf-form offset-width-7"> <div class="gf-form offset-width-7">
<label class="gf-form-label width-10"> <label class="gf-form-label width-10">
Trim edges points Trim edges points
<info-popver mode="right-normal"> <info-popover mode="right-normal">
Trim the edges on the timeseries x datapoints Trim the edges on the timeseries x datapoints
</info-popover> </info-popover>
</label> </label>
......
<query-editor-row query-ctrl="ctrl"> <query-editor-row query-ctrl="ctrl">
<div class="gf-form" ng-show="ctrl.target.textEditor"> <div class="gf-form" ng-show="ctrl.target.textEditor">
<input type="text" class="gf-form-input" ng-model="ctrl.target.query" spellcheck="false" ng-blur="ctrl.refresh()"></input> <input type="text" class="gf-form-input" ng-model="ctrl.target.target" spellcheck="false" ng-blur="ctrl.refresh()"></input>
</div> </div>
<div ng-hide="ctrl.target.textEditor"> <div ng-hide="ctrl.target.textEditor">
......
...@@ -123,6 +123,20 @@ $gf-form-margin: 0.25rem; ...@@ -123,6 +123,20 @@ $gf-form-margin: 0.25rem;
} }
&.gf-size-auto { width: auto; } &.gf-size-auto { width: auto; }
&--dropdown {
padding-right: $input-padding-x*2;
&:after {
position: absolute;
top: 35%;
right: $input-padding-x/2;
background-color: transparent;
color: $input-color;
font: normal normal normal $font-size-sm/1 FontAwesome;
content: '\f0d7';
pointer-events: none;
}
}
} }
.gf-form-select-wrapper { .gf-form-select-wrapper {
......
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