Skip to content

Commit

Permalink
Fix [Feature Store] Setting filters does not close the details panel (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mavdryk authored Jan 17, 2025
1 parent 6cfb8f2 commit a34d183
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 45 deletions.
23 changes: 10 additions & 13 deletions src/components/ActionBar/ActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Form } from 'react-final-form'
import { createForm } from 'final-form'
import { isEmpty, isEqual, isNil, mapValues, pickBy } from 'lodash'
import { useDispatch, useSelector } from 'react-redux'
import { useNavigate, useParams } from 'react-router-dom'
import { useNavigate } from 'react-router-dom'

import DatePicker from '../../common/DatePicker/DatePicker'
import FilterMenuModal from '../FilterMenuModal/FilterMenuModal'
Expand All @@ -45,10 +45,11 @@ import {
TAG_FILTER_ALL_ITEMS
} from '../../constants'
import detailsActions from '../../actions/details'
import { CUSTOM_RANGE_DATE_OPTION } from '../../utils/datePicker.util'
import { FILTERS_CONFIG } from '../../types'
import { setFilters, toggleAutoRefresh } from '../../reducers/filtersReducer'
import { getCloseDetailsLink } from '../../utils/link-helper.util'
import { setFieldState } from 'igz-controls/utils/form.util'
import { CUSTOM_RANGE_DATE_OPTION } from '../../utils/datePicker.util'
import { setFilters, toggleAutoRefresh } from '../../reducers/filtersReducer'

