Skip to content

Commit

Permalink
#3 delete one file
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcellino-Palerme committed Nov 7, 2023
1 parent cd3eaca commit 84a7227
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions components/ExtractInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,17 @@ async function getFiles(evt:Event | null):Promise<void>{
}

function deleteAll(){
console.log("plou");

files.splice(0, files.length)
}

console.log("next");

function deleteRow(id:string){
// get index of row
const index = files.findIndex((file) => file.id == id);

// Delete the row
if (index != undefined){
files.splice(index,1);
}
}

async function extract() {
Expand Down Expand Up @@ -180,14 +185,15 @@ defineExpose({
:loading-state="{ icon: 'i-heroicons-arrow-path-20-solid',
label: labLoading }">
<!-- TODO manage case unknow type -->
<template #delete-data>
<template #delete-data="{row}">
<UButton :title="labDeleteRow" icon="i-heroicons-x-mark"
size="xl" color="red" variant="ghost" />
size="xl" color="red" variant="ghost"
@click="deleteRow(row.id)" />
</template>
</UTable>

</UContainer>
<UContainer>
<UContainer v-if="files.length">
<UButton class="extractButton float-right block sizeAlone"
@click="extract()">
{{ labExtract }}
Expand Down

0 comments on commit 84a7227

Please sign in to comment.