Skip to content

Commit

Permalink
#48 delete file from database
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcellino-Palerme committed Jun 23, 2024
1 parent 590afa8 commit d50abde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions components/DaughterTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ const headers = ref([
{ title: t('nameMeta'), sortable:true, key: 'nameMeta' },
{ title: t('area'), sortable:true, key: 'area' },
{ title: t('expectedArea'), sortable:true, key: 'expectedArea' },
{ title: t('delete'), key: 'del' },
]);
// -- group by daughter solution
const groupBy = ref([{ title: t('nameFile'), sortable:true, key: 'nameFile' }]);
const groupBy = ref([{ sortable:true, key: 'idFile' }]);


/**
* Delete a daughter file
* @param nameFile name of the daughter file to delete
*/
function delDaughterFile(nameFile: string) {
model.value = model.value.filter((item) => item.nameFile !== nameFile);
function delDaughterFile(idFile: string) {
model.value = model.value.filter((item) => item.idFile !== idFile);
$fetch('/api/delFile', {
method: 'POST',
body: [idFile],
});
}

</script>
Expand All @@ -60,7 +63,8 @@ function delDaughterFile(nameFile: string) {
variant="text"
@click="toggleGroup(item)"
/>
{{ item.value }}
<!-- show name file about ifFile -->
{{ item.items[0].raw.nameFile }}
<!-- button to delete the group -->
<v-icon @click="delDaughterFile(item.value)">
mdi-delete
Expand Down
2 changes: 1 addition & 1 deletion components/ManageSerie.async.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function sendFile() {
// Update table of metabolites of the serie
rDaughterTable.value.push(
...result[1].map((r: [string, number]) => ({
id: result[0],
idFile: result[0],
nameFile: daughterFile.value.name,
nameMeta: r[0],
area: r[1],
Expand Down

0 comments on commit d50abde

Please sign in to comment.