Skip to content

Commit

Permalink
fix slo observability compressed styles to be not compressed
Browse files Browse the repository at this point in the history
  • Loading branch information
rshen91 committed Sep 16, 2024
1 parent 1199a5c commit 2fb8a5a
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 10 deletions.
9 changes: 9 additions & 0 deletions src/plugins/controls/public/control_group/control_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,12 @@ $controlMinWidth: $euiSize * 14;
}
}
}

.observability-slo {
.controlsWrapper {
min-height: $euiSize * 4;
}
.controlsFrame__draggable {
height: $euiButtonHeight;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface ControlGroupRendererProps {
timeRange?: TimeRange;
query?: Query;
dataLoading?: boolean;
className?: string;
}

export const ControlGroupRenderer = ({
Expand All @@ -50,6 +51,7 @@ export const ControlGroupRenderer = ({
query,
viewMode,
dataLoading,
className,
}: ControlGroupRendererProps) => {
const id = useMemo(() => uuidv4(), []);
const [regenerateId, setRegenerateId] = useState(uuidv4());
Expand Down Expand Up @@ -187,6 +189,7 @@ export const ControlGroupRenderer = ({
}}
hidePanelChrome
panelProps={{ hideLoader: true }}
className={className}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@
padding: $euiSizeM;
}
}

.observability-slo {
.optionsList--filterBtn {
height: $euiButtonHeight;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface Props {
};
hasUnappliedSelections: boolean;
labelPosition: ControlStyle;
className?: string;
}

export function ControlGroup({
Expand All @@ -54,6 +55,7 @@ export function ControlGroup({
controlsManager,
labelPosition,
hasUnappliedSelections,
className,
}: Props) {
const [isInitialized, setIsInitialized] = useState(false);
const [autoApplySelections, controlsInOrder] = useBatchedPublishingSubjects(
Expand Down Expand Up @@ -154,6 +156,7 @@ export function ControlGroup({
controlsManager.setControlApi(id, controlApi);
}}
isControlGroupInitialized={isInitialized}
className={className}
/>
))}
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,18 @@
.euiFormControlLayout__prepend {
padding-inline-start: $euiSizeXS * .5; // skinny icon
}
}

.observability-slo {
.controlPanel {
height: $euiButtonHeight;

&--labelWrapper {
height: 100%;
}

.controlPanel--label {
height: 100%;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const DragHandle = ({
export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlApi>({
Component,
uuid,
className,
}: ControlPanelProps<ApiType>) => {
const [api, setApi] = useState<ApiType | null>(null);
const {
Expand Down Expand Up @@ -157,12 +158,12 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA
data-test-subj="control-frame-title"
fullWidth
label={usingTwoLineLayout ? panelTitle || defaultPanelTitle || '...' : undefined}
display="rowCompressed"
display={className === 'observability-slo' ? undefined : 'rowCompressed'}
>
<EuiFormControlLayout
fullWidth
isLoading={Boolean(dataLoading)}
compressed
compressed={className === 'observability-slo' ? false : true}
className={classNames(
'controlFrame__formControlLayout',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export const ControlRenderer = <
getParentApi,
onApiAvailable,
isControlGroupInitialized,
className,
}: {
type: string;
uuid: string;
getParentApi: () => ControlGroupApi;
onApiAvailable?: (api: ApiType) => void;
isControlGroupInitialized: boolean;
className?: string;
}) => {
const cleanupFunction = useRef<(() => void) | null>(null);

Expand Down Expand Up @@ -138,7 +140,7 @@ export const ControlRenderer = <

return component && isControlGroupInitialized ? (
// @ts-expect-error
<ControlPanel<ApiType> Component={component} uuid={uuid} />
<ControlPanel<ApiType> Component={component} uuid={uuid} className={className} />
) : // Control group will not display controls until all controls are initialized
null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getControlGroupEmbeddableFactory = (services: {
autoApplySelections,
ignoreParentSettings,
} = initialRuntimeState;

const isObservabilitySLO = await services.core.application.capabilities.apm;
const autoApplySelections$ = new BehaviorSubject<boolean>(autoApplySelections);
const defaultDataViewId = await services.dataViews.getDefaultId();
const lastSavedControlsState$ = new BehaviorSubject<ControlPanelsState>(
Expand Down Expand Up @@ -298,6 +298,7 @@ export const getControlGroupEmbeddableFactory = (services: {
controlsManager={controlsManager}
hasUnappliedSelections={hasUnappliedSelections}
labelPosition={labelPosition}
className={isObservabilitySLO ? 'observability-slo' : undefined}
/>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,9 @@
padding: $euiSizeM;
}
}

.observability-slo {
.optionsList--filterBtn {
height: $euiButtonHeight;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ import './options_list.scss';

export const OptionsListControl = ({
controlPanelClassName,
className,
}: {
controlPanelClassName: string;
className?: string;
}) => {
const popoverId = useMemo(() => htmlIdGenerator()(), []);
const { api, stateManager, displaySettings } = useOptionsListContext();
Expand Down Expand Up @@ -174,7 +176,11 @@ export const OptionsListControl = ({
);

return (
<EuiFilterGroup fullWidth compressed className={controlPanelClassName}>
<EuiFilterGroup
fullWidth
className={controlPanelClassName}
compressed={className === 'observability-slo' ? false : true}
>
<EuiInputPopover
id={popoverId}
ownFocus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ export const getOptionsListControlFactory = (
hideExists$,
hideSort$
);

return (
<OptionsListControlContext.Provider
value={{
Expand All @@ -400,7 +399,12 @@ export const getOptionsListControlFactory = (
displaySettings: { placeholder, hideActionBar, hideExclude, hideExists, hideSort },
}}
>
<OptionsListControl controlPanelClassName={controlPanelClassName} />
<OptionsListControl
controlPanelClassName={controlPanelClassName}
className={
services.core.application.capabilities.apm ? 'observability-slo' : undefined
}
/>
</OptionsListControlContext.Provider>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface Props {
value: RangeValue | undefined;
uuid: string;
controlPanelClassName?: string;
className?: string;
}

export const RangeSliderControl: FC<Props> = ({
Expand All @@ -46,6 +47,7 @@ export const RangeSliderControl: FC<Props> = ({
value,
uuid,
controlPanelClassName,
className,
}: Props) => {
const rangeSliderRef = useRef<EuiDualRangeProps | null>(null);

Expand Down Expand Up @@ -194,7 +196,7 @@ export const RangeSliderControl: FC<Props> = ({
min={displayedMin}
max={displayedMax}
isLoading={isLoading}
compressed
compressed={className === 'observability-slo' ? false : true}
inputPopoverProps={{
className: controlPanelClassName,
panelMinWidth: MIN_POPOVER_WIDTH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface Props {
ticks: EuiRangeTick[];
timeRangeMin: number;
timeRangeMax: number;
className?: string;
}

export function TimeSliderAnchoredRange(props: Props) {
Expand All @@ -40,7 +41,7 @@ export function TimeSliderAnchoredRange(props: Props) {
max={props.timeRangeMax}
step={props.stepSize}
ticks={props.ticks}
compressed
compressed={props.className !== 'observability-slo' ? false : true}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface Props {
ticks: EuiRangeTick[];
timeRangeMin: number;
timeRangeMax: number;
className?: string;
}

export function TimeSliderSlidingWindowRange(props: Props) {
Expand All @@ -36,7 +37,7 @@ export function TimeSliderSlidingWindowRange(props: Props) {
step={props.stepSize}
ticks={props.ticks}
isDraggable
compressed
compressed={props.className !== 'observability-slo' ? true : false}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ export interface ControlPanelProps<
> {
uuid: string;
Component: PanelCompatibleComponent<ApiType, PropsType>;
className?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@
.dashboardViewport--screenshotMode .controlsWrapper--empty {
display:none
}

.observability-slo {
.dshDashboardViewport-controls {
padding-bottom: $euiSizeXS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const ReactEmbeddableRenderer = <
* as it changes. This is **not** expected to change over the lifetime of the component.
*/
onAnyStateChange?: (state: SerializedPanelState<SerializedState>) => void;
className?: string;
}) => {
const cleanupFunction = useRef<(() => void) | null>(null);
const firstLoadCompleteTime = useRef<number | null>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function APMEmbeddableRoot({
type={embeddableId}
getParentApi={() => ({ getSerializedStateForChild: () => ({ rawState: input }) })}
hidePanelChrome={true}
className="observability-slo"
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function QuickFilters({
return (
<Container>
<ControlGroupRenderer
className="observability-slo"
onApiAvailable={setControlGroupAPI}
getCreationOptions={async (initialState, builder) => {
builder.addOptionsListControl(
Expand Down

0 comments on commit 2fb8a5a

Please sign in to comment.