删除不需要的文件

This commit is contained in:
GoEdgeLab
2022-04-22 16:52:17 +08:00
parent ef2f6ca44f
commit 6366e98ce2
11 changed files with 0 additions and 756 deletions

View File

@@ -1,6 +0,0 @@
<first-menu>
<menu-item code="index" href="/servers/accesslogs">策略列表</menu-item>
<menu-item @click.prevent="createPolicy">[创建策略]</menu-item>
<span class="item disabled">|</span>
<span class="item"><tip-icon content="可以利用日志策略将服务的访问日志输出到特定的媒介中。"></tip-icon></span>
</first-menu>

View File

@@ -1,7 +0,0 @@
<first-menu>
<menu-item href="/servers/accesslogs">策略列表</menu-item>
<span class="item disabled">|</span>
<menu-item :href="'policy?policyId=' + policy.id" code="policy">"{{policy.name}}"详情</menu-item>
<menu-item :href="'test?policyId=' + policy.id" code="test">测试</menu-item>
<menu-item :href="'update?policyId=' + policy.id" code="update">修改</menu-item>
</first-menu>

View File

@@ -1,217 +0,0 @@
{$layout "layout_popup"}
<h3>创建策略</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="50" ref="focus"/>
</td>
</tr>
<tr>
<td>存储类型 *</td>
<td>
<select class="ui dropdown auto-width" name="type" v-model="type">
<option value="">[选择类型]</option>
<option v-for="type in types" :value="type.code">{{type.name}}</option>
</select>
</td>
</tr>
<!-- 文件 -->
<tbody v-show="type == 'file'">
<tr>
<td>日志文件路径 *</td>
<td>
<input type="text" name="filePath"/>
<p class="comment">
存储日志的文件路径,文件名中支持变量:
<span class="ui label tiny">年:${year}</span>
<span class="ui label tiny">月:${month}</span>
<span class="ui label tiny">周:${week}</span>
<span class="ui label tiny">日:${day}</span>
<span class="ui label tiny">时:${hour}</span>
<span class="ui label tiny">分:${minute}</span>
<span class="ui label tiny">秒:${second}</span>
<span class="ui label tiny">年月日:${date}</span>,比如<span class="ui label tiny">/var/log/web-access-${date}.log</span>此文件会在API节点上写入。
</p>
</td>
</tr>
<tr>
<td>是否自动创建目录</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="fileAutoCreate" value="1" checked="checked"/>
<label></label>
</div>
<p class="comment">选中后,如果文件目录不存在时可以自动创建。</p>
</td>
</tr>
</tbody>
<!-- Elastic Search -->
<tbody v-show="type == 'es'">
<tr>
<td>Endpoint *</td>
<td>
<input type="text" name="esEndpoint"/>
<p class="comment">ES HTTP接口地址类似于192.168.1.100:9200需要能够被API节点访问。</p>
</td>
</tr>
<tr>
<td>Index *</td>
<td>
<input type="text" name="esIndex"/>
<p class="comment">Index名称支持变量
<span class="ui label tiny">年:${year}</span>
<span class="ui label tiny">月:${month}</span>
<span class="ui label tiny">周:${week}</span>
<span class="ui label tiny">日:${day}</span>
<span class="ui label tiny">时:${hour}</span>
<span class="ui label tiny">分:${minute}</span>
<span class="ui label tiny">秒:${second}</span>
<span class="ui label tiny">年月日:${date}</span></p>
</td>
</tr>
<tr>
<td>Mapping Type *</td>
<td>
<input type="text" name="esMappingType"/>
<p class="comment">Mapping名称支持变量
<span class="ui label tiny">年:${year}</span>
<span class="ui label tiny">月:${month}</span>
<span class="ui label tiny">周:${week}</span>
<span class="ui label tiny">日:${day}</span>
<span class="ui label tiny">时:${hour}</span>
<span class="ui label tiny">分:${minute}</span>
<span class="ui label tiny">秒:${second}</span>
<span class="ui label tiny">年月日:${date}</span></p>
</td>
</tr>
<tr>
<td>认证用户名</td>
<td>
<input type="text" name="esUsername"/>
<p class="comment">配置了认证后才需要填写。</p>
</td>
</tr>
<tr>
<td>认证密码</td>
<td>
<input type="text" name="esPassword"/>
<p class="comment">配置了认证后才需要填写。</p>
</td>
</tr>
</tbody>
<!-- TCP Socket -->
<tbody v-show="type == 'tcp'">
<tr>
<td>网络协议 *</td>
<td>
<select name="tcpNetwork" class="ui dropdown" style="width:10em">
<option value="tcp">TCP</option>
<option value="unix">Unix Socket</option>
</select>
</td>
</tr>
<tr>
<td>网络地址 *</td>
<td>
<input type="text" name="tcpAddr"/>
<p class="comment">接收日志的网络地址需要能够被API节点访问。</p>
</td>
</tr>
</tbody>
<!-- Syslog -->
<tbody v-show="type == 'syslog'">
<tr>
<td>网络协议</td>
<td>
<select class="ui dropdown" name="syslogProtocol" v-model="syslogProtocol" style="width:10em">
<option value="none">[无]</option>
<option value="tcp">TCP</option>
<option value="udp">UDP</option>
<option value="socket">Unix Socket</option>
</select>
</td>
</tr>
<tr v-if="syslogProtocol == 'tcp' || syslogProtocol == 'udp'">
<td>网络地址 *</td>
<td>
<input type="text" name="syslogServerAddr"/>
<p class="comment">IP地址或主机名不包括端口需要能够被API节点访问。</p>
</td>
</tr>
<tr v-if="syslogProtocol == 'tcp' || syslogProtocol == 'udp'">
<td>端口</td>
<td>
<input type="text" name="syslogServerPort"/>
</td>
</tr>
<tr v-if="syslogProtocol == 'socket'">
<td>Socket路径 *</td>
<td>
<input type="text" name="syslogSocket"/>
<p class="comment">需要能够被API节点访问。</p>
</td>
</tr>
<tr>
<td>标签<em>(Tag)</em></td>
<td>
<input type="text" name="syslogTag"/>
<p class="comment">选填项。</p>
</td>
</tr>
<tr>
<td>优先级<em>(Priority)</em></td>
<td>
<select class="ui dropdown" name="syslogPriority" style="width:10em">
<option v-for="priority in syslogPriorities" :value="priority.value">{{priority.name}}</option>
</select>
<p class="comment">选填项。</p>
</td>
</tr>
</tbody>
<!-- 命令行输入流 -->
<tbody v-show="type == 'command'">
<tr>
<td>可执行文件 *</td>
<td>
<input type="text" name="commandCommand"/>
<p class="comment">不带参数的可执行文件地址此命令可执行文件需要部署在API节点上。</p>
</td>
</tr>
<tr>
<td>参数</td>
<td>
<input type="text" name="commandArgs"/>
<p class="comment">执行命令需要的参数</p>
</td>
</tr>
<tr>
<td>工作目录</td>
<td>
<input type="text" name="commandDir"/>
<p class="comment">命令执行所在的工作目录</p>
</td>
</tr>
</tbody>
<tr>
<td>是否公用</td>
<td>
<checkbox name="isPublic" value="1"></checkbox>
<p class="comment"><span class="red">选中后表示自动将此策略应用于所有集群,同时只会有一个公用策略。</span></p>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,8 +0,0 @@
Tea.context(function () {
this.type = ""
/**
* syslog
*/
this.syslogProtocol = "none"
})

