-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
…objectStore
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,19 +37,14 @@ const confirmDelete = () => { | |
const msgContext = props.ids.length > 1 ? `the selected ${props.ids.length} ${item}s` : `this ${item}`; | ||
confirm.require({ | ||
message: `Please confirm that you want to delete ${msgContext}.`, | ||
header: `Delete ${props.ids.length > 1 ? item + 's' : item }`, | ||
header: `Delete ${props.ids.length > 1 ? item + 's' : item}`, | ||
acceptLabel: 'Confirm', | ||
rejectLabel: 'Cancel', | ||
accept: async () => { | ||
try { | ||
const res = await objectStore.deleteObjects(props.ids, props.versionId); | ||
res?.forEach((ele, index)=>{ | ||
if (ele.status === 'fulfilled') { | ||
emit('on-deleted-success', props.ids[index]); | ||
} else { | ||
toast.error(`Error deleting ${props.ids[index]}`); | ||
emit('on-deleted-error'); | ||
} | ||
props.ids?.forEach(async (ele) => { | ||
const res = await objectStore.deleteObjects([ele], props.versionId); | ||
if (res) emit('on-deleted-success', props.versionId); | ||
}); | ||
} catch (error: any) { | ||
toast.error(`Error deleting one or more ${item}s`); | ||
|
@@ -64,38 +59,18 @@ const confirmDelete = () => { | |
</script> | ||
|
||
<template> | ||
<Dialog | ||
v-model:visible="displayNoFileDialog" | ||
header="No File Selected" | ||
:modal="true" | ||
> | ||
<Dialog v-model:visible="displayNoFileDialog" header="No File Selected" :modal="true"> | ||
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 62 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
<p>Please select at least one file from the list to delete.</p> | ||
<template #footer> | ||
<Button | ||
label="Ok" | ||
autofocus | ||
@click="displayNoFileDialog = false" | ||
/> | ||
<Button label="Ok" autofocus @click="displayNoFileDialog = false" /> | ||
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 65 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
</template> | ||
</Dialog> | ||
|
||
<Button | ||
v-if="props.mode === ButtonMode.ICON" | ||
class="p-button-lg p-button-text p-button-danger" | ||
:disabled="props.disabled" | ||
@click="confirmDelete()" | ||
> | ||
<Button v-if="props.mode === ButtonMode.ICON" class="p-button-lg p-button-text p-button-danger" | ||
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 69 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
:disabled="props.disabled" @click="confirmDelete()"> | ||
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 70 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
<font-awesome-icon icon="fa-solid fa-trash" /> | ||
</Button> | ||
<Button | ||
v-else | ||
class="p-button-outlined p-button-danger" | ||
:disabled="props.disabled" | ||
@click="confirmDelete()" | ||
> | ||
<font-awesome-icon | ||
icon="fa-solid fa-trash" | ||
class="mr-1" | ||
/> Delete | ||
<Button v-else class="p-button-outlined p-button-danger" :disabled="props.disabled" @click="confirmDelete()"> | ||
Check warning on line 73 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 73 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 73 in frontend/src/components/object/DeleteObjectButton.vue GitHub Actions / Unit Tests (Frontend) (16.x)
|
||
<font-awesome-icon icon="fa-solid fa-trash" class="mr-1" /> Delete | ||
</Button> | ||
</template> |