Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<first-menu>
<menu-item :href="'/servers/iplists'">IP列表</menu-item>
<raquo-item></raquo-item>
<menu-item :href="'/servers/iplists/lists?type=' + list.type">{{list.typeName}}</menu-item>
<span class="disabled item">|</span>
<menu-item :href="'/servers/iplists/list?listId=' + list.id" code="list">"{{list.name}}"详情</menu-item>
<menu-item :href="'/servers/iplists/items?listId=' + list.id" code="item">IP({{list.countItems}})</menu-item>
<menu-item :href="'/servers/iplists/update?listId=' + list.id" code="update">修改</menu-item>
<menu-item :href="'/servers/iplists/test?listId=' + list.id" code="test">IP检查</menu-item>
<menu-item :href="'/servers/iplists/export?listId=' + list.id" code="export">导出</menu-item>
<menu-item :href="'/servers/iplists/import?listId=' + list.id" code="import">导入</menu-item>
</first-menu>

View File

@@ -0,0 +1,11 @@
<first-menu>
<menu-item href="/servers/iplists" code="index">IP列表</menu-item>
<span class="disabled item">|</span>
<menu-item href="/servers/iplists/lists?type=black" :active="type == 'black'">黑名单</menu-item>
<menu-item href="/servers/iplists/lists?type=white" :active="type == 'white'">白名单</menu-item>
<menu-item href="/servers/iplists/lists?type=grey" :active="type == 'grey'">灰名单</menu-item>
<span class="item disabled" v-if="type.length > 0">|</span>
<menu-item @click.prevent="createList" v-if="type.length > 0">[创建名单]</menu-item>
<span class="item disabled" v-if="type.length > 0">|</span>
<span class="item" v-if="type.length > 0"><tip-icon content="创建名单时可以选择“全局有效”就会成为全局有效名单全局有效名单对所有网站自动生效非全局有效名单可以在WAF策略里引用。<br/><br/>黑名单其中的IP将会被禁止访问。<br/>白名单其中的IP将会自动放行优先级高于黑名单。<br/>灰名单其中的IP仅作为记录和观察使用不影响黑名单和白名单的作用。"></tip-icon></span>
</first-menu>

View File

@@ -0,0 +1,10 @@
{$layout "layout_popup"}
<h3>访问日志<span v-if="ipTo.length > 0" class="grey">{{ipFrom}} - {{ipTo}}</span><span v-else class="grey">{{ipFrom}}</span></h3>
<p class="comment" v-if="accessLogs.length == 0">暂时还没有访问日志。</p>
<table class="ui table selectable" v-if="accessLogs.length > 0">
<tr v-for="accessLog in accessLogs" :key="accessLog.requestId">
<td><http-access-log-box :v-access-log="accessLog"></http-access-log-box></td>
</tr>
</table>

View File

@@ -0,0 +1,39 @@
{$layout "layout_popup"}
<h3>绑定公用IP名单</h3>
<p class="comment" v-if="lists.length == 0">暂时还没有可用的公用IP名单。</p>
<table class="ui table selectable celled" v-if="lists.length > 0">
<thead>
<tr>
<th class="two wide center">ID</th>
<th>名称</th>
<th class="two wide center">类型</th>
<th>备注</th>
<th class="two wide center">IP数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="list in lists">
<td class="center">{{list.id}}</td>
<td>{{list.name}}</td>
<td class="center">
<span v-if="list.type == 'black'">黑名单</span>
<span v-if="list.type == 'white'">白名单</span>
<span v-if="list.type == 'grey'">灰名单</span>
</td>
<td>{{list.description}}</td>
<td class="center">
<span v-if="list.countItems > 0">{{list.countItems}}</span>
<span v-else class="disabled">0</span>
</td>
<td>
<a href="" @click.prevent="bind(list)" v-if="!list.isSelected">绑定</a>
<a href="" style="color: grey" @click.prevent="unbind(list)" v-if="list.isSelected">已绑定</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,23 @@
Tea.context(function () {
this.bind = function (list) {
this.$post("$")
.params({
httpFirewallPolicyId: this.httpFirewallPolicyId,
listId: list.id
})
.success(function () {
list.isSelected = true
})
}
this.unbind = function (list) {
this.$post(".unbindHTTPFirewall")
.params({
httpFirewallPolicyId: this.httpFirewallPolicyId,
listId: list.id
})
.success(function () {
list.isSelected = false
})
}
})

