From c6716633bc50eaae18727d8f11ce04034e294dda Mon Sep 17 00:00:00 2001
From: illia-prokopchuk <78905712+illia-prokopchuk@users.noreply.github.com>
Date: Thu, 20 Jun 2024 15:41:40 +0300
Subject: [PATCH] Impl [UI] Limit number of artifacts shown in the artifact
screen `1.6.x` (#2541)
---
src/common/WarningMessage/WarningMessage.js | 55 +++++++++++++++++++
src/common/WarningMessage/warningMessage.scss | 29 ++++++++++
src/components/Datasets/Datasets.js | 4 ++
src/components/Datasets/DatasetsView.js | 20 ++++---
src/components/Files/Files.js | 4 ++
src/components/Files/FilesView.js | 20 ++++---
src/components/ModelsPage/Models/Models.js | 4 ++
.../ModelsPage/Models/ModelsView.js | 27 +++++----
8 files changed, 138 insertions(+), 25 deletions(-)
create mode 100644 src/common/WarningMessage/WarningMessage.js
create mode 100644 src/common/WarningMessage/warningMessage.scss
diff --git a/src/common/WarningMessage/WarningMessage.js b/src/common/WarningMessage/WarningMessage.js
new file mode 100644
index 000000000..d52a91908
--- /dev/null
+++ b/src/common/WarningMessage/WarningMessage.js
@@ -0,0 +1,55 @@
+/*
+Copyright 2019 Iguazio Systems Ltd.
+
+Licensed under the Apache License, Version 2.0 (the "License") with
+an addition restriction as set forth herein. You may not use this
+file except in compliance with the License. You may obtain a copy of
+the License at http://www.apache.org/licenses/LICENSE-2.0.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied. See the License for the specific language governing
+permissions and limitations under the License.
+
+In addition, you may not use the software for any purposes that are
+illegal under applicable law, and the grant of the foregoing license
+under the Apache 2.0 license is conditioned upon your compliance with
+such restriction.
+*/
+import React from 'react'
+import PropTypes from 'prop-types'
+
+import { Tooltip, TextTooltipTemplate } from 'igz-controls/components'
+
+import { ReactComponent as UnsuccessAlert } from 'igz-controls/images/unsuccess_alert.svg'
+import { ReactComponent as Close } from 'igz-controls/images/close.svg'
+
+import './warningMessage.scss'
+
+const WarningMessage = ({ handleClose = null, message }) => {
+ return (
+
+
+ {handleClose && (
+
+ }>
+
+
+
+ )}
+
+ )
+}
+
+WarningMessage.propTypes = {
+ handleClose: PropTypes.func,
+ message: PropTypes.string.isRequired
+}
+
+export default WarningMessage
diff --git a/src/common/WarningMessage/warningMessage.scss b/src/common/WarningMessage/warningMessage.scss
new file mode 100644
index 000000000..820be91a8
--- /dev/null
+++ b/src/common/WarningMessage/warningMessage.scss
@@ -0,0 +1,29 @@
+@import '~igz-controls/scss/borders';
+
+.warning {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 10px;
+ padding: 10px 14px;
+ color: $sorbus;
+ background-color: rgba($sorbus, 0.1);
+ border: $parametersBorder;
+
+ &__data {
+ display: flex;
+ align-items: center;
+ }
+
+ &__message {
+ margin-right: 10px;
+ }
+
+ &__icon {
+ width: 22px;
+ height: 22px;
+ margin-right: 10px;
+ padding: 5px;
+ background-color: $sorbus;
+ border-radius: 50%;
+ }
+}
diff --git a/src/components/Datasets/Datasets.js b/src/components/Datasets/Datasets.js
index f40f0a920..f973df730 100644
--- a/src/components/Datasets/Datasets.js
+++ b/src/components/Datasets/Datasets.js
@@ -69,6 +69,7 @@ const Datasets = () => {
const [selectedDataset, setSelectedDataset] = useState({})
const [selectedRowData, setSelectedRowData] = useState({})
const [largeRequestErrorMessage, setLargeRequestErrorMessage] = useState('')
+ const [maxArtifactsErrorIsShown, setMaxArtifactsErrorIsShown] = useState(false)
const [convertedYaml, toggleConvertedYaml] = useYaml('')
const [urlTagOption] = useGetTagOptions(
fetchArtifactTags,
@@ -125,6 +126,7 @@ const Datasets = () => {
.then(result => {
if (result) {
setDatasets(result)
+ setMaxArtifactsErrorIsShown(result.length === 1000)
}
return result
@@ -362,11 +364,13 @@ const Datasets = () => {
handleRefresh={handleRefresh}
handleRegisterDataset={handleRegisterDataset}
largeRequestErrorMessage={largeRequestErrorMessage}
+ maxArtifactsErrorIsShown={maxArtifactsErrorIsShown}
pageData={pageData}
ref={datasetsRef}
selectedDataset={selectedDataset}
selectedRowData={selectedRowData}
setDatasets={setDatasets}
+ setMaxArtifactsErrorIsShown={setMaxArtifactsErrorIsShown}
setSelectedDataset={setSelectedDataset}
setSelectedRowData={setSelectedRowData}
sortProps={{ sortTable, selectedColumnName, getSortingIcon }}
diff --git a/src/components/Datasets/DatasetsView.js b/src/components/Datasets/DatasetsView.js
index a8ae13a23..769139b75 100644
--- a/src/components/Datasets/DatasetsView.js
+++ b/src/components/Datasets/DatasetsView.js
@@ -29,6 +29,7 @@ import Loader from '../../common/Loader/Loader'
import ArtifactsActionBar from '../ArtifactsActionBar/ArtifactsActionBar'
import NoData from '../../common/NoData/NoData'
import Details from '../Details/Details'
+import WarningMessage from '../../common/WarningMessage/WarningMessage'
import { DATASETS_FILTERS, DATASETS_PAGE, FULL_VIEW_MODE } from '../../constants'
import { getNoDataMessage } from '../../utils/getNoDataMessage'
@@ -53,18 +54,20 @@ const DatasetsView = React.forwardRef(
handleRefresh,
handleRegisterDataset,
largeRequestErrorMessage,
+ maxArtifactsErrorIsShown,
pageData,
selectedDataset,
selectedRowData,
setDatasets,
+ setMaxArtifactsErrorIsShown,
setSelectedDataset,
setSelectedRowData,
sortProps,
tableContent,
tableHeaders,
toggleConvertedYaml,
- urlTagOption,
- viewMode
+ urlTagOption = null,
+ viewMode = null
},
ref
) => {
@@ -111,6 +114,12 @@ const DatasetsView = React.forwardRef(
) : (
<>
{selectedRowData.loading && }
+ {maxArtifactsErrorIsShown && (
+ setMaxArtifactsErrorIsShown(false)}
+ />
+ )}
{
const [selectedFile, setSelectedFile] = useState({})
const [selectedRowData, setSelectedRowData] = useState({})
const [largeRequestErrorMessage, setLargeRequestErrorMessage] = useState('')
+ const [maxArtifactsErrorIsShown, setMaxArtifactsErrorIsShown] = useState(false)
const [convertedYaml, toggleConvertedYaml] = useYaml('')
const [urlTagOption] = useGetTagOptions(
fetchArtifactTags,
@@ -120,6 +121,7 @@ const Files = () => {
.then(result => {
if (result) {
setFiles(result)
+ setMaxArtifactsErrorIsShown(result.length === 1000)
}
return result
@@ -350,10 +352,12 @@ const Files = () => {
handleRefresh={handleRefresh}
handleRegisterArtifact={handleRegisterArtifact}
largeRequestErrorMessage={largeRequestErrorMessage}
+ maxArtifactsErrorIsShown={maxArtifactsErrorIsShown}
pageData={pageData}
ref={filesRef}
selectedFile={selectedFile}
selectedRowData={selectedRowData}
+ setMaxArtifactsErrorIsShown={setMaxArtifactsErrorIsShown}
setFiles={setFiles}
setSelectedFile={setSelectedFile}
setSelectedRowData={setSelectedRowData}
diff --git a/src/components/Files/FilesView.js b/src/components/Files/FilesView.js
index e97066835..004c481f8 100644
--- a/src/components/Files/FilesView.js
+++ b/src/components/Files/FilesView.js
@@ -29,6 +29,7 @@ import Loader from '../../common/Loader/Loader'
import PreviewModal from '../../elements/PreviewModal/PreviewModal'
import ArtifactsTableRow from '../../elements/ArtifactsTableRow/ArtifactsTableRow'
import Details from '../Details/Details'
+import WarningMessage from '../../common/WarningMessage/WarningMessage'
import { FILES_FILTERS, FILES_PAGE, FULL_VIEW_MODE } from '../../constants'
import { getNoDataMessage } from '../../utils/getNoDataMessage'
@@ -53,9 +54,11 @@ const FilesView = React.forwardRef(
handleRefresh,
handleRegisterArtifact,
largeRequestErrorMessage,
+ maxArtifactsErrorIsShown,
pageData,
selectedFile,
selectedRowData,
+ setMaxArtifactsErrorIsShown,
setFiles,
setSelectedFile,
setSelectedRowData,
@@ -63,8 +66,8 @@ const FilesView = React.forwardRef(
tableContent,
tableHeaders,
toggleConvertedYaml,
- urlTagOption,
- viewMode
+ urlTagOption = null,
+ viewMode = null
},
ref
) => {
@@ -111,6 +114,12 @@ const FilesView = React.forwardRef(
) : (
<>
{selectedRowData.loading && }
+ {maxArtifactsErrorIsShown && (
+ setMaxArtifactsErrorIsShown(false)}
+ />
+ )}
{
const [models, setModels] = useState([])
const [largeRequestErrorMessage, setLargeRequestErrorMessage] = useState('')
+ const [maxArtifactsErrorIsShown, setMaxArtifactsErrorIsShown] = useState(false)
const [selectedModel, setSelectedModel] = useState({})
const [selectedRowData, setSelectedRowData] = useState({})
//temporarily commented till ML-5606 will be done
@@ -136,6 +137,7 @@ const Models = ({ fetchModelFeatureVector }) => {
.then(result => {
if (result) {
setModels(result)
+ setMaxArtifactsErrorIsShown(result.length === 1000)
}
return result
@@ -462,11 +464,13 @@ const Models = ({ fetchModelFeatureVector }) => {
handleTrainModel={handleTrainModel}
isDemoMode={isDemoMode}
largeRequestErrorMessage={largeRequestErrorMessage}
+ maxArtifactsErrorIsShown={maxArtifactsErrorIsShown}
models={models}
pageData={pageData}
ref={modelsRef}
selectedModel={selectedModel}
selectedRowData={selectedRowData}
+ setMaxArtifactsErrorIsShown={setMaxArtifactsErrorIsShown}
setModels={setModels}
setSelectedModel={setSelectedModel}
setSelectedRowData={setSelectedRowData}
diff --git a/src/components/ModelsPage/Models/ModelsView.js b/src/components/ModelsPage/Models/ModelsView.js
index 0383fd476..c81fb53c1 100644
--- a/src/components/ModelsPage/Models/ModelsView.js
+++ b/src/components/ModelsPage/Models/ModelsView.js
@@ -27,6 +27,7 @@ import ModelsPageTabs from '../ModelsPageTabs/ModelsPageTabs'
import NoData from '../../../common/NoData/NoData'
import Table from '../../Table/Table'
import Details from '../../Details/Details'
+import WarningMessage from '../../../common/WarningMessage/WarningMessage'
import { FULL_VIEW_MODE, MODELS_FILTERS, MODELS_PAGE, MODELS_TAB } from '../../../constants'
import { SORT_PROPS } from 'igz-controls/types'
@@ -51,18 +52,20 @@ const ModelsView = React.forwardRef(
handleTrainModel,
isDemoMode,
largeRequestErrorMessage,
+ maxArtifactsErrorIsShown,
models,
pageData,
selectedModel,
selectedRowData,
+ setMaxArtifactsErrorIsShown,
setModels,
setSelectedModel,
setSelectedRowData,
- sortProps,
+ sortProps = null,
tableContent,
tableHeaders,
- viewMode,
- urlTagOption
+ urlTagOption = null,
+ viewMode = null
},
ref
) => {
@@ -114,6 +117,12 @@ const ModelsView = React.forwardRef(
) : (
<>
{selectedRowData.loading && }
+ {maxArtifactsErrorIsShown && (
+ setMaxArtifactsErrorIsShown(false)}
+ />
+ )}