Skip to content

Commit

Permalink
try hx-iclude
Browse files Browse the repository at this point in the history
  • Loading branch information
datewu committed Sep 10, 2023
1 parent 1b94f25 commit 7abd081
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion front/index-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1>kubernetes部署工具</h1>
</div>
</div>
<footer>
<div hx-get="/version" hx-swap="outerHTML" hx-trigger="load">version</div>
<div hx-get="/version" hx-swap="outerHTML" hx-trigger="revealed">version</div>
</footer>

<script>
Expand Down
17 changes: 10 additions & 7 deletions front/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<th>Name</th>
<th>Replicas</th>
<th>Age</th>
<th>Image</th>
<th>Edit image Tag</th>
<th>Container Name</th>
<th>Image Tag</th>
</tr>
{{ $ns := .Namespace}}
{{ $kind := .Kind}}
Expand All @@ -19,11 +19,14 @@
<td rowspan="{{ $rowspan }}">{{ .Age }}</td>
{{ $name := .Name}}
{{ range .Containers }}
<form hx-put="/my/update/{{ $ns }}/{{ $kind }}/{{ $name }}?container={{ .Name }}">
<td> <input name="image" type="text" value="{{ .Image }}" /> </td>
<td> <button type="submit"> update </button> </td>
</form>
{{ end }}
<tr hx-put="/my/update/resource" hx-include="this">
<input type="hidden" name="ns" value="{{ $ns }}">
<input type="hidden" name="kind" value="{{ $kind }}">
<input type="hidden" name="name" value="{{ $name }}">
<td> <input disabled type="text" name="cname" value=" {{ .Name }}" /></td>
<td> <input type="text" value="{{ .Image }}" /> </td>
</tr>
{{ end }}
</tr>
{{ else }}
<tr>
Expand Down

0 comments on commit 7abd081

Please sign in to comment.