View File

@@ -0,0 +1,79 @@
{$layout "layout_popup"}
<h3 v-if="list.type == 'white'">添加IP到白名单</h3>
<h3 v-if="list.type == 'black'">添加IP到黑名单</h3>
<h3 v-if="list.type == 'grey'">添加IP到灰名单</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="listId" :value="listId"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">类型 *</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type">
<option value="ip">单IP或IP段</option>
<option value="all">所有IP</option>
</select>
<p class="comment" v-if="type == 'ip'">单个IP或一个IP范围。</p>
<p class="comment" v-if="type == 'all'">允许或禁用所有的IP。</p>
</td>
</tr>
<tr v-if="type != 'all'">
<td>添加方式</td>
<td>
<radio name="method" value="single" :v-value="'single'" v-model="method">单个添加</radio> &nbsp; &nbsp;
<radio name="method" value="batch" :v-value="'batch'" v-model="method">批量添加</radio>
</td>
</tr>
<!-- 单个添加 -->
<tbody v-if="method == 'single' && type == 'ip'">
<tr>
<td>IP或IP段 *</td>
<td>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" style="width: 20em"/>
<p class="comment">支持IPv4和IPv6支持三种格式单个IP比如192.168.1.100、IP范围比如192.168.1.1-192.168.1.255、CIDR比如192.168.1.1/24</p>
</td>
</tr>
</tbody>
<!-- 批量添加 -->
<tbody v-if="method == 'batch' && type == 'ip'">
<tr>
<td>IP列表</td>
<td>
<textarea name="ipData" style="width: 20em" :placeholder="'x.x.x.x' + '\n' + 'x.x.x.x/24' + '\n' + 'x.x.x.x-y.y.y.y'" rows="3"></textarea>
<p class="comment">每行一个IP支持三种格式<code-label :class="'grey'">192.168.1.100</code-label><code-label :class="'grey'">192.168.1.1-192.168.1.255</code-label><code-label :class="'grey'">192.168.1.1/24</code-label></p>
</td>
</tr>
</tbody>
<tr>
<td>过期时间</td>
<td>
<datetime-input :v-name="'expiredAt'"></datetime-input>
<p class="comment">在加入名单某一段时间后会失效,留空表示永久有效。</p>
</td>
</tr>
<tr>
<td>级别</td>
<td>
<firewall-event-level-options :v-value="eventLevel"></firewall-event-level-options>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>备注</td>
<td><input type="text" name="reason" maxlength="100"/></td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,5 @@
Tea.context(function () {
this.type = "ip"
this.eventLevel = (this.listType == "white") ? "debug" : "critical"
this.method = "single"
})

View File

