diff --git a/internal/web/actions/default/clusters/cluster/node/settings/thresholds/index.go b/internal/web/actions/default/clusters/cluster/node/settings/thresholds/index.go deleted file mode 100644 index 1578394e..00000000 --- a/internal/web/actions/default/clusters/cluster/node/settings/thresholds/index.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. - -package thresholds - -import ( - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" - "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils" - "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" - "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "github.com/iwind/TeaGo/maps" -) - -type IndexAction struct { - actionutils.ParentAction -} - -func (this *IndexAction) Init() { - this.Nav("", "node", "update") - this.SecondMenu("threshold") -} - -func (this *IndexAction) RunGet(params struct { - ClusterId int64 - NodeId int64 -}) { - _, err := nodeutils.InitNodeInfo(this.Parent(), params.NodeId) - if err != nil { - this.ErrorPage(err) - return - } - - this.Data["nodeId"] = params.NodeId - - // 列出所有阈值 - thresholdsResp, err := this.RPC().NodeThresholdRPC().FindAllEnabledNodeThresholds(this.AdminContext(), &pb.FindAllEnabledNodeThresholdsRequest{ - Role: "node", - NodeClusterId: params.ClusterId, - NodeId: params.NodeId, - }) - if err != nil { - this.ErrorPage(err) - return - } - - thresholdMaps := []maps.Map{} - for _, threshold := range thresholdsResp.NodeThresholds { - thresholdMaps = append(thresholdMaps, maps.Map{ - "id": threshold.Id, - "itemName": nodeconfigs.FindNodeValueItemName(threshold.Item), - "paramName": nodeconfigs.FindNodeValueItemParamName(threshold.Item, threshold.Param), - "operatorName": nodeconfigs.FindNodeValueOperatorName(threshold.Operator), - "value": nodeconfigs.UnmarshalNodeValue(threshold.ValueJSON), - "sumMethodName": nodeconfigs.FindNodeValueSumMethodName(threshold.SumMethod), - "duration": threshold.Duration, - "durationUnitName": nodeconfigs.FindNodeValueDurationUnitName(threshold.DurationUnit), - "isOn": threshold.IsOn, - }) - } - this.Data["thresholds"] = thresholdMaps - - this.Show() -} diff --git a/web/views/@default/clusters/cluster/node/settings/thresholds/index.html b/web/views/@default/clusters/cluster/node/settings/thresholds/index.html deleted file mode 100644 index 29a32290..00000000 --- a/web/views/@default/clusters/cluster/node/settings/thresholds/index.html +++ /dev/null @@ -1,41 +0,0 @@ -{$layout} -{$template "/clusters/cluster/node/node_menu"} -{$template "/left_menu_with_menu"} - -
- -
- - [添加阈值] - -
- -

暂时还没有设置阈值。

- - - - - - - - - - - - - - - - - - - - - -
监控项参数操作符对比值统计时间段状态操作
{{threshold.itemName}}{{threshold.paramName}}{{threshold.operatorName}}{{threshold.value}}{{threshold.duration}}{{threshold.durationUnitName}} - - - 修改   - 删除 -
-
\ No newline at end of file diff --git a/web/views/@default/clusters/cluster/node/settings/thresholds/index.js b/web/views/@default/clusters/cluster/node/settings/thresholds/index.js deleted file mode 100644 index 2260af76..00000000 --- a/web/views/@default/clusters/cluster/node/settings/thresholds/index.js +++ /dev/null @@ -1,41 +0,0 @@ -Tea.context(function () { - this.createThreshold = function () { - teaweb.popup(Tea.url("/clusters/cluster/settings/thresholds/createPopup", { - clusterId: this.clusterId, - nodeId: this.nodeId - }), { - callback: function () { - teaweb.success("保存成功", function () { - teaweb.reload() - }) - } - }) - } - - this.updateThreshold = function (thresholdId) { - teaweb.popup(Tea.url("/clusters/cluster/settings/thresholds/updatePopup", { - thresholdId: thresholdId - }), { - callback: function () { - teaweb.success("保存成功", function () { - teaweb.reload() - }) - } - }) - } - - this.deleteThreshold = function (thresholdId) { - let that = this - teaweb.confirm("确定要删除这个阈值吗?", function () { - that.$post("/clusters/cluster/settings/thresholds/delete") - .params({ - thresholdId: thresholdId - }) - .success(function () { - teaweb.success("删除成功", function () { - teaweb.reload() - }) - }) - }) - } -}) \ No newline at end of file