forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardLogView.tsx
More file actions
118 lines (113 loc) · 4.43 KB
/
CardLogView.tsx
File metadata and controls
118 lines (113 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import { Fragment, useState } from 'react';
/* eslint-disable camelcase */
import {
Card,
CardHeader,
CardTitle,
CardBody,
CardFooter,
DescriptionList,
DescriptionListGroup,
DescriptionListTerm,
DescriptionListDescription,
Divider,
Gallery,
MenuToggle,
MenuToggleElement,
Select,
SelectList,
SelectOption,
Timestamp,
Title
} from '@patternfly/react-core';
import flex from '@patternfly/react-styles/css/utilities/Flex/flex';
import l_gallery_GridTemplateColumns_min from '@patternfly/react-tokens/dist/esm/l_gallery_GridTemplateColumns_min';
export const CardLogView: React.FunctionComponent = () => {
const [isOpen, setIsOpen] = useState(false);
const selectItems = (
<SelectList>
<SelectOption key="option1" value="Last hour">
Last hour
</SelectOption>
<SelectOption key="option2" value="Last 6 hours">
Last 6 hours
</SelectOption>
<SelectOption key="option3" value="Last 24 hours">
Last 24 hours
</SelectOption>
<SelectOption key="option4" value="Last 7 days">
Last 7 days
</SelectOption>
</SelectList>
);
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle ref={toggleRef} onClick={() => setIsOpen(!isOpen)} isExpanded={isOpen} variant="plainText">
Filter
</MenuToggle>
);
const headerActions = (
<Select onSelect={() => setIsOpen(!isOpen)} onOpenChange={setIsOpen} isOpen={isOpen} toggle={toggle}>
{selectItems}
</Select>
);
return (
<Fragment>
<b>Note:</b> Custom CSS is used in this demo to align the card title and select toggle text to{' '}
<code>baseline</code> alignment.
<br />
<br />
<Gallery hasGutter style={{ [l_gallery_GridTemplateColumns_min.name]: '360px' } as React.CSSProperties}>
<Card id="card-log-view-example">
<CardHeader className={flex.alignItemsFlexStart} actions={{ actions: headerActions, hasNoOffset: true }}>
<CardTitle>
<Title headingLevel="h4" size="xl" style={{ paddingTop: '3px' }}>
Activity
</Title>
</CardTitle>
</CardHeader>
<CardBody>
<DescriptionList aria-label="Activity logs">
<DescriptionListGroup>
<DescriptionListTerm>Readiness probe failed</DescriptionListTerm>
<DescriptionListDescription>
Readiness probe failed: Get https://10.131.0.7:5000/healthz: dial tcp 10.131.0.7:5000: connect:
connection refused
</DescriptionListDescription>
<DescriptionListDescription>
<Timestamp date={new Date('2023-06-17T11:02')} dateFormat="medium" timeFormat="short" />
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Successful assignment</DescriptionListTerm>
<DescriptionListDescription>
Successfully assigned default/example to ip-10-0-130-149.ec2.internal
</DescriptionListDescription>
<DescriptionListDescription>
<Timestamp date={new Date('2023-06-17T11:13')} dateFormat="medium" timeFormat="short" />
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Pulling image</DescriptionListTerm>
<DescriptionListDescription>Pulling image "openshift/hello-openshift"</DescriptionListDescription>
<DescriptionListDescription>
<Timestamp date={new Date('2023-06-17T10:59')} dateFormat="medium" timeFormat="short" />
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>Created container</DescriptionListTerm>
<DescriptionListDescription>Created container hello-openshift</DescriptionListDescription>
<DescriptionListDescription>
<Timestamp date={new Date('2023-06-17T10:45')} dateFormat="medium" timeFormat="short" />
</DescriptionListDescription>
</DescriptionListGroup>
</DescriptionList>
</CardBody>
<Divider />
<CardFooter>
<a href="#">View all activity</a>
</CardFooter>
</Card>
</Gallery>
</Fragment>
);
};