Skip to content

Commit

Permalink
Fix [Artifacts] 'Filter by' pop-up issues on version history page (#2974
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Taras-Hlukhovetskyi authored Dec 24, 2024
1 parent b75587c commit bec6534
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/components/ActionBar/ActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ const ActionBar = ({
<FilterMenuModal
applyChanges={filterMenuModal => applyChanges(formState.values, filterMenuModal)}
initialValues={filterMenuModalInitialState}
restartFormTrigger={`${tab}`}
values={filterMenuModal}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Documents/DocumentsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const DocumentsView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
<ArtifactsFilters artifacts={documents} />
<ArtifactsFilters artifacts={documents} isAllVersions={isAllVersions} />
</ActionBar>
</div>
{artifactsStore.loading ? null : tableContent.length === 0 ? (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Files/FilesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const FilesView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
<ArtifactsFilters artifacts={files} />
<ArtifactsFilters artifacts={files} isAllVersions={isAllVersions} />
</ActionBar>
</div>
{artifactsStore.loading ? null : tableContent.length === 0 ? (
Expand Down
19 changes: 3 additions & 16 deletions src/components/FilterMenuModal/FilterMenuModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import React, { useCallback, useEffect, useRef, useState } from 'react'
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { Form } from 'react-final-form'
import { createForm } from 'final-form'
import { isEmpty, isEqual, reduce, throttle } from 'lodash'
import { useDispatch } from 'react-redux'
import { useParams } from 'react-router-dom'

import { PopUpDialog, RoundedIcon, Button } from 'igz-controls/components'

Expand All @@ -45,15 +44,13 @@ const FilterMenuModal = ({
filterMenuName = '',
header = 'Filter by',
initialValues,
restartFormTrigger = null,
values,
withoutApplyButton = false,
wizardClassName = ''
}) => {
const [filtersWizardIsShown, setFiltersWizardIsShown] = useState(false)
const filtersIconButtonRef = useRef()
const dispatch = useDispatch()
const params = useParams()
const formRef = React.useRef(
createForm({
onSubmit: () => {},
Expand Down Expand Up @@ -101,19 +98,10 @@ const FilterMenuModal = ({
}
}, [hideFiltersWizard])

useEffect(() => {
const ref = formRef.current

return () => {
ref.restart(initialValues)
}
useLayoutEffect(() => {
formRef.current.reset(initialValues)
}, [
params.pageTab,
params.projectName,
restartFormTrigger,
dispatch,
initialValues,
filterMenuName
])

const getFilterCounter = formState => {
Expand Down Expand Up @@ -232,7 +220,6 @@ FilterMenuModal.propTypes = {
filterMenuName: PropTypes.string,
header: PropTypes.string,
initialValues: PropTypes.shape({}).isRequired,
restartFormTrigger: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
values: PropTypes.shape({}).isRequired,
withoutApplyButton: PropTypes.bool,
wizardClassName: PropTypes.string
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModelsPage/Models/ModelsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const ModelsView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
<ArtifactsFilters artifacts={models} />
<ArtifactsFilters artifacts={models} isAllVersions={isAllVersions} />
</ActionBar>
</div>
{isAllVersions && (
Expand Down

0 comments on commit bec6534

Please sign in to comment.