Skip to content
Open
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
5 changes: 3 additions & 2 deletions webapp/packages/core-theming/src/styles/UiPopover.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@layer components {
.dbv-kit-popover__content {
--dbv-kit-popover-border-width: 2px;
--dbv-kit-popover-border-color: var(--theme-input-border);
--dbv-kit-popover-border-color: color-mix(in srgb, var(--theme-on-surface) 9%, transparent);
--dbv-kit-popover-border-radius: 12px;

--dbv-kit-popover-content-background: var(--theme-surface);
--dbv-kit-popover-content-foreground: var(--theme-text-on-surface);
--dbv-kit-popover-content-shadow: 0 3px 10px oklch(22% 0.025 255 / 0.1);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
Expand All @@ -19,3 +19,20 @@
border-bottom: solid 2px;
border-color: inherit;
}

.topBar > .tabArea {
flex-basis: max-content;
max-width: 100%;
}

.tabs {
flex-wrap: wrap;
}

.actions {
margin-inline-start: auto;
}

.panels {
min-height: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
className?: string;
}

export const TeamForm = observer<Props>(function TeamForm({ state, onCancel, className }) {

Check warning on line 26 in webapp/packages/plugin-authentication-administration/src/Administration/Users/Teams/TeamsForm/TeamForm.tsx

View workflow job for this annotation

GitHub Actions / Frontend / Lint

'className' is defined but never used
const styles = useS(style);
const teamsAdministrationFormService = useService(TeamsAdministrationFormService);
const notificationService = useService(NotificationService);
Expand Down Expand Up @@ -63,12 +63,12 @@
<Form context={form} contents>
<TabsState container={teamsAdministrationFormService.parts} formState={state}>
<Container noWrap vertical>
<Container className={s(styles, { topBar: true })} gap keepSize noWrap>
<Container fill>
<Container className={s(styles, { topBar: true })} gap keepSize>
<Container className={s(styles, { tabArea: true })} fill>
<StatusMessage exception={getFirstException(state.exception)} message={state.statusMessage} type={ENotificationType.Info} />
<TabList disabled={false} underline big />
<TabList className={s(styles, { tabs: true })} disabled={false} underline big />
</Container>
<Container keepSize noWrap center gap compact>
<Container className={s(styles, { actions: true })} keepSize noWrap center gap compact>
<Button type="button" disabled={state.isDisabled} variant="secondary" onClick={onCancel}>
{translate('ui_processing_cancel')}
</Button>
Expand All @@ -77,7 +77,7 @@
</Button>
</Container>
</Container>
<Container vertical>
<Container className={s(styles, { panels: true })} vertical noWrap>
<TabPanelList />
</Container>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const CreateTeam: React.FC = observer(function CreateTeam() {
<GroupTitle header keepSize>
<Translate token="administration_teams_team_creation" />
</GroupTitle>
<Container overflow vertical>
<Container overflow vertical noWrap>
<Loader suspense>
<TeamForm state={createTeamService.formState} onCancel={createTeamService.cancelCreate} />
</Loader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const TeamsTable = observer<Props>(function TeamsTable({ teams }) {
}

if (column.key === DESCRIPTION_COLUMN.key) {
return <span title={row.description}>{row.description}</span>;
return (
<span className="tw:block tw:truncate tw:[contain:inline-size]" title={row.description}>
{row.description}
</span>
);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,107 @@
* you may not use this file except in compliance with the License.
*/
import { observer } from 'mobx-react-lite';
import { useContext } from 'react';

import { IconOrImage, ToolbarAction, ToolbarActions, useTranslate } from '@cloudbeaver/core-blocks';
import { IconOrImage, s, ToolbarAction, ToolbarActions, useS, useTranslate } from '@cloudbeaver/core-blocks';
import { Button, Popover, Radio, RadioGroup, usePopoverStore } from '@dbeaver/ui-kit';

import type { IUsersActionButtonProps } from '../../UsersAdministrationService.js';
import { UsersTableFiltersOpenContext } from './UsersTableFiltersOpenContext.js';
import styles from './UsersTableFilters.module.css';
import { DEFAULT_USER_ROLE, DEFAULT_USER_STATUS, type IUserFilters, USER_STATUSES } from './useUsersTableFilters.js';
import { useUsersTableFiltersDraft } from './useUsersTableFiltersDraft.js';

export const UsersTableFilterButton = observer<IUsersActionButtonProps>(function UsersTableFilterButton() {
interface Props {
filters: IUserFilters;
roles: readonly string[];
}

export const UsersTableFilterButton = observer<Props>(function UsersTableFilterButton({ filters, roles }) {
const translate = useTranslate();
const openContext = useContext(UsersTableFiltersOpenContext);
const style = useS(styles);
const label = translate('ui_filter');
const activeCount = Number(filters.status !== DEFAULT_USER_STATUS) + Number(filters.role !== DEFAULT_USER_ROLE);
const draft = useUsersTableFiltersDraft(filters);
const popover = usePopoverStore({
placement: 'bottom-start',
setOpen(open) {
if (open) {
draft.syncFromFilters();
}
},
});

if (!openContext) {
throw new Error('UsersTableFilterButton must be rendered within UsersTableFiltersOpenContext');
function apply() {
draft.apply();
popover.hide();
}

const label = translate('authentication_administration_users_filters_filter_label');

return (
<ToolbarActions>
<ToolbarAction active={openContext.open} aria-label={label} title={label} onClick={openContext.onToggle}>
<IconOrImage className="tw:w-full tw:h-full" icon="filter" />
</ToolbarAction>
</ToolbarActions>
<Popover store={popover}>
<div className={s(style, { triggerContainer: true })}>
<ToolbarActions>
<Popover.PopoverDisclosure
render={<ToolbarAction active={activeCount > 0} />}
className={s(style, { trigger: true })}
aria-label={activeCount > 0 ? `${label} (${activeCount})` : label}
title={label}
>
<IconOrImage className="tw:w-full tw:h-full" icon="filter" />
</Popover.PopoverDisclosure>
</ToolbarActions>
{activeCount > 0 && (
<span className={s(style, { badge: true })} aria-hidden>
{activeCount}
</span>
)}
</div>
<Popover.PopoverContent className={s(style, { popover: true })} aria-label={label} gutter={6} portal autoFocusOnShow unmountOnHide>
<div className={s(style, { groups: true })}>
<RadioGroup
label={translate('authentication_user_status')}
value={draft.status}
setValue={value => {
const status = USER_STATUSES.find(option => option.value === value);

if (status) {
draft.setStatus(status.value);
}
}}
vertical
>
{USER_STATUSES.map(status => (
<Radio key={status.value} value={status.value}>
{translate(status.label)}
</Radio>
))}
</RadioGroup>
{roles.length > 0 && (
<RadioGroup
label={translate('authentication_user_role')}
value={draft.role}
setValue={role => {
if (typeof role === 'string') {
draft.setRole(role);
}
}}
vertical
>
<Radio value={DEFAULT_USER_ROLE}>{translate('authentication_administration_users_filters_status_all')}</Radio>
{roles.map(role => (
<Radio key={role} value={role}>
{role}
</Radio>
))}
</RadioGroup>
)}
</div>
<div className={s(style, { actions: true })}>
<Button type="button" variant="ghost" size="small" onClick={draft.reset}>
{translate('ui_reset')}
</Button>
<Button type="button" variant="primary" size="small" onClick={apply}>
{translate('ui_apply')}
</Button>
</div>
</Popover.PopoverContent>
</Popover>
);
});
Original file line number Diff line number Diff line change
@@ -1,16 +1,93 @@
.filters {
.filterContainer {
display: flex;
flex-direction: column;
flex-wrap: wrap;
flex-shrink: 0;
gap: 16px;
align-items: center;
gap: 12px;
min-width: 0;
width: 100%;
}

.filterContainer {
.searchGroup {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
min-width: 0;
}

.searchGroup > .search {
flex: 0 1 auto;
min-width: 0;
}

.triggerContainer {
position: relative;
flex-shrink: 0;
}

.trigger[aria-expanded='true'] {
background: var(--theme-secondary);
}

.badge {
position: absolute;
inset-block-start: 1px;
inset-inline-end: 1px;
display: grid;
place-items: center;
box-sizing: border-box;
inline-size: 13px;
block-size: 13px;
border: 1px solid var(--theme-surface);
border-radius: 50%;
background: var(--theme-primary);
color: var(--theme-on-primary);
font-size: 9px;
line-height: 1;
pointer-events: none;
}

.popover {
--filters-panel-width: 17rem;

box-sizing: border-box;
min-width: 0;
width: min(var(--filters-panel-width), var(--popover-available-width, calc(100vw - 16px)));

&:has(.groups > :nth-child(2)) {
--filters-panel-width: 26rem;
}
}

.groups {
display: flex;
flex-wrap: wrap;
gap: 16px 24px;
padding: 20px;

& > * {
flex: 1 1 8rem;
min-width: 0;
overflow-wrap: anywhere;
}

& :global(.dbv-kit-radio-group__label) {
margin-block-end: 8px;
color: var(--theme-on-secondary);
font-size: 13px;
font-weight: 600;
}

& :global(.dbv-kit-radio-group.dbv-kit-radio-group--vertical) {
gap: 4px;
}
}

.actions {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 8px 12px;
border-block-start: 1px solid var(--dbv-kit-popover-border-color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,42 @@
* you may not use this file except in compliance with the License.
*/
import { observer } from 'mobx-react-lite';
import { type ReactNode, useCallback, useMemo, useState } from 'react';
import type { ReactNode } from 'react';

import { Filter, Placeholder, s, ToolbarActions, useS, useTranslate } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { CommonDialogService } from '@cloudbeaver/core-dialogs';

import { UsersAdministrationService } from '../../UsersAdministrationService.js';
import styles from './UsersTableFilters.module.css';
import { UsersTableFiltersDialog } from './UsersTableFiltersDialog.js';
import { UsersTableFiltersOpenContext } from './UsersTableFiltersOpenContext.js';
import { type IUserFilters } from './useUsersTableFilters.js';
import { UsersTableFilterButton } from './UsersTableFilterButton.js';
import styles from './UsersTableFilters.module.css';
import type { IUserFilters } from './useUsersTableFilters.js';

interface Props {
filters: IUserFilters;
roles: readonly string[];
actionsSlot?: ReactNode;
}

export const UsersTableFilters = observer<Props>(function UsersTableFilters({ filters, actionsSlot }) {
export const UsersTableFilters = observer<Props>(function UsersTableFilters({ filters, roles, actionsSlot }) {
const translate = useTranslate();
const style = useS(styles);
const usersAdministrationService = useService(UsersAdministrationService);
const commonDialogService = useService(CommonDialogService);

const [open, setOpen] = useState(false);
const onToggle = useCallback(async () => {
setOpen(true);
try {
await commonDialogService.open(UsersTableFiltersDialog, filters);
} finally {
setOpen(false);
}
}, [commonDialogService, filters]);
const openContext = useMemo(() => ({ open, onToggle }), [open, onToggle]);

return (
<div className={s(style, { filters: true })}>
<div className={s(style, { filterContainer: true })}>
<div className={s(style, { filterContainer: true })}>
<div className={s(style, { searchGroup: true })}>
<Filter
className="tw:w-full tw:max-w-sm"
className={s(style, { search: true }, 'tw:w-sm')}
placeholder={translate('authentication_administration_users_filters_search_placeholder')}
value={filters.search}
onChange={filters.setSearch}
/>
<UsersTableFiltersOpenContext.Provider value={openContext}>
<UsersTableFilterButton filters={filters} />
<ToolbarActions className="tw:ml-auto">
{actionsSlot}
<Placeholder container={usersAdministrationService.actionButtonsPlaceholder} filters={filters} />
</ToolbarActions>
</UsersTableFiltersOpenContext.Provider>
<UsersTableFilterButton filters={filters} roles={roles} />
</div>
<ToolbarActions className="tw:ml-auto">
{actionsSlot}
<Placeholder container={usersAdministrationService.actionButtonsPlaceholder} filters={filters} />
</ToolbarActions>
</div>
);
});
Loading
Loading