Skip to content

Commit

Permalink
wip Workbenches, need image
Browse files Browse the repository at this point in the history
more workbenches a11y updates

fix dsp modal

fix more select issues

prettier

remove unused import

revert id update

fix project modal

revert stack

wip Workbenches, need image

more workbenches a11y updates

fix dsp modal

fix more select issues

prettier

Add faker for the pass through api to enable regular user testing (#806)

* Add faker for the pass through api to enable regular user testing

* Add faker for backend openshift user

* add impersonate function for developers

* address comments and modify the doc

* Update to get the access token by making API call

* update doc

* add error message

* Fix lint issues

* address comments

---------

Co-authored-by: Juntao Wang <juntwang@redhat.com>

Storybook test integration (#974)

* added storybook boilerplate

added a mock and decorator

added tests

fixed deps for storybook

linter

old tests dont work on jest 28, reverting

linter error fix

fix build errors

fixed deps

* trimmed mocks

fixed tests

* fix webpack changes

* added a11y test to test-runner

fix a11y errors in settings (#979)

varname

rename bodyText to ariaLabel

add aria label to select

add aria-label to Select

fix a11y violation in cluster storage modal and list view

package-lock.json

package-lock.json

fix a11y in data connections and models/model servers

update DetailsSection to match changes on other branch

update Table file

fix pagination axe error

PR feedback from Andrew

change aria label text on password input
  • Loading branch information
jenny-s51 committed Mar 9, 2023
1 parent 730c03b commit c9a0c70
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 26 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import useTableColumnSort, { SortableData } from '~/utilities/useTableColumnSort
type TableProps<DataType> = {
data: DataType[];
columns: SortableData<DataType>[];
rowRenderer: (data: DataType) => React.ReactNode;
rowRenderer: (data: DataType, rowIndex: number) => React.ReactNode;
enablePagination?: boolean;
minPageSize?: number;
toolbarContent?: React.ReactElement<typeof ToolbarItem>;
Expand Down Expand Up @@ -50,9 +50,8 @@ const Table = <T,>({
const sort = useTableColumnSort<T>(columns, 0);

const showPagination = enablePagination && allData.length > minPageSize;
const pagination = (pageDirection: 'up' | 'down') => (
const pagination = (variant: 'top' | 'bottom') => (
<Pagination
dropDirection={pageDirection}
perPageComponent="button"
itemCount={allData.length}
perPage={pageSize}
Expand All @@ -62,6 +61,7 @@ const Table = <T,>({
setPageSize(newSize);
setPage(newPage);
}}
variant={variant}
widgetId="table-pagination"
/>
);
Expand All @@ -74,7 +74,7 @@ const Table = <T,>({
{toolbarContent}
{showPagination && (
<ToolbarItem variant="pagination" alignment={{ default: 'alignRight' }}>
{pagination('down')}
{pagination('top')}
</ToolbarItem>
)}
</ToolbarContent>
Expand All @@ -96,9 +96,11 @@ const Table = <T,>({
</Tr>
</Thead>
{disableRowRenderSupport ? (
sort.transformData(data).map((row) => rowRenderer(row))
sort.transformData(data).map((row, rowIndex) => rowRenderer(row, rowIndex))
) : (
<Tbody>{sort.transformData(data).map((row) => rowRenderer(row))}</Tbody>
<Tbody>
{sort.transformData(data).map((row, rowIndex) => rowRenderer(row, rowIndex))}
</Tbody>
)}
</TableComposable>
{emptyTableView && data.length === 0 && (
Expand All @@ -110,7 +112,7 @@ const Table = <T,>({
<Toolbar>
<ToolbarContent>
<ToolbarItem variant="pagination" alignment={{ default: 'alignRight' }}>
{pagination('up')}
{pagination('bottom')}
</ToolbarItem>
</ToolbarContent>
</Toolbar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ServingRuntimeTokenInput: React.FC<ServingRuntimeTokenInputProps> = ({
return (
<FormGroup
label="Service account name"
fieldId="service-account-form-name"
helperText="Enter the service account name for which the token will be generated"
helperTextInvalid={token.error}
helperTextInvalidIcon={<ExclamationCircleIcon />}
Expand All @@ -56,9 +57,9 @@ const ServingRuntimeTokenInput: React.FC<ServingRuntimeTokenInputProps> = ({
value={token.name}
isRequired
type="text"
id="simple-form-name-01"
name="simple-form-name-01"
aria-describedby="simple-form-name-01-helper"
id="service-account-form-name"
name="service-account-form-name"
aria-describedby="service-account-form-name-helper"
validated={token.error ? ValidatedOptions.error : ValidatedOptions.default}
onChange={(value) => {
const tokens = data.tokens?.map((item) =>
Expand All @@ -78,6 +79,7 @@ const ServingRuntimeTokenInput: React.FC<ServingRuntimeTokenInputProps> = ({
<SplitItem>
<Button
variant="plain"
aria-label="Remove service account"
icon={<MinusCircleIcon />}
onClick={() => {
setData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ const EnvironmentVariablesRow: React.FC<EnvironmentVariablesRowProps> = ({
>
{selectOptions}
</Select>
<Button data-id="remove-env-var-button" variant="plain" onClick={removeVariables}>
<Button
aria-label="Remove environment variable"
data-id="remove-env-var-button"
variant="plain"
onClick={removeVariables}
>
<MinusCircleIcon />
</Button>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const SizeSelectField: React.FC<SizeSelectFieldProps> = ({ value, setValue, size
isOpen={sizeDropdownOpen}
onToggle={() => setSizeDropdownOpen(!sizeDropdownOpen)}
aria-labelledby="container-size"
aria-label="Select a container size"
selections={value.name}
onSelect={(event, selection) => {
// We know we are setting values as a string
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/projects/components/DeleteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const DeleteModal: React.FC<DeleteModalProps> = ({
<StackItem>
<TextInput
id="delete-modal-input"
aria-label="Delete modal input"
value={value}
onChange={(newValue) => setValue(newValue)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const ExistingPVCField: React.FC<ExistingPVCFieldProps> = ({
<Select
removeFindDomNode
variant="typeahead"
aria-label="Persistent storage select"
selections={selectedStorage}
isOpen={isOpen}
onClear={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
ref={autoSelectNameRef}
id={nameFieldId}
name={nameFieldId}
aria-labelledby={nameFieldId}
value={data.name}
onChange={(name) => setData({ ...data, name })}
/>
Expand All @@ -69,7 +68,7 @@ const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
</Tooltip>
}
isRequired
fieldId={nameFieldId}
fieldId={`resource-${nameFieldId}`}
helperText={
!disableK8sName &&
"Must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character"
Expand All @@ -80,7 +79,6 @@ const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
isDisabled={disableK8sName}
id={`resource-${nameFieldId}`}
name={`resource-${nameFieldId}`}
aria-labelledby={`resource-${nameFieldId}`}
value={data.k8sName ?? k8sName}
onChange={(k8sName) => {
setData({ ...data, k8sName });
Expand All @@ -96,7 +94,6 @@ const NameDescriptionField: React.FC<NameDescriptionFieldProps> = ({
resizeOrientation="vertical"
id={descriptionFieldId}
name={descriptionFieldId}
aria-labelledby={descriptionFieldId}
value={data.description}
onChange={(description) => setData({ ...data, description })}
/>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/pages/projects/components/PasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const PasswordInput: React.FC<React.ComponentProps<typeof TextInput>> = (props)
return (
<InputGroup>
<TextInput {...props} type={isPassword ? 'password' : 'text'} />
<Button variant="control" onClick={() => setPassword(!isPassword)}>
<Button
aria-label={isPassword ? 'Show password' : 'Hide password'}
variant="control"
onClick={() => setPassword(!isPassword)}
>
{isPassword ? <EyeSlashIcon /> : <EyeIcon />}
</Button>
</InputGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const ConnectedNotebookField: React.FC<SelectNotebookFieldProps> = ({
selections={selections}
isOpen={notebookSelectOpen}
isDisabled={disabled}
aria-label="Notebook select"
onClear={() => {
onSelect([]);
setNotebookSelectOpen(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const DetailsSection: React.FC<DetailsSectionProps> = ({
<StackItem>
<Flex>
<FlexItem>
<Title id={id} headingLevel="h4" size="xl">
<Title id={`${id}-title`} headingLevel="h4" size="xl">
{title}
</Title>
</FlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ const NotebookTable: React.FC<NotebookTableProps> = ({ notebookStates, refresh }
data={notebookStates}
columns={columns}
disableRowRenderSupport
rowRenderer={(notebookState) => (
rowRenderer={(notebookState, i) => (
<NotebookTableRow
key={notebookState.notebook.metadata.uid}
rowIndex={i}
obj={notebookState}
onNotebookDelete={setNotebookToDelete}
onNotebookAddStorage={setAddNotebookStorage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ import NotebookStorageBars from './NotebookStorageBars';

type NotebookTableRowProps = {
obj: NotebookState;
rowIndex: number;
onNotebookDelete: (notebook: NotebookKind) => void;
onNotebookAddStorage: (notebook: NotebookKind) => void;
};

const NotebookTableRow: React.FC<NotebookTableRowProps> = ({
obj,
rowIndex,
onNotebookDelete,
onNotebookAddStorage,
}) => {
Expand All @@ -45,7 +47,14 @@ const NotebookTableRow: React.FC<NotebookTableRowProps> = ({
return (
<Tbody isExpanded={isExpanded}>
<Tr>
<Td expand={{ rowIndex: 0, isExpanded, onToggle: () => setExpanded(!isExpanded) }} />
<Td
expand={{
rowIndex: rowIndex,
expandId: 'notebook-row-item',
isExpanded,
onToggle: () => setExpanded(!isExpanded),
}}
/>
<Td dataLabel="Name">
<Title headingLevel="h4">
<ResourceNameTooltip resource={obj.notebook}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ const StorageTable: React.FC<StorageTableProps> = ({ pvcs, refresh, onAddPVC })
columns={columns}
disableRowRenderSupport
variant="compact"
rowRenderer={(pvc) => (
rowRenderer={(pvc, i) => (
<StorageTableRow
key={pvc.metadata.uid}
rowIndex={i}
obj={pvc}
onEditPVC={setEditPVC}
onDeletePVC={setDeleteStorage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import StorageWarningStatus from './StorageWarningStatus';

type StorageTableRowProps = {
obj: PersistentVolumeClaimKind;
rowIndex: number;
onDeletePVC: (pvc: PersistentVolumeClaimKind) => void;
onEditPVC: (pvc: PersistentVolumeClaimKind) => void;
onAddPVC: () => void;
};

const StorageTableRow: React.FC<StorageTableRowProps> = ({
obj,
rowIndex,
onDeletePVC,
onEditPVC,
onAddPVC,
Expand Down Expand Up @@ -55,7 +57,14 @@ const StorageTableRow: React.FC<StorageTableRowProps> = ({
return (
<Tbody isExpanded={isExpanded}>
<Tr>
<Td expand={{ rowIndex: 0, isExpanded, onToggle: () => setExpanded(!isExpanded) }} />
<Td
expand={{
rowIndex: rowIndex,
expandId: 'storage-row-item',
isExpanded,
onToggle: () => setExpanded(!isExpanded),
}}
/>
<Td dataLabel="Name">
<Flex
spaceItems={{ default: 'spaceItemsSm' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const EmptyProjects: React.FC = () => {
<EmptyStateSecondaryActions>
<Button
href="/notebookController"
component="a"
variant="link"
onClick={(e) => {
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ const ProjectListView: React.FC<ProjectListViewProps> = ({
<NewProjectButton />
</ToolbarItem>
<ToolbarItem>
<Button variant="link">
<Link to="/notebookController">Launch Jupyter</Link>
</Button>
<Button
variant="link"
component={() => <Link to="/notebookController">Launch Jupyter</Link>}
/>
</ToolbarItem>
</React.Fragment>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ContainerSizeSelector: React.FC<ContainerSizeSelectorProps> = ({
data-id="container-size-select"
isOpen={sizeDropdownOpen}
onToggle={() => setSizeDropdownOpen(!sizeDropdownOpen)}
aria-labelledby="container-size"
aria-label="Container size select"
selections={value.name}
onSelect={(event, selection) => {
// We know we are setting values as a string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const EnvTypeSelectField: React.FC<EnvTypeSelectFieldProps> = ({
onToggle={() => setOpen(!open)}
selections={envVariable.type || ''}
placeholderText="Select one"
aria-label="Select one"
onSelect={(e, value) => {
if (typeof value === 'string') {
onUpdate({
Expand Down Expand Up @@ -65,7 +66,12 @@ const EnvTypeSelectField: React.FC<EnvTypeSelectFieldProps> = ({
</Stack>
</SplitItem>
<SplitItem>
<Button variant="plain" icon={<MinusCircleIcon />} onClick={() => onRemove()} />
<Button
variant="plain"
aria-label="Remove environment variable"
icon={<MinusCircleIcon />}
onClick={() => onRemove()}
/>
</SplitItem>
</Split>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const GenericKeyValuePairField: React.FC<GenericKeyValuePairFieldProps> = ({
<SplitItem style={{ paddingTop: 'var(--pf-global--spacer--xl)' }}>
<Button
isDisabled={values.length === 1}
aria-label="Remove key-value pair"
variant="plain"
icon={<MinusCircleIcon />}
onClick={() => onUpdate(removeArrayItem(values, i))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const ImageStreamSelector: React.FC<ImageStreamSelectorProps> = ({
setImageSelectionOpen(false);
}
}}
aria-label="Select an image"
isOpen={imageSelectionOpen}
selections={selectOptionObjects.find(
(optionObject) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const ImageVersionSelector: React.FC<ImageVersionSelectorProps> = ({
setVersionSelectionOpen(false);
}
}}
aria-label="Image version select"
isOpen={versionSelectionOpen}
selections={selectOptionObjects.find(
(optionObject) => optionObject.imageVersion.name === selectedImageVersion?.name,
Expand Down

0 comments on commit c9a0c70

Please sign in to comment.