Skip to content

Commit

Permalink
Web UI tweaks (#42502)
Browse files Browse the repository at this point in the history
- remove disabling auto discover toggle for RDS
  when theres nothing in table
- use the correct default value for css pointer-events field
- fix reading previous data while loading next data for locks table
  • Loading branch information
kimlisa authored Jun 5, 2024
1 parent 10212c3 commit 129c2eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ export function EnrollRdsDatabase() {
<ToggleSection
wantAutoDiscover={wantAutoDiscover}
toggleWantAutoDiscover={() => setWantAutoDiscover(b => !b)}
isDisabled={tableData.items.length === 0}
discoveryGroupName={discoveryGroupName}
setDiscoveryGroupName={setDiscoveryGroupName}
clusterPublicUrl={ctx.storeUser.state.cluster.publicURL}
Expand Down Expand Up @@ -443,25 +442,19 @@ function getRdsEngineIdentifier(engine: DatabaseEngine): RdsEngineIdentifier {
function ToggleSection({
wantAutoDiscover,
toggleWantAutoDiscover,
isDisabled,
discoveryGroupName,
setDiscoveryGroupName,
clusterPublicUrl,
}: {
wantAutoDiscover: boolean;
isDisabled: boolean;
toggleWantAutoDiscover(): void;
discoveryGroupName: string;
setDiscoveryGroupName(n: string): void;
clusterPublicUrl: string;
}) {
return (
<Box mb={2}>
<Toggle
isToggled={wantAutoDiscover}
onToggle={toggleWantAutoDiscover}
disabled={isDisabled}
>
<Toggle isToggled={wantAutoDiscover} onToggle={toggleWantAutoDiscover}>
<Box ml={2} mr={1}>
Auto-enroll all databases for selected region
</Box>
Expand Down
2 changes: 1 addition & 1 deletion web/packages/teleport/src/Integrations/Enroll/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const IntegrationTile = styled(Flex)`
cursor: pointer;
${props => {
const pointerEvents = props.disabled || props.$exists ? 'none' : null;
const pointerEvents = props.disabled || props.$exists ? 'none' : 'auto';
if (props.$exists) {
return { pointerEvents };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ export function ServerSideSupportedList(props: CommonListProps) {
}

const table = useMemo(() => {
// If there is a fetchStatus, a fetching is going on.
// Show the loading indicator instead of trying to process previous data.
const resources = fetchStatus === 'loading' ? [] : fetchedData.agents;
const listProps: ServerSideListProps = {
fetchStatus,
customSort: {
Expand All @@ -120,21 +123,17 @@ export function ServerSideSupportedList(props: CommonListProps) {

switch (props.selectedResourceKind) {
case 'role':
return (
<Roles roles={fetchedData.agents as RoleResource[]} {...listProps} />
);
return <Roles roles={resources as RoleResource[]} {...listProps} />;
case 'node':
return <Nodes nodes={fetchedData.agents as Node[]} {...listProps} />;
return <Nodes nodes={resources as Node[]} {...listProps} />;
case 'windows_desktop':
return (
<Desktops desktops={fetchedData.agents as Desktop[]} {...listProps} />
);
return <Desktops desktops={resources as Desktop[]} {...listProps} />;
default:
console.error(
`[ServerSideSupportedList.tsx] table not defined for resource kind ${props.selectedResourceKind}`
);
}
}, [props.attempt, fetchedData, fetchStatus, props.selectedResources]);
}, [fetchedData, fetchStatus, props.selectedResources]);

return (
<TableWrapper
Expand Down

0 comments on commit 129c2eb

Please sign in to comment.