@@ -0,0 +1,4 @@
h3 var {
font-style: normal;
}
/*# sourceMappingURL=createPopup.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["createPopup.less"],"names":[],"mappings":"AAAA,EACC;EACC,kBAAA","file":"createPopup.css"}

View File

@@ -0,0 +1,50 @@
{$layout "layout_popup"}
<h3>创建<var v-if="type == 'black'">黑名单</var><var v-if="type == 'white'">白名单</var><var v-if="type == 'grey'">灰名单</var>
</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">名称 *</td>
<td>
<input type="text" name="name" maxlength="100" ref="focus"/>
</td>
</tr>
<tr>
<td>代号</td>
<td>
<input type="text" name="code" maxlength="100"/>
<p class="comment">可选参数,只能是英文字母、数字、中划线、下划线的组合。</p>
</td>
</tr>
<tr>
<td>类型</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type">
<option value="black">黑名单</option>
<option value="white">白名单</option>
<option value="grey">灰名单</option>
</select>
<p class="comment" v-if="type == 'black'">黑名单中的IP将会被禁止访问。</p>
<p class="comment" v-if="type == 'white'">白名单中的IP将会自动放行优先级高于黑名单。</p>
<p class="comment" v-if="type == 'grey'">灰名单中的IP仅作为记录和观察使用不影响黑名单和白名单的作用。</p>
</td>
</tr>
<tr>
<td>全局有效</td>
<td>
<checkbox name="isGlobal" checked="checked"></checkbox>
<p class="comment">选中后所有网站都自动使用此名单不需要再次绑定否则只有在WAF策略中绑定此名单后才会生效。</p>
</td>
</tr>
<tr>
<td>备注</td>
<td>
<textarea name="description" rows="2" maxlength="200"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,5 @@
h3 {
var {
font-style: normal;
}
}

View File

@@ -0,0 +1,25 @@
{$layout}
{$template "list_menu"}
<div class="margin"></div>
<form class="ui form" method="get" action="/servers/iplists/exportData">
<input type="hidden" name="listId" :value="list.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">说明</td>
<td>导出所有的IP并以文件格式下载。注意v1.3.5版本及以后导出的数据不能在之前的版本中导入。</td>
</tr>
<tr>
<td>格式</td>
<td>
<select class="ui dropdown auto-width" name="format">
<option value="xlsx">Excel</option>
<option value="csv">CSV</option>
<option value="txt">TXT</option>
<option value="json">JSON</option>
</select>
</td>
</tr>
</table>
<submit-btn>导出</submit-btn>
</form>

View File

@@ -0,0 +1,19 @@
{$layout}
{$template "list_menu"}
<div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success" data-tea-timeout="300">
<input type="hidden" name="listId" :value="list.id"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">选择IP文件 *</td>
<td>
<input type="file" name="file" accept=".xlsx, .json, .txt, .csv"/>
<p class="comment">文件名类似于<code-label>ip-list-123.xxx</code-label>支持Excel、CSV、JSON和纯文本TXT。</p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,11 @@
Tea.context(function () {
this.success = function (resp) {
let message = "成功导入" + resp.data.count + "个IP"
if (resp.data.countIgnore > 0) {
message += ",并忽略" + resp.data.countIgnore + "个格式错误的IP"
}
teaweb.success(message, function () {
teaweb.reload()
})
}
})

View File

@@ -0,0 +1,56 @@
{$layout}
{$template "menu"}
<div class="margin"></div>
<form class="ui form" action="/servers/iplists" method="get">
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="keyword" placeholder="x.x.x.x" v-model="keyword"/>
</div>
<div class="ui field">
<select class="ui dropdown auto-width" name="listType" v-model="listType">
<option value="">[所有类型]</option>
<option value="black">黑名单</option>
<option value="white">白名单</option>
<option value="grey">灰名单</option>
</select>
</div>
<div class="ui field">
<select class="ui dropdown" name="eventLevel" v-model="eventLevel">
<option value="">[所有级别]</option>
<option v-for="level in eventLevels" :value="level.code">{{level.name}}</option>
</select>
</div>
<div class="ui field">
<div class="ui checkbox">
<input type="checkbox" name="globalOnly" value="1" v-model="globalOnly" id="global-only-checkbox"/>
<label for="global-only-checkbox">系统自动拦截</label>
</div>
</div>
<div class="ui field" v-if="countUnread > 0">
<div class="ui checkbox">
<input type="checkbox" name="unread" value="1" v-model="unread"/>
<label><span class="red">New</span></label>
</div>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button>
&nbsp;
<a href="/servers/iplists" v-if="keyword.length > 0 || globalOnly || unread || eventLevel.length > 0 || listType.length > 0">[清除条件]</a>
</div>
<div class="ui field" v-if="countUnread > 0">
<span class="disabled">|</span>
</div>
<div class="ui field" v-if="countUnread > 0">
<a href="" @click.prevent="readAllItems" title="消除未读标记New">[全部设为已读]</a>
</div>
</div>
</form>
<div class="margin"></div>
<p class="comment" v-if="items.length == 0">暂时还没有IP。</p>
<ip-list-table v-if="items.length > 0" :v-items="items" @update-item="updateItem" @delete-item="deleteItem" :v-keyword="keyword" :v-show-search-button="true" :v-total="totalItems"></ip-list-table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,30 @@
Tea.context(function () {
this.updateItem = function (itemId) {
teaweb.popup(Tea.url(".updateIPPopup", {itemId: itemId}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteItem = function (itemId) {
let that = this
teaweb.confirm("确定要删除这个IP吗", function () {
that.$post(".deleteIP")
.params({
"itemId": itemId
})
.refresh()
})
}
this.readAllItems = function () {
this.$post(".readAll")
.success(function () {
teaweb.reload()
})
}
})

View File

@@ -0,0 +1,33 @@
{$layout}
{$template "list_menu"}
<second-menu>
<menu-item @click.prevent="createIP">[创建IP]</menu-item>
</second-menu>
<form class="ui form" action="/servers/iplists/items">
<input type="hidden" name="listId" :value="list.id"/>
<div class="ui fields inline">
<div class="ui field">
<input type="text" size="20" placeholder="x.x.x.x" name="keyword" v-model="keyword"/>
</div>
<div class="ui field">
<select class="ui dropdown" name="eventLevel" v-model="eventLevel">
<option value="">[级别]</option>
<option v-for="level in eventLevels" :value="level.code">{{level.name}}</option>
</select>
</div>
<div class="ui field">
<button class="ui button" type="submit">搜索</button>
&nbsp;
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="keyword.length > 0 || eventLevel.length > 0">[清除条件]</a>
</div>
</div>
<div class="margin"></div>
</form>
<p class="comment" v-if="items.length == 0">暂时还没有IP。</p>
<ip-list-table v-if="items.length > 0" :v-items="items" @update-item="updateItem" @delete-item="deleteItem" :v-keyword="keyword"></ip-list-table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,37 @@
Tea.context(function () {
this.updateItem = function (itemId) {
teaweb.popup(Tea.url(".updateIPPopup", {itemId: itemId}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteItem = function (itemId) {
let that = this
teaweb.confirm("确定要删除这个IP吗", function () {
that.$post(".deleteIP")
.params({
"itemId": itemId
})
.refresh()
})
}
/**
* 添加IP名单菜单
*/
this.createIP = function () {
teaweb.popup(Tea.url(".createIPPopup", {listId: this.list.id}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
})

View File

@@ -0,0 +1,42 @@
{$layout}
{$template "list_menu"}
<table class="ui table definition selectable">
<tr>
<td class="title">名称</td>
<td>
{{list.name}}
</td>
</tr>
<tr>
<td>ID</td>
<td>{{list.id}}</td>
</tr>
<tr>
<td>代号</td>
<td>
<span v-if="list.code.length > 0">{{list.code}}</span>
<span v-else class="disabled">没有设置</span>
</td>
</tr>
<tr>
<td>类型</td>
<td>
{{list.typeName}}
</td>
</tr>
<tr>
<td>全局有效</td>
<td>
<span v-if="list.isGlobal" class="green">Y</span>
<span v-else class="disabled">N</span>
</td>
</tr>
<tr>
<td>备注</td>
<td>
<span v-if="list.description.length > 0">{{list.description}}</span>
<span v-else class="disabled">-</span>
</td>
</tr>
</table>

View File

@@ -0,0 +1,9 @@
.label.white {
background: white !important;
border: 1px #ccc solid;
}
.label.gray {
background: #999 !important;
color: white !important;
}
/*# sourceMappingURL=lists.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["lists.less"],"names":[],"mappings":"AAAA,MAAM;EACL,4BAAA;EACA,sBAAA;;AAGD,MAAM;EACL,gBAAA;EACA,uBAAA","file":"lists.css"}

View File

@@ -0,0 +1,65 @@
{$layout}
{$template "menu"}
<tip-message-box code="iplist-public-tip">这里是公用的IP名单可以在WAF策略里直接引用。</tip-message-box>
<div class="margin"></div>
<form class="ui form" action="/servers/iplists/lists">
<input type="hidden" name="type" :value="type"/>
<div class="ui fields inline">
<div class="ui field">
<input type="text" placeholder="IP名单名称、代号..." name="keyword" v-model="keyword"/>
</div>
<div class="ui field">
<button type="submit" class="ui button">搜索</button>
&nbsp;
<a :href="'/servers/iplists/lists?type=' + type" v-if="keyword.length > 0">[清除条件]</a>
</div>
</div>
</form>
<p class="comment" v-if="lists.length == 0">暂时还没有公用IP名单。</p>
<table class="ui table selectable celled" v-if="lists.length > 0">
<thead>
<tr>
<th class="one wide center">ID</th>
<th class="three wide">IP名单名称</th>
<th class="three wide">代号</th>
<th class="two wide center">类型</th>
<th>备注</th>
<th class="two wide center">IP数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="list in lists">
<td class="center">{{list.id}}</td>
<td>
<a :href="'/servers/iplists/list?listId=' + list.id"><keyword :v-word="keyword">{{list.name}}</keyword></a>
<div v-if="list.isGlobal" style="margin-top: 0.3em"><grey-label>全局</grey-label></div>
</td>
<td>
<span v-if="list.code != null && list.code.length > 0"><keyword :v-word="keyword">{{list.code}}</keyword></span>
<span v-else class="disabled">-</span>
</td>
<td class="center">
<span v-if="list.type == 'black'"><span class="ui label tiny black">黑名单</span></span>
<span v-if="list.type == 'white'"><span class="ui label tiny white">白名单</span></span>
<span v-if="list.type == 'grey'"><span class="ui label tiny gray">灰名单</span></span>
</td>
<td>
<span v-if="list.description.length > 0">{{list.description}}</span>
<span v-else class="disabled">-</span>
</td>
<td class="center">
<a :href="'/servers/iplists/items?listId=' + list.id" v-if="list.countItems > 0">{{list.countItems}}</a>
<span v-else class="disabled">0</span>
</td>
<td>
<a :href="'/servers/iplists/list?listId=' + list.id">详情</a> &nbsp;
<a href="" @click.prevent="deleteList(list.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,27 @@
Tea.context(function () {
this.createList = function () {
teaweb.popup(Tea.url(".createPopup", {type: this.type}), {
height: "32em",
callback: function (resp) {
teaweb.success("保存成功", function () {
window.location = "/servers/iplists/lists?type=" + resp.data.list.type
})
}
})
}
this.deleteList = function (listId) {
let that = this
teaweb.confirm("确定要删除此IP名单吗", function () {
that.$post(".delete")
.params({
listId: listId
})
.success(function () {
teaweb.success("删除成功", function () {
teaweb.reload()
})
})
})
}
})

View File

@@ -0,0 +1,9 @@
.label.white {
background: white !important;
border: 1px #ccc solid;
}
.label.gray {
background: #999 !important;
color: white !important;
}

View File

@@ -0,0 +1,37 @@
{$layout "layout_popup"}
<h3>选择公用IP名单</h3>
<p class="comment" v-if="lists.length == 0">暂时还没有可用的公用IP名单。</p>
<table class="ui table selectable celled" v-if="lists.length > 0">
<thead>
<tr>
<th class="two wide center">ID</th>
<th>名称</th>
<th class="two wide center">类型</th>
<th>备注</th>
<th class="two wide center">IP数量</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="list in lists">
<td class="center">{{list.id}}</td>
<td>{{list.name}}</td>
<td class="center">
<span v-if="list.type == 'black'">黑名单</span>
<span v-if="list.type == 'white'">白名单</span>
<span v-if="list.type == 'grey'">灰名单</span>
</td>
<td>{{list.description}}</td>
<td class="center">
<span v-if="list.countItems > 0">{{list.countItems}}</span>
<span v-else class="disabled">0</span>
</td>
<td>
<a href="" @click.prevent="selectList(list)">选择</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,13 @@
Tea.context(function () {
this.selectList = function (list) {
NotifyPopup({
code: 200,
data: {
list: {
id: list.id,
name: list.name
}
}
})
}
})

View File

@@ -0,0 +1,40 @@
{$layout}
{$template "list_menu"}
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="listId" :value="list.id"/>
<table class="ui table selectable definition">
<tr>
<td class="title">IP *</td>
<td>
<input type="text" name="ip" class="text" maxlength="100" ref="focus" placeholder="x.x.x.x" v-model="ip"/>
<p class="comment">要检查的IP</p>
</td>
</tr>
<tr>
<td>检查结果</td>
<td>
<div v-if="result.isDone">
<div v-if="!result.isOk">
<span class="red">{{result.error}}</span>
</div>
<div v-if="result.isFound">
<div v-if="result.item != null">
<div v-if="result.isAllowed">
<span class="green" v-if="result.item.listType == 'white'">在白名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
<span class="grey" v-if="result.item.listType == 'grey'">在灰名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
</div>
<div v-else>
<span class="red">在黑名单中 <ip-item-text :v-item="result.item"></ip-item-text>&nbsp;<a href="" @click.prevent="updateItem(result.item.id)" title="查看和修改"><i class="icon pencil small"></i></a></span>
</div>
</div>
</div>
<div v-if="!result.isFound">
没有找到和{{ip}}匹配的配置。
</div>
</div>
</td>
</tr>
</table>
<submit-btn>检查IP状态</submit-btn>
</form>

View File

@@ -0,0 +1,33 @@
Tea.context(function () {
this.ip = ""
this.result = {
isDone: false,
isOk: false,
isFound: false,
isAllowed: false,
error: "",
ipItem: null,
ipList: null
}
this.$delay(function () {
this.$watch("ip", function () {
this.result.isDone = false
})
})
this.success = function (resp) {
this.result = resp.data.result
}
this.updateItem = function (itemId) {
teaweb.popup(Tea.url(".updateIPPopup", {itemId: itemId}), {
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
})

View File

@@ -0,0 +1,35 @@
{$layout}
{$template "list_menu"}
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="listId" :value="list.id"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">名称 *</td>
<td>
<input type="text" name="name" maxlength="100" ref="focus" v-model="list.name"/>
</td>
</tr>
<tr>
<td>代号</td>
<td>
<input type="text" name="code" maxlength="100" v-model="list.code"/>
<p class="comment">可选参数,只能是英文字母、数字、中划线、下划线的组合。</p>
</td>
</tr>
<tr>
<td>类型</td>
<td>
{{list.typeName}}
</td>
</tr>
<tr>
<td>备注</td>
<td>
<textarea name="description" rows="2" maxlength="200" v-model="list.description"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -0,0 +1,59 @@
{$layout "layout_popup"}
<h3>修改IP</h3>
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="itemId" :value="item.id"/>
<input type="hidden" name="type" :value="item.type"/>
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">类型 *</td>
<td>
<!-- 类型不允许修改 -->
<span v-if="item.type == 'ipv4'">IPv4</span>
<span v-if="item.type == 'ipv6'">IPv6</span>
<span v-if="item.type == 'all'">所有IP</span>
<p class="comment" v-if="type == 'ipv4'">单个IPv4或一个IPv4范围。</p>
<p class="comment" v-if="type == 'ipv6'">单个IPv6或一个IPv6范围。</p>
<p class="comment" v-if="type == 'all'">允许或禁用所有的IP。</p>
</td>
</tr>
<tbody v-if="type != 'all'">
<tr>
<td>IP或IP段 *</td>
<td>
<input type="text" name="value" maxlength="64" placeholder="x.x.x.x" ref="focus" v-model="item.value" style="width: 20em"/>
</td>
</tr>
</tbody>
<tr>
<td>过期时间</td>
<td>
<datetime-input :v-name="'expiredAt'" :v-timestamp="item.expiredAt"></datetime-input>
<p class="comment">在加入名单某一段时间后会失效,留空表示永久有效。</p>
</td>
</tr>
<tr>
<td>级别</td>
<td>
<firewall-event-level-options :v-value="item.eventLevel"></firewall-event-level-options>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>备注</td>
<td><input type="text" name="reason" maxlength="100" v-model="item.reason"/></td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>