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

Impl [Jobs] Revamp Jobs page filters bar #2817

Merged
merged 10 commits into from
Nov 12, 2024
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
8 changes: 5 additions & 3 deletions src/common/NameFilter/NameFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ import { ReactComponent as SearchIcon } from 'igz-controls/images/search.svg'

import './nameFilter.scss'

const NameFilter = ({ applyChanges, filterMenuName= '' }) => {
const NameFilter = ({ applyChanges, filterMenuName = '' }) => {
const { input } = useField(NAME_FILTER)
const dispatch = useDispatch()

const handleNameChange = event => {
if (event.keyCode === KEY_CODES.ENTER) {
applyChanges(event.target.value)
if (filterMenuName) {
dispatch(setFiltersValues({ name: filterMenuName, value: { [NAME_FILTER]: event.target.value } }))
dispatch(
setFiltersValues({ name: filterMenuName, value: { [NAME_FILTER]: event.target.value } })
)
} else {
dispatch(setFilters({ [NAME_FILTER]: event.target.value }))
}
Expand All @@ -54,7 +56,7 @@ const NameFilter = ({ applyChanges, filterMenuName= '' }) => {
}

return (
<div className="name-filter">
<div className="name-filter filter-column">
<FormInput
iconClass="name-filter__icon"
iconClick={handleIconClick}
Expand Down
33 changes: 20 additions & 13 deletions src/components/ActionBar/ActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const ActionBar = ({
</div>
)}
{DATES_FILTER in filterMenu && !filtersConfig[DATES_FILTER].hidden && (
<div key={DATES_FILTER} className="action-bar__filters-item">
<div key={DATES_FILTER} className="action-bar__filters-item filter-column">
<Field name={DATES_FILTER}>
{({ input }) => {
return (
Expand All @@ -312,18 +312,18 @@ const ActionBar = ({
</Field>
</div>
)}
{filterMenuModal && (
<FilterMenuModal
applyChanges={filterMenuModal => applyChanges(formState.values, filterMenuModal)}
filterMenuName={filterMenuName}
initialValues={filterMenuModalInitialState}
restartFormTrigger={`${tab}`}
values={filterMenuModal.values}
>
{children}
</FilterMenuModal>
)}
</div>
{filterMenuModal && (
<FilterMenuModal
applyChanges={filterMenuModal => applyChanges(formState.values, filterMenuModal)}
filterMenuName={filterMenuName}
initialValues={filterMenuModalInitialState}
restartFormTrigger={`${tab}`}
values={filterMenuModal.values}
>
{children}
</FilterMenuModal>
)}
{(withRefreshButton || !isEmpty(actionButtons)) && (
<div className="action-bar__actions">
{actionButtons.map(
Expand All @@ -332,6 +332,7 @@ const ActionBar = ({
!actionButton.hidden &&
(actionButton.template || (
<Button
disabled={actionButton.disabled}
key={index}
variant={actionButton.variant}
label={actionButton.label}
Expand All @@ -340,7 +341,13 @@ const ActionBar = ({
/>
))
)}
{autoRefreshIsEnabled && <FormCheckBox className="auto-refresh" label={AUTO_REFRESH} name={AUTO_REFRESH_ID} />}
{autoRefreshIsEnabled && (
<FormCheckBox
className="auto-refresh"
label={AUTO_REFRESH}
name={AUTO_REFRESH_ID}
/>
)}
<FormOnChange handler={setAutoRefresh} name={AUTO_REFRESH_ID} />
{withRefreshButton && (
<RoundedIcon tooltipText="Refresh" onClick={() => refresh(formState)} id="refresh">
Expand Down
4 changes: 3 additions & 1 deletion src/components/FilterMenuModal/FilterMenuModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ const FilterMenuModal = ({
)}
{applyButton && !withoutApplyButton && (
<Button
disabled={isEqual(filtersData?.values, formState.values) || formState?.invalid}
disabled={
isEqual(filtersData?.values, formState.values) || formState?.invalid
}
id="filter-apply-btn"
variant={applyButton.variant}
label={applyButton.label}
Expand Down
14 changes: 6 additions & 8 deletions src/components/JobWizard/JobWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import { FUNCTIONS_SELECTION_FUNCTIONS_TAB } from './JobWizardSteps/JobWizardFun
import { JOB_WIZARD_MODE } from '../../types'
import { MODAL_MAX } from 'igz-controls/constants'
import { resetModalFilter } from '../../reducers/filtersReducer'
import { scheduledJobsActionCreator } from '../Jobs/ScheduledJobs/scheduledJobs.util'
import { setFieldState, isSubmitDisabled } from 'igz-controls/utils/form.util'
import { setNotification } from '../../reducers/notificationReducer'
import { showErrorNotification } from '../../utils/notifications.util'
Expand Down Expand Up @@ -139,11 +138,11 @@ const JobWizard = ({

useEffect(() => {
if (!isEditMode) {
dispatch(projectsAction.fetchProject(params.projectName, { format: 'minimal' })).then(
project => setCurrentProject(project)
).catch(error => {
showErrorNotification(dispatch, error, 'The project failed to load')
})
dispatch(projectsAction.fetchProject(params.projectName, { format: 'minimal' }))
.then(project => setCurrentProject(project))
.catch(error => {
showErrorNotification(dispatch, error, 'The project failed to load')
})
}
}, [dispatch, isEditMode, params.projectName])

Expand Down Expand Up @@ -563,7 +562,6 @@ export default connect(
{
...functionsActions,
...jobsActions,
...projectsAction,
editJob: scheduledJobsActionCreator.editJob
...projectsAction
}
)(JobWizard)
Loading
Loading