mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
PanelEdit: Always have bottom border to make sections easier to see when expanded (#35565)
This commit is contained in:
parent
75ff02a9fb
commit
7599ab8217
@ -54,7 +54,6 @@ export const OptionsPaneCategory: FC<OptionsPaneCategoryProps> = React.memo(
|
|||||||
const boxStyles = cx(
|
const boxStyles = cx(
|
||||||
{
|
{
|
||||||
[styles.box]: true,
|
[styles.box]: true,
|
||||||
[styles.boxExpanded]: isExpanded,
|
|
||||||
[styles.boxNestedExpanded]: isNested && isExpanded,
|
[styles.boxNestedExpanded]: isNested && isExpanded,
|
||||||
},
|
},
|
||||||
className,
|
className,
|
||||||
@ -93,13 +92,7 @@ export const OptionsPaneCategory: FC<OptionsPaneCategoryProps> = React.memo(
|
|||||||
const getStyles = (theme: GrafanaTheme2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
return {
|
return {
|
||||||
box: css`
|
box: css`
|
||||||
border-bottom: 1px solid ${theme.colors.border.weak};
|
border-top: 1px solid ${theme.colors.border.weak};
|
||||||
&:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
boxExpanded: css`
|
|
||||||
border-bottom: 0;
|
|
||||||
`,
|
`,
|
||||||
boxNestedExpanded: css`
|
boxNestedExpanded: css`
|
||||||
margin-bottom: ${theme.spacing(2)};
|
margin-bottom: ${theme.spacing(2)};
|
||||||
|
@ -7,14 +7,16 @@ import {
|
|||||||
VariableSuggestionsScope,
|
VariableSuggestionsScope,
|
||||||
DynamicConfigValue,
|
DynamicConfigValue,
|
||||||
ConfigOverrideRule,
|
ConfigOverrideRule,
|
||||||
|
GrafanaTheme2,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { Container, fieldMatchersUI, ValuePicker } from '@grafana/ui';
|
import { fieldMatchersUI, useStyles2, ValuePicker } from '@grafana/ui';
|
||||||
import { OptionPaneRenderProps } from './types';
|
import { OptionPaneRenderProps } from './types';
|
||||||
import { OptionsPaneItemDescriptor } from './OptionsPaneItemDescriptor';
|
import { OptionsPaneItemDescriptor } from './OptionsPaneItemDescriptor';
|
||||||
import { OptionsPaneCategoryDescriptor } from './OptionsPaneCategoryDescriptor';
|
import { OptionsPaneCategoryDescriptor } from './OptionsPaneCategoryDescriptor';
|
||||||
import { DynamicConfigValueEditor } from './DynamicConfigValueEditor';
|
import { DynamicConfigValueEditor } from './DynamicConfigValueEditor';
|
||||||
import { getDataLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
|
import { getDataLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
|
||||||
import { OverrideCategoryTitle } from './OverrideCategoryTitle';
|
import { OverrideCategoryTitle } from './OverrideCategoryTitle';
|
||||||
|
import { css } from '@emotion/css';
|
||||||
|
|
||||||
export function getFieldOverrideCategories(props: OptionPaneRenderProps): OptionsPaneCategoryDescriptor[] {
|
export function getFieldOverrideCategories(props: OptionPaneRenderProps): OptionsPaneCategoryDescriptor[] {
|
||||||
const categories: OptionsPaneCategoryDescriptor[] = [];
|
const categories: OptionsPaneCategoryDescriptor[] = [];
|
||||||
@ -208,7 +210,7 @@ export function getFieldOverrideCategories(props: OptionPaneRenderProps): Option
|
|||||||
id: 'add button',
|
id: 'add button',
|
||||||
customRender: function renderAddButton() {
|
customRender: function renderAddButton() {
|
||||||
return (
|
return (
|
||||||
<Container padding="md" key="Add override">
|
<AddOverrideButtonContainer key="Add override">
|
||||||
<ValuePicker
|
<ValuePicker
|
||||||
icon="plus"
|
icon="plus"
|
||||||
label="Add field override"
|
label="Add field override"
|
||||||
@ -222,22 +224,12 @@ export function getFieldOverrideCategories(props: OptionPaneRenderProps): Option
|
|||||||
.map<SelectableValue<string>>((i) => ({ label: i.name, value: i.id, description: i.description }))}
|
.map<SelectableValue<string>>((i) => ({ label: i.name, value: i.id, description: i.description }))}
|
||||||
onChange={(value) => onOverrideAdd(value)}
|
onChange={(value) => onOverrideAdd(value)}
|
||||||
/>
|
/>
|
||||||
</Container>
|
</AddOverrideButtonContainer>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// <FeatureInfoBox
|
|
||||||
// title="Overrides"
|
|
||||||
// url={getDocsLink(DocsId.FieldConfigOverrides)}
|
|
||||||
// className={css`
|
|
||||||
// margin: ${theme.spacing.md};
|
|
||||||
// `}
|
|
||||||
// >
|
|
||||||
// Field override rules give you fine-grained control over how your data is displayed.
|
|
||||||
// </FeatureInfoBox>
|
|
||||||
|
|
||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,3 +249,15 @@ function getOverrideProperties(registry: FieldConfigOptionsRegistry) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AddOverrideButtonContainer({ children }: { children: React.ReactNode }) {
|
||||||
|
const styles = useStyles2(getBorderTopStyles);
|
||||||
|
return <div className={styles}>{children}</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBorderTopStyles(theme: GrafanaTheme2) {
|
||||||
|
return css({
|
||||||
|
borderTop: `1px solid ${theme.colors.border.weak}`,
|
||||||
|
padding: `${theme.spacing(2)}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user