From 1a684b1c4279c9e6acf13a6b5ab9cff190db0c37 Mon Sep 17 00:00:00 2001 From: illia prokopchuk Date: Mon, 7 Oct 2024 12:28:05 +0300 Subject: [PATCH] Fix [UI] "add a tag" UI should not check uniqueness but rather update the existing tag --- package.json | 1 - .../AddArtifactTagPopUp.js | 110 ++++++++++-------- 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index c6760c1f6..524180351 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "final-form-arrays": "^3.1.0", "fs-extra": "^10.0.0", "identity-obj-proxy": "^3.0.0", - "iguazio.dashboard-react-controls": "2.2.1", "is-wsl": "^1.1.0", "js-base64": "^2.5.2", "js-yaml": "^4.1.0", diff --git a/src/elements/AddArtifactTagPopUp/AddArtifactTagPopUp.js b/src/elements/AddArtifactTagPopUp/AddArtifactTagPopUp.js index 13248bcb9..f7a640eb5 100644 --- a/src/elements/AddArtifactTagPopUp/AddArtifactTagPopUp.js +++ b/src/elements/AddArtifactTagPopUp/AddArtifactTagPopUp.js @@ -25,10 +25,11 @@ import { Form } from 'react-final-form' import { createForm } from 'final-form' import { Button, FormInput, Modal } from 'igz-controls/components' +import Loader from '../../common/Loader/Loader' import { DATASET_TYPE, MODEL_TYPE } from '../../constants' import { SECONDARY_BUTTON, TERTIARY_BUTTON } from 'igz-controls/constants' -import { addTag } from '../../reducers/artifactsReducer' +import { addTag, fetchArtifacts } from '../../reducers/artifactsReducer' import { getValidationRules } from 'igz-controls/utils/validation.util' import { setNotification } from '../../reducers/notificationReducer' import { showErrorNotification } from '../../utils/notifications.util' @@ -37,7 +38,6 @@ import { isSubmitDisabled } from 'igz-controls/utils/form.util' const AddArtifactTagPopUp = ({ artifact, - getArtifact, isOpen, onAddTag = () => {}, onResolve, @@ -47,7 +47,8 @@ const AddArtifactTagPopUp = ({ const [initialValues] = useState({ artifactTag: '' }) - const [existingTags, setExistingTags] = useState([]) + const [artifactTags, setArtifactTags] = useState([]) + const [isLoading, setIsLoading] = useState(true) const formRef = React.useRef( createForm({ @@ -58,16 +59,6 @@ const AddArtifactTagPopUp = ({ const location = useLocation() const { handleCloseModal, resolveModal } = useModalBlockHistory(onResolve, formRef.current) - useEffect(() => { - getArtifact && - dispatch(getArtifact()) - .unwrap() - .then(results => { - const tags = results.filter(result => result.tag).map(result => result.tag) - setExistingTags(tags) - }) - }, [dispatch, getArtifact]) - const addArtifactTag = values => { const identifier = { key: artifact.db_key || artifact.key, @@ -127,44 +118,72 @@ const AddArtifactTagPopUp = ({ return actions.map(action =>