Skip to content

Commit

Permalink
Merge branch 'devel' into CB-5625-show-only-enabled-identity-provider…
Browse files Browse the repository at this point in the history
…s-in-configuration-section
  • Loading branch information
EvgeniaBzzz authored Sep 27, 2024
2 parents 18f0b05 + cf764f5 commit 8548b9c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ export class ResourceOffsetPagination<TKey, TMetadata extends ICachedResourceMet
return undefined;
}

const page = this.metadata.get(key as TKey).offsetPage;

if (!page || !isOffsetPageInRange(page, key.options)) {
return undefined;
}

return page;
return this.metadata.get(key as TKey).offsetPage;
}

hasNextPage(key: ResourceAlias<TKey, Readonly<ICachedResourceOffsetPageOptions>>): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import { observer } from 'mobx-react-lite';
import { useState } from 'react';

import { AuthRolesResource } from '@cloudbeaver/core-authentication';
import { Combobox, Filter, Group, IconOrImage, s, useResource, useS, useTranslate } from '@cloudbeaver/core-blocks';
import { Filter, Group, IconOrImage, Loader, s, useS, useTranslate } from '@cloudbeaver/core-blocks';

import styles from './UsersTableFilters.module.css';
import { type IUserFilters, USER_ROLE_ALL, USER_STATUSES } from './useUsersTableFilters.js';
import { UsersTableFiltersDetails } from './UsersTableFiltersDetails.js';
import { type IUserFilters } from './useUsersTableFilters.js';

interface Props {
filters: IUserFilters;
Expand All @@ -21,7 +21,6 @@ interface Props {
export const UsersTableFilters = observer<Props>(function UsersTableFilters({ filters }) {
const translate = useTranslate();
const style = useS(styles);
const authRolesResource = useResource(UsersTableFilters, AuthRolesResource, undefined);

const [open, setOpen] = useState(false);

Expand All @@ -42,23 +41,9 @@ export const UsersTableFilters = observer<Props>(function UsersTableFilters({ fi
</div>

{open && (
<Group box gap>
<Combobox
value={filters.status}
items={USER_STATUSES}
valueSelector={value => translate(value.label)}
keySelector={value => value.value}
keepSize
onSelect={filters.setStatus}
>
{translate('authentication_user_status')}
</Combobox>
{!!authRolesResource.data.length && (
<Combobox items={[...authRolesResource.data, USER_ROLE_ALL]} value={filters.role} keepSize onSelect={filters.setRole}>
{translate('authentication_user_role')}
</Combobox>
)}
</Group>
<Loader suspense inline>
<UsersTableFiltersDetails filters={filters} />
</Loader>
)}
</Group>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.
*/
import { observer } from 'mobx-react-lite';

import { AuthRolesResource } from '@cloudbeaver/core-authentication';
import { Combobox, Group, useResource, useTranslate } from '@cloudbeaver/core-blocks';

import { type IUserFilters, USER_ROLE_ALL, USER_STATUSES } from './useUsersTableFilters.js';

interface Props {
filters: IUserFilters;
}

export const UsersTableFiltersDetails = observer<Props>(function UsersTableFiltersDetails({ filters }) {
const translate = useTranslate();
const authRolesResource = useResource(UsersTableFiltersDetails, AuthRolesResource, undefined);

return (
<Group box gap>
<Combobox
value={filters.status}
items={USER_STATUSES}
valueSelector={value => translate(value.label)}
keySelector={value => value.value}
keepSize
onSelect={filters.setStatus}
>
{translate('authentication_user_status')}
</Combobox>
{!!authRolesResource.data.length && (
<Combobox items={[...authRolesResource.data, USER_ROLE_ALL]} value={filters.role} keepSize onSelect={filters.setRole}>
{translate('authentication_user_role')}
</Combobox>
)}
</Group>
);
});

0 comments on commit 8548b9c

Please sign in to comment.