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:
Josh Hunt
2022-07-29 16:29:55 +01:00
committed by GitHub
parent d3323f870e
commit 06d78ea904
14 changed files with 85 additions and 33 deletions

View File

@@ -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}

View File

@@ -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>
);
})}