Skip to content

Commit 529ef83

Browse files
committed
Apply Katie's feedback from other PR
1 parent 71cb6f0 commit 529ef83

File tree

22 files changed

+530
-342
lines changed

22 files changed

+530
-342
lines changed

package-lock.json

+34-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/module/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@patternfly/documentation-framework": "^6.5.16",
4747
"@patternfly/react-code-editor": "^6.0.0",
4848
"@patternfly/patternfly": "^6.0.0",
49-
"@types/react": "^19.1.0",
50-
"@types/react-dom": "^19.1.2",
49+
"@types/react": "^18.2.33",
50+
"@types/react-dom": "^18.3.1",
5151
"react": "^18.3.1",
5252
"react-dom": "^18.3.1",
5353
"typescript": "^5.8.3"

packages/module/src/Ansible/Ansible.tsx

+47-28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { HTMLAttributes, DetailedHTMLProps, FunctionComponent, CSSProperties } from 'react';
1+
import type { FunctionComponent, CSSProperties } from 'react';
22
import { Fragment } from 'react';
33
import clsx from 'clsx';
44
import { createUseStyles } from 'react-jss';
55

6-
export interface AnsibleProps extends DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> {
6+
export interface AnsibleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
77
/** Supported/unsupported variant flag */
88
isSupported?: boolean;
99
/** Red Hat Ansible Automation Platform technology icon */
@@ -14,22 +14,30 @@ export interface AnsibleProps extends DetailedHTMLProps<HTMLAttributes<HTMLEleme
1414
ouiaId?: string | number;
1515
}
1616

