优化界面/删除不需要的文件

This commit is contained in:
刘祥超
2022-04-07 10:21:38 +08:00
parent 61f043319d
commit 46812f9e42
59 changed files with 550 additions and 1570 deletions

View File

@@ -1,40 +0,0 @@
{$layout "layout_popup"}
<h3>创建密钥</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="domainId" :value="domainId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">密钥名称 *</td>
<td>
<input type="text" name="name" ref="focus"/>
</td>
</tr>
<tr>
<td>算法 *</td>
<td>
<select class="ui dropdown auto-width" name="algo">
<option value="">[选择算法]</option>
<option v-for="algo in algorithms" :value="algo.code">{{algo.name}}</option>
</select>
</td>
</tr>
<tr>
<td>密码 *</td>
<td>
<div style="margin-bottom: 1em">
<radio name="secretType" value="clear" :v-value="'clear'" v-model="secretType">明文密码</radio>
&nbsp; &nbsp;
<radio name="secretType" value="base64" :v-value="'base64'" v-model="secretType">Base64密码</radio>
</div>
<textarea name="secret" maxlength="256" v-model="secret" rows="3"></textarea>
<p class="comment" v-if="secretType == 'clear'">客户端需要将明文转换为BASE64使用。</p>
<div style="margin-top: 1em">
<a href="" @click.prevent="generateSecret">[随机生成]</a>
</div>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,20 +0,0 @@
Tea.context(function () {
this.secretType = "clear"
this.secret = ""
this.$delay(function () {
this.$watch("secretType", function () {
this.secret = ""
})
})
this.generateSecret = function () {
this.$post(".generateSecret")
.params({
secretType: this.secretType
})
.success(function (resp) {
this.secret = resp.data.secret
})
}
})

View File

@@ -1,38 +0,0 @@
{$layout}
{$template "../domain_menu"}
<second-menu>
<menu-item @click.prevent="createKey">[创建密钥]</menu-item>
</second-menu>
<tip-message-box>这里的密钥可以用于TSIG通讯校验。</tip-message-box>
<p class="comment" v-if="keys.length == 0">暂时还没有密钥。</p>
<table class="ui table celled selectable" v-if="keys.length > 0">
<thead>
<tr>
<th class="three wide">密钥名称</th>
<th class="three wide">算法</th>
<th>密码</th>
<th class="two wide">密码类型</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="key in keys">
<td>{{key.name}}</td>
<td>{{key.algoName}}</td>
<td>{{key.secret}}</td>
<td>{{key.secretTypeName}}</td>
<td>
<label-on :v-is-on="key.isOn"></label-on>
</td>
<td>
<a href="" @click.prevent="updateKey(key.id)">修改</a> &nbsp;
<a href="" @click.prevent="deleteKey(key.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -1,31 +0,0 @@
Tea.context(function () {
this.createKey = function () {
teaweb.popup(Tea.url(".createPopup?domainId=" + this.domain.id), {
height: "24em",
callback: function () {
teaweb.successRefresh("保存成功")
}
})
}
this.updateKey = function (keyId) {
teaweb.popup(Tea.url(".updatePopup?keyId=" + keyId), {
height: "27em",
callback: function () {
teaweb.successRefresh("保存成功")
}
})
}
this.deleteKey = function (keyId) {
teaweb.confirm("确定要删除这个密钥吗?", function () {
this.$post(".delete")
.params({
keyId: keyId
})
.success(function () {
teaweb.successRefresh("删除成功")
})
})
}
})

View File

@@ -1,46 +0,0 @@
{$layout "layout_popup"}
<h3>修改密钥</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="keyId" :value="key.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">密钥名称 *</td>
<td>
<input type="text" name="name" ref="focus" v-model="key.name"/>
</td>
</tr>
<tr>
<td>算法 *</td>
<td>
<select class="ui dropdown auto-width" name="algo" v-model="key.algo">
<option value="">[选择算法]</option>
<option v-for="algo in algorithms" :value="algo.code">{{algo.name}}</option>
</select>
</td>
</tr>
<tr>
<td>密码 *</td>
<td>
<div style="margin-bottom: 1em">
<radio name="secretType" value="clear" :v-value="'clear'" v-model="secretType">明文密码</radio>
&nbsp; &nbsp;
<radio name="secretType" value="base64" :v-value="'base64'" v-model="secretType">Base64密码</radio>
</div>
<textarea name="secret" maxlength="256" v-model="secret" rows="3"></textarea>
<p class="comment" v-if="secretType == 'clear'">客户端需要将明文转换为BASE64使用。</p>
<div style="margin-top: 1em">
<a href="" @click.prevent="generateSecret">[随机生成]</a>
</div>
</td>
</tr>
<tr>
<td>是否启用</td>
<td>
<checkbox name="isOn" v-model="key.isOn"></checkbox>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,20 +0,0 @@
Tea.context(function () {
this.secretType = this.key.secretType
this.secret = this.key.secret
this.$delay(function () {
this.$watch("secretType", function () {
this.secret = ""
})
})
this.generateSecret = function () {
this.$post(".generateSecret")
.params({
secretType: this.secretType
})
.success(function (resp) {
this.secret = resp.data.secret
})
}
})

View File