import { ReactComponent as CollapseIcon } from 'igz-controls/images/collapse.svg'
import { ReactComponent as ExpandIcon } from 'igz-controls/images/expand.svg'
Expand All @@ -62,13 +63,13 @@ const ActionBar = ({
autoRefreshStopTrigger = false,
cancelRequest = null,
children,
closeParamName = '',
filters,
filtersConfig,
handleAutoRefreshPrevValueChange,
handleRefresh,
hidden = false,
internalAutoRefreshIsEnabled = false,
navigateLink,
removeSelectedItem = null,
setSearchParams,
setSelectedRowData = null,
Expand All @@ -87,7 +88,6 @@ const ActionBar = ({
const filtersStore = useSelector(store => store.filtersStore)
const changes = useSelector(store => store.detailsStore.changes)
const dispatch = useDispatch()
const params = useParams()
const navigate = useNavigate()

const actionBarClassNames = classnames('action-bar', hidden && 'action-bar_hidden')
Expand Down Expand Up @@ -202,8 +202,8 @@ const ActionBar = ({
const newFilters = { ...filters, ...formValues }

if (filtersHelperResult) {
if ((params.name && params.tag) || params.id) {
navigate(navigateLink)
if (closeParamName) {
navigate(getCloseDetailsLink(closeParamName, true))
}

if (
Expand All @@ -230,17 +230,14 @@ const ActionBar = ({
filtersHelper,
changes,
dispatch,
params.name,
params.tag,
params.id,
filtersStore.groupBy,
saveFilters,
closeParamName,
removeSelectedItem,
setSelectedRowData,
toggleAllRows,
handleRefresh,
navigate,
navigateLink
navigate
]
)

Expand Down Expand Up @@ -472,11 +469,11 @@ ActionBar.propTypes = {
autoRefreshIsEnabled: PropTypes.bool,
autoRefreshIsStopped: PropTypes.bool,
cancelRequest: PropTypes.func,
closeParamName: PropTypes.string,
filters: PropTypes.object.isRequired,
filtersConfig: FILTERS_CONFIG.isRequired,
handleRefresh: PropTypes.func.isRequired,
hidden: PropTypes.bool,
navigateLink: PropTypes.string,
removeSelectedItem: PropTypes.func,
setSearchParams: PropTypes.func.isRequired,
setSelectedRowData: PropTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const AddToFeatureVectorView = React.forwardRef(
filters={filters}
filtersConfig={filtersConfig}
handleRefresh={handleRefresh}
page={FEATURE_STORE_PAGE}
setSearchParams={setSearchParams}
tab={ADD_TO_FEATURE_VECTOR_TAB}
withoutExpandButton
Expand Down
4 changes: 2 additions & 2 deletions src/components/Alerts/AlertsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ const AlertsView = ({
<div className="content__action-bar-wrapper">
<ActionBar
autoRefreshIsStopped={true}
closeParamName={ALERTS_PAGE_PATH}
filterMenuName={ALERTS_FILTERS}
filtersConfig={alertsFiltersConfig}
filters={filters}
filtersConfig={alertsFiltersConfig}
handleRefresh={handleRefreshAlerts}
page={ALERTS_PAGE}
setSearchParams={setSearchParams}
withRefreshButton
withoutExpandButton
Expand Down
3 changes: 1 addition & 2 deletions src/components/Datasets/DatasetsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ const DatasetsView = React.forwardRef(
onClick: handleRegisterDataset
}
]}
closeParamName={isAllVersions ? ALL_VERSIONS_PATH : DATASETS_TAB}
filters={filters}
filtersConfig={filtersConfig}
navigateLink={`/projects/${projectName}/${DATASETS_TAB}${isAllVersions ? `/${datasetName}/${ALL_VERSIONS_PATH}` : ''}${window.location.search}`}
handleRefresh={handleRefreshDatasets}
page={DATASETS_PAGE}
setSearchParams={setSearchDatasetsParams}
withRefreshButton
withoutExpandButton
Expand Down
3 changes: 1 addition & 2 deletions src/components/Documents/DocumentsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ const DocumentsView = React.forwardRef(
/>
)}
<ActionBar
closeParamName={isAllVersions ? ALL_VERSIONS_PATH : DOCUMENTS_TAB}
filters={filters}
filtersConfig={filtersConfig}
navigateLink={`/projects/${projectName}/${DOCUMENTS_TAB}${isAllVersions ? `/${documentName}/${ALL_VERSIONS_PATH}` : ''}${window.location.search}`}
handleRefresh={handleRefreshDocuments}
page={DOCUMENTS_PAGE}
setSearchParams={setSearchDocumentsParams}
withRefreshButton
withoutExpandButton
Expand Down
2 changes: 1 addition & 1 deletion src/components/FeatureStore/FeatureSets/FeatureSetsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ const FeatureSetsView = React.forwardRef(
onClick: () => setFeatureSetsPanelIsOpen(true)
}
]}
closeParamName={FEATURE_SETS_TAB}
filters={filters}
filtersConfig={filtersConfig}
handleRefresh={handleRefresh}
page={FEATURE_STORE_PAGE}
setSearchParams={setSearchParams}
tab={FEATURE_SETS_TAB}
withoutExpandButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ const FeatureVectorsView = React.forwardRef(
onClick: () => setCreateVectorPopUpIsOpen(true)
}
]}
closeParamName={FEATURE_VECTORS_TAB}
filters={filters}
filtersConfig={filtersConfig}
handleRefresh={handleRefresh}
page={FEATURE_STORE_PAGE}
setSearchParams={setSearchParams}
tab={FEATURE_VECTORS_TAB}
withoutExpandButton
Expand Down
1 change: 0 additions & 1 deletion src/components/FeatureStore/Features/FeaturesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const FeaturesView = React.forwardRef(
filters={filters}
filtersConfig={filtersConfig}
handleRefresh={handleRefresh}
page={FEATURE_STORE_PAGE}
setSearchParams={setSearchParams}
tab={FEATURES_TAB}
withoutExpandButton
Expand Down
3 changes: 1 addition & 2 deletions src/components/Files/FilesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ const FilesView = React.forwardRef(
onClick: handleRegisterArtifact
}
]}
closeParamName={isAllVersions ? ALL_VERSIONS_PATH : FILES_TAB}
filters={filters}
filtersConfig={filtersConfig}
navigateLink={`/projects/${projectName}/files${isAllVersions ? `/${fileName}/${ALL_VERSIONS_PATH}` : ''}${window.location.search}`}
handleRefresh={handleRefreshFiles}
page={FILES_PAGE}
setSearchParams={setSearchFilesParams}
withRefreshButton
withoutExpandButton
Expand Down
13 changes: 6 additions & 7 deletions src/components/FunctionsPage/FunctionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ const FunctionsView = ({
/>
)}
<ActionBar
page={FUNCTIONS_PAGE}
filtersConfig={functionsFiltersConfig}
filters={filters}
handleRefresh={handleRefreshFunctions}
navigateLink={`/projects/${params.projectName}/functions${isAllVersions ? `/${params.funcName}/${ALL_VERSIONS_PATH}` : ''}${window.location.search}`}
setSearchParams={setSearchFunctionsParams}
withoutExpandButton
actionButtons={[
{
hidden: !isDemoMode,
Expand All @@ -108,6 +101,12 @@ const FunctionsView = ({
})
}
]}
closeParamName={isAllVersions ? ALL_VERSIONS_PATH : FUNCTIONS_PAGE_PATH}
filters={filters}
filtersConfig={functionsFiltersConfig}
handleRefresh={handleRefreshFunctions}
setSearchParams={setSearchFunctionsParams}
withoutExpandButton
>
<FunctionsFilters />
</ActionBar>
Expand Down
5 changes: 2 additions & 3 deletions src/components/Jobs/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { ConfirmDialog } from 'igz-controls/components'

import {
INACTIVE_JOBS_TAB,
JOBS_MONITORING_PAGE,
JOBS_PAGE,
JOBS_PAGE_PATH,
MONITOR_JOBS_TAB,
Expand Down Expand Up @@ -238,13 +237,13 @@ const Jobs = () => {
jobWizardIsOpened || jobsStore.loading || Boolean(jobsStore.jobLoadingCounter)
}
autoRefreshStopTrigger={!isEmpty(selectedJob)}
closeParamName={selectedTab}
filters={filters}
filtersConfig={initialTabData[selectedTab].filtersConfig}
handleRefresh={tabData[selectedTab].handleRefresh}
handleAutoRefreshPrevValueChange={setAutoRefreshPrevValue}
handleRefresh={tabData[selectedTab].handleRefresh}
hidden={Boolean(params.workflowId)}
key={selectedTab}
page={JOBS_MONITORING_PAGE}
setSearchParams={setSearchParams}
tab={selectedTab}
withAutoRefresh={selectedTab === MONITOR_JOBS_TAB}
Expand Down
1 change: 0 additions & 1 deletion src/components/Jobs/MonitorJobs/MonitorJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ const MonitorJobs = () => {
autoRefreshPrevValue={autoRefreshPrevValue}
jobRuns={jobRuns}
jobs={jobs}
navigateLink={getBackLink()}
paginatedJobs={paginatedJobs}
ref={{ abortJobRef, fetchJobFunctionsPromiseRef }}
refreshJobs={refreshJobs}
Expand Down
3 changes: 1 addition & 2 deletions src/components/ModelsPage/ModelEndpoints/ModelEndpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ const ModelEndpoints = () => {
filters={filters}
filtersConfig={filtersConfig}
handleRefresh={handleRefresh}
navigateLink={`/projects/${params.projectName}/models/${MODEL_ENDPOINTS_TAB}${window.location.search}`}
page={MODELS_PAGE}
closeParamName={MODEL_ENDPOINTS_TAB}
setSearchParams={setSearchParams}
tab={MODEL_ENDPOINTS_TAB}
withoutExpandButton
Expand Down
3 changes: 1 addition & 2 deletions src/components/ModelsPage/Models/ModelsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ const ModelsView = React.forwardRef(
hidden: !isDemoMode
}
]}
closeParamName={isAllVersions ? ALL_VERSIONS_PATH : MODELS_TAB}
filters={filters}
filtersConfig={filtersConfig}
navigateLink={`/projects/${projectName}/models/models${isAllVersions ? `/${modelName}/${ALL_VERSIONS_PATH}` : ''}${window.location.search}`}
handleRefresh={handleRefreshModels}
page={MODELS_PAGE}
setSearchParams={setSearchModelsParams}
tab={MODELS_TAB}
withRefreshButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,10 @@ const RealTimePipelines = () => {
<div className={filterMenuClassNames}>
<ModelsPageTabs />
<ActionBar
closeParamName={REAL_TIME_PIPELINES_TAB}
filters={filters}
filtersConfig={filtersConfig}
handleRefresh={handleRefresh}
navigateLink={`/projects/${params.projectName}/models/${REAL_TIME_PIPELINES_TAB}${window.location.search}`}
page={MODELS_PAGE}
setSearchParams={setSearchParams}
tab={REAL_TIME_PIPELINES_TAB}
withoutExpandButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const JobsMonitoring = () => {
filtersConfig={jobsFiltersConfig}
jobRuns={jobRuns}
jobs={jobs}
navigateLink={getBackLink()}
paginatedJobs={paginatedJobs}
ref={{ abortJobRef, fetchJobFunctionsPromiseRef }}
refreshJobs={() => refreshJobs(filters)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ const ProjectsJobsMonitoring = () => {
jobWizardIsOpened || jobsStore.loading || Boolean(jobsStore.jobLoadingCounter)
}
autoRefreshStopTrigger={!isEmpty(selectedJob)}
closeParamName={selectedTab}
filters={filters}
filtersConfig={initialTabData[selectedTab].filtersConfig}
handleRefresh={tabData[selectedTab].handleRefresh}
handleAutoRefreshPrevValueChange={setAutoRefreshPrevValue}
hidden={Boolean(params.workflowId)}
key={selectedTab}
page={JOBS_MONITORING_PAGE}
setSearchParams={setSearchParams}
tab={selectedTab}
withAutoRefresh={selectedTab === JOBS_MONITORING_JOBS_TAB}
Expand Down
1 change: 0 additions & 1 deletion src/elements/JobsTable/JobsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ JobsTable.propTypes = {
filtersConfig: FILTERS_CONFIG.isRequired,
jobRuns: PropTypes.array.isRequired,
jobs: PropTypes.array.isRequired,
navigateLink: PropTypes.string.isRequired,
paginatedJobs: PropTypes.array.isRequired,
refreshJobs: PropTypes.func.isRequired,
requestErrorMessage: PropTypes.string.isRequired,
Expand Down

0 comments on commit a34d183

Please sign in to comment.