deletion button api modification

This commit is contained in:
sumedh
2024-10-04 20:32:57 +05:30
parent 28d4ac1184
commit bda76abaf9

View File

@@ -31,7 +31,7 @@ const fectchDetails = async () => {
} }
} }
const ingesttext = (textDetails) => { const deleteRecords = (textDetails) => {
confirm.require({ confirm.require({
target: event.currentTarget, target: event.currentTarget,
message: "Do you want to Proceed?", message: "Do you want to Proceed?",
@@ -42,19 +42,19 @@ const ingesttext = (textDetails) => {
outlined: true outlined: true
}, },
acceptProps: { acceptProps: {
label: 'Ingest Record', label: 'Delete Records',
severity: 'danger', severity: 'danger',
}, },
accept: () => { accept: () => {
axios.get(`/ingest_texts/${textDetails.id}`) axios.delete(`/deleteTextRecords/${textDetails.id}`)
.then((response) => { .then((response) => {
toast.add({ severity: 'success', summary: 'Ingestion Summary', detail: 'Ingestion Done', life: 6000 }); toast.add({ severity: 'success', summary: 'Ingestion Summary', detail: 'Deletion IN Progress', life: 6000 });
console.log("inhgestion info: ", response.data) console.log("Deletion info: ", response.data)
}) })
.catch((error) => { .catch((error) => {
console.error('Error while ingestion', error) console.error('Error while ingestion', error)
toast.add({ severity: 'error', summary: 'Error Summary', detail: 'Ingestion Failed', life: 6000 }); toast.add({ severity: 'error', summary: 'Error Summary', detail: 'Deletion Failed', life: 6000 });
}) })
}, },
reject: () => { reject: () => {
@@ -111,15 +111,10 @@ function formatDate(dateString) {
{{ formatDate(data.ingestionDate) }} {{ formatDate(data.ingestionDate) }}
</template> </template>
</Column> </Column>
<Column field="ingestionStatus" header="ingestionStatus">
<template #body="{ data }">
{{ data.ingestionStatus }}
</template>
</Column>
<Column :exportable="false" style="min-width: 12rem"> <Column :exportable="false" style="min-width: 12rem">
<template #body="slotProps"> <template #body="slotProps">
<Button text raised rounded severity="info" type="button" class="mr-2" icon="pi pi-play" <Button text raised rounded severity="info" type="button" class="mr-2" icon="pi pi-trash"
@click="ingesttext(slotProps.data)" v-tooltip.top="'Start Ingestion of text'"> @click="deleteRecords(slotProps.data)" v-tooltip.top="'Delete the records'">
</Button> </Button>
</template> </template>
</Column> </Column>