Showing
1 changed file
with
26 additions
and
8 deletions
@@ -82,11 +82,8 @@ | @@ -82,11 +82,8 @@ | ||
82 | <div class="form-inline" role="form" style="margin: 12px; ;"> | 82 | <div class="form-inline" role="form" style="margin: 12px; ;"> |
83 | <div class="input-group"> | 83 | <div class="input-group"> |
84 | <span class="input-group-addon">prefix:</span> | 84 | <span class="input-group-addon">prefix:</span> |
85 | - <select id="prefixInput" class="form-control"> | ||
86 | - <option value="yh:users:userInfo">yh:users:userInfo</option> | ||
87 | - <option value="yh:uic:userinfo:yohouid">yh:uic:userinfo:yohouid</option> | ||
88 | - <%--<option value="localhost:3306">Test</option>--%> | ||
89 | - </select> | 85 | + <input id="prefixInput" class="form-control"> |
86 | + </input> | ||
90 | </div> | 87 | </div> |
91 | <button id="btnSearch" class="btn btn-danger" style="margin-left: 10px" onclick="btnClear()"> | 88 | <button id="btnSearch" class="btn btn-danger" style="margin-left: 10px" onclick="btnClear()"> |
92 | 清除缓存 | 89 | 清除缓存 |
@@ -108,6 +105,16 @@ | @@ -108,6 +105,16 @@ | ||
108 | var _PAGE_REDIS_SOURCE=""; | 105 | var _PAGE_REDIS_SOURCE=""; |
109 | 106 | ||
110 | function btnClear() { | 107 | function btnClear() { |
108 | + var pre=$.trim($("#prefixInput").val()); | ||
109 | + if(pre==null||pre.length<=0){ | ||
110 | + localAlert('提示', '请求参数prefix不允许为空!'); | ||
111 | + return ; | ||
112 | + } | ||
113 | + if(!checkRate(pre.substr(0,1))){ | ||
114 | + localAlert('提示', '请求参数prefix必须以数字或字母开头!'); | ||
115 | + return ; | ||
116 | + } | ||
117 | + | ||
111 | var dialog = $("<div>").appendTo($("body")); | 118 | var dialog = $("<div>").appendTo($("body")); |
112 | dialog.dialog({ | 119 | dialog.dialog({ |
113 | title: "清除确定", | 120 | title: "清除确定", |
@@ -124,7 +131,7 @@ | @@ -124,7 +131,7 @@ | ||
124 | className: "btn-success", | 131 | className: "btn-success", |
125 | onclick: function () { | 132 | onclick: function () { |
126 | $(dialog).dialog("hide"); | 133 | $(dialog).dialog("hide"); |
127 | - goClear(); | 134 | + goClear(pre); |
128 | } | 135 | } |
129 | }] | 136 | }] |
130 | }); | 137 | }); |
@@ -132,10 +139,10 @@ | @@ -132,10 +139,10 @@ | ||
132 | 139 | ||
133 | } | 140 | } |
134 | 141 | ||
135 | - function goClear(){ | 142 | + function goClear(pre){ |
136 | var frontParam={}; | 143 | var frontParam={}; |
137 | frontParam.dataSourceInfo=_PAGE_REDIS_SOURCE; | 144 | frontParam.dataSourceInfo=_PAGE_REDIS_SOURCE; |
138 | - frontParam.keyPrefix=$.trim($("#prefixInput option:selected").val()); | 145 | + frontParam.keyPrefix=pre; |
139 | 146 | ||
140 | $.post({ | 147 | $.post({ |
141 | url: contextPath + "redisClear/clear", | 148 | url: contextPath + "redisClear/clear", |
@@ -155,6 +162,17 @@ | @@ -155,6 +162,17 @@ | ||
155 | }); | 162 | }); |
156 | } | 163 | } |
157 | 164 | ||
165 | + function checkRate(nubmer) | ||
166 | + { | ||
167 | + var re = /^[0-9a-zA-Z]*$/g; //判断字符串是否为数字和字母组合 //判断正整数 /^[1-9]+[0-9]*]*$/ | ||
168 | + if (!re.test(nubmer)) | ||
169 | + { | ||
170 | + return false; | ||
171 | + }else{ | ||
172 | + return true; | ||
173 | + } | ||
174 | + } | ||
175 | + | ||
158 | 176 | ||
159 | $(document).ready(function () { | 177 | $(document).ready(function () { |
160 | //查询redis配置信息 | 178 | //查询redis配置信息 |
-
Please register or login to post a comment