Showing
1 changed file
with
117 additions
and
8 deletions
@@ -83,6 +83,9 @@ | @@ -83,6 +83,9 @@ | ||
83 | <button class="btn btn-large btn-primary" id="toqq-btn" onclick="toDoExe('toQcloud')"> | 83 | <button class="btn btn-large btn-primary" id="toqq-btn" onclick="toDoExe('toQcloud')"> |
84 | 所有流量切向qq | 84 | 所有流量切向qq |
85 | </button> | 85 | </button> |
86 | + <button class="btn btn-large btn-primary" id="toqq-withmysql-btn" onclick="toDoExeWithMysql('toQcloud')"> | ||
87 | + 所有流量切向qq(包括mysql) | ||
88 | + </button> | ||
86 | </div> | 89 | </div> |
87 | </div> | 90 | </div> |
88 | <div class="panel"> | 91 | <div class="panel"> |
@@ -90,7 +93,7 @@ | @@ -90,7 +93,7 @@ | ||
90 | <h4 style="display: inline">切换流程</h4> | 93 | <h4 style="display: inline">切换流程</h4> |
91 | </div> | 94 | </div> |
92 | <div class="panel-body"> | 95 | <div class="panel-body"> |
93 | - <button class="btn btn-large" id="switch_mysql-btn" style="background-color: green">mysql</button> | 96 | + <button class="btn btn-large" id="switch_mysql-btn">mysql</button> |
94 | ===》 | 97 | ===》 |
95 | <button class="btn btn-large" id="switch_redis-btn">redis(目标DC)</button> | 98 | <button class="btn btn-large" id="switch_redis-btn">redis(目标DC)</button> |
96 | ===》 | 99 | ===》 |
@@ -156,6 +159,24 @@ | @@ -156,6 +159,24 @@ | ||
156 | </div> | 159 | </div> |
157 | </div> | 160 | </div> |
158 | </div> | 161 | </div> |
162 | +<div id="second_confirm_model" class="modal"tabindex="-1" role="dialog" style="padding-top: 12%"> | ||
163 | + <div class="modal-dialog modal-sm"> | ||
164 | + <div class="modal-content"> | ||
165 | + <div class="modal-header"> | ||
166 | + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> | ||
167 | + <h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> <span class="title" style="font-weight: bold;">再次确认</span></h5> | ||
168 | + </div> | ||
169 | + <div class="modal-body small"> | ||
170 | + <p ><span class="message">确定执行切换?</span></p><input type="text" disabled id="reconfirm_tocloud"/> | ||
171 | + <input type="hidden" id="tokenID"> | ||
172 | + </div> | ||
173 | + <div class="modal-footer" > | ||
174 | + <button type="button" class="btn btn-primary ok" onclick="reConfirmSwitchSubmit()">确认</button> | ||
175 | + <button type="button" class="btn btn-default cancel" data-dismiss="modal">取消</button> | ||
176 | + </div> | ||
177 | + </div> | ||
178 | + </div> | ||
179 | +</div> | ||
159 | 180 | ||
160 | 181 | ||
161 | <script src="<%=basePath %>script/common/genarate_left_panel.js"></script> | 182 | <script src="<%=basePath %>script/common/genarate_left_panel.js"></script> |
@@ -169,6 +190,7 @@ | @@ -169,6 +190,7 @@ | ||
169 | var array = new Array(); | 190 | var array = new Array(); |
170 | var array_next = new Array(); | 191 | var array_next = new Array(); |
171 | $(document).ready(function () { | 192 | $(document).ready(function () { |
193 | + array.push("switch_mysql"); | ||
172 | array.push("switch_redis"); | 194 | array.push("switch_redis"); |
173 | array.push("switch_internel_dns"); | 195 | array.push("switch_internel_dns"); |
174 | array.push("switch_cobar"); | 196 | array.push("switch_cobar"); |
@@ -182,6 +204,14 @@ | @@ -182,6 +204,14 @@ | ||
182 | 204 | ||
183 | //执行切换 | 205 | //执行切换 |
184 | function toDoExe(toCloud) { | 206 | function toDoExe(toCloud) { |
207 | + array.splice(0,array.length);//清空数组 | ||
208 | + //array.push("switch_mysql"); | ||
209 | + array.push("switch_redis"); | ||
210 | + array.push("switch_internel_dns"); | ||
211 | + array.push("switch_cobar"); | ||
212 | + array.push("switch_lua"); | ||
213 | + array.push("switch_dnspod"); | ||
214 | + | ||
185 | switchWait = null; | 215 | switchWait = null; |
186 | $("input[name='cloud_name']").val(toCloud); | 216 | $("input[name='cloud_name']").val(toCloud); |
187 | $("input[name='sms_name']").val(''); | 217 | $("input[name='sms_name']").val(''); |
@@ -189,8 +219,54 @@ | @@ -189,8 +219,54 @@ | ||
189 | type: 'post', | 219 | type: 'post', |
190 | url: contextPath + "/centerSwitch/doExeAndCheckBefore", | 220 | url: contextPath + "/centerSwitch/doExeAndCheckBefore", |
191 | dataType: 'json', | 221 | dataType: 'json', |
222 | + success: function (resp) { | ||
223 | + if(resp.code == 200){ | ||
224 | + $('#confirmSubmitDivId').modal('show'); | ||
225 | + }else{ | ||
226 | + var errorMsg="发送短信验证码异常"; | ||
227 | + if(resp.message){ | ||
228 | + errorMsg=resp.message; | ||
229 | + } | ||
230 | + alert(errorMsg); | ||
231 | + } | ||
232 | + }, | ||
233 | + error: function () { | ||
234 | + alert("发送短信验证码失败"); | ||
235 | + } | ||
192 | }); | 236 | }); |
237 | + } | ||
238 | + | ||
239 | + function toDoExeWithMysql(toCloud){ | ||
240 | + array.splice(0,array.length);//清空数组 | ||
241 | + array.push("switch_mysql"); | ||
242 | + array.push("switch_redis"); | ||
243 | + array.push("switch_internel_dns"); | ||
244 | + array.push("switch_cobar"); | ||
245 | + array.push("switch_lua"); | ||
246 | + array.push("switch_dnspod"); | ||
247 | + | ||
248 | + switchWait = null; | ||
249 | + $("input[name='cloud_name']").val(toCloud); | ||
250 | + $("input[name='sms_name']").val(''); | ||
251 | + $.ajax({ | ||
252 | + type: 'post', | ||
253 | + url: contextPath + "/centerSwitch/doExeAndCheckBefore", | ||
254 | + dataType: 'json', | ||
255 | + success: function (resp) { | ||
256 | + if(resp.code == 200){ | ||
193 | $('#confirmSubmitDivId').modal('show'); | 257 | $('#confirmSubmitDivId').modal('show'); |
258 | + }else{ | ||
259 | + var errorMsg="发送短信验证码异常"; | ||
260 | + if(resp.message){ | ||
261 | + errorMsg=resp.message; | ||
262 | + } | ||
263 | + alert(errorMsg); | ||
264 | + } | ||
265 | + }, | ||
266 | + error: function () { | ||
267 | + alert("发送短信验证码失败"); | ||
268 | + } | ||
269 | + }); | ||
194 | } | 270 | } |
195 | 271 | ||
196 | function submit(){ | 272 | function submit(){ |
@@ -209,6 +285,24 @@ | @@ -209,6 +285,24 @@ | ||
209 | dataType: 'json', | 285 | dataType: 'json', |
210 | success: function (resp) { | 286 | success: function (resp) { |
211 | if(resp.code == 200){ | 287 | if(resp.code == 200){ |
288 | + $("#tokenID").val(resp.data); | ||
289 | + $("#reconfirm_tocloud").val(toCloud); | ||
290 | + $('#second_confirm_model').modal({ | ||
291 | + keyboard: false, | ||
292 | + backdrop:'static' | ||
293 | + }); | ||
294 | + }else{ | ||
295 | + alert("短信验证码错误或者失效"); | ||
296 | + } | ||
297 | + }, | ||
298 | + error: function () { | ||
299 | + } | ||
300 | + }); | ||
301 | + } | ||
302 | + | ||
303 | + function reConfirmSwitchSubmit(){ | ||
304 | + var toCloud = $("input[name='cloud_name']").val(); | ||
305 | + $('#second_confirm_model').modal('hide'); | ||
212 | $('#confirmSubmitDivId').modal('hide'); | 306 | $('#confirmSubmitDivId').modal('hide'); |
213 | $("#detail-div").empty(); | 307 | $("#detail-div").empty(); |
214 | for (var i = 0; i < array.length; i++) { | 308 | for (var i = 0; i < array.length; i++) { |
@@ -222,13 +316,6 @@ | @@ -222,13 +316,6 @@ | ||
222 | 316 | ||
223 | switchWait = toWait("正在切换(目标DC),请耐心等候..."); | 317 | switchWait = toWait("正在切换(目标DC),请耐心等候..."); |
224 | doExe(array, 0, toCloud); | 318 | doExe(array, 0, toCloud); |
225 | - }else{ | ||
226 | - alert("短信验证码错误或者失效"); | ||
227 | - } | ||
228 | - }, | ||
229 | - error: function () { | ||
230 | - } | ||
231 | - }); | ||
232 | } | 319 | } |
233 | 320 | ||
234 | var switchWait; | 321 | var switchWait; |
@@ -240,11 +327,13 @@ | @@ -240,11 +327,13 @@ | ||
240 | type: 'post', | 327 | type: 'post', |
241 | url: contextPath + "/centerSwitch/doExeAndCheck", | 328 | url: contextPath + "/centerSwitch/doExeAndCheck", |
242 | data: { | 329 | data: { |
330 | + 'tokenID':$("#tokenID").val(), | ||
243 | 'name': name, | 331 | 'name': name, |
244 | 'exe': commond | 332 | 'exe': commond |
245 | }, | 333 | }, |
246 | dataType: 'json', | 334 | dataType: 'json', |
247 | success: function (resp) { | 335 | success: function (resp) { |
336 | + if(resp.code == 200){ | ||
248 | $("#"+name+"-btn").removeClass("btn-warning"); | 337 | $("#"+name+"-btn").removeClass("btn-warning"); |
249 | $("#"+name+"-btn").addClass("btn-success"); | 338 | $("#"+name+"-btn").addClass("btn-success"); |
250 | var div = "<div class=\"alert alert-info alert-block\">"; | 339 | var div = "<div class=\"alert alert-info alert-block\">"; |
@@ -260,6 +349,15 @@ | @@ -260,6 +349,15 @@ | ||
260 | //重启java | 349 | //重启java |
261 | javaRestart(commond); | 350 | javaRestart(commond); |
262 | } | 351 | } |
352 | + }else{ | ||
353 | + var div = "<div class=\"alert alert-warning alert-block\">"; | ||
354 | + div = div + "<h4 class=\"alert-heading\">" + name + "</h4>"; | ||
355 | + div = div + "发生异常:"+resp.message + "</div>"; | ||
356 | + $("#detail-div").append(div); | ||
357 | + | ||
358 | + switchWait.modal('hide'); | ||
359 | + } | ||
360 | + | ||
263 | }, | 361 | }, |
264 | error: function () { | 362 | error: function () { |
265 | var div = "<div>切换(目标DC)请求异常</div>"; | 363 | var div = "<div>切换(目标DC)请求异常</div>"; |
@@ -318,11 +416,13 @@ | @@ -318,11 +416,13 @@ | ||
318 | type: 'post', | 416 | type: 'post', |
319 | url: contextPath + "/centerSwitch/doExeAndCheck", | 417 | url: contextPath + "/centerSwitch/doExeAndCheck", |
320 | data: { | 418 | data: { |
419 | + 'tokenID':$("#tokenID").val(), | ||
321 | 'name': name, | 420 | 'name': name, |
322 | 'exe': commond | 421 | 'exe': commond |
323 | }, | 422 | }, |
324 | dataType: 'json', | 423 | dataType: 'json', |
325 | success: function (resp) { | 424 | success: function (resp) { |
425 | + if(resp.code == 200){ | ||
326 | $("#"+name+"-btn").removeClass("btn-warning"); | 426 | $("#"+name+"-btn").removeClass("btn-warning"); |
327 | $("#"+name+"-btn").addClass("btn-success"); | 427 | $("#"+name+"-btn").addClass("btn-success"); |
328 | var div = "<div class=\"alert alert-info alert-block\">"; | 428 | var div = "<div class=\"alert alert-info alert-block\">"; |
@@ -338,6 +438,15 @@ | @@ -338,6 +438,15 @@ | ||
338 | //重启java | 438 | //重启java |
339 | javaRestartNext(commond); | 439 | javaRestartNext(commond); |
340 | } | 440 | } |
441 | + }else{ | ||
442 | + var div = "<div class=\"alert alert-warning alert-block\">"; | ||
443 | + div = div + "<h4 class=\"alert-heading\">" + name + "</h4>"; | ||
444 | + div = div + "发生异常:"+resp.message + "</div>"; | ||
445 | + $("#detail-div").append(div); | ||
446 | + | ||
447 | + switchWait.modal('hide'); | ||
448 | + } | ||
449 | + | ||
341 | }, | 450 | }, |
342 | error: function () { | 451 | error: function () { |
343 | var div = "<div>切换(源DC)请求异常</div>"; | 452 | var div = "<div>切换(源DC)请求异常</div>"; |
-
Please register or login to post a comment