@@ -1,54 +0,0 @@
{$layout "layout_popup"}
<h3>创建记录</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="domainId" :value="domain.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">记录名</td>
<td>
<div class="ui input right labeled">
<input type="text" name="name" ref="focus"/>
<span class="ui label">.{{domain.name}}</span>
</div>
</td>
</tr>
<tr>
<td>记录类型</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type" @change="changeType">
<option v-for="t in types" :value="t.type">{{t.type}}</option>
</select>
<p class="comment">{{typeDescription}}</p>
</td>
</tr>
<tr>
<td>记录值</td>
<td>
<input type="text" name="value" maxlength="512"/>
</td>
</tr>
<tr>
<td>TTL</td>
<td>
<select class="ui dropdown auto-width" name="ttl">
<option v-for="v in ttlValues" :value="v.value">{{v.name}}</option>
</select>
</td>
</tr>
<tr>
<td>线路</td>
<td>
<ns-routes-selector></ns-routes-selector>
</td>
</tr>
<tr>
<td>备注</td>
<td>
<textarea rows="2" name="description"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,15 +0,0 @@
Tea.context(function () {
this.type = "A"
this.typeDescription = ""
this.changeType = function () {
let that = this
this.types.forEach(function (v) {
if (v.type == that.type) {
that.typeDescription = v.description
}
})
}
this.changeType()
})

View File

@@ -1,62 +0,0 @@
{$layout}
{$template "../domain_menu"}
<second-menu>
<menu-item @click.prevent="createRecord">[创建记录]</menu-item>
</second-menu>
<form class="ui form" method="get" action="/ns/domains/records">
<input type="hidden" name="domainId" :value="domain.id"/>
<div class="ui fields inline">
<div class="ui field">
<select class="ui dropdown" name="type" v-model="type">
<option value="">[记录类型]</option>
<option v-for="t in types" :value="t.type">{{t.type}}</option>
</select>
</div>
<div class="ui field">
<ns-route-selector :v-route-code="routeCode"></ns-route-selector>
</div>
<div class="ui field">
<input type="text" placeholder="记录名、备注..." name="keyword" v-model="keyword"/>
</div>
<div class="ui field">
<button type="submit" class="ui button">搜索</button>
</div>
</div>
</form>
<p class="comment" v-if="records.length == 0">暂时还没有记录。</p>
<table class="ui table selectable celled" v-if="records.length > 0">
<thead>
<tr>
<th>记录名</th>
<th>记录类型</th>
<th>记录值</th>
<th>TTL</th>
<th>线路</th>
<th>备注</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="record in records">
<td><keyword :v-word="keyword">{{record.name}}</keyword></td>
<td>{{record.type}}</td>
<td><keyword :v-word="keyword">{{record.value}}</keyword></td>
<td>{{formatTTL(record.ttl)}}</td>
<td>
<div v-for="route in record.routes" style="margin-top: 0.3em; margin-bottom: 0.3em">
<span class="ui label basic text tiny">{{route.name}}</span>
</div>
</td>
<td><keyword :v-word="keyword">{{record.description}}</keyword></td>
<td><label-on :v-is-on="record.isOn"></label-on></td>
<td>
<a href="" @click.prevent="updateRecord(record.id)">修改</a> &nbsp;
<a href="" @click.prevent="deleteRecord(record.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -1,52 +0,0 @@
Tea.context(function () {
this.createRecord = function () {
teaweb.popup("/ns/domains/records/createPopup?domainId=" + this.domain.id, {
height: "33em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.updateRecord = function (recordId) {
teaweb.popup("/ns/domains/records/updatePopup?recordId=" + recordId, {
height: "33em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteRecord = function (recordId) {
let that = this
teaweb.confirm("确定要删除此记录吗?", function () {
that.$post(".delete")
.params({
recordId: recordId
})
.success(function () {
teaweb.reload()
})
})
}
this.formatTTL = function (ttl) {
if (ttl % 86400 == 0) {
let days = ttl / 86400
return days + "天"
}
if (ttl % 3600 == 0) {
let hours = ttl / 3600
return hours + "小时"
}
if (ttl % 60 == 0) {
let minutes = ttl / 60
return minutes + "分钟"
}
return ttl + "秒"
}
})

View File

@@ -1,65 +0,0 @@
{$layout "layout_popup"}
<h3>修改记录</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="recordId" :value="record.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">记录名</td>
<td>
<div class="ui input right labeled">
<input type="text" name="name" ref="focus" v-model="record.name"/>
<span class="ui label">.{{domain.name}}</span>
</div>
</td>
</tr>
<tr>
<td>记录类型</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type" @change="changeType">
<option v-for="t in types" :value="t.type">{{t.type}}</option>
</select>
<p class="comment">{{typeDescription}}</p>
</td>
</tr>
<tr>
<td>记录值</td>
<td>
<input type="text" name="value" maxlength="512" v-model="record.value"/>
</td>
</tr>
<tr>
<td>TTL</td>
<td>
<select class="ui dropdown auto-width" name="ttl" v-model="record.ttl">
<option v-for="v in ttlValues" :value="v.value">{{v.name}}</option>
</select>
</td>
</tr>
<tr>
<td>线路</td>
<td>
<ns-routes-selector :v-routes="record.routes"></ns-routes-selector>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>备注</td>
<td>
<textarea rows="2" name="description" v-model="record.description"></textarea>
</td>
</tr>
<tr>
<td>是否启用</td>
<td>
<checkbox name="isOn" v-model="record.isOn"></checkbox>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,15 +0,0 @@
Tea.context(function () {
this.type = this.record.type
this.typeDescription = ""
this.changeType = function () {
let that = this
this.types.forEach(function (v) {
if (v.type == that.type) {
that.typeDescription = v.description
}
})
}
this.changeType()
})