Skip to content

Commit cd6e168

Browse files
Merge pull request #197 from PeterYurkovich/update-release-0.4
COO-1545: Update 0.4 branch from main
2 parents bc9313f + 0e0ecb7 commit cd6e168

3 files changed

Lines changed: 151 additions & 85 deletions

File tree

Dockerfile.cypress

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM registry.access.redhat.com/ubi9/nodejs-18:latest
2+
3+
WORKDIR /usr/src/app
4+
5+
RUN mkdir web
6+
7+
COPY Makefile Makefile
8+
COPY web/package*.json ./web
9+
RUN make install-frontend-ci-clean
10+
11+
COPY web/ /usr/src/app/web
12+
13+
RUN make build-frontend
14+
15+
ENTRYPOINT ["make", "test-frontend"]

web/package-lock.json

Lines changed: 43 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import * as React from 'react';
2+
import {
3+
Flex,
4+
FlexItem,
5+
InputGroup,
6+
InputGroupItem,
7+
DatePicker,
8+
isValidDate,
9+
TimePicker,
10+
yyyyMMddFormat,
11+
} from '@patternfly/react-core';
12+
13+
interface DateTimeRangePickerProps {
14+
from: Date | null;
15+
to: Date | null;
16+
onDateChange: (type: 'start' | 'end', newDate: Date, hour?: number, minute?: number) => void;
17+
}
18+
19+
const DateTimeRangePicker: React.FC<DateTimeRangePickerProps> = ({ from, to, onDateChange }) => {
20+
const toValidator = (date: Date): string => {
21+
// Date comparison validation
22+
return isValidDate(from) && yyyyMMddFormat(date) >= yyyyMMddFormat(from)
23+
? ''
24+
: 'The "to" date must be after the "from" date';
25+
};
26+
27+
return (
28+
<Flex direction={{ default: 'column', lg: 'column' }}>
29+
<FlexItem>
30+
<InputGroup>
31+
<InputGroupItem>
32+
<DatePicker
33+
value={isValidDate(from) ? yyyyMMddFormat(from) : ''}
34+
onChange={(_event, inputDate, newFromDate) => {
35+
if (isValidDate(newFromDate)) {
36+
onDateChange('start', newFromDate); // Pass 'start' type to handler
37+
}
38+
}}
39+
aria-label="Start date"
40+
placeholder="YYYY-MM-DD"
41+
/>
42+
</InputGroupItem>
43+
<InputGroupItem>
44+
<TimePicker
45+
aria-label="Start time"
46+
style={{ width: '150px' }}
47+
onChange={(_event, time, hour, minute) => {
48+
if (isValidDate(from)) {
49+
onDateChange('start', from as Date, hour, minute); // Update start time
50+
}
51+
}}
52+
/>
53+
</InputGroupItem>
54+
</InputGroup>
55+
</FlexItem>
56+
<FlexItem>
57+
<div>to</div>
58+
</FlexItem>
59+
<FlexItem>
60+
<InputGroup>
61+
<InputGroupItem>
62+
<DatePicker
63+
value={isValidDate(to) ? yyyyMMddFormat(to as Date) : ''}
64+
onChange={(_event, inputDate, newToDate) => {
65+
if (isValidDate(newToDate)) {
66+
onDateChange('end', newToDate); // Pass 'end' type to handler
67+
}
68+
}}
69+
isDisabled={!isValidDate(from)}
70+
rangeStart={from}
71+
validators={[toValidator]}
72+
aria-label="End date"
73+
placeholder="YYYY-MM-DD"
74+
/>
75+
</InputGroupItem>
76+
<InputGroupItem>
77+
<TimePicker
78+
style={{ width: '150px' }}
79+
onChange={(_event, time, hour, minute) => {
80+
if (isValidDate(to)) {
81+
onDateChange('end', to as Date, hour, minute); // Update end time
82+
}
83+
}}
84+
isDisabled={!isValidDate(from)}
85+
/>
86+
</InputGroupItem>
87+
</InputGroup>
88+
</FlexItem>
89+
</Flex>
90+
);
91+
};
92+
93+
export default DateTimeRangePicker;

0 commit comments

Comments
 (0)