Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMS-5268: Template detail page - minor ux changes #411

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ConditionalTooltip from 'components/ConditionalTooltip/ConditionalTooltip';
import EmptyTableState from 'components/EmptyTableState/EmptyTableState';
import Hide from 'components/Hide/Hide';
import { formatDateDDMMMYYYY } from 'helpers';
import { formatDateUTC } from 'helpers';
import useDeepCompareEffect from 'Hooks/useDeepCompareEffect';
import useRootPath from 'Hooks/useRootPath';
import { isEmpty } from 'lodash';
Expand Down Expand Up @@ -74,7 +74,7 @@ export default function TemplateRepositoriesTable({
}, [snapshotList.length]);

const columnHeaders = [
{ name: 'Repository Name' },
{ name: 'Name' },
{ name: 'Snapshot Date', width: 20 },
Copy link
Member

@swadeley swadeley Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ name: 'Snapshot Date', width: 20 },
{ name: 'Snapshot date', width: 20 },

In associated Jira, red is used to highlight what is wanted.
EDIT: Maybe it was just sentence case that was asked for, i.e. 'Snapshot date'. I'll ask in Jira for confirmation.

{ name: 'Change', width: 15 },
{ name: 'Packages', width: 15 },
Expand All @@ -98,7 +98,7 @@ export default function TemplateRepositoriesTable({
<Thead>
<Tr>
{columnHeaders.map(({ name, width }, index) =>
name === 'Repository Name' || name === 'Snapshot Date' ? (
name === 'Name' || name === 'Snapshot Date' ? (
<Th
width={width as BaseCellProps['width']}
key={index + name + '_header'}
Expand Down Expand Up @@ -162,7 +162,7 @@ export default function TemplateRepositoriesTable({
</Hide>
</Flex>
</Td>
<Td>{formatDateDDMMMYYYY(created_at, true)}</Td>
<Td>{formatDateUTC(created_at)}</Td>
<Td>
<ChangedArrows
addedCount={added_counts?.['rpm.package'] || 0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import {
Flex,
FlexItem,
Grid,
InputGroup,
InputGroupItem,
InputGroupText,
Pagination,
PaginationVariant,
TextInput,
} from '@patternfly/react-core';
import { global_BackgroundColor_100, global_Color_200 } from '@patternfly/react-tokens';
import { useEffect, useMemo, useState } from 'react';
Expand All @@ -28,8 +22,6 @@ import ConditionalTooltip from 'components/ConditionalTooltip/ConditionalTooltip
import { useAppContext } from 'middleware/AppContext';
import { ADD_ROUTE } from 'Routes/constants';
import Hide from 'components/Hide/Hide';
import SystemsDeleteKebab from 'components/SharedTables/SystemsTable/Components/SystemsDeleteKebab';
import { SearchIcon } from '@patternfly/react-icons';
import useDebounce from 'Hooks/useDebounce';

const useStyles = createUseStyles({
Expand Down Expand Up @@ -74,7 +66,7 @@ export default function TemplateSystemsTab() {
const storedPerPage = Number(localStorage.getItem(perPageKey)) || 20;
const [page, setPage] = useState(1);
const [searchQuery, setSearchQuery] = useState('');
const [perPage, setPerPage] = useState(storedPerPage);
const [perPage] = useState(storedPerPage);

const [activeSortIndex, setActiveSortIndex] = useState<number>(-1);
const [activeSortDirection, setActiveSortDirection] = useState<'asc' | 'desc'>('asc');
Expand Down Expand Up @@ -143,7 +135,6 @@ export default function TemplateSystemsTab() {
]);
}
};
const onSetPage = (_, newPage) => setPage(newPage);

const handleSelectItem = (id: string) => {
if (selectedList.has(id)) {
Expand All @@ -153,15 +144,6 @@ export default function TemplateSystemsTab() {
}
};

const deselectAll = () => {
setSelected([]);
};

const onPerPageSelect = (_, newPerPage, newPage) => {
setPerPage(newPerPage);
setPage(newPage);
localStorage.setItem(perPageKey, newPerPage.toString());
};

const fetchingOrLoading = isFetching || isLoading || isDeleting;

Expand Down Expand Up @@ -198,61 +180,6 @@ export default function TemplateSystemsTab() {

return (
<Grid className={classes.mainContainer}>
<InputGroup className={classes.topContainer}>
<Flex gap={{ default: 'gapMd' }}>
<InputGroupItem>
<TextInput
id='search'
ouiaId='name_search'
placeholder='Filter by name'
value={searchQuery}
onChange={(_event, value) => setSearchQuery(value)}
/>
<InputGroupText id='search-icon'>
<SearchIcon />
</InputGroupText>
</InputGroupItem>
<FlexItem className={classes.ctions}>
<ConditionalTooltip
content={`You do not have the required ${missingRequirements} to perform this action.`}
show={isMissingRequirements}
setDisabled
>
<Button
id='assignTemplateToSystems'
ouiaId='assign_template_to_systems'
variant='primary'
isDisabled={fetchingOrLoading}
onClick={() => navigate('add')}
>
Assign template to systems
</Button>
</ConditionalTooltip>
</FlexItem>
<ConditionalTooltip
content={`You do not have the required ${missingRequirements} to perform this action.`}
show={isMissingRequirements}
setDisabled
>
<SystemsDeleteKebab
deleteFromSystems={deleteFromSystems}
deselectAll={deselectAll}
isDisabled={!rbac?.templateWrite}
selected={selected}
/>
</ConditionalTooltip>
</Flex>
<Pagination
id='top-pagination-id'
widgetId='topPaginationWidgetId'
itemCount={total_items}
perPage={perPage}
page={page}
onSetPage={onSetPage}
isCompact
onPerPageSelect={onPerPageSelect}
/>
</InputGroup>
<Hide hide={!!total_items}>
<Bullseye data-ouia-component-id='systems_list_page'>
<EmptyTableState
Expand Down Expand Up @@ -297,18 +224,6 @@ export default function TemplateSystemsTab() {
</Hide>
<Flex className={classes.bottomContainer}>
<FlexItem />
<FlexItem>
<Pagination
id='bottom-pagination-id'
widgetId='bottomPaginationWidgetId'
itemCount={total_items}
perPage={perPage}
page={page}
onSetPage={onSetPage}
variant={PaginationVariant.bottom}
onPerPageSelect={onPerPageSelect}
/>
</FlexItem>
</Flex>
<Outlet />
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SharedTables/PackagesTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function PackagesTable({
setPrev(packagesList.length || 10);
}, [packagesList.length]);

const columnHeaders = ['Name', 'Version', 'Release', 'Arch'];
const columnHeaders = ['Name', 'Version', 'Release', 'Architecture'];

return (
<>
Expand Down
Loading