From 215a2f3155ea211f813d44e64601e799f2af1d48 Mon Sep 17 00:00:00 2001
From: Taras-Hlukhovetskyi
<155433425+Taras-Hlukhovetskyi@users.noreply.github.com>
Date: Mon, 13 Jan 2025 12:02:49 +0200
Subject: [PATCH] Fix [Artifacts] Add `best iteration` checkbox to filters
(#3007)
---
src/components/ArtifactsActionBar/ArtifactsFilters.js | 6 ++----
src/components/Datasets/Datasets.js | 10 ++++++++--
src/components/Datasets/DatasetsView.js | 2 +-
src/components/Datasets/datasets.util.js | 8 ++++----
src/components/Documents/Documents.js | 10 ++++++++--
src/components/Documents/DocumentsView.js | 2 +-
src/components/Documents/documents.util.js | 6 +++---
src/components/Files/Files.js | 10 ++++++++--
src/components/Files/FilesView.js | 2 +-
src/components/Files/files.util.js | 8 ++++----
src/components/ModelsPage/Models/Models.js | 10 ++++++++--
src/components/ModelsPage/Models/ModelsView.js | 2 +-
src/components/ModelsPage/Models/models.util.js | 8 ++++----
13 files changed, 53 insertions(+), 31 deletions(-)
diff --git a/src/components/ArtifactsActionBar/ArtifactsFilters.js b/src/components/ArtifactsActionBar/ArtifactsFilters.js
index d5605f7c1..e593678e6 100644
--- a/src/components/ArtifactsActionBar/ArtifactsFilters.js
+++ b/src/components/ArtifactsActionBar/ArtifactsFilters.js
@@ -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 => {
@@ -53,8 +53,7 @@ const ArtifactsFilters = ({ artifacts, isAllVersions }) => {
- {isAllVersions && (
-
)
}
diff --git a/src/components/Datasets/Datasets.js b/src/components/Datasets/Datasets.js
index e6e3f3d09..b2bb5d853 100644
--- a/src/components/Datasets/Datasets.js
+++ b/src/components/Datasets/Datasets.js
@@ -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 {
@@ -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([])
}
diff --git a/src/components/Datasets/DatasetsView.js b/src/components/Datasets/DatasetsView.js
index f5d69abf0..f941f7a83 100644
--- a/src/components/Datasets/DatasetsView.js
+++ b/src/components/Datasets/DatasetsView.js
@@ -107,7 +107,7 @@ const DatasetsView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
-
+
{artifactsStore.loading ? null : tableContent.length === 0 ? (
diff --git a/src/components/Datasets/datasets.util.js b/src/components/Datasets/datasets.util.js
index b4fcb584c..6171bd04d 100644
--- a/src/components/Datasets/datasets.util.js
+++ b/src/components/Datasets/datasets.util.js
@@ -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'
@@ -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
}
})
diff --git a/src/components/Documents/Documents.js b/src/components/Documents/Documents.js
index c9ade5059..8dd2086a0 100644
--- a/src/components/Documents/Documents.js
+++ b/src/components/Documents/Documents.js
@@ -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'
@@ -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([])
}
diff --git a/src/components/Documents/DocumentsView.js b/src/components/Documents/DocumentsView.js
index 4707395d3..ad5587f60 100644
--- a/src/components/Documents/DocumentsView.js
+++ b/src/components/Documents/DocumentsView.js
@@ -94,7 +94,7 @@ const DocumentsView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
-
+
{artifactsStore.loading ? null : tableContent.length === 0 ? (
diff --git a/src/components/Documents/documents.util.js b/src/components/Documents/documents.util.js
index b03286a6c..21ad2315d 100644
--- a/src/components/Documents/documents.util.js
+++ b/src/components/Documents/documents.util.js
@@ -31,6 +31,7 @@ import {
ITERATIONS_FILTER,
LABELS_FILTER,
NAME_FILTER,
+ SHOW_ITERATIONS,
TAG_FILTER,
TAG_FILTER_ALL_ITEMS,
TAG_FILTER_LATEST,
@@ -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
}
})
diff --git a/src/components/Files/Files.js b/src/components/Files/Files.js
index 408b95967..17cc242fe 100644
--- a/src/components/Files/Files.js
+++ b/src/components/Files/Files.js
@@ -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,
@@ -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([])
}
diff --git a/src/components/Files/FilesView.js b/src/components/Files/FilesView.js
index 6697815b4..73a06a85b 100644
--- a/src/components/Files/FilesView.js
+++ b/src/components/Files/FilesView.js
@@ -106,7 +106,7 @@ const FilesView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
-
+
{artifactsStore.loading ? null : tableContent.length === 0 ? (
diff --git a/src/components/Files/files.util.js b/src/components/Files/files.util.js
index 299a4351e..211e73714 100644
--- a/src/components/Files/files.util.js
+++ b/src/components/Files/files.util.js
@@ -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'
@@ -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
}
})
diff --git a/src/components/ModelsPage/Models/Models.js b/src/components/ModelsPage/Models/Models.js
index c534c7430..b72524317 100644
--- a/src/components/ModelsPage/Models/Models.js
+++ b/src/components/ModelsPage/Models/Models.js
@@ -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,
@@ -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([])
}
diff --git a/src/components/ModelsPage/Models/ModelsView.js b/src/components/ModelsPage/Models/ModelsView.js
index 6194b6e9c..5e71e1c4a 100644
--- a/src/components/ModelsPage/Models/ModelsView.js
+++ b/src/components/ModelsPage/Models/ModelsView.js
@@ -105,7 +105,7 @@ const ModelsView = React.forwardRef(
withRefreshButton
withoutExpandButton
>
-
+
{isAllVersions && (
diff --git a/src/components/ModelsPage/Models/models.util.js b/src/components/ModelsPage/Models/models.util.js
index bd232ec6b..d11b3d9f3 100644
--- a/src/components/ModelsPage/Models/models.util.js
+++ b/src/components/ModelsPage/Models/models.util.js
@@ -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'
@@ -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
}
})