mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Disable variable pickers for snapshots (#52827)
* user essentials mob! 🔱 lastFile:public/app/features/variables/textbox/TextBoxVariablePicker.tsx * user essentials mob! 🔱 * user essentials mob! 🔱 lastFile:public/app/features/variables/adhoc/picker/AdHocFilter.tsx * finish up disabling variables in snapshots * remove accident * use theme.spacing instead of the v1 shim Co-authored-by: Joao Silva <joao.silva@grafana.com> Co-authored-by: Leodegario Pasakdal <leodegario.pasakdal@grafana.com>
This commit is contained in:
@@ -49,10 +49,12 @@ class SubMenuUnConnected extends PureComponent<Props> {
|
||||
return null;
|
||||
}
|
||||
|
||||
const readOnlyVariables = dashboard.meta.isSnapshot ?? false;
|
||||
|
||||
return (
|
||||
<div className="submenu-controls">
|
||||
<form aria-label="Template variables" className={styles}>
|
||||
<SubMenuItems variables={variables} />
|
||||
<SubMenuItems variables={variables} readOnly={readOnlyVariables} />
|
||||
</form>
|
||||
<Annotations
|
||||
annotations={annotations}
|
||||
|
||||
@@ -7,9 +7,10 @@ import { VariableHide, VariableModel } from '../../../variables/types';
|
||||
|
||||
interface Props {
|
||||
variables: VariableModel[];
|
||||
readOnly?: boolean;
|
||||
}
|
||||
|
||||
export const SubMenuItems: FunctionComponent<Props> = ({ variables }) => {
|
||||
export const SubMenuItems: FunctionComponent<Props> = ({ variables, readOnly }) => {
|
||||
const [visibleVariables, setVisibleVariables] = useState<VariableModel[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -29,7 +30,7 @@ export const SubMenuItems: FunctionComponent<Props> = ({ variables }) => {
|
||||
className="submenu-item gf-form-inline"
|
||||
data-testid={selectors.pages.Dashboard.SubMenu.submenuItem}
|
||||
>
|
||||
<PickerRenderer variable={variable} />
|
||||
<PickerRenderer variable={variable} readOnly={readOnly} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user