Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl [Artifacts] Delete artifact without a tag #2607

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/api/artifacts-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ const fetchArtifacts = (project, filters, config = {}, withLatestTag) => {
const artifactsApi = {
addTag: (project, tag, data) => mainHttpClient.put(`/projects/${project}/tags/${tag}`, data),
buildFunction: data => mainHttpClient.post('/build/function', data),
deleteArtifact: (project, key, tag, tree, deletion_strategy, secrets) => {
deleteArtifact: (project, key, uid, deletion_strategy, secrets) => {
const config = {
params: {
tag,
tree
'object-uid': uid
}
}

Expand Down
10 changes: 2 additions & 8 deletions src/components/Datasets/datasets.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,7 @@ export const generateActionsMenu = (
{
label: 'Delete',
icon: <Delete />,
disabled: !datasetMin?.tag,
hidden: [ACTION_MENU_PARENT_ROW, ACTION_MENU_PARENT_ROW_EXPANDED].includes(menuPosition),
tooltip: !datasetMin?.tag
? 'A tag is required to delete a dataset. Open the dataset, click on the edit icon, and assign a tag before proceeding with the deletion'
: '',
className: 'danger',
onClick: () =>
datasetDataCouldBeDeleted ?
Expand All @@ -329,8 +325,7 @@ export const generateActionsMenu = (
dispatch,
projectName,
datasetMin.db_key,
datasetMin.tag,
datasetMin.tree,
datasetMin.uid,
handleRefresh,
datasetsFilters,
DATASET_TYPE
Expand All @@ -352,8 +347,7 @@ export const generateActionsMenu = (
dispatch,
projectName,
datasetMin.db_key,
datasetMin.tag,
datasetMin.tree,
datasetMin.uid,
handleRefresh,
datasetsFilters,
DATASET_TYPE,
Expand Down
7 changes: 1 addition & 6 deletions src/components/Files/files.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@ export const generateActionsMenu = (
label: 'Delete',
icon: <Delete />,
hidden: [ACTION_MENU_PARENT_ROW, ACTION_MENU_PARENT_ROW_EXPANDED].includes(menuPosition),
disabled: !fileMin?.tag,
tooltip: !fileMin?.tag
? 'A tag is required to delete an artifact. Open the artifact, click on the edit icon, and assign a tag before proceeding with the deletion'
: '',
className: 'danger',
onClick: () =>
openPopUp(DeleteArtifactPopUp, {
Expand All @@ -307,8 +303,7 @@ export const generateActionsMenu = (
dispatch,
projectName,
fileMin.db_key,
fileMin.tag,
fileMin.tree,
fileMin.uid,
handleRefresh,
filters,
ARTIFACT_TYPE,
Expand Down
10 changes: 2 additions & 8 deletions src/components/ModelsPage/Models/models.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,7 @@ export const generateActionsMenu = (
label: 'Delete',
icon: <Delete />,
className: 'danger',
disabled: !modelMin?.tag,
hidden: [ACTION_MENU_PARENT_ROW, ACTION_MENU_PARENT_ROW_EXPANDED].includes(menuPosition),
tooltip: !modelMin?.tag
? 'A tag is required to delete a model. Open the model, click on the edit icon, and assign a tag before proceeding with the deletion'
: '',
onClick: () =>
openDeleteConfirmPopUp(
'Delete model?',
Expand All @@ -377,8 +373,7 @@ export const generateActionsMenu = (
dispatch,
projectName,
modelMin.db_key,
modelMin.tag,
modelMin.tree,
modelMin.uid,
handleRefresh,
modelsFilters,
MODEL_TYPE
Expand All @@ -400,8 +395,7 @@ export const generateActionsMenu = (
dispatch,
projectName,
modelMin.db_key,
modelMin.tag,
modelMin.tree,
modelMin.uid,
handleRefresh,
modelsFilters,
MODEL_TYPE,
Expand Down
6 changes: 2 additions & 4 deletions src/elements/DeleteArtifactPopUp/DeleteArtifactPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ const DeleteArtifactPopUp = ({ artifact, artifactType, category, filters, handle
dispatch,
params.projectName,
artifact.db_key,
artifact.tag,
artifact.tree,
artifact.uid,
handleRefresh,
filters,
artifactType,
Expand All @@ -88,8 +87,7 @@ const DeleteArtifactPopUp = ({ artifact, artifactType, category, filters, handle
})
}, [
artifact.db_key,
artifact.tag,
artifact.tree,
artifact.uid,
artifactType,
category,
dispatch,
Expand Down
4 changes: 2 additions & 2 deletions src/reducers/artifactsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export const buildFunction = createAsyncThunk('buildFunction', ({ funcData }) =>
})
export const deleteArtifact = createAsyncThunk(
'deleteArtifact',
({ project, key, tag, tree, deletion_strategy, secrets }) => {
return artifactsApi.deleteArtifact(project, key, tag, tree, deletion_strategy, secrets)
({ project, key, uid, deletion_strategy, secrets }) => {
return artifactsApi.deleteArtifact(project, key, uid, deletion_strategy, secrets)
}
)
export const deleteArtifacts = createAsyncThunk(
Expand Down
3 changes: 0 additions & 3 deletions src/utils/getUniqueIdentifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ export const getArtifactIdentifier = (artifact, unique) => {
}

if (unique) {
if (artifact?.tag) identifier += `.${artifact.tag}`
if (artifact?.tree) identifier += `.${artifact.tree}`
if (!isNaN(artifact?.iter)) identifier += `.${artifact.iter}`
if (artifact?.uid) identifier += `.${artifact.uid}`
if (artifact?.metadata?.uid) identifier += `.${artifact.metadata.uid}`
}
Expand Down
8 changes: 3 additions & 5 deletions src/utils/handleDeleteArtifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export const handleDeleteArtifact = (
dispatch,
project,
key,
tag,
tree,
uid,
refreshArtifacts,
filters,
artifactType,
Expand All @@ -40,7 +39,7 @@ export const handleDeleteArtifact = (
return dispatch(
isDeleteAll
? deleteArtifacts({ project, name: key, category })
: deleteArtifact({ project, key, tag, tree, deletion_strategy, secrets })
: deleteArtifact({ project, key, uid, deletion_strategy, secrets })
)
.unwrap()
.then(() => {
Expand All @@ -59,8 +58,7 @@ export const handleDeleteArtifact = (
dispatch,
project,
key,
tag,
tree,
uid,
refreshArtifacts,
filters,
artifactType,
Expand Down
Loading
Loading