add: API Token相关的前端页面

This commit is contained in:
Akkia
2022-05-18 20:52:18 +08:00
parent fcd0ccae56
commit 914d7cbbae
11 changed files with 149 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
<a class='item{{if eq .MatchedPath "/monitor"}} active{{end}}' href="/monitor"><i class="rss icon"></i>{{tr "Services"}}</a>
<a class='item{{if eq .MatchedPath "/cron"}} active{{end}}' href="/cron"><i class="clock icon"></i>{{tr "Task"}}</a>
<a class='item{{if eq .MatchedPath "/notification"}} active{{end}}' href="/notification"><i class="bell icon"></i>{{tr "Notification"}}</a>
<a class='item{{if eq .MatchedPath "/api"}} active{{end}}' href="/api"><i class="key icon"></i>API</a>
<a class='item{{if eq .MatchedPath "/setting"}} active{{end}}' href="/setting">
<i class="settings icon"></i>{{tr "Settings"}}
</a>

19
resource/template/component/api.html vendored Normal file
View File

@@ -0,0 +1,19 @@
{{define "component/api"}}
<div class="ui tiny api modal transition hidden">
<div class="header">{{tr "IssueNewApiToken"}}</div>
<div class="content">
<form id="apiForm" class="ui form">
<input type="hidden" name="id">
<div class="field">
<label>{{tr "Note"}}</label>
<textarea name="Note"></textarea>
</div>
</form>
</div>
<div class=" actions">
<div class="ui negative button">{{tr "Cancel"}}</div>
<button class="ui positive nezha-primary-btn right labeled icon button">{{tr "Confirm"}}<i class="checkmark icon"></i>
</button>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,41 @@
{{define "dashboard/api"}}
{{template "common/header" .}}
{{template "common/menu" .}}
<div class="nb-container">
<div class="ui container">
<div class="ui grid">
<div class="right floated right aligned twelve wide column">
<button class="ui right labeled nezha-primary-btn icon button" onclick="issueNewApiToken()"><i class="add icon"></i>
{{tr "IssueNewApiToken"}}
</button>
</div>
</div>
<table class="ui very basic table">
<thead>
<tr>
<th>{{tr "Token"}}</th>
<th>{{tr "Note"}}</th>
</tr>
</thead>
<tbody>
{{range $token := .Tokens}}
<tr>
<td>{{$token.Token}}</td>
<td>{{$token.Note}}</td>
<td>
<div class="ui mini icon buttons">
<button class="ui button"
onclick="showConfirm('{{tr "DeleteToken"}}','{{tr "ConfirmToDeleteThisToken"}}',deleteRequest,'/api/token/'+{{$token.Token}})">
<i class="trash alternate outline icon"></i>
</button>
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{template "component/api"}}
{{template "common/footer" .}}
{{end}}