17-
const RHAAPTechnologyIcon =
18-
<svg
19-
width="24" height="24" viewBox="0 0 38 38"
20-
xmlns="http://www.w3.org/2000/svg">
21-
<defs>
22-
<style>
23-
{`.uuid-6998fa22-ec9a-4e2f-9d0d-f4bc3361e80e{fill:#e00;}`}
24-
{`.uuid-2a01d04c-89d4-48ba-a2d8-51034215da9b{fill:#fff;}`}
25-
{`.uuid-a19226e8-b71f-481c-815f-1ed60f4363a6{fill:#4d4d4d;}`}
26-
</style>
27-
</defs>
28-
<rect x="1" y="1" width="36" height="36" rx="9" ry="9"/>
29-
<path className="uuid-a19226e8-b71f-481c-815f-1ed60f4363a6" d="m28,2.25c4.27338,0,7.75,3.47664,7.75,7.75v18c0,4.27336-3.47662,7.75-7.75,7.75H10c-4.27338,0-7.75-3.47664-7.75-7.75V10c0-4.27336,3.47662-7.75,7.75-7.75h18m0-1.25H10C5.02942,1,1,5.02944,1,10v18c0,4.97057,4.02942,9,9,9h18c4.97058,0,9-4.02943,9-9V10c0-4.97056-4.02942-9-9-9h0Z"/>
30-
<path className="uuid-2a01d04c-89d4-48ba-a2d8-51034215da9b" d="m15,23.625c-.08594,0-.17383-.01758-.25684-.05566-.31445-.1416-.45508-.51172-.3125-.82617l2.02051-4.48145c.00293-.00586.00586-.01172.00781-.01758l1.97168-4.36914c.20117-.44922.9375-.44922,1.13867,0l4,8.86816c.11814.25977.04395.56641-.17871.74512-.22266.17773-.53613.18262-.7666.01172l-5.34961-4.02148-1.70508,3.77832c-.10352.23145-.33105.36816-.56934.36816Zm2.80078-5.31445l3.62891,2.72754-2.42969-5.38574-1.19922,2.6582Z"/>
31-
<path className="uuid-6998fa22-ec9a-4e2f-9d0d-f4bc3361e80e" d="m19,30.125c-6.13477,0-11.125-4.99023-11.125-11.125s4.99023-11.125,11.125-11.125,11.125,4.99023,11.125,11.125-4.99023,11.125-11.125,11.125Zm0-21c-5.44531,0-9.875,4.42969-9.875,9.875s4.42969,9.875,9.875,9.875,9.875-4.42969,9.875-9.875-4.42969-9.875-9.875-9.875Z"/>
32-
</svg>
17+
const RHAAPTechnologyIcon = (
18+
<svg width="24" height="24" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg">
19+
<defs>
20+
<style>
21+
{`.uuid-6998fa22-ec9a-4e2f-9d0d-f4bc3361e80e{fill:#e00;}`}
22+
{`.uuid-2a01d04c-89d4-48ba-a2d8-51034215da9b{fill:#fff;}`}
23+
{`.uuid-a19226e8-b71f-481c-815f-1ed60f4363a6{fill:#4d4d4d;}`}
24+
</style>
25+
</defs>
26+
<rect x="1" y="1" width="36" height="36" rx="9" ry="9" />
27+
<path
28+
className="uuid-a19226e8-b71f-481c-815f-1ed60f4363a6"
29+
d="m28,2.25c4.27338,0,7.75,3.47664,7.75,7.75v18c0,4.27336-3.47662,7.75-7.75,7.75H10c-4.27338,0-7.75-3.47664-7.75-7.75V10c0-4.27336,3.47662-7.75,7.75-7.75h18m0-1.25H10C5.02942,1,1,5.02944,1,10v18c0,4.97057,4.02942,9,9,9h18c4.97058,0,9-4.02943,9-9V10c0-4.97056-4.02942-9-9-9h0Z"
30+
/>
31+
<path
32+
className="uuid-2a01d04c-89d4-48ba-a2d8-51034215da9b"
33+
d="m15,23.625c-.08594,0-.17383-.01758-.25684-.05566-.31445-.1416-.45508-.51172-.3125-.82617l2.02051-4.48145c.00293-.00586.00586-.01172.00781-.01758l1.97168-4.36914c.20117-.44922.9375-.44922,1.13867,0l4,8.86816c.11814.25977.04395.56641-.17871.74512-.22266.17773-.53613.18262-.7666.01172l-5.34961-4.02148-1.70508,3.77832c-.10352.23145-.33105.36816-.56934.36816Zm2.80078-5.31445l3.62891,2.72754-2.42969-5.38574-1.19922,2.6582Z"
34+
/>
35+
<path
36+
className="uuid-6998fa22-ec9a-4e2f-9d0d-f4bc3361e80e"
37+
d="m19,30.125c-6.13477,0-11.125-4.99023-11.125-11.125s4.99023-11.125,11.125-11.125,11.125,4.99023,11.125,11.125-4.99023,11.125-11.125,11.125Zm0-21c-5.44531,0-9.875,4.42969-9.875,9.875s4.42969,9.875,9.875,9.875,9.875-4.42969,9.875-9.875-4.42969-9.875-9.875-9.875Z"
38+
/>
39+
</svg>
40+
);
3341

3442
const useStyles = createUseStyles({
3543
ansible: {
@@ -41,18 +49,24 @@ const useStyles = createUseStyles({
4149
},
4250
ansibleSupported: {
4351
'& .st0': {
44-
fill: 'var(--pf-t-global--icon--color--regular)',
52+
fill: 'var(--pf-t-global--icon--color--regular)'
4553
}
4654
},
4755
ansibleUnsupported: {
4856
'& .st0, .st1, .st2': {
4957
fill: 'var(--pf-t--global--icon--color--disabled)',
50-
cursor: 'not-allowed',
58+
cursor: 'not-allowed'
5159
}
5260
}
53-
})
61+
});
5462

