I'm trying to make a simple log viewer for a personal project.
Basically I have a log file that looks like this:
D16,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D17,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D18,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D19,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D20,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D21,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D22,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D23,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
D24,2020-10-11T17:13:00.507897,2020-10-11T17:13:00.701859,0:00:00.193976
The first thing is the ID such as D16, D17.
So when you load a log file it creates a object that looks like this:
{
D15: [array of information],
D16: [array of information],
D17: [array of information],
}
And in the UI you see this: ID viewer in ui
The ids are draggable and are meant to be dragged in to a container that looks like this:
And on release of the id it should show the information from the object I created earlier.
What I have working now is when on release I can get the ID and which element it was dropped on.
I don't know how I would add the information to this element.
My functions:
StartDrag:
startDrag(evt, id){
evt.dataTransfer.dropEffect = 'move'
evt.dataTransfer.effectAllowed = 'move'
evt.dataTransfer.setData('logId', id)
},
onDrop:
onDrop(evt) {
const logId = evt.dataTransfer.getData('logId')
console.log(evt.srcElement.classList.add(logId))
console.log(logId)
},