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

add isFullScreen capability #5

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -191,9 +191,10 @@ export const useSessionView = ({
? sessionView.getSessionView({
sessionEntityId: sessionViewId,
loadAlertDetails: openDetailsPanel,
isFullScreen: fullScreen,
})
: null;
}, [openDetailsPanel, sessionView, sessionViewId]);
}, [openDetailsPanel, sessionView, sessionViewId, fullScreen]);

const navigation = useMemo(() => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const SessionView = ({
height,
jumpToEvent,
loadAlertDetails,
isFullScreen = false,
}: SessionViewDeps) => {
const [isDetailOpen, setIsDetailOpen] = useState(false);
const [selectedProcess, setSelectedProcess] = useState<Process | null>(null);
Expand All @@ -50,7 +51,7 @@ export const SessionView = ({
const [fetchAlertStatus, setFetchAlertStatus] = useState<string[]>([]);
const [updatedAlertsStatus, setUpdatedAlertsStatus] = useState<AlertStatusEventEntityIdMap>({});

const styles = useStyles({ height });
const styles = useStyles({ height, isFullScreen });

const onProcessSelected = useCallback((process: Process | null) => {
setSelectedProcess(process);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@ import { euiLightVars as theme } from '@kbn/ui-theme';

interface StylesDeps {
height: string | undefined;
isFullScreen?: boolean;
}

export const useStyles = ({ height = '500px' }: StylesDeps) => {
export const useStyles = ({ height = '500px', isFullScreen }: StylesDeps) => {
const { euiTheme } = useEuiTheme();

const cached = useMemo(() => {
const { border } = euiTheme;

const processTree: CSSObject = {
height: `${height}`,
height: `${isFullScreen ? 'calc(100vh - 118px)' : height}`,
position: 'relative',
};

const detailPanel: CSSObject = {
height: `${height}px`,
height: `${isFullScreen ? 'calc(100vh - 118px)' : height}`,
borderRightWidth: '0px',
};

Expand Down Expand Up @@ -67,7 +68,7 @@ export const useStyles = ({ height = '500px' }: StylesDeps) => {
sessionViewerComponent,
toolBar,
};
}, [height, euiTheme]);
}, [height, isFullScreen, euiTheme]);

return cached;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getDetailPanelProcessLeader = (leader: ProcessFields) => ({
entryMetaType: leader.entry_meta?.type ?? '',
userName: leader.user?.name,
groupName: leader.group?.name ?? '',
entryMetaSourceIp: leader.entry_meta?.source.ip ?? '',
entryMetaSourceIp: leader.entry_meta?.source?.ip ?? '',
});

export const getDetailPanelProcess = (process: Process) => {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/session_view/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface SessionViewDeps {
// the root node of the process tree to render. e.g process.entry.entity_id or process.session_leader.entity_id
sessionEntityId: string;
height?: string;
isFullScreen?: boolean;
// if provided, the session view will jump to and select the provided event if it belongs to the session leader
// session view will fetch a page worth of events starting from jumpToEvent as well as a page backwards.
jumpToEvent?: ProcessEvent;
Expand Down