package components
import "git.src.quest/~liljamo/emerwen-proto/go/proto/shared"
import "fmt"
func getMethodString(target *shared.Target) string {
switch target.Method.(type) {
case *shared.Target_Ping:
return "Ping"
case *shared.Target_Get:
return "Get"
default:
return "fuck"
}
}
templ PartialWorkers(workers []*shared.Worker) {
<div class="flex flex-col gap-2">
for _, worker := range workers {
<div class="flex flex-col bg-slate-100 p-2">
<div class="flex gap-1">
ID: { fmt.Sprintf("%d", worker.Id) }
</div>
<div class="flex items-center gap-1 border p-1">
<div>Auth Token: </div>
<input class="border" disabled type="password" value={ worker.AuthToken }
id={ fmt.Sprintf("auth_key_%d", worker.Id) }
/>
@eyeToggle(fmt.Sprintf("auth_key_%d", worker.Id))
</div>
<details>
<summary>Targets:</summary>
<div class="flex flex-col gap-1 p-2">
for _, target := range worker.Targets {
<div class="flex flex-col bg-slate-200 p-2">
<div class="flex gap-1">
ID: { fmt.Sprintf("%d", target.Id) }
</div>
<div class="flex items-center gap-1 border p-1">
<div>Addr: </div>
<input class="border" value={ target.Addr }/>
</div>
<div class="flex items-center gap-1 border p-1">
<div>Interval (ms): </div>
<input class="border" value={ fmt.Sprint(target.Interval) }/>
</div>
<div class="flex flex-col gap-1">
<div>Method:</div>
switch m := target.Method.(type) {
case *shared.Target_Ping:
<div>Ping</div>
case *shared.Target_Get:
<div>Get</div>
<input class="border" value={ fmt.Sprint(m.Get.OkCodes) }/>
default:
<div>fuck</div>
}
</div>
</div>
}
</div>
</details>
</div>
}
</div>
}