View File

@@ -1,44 +0,0 @@
{$layout}
{$template "menu"}
<p class="comment" v-if="policies.length == 0">暂时还没有访问日志策略。</p>
<table class="ui table celled selectable" v-if="policies.length > 0">
<thead>
<tr>
<th>策略名称</th>
<th class="three op">类型</th>
<th>主要参数</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="policy in policies">
<td><a :href="Tea.url('.policy', {policyId: policy.id})">{{policy.name}}</a>
<div style="margin-top: 0.3em" v-if="policy.isPublic">
<span class="ui label olive tiny basic">公用</span>
</div>
</td>
<td>{{policy.typeName}}</td>
<td>
<span v-if="policy.options == null" class="disabled">-</span>
<span v-else-if="policy.type == 'es'">Endpoint: {{policy.options.endpoint}}</span>
<span v-else-if="policy.type == 'file'">文件路径:{{policy.options.path}}</span>
<span v-else-if="policy.type == 'tcp'">网络地址:{{policy.options.addr}}</span>
<span v-else-if="policy.type == 'command'">可执行命令:{{policy.options.command}}</span>
<span v-else-if="policy.type == 'syslog'">
<span v-if="policy.options.protocol == 'tcp'">TCP {{policy.options.serverAddr}}</span>
<span v-if="policy.options.protocol == 'udp'">UDP {{policy.options.serverAddr}}</span>
<span v-if="policy.options.protocol == 'socket'">SOCK {{policy.options.socket}}</span>
</span>
</td>
<td>
<label-on :v-is-on="policy.isOn"></label-on>
</td>
<td>
<a :href="Tea.url('.policy', {policyId: policy.id})">详情</a> &nbsp; <a href="" @click.prevent="deletePolicy(policy.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View File

