Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Observability] fix slo observability compressed styles to be not compressed #193081

Merged
merged 29 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2fb8a5a
fix slo observability compressed styles to be not compressed
rshen91 Sep 16, 2024
67ea6a2
remove sass changes from controls plugin
rshen91 Sep 16, 2024
cf01d44
update
rshen91 Sep 16, 2024
c9d3ffe
fix
rshen91 Sep 17, 2024
0b6fbc0
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Sep 17, 2024
8c45a2a
code review
rshen91 Sep 18, 2024
5354eb0
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Sep 18, 2024
e590230
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Sep 20, 2024
caa0bf2
code review sass clean up
rshen91 Sep 20, 2024
7f0d2f3
Merge remote-tracking branch 'origin/slo-non-compressed' into slo-non…
rshen91 Sep 20, 2024
2831847
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Sep 30, 2024
a722e87
wip refactor
rshen91 Sep 30, 2024
913f0ff
revert some changes
rshen91 Sep 30, 2024
bb6a928
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Sep 30, 2024
451d33c
remove from controls api
rshen91 Sep 30, 2024
c9a2d59
fix
rshen91 Sep 30, 2024
4cf021a
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Sep 30, 2024
cf410d8
fix
rshen91 Sep 30, 2024
9c60c87
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Oct 1, 2024
83da3f5
fix
rshen91 Oct 1, 2024
02f6a67
cleaner
rshen91 Oct 1, 2024
9e32829
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Oct 1, 2024
c986f23
fix typeguard type
rshen91 Oct 1, 2024
ad6ee2c
fix
rshen91 Oct 1, 2024
899b248
code review
rshen91 Oct 1, 2024
adc1846
code review
rshen91 Oct 1, 2024
bb77b0d
code review
rshen91 Oct 1, 2024
b21f593
unit tests
rshen91 Oct 1, 2024
00c0670
Merge remote-tracking branch 'upstream/main' into slo-non-compressed
rshen91 Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { ControlPanelProps, DefaultControlApi } from '../../controls/types';
import { ControlError } from './control_error';

import './control_panel.scss';
import { isCompressed } from '../utils/is_compressed';

const DragHandle = ({
isEditable,
Expand Down Expand Up @@ -122,7 +123,6 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA
const isEditable = viewMode === ViewMode.EDIT;
const controlWidth = width ?? DEFAULT_CONTROL_WIDTH;
const controlGrow = grow ?? DEFAULT_CONTROL_GROW;

return (
<EuiFlexItem
ref={setNodeRef}
Expand Down Expand Up @@ -154,12 +154,10 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA
data-test-subj="control-frame-title"
fullWidth
label={usingTwoLineLayout ? panelTitle || defaultPanelTitle || '...' : undefined}
display="rowCompressed"
>
<EuiFormControlLayout
fullWidth
isLoading={Boolean(dataLoading)}
compressed
className={classNames(
'controlFrame__formControlLayout',
{
Expand Down Expand Up @@ -191,6 +189,7 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA
)}
</>
}
compressed={isCompressed(api)}
>
<>
{blockingError && (
Expand Down
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;
compressed?: boolean;
}

export const ControlGroupRenderer = ({
Expand All @@ -50,6 +51,7 @@ export const ControlGroupRenderer = ({
query,
viewMode,
dataLoading,
compressed,
}: ControlGroupRendererProps) => {
const id = useMemo(() => uuidv4(), []);
const [regenerateId, setRegenerateId] = useState(uuidv4());
Expand Down Expand Up @@ -171,6 +173,7 @@ export const ControlGroupRenderer = ({
getRuntimeStateForChild: () => {
return runtimeState$.getValue();
},
compressed: compressed ?? true,
})}
onApiAvailable={(controlGroupApi) => {
const controlGroupRendererApi: ControlGroupRendererApi = {
Expand Down
23 changes: 23 additions & 0 deletions src/plugins/controls/public/control_group/utils/is_compressed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { apiHasParentApi } from '@kbn/presentation-publishing';

export interface HasCompressed {
compressed: boolean;
}

export const apiHasCompressed = (unknownApi: unknown): unknownApi is HasCompressed => {
return Boolean(unknownApi) && typeof (unknownApi as HasCompressed).compressed === 'boolean';
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to export these


export function isCompressed(api: unknown): boolean {
if (apiHasCompressed(api)) return api.compressed;
return apiHasParentApi(api) ? isCompressed(api.parentApi) : true;
}
Heenawter marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the range slider + time slider controls also use the compressed prop on their components, no? We should make this consistent, even if the SLO page does not use these control types

Copy link
Contributor Author

@rshen91 rshen91 Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good - I'm down for consistency bb77b0d for changes

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
useBatchedPublishingSubjects,
} from '@kbn/presentation-publishing';

import { isCompressed } from '../../../../control_group/utils/is_compressed';
import { OptionsListSelection } from '../../../../../common/options_list/options_list_selections';
import { MIN_POPOVER_WIDTH } from '../../../constants';
import { useOptionsListContext } from '../options_list_context_provider';
Expand Down Expand Up @@ -174,7 +175,7 @@ export const OptionsListControl = ({
);

return (
<EuiFilterGroup fullWidth compressed className={controlPanelClassName}>
<EuiFilterGroup fullWidth compressed={isCompressed(api)} className={controlPanelClassName}>
<EuiInputPopover
id={popoverId}
ownFocus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function QuickFilters({
};
}}
timeRange={{ from: 'now-24h', to: 'now' }}
compressed={false}
/>
</Container>
);
Expand Down