mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	删除不需要的文件
This commit is contained in:
		@@ -1,87 +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="clusterId" :value="clusterId" />
 | 
			
		||||
    <input type="hidden" name="nodeId" :value="nodeId"/>
 | 
			
		||||
    <input type="hidden" name="sumMethod" value="avg"/>
 | 
			
		||||
 | 
			
		||||
    <table class="ui table definition selectable">
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td class="title">监控项 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="ui dropdown auto-width" name="item" v-model="threshold.item" @change="changeItem">
 | 
			
		||||
                    <option v-for="item in items" :value="item.code">{{item.name}}</option>
 | 
			
		||||
                </select>
 | 
			
		||||
                <p class="comment">{{itemDescription}}</p>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>参数 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="ui dropdown auto-width" name="param" v-model="threshold.param" @change="changeParam">
 | 
			
		||||
                    <option v-for="param in itemParams" :value="param.code">{{param.name}}</option>
 | 
			
		||||
                </select>
 | 
			
		||||
                <p class="comment">{{paramDescription}}</p>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>操作符 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="ui dropdown auto-width" name="operator" v-model="threshold.operator">
 | 
			
		||||
                    <option v-for="operator in operators" :value="operator.code">{{operator.name}}</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>对比值</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input type="text" name="value" style="width: 6em" maxlength="10"/>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>统计时间段 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <div class="ui fields inline">
 | 
			
		||||
                    <div class="ui field">
 | 
			
		||||
                        <input type="text" name="duration" value="5" style="width: 5em"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="ui field">
 | 
			
		||||
                        分钟
 | 
			
		||||
                        <!-- TODO 将来支持更多时间范围 -->
 | 
			
		||||
                        <input type="hidden" name="durationUnit" value="minute"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </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" maxlength="100" name="message"></textarea>
 | 
			
		||||
                    <p class="comment">触发阈值时的消息提示。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>消息通知间隔</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <div class="ui fields inline">
 | 
			
		||||
                        <div class="ui field">
 | 
			
		||||
                            <input type="text" name="notifyDuration" value="10" style="width: 5em"/>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="ui field">
 | 
			
		||||
                            分钟
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <p class="comment">在此间隔内将不会重复发送跟此阈值相关的消息。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
    <submit-btn></submit-btn>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
	this.threshold = {
 | 
			
		||||
		item: this.items[0].code,
 | 
			
		||||
		param: "",
 | 
			
		||||
		operator: this.operators[0].code
 | 
			
		||||
	}
 | 
			
		||||
	this.$delay(function () {
 | 
			
		||||
		this.changeItem()
 | 
			
		||||
		this.changeParam()
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.itemDescription = ""
 | 
			
		||||
	this.itemParams = []
 | 
			
		||||
 | 
			
		||||
	this.changeItem = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.threshold.param = ""
 | 
			
		||||
		this.items.forEach(function (v) {
 | 
			
		||||
			if (v.code == that.threshold.item) {
 | 
			
		||||
				that.itemDescription = v.description
 | 
			
		||||
				that.itemParams = v.params
 | 
			
		||||
				that.threshold.param = v.params[0].code
 | 
			
		||||
				that.paramDescription = v.params[0].description
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.paramDescription = ""
 | 
			
		||||
 | 
			
		||||
	this.changeParam = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.items.forEach(function (v) {
 | 
			
		||||
			if (v.code == that.threshold.item) {
 | 
			
		||||
				v.params.forEach(function (param) {
 | 
			
		||||
					if (param.code == that.threshold.param) {
 | 
			
		||||
						that.paramDescription = param.description
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
@@ -1,42 +0,0 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "../menu"}
 | 
			
		||||
{$template "/left_menu_with_menu"}
 | 
			
		||||
 | 
			
		||||
<div class="right-box with-menu">
 | 
			
		||||
    <first-menu>
 | 
			
		||||
        <menu-item @click.prevent="createThreshold">[添加阈值]</menu-item>
 | 
			
		||||
    </first-menu>
 | 
			
		||||
 | 
			
		||||
    <p class="comment" v-if="thresholds.length == 0">暂时还没有设置阈值。</p>
 | 
			
		||||
    <table class="ui table selectable celled" v-if="thresholds.length > 0">
 | 
			
		||||
        <thead>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <th>监控项</th>
 | 
			
		||||
                <th>参数</th>
 | 
			
		||||
                <th>操作符</th>
 | 
			
		||||
                <th>对比值</th>
 | 
			
		||||
                <th>统计时间段</th>
 | 
			
		||||
                <th class="two wide">状态</th>
 | 
			
		||||
                <th class="two op">操作</th>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tr v-for="threshold in thresholds">
 | 
			
		||||
            <td>{{threshold.itemName}}
 | 
			
		||||
                <div v-if="threshold.node != null" style="margin-top: 0.3em">
 | 
			
		||||
                    <a :href="'/clusters/cluster/node/settings/thresholds?clusterId=' + clusterId + '&nodeId=' + threshold.node.id" class="ui label basic tiny" title="节点专属阈值设置"><span class="small">节点:{{threshold.node.name}}</span></a>
 | 
			
		||||
                </div>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>{{threshold.paramName}}</td>
 | 
			
		||||
            <td>{{threshold.operatorName}}</td>
 | 
			
		||||
            <td>{{threshold.value}}</td>
 | 
			
		||||
            <td>{{threshold.duration}}{{threshold.durationUnitName}}</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <label-on :v-is-on="threshold.isOn"></label-on>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <a href="" @click.prevent="updateThreshold(threshold.id)">修改</a>  
 | 
			
		||||
                <a href="" @click.prevent="deleteThreshold(threshold.id)">删除</a>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
    </table>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -1,40 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.createThreshold = function () {
 | 
			
		||||
		teaweb.popup(Tea.url(".createPopup", {
 | 
			
		||||
			clusterId: this.clusterId
 | 
			
		||||
		}), {
 | 
			
		||||
			callback: function () {
 | 
			
		||||
				teaweb.success("保存成功", function () {
 | 
			
		||||
					teaweb.reload()
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.updateThreshold = function (thresholdId) {
 | 
			
		||||
		teaweb.popup(Tea.url(".updatePopup", {
 | 
			
		||||
			thresholdId: thresholdId
 | 
			
		||||
		}), {
 | 
			
		||||
			callback: function () {
 | 
			
		||||
				teaweb.success("保存成功", function () {
 | 
			
		||||
					teaweb.reload()
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.deleteThreshold = function (thresholdId) {
 | 
			
		||||
		let that = this
 | 
			
		||||
		teaweb.confirm("确定要删除这个阈值吗?", function () {
 | 
			
		||||
			that.$post(".delete")
 | 
			
		||||
				.params({
 | 
			
		||||
					thresholdId: thresholdId
 | 
			
		||||
				})
 | 
			
		||||
				.success(function () {
 | 
			
		||||
					teaweb.success("删除成功", function () {
 | 
			
		||||
						teaweb.reload()
 | 
			
		||||
					})
 | 
			
		||||
				})
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
@@ -1,92 +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="thresholdId" :value="threshold.id"/>
 | 
			
		||||
    <input type="hidden" name="sumMethod" value="avg"/>
 | 
			
		||||
 | 
			
		||||
    <table class="ui table definition selectable">
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td class="title">监控项 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="ui dropdown auto-width" name="item" v-model="threshold.item" @change="changeItem">
 | 
			
		||||
                    <option v-for="item in items" :value="item.code">{{item.name}}</option>
 | 
			
		||||
                </select>
 | 
			
		||||
                <p class="comment">{{itemDescription}}</p>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>参数 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="ui dropdown auto-width" name="param" v-model="threshold.param" @change="changeParam">
 | 
			
		||||
                    <option v-for="param in itemParams" :value="param.code">{{param.name}}</option>
 | 
			
		||||
                </select>
 | 
			
		||||
                <p class="comment">{{paramDescription}}</p>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>操作符 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select class="ui dropdown auto-width" name="operator" v-model="threshold.operator">
 | 
			
		||||
                    <option v-for="operator in operators" :value="operator.code">{{operator.name}}</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>对比值</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input type="text" name="value" style="width: 6em" maxlength="10" v-model="threshold.value"/>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>统计时间段 *</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <div class="ui fields inline">
 | 
			
		||||
                    <div class="ui field">
 | 
			
		||||
                        <input type="text" name="duration" value="5" style="width: 5em" v-model="threshold.duration"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="ui field">
 | 
			
		||||
                        分钟
 | 
			
		||||
                        <!-- TODO 将来支持更多时间范围 -->
 | 
			
		||||
                        <input type="hidden" name="durationUnit" value="minute" v-model="threshold.durationUnit"/>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </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" maxlength="100" name="message" v-model="threshold.message"></textarea>
 | 
			
		||||
                    <p class="comment">触发阈值时的消息提示。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>消息通知间隔</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <div class="ui fields inline">
 | 
			
		||||
                        <div class="ui field">
 | 
			
		||||
                            <input type="text" name="notifyDuration" v-model="threshold.notifyDuration" value="10" style="width: 5em"/>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="ui field">
 | 
			
		||||
                            分钟
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <p class="comment">在此间隔内将不会重复发送跟此阈值相关的消息。</p>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>是否启用</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <checkbox name="isOn" value="1" v-model="threshold.isOn"></checkbox>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
    <submit-btn></submit-btn>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -1,48 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
	this.$delay(function () {
 | 
			
		||||
		this.initItem()
 | 
			
		||||
		this.changeParam()
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.itemDescription = ""
 | 
			
		||||
	this.itemParams = []
 | 
			
		||||
 | 
			
		||||
	this.initItem = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.items.forEach(function (v) {
 | 
			
		||||
			if (v.code == that.threshold.item) {
 | 
			
		||||
				that.itemDescription = v.description
 | 
			
		||||
				that.itemParams = v.params
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.changeItem = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.threshold.param = ""
 | 
			
		||||
		this.items.forEach(function (v) {
 | 
			
		||||
			if (v.code == that.threshold.item) {
 | 
			
		||||
				that.itemDescription = v.description
 | 
			
		||||
				that.itemParams = v.params
 | 
			
		||||
				that.threshold.param = v.params[0].code
 | 
			
		||||
				that.paramDescription = v.params[0].description
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.paramDescription = ""
 | 
			
		||||
 | 
			
		||||
	this.changeParam = function () {
 | 
			
		||||
		let that = this
 | 
			
		||||
		this.items.forEach(function (v) {
 | 
			
		||||
			if (v.code == that.threshold.item) {
 | 
			
		||||
				v.params.forEach(function (param) {
 | 
			
		||||
					if (param.code == that.threshold.param) {
 | 
			
		||||
						that.paramDescription = param.description
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user