mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Explore: updates Query Row component, moves latency to query row actions * Explore: updates query row actions - adds latency and removes add row button * Explore: updates explore toolbar props, adds index of the last query row * Explore: updates toolbar, adds add new row button * Explore: updates add new query row toolbar button title to add query * Explore: updates query row actions - adds disabled property on latency button * Explore: updates query row actions snapshot * Explore: updates styles * Explore: updates query row, removes latency * Explore: updates query row actions, removed latency * Explore: updates query row actions test and snapshot * Explore: updates toolbar, moves add new query row button below query rows * Explore: updates add query row button color and adds transparent background to latency div * Explore: updates styles for add query row button responsiveness * Explore: updates query row with latency button, fixes alignment of overall latency * Explore: updates query row actions snapshot * Explore: removes overall latency * Explore: updates query row latency - removes mouseover-triggered style changes * Explore: updates query row actions snapshot * Explore: moves styles from scss to emotion * Add row button: Removed responsiveness, reused query row styles Co-authored-by: David <david.kaltschmidt@gmail.com>
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
|
|
function formatLatency(value: number) {
|
|
return `${(value / 1000).toFixed(1)}s`;
|
|
}
|
|
|
|
export type Props = {
|
|
canToggleEditorModes: boolean;
|
|
isDisabled?: boolean;
|
|
isNotStarted: boolean;
|
|
latency: number;
|
|
onClickToggleEditorMode: () => void;
|
|
onClickToggleDisabled: () => void;
|
|
onClickRemoveButton: () => void;
|
|
};
|
|
|
|
export function QueryRowActions(props: Props) {
|
|
const {
|
|
canToggleEditorModes,
|
|
onClickToggleEditorMode,
|
|
onClickToggleDisabled,
|
|
onClickRemoveButton,
|
|
isDisabled,
|
|
isNotStarted,
|
|
latency,
|
|
} = props;
|
|
|
|
return (
|
|
<div className="gf-form-inline flex-shrink-0">
|
|
{canToggleEditorModes && (
|
|
<div className="gf-form">
|
|
<button
|
|
aria-label="Edit mode button"
|
|
className="gf-form-label gf-form-label--btn"
|
|
onClick={onClickToggleEditorMode}
|
|
>
|
|
<i className="fa fa-pencil" />
|
|
</button>
|
|
</div>
|
|
)}
|
|
<div className="gf-form">
|
|
<button disabled className="gf-form-label" title="Query row latency">
|
|
{formatLatency(latency)}
|
|
</button>
|
|
</div>
|
|
<div className="gf-form">
|
|
<button
|
|
disabled={isNotStarted}
|
|
className="gf-form-label gf-form-label--btn"
|
|
onClick={onClickToggleDisabled}
|
|
title="Disable/enable query"
|
|
>
|
|
<i className={isDisabled ? 'fa fa-eye-slash' : 'fa fa-eye'} />
|
|
</button>
|
|
</div>
|
|
<div className="gf-form">
|
|
<button className="gf-form-label gf-form-label--btn" onClick={onClickRemoveButton} title="Remove query">
|
|
<i className="fa fa-minus" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|