feat: #10 added the base for the class on the page
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
{{ end }}
|
||||
|
||||
{{ define "delete-model-card" }}
|
||||
<form hx-delete="/models/delete" hx-headers='{"REQUEST-TYPE": "html"}' hx-swap="outerHTML" {{ if .Error }} class="submitted" {{end}} >
|
||||
<form hx-delete="/models/delete" hx-headers='{"REQUEST-TYPE": "html"}' hx-swap="outerHTML" {{ if .Error }} class="submitted" {{end}} >
|
||||
<fieldset>
|
||||
<span>
|
||||
To delete this model please type "{{ .Model.Name }}":
|
||||
@@ -42,6 +42,115 @@
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{/* Is called from a diffrent endpoint so that it does not matter where this is from :) which means that . can mean what ever I want */}}
|
||||
{{ define "data-model-create-class-table-table" }}
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
File Path
|
||||
</th>
|
||||
<th>
|
||||
Mode
|
||||
</th>
|
||||
<th>
|
||||
<!-- Img -->
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .List}}
|
||||
<tr>
|
||||
<td>
|
||||
{{.FilePath}}
|
||||
</td>
|
||||
<td>
|
||||
{{ if (eq .Mode 2) }}
|
||||
Testing
|
||||
{{ else }}
|
||||
Training
|
||||
{{ end }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{{ if startsWith .FilePath "file://" }}
|
||||
<img src="/savedData/{{ $.ModelId }}/data/{{ if (eq .Mode 2) }}testing{{ else }}training{{ end }}/{{ $.Name }}/{{ replace .FilePath "file://" "" 1 }}" height="30px" width="30px" style="object-fit: contain;" />
|
||||
{{ else }}
|
||||
TODO
|
||||
img {{ .FilePath }}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="flex justify-center align-center">
|
||||
<div class="grow-1 flex justify-end align-center ">
|
||||
{{ if gt .Page 0 }}
|
||||
<button
|
||||
hx-get="/models/data/list?id={{ .Id }}&page={{ add .Page -1 }}"
|
||||
hx-target=".content[data-tab='{{ .Name }}']"
|
||||
hx-swap="innerHTML"
|
||||
hx-headers='{"REQUEST-TYPE": "html"}'
|
||||
data-tab="{{ .Name }}">
|
||||
Prev
|
||||
</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div style="padding: 10px;">
|
||||
{{ .Page }}
|
||||
</div>
|
||||
|
||||
<div class="grow-1 flex justify-start align-center">
|
||||
{{ if lt (mul .Page 10) .Count }}
|
||||
<button
|
||||
hx-get="/models/data/list?id={{ .Id }}&page={{ add .Page 1 }}"
|
||||
hx-target=".content[data-tab='{{ .Name }}']"
|
||||
hx-swap="innerHTML"
|
||||
hx-headers='{"REQUEST-TYPE": "html"}'
|
||||
data-tab="{{ .Name }}">
|
||||
Next
|
||||
</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ define "data-model-create-class-table" }}
|
||||
{{ if eq (len .Classes) 0 }}
|
||||
TODO CREATE TABLE
|
||||
{{else}}
|
||||
<div class="tabs">
|
||||
{{/* Handle the case where there are to many buttons */}}
|
||||
{{ range .Classes }}
|
||||
{{/* TODO Auto Load 1st */}}
|
||||
<button
|
||||
hx-get="/models/data/list?id={{ .Id }}"
|
||||
hx-target=".content[data-tab='{{ .Name }}']"
|
||||
hx-swap="innerHTML"
|
||||
hx-headers='{"REQUEST-TYPE": "html"}'
|
||||
class="tab"
|
||||
data-tab="{{ .Name }}">
|
||||
{{ .Name }}
|
||||
</button>
|
||||
{{ end }}
|
||||
{{ range .Classes }}
|
||||
<div
|
||||
class="content"
|
||||
data-tab="{{ .Name }}"
|
||||
hx-get="/models/data/list?id={{ .Id }}"
|
||||
hx-target=".content[data-tab='{{ .Name }}']"
|
||||
hx-trigger="load"
|
||||
hx-swap="innerHTML"
|
||||
hx-headers='{"REQUEST-TYPE": "html"}'>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{end}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "data-model-card" }}
|
||||
<div class="card">
|
||||
<h3>
|
||||
@@ -114,7 +223,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="content" data-tab="create_class">
|
||||
TODO
|
||||
{{ template "data-model-create-class-table" . }}
|
||||
</div>
|
||||
<div class="content" data-tab="api">
|
||||
TODO
|
||||
@@ -132,7 +241,7 @@
|
||||
Api
|
||||
</button>
|
||||
<div class="content" data-tab="create_class">
|
||||
TODO
|
||||
{{ template "data-model-create-class-table" . }}
|
||||
</div>
|
||||
<div class="content" data-tab="api">
|
||||
TODO
|
||||
|
||||
Reference in New Issue
Block a user