-
Notifications
You must be signed in to change notification settings - Fork 8.1k
/
Copy pathflow-rule-dialog.html
172 lines (159 loc) · 9.59 KB
/
flow-rule-dialog.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<div>
<span class="brand" style="font-weight:bold;">{{gatewayFlowRuleDialog.title}}</span>
<div class="card" style="margin-top: 20px;margin-bottom: 10px;">
<div class="panel-body">
<div class="row">
<form role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">API 类型</label>
<div class="col-sm-9">
<div class="form-control highlight-border" align="center">
<input type="radio" ng-if="gatewayFlowRuleDialog.type == 'edit'" value="0" checked ng-model='currentRule.resourceMode'
disabled="" title="Route ID" /><span ng-if="gatewayFlowRuleDialog.type == 'edit'"> Route ID </span>
<input type="radio" ng-if="gatewayFlowRuleDialog.type == 'add'" value="0" checked ng-model='currentRule.resourceMode'
title="Route ID" ng-click="useRouteID()"/><span ng-if="gatewayFlowRuleDialog.type == 'add'"> Route ID </span>
<input type="radio" ng-if="gatewayFlowRuleDialog.type == 'edit'" value="1" ng-model='currentRule.resourceMode'
disabled="" title="API分组" /><span ng-if="gatewayFlowRuleDialog.type == 'edit'"> API 分组  </span>
<input type="radio" ng-if="gatewayFlowRuleDialog.type == 'add'" value="1" ng-model='currentRule.resourceMode'
title="API分组" ng-click="useCustormAPI()"/><span ng-if="gatewayFlowRuleDialog.type == 'add'"> API 分组  </span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">API 名称</label>
<div class="col-sm-9">
<input type="text" ng-if="currentRule.resourceMode == 0 && gatewayFlowRuleDialog.type == 'edit'" class="form-control" placeholder="请输入 Route ID" ng-model='currentRule.resource'
disabled="" />
<input type="text" ng-if="currentRule.resourceMode == 0 && gatewayFlowRuleDialog.type == 'add'" class="form-control highlight-border" placeholder="请输入 Route ID" ng-model='currentRule.resource' />
<select ng-if="currentRule.resourceMode == 1 && gatewayFlowRuleDialog.type == 'edit'" ng-model="currentRule.resource" ng-init="selectedName = currentRule.resource"
disabled="" ng-options="name for name in apiNames" class="form-control">
</select>
<select ng-if="currentRule.resourceMode == 1 && gatewayFlowRuleDialog.type == 'add'" ng-model="currentRule.resource" ng-init="currentRule.resource"
ng-options="name for name in apiNames" class="form-control">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">针对请求属性</label>
<div class="col-sm-2">
<label class="checkbox-inline">
<input type="checkbox" ng-if="currentRule.paramItem != null" checked ng-click="notUseParamItem()" />
<input type="checkbox" ng-if="currentRule.paramItem == null" ng-click="useParamItem()" />
</label>
</div>
</div>
<div class="form-group" ng-if="currentRule.paramItem != null">
<label class="col-sm-2 control-label">参数属性</label>
<div class="col-sm-9">
<div class="form-control highlight-border" align="center">
<input type="radio" name="parseStrategy" value="0" checked ng-model='currentRule.paramItem.parseStrategy' title="Client IP" /> Client IP
<input type="radio" name="parseStrategy" value="1" ng-model='currentRule.paramItem.parseStrategy' title="Remote Host" /> Remote Host
<input type="radio" name="parseStrategy" value="2" ng-model='currentRule.paramItem.parseStrategy' title="Header" /> Header
<input type="radio" name="parseStrategy" value="3" ng-model='currentRule.paramItem.parseStrategy' title="URL 参数" /> URL 参数
<input type="radio" name="parseStrategy" value="4" ng-model='currentRule.paramItem.parseStrategy' title="Cookie" /> Cookie
</div>
</div>
</div>
<div class="form-group" ng-if="currentRule.paramItem != null && (currentRule.paramItem.parseStrategy == 2 || currentRule.paramItem.parseStrategy == 3 || currentRule.paramItem.parseStrategy == 4)">
<label class="col-sm-2 control-label">
<span ng-if="currentRule.paramItem.parseStrategy==2">Header 名称</span>
<span ng-if="currentRule.paramItem.parseStrategy==3">URL 参数名称</span>
<span ng-if="currentRule.paramItem.parseStrategy==4">Cookie 名称</span>
</label>
<div class="col-sm-9">
<input type="text" name="fieldName" class="form-control highlight-border" placeholder="请输入" ng-model='currentRule.paramItem.fieldName' />
</div>
</div>
<div class="form-group" ng-if="currentRule.paramItem != null">
<label class="col-sm-2 control-label">属性值匹配</label>
<div class="col-sm-2">
<label class="checkbox-inline">
<input type="checkbox" ng-if="currentRule.paramItem.pattern != null" checked ng-click="notUseParamItemVal()"/>
<input type="checkbox" ng-if="currentRule.paramItem.pattern == null" ng-click="useParamItemVal()"/>
</label>
</div>
</div>
<div class="form-group" ng-if="currentRule.paramItem.pattern != null">
<label class="col-sm-2 control-label">匹配模式</label>
<div class="col-sm-4 control-label">
<div class="form-control highlight-border" align="center">
<input type="radio" value="0" checked ng-model="currentRule.paramItem.matchStrategy" title="精确" /> 精确
<input type="radio" value="3" ng-model="currentRule.paramItem.matchStrategy" title="子串" /> 子串
<input type="radio" value="2" ng-model="currentRule.paramItem.matchStrategy" title="正则" /> 正则
</div>
</div>
<label class="col-sm-2 control-label">匹配串</label>
<div class="col-sm-3 control-label">
<input type='text' ng-model="currentRule.paramItem.pattern" class="form-control highlight-border" placeholder="匹配串" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">阈值类型</label>
<div class="col-sm-9">
<div class="form-control highlight-border" align="center">
<input type="radio" name="grade" value="1" checked ng-model="currentRule.grade" title="QPS" /> QPS
<input type="radio" name="grade" value="0" ng-model="currentRule.grade" title="线程数" /> 线程数
</div>
</div>
</div>
<div class="form-group">
<div>
<label class="col-sm-2 control-label">
<span ng-if="currentRule.grade==1">QPS 阈值</span>
<span ng-if="currentRule.grade==0">线程数</span>
</label>
<div class="col-sm-3">
<input type='number' min="0" class="form-control highlight-border" ng-model='currentRule.count' placeholder="阈值" />
</div>
</div>
</div>
<div class="form-group" ng-if="currentRule.grade==1">
<div>
<label class="col-sm-2 control-label">间隔</label>
<div class="col-sm-3">
<input type='number' id="txtInterval" min="1" class="form-control highlight-border" ng-model='currentRule.interval' placeholder="统计窗口时间长度" />
</div>
<div class="col-sm-2">
<select ng-model="currentRule.intervalUnit" ng-init="currentRule.intervalUnit"
ng-options="intervalUnit.val as intervalUnit.desc for intervalUnit in intervalUnits" class="form-control" ng-click="changeIntervalUnit()">
</select>
</div>
</div>
</div>
<div class="form-group" ng-if="currentRule.grade==1">
<label class="col-sm-2 control-label">流控方式</label>
<div class="col-sm-9">
<div class="form-control highlight-border" align="center">
<input type="radio" name="controlBehavior" value="0" checked ng-model='currentRule.controlBehavior' title="快速失败" /> 快速失败
<input type="radio" name="controlBehavior" value="2" ng-model='currentRule.controlBehavior' title="匀速排队" /> 匀速排队 
</div>
</div>
</div>
<div class="form-group" ng-if="currentRule.grade==1 && currentRule.controlBehavior==0">
<div>
<label class="col-sm-2 control-label">Burst size</label>
<div class="col-sm-3">
<input type='number' min="0" class="form-control highlight-border" ng-model='currentRule.burst' placeholder="突发请求额外允许数" />
</div>
</div>
</div>
<div class="form-group" ng-if="currentRule.grade==1 && currentRule.controlBehavior==2">
<div>
<label class="col-sm-2 control-label">超时时间</label>
<div class="col-sm-3">
<input type='number' min="0" class="form-control highlight-border" ng-model='currentRule.maxQueueingTimeoutMs' placeholder="排队等待时间(ms)" />
</div>
</div>
</div>
</form>
</div>
<div class="separator"></div>
<div clss="row" style="margin-top: 20px;">
<button class="btn btn-outline-danger" style="float:right; height: 30px;font-size: 12px;margin-left: 10px;" ng-click="closeThisDialog()">取消</button>
<button class="btn btn-outline-success" style="float:right; height: 30px;font-size: 12px;margin-left: 10px;" ng-click="saveRule()">{{gatewayFlowRuleDialog.confirmBtnText}}</button>
<button ng-if="gatewayFlowRuleDialog.saveAndContinueBtnText" class="btn btn-default" style="float:right; height: 30px;font-size: 12px;"
ng-click="saveRuleAndContinue()">{{gatewayFlowRuleDialog.saveAndContinueBtnText}}</button>
</div>
</div>
</div>
</div>