diff --git a/src/App.js b/src/App.js index 70955ed..2d0493f 100644 --- a/src/App.js +++ b/src/App.js @@ -4,7 +4,7 @@ import React, {useState,useEffect,useReducer} from 'react'; import Toggle from 'react-toggle' //Tooltip props: http://aaronshaf.github.io/react-toggle/ import Helmet from 'react-helmet' -import {XSquareFill, PlusCircle, LifePreserver, Server, CloudUploadFill} from 'react-bootstrap-icons' +import {TrashFill, XSquareFill, PlusCircle, LifePreserver, Server, CloudUploadFill} from 'react-bootstrap-icons' import { SkillTreeEditor } from './skilltree/skillTreeEditor' @@ -143,6 +143,26 @@ function TableEditor(p) { }) } } + + function SubmitDeletion() { + if (!lockSubmission) { + setLockSubmission(true) + var promises = [] + for (var dat of data) { + if (document.getElementById("delete_"+dat.id).checked) { + promises.push(axios.delete(p.BACKENDURL+p.path,{data:{pass:p.password,id:dat.id}})) + } + } + Promise.allSettled(promises) + .catch((err)=>{ + alert(err.message) + }) + .then((data)=>{ + setLockSubmission(false) + setUpdate(true) + }) + } + } useEffect(()=>{ setUpdate(true) @@ -216,7 +236,7 @@ function TableEditor(p) { }} style={{opacity:0}} id="uploads" type="file" accept=".txt,.csv"/>} - + {SubmitDeletion()}} className="trashButton"/> {fields.map((field,i)=>{field.name})} @@ -224,7 +244,7 @@ function TableEditor(p) { {{fields.map((col,i)=>{{setSubmitVal({field:col.name,value:f});}}/>})}{SubmitBoxes()}} className="submitbutton"/>} {data.map((dat)=> - {axios.delete(p.BACKENDURL+p.path,{data:{id:dat.id,pass:p.password}}).then(()=>{setUpdate(true)}).catch((err)=>{alert(err.response.data)})}}/>{fields.map((col,i)=> + {fields.map((col,i)=> patchValue(value,p,col,dat)} callback2={(f,value)=>{if (f.key==='Enter') {f.currentTarget.blur()} else {return 'Chill'}}} value={String(dat[col.name])}/>)})} diff --git a/src/style.css b/src/style.css index fe4a98a..6c7e12e 100644 --- a/src/style.css +++ b/src/style.css @@ -1399,3 +1399,12 @@ dd:before { font-family: "Segoe UI Symbol"; content: "\2B1B" !important; } +.trashButton{ + color:rgba(100,50,50,1); + width:24px; + height:24px; +} +.trashButton:hover { + color:rgba(200,50,50,1); + border: 2px solid red; +} \ No newline at end of file