mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Prevent docCount fetch and remove sidebar if no timeField set. * Don't show metrics section if no metrics cards * Add parens to conditional statement as per styleguide * Don't create docCount card if not timeseries based
This commit is contained in:
parent
6e4ae71663
commit
3062069d52
3 changed files with 19 additions and 10 deletions
|
@ -7,7 +7,7 @@
|
|||
<h1>{{indexPattern.title}}</h1>
|
||||
</div>
|
||||
<div class="euiFlexItem euiFlexItem--flexGrowZero">
|
||||
<ml-full-time-range-selector index-pattern='indexPattern' query='searchQuery' />
|
||||
<ml-full-time-range-selector ng-if="showSidebar" index-pattern='indexPattern' query='searchQuery' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="kuiPanel kuiVerticalRhythm datavisualizer-panel card-panel">
|
||||
<div ng-if="metricCards.length > 0" class="kuiPanel kuiVerticalRhythm datavisualizer-panel card-panel">
|
||||
<div class="euiText">
|
||||
<h2
|
||||
class="kuiSubTitle kuiVerticalRhythm"
|
||||
|
|
|
@ -302,12 +302,18 @@ module
|
|||
|
||||
const metricCards = [];
|
||||
|
||||
// Add a config for 'document count', identified by no field name.
|
||||
metricCards.push({
|
||||
type: ML_JOB_FIELD_TYPES.NUMBER,
|
||||
existsInDocs: true,
|
||||
loading: true
|
||||
});
|
||||
// Add a config for 'document count', identified by no field name if index is timeseries based
|
||||
if (indexPattern.timeFieldName !== undefined) {
|
||||
metricCards.push({
|
||||
type: ML_JOB_FIELD_TYPES.NUMBER,
|
||||
existsInDocs: true,
|
||||
loading: true
|
||||
});
|
||||
} else {
|
||||
// disable timeRangeSelector and remove sidebar if index not timeseries based
|
||||
timefilter.disableTimeRangeSelector();
|
||||
$scope.showSidebar = false;
|
||||
}
|
||||
|
||||
// Add on 1 for the document count card.
|
||||
// TODO - remove the '+1' if document count goes in its own section.
|
||||
|
@ -477,7 +483,7 @@ module
|
|||
fields: numberFields
|
||||
})
|
||||
.then((resp) => {
|
||||
// Add the metric stats to the existing stats in the corresponding card.
|
||||
// Add the metric stats to the existing stats in the corresponding card. [ {documentCounts:...}, {fieldName: ..} ]
|
||||
_.each($scope.metricCards, (card) => {
|
||||
if (card.fieldName !== undefined) {
|
||||
card.stats = { ...card.stats, ...(_.find(resp, { fieldName: card.fieldName })) };
|
||||
|
|
|
@ -122,7 +122,10 @@ export class DataVisualizer {
|
|||
_.each(fields, (field) => {
|
||||
if (field.fieldName === undefined) {
|
||||
// undefined fieldName is used for a document count request.
|
||||
batches.push([field]);
|
||||
// getDocumentCountStats requires timeField - don't add to batched requests if not defined
|
||||
if (timeFieldName !== undefined) {
|
||||
batches.push([field]);
|
||||
}
|
||||
} else {
|
||||
const fieldType = field.type;
|
||||
if (batchedFields[fieldType] === undefined) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue