-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TSVB] Introducing Timerange Data Mode for Metric Style Visualizations #15760
Changes from all commits
60aae42
7651840
cf45e42
a8b4c24
f4e24ff
567ba4d
9e1ea5f
3d9326b
cc066f8
9c092f3
b105dfc
62ce472
0dcf65d
39381d3
5bb9374
9d7384e
51e3a59
2123553
46091ff
16450f5
e5e3cca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export const metricTypes = ['gauge', 'table', 'metric', 'top_n']; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned below, a predicate like |
||
export function isMetric(panelType) { | ||
return metricTypes.includes(panelType); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ import React from 'react'; | |
import { | ||
EuiComboBox, | ||
} from '@elastic/eui'; | ||
import { isMetric } from '../../../common/metric_types'; | ||
|
||
const metricAggs = [ | ||
{ label: 'Average', value: 'avg' }, | ||
|
@@ -79,8 +80,12 @@ function filterByPanelType(panelType) { | |
}; | ||
} | ||
|
||
function includeCalculation() { | ||
return agg => agg.value === 'calculation'; | ||
} | ||
|
||
function AggSelect(props) { | ||
const { siblings, panelType, value } = props; | ||
const { siblings, panelType, value, timerangeMode, metricsOnly } = props; | ||
|
||
const selectedOption = allAggOptions.find(option => { | ||
return value === option.value; | ||
|
@@ -93,8 +98,17 @@ function AggSelect(props) { | |
if (siblings.length <= 1) enablePipelines = false; | ||
|
||
let options; | ||
if (panelType === 'metrics') { | ||
if (metricsOnly) { | ||
options = metricAggs; | ||
} else if (isMetric(panelType) && timerangeMode === 'all') { | ||
options = [ | ||
{ label: 'Metric Aggregations', value: null, heading: true, disabled: true }, | ||
...metricAggs, | ||
{ label: 'Parent Pipeline Aggregations', value: null, pipeline: true, heading: true, disabled: true }, | ||
...pipelineAggs.filter(filterByPanelType(panelType)) | ||
.filter(includeCalculation()) | ||
.map(agg => ({ ...agg, disabled: !enablePipelines })), | ||
]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be a lot of overlap with the next |
||
} else { | ||
options = [ | ||
{ | ||
|
@@ -137,11 +151,17 @@ function AggSelect(props) { | |
); | ||
} | ||
|
||
AggSelect.defaultProps = { | ||
metricsOnly: false | ||
}; | ||
|
||
AggSelect.propTypes = { | ||
onChange: PropTypes.func, | ||
panelType: PropTypes.string, | ||
siblings: PropTypes.array, | ||
value: PropTypes.string, | ||
timerangeMode: PropTypes.oneOf(['all', 'last']), | ||
metricsOnly: PropTypes.bool | ||
}; | ||
|
||
export default AggSelect; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that our fork of the
datemath
package now lives inpackages/
, is this still required?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we suppose to link directly to those packages or rely on the links setup in
package.json
? Maybe @spalger could weigh in on this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind... I see we are suppose to be using
@kbn/datemath
instead which links to thepackages
directory