Showing
1 changed file
with
148 additions
and
39 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 | + } | ||
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){ | ||
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 | + } | ||
192 | }); | 269 | }); |
193 | - $('#confirmSubmitDivId').modal('show'); | ||
194 | } | 270 | } |
195 | 271 | ||
196 | function submit(){ | 272 | function submit(){ |
@@ -209,19 +285,12 @@ | @@ -209,19 +285,12 @@ | ||
209 | dataType: 'json', | 285 | dataType: 'json', |
210 | success: function (resp) { | 286 | success: function (resp) { |
211 | if(resp.code == 200){ | 287 | if(resp.code == 200){ |
212 | - $('#confirmSubmitDivId').modal('hide'); | ||
213 | - $("#detail-div").empty(); | ||
214 | - for (var i = 0; i < array.length; i++) { | ||
215 | - $("#" + array[i] + "-btn").removeClass("btn-success"); | ||
216 | - } | ||
217 | - for (var j = 0; j < array_next.length; j++) { | ||
218 | - $("#" + array_next[j] + "-btn").removeClass("btn-success"); | ||
219 | - } | ||
220 | - $("#java-btn").removeClass("btn-success"); | ||
221 | - $("#java_next-btn").removeClass("btn-success"); | ||
222 | - | ||
223 | - switchWait = toWait("正在切换(目标DC),请耐心等候..."); | ||
224 | - doExe(array, 0, toCloud); | 288 | + $("#tokenID").val(resp.data); |
289 | + $("#reconfirm_tocloud").val(toCloud); | ||
290 | + $('#second_confirm_model').modal({ | ||
291 | + keyboard: false, | ||
292 | + backdrop:'static' | ||
293 | + }); | ||
225 | }else{ | 294 | }else{ |
226 | alert("短信验证码错误或者失效"); | 295 | alert("短信验证码错误或者失效"); |
227 | } | 296 | } |
@@ -231,6 +300,24 @@ | @@ -231,6 +300,24 @@ | ||
231 | }); | 300 | }); |
232 | } | 301 | } |
233 | 302 | ||
303 | + function reConfirmSwitchSubmit(){ | ||
304 | + var toCloud = $("input[name='cloud_name']").val(); | ||
305 | + $('#second_confirm_model').modal('hide'); | ||
306 | + $('#confirmSubmitDivId').modal('hide'); | ||
307 | + $("#detail-div").empty(); | ||
308 | + for (var i = 0; i < array.length; i++) { | ||
309 | + $("#" + array[i] + "-btn").removeClass("btn-success"); | ||
310 | + } | ||
311 | + for (var j = 0; j < array_next.length; j++) { | ||
312 | + $("#" + array_next[j] + "-btn").removeClass("btn-success"); | ||
313 | + } | ||
314 | + $("#java-btn").removeClass("btn-success"); | ||
315 | + $("#java_next-btn").removeClass("btn-success"); | ||
316 | + | ||
317 | + switchWait = toWait("正在切换(目标DC),请耐心等候..."); | ||
318 | + doExe(array, 0, toCloud); | ||
319 | + } | ||
320 | + | ||
234 | var switchWait; | 321 | var switchWait; |
235 | //执行切换 | 322 | //执行切换 |
236 | function doExe(array, i,commond) { | 323 | function doExe(array, i,commond) { |
@@ -240,26 +327,37 @@ | @@ -240,26 +327,37 @@ | ||
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) { |
248 | - $("#"+name+"-btn").removeClass("btn-warning"); | ||
249 | - $("#"+name+"-btn").addClass("btn-success"); | ||
250 | - var div = "<div class=\"alert alert-info alert-block\">"; | ||
251 | - div = div + "<h4 class=\"alert-heading\">" + name + "</h4>"; | ||
252 | - div = div + resp.data + "</div>"; | ||
253 | - $("#detail-div").append(div); | ||
254 | - i++; | ||
255 | - if(i < array.length){ | ||
256 | - doExe(array,i,commond); | 336 | + if(resp.code == 200){ |
337 | + $("#"+name+"-btn").removeClass("btn-warning"); | ||
338 | + $("#"+name+"-btn").addClass("btn-success"); | ||
339 | + var div = "<div class=\"alert alert-info alert-block\">"; | ||
340 | + div = div + "<h4 class=\"alert-heading\">" + name + "</h4>"; | ||
341 | + div = div + resp.data + "</div>"; | ||
342 | + $("#detail-div").append(div); | ||
343 | + i++; | ||
344 | + if(i < array.length){ | ||
345 | + doExe(array,i,commond); | ||
346 | + }else{ | ||
347 | + switchWait.modal('hide'); | ||
348 | + | ||
349 | + //重启java | ||
350 | + javaRestart(commond); | ||
351 | + } | ||
257 | }else{ | 352 | }else{ |
258 | - switchWait.modal('hide'); | 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); | ||
259 | 357 | ||
260 | - //重启java | ||
261 | - javaRestart(commond); | 358 | + switchWait.modal('hide'); |
262 | } | 359 | } |
360 | + | ||
263 | }, | 361 | }, |
264 | error: function () { | 362 | error: function () { |
265 | var div = "<div>切换(目标DC)请求异常</div>"; | 363 | var div = "<div>切换(目标DC)请求异常</div>"; |
@@ -318,26 +416,37 @@ | @@ -318,26 +416,37 @@ | ||
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) { |
326 | - $("#"+name+"-btn").removeClass("btn-warning"); | ||
327 | - $("#"+name+"-btn").addClass("btn-success"); | ||
328 | - var div = "<div class=\"alert alert-info alert-block\">"; | ||
329 | - div = div + "<h4 class=\"alert-heading\">" + name + "</h4>"; | ||
330 | - div = div + resp.data + "</div>"; | ||
331 | - $("#detail-div").append(div); | ||
332 | - i++; | ||
333 | - if(i < array_next.length){ | ||
334 | - doExeNext(array_next,i,commond); | 425 | + if(resp.code == 200){ |
426 | + $("#"+name+"-btn").removeClass("btn-warning"); | ||
427 | + $("#"+name+"-btn").addClass("btn-success"); | ||
428 | + var div = "<div class=\"alert alert-info alert-block\">"; | ||
429 | + div = div + "<h4 class=\"alert-heading\">" + name + "</h4>"; | ||
430 | + div = div + resp.data + "</div>"; | ||
431 | + $("#detail-div").append(div); | ||
432 | + i++; | ||
433 | + if(i < array_next.length){ | ||
434 | + doExeNext(array_next,i,commond); | ||
435 | + }else{ | ||
436 | + switchWait.modal('hide'); | ||
437 | + | ||
438 | + //重启java | ||
439 | + javaRestartNext(commond); | ||
440 | + } | ||
335 | }else{ | 441 | }else{ |
336 | - switchWait.modal('hide'); | 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); | ||
337 | 446 | ||
338 | - //重启java | ||
339 | - javaRestartNext(commond); | 447 | + switchWait.modal('hide'); |
340 | } | 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