Commit 4c4835e8 by Torkel Ödegaard

ux(query-editors): more progress on elastic query editor

parent a1faaa13
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="gf-form-query-content" ng-if="ctrl.collapsed"> <div class="gf-form-query-content" ng-if="ctrl.collapsed">
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label gf-form-filler pointer" ng-click="ctrl.toggleCollapse()"> <label class="gf-form-label pointer gf-form-label--grow" ng-click="ctrl.toggleCollapse()">
{{ctrl.collapsedText}} {{ctrl.collapsedText}}
</label> </label>
</div> </div>
......
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
</label> </label>
</div> </div>
<div class="gf-form-filler"></div> <div class="gf-form gf-form--grow">
<label class="gf-form-label gf-form-label--grow"></label>
</div>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label" ng-if="isFirst"> <label class="gf-form-label" ng-if="isFirst">
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
</label> </label>
</div> </div>
<div class="gf-form-filler"></div> <div class="gf-form gf-form--grow">
<label class="gf-form-label gf-form-label--grow"></label>
</div>
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label" ng-if="isFirst"> <label class="gf-form-label" ng-if="isFirst">
......
<query-editor-row query-ctrl="ctrl"> <query-editor-row query-ctrl="ctrl" can-collapse="true">
<div class="gf-form-inline"> <div class="gf-form-inline">
<div class="gf-form gf-form-flex"> <div class="gf-form gf-form--grow">
<label class="gf-form-label query-keyword width-7">Query</label> <label class="gf-form-label query-keyword width-7">Query</label>
<input type="text" class="gf-form-input" ng-model="ctrl.target.query" spellcheck='false' placeholder="Lucene query" ng-blur="ctrl.refresh()"> <input type="text" class="gf-form-input" ng-model="ctrl.target.query" spellcheck='false' placeholder="Lucene query" ng-blur="ctrl.refresh()">
</div> </div>
......
...@@ -38,6 +38,11 @@ export class ElasticQueryCtrl extends QueryCtrl { ...@@ -38,6 +38,11 @@ export class ElasticQueryCtrl extends QueryCtrl {
this.$rootScope.appEvent('elastic-query-updated'); this.$rootScope.appEvent('elastic-query-updated');
} }
getCollapsedText() {
var text = 'Count(), Avg(@value), Group by(@timestamp, 1min) Query';
return text;
}
handleQueryError(err) { handleQueryError(err) {
this.error = err.message || 'Failed to issue metric query'; this.error = err.message || 'Failed to issue metric query';
return []; return [];
......
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
<span graphite-add-func></span> <span graphite-add-func></span>
</div> </div>
<div class="gf-form-filler"></div> <div class="gf-form gf-form--grow">
<div class="gf-form-label gf-form-label--grow"></div>
</div>
</div> </div>
</div> </div>
......
...@@ -16,13 +16,16 @@ ...@@ -16,13 +16,16 @@
<div class="gf-form"> <div class="gf-form">
<label class="gf-form-label query-keyword">WHERE</label> <label class="gf-form-label query-keyword">WHERE</label>
</div>
<div class="gf-form" ng-repeat="segment in ctrl.tagSegments">
<metric-segment segment="segment" get-options="ctrl.getTagsOrValues(segment, $index)" on-change="ctrl.tagSegmentUpdated(segment, $index)"></metric-segment>
</div>
<div ng-repeat="segment in ctrl.tagSegments"> <div class="gf-form gf-form--grow">
<metric-segment segment="segment" get-options="ctrl.getTagsOrValues(segment, $index)" on-change="ctrl.tagSegmentUpdated(segment, $index)"></metric-segment> <div class="gf-form-label gf-form-label--grow"></div>
</div>
</div> </div>
<div class="gf-form-filler"></div>
</div> </div>
<div class="gf-form-inline" ng-repeat="selectParts in ctrl.queryModel.selectModels"> <div class="gf-form-inline" ng-repeat="selectParts in ctrl.queryModel.selectModels">
...@@ -49,7 +52,9 @@ ...@@ -49,7 +52,9 @@
</label> </label>
</div> </div>
<div class="gf-form-filler"></div> <div class="gf-form gf-form--grow">
<div class="gf-form-label gf-form-label--grow"></div>
</div>
</div> </div>
<div class="gf-form-inline"> <div class="gf-form-inline">
...@@ -66,9 +71,12 @@ ...@@ -66,9 +71,12 @@
</influx-query-part-editor> </influx-query-part-editor>
<metric-segment segment="ctrl.groupBySegment" get-options="ctrl.getGroupByOptions()" on-change="ctrl.groupByAction(part, $index)"></metric-segment> <metric-segment segment="ctrl.groupBySegment" get-options="ctrl.getGroupByOptions()" on-change="ctrl.groupByAction(part, $index)"></metric-segment>
</div> </div>
<div class="gf-form-filler"></div> <div class="gf-form gf-form--grow">
<div class="gf-form-label gf-form-label--grow"></div>
</div>
</div> </div>
</div> </div>
...@@ -83,7 +91,9 @@ ...@@ -83,7 +91,9 @@
<select class="gf-form-input gf-size-auto" ng-model="ctrl.target.resultFormat" ng-options="f.value as f.text for f in ctrl.resultFormats" ng-change="ctrl.refresh()"></select> <select class="gf-form-input gf-size-auto" ng-model="ctrl.target.resultFormat" ng-options="f.value as f.text for f in ctrl.resultFormats" ng-change="ctrl.refresh()"></select>
</div> </div>
</div> </div>
<div class="gf-form-filler"></div> <div class="gf-form gf-form--grow">
<div class="gf-form-label gf-form-label--grow"></div>
</div>
</div> </div>
</query-editor-row> </query-editor-row>
$popover-arrow-size: 1rem; $popover-arrow-size: 0.7rem;
$color: inherit; $color: inherit;
$backgroundColor: $btn-secondary-bg; $backgroundColor: $btn-secondary-bg;
$color: $text-color; $color: $text-color;
......
...@@ -11,6 +11,10 @@ $gf-form-margin: 0.25rem; ...@@ -11,6 +11,10 @@ $gf-form-margin: 0.25rem;
&--offset-1 { &--offset-1 {
margin-left: $spacer; margin-left: $spacer;
} }
&--grow {
flex-grow: 1;
}
} }
.gf-form-group { .gf-form-group {
...@@ -22,10 +26,6 @@ $gf-form-margin: 0.25rem; ...@@ -22,10 +26,6 @@ $gf-form-margin: 0.25rem;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
align-content: flex-start; align-content: flex-start;
.gf-form-flex {
flex-grow: 1;
}
} }
.gf-form-button-row { .gf-form-button-row {
...@@ -48,16 +48,12 @@ $gf-form-margin: 0.25rem; ...@@ -48,16 +48,12 @@ $gf-form-margin: 0.25rem;
border: $input-btn-border-width solid transparent; border: $input-btn-border-width solid transparent;
@include border-radius($label-border-radius-sm); @include border-radius($label-border-radius-sm);
}
.gf-form-filler {
margin-right: $gf-form-margin;
margin-bottom: $gf-form-margin;
flex-grow: 1;
background-color: $input-label-bg;
border: $input-btn-border-width solid transparent; &--grow {
@include border-radius($label-border-radius-sm); flex-grow: 1;
min-height: 2.7rem;
}
} }
.gf-form-checkbox { .gf-form-checkbox {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
font-family: inherit; font-family: inherit;
background: $theme-bg; background: $theme-bg;
color: $theme-color; color: $theme-color;
padding: $spacer; padding: 0.65rem;
font-size: $font-size-sm; font-size: $font-size-sm;
max-width: 20rem; max-width: 20rem;
......
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