Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Fix agents overflow, drop handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Nilsen84 committed Aug 9, 2023
1 parent 790464f commit 763482d
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions gui/src/pages/Agents.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import trash from '../assets/trash.svg'
import { config } from '../config'
import {config} from '../config'
function addAgent(file) {
if($config.agents.some(a => a.path == file.path)) {
if ($config.agents.some(a => a.path == file.path)) {
return
}
Expand All @@ -21,25 +21,41 @@
}
</script>

<div class="flex flex-col items-stretch">
<div class="h-[52px] bg-white flex items-center text-lg relative px-2">
<div class="flex flex-col items-stretch h-full">
<div class="h-[52px] flex-shrink-0 bg-white flex items-center text-lg relative px-2">
<div class="flex-1">
<label
class="border-2 border-black rounded-md w-9 h-9 text-4xl flex justify-center border-opacity-70 cursor-pointer"
on:change={e => {
addAgent(e.target.files[0])
e.target.value = ''
<label class="border-2 border-black rounded-md w-9 h-9 text-4xl flex justify-center border-opacity-70 cursor-pointer">
<input
type="file"
class="hidden"
accept=".jar"
multiple="multiple"
on:change={e => {
for (const file of e.target.files) {
addAgent(file)
}
e.target.value = ''
}}
>
<input type="file" class="hidden" accept=".jar">
>
<span class="absolute top-1 font-light opacity-80">+</span>
</label>
</div>
Java Premain Agents
<div class="flex-1"></div>
</div>

<div class="flex flex-col p-4 gap-2">
<div
class="flex flex-col p-4 gap-2 overflow-y-scroll flex-grow"
on:dragover|preventDefault
on:drop|preventDefault={e => {
for(const file of e.dataTransfer.files) {
if(file.name.endsWith('.jar')) {
addAgent(file)
}
}
window.dispatchEvent(new Event('change'))
}}
>
{#each $config.agents as agent, i (agent.path)}
<div class="flex items-center bg-white px-2 w-full h-10 rounded-lg agent">
<input tabindex="-1" type="checkbox" class="scale-[115%]" bind:checked={agent.enabled}>
Expand Down

0 comments on commit 763482d

Please sign in to comment.