@@ -1,20 +0,0 @@
Tea.context(function () {
this.createPolicy = function () {
teaweb.popup(Tea.url(".createPopup", {}), {
height: "24em",
callback: NotifyReloadSuccess("保存成功")
})
}
this.deletePolicy = function (policyId) {
teaweb.confirm("确定要删除这个日志策略吗?", function () {
this.$post(".delete")
.params({
policyId: policyId
})
.success(function () {
teaweb.successRefresh("保存成功")
})
})
}
})

View File

@@ -1,173 +0,0 @@
{$layout}
{$template "policy_menu"}
<table class="ui table definition selectable">
<tr>
<td class="title">策略名称</td>
<td>
{{policy.name}}
</td>
</tr>
<tr>
<td>状态</td>
<td>
<label-on :v-is-on="policy.isOn"></label-on>
</td>
</tr>
<tr>
<td>存储类型</td>
<td>
{{policy.typeName}}
</td>
</tr>
<!-- 文件 -->
<tbody v-if="policy.type == 'file'">
<tr>
<td>日志文件路径</td>
<td>
{{policy.options.path}}
</td>
</tr>
<tr>
<td>是否自动创建目录</td>
<td>
<span v-if="policy.options.autoCreate" class="green">Y</span>
<span v-else class="disabled">N</span>
</td>
</tr>
</tbody>
<!-- Elastic Search -->
<tbody v-if="policy.type == 'es'">
<tr>
<td>Endpoint</td>
<td>
{{policy.options.endpoint}}
</td>
</tr>
<tr>
<td>Index</td>
<td>
{{policy.options.index}}
</td>
</tr>
<tr>
<td>Mapping Type</td>
<td>
{{policy.options.mappingType}}
</td>
</tr>
<tr>
<td>认证用户名</td>
<td>
<span v-if="policy.options.username.length > 0">{{policy.options.username}}</span>
<span v-else class="disabled">没有填写。</span>
</td>
</tr>
<tr>
<td>认证密码</td>
<td>
<span v-if="policy.options.password.length > 0">{{policy.options.password}}</span>
<span v-else class="disabled">没有填写。</span>
</td>
</tr>
</tbody>
<!-- TCP Socket -->
<tbody v-if="policy.type == 'tcp'">
<tr>
<td>网络协议</td>
<td>
{{policy.options.network.toUpperCase()}}
</td>
</tr>
<tr>
<td>网络地址</td>
<td>
{{policy.options.addr}}
</td>
</tr>
</tbody>
<!-- Syslog -->
<tbody v-if="policy.type == 'syslog'">
<tr>
<td>网络协议</td>
<td>
<span v-if="policy.options.protocol == 'none'" class="disabled">[无]</span>
<span v-if="policy.options.protocol == 'tcp'">TCP</span>
<span v-if="policy.options.protocol == 'udp'">UDP</span>
<span v-if="policy.options.protocol == 'socket'">Unix Socket</span>
</td>
</tr>
<tr v-if="policy.options.protocol == 'tcp' || policy.options.protocol == 'udp'">
<td>网络地址</td>
<td>
{{policy.options.serverAddr}}
</td>
</tr>
<tr v-if="policy.options.protocol == 'tcp' || policy.options.protocol == 'udp'">
<td>端口</td>
<td>
{{policy.options.serverPort}}
</td>
</tr>
<tr v-if="policy.options.protocol == 'socket'">
<td>Socket路径</td>
<td>
{{policy.options.socket}}
</td>
</tr>
<tr>
<td>标签<em>(Tag)</em></td>
<td>
<span v-if="policy.options.tag.length > 0">{{policy.options.tag}}</span>
<span v-else class="disabled">没有设置</span>
</td>
</tr>
<tr>
<td>优先级<em>(Priority)</em></td>
<td>
{{syslogPriorityName}}
</td>
</tr>
</tbody>
<!-- 命令行输入流 -->
<tbody v-if="policy.type == 'command'">
<tr>
<td>可执行命令</td>
<td>
{{policy.options.command}}
</td>
</tr>
<tr>
<td>参数</td>
<td>
<div v-if="policy.options.args != null && policy.options.args.length > 0">
<span v-for="arg in policy.options.args" class="ui label basic tiny">{{arg}}</span>
</div>
<span v-else class="disabled">没有设置参数。</span>
</td>
</tr>
<tr>
<td>工作目录</td>
<td>
<span v-if="policy.options.dir.length > 0">{{policy.options.dir}}</span>
<span v-else class="disabled">没有设置工作目录。</span>
</td>
</tr>
</tbody>
<tr>
<td>是否公用</td>
<td>
<span v-if="policy.isPublic" class="green">Y</span>
<span v-else class="disabled">N</span>
</td>
</tr>
</table>

