Skip to content

Commit

Permalink
Fix [Artifacts] Add best iteration checkbox to filters (#3007)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taras-Hlukhovetskyi authored Jan 13, 2025
1 parent 852c80d commit 215a2f3
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 31 deletions.
6 changes: 2 additions & 4 deletions src/components/ArtifactsActionBar/ArtifactsFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ITERATIONS_FILTER, LABELS_FILTER, SHOW_ITERATIONS, TAG_FILTER } from '.

import './artifactsFilters.scss'

const ArtifactsFilters = ({ artifacts, isAllVersions }) => {
const ArtifactsFilters = ({ artifacts }) => {
const form = useForm()

const handleIter = value => {
Expand All @@ -53,16 +53,14 @@ const ArtifactsFilters = ({ artifacts, isAllVersions }) => {
<div className="form-row">
<FormTagFilter content={artifacts} label="Version tag" name={TAG_FILTER} />
</div>
{isAllVersions && (
<div className="form-row">
<div className="form-row">
<FormCheckBox
className="artifacts-filters__iter"
label="Show best iteration only"
name={ITERATIONS_FILTER}
/>
<FormOnChange name={ITERATIONS_FILTER} handler={handleIter} />
</div>
)}
</div>
)
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/Datasets/Datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import {
GROUP_BY_NONE,
REQUEST_CANCELED,
BE_PAGE,
BE_PAGE_SIZE
BE_PAGE_SIZE,
ITERATIONS_FILTER,
SHOW_ITERATIONS
} from '../../constants'
import { fetchArtifactTags, fetchDataSets, removeDataSets } from '../../reducers/artifactsReducer'
import {
Expand Down Expand Up @@ -113,7 +115,11 @@ const Datasets = ({ isAllVersions = false }) => {
requestParams.name = params.datasetName
setDatasetVersions([])
} else {
requestParams['partition-by'] = 'project_and_name'
if (filters[ITERATIONS_FILTER] !== SHOW_ITERATIONS) {
requestParams['partition-by'] = 'project_and_name'
requestParams['partition-sort-by'] = 'updated'
}

setDatasets([])
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Datasets/DatasetsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const DatasetsView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
<ArtifactsFilters artifacts={datasets} isAllVersions={isAllVersions} />
<ArtifactsFilters artifacts={datasets} />
</ActionBar>
</div>
{artifactsStore.loading ? null : tableContent.length === 0 ? (
Expand Down
8 changes: 4 additions & 4 deletions src/components/Datasets/datasets.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import {
TAG_FILTER_ALL_ITEMS,
TAG_FILTER_LATEST,
VIEW_SEARCH_PARAMETER,
BE_PAGE
BE_PAGE,
SHOW_ITERATIONS
} from '../../constants'
import { PRIMARY_BUTTON } from 'igz-controls/constants'
import { applyTagChanges, chooseOrFetchArtifact } from '../../utils/artifacts.util'
Expand Down Expand Up @@ -88,9 +89,8 @@ export const getFiltersConfig = isAllVersions => ({
[LABELS_FILTER]: { label: 'Labels:', initialValue: '', isModal: true },
[ITERATIONS_FILTER]: {
label: 'Show best iteration only:',
initialValue: '',
isModal: true,
hidden: !isAllVersions
initialValue: isAllVersions ? '' : SHOW_ITERATIONS,
isModal: true
}
})

Expand Down
10 changes: 8 additions & 2 deletions src/components/Documents/Documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ import {
DOCUMENT_TYPE,
DOCUMENTS_TAB,
GROUP_BY_NONE,
REQUEST_CANCELED
ITERATIONS_FILTER,
REQUEST_CANCELED,
SHOW_ITERATIONS
} from '../../constants'
import { fetchArtifactTags, fetchDocuments, removeDocuments } from '../../reducers/artifactsReducer'
import { getFilterTagOptions, setFilters } from '../../reducers/filtersReducer'
Expand Down Expand Up @@ -109,7 +111,11 @@ const Documents = ({ isAllVersions = false }) => {
requestParams.name = params.documentName
setDocumentVersions([])
} else {
requestParams['partition-by'] = 'project_and_name'
if (filters[ITERATIONS_FILTER] !== SHOW_ITERATIONS) {
requestParams['partition-by'] = 'project_and_name'
requestParams['partition-sort-by'] = 'updated'
}

setDocuments([])
}

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} isAllVersions={isAllVersions} />
<ArtifactsFilters artifacts={documents} />
</ActionBar>
</div>
{artifactsStore.loading ? null : tableContent.length === 0 ? (
Expand Down
6 changes: 3 additions & 3 deletions src/components/Documents/documents.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
ITERATIONS_FILTER,
LABELS_FILTER,
NAME_FILTER,
SHOW_ITERATIONS,
TAG_FILTER,
TAG_FILTER_ALL_ITEMS,
TAG_FILTER_LATEST,
Expand Down Expand Up @@ -70,9 +71,8 @@ export const getFiltersConfig = isAllVersions => ({
[LABELS_FILTER]: { label: 'Labels:', initialValue: '', isModal: true },
[ITERATIONS_FILTER]: {
label: 'Show best iteration only:',
initialValue: '',
isModal: true,
hidden: !isAllVersions
initialValue: isAllVersions ? '' : SHOW_ITERATIONS,
isModal: true
}
})

Expand Down
10 changes: 8 additions & 2 deletions src/components/Files/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import {
BE_PAGE_SIZE,
FILES_TAB,
GROUP_BY_NONE,
REQUEST_CANCELED
ITERATIONS_FILTER,
REQUEST_CANCELED,
SHOW_ITERATIONS
} from '../../constants'
import {
checkForSelectedFile,
Expand Down Expand Up @@ -111,7 +113,11 @@ const Files = ({ isAllVersions = false }) => {
requestParams.name = params.fileName
setFileVersions([])
} else {
requestParams['partition-by'] = 'project_and_name'
if (filters[ITERATIONS_FILTER] !== SHOW_ITERATIONS) {
requestParams['partition-by'] = 'project_and_name'
requestParams['partition-sort-by'] = 'updated'
}

setFiles([])
}

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} isAllVersions={isAllVersions} />
<ArtifactsFilters artifacts={files} />
</ActionBar>
</div>
{artifactsStore.loading ? null : tableContent.length === 0 ? (
Expand Down
8 changes: 4 additions & 4 deletions src/components/Files/files.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import {
TAG_FILTER_ALL_ITEMS,
TAG_FILTER_LATEST,
VIEW_SEARCH_PARAMETER,
BE_PAGE
BE_PAGE,
SHOW_ITERATIONS
} from '../../constants'
import { applyTagChanges, chooseOrFetchArtifact } from '../../utils/artifacts.util'
import { copyToClipboard } from '../../utils/copyToClipboard'
Expand Down Expand Up @@ -70,9 +71,8 @@ export const getFiltersConfig = isAllVersions => ({
[LABELS_FILTER]: { label: 'Labels:', initialValue: '', isModal: true },
[ITERATIONS_FILTER]: {
label: 'Show best iteration only:',
initialValue: '',
isModal: true,
hidden: !isAllVersions
initialValue: isAllVersions ? '' : SHOW_ITERATIONS,
isModal: true
}
})

Expand Down
10 changes: 8 additions & 2 deletions src/components/ModelsPage/Models/Models.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ import {
FUNCTION_TYPE_SERVING,
ALL_VERSIONS_PATH,
BE_PAGE,
BE_PAGE_SIZE
BE_PAGE_SIZE,
ITERATIONS_FILTER,
SHOW_ITERATIONS
} from '../../../constants'
import {
checkForSelectedModel,
Expand Down Expand Up @@ -127,7 +129,11 @@ const Models = ({ fetchModelFeatureVector, isAllVersions }) => {
requestParams.name = params.modelName
setModelVersions([])
} else {
requestParams['partition-by'] = 'project_and_name'
if (filters[ITERATIONS_FILTER] !== SHOW_ITERATIONS) {
requestParams['partition-by'] = 'project_and_name'
requestParams['partition-sort-by'] = 'updated'
}

setModels([])
}

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} isAllVersions={isAllVersions} />
<ArtifactsFilters artifacts={models} />
</ActionBar>
</div>
{isAllVersions && (
Expand Down
8 changes: 4 additions & 4 deletions src/components/ModelsPage/Models/models.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import {
TAG_FILTER_LATEST,
VIEW_SEARCH_PARAMETER,
TAG_FILTER_ALL_ITEMS,
BE_PAGE
BE_PAGE,
SHOW_ITERATIONS
} from '../../../constants'
import { showArtifactsPreview, updateArtifact } from '../../../reducers/artifactsReducer'
import { FORBIDDEN_ERROR_STATUS_CODE } from 'igz-controls/constants'
Expand Down Expand Up @@ -76,9 +77,8 @@ export const getFiltersConfig = isAllVersions => ({
[LABELS_FILTER]: { label: 'Labels:', initialValue: '', isModal: true },
[ITERATIONS_FILTER]: {
label: 'Show best iteration only:',
initialValue: '',
isModal: true,
hidden: !isAllVersions
initialValue: isAllVersions ? '' : SHOW_ITERATIONS,
isModal: true
}
})

Expand Down

0 comments on commit 215a2f3

Please sign in to comment.