2019-10-22 07:57:46 -05:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
canToggleEditorModes: boolean;
|
2019-11-26 03:01:32 -06:00
|
|
|
isDisabled?: boolean;
|
2019-11-01 08:48:35 -05:00
|
|
|
isNotStarted: boolean;
|
2019-10-22 07:57:46 -05:00
|
|
|
onClickToggleEditorMode: () => void;
|
2019-11-01 08:48:35 -05:00
|
|
|
onClickToggleDisabled: () => void;
|
2019-10-22 07:57:46 -05:00
|
|
|
onClickAddButton: () => void;
|
|
|
|
onClickRemoveButton: () => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function QueryRowActions(props: Props) {
|
|
|
|
const {
|
|
|
|
canToggleEditorModes,
|
|
|
|
onClickToggleEditorMode,
|
2019-11-01 08:48:35 -05:00
|
|
|
onClickToggleDisabled,
|
2019-10-22 07:57:46 -05:00
|
|
|
onClickAddButton,
|
|
|
|
onClickRemoveButton,
|
2019-11-01 08:48:35 -05:00
|
|
|
isDisabled,
|
|
|
|
isNotStarted,
|
2019-10-22 07:57:46 -05:00
|
|
|
} = 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">
|
2019-11-01 08:48:35 -05:00
|
|
|
<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'} />
|
2019-10-22 07:57:46 -05:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div className="gf-form">
|
2019-11-01 08:48:35 -05:00
|
|
|
<button className="gf-form-label gf-form-label--btn" onClick={onClickAddButton} title="Add query">
|
2019-10-22 07:57:46 -05:00
|
|
|
<i className="fa fa-plus" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div className="gf-form">
|
2019-11-01 08:48:35 -05:00
|
|
|
<button className="gf-form-label gf-form-label--btn" onClick={onClickRemoveButton} title="Remove query">
|
2019-10-22 07:57:46 -05:00
|
|
|
<i className="fa fa-minus" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|