View File

@@ -1,19 +0,0 @@
{$layout "layout"}
{$template "/code_editor"}
{$template "policy_menu"}
<form class="ui form" data-tea-action="$" data-tea-success="success" data-tea-timeou="30" data-tea-done="done" data-tea-before="before">
<input type="hidden" name="policyId" :value="policy.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">发送内容</td>
<td>
<source-code-box id="json-data-box" type="application/json" :read-only="false" name="bodyJSON">{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
}</source-code-box>
</td>
</tr>
</table>
<submit-btn v-if="!isRequesting"></submit-btn>
<button class="ui button disabled" type="button" v-if="isRequesting">发送中...</button>
</form>

View File

@@ -1,15 +0,0 @@
Tea.context(function () {
this.isRequesting = false
this.success = function () {
teaweb.success("发送成功")
}
this.before = function () {
this.isRequesting = true
}
this.done = function () {
this.isRequesting = false
}
})

View File

@@ -1,223 +0,0 @@
{$layout}
{$template "policy_menu"}
<h3>修改策略</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="policyId" :value="policy.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">策略名称 *</td>
<td>
<input type="text" name="name" maxlength="50" ref="focus" v-model="policy.name"/>
</td>
</tr>
<tr>
<td>存储类型 *</td>
<td>
{{policy.typeName}}
</td>
</tr>
<!-- 文件 -->
<tbody v-show="type == 'file'">
<tr>
<td>日志文件路径 *</td>
<td>
<input type="text" name="filePath" v-model="policy.options.path"/>
<p class="comment">
存储日志的文件路径,文件名中支持变量:
<span class="ui label tiny">年:${year}</span>
<span class="ui label tiny">月:${month}</span>
<span class="ui label tiny">周:${week}</span>
<span class="ui label tiny">日:${day}</span>
<span class="ui label tiny">时:${hour}</span>
<span class="ui label tiny">分:${minute}</span>
<span class="ui label tiny">秒:${second}</span>
<span class="ui label tiny">年月日:${date}</span>,比如<span class="ui label tiny">/var/log/web-access-${date}.log</span>此文件会在API节点上写入。
</p>
</td>
</tr>
<tr>
<td>是否自动创建目录</td>
<td>
<div class="ui checkbox">
<input type="checkbox" name="fileAutoCreate" value="1" v-model="policy.options.autoCreate"/>
<label></label>
</div>
<p class="comment">选中后,如果文件目录不存在时可以自动创建。</p>
</td>
</tr>
</tbody>
<!-- Elastic Search -->
<tbody v-show="type == 'es'">
<tr>
<td>Endpoint *</td>
<td>
<input type="text" name="esEndpoint" v-model="policy.options.endpoint"/>
<p class="comment">ES HTTP接口地址类似于192.168.1.100:9200需要能够被API节点访问。</p>
</td>
</tr>
<tr>
<td>Index *</td>
<td>
<input type="text" name="esIndex" v-model="policy.options.index"/>
<p class="comment">Index名称支持变量
<span class="ui label tiny">年:${year}</span>
<span class="ui label tiny">月:${month}</span>
<span class="ui label tiny">周:${week}</span>
<span class="ui label tiny">日:${day}</span>
<span class="ui label tiny">时:${hour}</span>
<span class="ui label tiny">分:${minute}</span>
<span class="ui label tiny">秒:${second}</span>
<span class="ui label tiny">年月日:${date}</span></p>
</td>
</tr>
<tr>
<td>Mapping Type *</td>
<td>
<input type="text" name="esMappingType" v-model="policy.options.mappingType"/>
<p class="comment">Mapping名称支持变量
<span class="ui label tiny">年:${year}</span>
<span class="ui label tiny">月:${month}</span>
<span class="ui label tiny">周:${week}</span>
<span class="ui label tiny">日:${day}</span>
<span class="ui label tiny">时:${hour}</span>
<span class="ui label tiny">分:${minute}</span>
<span class="ui label tiny">秒:${second}</span>
<span class="ui label tiny">年月日:${date}</span></p>
</td>
</tr>
<tr>
<td>认证用户名</td>
<td>
<input type="text" name="esUsername" v-model="policy.options.username"/>
<p class="comment">配置了认证后才需要填写。</p>
</td>
</tr>
<tr>
<td>认证密码</td>
<td>
<input type="text" name="esPassword" v-model="policy.options.password"/>
<p class="comment">配置了认证后才需要填写。</p>
</td>
</tr>
</tbody>
<!-- TCP Socket -->
<tbody v-show="type == 'tcp'">
<tr>
<td>网络协议 *</td>
<td>
<select name="tcpNetwork" class="ui dropdown" style="width:10em" v-model="policy.options.network">
<option value="tcp">TCP</option>
<option value="unix">Unix Socket</option>
</select>
</td>
</tr>
<tr>
<td>网络地址 *</td>
<td>
<input type="text" name="tcpAddr" v-model="policy.options.addr"/>
<p class="comment">接收日志的网络地址需要能够被API节点访问。</p>
</td>
</tr>
</tbody>
<!-- Syslog -->
<tbody v-show="type == 'syslog'">
<tr>
<td>网络协议</td>
<td>
<select class="ui dropdown" name="syslogProtocol" v-model="syslogProtocol" style="width:10em">
<option value="none">[无]</option>
<option value="tcp">TCP</option>
<option value="udp">UDP</option>
<option value="socket">Unix Socket</option>
</select>
</td>
</tr>
<tr v-if="syslogProtocol == 'tcp' || syslogProtocol == 'udp'">
<td>网络地址 *</td>
<td>
<input type="text" name="syslogServerAddr" v-model="policy.options.serverAddr"/>
<p class="comment">IP地址或主机名不包括端口需要能够被API节点访问。</p>
</td>
</tr>
<tr v-if="syslogProtocol == 'tcp' || syslogProtocol == 'udp'">
<td>端口</td>
<td>
<input type="text" name="syslogServerPort" v-model="policy.options.serverPort"/>
</td>
</tr>
<tr v-if="syslogProtocol == 'socket'">
<td>Socket路径 *</td>
<td>
<input type="text" name="syslogSocket" v-model="policy.options.socket"/>
<p class="comment">需要能够被API节点访问。</p>
</td>
</tr>
<tr>
<td>标签<em>(Tag)</em></td>
<td>
<input type="text" name="syslogTag" v-model="policy.options.tag"/>
<p class="comment">选填项。</p>
</td>
</tr>
<tr>
<td>优先级<em>(Priority)</em></td>
<td>
<select class="ui dropdown" name="syslogPriority" style="width:10em" v-model="policy.options.priority">
<option v-for="priority in syslogPriorities" :value="priority.value">{{priority.name}}</option>
</select>
<p class="comment">选填项。</p>
</td>
</tr>
</tbody>
<!-- 命令行输入流 -->
<tbody v-show="type == 'command'">
<tr>
<td>可执行文件 *</td>
<td>
<input type="text" name="commandCommand" v-model="policy.options.command"/>
<p class="comment">不带参数的可执行文件地址此命令可执行文件需要部署在API节点上。</p>
</td>
</tr>
<tr>
<td>参数</td>
<td>
<input type="text" name="commandArgs" v-model="policy.options.args"/>
<p class="comment">执行命令需要的参数</p>
</td>
</tr>
<tr>
<td>工作目录</td>
<td>
<input type="text" name="commandDir" v-model="policy.options.dir"/>
<p class="comment">命令执行所在的工作目录</p>
</td>
</tr>
</tbody>
<tr>
<td>是否公用</td>
<td>
<checkbox name="isPublic" v-model="policy.isPublic"></checkbox>
<p class="comment"><span class="red">选中后表示自动将此策略应用于所有集群,同时只会有一个公用策略。</span></p>
</td>
</tr>
<tr>
<td>是否启用</td>
<td>
<checkbox name="isOn" v-model="policy.isOn"></checkbox>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,24 +0,0 @@
Tea.context(function () {
this.success = NotifySuccess("html:保存成功<br/>新的配置将会在1分钟之内生效", ".policy", {policyId: this.policy.id})
this.type = this.policy.type
/**
* syslog
*/
this.syslogProtocol = this.policy.options.protocol
/**
* command
*/
if (this.policy.type == "command") {
let args = this.policy.options.args
if (args == null) {
args = ""
} else {
args = args.join(" ")
}
this.policy.options.args = args
}
})