Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(filters): fix datetimepicker error text alignments #574

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/Recordings/ActiveRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,9 @@ const ActiveRecordingsToolbar: React.FunctionComponent<ActiveRecordingsToolbarPr
filters={props.targetRecordingFilters}
updateFilters={props.updateFilters}
/>
<ToolbarGroup variant="button-group">{buttons}</ToolbarGroup>
<ToolbarGroup style={{ alignSelf: 'start' }} variant="button-group">
{buttons}
</ToolbarGroup>
{deleteActiveWarningModal}
</ToolbarContent>
</Toolbar>
Expand Down
2 changes: 1 addition & 1 deletion src/app/Recordings/ArchivedRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ const ArchivedRecordingsToolbar: React.FunctionComponent<ArchivedRecordingsToolb
filters={props.targetRecordingFilters}
updateFilters={props.updateFilters}
/>
<ToolbarGroup variant="button-group">
<ToolbarGroup variant="button-group" style={{ alignSelf: 'start' }}>
<ToolbarItem>
<Button
key="edit labels"
Expand Down
35 changes: 23 additions & 12 deletions src/app/Recordings/Filters/DateTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@
* SOFTWARE.
*/

import { Button, ButtonVariant, DatePicker, Flex, FlexItem, Text, TimePicker } from '@patternfly/react-core';
import {
Button,
ButtonVariant,
DatePicker,
Flex,
FlexItem,
InputGroup,
Text,
TimePicker,
} from '@patternfly/react-core';
import { SearchIcon } from '@patternfly/react-icons';
import React from 'react';

Expand Down Expand Up @@ -74,22 +83,24 @@ export const DateTimePicker: React.FunctionComponent<DateTimePickerProps> = (pro

const handleSubmit = React.useCallback(() => {
selectedDate!.setUTCHours(selectedHour, selectedMinute);
props.onSubmit(`${selectedDate!.toISOString()}`);
props.onSubmit(selectedDate!.toISOString());
}, [selectedDate, selectedHour, selectedMinute, props.onSubmit]);

return (
<Flex>
<FlexItem>
<DatePicker appendTo="parent" onChange={onDateChange} aria-label="Date Picker" placeholder="YYYY-MM-DD" />
<TimePicker
isOpen={isTimeOpen}
setIsOpen={onTimeToggle}
is24Hour
aria-label="Time Picker"
className="time-picker"
menuAppendTo="parent"
onChange={onTimeChange}
/>
<InputGroup>
<DatePicker appendTo="parent" onChange={onDateChange} aria-label="Date Picker" placeholder="YYYY-MM-DD" />
<TimePicker
isOpen={isTimeOpen}
setIsOpen={onTimeToggle}
is24Hour
aria-label="Time Picker"
className="time-picker"
menuAppendTo="parent"
onChange={onTimeChange}
/>
</InputGroup>
</FlexItem>
<FlexItem>
<Text>UTC</Text>
Expand Down
65 changes: 27 additions & 38 deletions src/app/Recordings/RecordingFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,33 +202,18 @@ export const RecordingFilters: React.FunctionComponent<RecordingFiltersProps> =

const filterDropdownItems = React.useMemo(
() => [
<InputGroup>
<NameFilter recordings={props.recordings} onSubmit={onNameInput} filteredNames={props.filters.Name} />
</InputGroup>,
<InputGroup>
<LabelFilter recordings={props.recordings} onSubmit={onLabelInput} filteredLabels={props.filters.Label} />
</InputGroup>,
<NameFilter recordings={props.recordings} onSubmit={onNameInput} filteredNames={props.filters.Name} />,
<LabelFilter recordings={props.recordings} onSubmit={onLabelInput} filteredLabels={props.filters.Label} />,
...(!props.isArchived
? [
<InputGroup>
<RecordingStateFilter
filteredStates={props.filters.State}
onSelectToggle={onRecordingStateSelectToggle}
/>
</InputGroup>,
<InputGroup>
<DateTimePicker onSubmit={onStartedBeforeInput} />
</InputGroup>,
<InputGroup>
<DateTimePicker onSubmit={onStartedAfterInput} />
</InputGroup>,
<InputGroup>
<DurationFilter
durations={props.filters.DurationSeconds}
onContinuousDurationSelect={onContinuousDurationSelect}
onDurationInput={onDurationInput}
></DurationFilter>
</InputGroup>,
<RecordingStateFilter filteredStates={props.filters.State} onSelectToggle={onRecordingStateSelectToggle} />,
<DateTimePicker onSubmit={onStartedBeforeInput} />,
<DateTimePicker onSubmit={onStartedAfterInput} />,
<DurationFilter
durations={props.filters.DurationSeconds}
onContinuousDurationSelect={onContinuousDurationSelect}
onDurationInput={onDurationInput}
></DurationFilter>,
]
: []),
],
Expand All @@ -252,19 +237,23 @@ export const RecordingFilters: React.FunctionComponent<RecordingFiltersProps> =
return (
<ToolbarToggleGroup toggleIcon={<FilterIcon />} breakpoint="xl">
<ToolbarGroup variant="filter-group">
<ToolbarItem>{categoryDropdown}</ToolbarItem>
{Object.keys(props.filters).map((filterKey, i) => (
<ToolbarFilter
key={filterKey}
chips={props.filters[filterKey]}
deleteChip={onDelete}
deleteChipGroup={onDeleteGroup}
categoryName={filterKey}
showToolbarItem={filterKey === currentCategory}
>
{filterDropdownItems[i]}
</ToolbarFilter>
))}
<ToolbarItem>
<InputGroup>
{categoryDropdown}
{Object.keys(props.filters).map((filterKey, i) => (
<ToolbarFilter
key={filterKey}
chips={props.filters[filterKey]}
deleteChip={onDelete}
deleteChipGroup={onDeleteGroup}
categoryName={filterKey}
showToolbarItem={filterKey === currentCategory}
>
{filterDropdownItems[i]}
</ToolbarFilter>
))}
</InputGroup>
</ToolbarItem>
</ToolbarGroup>
</ToolbarToggleGroup>
);
Expand Down