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

CB-4030 makes clear log viewer button sticky to the top-right corner #2505

Merged
Merged
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
@@ -0,0 +1,52 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/

.wrapper {
overflow: hidden;
height: 100%;
width: 100%;
}

.table {
flex: 1 1 auto;
width: 100%;
}

.tableWrapper {
height: 100%;
}

.messageTitleBox {
display: flex;
align-items: center;

.messageTitle {
flex: 1;
}
}

.tableColumnHeader {
white-space: nowrap;
text-overflow: ellipsis;
}

.tableColumnHeaderMin {
width: 32px;
}

.timestamp {
width: 116px;
min-width: 116px;
}

.clearButton {
position: absolute !important;
top: 4px;
right: 16px;
z-index: 100;
}
82 changes: 26 additions & 56 deletions webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,12 @@
* you may not use this file except in compliance with the License.
*/
import { observer } from 'mobx-react-lite';
import styled, { css, use } from 'reshadow';

import { MenuBarSmallItem, Table, TableBody, TableColumnHeader, TableHeader, useStyles, useTranslate } from '@cloudbeaver/core-blocks';
import { Container, MenuBarSmallItem, s, Table, TableBody, TableColumnHeader, TableHeader, useS, useTranslate } from '@cloudbeaver/core-blocks';

import type { ILogEntry } from './ILogEntry';
import { LogEntry } from './LogEntry';

const styles = css`
wrapper {
overflow: hidden;
display: flex;
flex-direction: column;
height: 100%;
}
Table {
flex: 1 1 auto;
width: 100%;
}
table-wrapper {
overflow: auto;
}
message-title-box {
display: flex;
align-items: center;

& message-title {
flex: 1;
}
}
[|buttons] {
text-align: right;
}
TableColumnHeader {
white-space: nowrap;
text-overflow: ellipsis;
}
TableColumnHeader[min] {
width: 32px;
}
[|timestamp] {
width: 116px;
min-width: 116px;
}
`;
import styles from './LogViewerTable.m.css';

interface Props {
items: ILogEntry[];
Expand All @@ -60,22 +22,30 @@ interface Props {
}
export const LogViewerTable = observer<Props>(function LogViewerTable({ items, selectedItem, onItemSelect, onClear, className }) {
const translate = useTranslate();
const style = useStyles(styles);
const style = useS(styles);

return styled(style)(
<wrapper className={className}>
<table-wrapper>
<Table {...use({ expanded: !!selectedItem })}>
return (
<Container className={s(style, { wrapper: true }, className)}>
<MenuBarSmallItem
className={s(style, { clearButton: true })}
icon="trash"
viewBox="0 0 24 24"
title={translate('plugin_log_viewer_clear_log')}
onClick={onClear}
>
{translate('ui_clear')}
</MenuBarSmallItem>
<Container className={s(style, { tableWrapper: true })} overflow>
<Table className={s(style, { table: true })}>
<TableHeader fixed>
<TableColumnHeader min />
<TableColumnHeader {...use({ timestamp: true })}>{translate('plugin_log_viewer_entry_timestamp')}</TableColumnHeader>
<TableColumnHeader>
<message-title-box>
<message-title>{translate('plugin_log_viewer_entry_message')}</message-title>
<MenuBarSmallItem icon="trash" viewBox="0 0 24 24" title={translate('plugin_log_viewer_clear_log')} onClick={onClear}>
{translate('ui_clear')}
</MenuBarSmallItem>
</message-title-box>
<TableColumnHeader className={s(style, { tableColumnHeader: true, tableColumnHeaderMin: true })} min />
<TableColumnHeader className={s(style, { tableColumnHeader: true, timestamp: true })}>
{translate('plugin_log_viewer_entry_timestamp')}
</TableColumnHeader>
<TableColumnHeader className={s(style, { tableColumnHeader: true })}>
<div className={s(style, { messageTitleBox: true })}>
<div className={s(style, { messageTitle: true })}>{translate('plugin_log_viewer_entry_message')}</div>
</div>
</TableColumnHeader>
</TableHeader>
<TableBody>
Expand All @@ -84,7 +54,7 @@ export const LogViewerTable = observer<Props>(function LogViewerTable({ items, s
))}
</TableBody>
</Table>
</table-wrapper>
</wrapper>,
</Container>
</Container>
);
});
Loading