Skip to content

Commit

Permalink
Table sort
Browse files Browse the repository at this point in the history
  • Loading branch information
michellescripts committed Dec 24, 2024
1 parent 70a61f4 commit 32c924a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
AwsResource,
StatCard,
} from 'teleport/Integrations/status/AwsOidc/StatCard';
import {AwsOidcTitle} from "teleport/Integrations/status/AwsOidc/AwsOidcTitle";
import { AwsOidcTitle } from 'teleport/Integrations/status/AwsOidc/AwsOidcTitle';

export function AwsOidcDashboard() {
const { statsAttempt, integrationAttempt } = useAwsOidcStatus();
Expand All @@ -54,7 +54,7 @@ export function AwsOidcDashboard() {
<>
<AwsOidcHeader integration={integration} />
<FeatureBox css={{ maxWidth: '1400px', paddingTop: '16px' }}>
{integration && <AwsOidcTitle integration={integration}/>}
{integration && <AwsOidcTitle integration={integration} />}
<H2 my={3}>Auto-Enrollment</H2>
<Flex gap={3}>
<StatCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export function AwsOidcTitle({
const { status, labelKind } = getStatusAndLabel(integration);

const content = {
to: !resource ? cfg.routes.integrations : cfg.getIntegrationStatusRoute(integration.kind, integration.name),
to: !resource
? cfg.routes.integrations
: cfg.getIntegrationStatusRoute(integration.kind, integration.name),
helper: !resource ? 'Back to integrations' : 'Back to integration',
content: !resource ? integration.name : resource.toUpperCase(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { AwsResource } from 'teleport/Integrations/status/AwsOidc/StatCard';
import { IntegrationKind } from 'teleport/services/integrations';
import { Rds } from 'teleport/Integrations/status/AwsOidc/Details/Rds';
import { Rules } from 'teleport/Integrations/status/AwsOidc/Details/Rules';
import {AwsOidcTitle} from "teleport/Integrations/status/AwsOidc/AwsOidcTitle";
import { AwsOidcTitle } from 'teleport/Integrations/status/AwsOidc/AwsOidcTitle';

export function Details() {
const { resourceKind } = useParams<{
Expand All @@ -42,7 +42,9 @@ export function Details() {
<AwsOidcHeader integration={integration} resource={resourceKind} />
)}
<FeatureBox css={{ maxWidth: '1400px', paddingTop: '16px', gap: '30px' }}>
{integration && <AwsOidcTitle integration={integration} resource={resourceKind}/>}
{integration && (
<AwsOidcTitle integration={integration} resource={resourceKind} />
)}
{resourceKind == AwsResource.ec2 && <Rules />}
{resourceKind == AwsResource.eks && <Rules />}
{resourceKind == AwsResource.rds && <Rds />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
import { AwsResource } from 'teleport/Integrations/status/AwsOidc/StatCard';
import { SearchPanel } from 'shared/components/Search';
import { useServerSidePagination } from 'teleport/components/hooks';
import { SortType } from 'design/DataTable/types';

export function Rules() {
const { name, resourceKind } = useParams<{
Expand All @@ -39,6 +40,10 @@ export function Rules() {
}>();

const [search, setSearch] = useState('');
const [sort, setSort] = useState<SortType>({
fieldName: 'region',
dir: 'ASC',
});
const serverSidePagination =
useServerSidePagination<IntegrationDiscoveryRule>({
pageSize: 20,
Expand All @@ -52,12 +57,12 @@ export function Rules() {
return { agents: rules, nextKey };
},
clusterId: '',
params: { search },
params: { search, sort },
});

useEffect(() => {
serverSidePagination.fetch();
}, [search]);
}, [search, sort]);

return (
<Table<IntegrationDiscoveryRule>
Expand Down Expand Up @@ -98,8 +103,8 @@ export function Rules() {
onFetchPrev: serverSidePagination.fetchPrev,
}}
serversideProps={{
sort: undefined,
setSort: () => undefined,
sort: sort,
setSort: setSort,
serversideSearchPanel: (
<SearchPanel
updateSearch={setSearch}
Expand Down

0 comments on commit 32c924a

Please sign in to comment.