mirror of https://github.com/prometheus/prometheus
Browse Source
* Add expression explorer Signed-off-by: Lucas Hild <git@lucas-hild.de> * Add final new line to all files Signed-off-by: Lucas Hild <git@lucas-hild.de> * Rename expression to metric Signed-off-by: Lucas Hild <git@lucas-hild.de> * Pass dedicated metrics array to metrics explorer Signed-off-by: Lucas Hild <git@lucas-hild.de> * Fix styling of button Signed-off-by: Lucas Hild <git@lucas-hild.de> * Use append instead of prepend Signed-off-by: Lucas Hild <git@lucas-hild.de> * Update max width of modal Signed-off-by: Lucas Hild <git@lucas-hild.de> * Fix code style Signed-off-by: Lucas Hild <git@lucas-hild.de> * Fix inconsistent variable naming Signed-off-by: Lucas Hild <git@lucas-hild.de> * Fix modal title Signed-off-by: Lucas Hild <git@lucas-hild.de> * Fix tests Signed-off-by: Lucas Hild <git@lucas-hild.de> * Prevent request from being cached Signed-off-by: Lucas Hild <git@lucas-hild.de> * Remove timestamp from request Signed-off-by: Lucas Hild <git@lucas-hild.de> * Update button selector in test Signed-off-by: Lucas Hild <git@lucas-hild.de> * Refactor passing down metric names and query history Signed-off-by: Lucas Hild <git@lucas-hild.de> * Fix code style Signed-off-by: Lucas Hild <git@lucas-hild.de>pull/8529/head
Lucas Hild
4 years ago
committed by
GitHub
6 changed files with 190 additions and 96 deletions
@ -0,0 +1,14 @@
|
||||
.metrics-explorer.modal-dialog { |
||||
max-width: 750px; |
||||
overflow-wrap: break-word; |
||||
} |
||||
|
||||
.metrics-explorer .metric { |
||||
cursor: pointer; |
||||
margin: 0; |
||||
padding: 5px; |
||||
} |
||||
|
||||
.metrics-explorer .metric:hover { |
||||
background: #efefef; |
||||
} |
@ -0,0 +1,38 @@
|
||||
import React, { Component } from 'react'; |
||||
import { Modal, ModalBody, ModalHeader } from 'reactstrap'; |
||||
import './MetricsExplorer.css'; |
||||
|
||||
interface Props { |
||||
show: boolean; |
||||
updateShow(show: boolean): void; |
||||
metrics: string[]; |
||||
insertAtCursor(value: string): void; |
||||
} |
||||
|
||||
class MetricsExplorer extends Component<Props, {}> { |
||||
handleMetricClick = (query: string) => { |
||||
this.props.insertAtCursor(query); |
||||
this.props.updateShow(false); |
||||
}; |
||||
|
||||
toggle = () => { |
||||
this.props.updateShow(!this.props.show); |
||||
}; |
||||
|
||||
render() { |
||||
return ( |
||||
<Modal isOpen={this.props.show} toggle={this.toggle} className="metrics-explorer"> |
||||
<ModalHeader toggle={this.toggle}>Metrics Explorer</ModalHeader> |
||||
<ModalBody> |
||||
{this.props.metrics.map(metric => ( |
||||
<p className="metric" key="metric" onClick={this.handleMetricClick.bind(this, metric)}> |
||||
{metric} |
||||
</p> |
||||
))} |
||||
</ModalBody> |
||||
</Modal> |
||||
); |
||||
} |
||||
} |
||||
|
||||
export default MetricsExplorer; |
Loading…
Reference in new issue