55-
const Ansible: FunctionComponent<AnsibleProps> = ({ isSupported = true, isRHAAP, className, ouiaId = "Ansible-icon", ...props }: AnsibleProps) => {
63+
const Ansible: FunctionComponent<AnsibleProps> = ({
64+
isSupported = true,
65+
isRHAAP,
66+
className,
67+
ouiaId = 'Ansible-icon',
68+
...props
69+
}: AnsibleProps) => {
5670
const classes = useStyles();
5771
const ansibleLogoClass = clsx(
5872
classes.ansible,
@@ -71,7 +85,7 @@ const Ansible: FunctionComponent<AnsibleProps> = ({ isSupported = true, isRHAAP,
7185
width="803.8"
7286
height="221.5"
7387
/>
74-
88+
7589
<rect
7690
x="-279.7"
7791
y="904"
@@ -80,7 +94,7 @@ const Ansible: FunctionComponent<AnsibleProps> = ({ isSupported = true, isRHAAP,
8094
width="2590.2"
8195
height="221.5"
8296
/>
83-
97+
8498
<rect
8599
x="17.1"
86100
y="1620.5"
@@ -93,13 +107,18 @@ const Ansible: FunctionComponent<AnsibleProps> = ({ isSupported = true, isRHAAP,
93107
);
94108

95109
return (
96-
(<Fragment>
110+
<Fragment>
97111
{isRHAAP ? (
98112
<i title="Red Hat Ansible Automation Platform" data-ouia-component-id={ouiaId} {...props}>
99113
{RHAAPTechnologyIcon}
100114
</i>
101115
) : (
102-
<i className={ansibleLogoClass} title={isSupported ? "Ansible supported" : "Ansible is not supported" } data-ouia-component-id={ouiaId} {...props}>
116+
<i
117+
className={ansibleLogoClass}
118+
title={isSupported ? 'Ansible supported' : 'Ansible is not supported'}
119+
data-ouia-component-id={ouiaId}
120+
{...props}
121+
>
103122
<svg
104123
version="1.1"
105124
x="0px"
@@ -117,8 +136,8 @@ const Ansible: FunctionComponent<AnsibleProps> = ({ isSupported = true, isRHAAP,
117136
{isSupported ? null : unsupportedSlash}
118137
</svg>
119138
</i>
120-
) }
121-
</Fragment>)
139+
)}
140+
</Fragment>
122141
);
123142
};
124143

packages/module/src/ColumnManagementModal/ColumnManagementModal.tsx

+42-34
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReactNode, MouseEvent, FunctionComponent } from 'react';
1+
import type { MouseEvent as ReactMouseEvent, FunctionComponent } from 'react';
22
import { useState } from 'react';
33
import {
44
Button,
@@ -18,50 +18,50 @@ import { ModalProps, Modal, ModalVariant } from '@patternfly/react-core/deprecat
1818

1919
export interface ColumnManagementModalColumn {
2020
/** Internal identifier of a column by which table displayed columns are filtered. */
21-
key: string,
21+
key: string;
2222
/** The actual display name of the column possibly with a tooltip or icon. */
23-
title: ReactNode,
23+
title: React.ReactNode;
2424
/** If user changes checkboxes, the component will send back column array with this property altered. */
25-
isShown?: boolean,
25+
isShown?: boolean;
2626
/** Set to false if the column should be hidden initially */
27-
isShownByDefault: boolean,
27+
isShownByDefault: boolean;
2828
/** The checkbox will be disabled, this is applicable to columns which should not be toggleable by user */
29-
isUntoggleable?: boolean
29+
isUntoggleable?: boolean;
3030
}
3131

3232
/** extends ModalProps */
3333
export interface ColumnManagementModalProps extends Omit<ModalProps, 'ref' | 'children'> {
3434
/** Flag to show the modal */
35-
isOpen?: boolean,
35+
isOpen?: boolean;
3636
/** Invoked when modal visibility is changed */
37-
onClose?: (event: KeyboardEvent | MouseEvent) => void,
37+
onClose?: (event: KeyboardEvent | ReactMouseEvent) => void;
3838
/** Current column state */
39-
appliedColumns: ColumnManagementModalColumn[],
39+
appliedColumns: ColumnManagementModalColumn[];
4040
/** Invoked with new column state after save button is clicked */
41-
applyColumns: (newColumns: ColumnManagementModalColumn[]) => void,
41+
applyColumns: (newColumns: ColumnManagementModalColumn[]) => void;
4242
/* Modal description text */
43-
description?: string,
43+
description?: string;
4444
/* Modal title text */
45-
title?: string,
45+
title?: string;
4646
/** Custom OUIA ID */
47-
ouiaId?: string | number,
47+
ouiaId?: string | number;
4848
}
4949

50-
const ColumnManagementModal: FunctionComponent<ColumnManagementModalProps> = (
51-
{ title = 'Manage columns',
52-
description = 'Selected categories will be displayed in the table.',
53-
isOpen = false,
54-
onClose = () => undefined,
55-
appliedColumns,
56-
applyColumns,
57-
ouiaId = 'ColumnManagementModal',
58-
...props }: ColumnManagementModalProps) => {
59-
50+
const ColumnManagementModal: FunctionComponent<ColumnManagementModalProps> = ({
51+
title = 'Manage columns',
52+
description = 'Selected categories will be displayed in the table.',
53+
isOpen = false,
54+
onClose = () => undefined,
55+
appliedColumns,
56+
applyColumns,
57+
ouiaId = 'ColumnManagementModal',
58+
...props
59+
}: ColumnManagementModalProps) => {
6060
const [ currentColumns, setCurrentColumns ] = useState(
61-
appliedColumns.map(column => ({ ...column, isShown: column.isShown ?? column.isShownByDefault }))
61+
appliedColumns.map((column) => ({ ...column, isShown: column.isShown ?? column.isShownByDefault }))
6262
);
6363

64-
const handleChange = index => {
64+
const handleChange = (index) => {
6565
const newColumns = [ ...currentColumns ];
6666
const changedColumn = { ...newColumns[index] };
6767

@@ -73,22 +73,24 @@ const ColumnManagementModal: FunctionComponent<ColumnManagementModalProps> = (
7373

7474
const selectAll = () => {
7575
let newColumns = [ ...currentColumns ];
76-
newColumns = newColumns.map(column => ({ ...column, isShown: true }));
76+
newColumns = newColumns.map((column) => ({ ...column, isShown: true }));
7777

7878
setCurrentColumns(newColumns);
7979
};
8080

8181
const resetToDefault = () => {
82-
setCurrentColumns(currentColumns.map(column => ({ ...column, isShown: column.isShownByDefault ?? false })));
82+
setCurrentColumns(currentColumns.map((column) => ({ ...column, isShown: column.isShownByDefault ?? false })));
8383
};
8484

85-
const handleSave = event => {
85+
const handleSave = (event) => {
8686
applyColumns(currentColumns);
8787
onClose(event);
8888
};
8989

90-
const handleCancel = event => {
91-
setCurrentColumns(appliedColumns.map(column => ({ ...column, isShown: column.isShown ?? column.isShownByDefault })));
90+
const handleCancel = (event) => {
91+
setCurrentColumns(
92+
appliedColumns.map((column) => ({ ...column, isShown: column.isShown ?? column.isShownByDefault }))
93+
);
9294
onClose(event);
9395
};
9496

@@ -116,7 +118,13 @@ const ColumnManagementModal: FunctionComponent<ColumnManagementModalProps> = (
116118
</>
117119
}
118120
actions={[
119-
<Button key="save" className='pf-v6-u-mr-md' variant={ButtonVariant.primary} onClick={handleSave} ouiaId={`${ouiaId}-save-button`}>
121+
<Button
122+
key="save"
123+
className="pf-v6-u-mr-md"
124+
variant={ButtonVariant.primary}
125+
onClick={handleSave}
126+
ouiaId={`${ouiaId}-save-button`}
127+
>
120128
Save
121129
</Button>,
122130
<Button key="cancel" variant={ButtonVariant.link} onClick={handleCancel} ouiaId={`${ouiaId}-cancel-button`}>
@@ -127,7 +135,7 @@ const ColumnManagementModal: FunctionComponent<ColumnManagementModalProps> = (
127135
{...props}
128136
>
129137
<DataList aria-label="Selected columns" isCompact data-ouia-component-id={`${ouiaId}-column-list`}>
130-
{currentColumns.map((column, index) =>
138+
{currentColumns.map((column, index) => (
131139
<DataListItem key={column.key}>
132140
<DataListItemRow>
133141
<DataListCheck
@@ -149,10 +157,10 @@ const ColumnManagementModal: FunctionComponent<ColumnManagementModalProps> = (
149157
/>
150158
</DataListItemRow>
151159
</DataListItem>
152-
)}
160+
))}
153161
</DataList>
154162
</Modal>
155163
);
156-
}
164+
};
157165

158166
export default ColumnManagementModal;

0 commit comments

Comments
 (0)