Skip to content
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
3 changes: 0 additions & 3 deletions libs/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@
"Select Organization": "Select Organization",
"Change Organization": "Change Organization",
"Settings": "Settings",
"Technology preview features provide early access to upcoming product innovations, enabling you to test functionality and provide feedback during the development process.": "Technology preview features provide early access to upcoming product innovations, enabling you to test functionality and provide feedback during the development process.",
"Technology preview description": "Technology preview description",
"Technology preview": "Technology preview",
"Fleet not found": "Fleet not found",
"We could not find the fleet with id <1>{id}</1>": "We could not find the fleet with id <1>{id}</1>",
"Device not found": "Device not found",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ const DevicesPage = ({ canListER }: { canListER: boolean }) => {
setSelectedLabels,
} = useDeviceBackendFilters();
const [onlyDecommissioned, setOnlyDecommissioned] = React.useState<boolean>(false);
const [showDeviceListBadge, setShowDeviceListBadge] = React.useState<boolean>(true);

const onEmptyErChanged = React.useCallback((isEmpty: boolean) => {
if (isEmpty) {
setShowDeviceListBadge(true);
} else {
setShowDeviceListBadge(false);
}
}, []);

const { currentPage, setCurrentPage, onPageFetched, nextContinue, itemCount } = useTablePagination<DeviceList>(
onlyDecommissioned ? undefined : removeDecommissionedDevices,
Expand All @@ -71,9 +62,9 @@ const DevicesPage = ({ canListER }: { canListER: boolean }) => {

return (
<>
{canListER && <EnrollmentRequestList onEmptyListChanged={onEmptyErChanged} refetchDevices={refetch} />}
{canListER && <EnrollmentRequestList refetchDevices={refetch} />}

<ListPage title={t('Devices')} withBadge={showDeviceListBadge}>
<ListPage title={t('Devices')}>
{/* When searching for decommissioned devices we want to avoid showing the enrolled devices */}
<ListPageBody error={error} loading={loading || (onlyDecommissioned && updating && !hasFiltersEnabled)}>
{onlyDecommissioned ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const getEnrollmentColumns = (t: TFunction): ApiSortTableColumn[] => [

type EnrollmentRequestListProps = {
refetchDevices?: VoidFunction;
onEmptyListChanged?: (isEmpty: boolean) => void;
isStandalone?: boolean;
};

Expand All @@ -51,7 +50,7 @@ const enrollmentRequestListPermissions = [
{ kind: RESOURCE.ENROLLMENT_REQUEST, verb: VERB.DELETE },
];

const EnrollmentRequestList = ({ onEmptyListChanged, refetchDevices, isStandalone }: EnrollmentRequestListProps) => {
const EnrollmentRequestList = ({ refetchDevices, isStandalone }: EnrollmentRequestListProps) => {
const { t } = useTranslation();
const { checkPermissions } = usePermissionsContext();
const [canApprove, canDelete] = checkPermissions(enrollmentRequestListPermissions);
Expand Down Expand Up @@ -81,12 +80,6 @@ const EnrollmentRequestList = ({ onEmptyListChanged, refetchDevices, isStandalon
},
});

React.useEffect(() => {
if (onEmptyListChanged && !search && !isLoading) {
onEmptyListChanged?.(itemCount === 0);
}
}, [search, itemCount, isLoading, onEmptyListChanged]);

// In non-standalone mode, hide the entire component when the search result is empty (and not due to filtering)
const isLastUnfilteredListEmpty = !search && itemCount === 0;
if (!isStandalone && isLastUnfilteredListEmpty) {
Expand Down
9 changes: 1 addition & 8 deletions libs/ui-components/src/components/ListPage/ListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import * as React from 'react';

import { Flex, FlexItem, PageSection, PageSectionVariants, Title, TitleProps } from '@patternfly/react-core';
import TechPreviewBadge from '../common/TechPreviewBadge';

type ListPageProps = {
title: string;
headingLevel?: TitleProps['headingLevel'];
children: React.ReactNode;
withBadge?: boolean;
};

const ListPage: React.FC<ListPageProps> = ({ title, headingLevel = 'h1', withBadge = true, children }) => {
const ListPage: React.FC<ListPageProps> = ({ title, headingLevel = 'h1', children }) => {
return (
<PageSection variant={PageSectionVariants.light}>
<Flex gap={{ default: 'gapMd' }} alignItems={{ default: 'alignItemsCenter' }}>
Expand All @@ -19,11 +17,6 @@ const ListPage: React.FC<ListPageProps> = ({ title, headingLevel = 'h1', withBad
{title}
</Title>
</FlexItem>
{withBadge && (
<FlexItem>
<TechPreviewBadge />
</FlexItem>
)}
</Flex>
{children}
</PageSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
Alert,
Button,
Divider,
Flex,
FlexItem,
List,
ListItem,
PageSection,
Expand All @@ -16,7 +14,6 @@ import {
} from '@patternfly/react-core';
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';

import TechPreviewBadge from '../common/TechPreviewBadge';
import { useTranslation } from '../../hooks/useTranslation';
import { useAppContext } from '../../hooks/useAppContext';
import { getErrorMessage } from '../../utils/error';
Expand Down Expand Up @@ -140,14 +137,7 @@ const CommandLineToolsPage = () => {
<PageSection variant={PageSectionVariants.light}>
<Stack hasGutter>
<StackItem>
<Flex>
<FlexItem>
<Title headingLevel="h1">{t('Command Line Tools')}</Title>
</FlexItem>
<FlexItem>
<TechPreviewBadge />
</FlexItem>
</Flex>
<Title headingLevel="h1">{t('Command Line Tools')}</Title>
</StackItem>
<Divider className="pf-v5-u-my-lg" />
<StackItem>
Expand Down
19 changes: 6 additions & 13 deletions libs/ui-components/src/components/OverviewPage/OverviewPage.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import * as React from 'react';
import Overview from './Overview';
import { PageSection, PageSectionVariants, Title } from '@patternfly/react-core';

import { useTranslation } from '../../hooks/useTranslation';
import { Flex, FlexItem, PageSection, PageSectionVariants, Title } from '@patternfly/react-core';
import TechPreviewBadge from '../common/TechPreviewBadge';
import Overview from './Overview';

const OverviewPage = () => {
const { t } = useTranslation();
return (
<>
<PageSection variant={PageSectionVariants.light}>
<Flex gap={{ default: 'gapMd' }} alignItems={{ default: 'alignItemsCenter' }}>
<FlexItem>
<Title headingLevel="h1" size="3xl" role="heading">
{t('Overview')}
</Title>
</FlexItem>
<FlexItem>
<TechPreviewBadge />
</FlexItem>
</Flex>
<Title headingLevel="h1" size="3xl" role="heading">
{t('Overview')}
</Title>
</PageSection>
<PageSection variant={PageSectionVariants.light} isFilled>
<Overview />
Expand Down
45 changes: 0 additions & 45 deletions libs/ui-components/src/components/common/TechPreviewBadge.tsx

This file was deleted.