@patternfly/react-core 5.2.0-prerelease.6 → 5.2.0-prerelease.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Alert/examples/Alert.md +142 -103
- package/src/demos/CardDemos.md +16 -2933
- package/src/demos/{Card/Card.md → CardView/CardView.md} +1 -1
- package/src/demos/{Card → CardView}/examples/CardView.tsx +1 -1
- package/src/demos/PrimaryDetail.md +2 -2
- package/src/demos/examples/Card/CardAggregateStatus.tsx +249 -0
- package/src/demos/examples/Card/CardDetails.tsx +95 -0
- package/src/demos/examples/Card/CardEventsView.tsx +154 -0
- package/src/demos/examples/Card/CardHorizontalGrid.tsx +240 -0
- package/src/demos/examples/Card/CardHorizontalSplit.tsx +30 -0
- package/src/demos/examples/Card/CardLogView.tsx +118 -0
- package/src/demos/examples/Card/CardNested.tsx +532 -0
- package/src/demos/examples/Card/CardStatus.tsx +262 -0
- package/src/demos/examples/Card/CardStatusTabbed.tsx +113 -0
- package/src/demos/examples/Card/CardTrendDemo1.tsx +106 -0
- package/src/demos/examples/Card/CardTrendDemo2.tsx +76 -0
- package/src/demos/examples/Card/CardUtilizationDemo1.tsx +109 -0
- package/src/demos/examples/Card/CardUtilizationDemo2.tsx +103 -0
- package/src/demos/examples/Card/CardUtilizationDemo3.tsx +174 -0
- package/src/demos/examples/Card/CardUtilizationDemo4.tsx +50 -0
- package/src/demos/examples/Card/CardWithAccordion.tsx +514 -0
- /package/src/demos/{Card/examples/CardData.jsx → CardView/examples/CardViewData.jsx} +0 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Alert,
|
|
5
|
+
Card,
|
|
6
|
+
CardBody,
|
|
7
|
+
CardHeader,
|
|
8
|
+
Divider,
|
|
9
|
+
Flex,
|
|
10
|
+
FlexItem,
|
|
11
|
+
Grid,
|
|
12
|
+
GridItem,
|
|
13
|
+
Label,
|
|
14
|
+
NotificationDrawer,
|
|
15
|
+
NotificationDrawerBody,
|
|
16
|
+
NotificationDrawerGroup,
|
|
17
|
+
NotificationDrawerList,
|
|
18
|
+
NotificationDrawerListItem,
|
|
19
|
+
NotificationDrawerListItemBody,
|
|
20
|
+
NotificationDrawerListItemHeader,
|
|
21
|
+
Popover,
|
|
22
|
+
Title
|
|
23
|
+
} from '@patternfly/react-core';
|
|
24
|
+
import { Table, Thead, Tbody, Tr, Th, Td, ExpandableRowContent } from '@patternfly/react-table';
|
|
25
|
+
import BellIcon from '@patternfly/react-icons/dist/js/icons/bell-icon';
|
|
26
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
|
|
27
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
28
|
+
import ExclamationTriangleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon';
|
|
29
|
+
import global_success_color_100 from '@patternfly/react-tokens/dist/esm/global_success_color_100';
|
|
30
|
+
import global_danger_color_100 from '@patternfly/react-tokens/dist/esm/global_danger_color_100';
|
|
31
|
+
import global_Color_200 from '@patternfly/react-tokens/dist/esm/global_Color_200';
|
|
32
|
+
|
|
33
|
+
export const CardStatus: React.FunctionComponent = () => {
|
|
34
|
+
const [drawerExpanded, setDrawerExpanded] = React.useState(false);
|
|
35
|
+
const handleDrawerToggleClick = () => {
|
|
36
|
+
setDrawerExpanded(!drawerExpanded);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const [rowsExpanded, setRowsExpanded] = React.useState([false, false, false]);
|
|
40
|
+
const handleToggleExpand = (_: any, rowIndex: number) => {
|
|
41
|
+
const newRowsExpanded = [...rowsExpanded];
|
|
42
|
+
newRowsExpanded[rowIndex] = !rowsExpanded[rowIndex];
|
|
43
|
+
setRowsExpanded(newRowsExpanded);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const header = (
|
|
47
|
+
<CardHeader>
|
|
48
|
+
<Title headingLevel="h4" size="lg">
|
|
49
|
+
Status
|
|
50
|
+
</Title>
|
|
51
|
+
</CardHeader>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const columns = ['Components', 'Response Rate'];
|
|
55
|
+
|
|
56
|
+
const rows = [
|
|
57
|
+
{
|
|
58
|
+
content: ['API Servers', '20%'],
|
|
59
|
+
child: (
|
|
60
|
+
<Alert
|
|
61
|
+
title="This is a critical alert that can be associated with the control panel."
|
|
62
|
+
variant="danger"
|
|
63
|
+
isInline
|
|
64
|
+
></Alert>
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
content: ['Controller Managers', '100%'],
|
|
69
|
+
child: (
|
|
70
|
+
<Alert
|
|
71
|
+
title="This is a critical alert that can be associated with the control panel."
|
|
72
|
+
variant="danger"
|
|
73
|
+
isInline
|
|
74
|
+
></Alert>
|
|
75
|
+
)
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
content: ['etcd', '91%'],
|
|
79
|
+
child: (
|
|
80
|
+
<Alert
|
|
81
|
+
title="This is a critical alert that can be associated with the control panel."
|
|
82
|
+
variant="danger"
|
|
83
|
+
isInline
|
|
84
|
+
></Alert>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
const popoverBodyContent = (
|
|
90
|
+
<>
|
|
91
|
+
<div>
|
|
92
|
+
Components of the Control Panel are responsible for maintaining and reconciling the state of the cluster.
|
|
93
|
+
</div>
|
|
94
|
+
<Table variant="compact">
|
|
95
|
+
<Thead>
|
|
96
|
+
<Tr>
|
|
97
|
+
<Th />
|
|
98
|
+
{columns.map((column, columnIndex) => (
|
|
99
|
+
<Th key={columnIndex} modifier="fitContent">
|
|
100
|
+
{column}
|
|
101
|
+
</Th>
|
|
102
|
+
))}
|
|
103
|
+
</Tr>
|
|
104
|
+
</Thead>
|
|
105
|
+
{rows.map((row, rowIndex) => {
|
|
106
|
+
const parentRow = (
|
|
107
|
+
<Tr key={rowIndex}>
|
|
108
|
+
<Td
|
|
109
|
+
key={`${rowIndex}_0`}
|
|
110
|
+
expand={row.child && { isExpanded: rowsExpanded[rowIndex], rowIndex, onToggle: handleToggleExpand }}
|
|
111
|
+
/>
|
|
112
|
+
{row.content.map((cell, cellIndex) => (
|
|
113
|
+
<Td key={`${rowIndex}_${cellIndex}`} dataLabel={columns[cellIndex]} modifier="fitContent">
|
|
114
|
+
{cell}
|
|
115
|
+
</Td>
|
|
116
|
+
))}
|
|
117
|
+
</Tr>
|
|
118
|
+
);
|
|
119
|
+
const childRow = row.child ? (
|
|
120
|
+
<Tr key={`${rowIndex}_child`} isExpanded={rowsExpanded[rowIndex]}>
|
|
121
|
+
<Td key={`${rowIndex}_1`} colSpan={3} dataLabel={`${rowIndex}_child`}>
|
|
122
|
+
<ExpandableRowContent>{row.child}</ExpandableRowContent>
|
|
123
|
+
</Td>
|
|
124
|
+
</Tr>
|
|
125
|
+
) : null;
|
|
126
|
+
return (
|
|
127
|
+
<Tbody key={rowIndex} isExpanded={rowsExpanded[rowIndex]}>
|
|
128
|
+
{parentRow}
|
|
129
|
+
{childRow}
|
|
130
|
+
</Tbody>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
133
|
+
</Table>
|
|
134
|
+
</>
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const body = (
|
|
138
|
+
<CardBody>
|
|
139
|
+
<Grid hasGutter sm={6} lg={3}>
|
|
140
|
+
<GridItem>
|
|
141
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
142
|
+
<FlexItem>
|
|
143
|
+
<CheckCircleIcon color={global_success_color_100.var} />
|
|
144
|
+
</FlexItem>
|
|
145
|
+
<FlexItem>
|
|
146
|
+
<span>Cluster</span>
|
|
147
|
+
</FlexItem>
|
|
148
|
+
</Flex>
|
|
149
|
+
</GridItem>
|
|
150
|
+
<GridItem>
|
|
151
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
152
|
+
<FlexItem>
|
|
153
|
+
<ExclamationCircleIcon color={global_danger_color_100.var} />
|
|
154
|
+
</FlexItem>
|
|
155
|
+
<FlexItem>
|
|
156
|
+
<Popover headerContent="Control Panel Status" bodyContent={popoverBodyContent} minWidth="400px">
|
|
157
|
+
<a href="#" onClick={(e) => e.preventDefault()}>
|
|
158
|
+
Control Panel
|
|
159
|
+
</a>
|
|
160
|
+
</Popover>
|
|
161
|
+
</FlexItem>
|
|
162
|
+
</Flex>
|
|
163
|
+
</GridItem>
|
|
164
|
+
<GridItem>
|
|
165
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
166
|
+
<FlexItem>
|
|
167
|
+
<ExclamationCircleIcon color={global_danger_color_100.var} />
|
|
168
|
+
</FlexItem>
|
|
169
|
+
<Flex direction={{ default: 'column' }} spaceItems={{ default: 'spaceItemsNone' }}>
|
|
170
|
+
<FlexItem>
|
|
171
|
+
<a href="#">Operators</a>
|
|
172
|
+
</FlexItem>
|
|
173
|
+
<FlexItem>
|
|
174
|
+
<span style={{ color: global_Color_200.var }}>1 degraded</span>
|
|
175
|
+
</FlexItem>
|
|
176
|
+
</Flex>
|
|
177
|
+
</Flex>
|
|
178
|
+
</GridItem>
|
|
179
|
+
<GridItem>
|
|
180
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
181
|
+
<FlexItem>
|
|
182
|
+
<CheckCircleIcon color={global_success_color_100.var} />
|
|
183
|
+
</FlexItem>
|
|
184
|
+
<Flex direction={{ default: 'column' }} spaceItems={{ default: 'spaceItemsNone' }}>
|
|
185
|
+
<FlexItem>
|
|
186
|
+
<a href="#">Image Vulnerabilities</a>
|
|
187
|
+
</FlexItem>
|
|
188
|
+
<FlexItem>
|
|
189
|
+
<span style={{ color: global_Color_200.var }}>0 vulnerabilities</span>
|
|
190
|
+
</FlexItem>
|
|
191
|
+
</Flex>
|
|
192
|
+
</Flex>
|
|
193
|
+
</GridItem>
|
|
194
|
+
</Grid>
|
|
195
|
+
</CardBody>
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
const drawerTitle = (
|
|
199
|
+
<Flex spaceItems={{ default: 'spaceItemsSm' }}>
|
|
200
|
+
<FlexItem spacer={{ default: 'spacerMd' }}>
|
|
201
|
+
<span>Notifications</span>
|
|
202
|
+
</FlexItem>
|
|
203
|
+
<Label color="red" icon={<ExclamationCircleIcon />}>
|
|
204
|
+
1
|
|
205
|
+
</Label>
|
|
206
|
+
<Label color="orange" icon={<ExclamationTriangleIcon />}>
|
|
207
|
+
3
|
|
208
|
+
</Label>
|
|
209
|
+
<Label color="green" icon={<CheckCircleIcon />}>
|
|
210
|
+
3
|
|
211
|
+
</Label>
|
|
212
|
+
<Label color="blue" icon={<ExclamationCircleIcon />}>
|
|
213
|
+
3
|
|
214
|
+
</Label>
|
|
215
|
+
<Label color="green" icon={<BellIcon />}>
|
|
216
|
+
3
|
|
217
|
+
</Label>
|
|
218
|
+
</Flex>
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
const drawer = (
|
|
222
|
+
<NotificationDrawer>
|
|
223
|
+
<NotificationDrawerBody>
|
|
224
|
+
<NotificationDrawerGroup
|
|
225
|
+
count={0}
|
|
226
|
+
onExpand={handleDrawerToggleClick}
|
|
227
|
+
isExpanded={drawerExpanded}
|
|
228
|
+
title={drawerTitle}
|
|
229
|
+
headingLevel="h4"
|
|
230
|
+
>
|
|
231
|
+
<NotificationDrawerList isHidden={!drawerExpanded}>
|
|
232
|
+
<NotificationDrawerListItem variant="danger">
|
|
233
|
+
<NotificationDrawerListItemHeader
|
|
234
|
+
variant="danger"
|
|
235
|
+
headingLevel="h5"
|
|
236
|
+
title="Critical alert regarding control plane"
|
|
237
|
+
/>
|
|
238
|
+
<NotificationDrawerListItemBody>
|
|
239
|
+
This is a long description to show how the title will wrap if it is long and wraps to multiple lines.
|
|
240
|
+
</NotificationDrawerListItemBody>
|
|
241
|
+
</NotificationDrawerListItem>
|
|
242
|
+
<NotificationDrawerListItem variant="warning">
|
|
243
|
+
<NotificationDrawerListItemHeader variant="warning" headingLevel="h5" title="Warning alert" />
|
|
244
|
+
<NotificationDrawerListItemBody>
|
|
245
|
+
This is a warning notification description.
|
|
246
|
+
</NotificationDrawerListItemBody>
|
|
247
|
+
</NotificationDrawerListItem>
|
|
248
|
+
</NotificationDrawerList>
|
|
249
|
+
</NotificationDrawerGroup>
|
|
250
|
+
</NotificationDrawerBody>
|
|
251
|
+
</NotificationDrawer>
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
return (
|
|
255
|
+
<Card>
|
|
256
|
+
{header}
|
|
257
|
+
{body}
|
|
258
|
+
<Divider />
|
|
259
|
+
{drawer}
|
|
260
|
+
</Card>
|
|
261
|
+
);
|
|
262
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardBody,
|
|
5
|
+
CardHeader,
|
|
6
|
+
DescriptionList,
|
|
7
|
+
DescriptionListDescription,
|
|
8
|
+
DescriptionListGroup,
|
|
9
|
+
DescriptionListTerm,
|
|
10
|
+
Flex,
|
|
11
|
+
FlexItem,
|
|
12
|
+
Tab,
|
|
13
|
+
TabContent,
|
|
14
|
+
Tabs,
|
|
15
|
+
TabTitleText,
|
|
16
|
+
Title
|
|
17
|
+
} from '@patternfly/react-core';
|
|
18
|
+
import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
|
|
19
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
20
|
+
|
|
21
|
+
const descriptionListData = [
|
|
22
|
+
{
|
|
23
|
+
status: 'Running',
|
|
24
|
+
resourceName: 'Resource name that is long and can wrap',
|
|
25
|
+
detail: '121 Systems',
|
|
26
|
+
icon: <CheckCircleIcon />
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
status: 'Ready',
|
|
30
|
+
resourceName: 'Resource name that is long and can wrap',
|
|
31
|
+
detail: '123 Systems',
|
|
32
|
+
icon: <ExclamationCircleIcon />
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
status: 'Running',
|
|
36
|
+
resourceName: 'Resource name that is long and can wrap',
|
|
37
|
+
detail: '122 Systems',
|
|
38
|
+
icon: <CheckCircleIcon />
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
status: 'Ready',
|
|
42
|
+
resourceName: 'Resource name that is long and can wrap',
|
|
43
|
+
detail: '124 Systems',
|
|
44
|
+
icon: <ExclamationCircleIcon />
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export const CardStatusTabbed: React.FunctionComponent = () => {
|
|
49
|
+
const [activeTabKey, setActiveTabKey] = React.useState(0);
|
|
50
|
+
const handleTabClick = (_e: React.MouseEvent<HTMLElement, MouseEvent>, tabIndex: string | number) => {
|
|
51
|
+
setActiveTabKey(Number(tabIndex));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const tabContent = (
|
|
55
|
+
<DescriptionList isHorizontal columnModifier={{ lg: '2Col' }}>
|
|
56
|
+
{descriptionListData.map(({ status, resourceName, detail, icon }, index) => (
|
|
57
|
+
<DescriptionListGroup key={index}>
|
|
58
|
+
<DescriptionListTerm>
|
|
59
|
+
<Flex>
|
|
60
|
+
<FlexItem>{icon}</FlexItem>
|
|
61
|
+
<FlexItem>
|
|
62
|
+
<Title headingLevel="h4" size="md">
|
|
63
|
+
{status}
|
|
64
|
+
</Title>
|
|
65
|
+
</FlexItem>
|
|
66
|
+
</Flex>
|
|
67
|
+
</DescriptionListTerm>
|
|
68
|
+
<DescriptionListDescription>
|
|
69
|
+
<a href="#">{resourceName}</a>
|
|
70
|
+
<div>{detail}</div>
|
|
71
|
+
</DescriptionListDescription>
|
|
72
|
+
</DescriptionListGroup>
|
|
73
|
+
))}
|
|
74
|
+
</DescriptionList>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<Card>
|
|
80
|
+
<CardHeader>
|
|
81
|
+
<Title headingLevel="h4" size="lg">
|
|
82
|
+
Status
|
|
83
|
+
</Title>
|
|
84
|
+
</CardHeader>
|
|
85
|
+
<CardBody>
|
|
86
|
+
<Tabs isFilled id="status-tabs" activeKey={activeTabKey} onSelect={handleTabClick}>
|
|
87
|
+
{[1, 2, 3].map((tab, tabIndex) => (
|
|
88
|
+
<Tab
|
|
89
|
+
key={tabIndex}
|
|
90
|
+
eventKey={tabIndex}
|
|
91
|
+
title={<TabTitleText>{`Object ${tabIndex + 1}`}</TabTitleText>}
|
|
92
|
+
tabContentId={`tabContent${tabIndex}`}
|
|
93
|
+
/>
|
|
94
|
+
))}
|
|
95
|
+
</Tabs>
|
|
96
|
+
</CardBody>
|
|
97
|
+
<CardBody>
|
|
98
|
+
{[1, 2, 3].map((tab, tabIndex) => (
|
|
99
|
+
<TabContent
|
|
100
|
+
key={tabIndex}
|
|
101
|
+
eventKey={tabIndex}
|
|
102
|
+
id={`tabContent${tabIndex}`}
|
|
103
|
+
activeKey={activeTabKey}
|
|
104
|
+
hidden={tabIndex !== activeTabKey}
|
|
105
|
+
>
|
|
106
|
+
{tabContent}
|
|
107
|
+
</TabContent>
|
|
108
|
+
))}
|
|
109
|
+
</CardBody>
|
|
110
|
+
</Card>
|
|
111
|
+
</>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardTitle,
|
|
5
|
+
CardBody,
|
|
6
|
+
CardHeader,
|
|
7
|
+
Title,
|
|
8
|
+
Gallery,
|
|
9
|
+
GalleryItem,
|
|
10
|
+
Flex,
|
|
11
|
+
FlexItem,
|
|
12
|
+
Select,
|
|
13
|
+
SelectList,
|
|
14
|
+
SelectOption,
|
|
15
|
+
MenuToggle,
|
|
16
|
+
MenuToggleElement
|
|
17
|
+
} from '@patternfly/react-core';
|
|
18
|
+
import { ChartArea, ChartGroup, ChartVoronoiContainer } from '@patternfly/react-charts';
|
|
19
|
+
import text from '@patternfly/react-styles/css/utilities/Text/text';
|
|
20
|
+
|
|
21
|
+
export const CardTrendDemo1: React.FunctionComponent = () => {
|
|
22
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
23
|
+
|
|
24
|
+
const selectItems = (
|
|
25
|
+
<SelectList>
|
|
26
|
+
<SelectOption key="option1" value="Last hour">
|
|
27
|
+
Last hour
|
|
28
|
+
</SelectOption>
|
|
29
|
+
<SelectOption key="option2" value="Last 6 hours">
|
|
30
|
+
Last 6 hours
|
|
31
|
+
</SelectOption>
|
|
32
|
+
<SelectOption key="option3" value="Last 24 hours">
|
|
33
|
+
Last 24 hours
|
|
34
|
+
</SelectOption>
|
|
35
|
+
<SelectOption key="option4" value="Last 7 days">
|
|
36
|
+
Last 7 days
|
|
37
|
+
</SelectOption>
|
|
38
|
+
</SelectList>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
|
42
|
+
<MenuToggle ref={toggleRef} onClick={() => setIsOpen(!isOpen)} isExpanded={isOpen} variant="plainText">
|
|
43
|
+
Filter
|
|
44
|
+
</MenuToggle>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const headerActions = (
|
|
48
|
+
<Select onSelect={() => setIsOpen(!isOpen)} onOpenChange={setIsOpen} isOpen={isOpen} toggle={toggle}>
|
|
49
|
+
{selectItems}
|
|
50
|
+
</Select>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<React.Fragment>
|
|
55
|
+
<b>Note:</b> Custom CSS is used in this demo to align the card title and select toggle text to{' '}
|
|
56
|
+
<code>baseline</code> alignment.
|
|
57
|
+
<br />
|
|
58
|
+
<br />
|
|
59
|
+
<Gallery hasGutter minWidths={{ default: '360px' }}>
|
|
60
|
+
<GalleryItem>
|
|
61
|
+
<Card id="trend-card-1-card" component="div">
|
|
62
|
+
<CardHeader actions={{ actions: headerActions, hasNoOffset: true }}>
|
|
63
|
+
<Flex direction={{ default: 'column' }} spaceItems={{ default: 'spaceItemsNone' }}>
|
|
64
|
+
<FlexItem>
|
|
65
|
+
<CardTitle>
|
|
66
|
+
<Title headingLevel="h4" size="lg">
|
|
67
|
+
1,050,765 IOPS
|
|
68
|
+
</Title>
|
|
69
|
+
</CardTitle>
|
|
70
|
+
</FlexItem>
|
|
71
|
+
<FlexItem>
|
|
72
|
+
<span className={text.color_200}>Workload</span>
|
|
73
|
+
</FlexItem>
|
|
74
|
+
</Flex>
|
|
75
|
+
</CardHeader>
|
|
76
|
+
<CardBody>
|
|
77
|
+
<ChartGroup
|
|
78
|
+
ariaDesc="Mock average cluster utilization"
|
|
79
|
+
ariaTitle="Mock cluster sparkline chart"
|
|
80
|
+
containerComponent={
|
|
81
|
+
<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
|
|
82
|
+
}
|
|
83
|
+
height={100}
|
|
84
|
+
maxDomain={{ y: 9 }}
|
|
85
|
+
padding={0}
|
|
86
|
+
width={400}
|
|
87
|
+
>
|
|
88
|
+
<ChartArea
|
|
89
|
+
data={[
|
|
90
|
+
{ name: 'Cluster', x: '2015', y: 7 },
|
|
91
|
+
{ name: 'Cluster', x: '2016', y: 6 },
|
|
92
|
+
{ name: 'Cluster', x: '2017', y: 8 },
|
|
93
|
+
{ name: 'Cluster', x: '2018', y: 3 },
|
|
94
|
+
{ name: 'Cluster', x: '2019', y: 4 },
|
|
95
|
+
{ name: 'Cluster', x: '2020', y: 1 },
|
|
96
|
+
{ name: 'Cluster', x: '2021', y: 0 }
|
|
97
|
+
]}
|
|
98
|
+
/>
|
|
99
|
+
</ChartGroup>
|
|
100
|
+
</CardBody>
|
|
101
|
+
</Card>
|
|
102
|
+
</GalleryItem>
|
|
103
|
+
</Gallery>
|
|
104
|
+
</React.Fragment>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardTitle,
|
|
5
|
+
CardFooter,
|
|
6
|
+
CardHeader,
|
|
7
|
+
Title,
|
|
8
|
+
Gallery,
|
|
9
|
+
GalleryItem,
|
|
10
|
+
Flex,
|
|
11
|
+
FlexItem
|
|
12
|
+
} from '@patternfly/react-core';
|
|
13
|
+
import { ChartArea, ChartGroup, ChartVoronoiContainer } from '@patternfly/react-charts';
|
|
14
|
+
import text from '@patternfly/react-styles/css/utilities/Text/text';
|
|
15
|
+
|
|
16
|
+
export const CardTrendDemo2: React.FunctionComponent = () => (
|
|
17
|
+
<Gallery hasGutter minWidths={{ default: '360px' }}>
|
|
18
|
+
<GalleryItem>
|
|
19
|
+
<Card id="trend-card-2-card" component="div">
|
|
20
|
+
<CardHeader>
|
|
21
|
+
<Flex alignItems={{ default: 'alignItemsCenter' }}>
|
|
22
|
+
<FlexItem flex={{ default: 'flexNone' }}>
|
|
23
|
+
<Flex direction={{ default: 'column' }} spaceItems={{ default: 'spaceItemsNone' }}>
|
|
24
|
+
<FlexItem>
|
|
25
|
+
<CardTitle>
|
|
26
|
+
<Title headingLevel="h4" size="2xl">
|
|
27
|
+
842 TB
|
|
28
|
+
</Title>
|
|
29
|
+
</CardTitle>
|
|
30
|
+
</FlexItem>
|
|
31
|
+
<FlexItem>
|
|
32
|
+
<span className={text.color_200}>Storage capacity</span>
|
|
33
|
+
</FlexItem>
|
|
34
|
+
</Flex>
|
|
35
|
+
</FlexItem>
|
|
36
|
+
<FlexItem flex={{ default: 'flex_1' }}>
|
|
37
|
+
<ChartGroup
|
|
38
|
+
ariaDesc="Mock average cluster utilization"
|
|
39
|
+
ariaTitle="Mock cluster sparkline chart"
|
|
40
|
+
containerComponent={
|
|
41
|
+
<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
|
|
42
|
+
}
|
|
43
|
+
height={100}
|
|
44
|
+
maxDomain={{ y: 9 }}
|
|
45
|
+
padding={0}
|
|
46
|
+
width={400}
|
|
47
|
+
>
|
|
48
|
+
<ChartArea
|
|
49
|
+
data={[
|
|
50
|
+
{ name: 'Cluster', x: '2015', y: 7 },
|
|
51
|
+
{ name: 'Cluster', x: '2016', y: 6 },
|
|
52
|
+
{ name: 'Cluster', x: '2017', y: 8 },
|
|
53
|
+
{ name: 'Cluster', x: '2018', y: 3 },
|
|
54
|
+
{ name: 'Cluster', x: '2019', y: 4 },
|
|
55
|
+
{ name: 'Cluster', x: '2020', y: 1 },
|
|
56
|
+
{ name: 'Cluster', x: '2021', y: 0 }
|
|
57
|
+
]}
|
|
58
|
+
/>
|
|
59
|
+
</ChartGroup>
|
|
60
|
+
</FlexItem>
|
|
61
|
+
</Flex>
|
|
62
|
+
</CardHeader>
|
|
63
|
+
<CardFooter>
|
|
64
|
+
<Flex>
|
|
65
|
+
<FlexItem>
|
|
66
|
+
<a href="#">Action 1</a>
|
|
67
|
+
</FlexItem>
|
|
68
|
+
<FlexItem>
|
|
69
|
+
<a href="#">Action 2</a>
|
|
70
|
+
</FlexItem>
|
|
71
|
+
</Flex>
|
|
72
|
+
</CardFooter>
|
|
73
|
+
</Card>
|
|
74
|
+
</GalleryItem>
|
|
75
|
+
</Gallery>
|
|
76
|
+
);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Card,
|
|
4
|
+
CardTitle,
|
|
5
|
+
CardBody,
|
|
6
|
+
CardFooter,
|
|
7
|
+
Title,
|
|
8
|
+
Gallery,
|
|
9
|
+
GalleryItem,
|
|
10
|
+
Flex,
|
|
11
|
+
FlexItem,
|
|
12
|
+
Stack,
|
|
13
|
+
Divider
|
|
14
|
+
} from '@patternfly/react-core';
|
|
15
|
+
import { ChartArea, ChartGroup, ChartVoronoiContainer } from '@patternfly/react-charts';
|
|
16
|
+
|
|
17
|
+
export const CardUtilizationDemo1: React.FunctionComponent = () => (
|
|
18
|
+
<Gallery hasGutter minWidths={{ default: '360px' }}>
|
|
19
|
+
<GalleryItem>
|
|
20
|
+
<Card id="utilization-card-1-card" component="div">
|
|
21
|
+
<CardTitle>
|
|
22
|
+
<Title headingLevel="h4" size="lg">
|
|
23
|
+
Top Utilized Clusters
|
|
24
|
+
</Title>
|
|
25
|
+
</CardTitle>
|
|
26
|
+
<CardBody>
|
|
27
|
+
<Flex direction={{ default: 'column' }}>
|
|
28
|
+
<FlexItem>
|
|
29
|
+
<Stack>
|
|
30
|
+
<b>Cluster-1204</b>
|
|
31
|
+
<span>27.3 cores available</span>
|
|
32
|
+
</Stack>
|
|
33
|
+
</FlexItem>
|
|
34
|
+
<FlexItem>
|
|
35
|
+
<ChartGroup
|
|
36
|
+
ariaDesc="Mock average cluster utilization"
|
|
37
|
+
ariaTitle="Mock cluster sparkline chart"
|
|
38
|
+
containerComponent={
|
|
39
|
+
<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
|
|
40
|
+
}
|
|
41
|
+
height={100}
|
|
42
|
+
maxDomain={{ y: 9 }}
|
|
43
|
+
padding={0}
|
|
44
|
+
width={400}
|
|
45
|
+
>
|
|
46
|
+
<ChartArea
|
|
47
|
+
data={[
|
|
48
|
+
{ name: 'Cluster', x: '2015', y: 7 },
|
|
49
|
+
{ name: 'Cluster', x: '2016', y: 6 },
|
|
50
|
+
{ name: 'Cluster', x: '2017', y: 8 },
|
|
51
|
+
{ name: 'Cluster', x: '2018', y: 3 },
|
|
52
|
+
{ name: 'Cluster', x: '2019', y: 4 },
|
|
53
|
+
{ name: 'Cluster', x: '2020', y: 1 },
|
|
54
|
+
{ name: 'Cluster', x: '2021', y: 0 }
|
|
55
|
+
]}
|
|
56
|
+
/>
|
|
57
|
+
</ChartGroup>
|
|
58
|
+
</FlexItem>
|
|
59
|
+
<FlexItem>
|
|
60
|
+
<a href="#">View details</a>
|
|
61
|
+
</FlexItem>
|
|
62
|
+
</Flex>
|
|
63
|
+
</CardBody>
|
|
64
|
+
<CardBody>
|
|
65
|
+
<Flex direction={{ default: 'column' }}>
|
|
66
|
+
<FlexItem>
|
|
67
|
+
<Stack>
|
|
68
|
+
<b>Abcdef-1204</b>
|
|
69
|
+
<span>50.6 cores available</span>
|
|
70
|
+
</Stack>
|
|
71
|
+
</FlexItem>
|
|
72
|
+
<FlexItem>
|
|
73
|
+
<ChartGroup
|
|
74
|
+
ariaDesc="Mock average cluster utilization"
|
|
75
|
+
ariaTitle="Mock cluster sparkline chart"
|
|
76
|
+
containerComponent={
|
|
77
|
+
<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />
|
|
78
|
+
}
|
|
79
|
+
height={100}
|
|
80
|
+
maxDomain={{ y: 9 }}
|
|
81
|
+
padding={0}
|
|
82
|
+
width={400}
|
|
83
|
+
>
|
|
84
|
+
<ChartArea
|
|
85
|
+
data={[
|
|
86
|
+
{ name: 'Cluster', x: '2015', y: 7 },
|
|
87
|
+
{ name: 'Cluster', x: '2016', y: 6 },
|
|
88
|
+
{ name: 'Cluster', x: '2017', y: 8 },
|
|
89
|
+
{ name: 'Cluster', x: '2018', y: 3 },
|
|
90
|
+
{ name: 'Cluster', x: '2019', y: 4 },
|
|
91
|
+
{ name: 'Cluster', x: '2020', y: 1 },
|
|
92
|
+
{ name: 'Cluster', x: '2021', y: 0 }
|
|
93
|
+
]}
|
|
94
|
+
/>
|
|
95
|
+
</ChartGroup>
|
|
96
|
+
</FlexItem>
|
|
97
|
+
<FlexItem>
|
|
98
|
+
<a href="#">View details</a>
|
|
99
|
+
</FlexItem>
|
|
100
|
+
</Flex>
|
|
101
|
+
</CardBody>
|
|
102
|
+
<Divider />
|
|
103
|
+
<CardFooter>
|
|
104
|
+
<a href="#">View all clusters</a>
|
|
105
|
+
</CardFooter>
|
|
106
|
+
</Card>
|
|
107
|
+
</GalleryItem>
|
|
108
|
+
</Gallery>
|
|
109
|
+
);
|