generated from datewu/project-abc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check r.Header.Get("HX-Request") == ""
- Loading branch information
datewu
committed
Sep 12, 2023
1 parent
8ae5f68
commit 7086295
Showing
10 changed files
with
171 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{{ define "content" }} | ||
<div id="content"> | ||
<div class="url-btns"> | ||
<p id="url">https://set-img.deoops.com/api/v1/auth/setimg</p> | ||
<div> | ||
<button hx-on="click: copyPastboard(this)">copy</button> | ||
<button hx-on="click: toogle(this)">more</button> | ||
</div> | ||
</div> | ||
<div id="detail"> | ||
<pre> | ||
curl -XPOST https://set-img.deoops.com/api/v1/auth/setimg \ | ||
-H 'Authorization: $TOKEN' \ | ||
--data-binary \ | ||
'{"container_name":"CHANGE-ME", "kind":"CHANGE-deploy/sts", | ||
"img":"${ { steps.prep.outputs.tags } }", | ||
"name":"CHANGE-ME","namespace":"CHANGE-ME"}' | ||
</pre> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
function copyPastboard(t) { | ||
// Get the text field | ||
var copyText = document.getElementById("url"); | ||
// Copy the text inside the text field | ||
navigator.clipboard.writeText(copyText.innerText); | ||
t.innerText = 'copied!' | ||
t.blur() | ||
} | ||
|
||
function toogle(t) { | ||
var detail = document.getElementById("detail"); | ||
if (t.innerText === "less") { | ||
t.innerText = "more"; | ||
detail.style.display = "none"; | ||
} else { | ||
detail.style.display = "block"; | ||
t.innerText = "less"; | ||
} | ||
t.blur(); | ||
} | ||
</script> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/static/fav.svg" /> | ||
<link rel="stylesheet" href="/static/page.css" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<script src="https://unpkg.com/htmx.org@1.9.5" | ||
integrity="sha384-xcuj3WpfgjlKF+FXhSQFQ0ZNr39ln+hwjN3npfM9VBnUskLolQAcN80McRIVOPuO" | ||
crossorigin="anonymous"></script> | ||
<title>k8s管理工具</title> | ||
</head> | ||
|
||
<body hx-boost="true" hx-indicator="#in-spinner"> | ||
<!-- <img id="in-spinner" class="htmx-indicator" alt="spinner" src="/static/spinner.svg"> --> | ||
<img id="in-spinner" alt="spinner" src="/static/spinner.svg"> | ||
<div class="app"> | ||
<a href="/" class="logo"> | ||
<img src="/static/fav.svg" alt="logo" /> | ||
<p> | ||
kubernetes部署工具 | ||
</p> | ||
</a> | ||
{{ if .User }} | ||
<div hx-target="#content" hx-push-url="true"> | ||
<a href="/my/profile"> {{ .User }} </a> | ||
<a href="/my/deploys">Deploys</a> | ||
<a href="/my/sts">Statefulsets</a> | ||
</div> | ||
{{ else }} | ||
<div id="profile" hx-get="/login/github/init" hx-swap="outerHTML" hx-trigger="load"></div> | ||
{{ end }} | ||
<div id="content"> | ||
{{ template "content" .}} | ||
</div> | ||
</div> | ||
<footer> | ||
<div hx-get="/version" hx-swap="outerHTML" hx-trigger="revealed">version</div> | ||
</footer> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package front | ||
|
||
import ( | ||
"html/template" | ||
|
||
_ "embed" | ||
) | ||
|
||
//go:embed layout.html | ||
var layoutHtml string | ||
|
||
var layoutTpl = template.Must(template.New("layout").Parse(layoutHtml)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package front | ||
|
||
import ( | ||
"html/template" | ||
|
||
_ "embed" | ||
) | ||
|
||
var profileHtml = ` | ||
{{- define "content" }} | ||
<span>welcome {{ .User }}</span> | ||
{{ end -}} | ||
` | ||
|
||
// ProfileTpl is the profile template. | ||
var ProfileTpl = template.Must(template.New("profile").Parse(profileHtml + layoutHtml)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.