From cbb44f1e50cc4ee47b750402d4695a3fefa234c9 Mon Sep 17 00:00:00 2001 From: mariana-furyk <58301139+mariana-furyk@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:49:52 +0200 Subject: [PATCH 1/2] Impl [Artifacts][Models][Datasets] artifacts screen needs to change BE query behavior `1.6.x` (#2225) --- src/api/artifacts-api.js | 15 ++-- src/common/FormTagFilter/FormTagFilter.js | 39 ++++++++--- src/common/FormTagFilter/formTagFilters.scss | 4 ++ .../ArtifactsActionBar/ArtifactsActionBar.js | 4 +- .../ArtifactsActionBar/ArtifactsFilters.js | 9 ++- src/components/Datasets/Datasets.js | 69 +++++++++++-------- src/components/Datasets/DatasetsView.js | 1 + src/components/Files/Files.js | 63 +++++++++++------ src/components/Files/FilesView.js | 1 + src/components/ModelsPage/Models/Models.js | 53 ++++++++------ .../ModelsPage/Models/ModelsView.js | 1 + src/hooks/useGetTagOptions.hook.js | 4 +- 12 files changed, 173 insertions(+), 90 deletions(-) diff --git a/src/api/artifacts-api.js b/src/api/artifacts-api.js index 3e76d1de5d..bcecf42162 100644 --- a/src/api/artifacts-api.js +++ b/src/api/artifacts-api.js @@ -23,10 +23,11 @@ import { DATASET_TYPE, MODEL_TYPE, SHOW_ITERATIONS, - TAG_FILTER_ALL_ITEMS + TAG_FILTER_ALL_ITEMS, + TAG_FILTER_LATEST } from '../constants' -const fetchArtifacts = (project, filters, config = {}) => { +const fetchArtifacts = (project, filters, config = {}, withLatestTag) => { const params = {} if (filters?.labels) { @@ -37,6 +38,10 @@ const fetchArtifacts = (project, filters, config = {}) => { params['best-iteration'] = true } + if (filters?.tag && (withLatestTag || filters.tag !== TAG_FILTER_LATEST)) { + params.tag = filters.tag === TAG_FILTER_ALL_ITEMS ? '*' : filters.tag + } + if (filters?.name) { params.name = `~${filters.name}` } @@ -121,7 +126,7 @@ const artifactsApi = { params: { category: DATASET_TYPE } } - return fetchArtifacts(project, filters, newConfig) + return fetchArtifacts(project, filters, newConfig, true) }, getFile: (project, file, iter, tag) => { return fetchArtifacts( @@ -143,7 +148,7 @@ const artifactsApi = { params: { category: ARTIFACT_OTHER_TYPE, format: 'full' } } - return fetchArtifacts(project, filters, newConfig) + return fetchArtifacts(project, filters, newConfig, true) }, getModel: (project, model, iter, tag) => { return fetchArtifacts( @@ -177,7 +182,7 @@ const artifactsApi = { params: { category: MODEL_TYPE, format: 'full' } } - return fetchArtifacts(project, filters, newConfig) + return fetchArtifacts(project, filters, newConfig, true) }, registerArtifact: (project, data) => { return mainHttpClientV2.post(`/projects/${project}/artifacts`, data) diff --git a/src/common/FormTagFilter/FormTagFilter.js b/src/common/FormTagFilter/FormTagFilter.js index 2ecf08d13d..a299dc9fde 100644 --- a/src/common/FormTagFilter/FormTagFilter.js +++ b/src/common/FormTagFilter/FormTagFilter.js @@ -21,7 +21,7 @@ import React, { useState, useRef, useEffect, useCallback, useMemo, useLayoutEffe import PropTypes from 'prop-types' import { Field, useField } from 'react-final-form' import { useSelector } from 'react-redux' -import { isEqual } from 'lodash' +import { isEqual, uniq } from 'lodash' import classnames from 'classnames' import { PopUpDialog } from 'igz-controls/components' @@ -33,7 +33,7 @@ import { ReactComponent as Caret } from 'igz-controls/images/dropdown.svg' import './formTagFilters.scss' -const FormTagFilter = ({ label, name }) => { +const FormTagFilter = ({ content, label, name }) => { const { input } = useField(name) const [isDropDownMenuOpen, setIsDropDownMenuOpen] = useState(false) const [tagFilter, setTagFilter] = useState(input.value) @@ -51,26 +51,44 @@ const FormTagFilter = ({ label, name }) => { const options = useMemo(() => { let newTagOptions = tagFilterOptions + let pageTagList = [] if (filtersStore.tagOptions?.length > 0) { const defaultOptionsTags = tagFilterOptions.map(option => option.id) + pageTagList = [...tagFilterOptions] + let contentTagList = [] + + if (content) { + contentTagList = uniq(content.map(contentItem => contentItem.tag)) + } + newTagOptions = [ - ...tagFilterOptions, ...filtersStore.tagOptions.reduce((acc, tag) => { if (!defaultOptionsTags.includes(tag)) { - acc.push({ - label: tag, - id: tag - }) + if (contentTagList.includes(tag)) { + pageTagList.push({ + label: tag, + id: tag + }) + } else { + acc.push({ + label: tag, + id: tag + }) + } } return acc }, []) ] + + if (pageTagList.length > 2) { + pageTagList[pageTagList.length - 1].className = 'page-tag-list' + } } - return newTagOptions - }, [filtersStore.tagOptions]) + return [...pageTagList, ...newTagOptions] + }, [content, filtersStore.tagOptions]) useEffect(() => { if (!isEqual(options, filtersStore.tagOptions)) { @@ -193,7 +211,8 @@ const FormTagFilter = ({ label, name }) => { 'form-tag-filter__dropdown-item', tagFilter.length !== 0 && tagFilter === tag.id && - 'form-tag-filter__dropdown-item_selected' + 'form-tag-filter__dropdown-item_selected', + tag.className ) return ( diff --git a/src/common/FormTagFilter/formTagFilters.scss b/src/common/FormTagFilter/formTagFilters.scss index 8aad33778e..aa81775433 100644 --- a/src/common/FormTagFilter/formTagFilters.scss +++ b/src/common/FormTagFilter/formTagFilters.scss @@ -82,5 +82,9 @@ background-color: $alabaster; } } + + .page-tag-list { + border-bottom: $dividerBorder; + } } } diff --git a/src/components/ArtifactsActionBar/ArtifactsActionBar.js b/src/components/ArtifactsActionBar/ArtifactsActionBar.js index 1211ae2a4f..aeae500b1f 100644 --- a/src/components/ArtifactsActionBar/ArtifactsActionBar.js +++ b/src/components/ArtifactsActionBar/ArtifactsActionBar.js @@ -46,6 +46,7 @@ import { ReactComponent as RefreshIcon } from 'igz-controls/images/refresh.svg' function ArtifactsActionBar({ actionButtons, + artifacts, cancelRequest, filterMenuName, handleRefresh, @@ -155,7 +156,7 @@ function ArtifactsActionBar({ values={filtersInitialState} wizardClassName="artifacts-filters__wrapper" > - +
@@ -199,6 +200,7 @@ ArtifactsActionBar.propTypes = { variant: PropTypes.string.isRequired }) ), + artifacts: PropTypes.arrayOf(PropTypes.object).isRequired, cancelRequest: PropTypes.func, filterMenuName: PropTypes.string.isRequired, handleRefresh: PropTypes.func.isRequired, diff --git a/src/components/ArtifactsActionBar/ArtifactsFilters.js b/src/components/ArtifactsActionBar/ArtifactsFilters.js index cfe614d445..71fa1f969e 100644 --- a/src/components/ArtifactsActionBar/ArtifactsFilters.js +++ b/src/components/ArtifactsActionBar/ArtifactsFilters.js @@ -20,6 +20,7 @@ such restriction. import React from 'react' import { OnChange } from 'react-final-form-listeners' import { useForm } from 'react-final-form' +import PropTypes from 'prop-types' import { FormInput, FormCheckBox } from 'igz-controls/components' import FormTagFilter from '../../common/FormTagFilter/FormTagFilter' @@ -28,7 +29,7 @@ import { ITERATIONS_FILTER, LABELS_FILTER, SHOW_ITERATIONS, TAG_FILTER } from '. import './artifactsFilters.scss' -const ArtifactsFilters = () => { +const ArtifactsFilters = ({ artifacts }) => { const form = useForm() const handleIter = value => { @@ -46,7 +47,7 @@ const ArtifactsFilters = () => { {handleLabelsChange}
- +
{ ) } +ArtifactsFilters.propTypes = { + artifacts: PropTypes.arrayOf(PropTypes.object).isRequired +} + export default ArtifactsFilters diff --git a/src/components/Datasets/Datasets.js b/src/components/Datasets/Datasets.js index 731419db08..42dd5543a3 100644 --- a/src/components/Datasets/Datasets.js +++ b/src/components/Datasets/Datasets.js @@ -20,7 +20,6 @@ such restriction. import React, { useCallback, useEffect, useRef, useState, useMemo } from 'react' import { useDispatch, useSelector } from 'react-redux' import { useLocation, useNavigate, useParams } from 'react-router-dom' -import { isNil } from 'lodash' import DatasetsView from './DatasetsView' import AddArtifactTagPopUp from '../../elements/AddArtifactTagPopUp/AddArtifactTagPopUp' @@ -34,9 +33,11 @@ import { GROUP_BY_NAME, GROUP_BY_NONE, REQUEST_CANCELED, + SHOW_ITERATIONS, TAG_FILTER_ALL_ITEMS } from '../../constants' import { + fetchArtifactTags, fetchDataSet, fetchDataSets, removeDataSet, @@ -56,8 +57,7 @@ import { getArtifactIdentifier } from '../../utils/getUniqueIdentifier' import { getViewMode } from '../../utils/helper' import { isDetailsTabExists } from '../../utils/isDetailsTabExists' import { openPopUp } from 'igz-controls/utils/common.util' -import { setArtifactTags } from '../../utils/artifacts.util' -import { setFilters } from '../../reducers/filtersReducer' +import { getFilterTagOptions, setFilters } from '../../reducers/filtersReducer' import { setNotification } from '../../reducers/notificationReducer' import { useGetTagOptions } from '../../hooks/useGetTagOptions.hook' import { useGroupContent } from '../../hooks/groupContent.hook' @@ -66,12 +66,16 @@ import { useYaml } from '../../hooks/yaml.hook' const Datasets = () => { const [datasets, setDatasets] = useState([]) - const [allDatasets, setAllDatasets] = useState([]) const [selectedDataset, setSelectedDataset] = useState({}) const [selectedRowData, setSelectedRowData] = useState({}) const [largeRequestErrorMessage, setLargeRequestErrorMessage] = useState('') const [convertedYaml, toggleConvertedYaml] = useYaml('') - const [urlTagOption] = useGetTagOptions(null, filters, null, DATASETS_FILTERS) + const [urlTagOption] = useGetTagOptions( + fetchArtifactTags, + filters, + DATASET_TYPE, + DATASETS_FILTERS + ) const artifactsStore = useSelector(store => store.artifactsStore) const filtersStore = useSelector(store => store.filtersStore) const datasetsRef = useRef(null) @@ -118,19 +122,12 @@ const Datasets = () => { }) ) .unwrap() - .then(dataSetsResponse => { - if (dataSetsResponse) { - setArtifactTags( - dataSetsResponse, - setDatasets, - setAllDatasets, - filters, - dispatch, - DATASETS_PAGE - ) - - return dataSetsResponse + .then(result => { + if (result) { + setDatasets(result) } + + return result }) }, [dispatch, params.projectName] @@ -138,13 +135,20 @@ const Datasets = () => { const handleRefresh = useCallback( filters => { + dispatch( + getFilterTagOptions({ + dispatch, + fetchTags: fetchArtifactTags, + project: params.projectName, + category: DATASET_TYPE + }) + ) setSelectedRowData({}) setDatasets([]) - setAllDatasets([]) return fetchData(filters) }, - [fetchData] + [dispatch, fetchData, params.projectName] ) const handleAddTag = useCallback( @@ -205,11 +209,12 @@ const Datasets = () => { if ('tag' in changes.data) { setSelectedRowData({}) setDatasets([]) - setAllDatasets([]) if (changes.data.tag.currentFieldValue) { navigate( - `/projects/${params.projectName}/${DATASETS_PAGE.toLowerCase()}/${params.name}/${changes.data.tag.currentFieldValue}/overview`, + `/projects/${params.projectName}/${DATASETS_PAGE.toLowerCase()}/${params.name}/${ + changes.data.tag.currentFieldValue + }/overview`, { replace: true } ) } @@ -274,7 +279,11 @@ const Datasets = () => { useSortTable({ headers: tableHeaders, content: tableContent, - sortConfig: { excludeSortBy: ['labels', 'size'], defaultSortBy: 'updated', defaultDirection: 'desc' } + sortConfig: { + excludeSortBy: ['labels', 'size'], + defaultSortBy: 'updated', + defaultDirection: 'desc' + } }) useEffect(() => { @@ -284,10 +293,13 @@ const Datasets = () => { }, [location, navigate, pageData.details.menu, params.name, params.tab, params.tag]) useEffect(() => { - if (isNil(filtersStore.tagOptions) && urlTagOption) { - fetchData({ ...datasetsFilters, tag: urlTagOption }) + if (urlTagOption && datasets.length === 0) { + fetchData({ + tag: urlTagOption, + iter: SHOW_ITERATIONS + }) } - }, [datasetsFilters, fetchData, filtersStore, urlTagOption]) + }, [datasets.length, fetchData, urlTagOption]) useEffect(() => { dispatch(setFilters({ groupBy: GROUP_BY_NONE })) @@ -297,7 +309,7 @@ const Datasets = () => { checkForSelectedDataset( params.name, selectedRowData, - allDatasets, + datasets, params.tag, params.iter, params.uid, @@ -306,7 +318,7 @@ const Datasets = () => { navigate ) }, [ - allDatasets, + datasets, navigate, params.iter, params.name, @@ -319,7 +331,6 @@ const Datasets = () => { useEffect(() => { return () => { setDatasets([]) - setAllDatasets([]) dispatch(removeDataSets()) setSelectedDataset({}) abortControllerRef.current.abort(REQUEST_CANCELED) @@ -335,6 +346,8 @@ const Datasets = () => { }) }, [handleRefresh, params, datasetsFilters]) + useEffect(() => setDatasets([]), [filtersStore.tag]) + return ( { const [files, setFiles] = useState([]) - const [allFiles, setAllFiles] = useState([]) const [selectedFile, setSelectedFile] = useState({}) const [selectedRowData, setSelectedRowData] = useState({}) const [largeRequestErrorMessage, setLargeRequestErrorMessage] = useState('') const [convertedYaml, toggleConvertedYaml] = useYaml('') - const [urlTagOption] = useGetTagOptions(null, filters, null, FILES_FILTERS) + const [urlTagOption] = useGetTagOptions( + fetchArtifactTags, + filters, + ARTIFACT_OTHER_TYPE, + FILES_FILTERS + ) const artifactsStore = useSelector(store => store.artifactsStore) const filtersStore = useSelector(store => store.filtersStore) const params = useParams() @@ -107,12 +117,12 @@ const Files = () => { }) ) .unwrap() - .then(filesResponse => { - if (filesResponse) { - setArtifactTags(filesResponse, setFiles, setAllFiles, filters, dispatch, FILES_PAGE) - - return filesResponse + .then(result => { + if (result) { + setFiles(result) } + + return result }) }, [dispatch, params.projectName] @@ -120,13 +130,20 @@ const Files = () => { const handleRefresh = useCallback( filters => { + dispatch( + getFilterTagOptions({ + dispatch, + fetchTags: fetchArtifactTags, + project: params.projectName, + category: ARTIFACT_OTHER_TYPE + }) + ) setSelectedRowData({}) setFiles([]) - setAllFiles([]) return fetchData(filters) }, - [fetchData] + [dispatch, fetchData, params.projectName] ) const handleAddTag = useCallback( @@ -224,7 +241,11 @@ const Files = () => { useSortTable({ headers: tableHeaders, content: tableContent, - sortConfig: { excludeSortBy: ['labels', 'size'], defaultSortBy: 'updated', defaultDirection: 'desc' } + sortConfig: { + excludeSortBy: ['labels', 'size'], + defaultSortBy: 'updated', + defaultDirection: 'desc' + } }) const applyDetailsChanges = useCallback( @@ -244,7 +265,6 @@ const Files = () => { if ('tag' in changes.data) { setSelectedRowData({}) setFiles([]) - setAllFiles([]) if (changes.data.tag.currentFieldValue) { navigate( @@ -264,21 +284,22 @@ const Files = () => { }, [navigate, location, pageData.details.menu, params.name, params.tag, params.tab]) useEffect(() => { - if (isNil(filtersStore.tagOptions) && urlTagOption) { - fetchData({ ...filesFilters, tag: urlTagOption }) + if (urlTagOption) { + fetchData({ tag: urlTagOption, iter: SHOW_ITERATIONS }) } - }, [fetchData, filesFilters, filtersStore, urlTagOption]) + }, [fetchData, urlTagOption]) useEffect(() => { return () => { setFiles([]) - setAllFiles([]) dispatch(removeFiles()) setSelectedFile({}) abortControllerRef.current.abort(REQUEST_CANCELED) } }, [params.projectName, dispatch]) + useEffect(() => setFiles([]), [filtersStore.tag]) + useEffect(() => { dispatch(setFilters({ groupBy: GROUP_BY_NONE })) }, [dispatch, params.projectName]) @@ -287,7 +308,7 @@ const Files = () => { checkForSelectedFile( params.name, selectedRowData, - allFiles, + files, params.tag, params.iter, params.uid, @@ -296,7 +317,7 @@ const Files = () => { setSelectedFile ) }, [ - allFiles, + files, navigate, params.iter, params.name, diff --git a/src/components/Files/FilesView.js b/src/components/Files/FilesView.js index 7cf61d67d9..e970668359 100644 --- a/src/components/Files/FilesView.js +++ b/src/components/Files/FilesView.js @@ -87,6 +87,7 @@ const FilesView = React.forwardRef( onClick: handleRegisterArtifact } ]} + artifacts={files} filterMenuName={FILES_FILTERS} handleRefresh={handleRefresh} page={FILES_PAGE} diff --git a/src/components/ModelsPage/Models/Models.js b/src/components/ModelsPage/Models/Models.js index 5237e731b6..f857be2ff9 100644 --- a/src/components/ModelsPage/Models/Models.js +++ b/src/components/ModelsPage/Models/Models.js @@ -19,7 +19,7 @@ such restriction. */ import React, { useCallback, useEffect, useMemo, useState, useRef } from 'react' import { connect, useDispatch, useSelector } from 'react-redux' -import { isEmpty, isNil } from 'lodash' +import { isEmpty } from 'lodash' import { useLocation, useNavigate, useParams } from 'react-router-dom' import AddArtifactTagPopUp from '../../../elements/AddArtifactTagPopUp/AddArtifactTagPopUp' @@ -29,6 +29,7 @@ import RegisterModelModal from '../../../elements/RegisterModelModal/RegisterMod import JobWizard from '../../JobWizard/JobWizard' import { + fetchArtifactTags, fetchModel, fetchModels, removeModel, @@ -42,7 +43,9 @@ import { FILTER_MENU_MODAL, GROUP_BY_NONE, MODELS_FILTERS, - REQUEST_CANCELED + REQUEST_CANCELED, + MODEL_TYPE, + SHOW_ITERATIONS } from '../../../constants' import { checkForSelectedModel, @@ -59,7 +62,7 @@ import { getArtifactIdentifier } from '../../../utils/getUniqueIdentifier' import { isDetailsTabExists } from '../../../utils/isDetailsTabExists' import { openPopUp } from 'igz-controls/utils/common.util' import { parseChipsData } from '../../../utils/convertChipsData' -import { setFilters } from '../../../reducers/filtersReducer' +import { getFilterTagOptions, setFilters } from '../../../reducers/filtersReducer' import { setNotification } from '../../../reducers/notificationReducer' import { useGroupContent } from '../../../hooks/groupContent.hook' import { useModelsPage } from '../ModelsPage.context' @@ -67,18 +70,16 @@ import { useSortTable } from '../../../hooks/useSortTable.hook' import { useGetTagOptions } from '../../../hooks/useGetTagOptions.hook' import { getViewMode } from '../../../utils/helper' import { useMode } from '../../../hooks/mode.hook' -import { setArtifactTags } from '../../../utils/artifacts.util' const Models = ({ fetchModelFeatureVector }) => { const [models, setModels] = useState([]) - const [allModels, setAllModels] = useState([]) const [largeRequestErrorMessage, setLargeRequestErrorMessage] = useState('') const [selectedModel, setSelectedModel] = useState({}) const [selectedRowData, setSelectedRowData] = useState({}) const [metricsCounter, setMetricsCounter] = useState(0) const [dataIsLoaded, setDataIsLoaded] = useState(false) const [tableHeaders, setTableHeaders] = useState([]) - const [urlTagOption] = useGetTagOptions(null, filters, null, MODELS_FILTERS) + const [urlTagOption] = useGetTagOptions(fetchArtifactTags, filters, MODEL_TYPE, MODELS_FILTERS) const artifactsStore = useSelector(store => store.artifactsStore) const detailsStore = useSelector(store => store.detailsStore) const filtersStore = useSelector(store => store.filtersStore) @@ -128,12 +129,12 @@ const Models = ({ fetchModelFeatureVector }) => { }) ) .unwrap() - .then(modelsResponse => { - if (modelsResponse) { - setArtifactTags(modelsResponse, setModels, setAllModels, filters, dispatch, MODELS_TAB) - - return modelsResponse + .then(result => { + if (result) { + setModels(result) } + + return result }) }, [dispatch, setModels, params.projectName] @@ -145,15 +146,22 @@ const Models = ({ fetchModelFeatureVector }) => { const handleRefresh = useCallback( filters => { + dispatch( + getFilterTagOptions({ + dispatch, + fetchTags: fetchArtifactTags, + project: params.projectName, + category: MODEL_TYPE + }) + ) setSelectedRowData({}) setModels([]) - setAllModels([]) setTableHeaders([]) setDataIsLoaded(false) return fetchData(filters) }, - [fetchData, setAllModels, setModels] + [dispatch, fetchData, params.projectName] ) const handleAddTag = useCallback( @@ -288,7 +296,6 @@ const Models = ({ fetchModelFeatureVector }) => { if ('tag' in changes.data) { setSelectedRowData({}) setModels([]) - setAllModels([]) if (changes.data.tag.currentFieldValue) { navigate( @@ -310,22 +317,24 @@ const Models = ({ fetchModelFeatureVector }) => { }, [navigate, location, pageData.details.menu, params.name, params.tag, params.tab]) useEffect(() => { - if (isNil(filtersStore.tagOptions) && urlTagOption) { - fetchData({ ...modelsFilters, tag: urlTagOption }) + if (urlTagOption) { + fetchData({ + tag: urlTagOption, + iter: SHOW_ITERATIONS + }) } - }, [fetchData, filtersStore, modelsFilters, urlTagOption]) + }, [fetchData, urlTagOption]) useEffect(() => { return () => { setModels([]) - setAllModels([]) dispatch(removeModels()) setSelectedModel({}) setTableHeaders([]) setDataIsLoaded(false) abortControllerRef.current.abort(REQUEST_CANCELED) } - }, [dispatch, params.projectName, setModels, setAllModels]) + }, [dispatch, params.projectName, setModels]) useEffect(() => { dispatch(setFilters({ groupBy: GROUP_BY_NONE })) @@ -335,7 +344,7 @@ const Models = ({ fetchModelFeatureVector }) => { checkForSelectedModel( params.name, selectedRowData, - allModels, + models, params.tag, params.iter, params.uid, @@ -344,7 +353,7 @@ const Models = ({ fetchModelFeatureVector }) => { setSelectedModel ) }, [ - allModels, + models, navigate, params.iter, params.name, @@ -404,6 +413,8 @@ const Models = ({ fetchModelFeatureVector }) => { } }, [dataIsLoaded, models, tableHeaders]) + useEffect(() => setModels([]), [filtersStore.tag]) + const handleRegisterModel = useCallback(() => { openPopUp(RegisterModelModal, { params, diff --git a/src/components/ModelsPage/Models/ModelsView.js b/src/components/ModelsPage/Models/ModelsView.js index 4a60783dea..0383fd4768 100644 --- a/src/components/ModelsPage/Models/ModelsView.js +++ b/src/components/ModelsPage/Models/ModelsView.js @@ -89,6 +89,7 @@ const ModelsView = React.forwardRef( hidden: !isDemoMode } ]} + artifacts={models} filterMenuName={MODELS_FILTERS} handleRefresh={handleRefresh} page={MODELS_PAGE} diff --git a/src/hooks/useGetTagOptions.hook.js b/src/hooks/useGetTagOptions.hook.js index 837c3938ed..ed62d0f213 100644 --- a/src/hooks/useGetTagOptions.hook.js +++ b/src/hooks/useGetTagOptions.hook.js @@ -39,6 +39,8 @@ export const useGetTagOptions = (fetchTags, filters, category, modalFiltersName) ) { if (!paramTag) { setUrlTagOption(TAG_FILTER_LATEST) + } else if (paramTag) { + setUrlTagOption(paramTag) } if (fetchTags) { @@ -54,7 +56,6 @@ export const useGetTagOptions = (fetchTags, filters, category, modalFiltersName) .then(tags => { if (paramTag) { if (tags.find(filterTag => filterTag === paramTag)) { - setUrlTagOption(paramTag) dispatch(setFilters({ paramTag })) modalFiltersName && dispatch( @@ -77,7 +78,6 @@ export const useGetTagOptions = (fetchTags, filters, category, modalFiltersName) } }) } else if (paramTag) { - setUrlTagOption(paramTag) dispatch(setFilters({ paramTag })) modalFiltersName && dispatch( From 1f48c4b05836da21679fb4596b2357a448669020 Mon Sep 17 00:00:00 2001 From: Ilank <63646693+ilan7empest@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:50:13 +0200 Subject: [PATCH 2/2] Fix [Batch Run] Blank project screen after setting model target path `1.6.x` (#2227) --- src/common/TargetPath/targetPath.util.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/TargetPath/targetPath.util.js b/src/common/TargetPath/targetPath.util.js index 5bf49c2d79..686d141615 100644 --- a/src/common/TargetPath/targetPath.util.js +++ b/src/common/TargetPath/targetPath.util.js @@ -304,9 +304,9 @@ export const generateArtifactsReferencesList = artifacts => { const [nextRefIter, nextRefTree] = nextRef.id.split('@') if (prevRefTree === nextRefTree) { - return prevRefIter.localeCompare(nextRefIter) + return prevRefIter && prevRefIter.localeCompare(nextRefIter) } else { - return prevRefTree.localeCompare(nextRefTree) + return prevRefTree && prevRefTree.localeCompare(nextRefTree) } })