guest_show.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. {% extends "layout.html" %}
  2. {% block title %} Guest {% endblock %}
  3. {% block head %}
  4. {{ super() }}
  5. <style type="text/css">
  6. .table {
  7. font-size: 12px;
  8. border-width: 1px;
  9. line-height: 20px;
  10. }
  11. .table > thead > tr > th,
  12. .table > tfoot > tr > th {
  13. color: #999999;
  14. font-weight: normal;
  15. border-bottom: 0 solid #e1e6eb;
  16. background-color: #F5F6FA;
  17. }
  18. .table > tbody > tr > td {
  19. color: #424547;
  20. }
  21. .table-bordered > tbody > tr {
  22. padding-top: 10px;
  23. padding-bottom: 10px;
  24. height: 106px;
  25. }
  26. .table-bordered > thead > tr > th,
  27. .table-bordered > tbody > tr > th,
  28. .table-bordered > tfoot > tr > th,
  29. .table-bordered > thead > tr > td,
  30. .table-bordered > tbody > tr > td,
  31. .table-bordered > tfoot > tr > td {
  32. border-style: solid;
  33. border-width: 1px 0 0 0;
  34. }
  35. .btn,
  36. .form-control,
  37. .modal-content {
  38. border-radius: 0 !important;
  39. }
  40. .btn-shortcut {
  41. font-size: 12px !important;
  42. padding: 0 26px;
  43. }
  44. .show {
  45. display: inline-block !important;
  46. }
  47. .tr-selected td,
  48. .tr-selected {
  49. color: #000 !important;
  50. background: #fffdf4 !important;
  51. }
  52. </style>
  53. {% endblock head %}
  54. {% block content %}
  55. <script type="text/javascript">
  56. var page = 1;
  57. var page_size = 10;
  58. var keyword = '';
  59. var resource_path = window.location.pathname;
  60. var cur_url = resource_path;
  61. $(document).ready(function() {
  62. page_size = $('#page_size').val();
  63. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  64. var last_ready = null;
  65. $('#content_search').keydown(function() {
  66. if (last_ready !== null) {
  67. clearTimeout(last_ready);
  68. }
  69. last_ready = setTimeout(function () {
  70. keyword = $('#content_search').val();
  71. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  72. if (keyword.length > 0) {
  73. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  74. }
  75. window.location.href=cur_url;
  76. }, 1000);
  77. });
  78. $('#page_size').change(function () {
  79. keyword = $('#content_search').val();
  80. page_size = $('#page_size').val();
  81. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  82. if (keyword.length > 0) {
  83. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  84. }
  85. window.location.href=cur_url;
  86. });
  87. $("thead").on('click', ".all_selector", function() {
  88. if ($("thead .all_selector").is(':checked')) {
  89. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', true);
  90. $(".all_selector").prop('checked', true);
  91. } else {
  92. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', false);
  93. $(".all_selector").prop('checked', false);
  94. }
  95. select_item_action();
  96. });
  97. $("tfoot").on('click', ".all_selector", function() {
  98. if ($("tfoot .all_selector").is(':checked')) {
  99. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', true);
  100. $(".all_selector").prop('checked', true);
  101. } else {
  102. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', false);
  103. $(".all_selector").prop('checked', false);
  104. }
  105. select_item_action();
  106. });
  107. $("tbody tr").on('click', "input[type='checkbox']", function() {
  108. select_item_action();
  109. });
  110. $('body').addClass('add-transition');
  111. $('.add-page-transition').on('click', function(){
  112. var transAttr = $(this).attr('data-transition');
  113. $('.add-transition').attr('class', 'add-transition');
  114. $('.add-transition').addClass(transAttr);
  115. });
  116. $('#edit_remark_modal').on('show.bs.modal', function (me) {
  117. $('#instance_uuid').val($(me.relatedTarget).parent().parent().prev().prev().text());
  118. $('#edit_remark').val($(me.relatedTarget).prev().text());
  119. });
  120. $('#migrate_host').chosen({
  121. "disable_search": true
  122. });
  123. $('#migrate_modal').on('show.bs.modal', function (me) {
  124. $('#migrate_instance_uuid').val(
  125. $(me.relatedTarget).parent().parent().parent().parent().parent().children()[0].textContent);
  126. $.ajax({
  127. url : '/api/hosts',
  128. type : 'GET',
  129. contentType: "application/json; charset=utf-8",
  130. dataType: 'json',
  131. error : function() {
  132. },
  133. success : function(data, textStatus, xhr) {
  134. $('#migrate_host').empty();
  135. $.each(data.data, function(k, v) {
  136. $('#migrate_host').append(
  137. $('<option>', {value: v['hostname'], text: v['hostname']})
  138. );
  139. });
  140. $('#migrate_host').trigger("chosen:updated");
  141. }
  142. });
  143. });
  144. $('#reset_password_modal').on('show.bs.modal', function (me) {
  145. $('#reset_password_instance_uuid').val(
  146. $(me.relatedTarget).parent().parent().parent().parent().parent().children()[0].textContent);
  147. });
  148. });
  149. function refresh() {
  150. keyword = $('#content_search').val();
  151. page = $('#pagination li.active a').text();
  152. page_size = $('#page_size').val();
  153. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  154. if (keyword.length > 0) {
  155. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  156. }
  157. window.location.href=cur_url;
  158. }
  159. function row_onmouseover(me) {
  160. $(me).find(".edit_remark_trigger").css('display','inline-flex');
  161. }
  162. function row_onmouseout(me) {
  163. $(me).find(".edit_remark_trigger").css('display','none');
  164. }
  165. function remark_update(me) {
  166. var uuid = $('#instance_uuid').val();
  167. var remark = $('#edit_remark').val();
  168. $('#edit_remark_modal').modal('hide');
  169. $.ajax({
  170. url : '/api/guest/' + uuid,
  171. type : 'PATCH',
  172. contentType: "application/json; charset=utf-8",
  173. data : JSON.stringify({
  174. remark: remark
  175. }),
  176. error : function() {
  177. alter_danger('实例备注更新失败!');
  178. },
  179. success : function() {
  180. $('#guest_list tbody').find('td:contains(' + uuid + ')').next().next().find('p').text(remark);
  181. alter_success('实例备注更新成功!');
  182. }
  183. });
  184. }
  185. function get_selected_element(checked) {
  186. if (checked === null) {
  187. checked = true;
  188. }
  189. if (checked) {
  190. return $('tbody :checked');
  191. } else {
  192. return $('tbody input:not(:checked)');
  193. }
  194. }
  195. function highlight_selected_element() {
  196. var selected_element = get_selected_element(true);
  197. var no_selected_element = get_selected_element(false);
  198. selected_element.each(function(i, e) {
  199. $(e).parent().parent().toggleClass('tr-selected', true);
  200. });
  201. no_selected_element.each(function(i, e) {
  202. $(e).parent().parent().toggleClass('tr-selected', false);
  203. });
  204. }
  205. function shortcut_bar_enable() {
  206. var selected_element = get_selected_element(true);
  207. if (selected_element.length > 0) {
  208. $('.btn-shortcut').toggleClass('disabled', false);
  209. } else {
  210. $('.btn-shortcut').toggleClass('disabled', true);
  211. }
  212. }
  213. function select_item_action() {
  214. highlight_selected_element();
  215. shortcut_bar_enable();
  216. }
  217. function boot(uuids) {
  218. $.ajax({
  219. url : '/api/guests/_boot/' + uuids.join(','),
  220. type : 'PUT',
  221. contentType: "application/json; charset=utf-8",
  222. error : function() {
  223. alter_danger('实例启动指令发送失败!');
  224. },
  225. success : function() {
  226. alter_success('实例启动指令发送成功!');
  227. }
  228. });
  229. }
  230. function reboot(uuids) {
  231. $.ajax({
  232. url : '/api/guests/_reboot/' + uuids.join(','),
  233. type : 'PUT',
  234. contentType: "application/json; charset=utf-8",
  235. error : function() {
  236. alter_danger('实例重启指令发送失败!');
  237. },
  238. success : function() {
  239. alter_success('实例重启指令发送成功!');
  240. }
  241. });
  242. }
  243. function force_reboot(uuids) {
  244. $.ajax({
  245. url : '/api/guests/_force_reboot/' + uuids.join(','),
  246. type : 'PUT',
  247. contentType: "application/json; charset=utf-8",
  248. error : function() {
  249. alter_danger('实例强制重启指令发送失败!');
  250. },
  251. success : function() {
  252. alter_success('实例强制重启指令发送成功!');
  253. }
  254. });
  255. }
  256. function shutdown(uuids) {
  257. $.ajax({
  258. url : '/api/guests/_shutdown/' + uuids.join(','),
  259. type : 'PUT',
  260. contentType: "application/json; charset=utf-8",
  261. error : function() {
  262. alter_danger('实例停止指令发送失败!');
  263. },
  264. success : function() {
  265. alter_success('实例停止指令发送成功!');
  266. }
  267. });
  268. }
  269. function force_shutdown(uuids) {
  270. $.ajax({
  271. url : '/api/guests/_force_shutdown/' + uuids.join(','),
  272. type : 'PUT',
  273. contentType: "application/json; charset=utf-8",
  274. error : function() {
  275. alter_danger('实例强制停止指令发送失败!');
  276. },
  277. success : function() {
  278. alter_success('实例强制停止指令发送成功!');
  279. }
  280. });
  281. }
  282. function suspend(uuids) {
  283. $.ajax({
  284. url : '/api/guests/_suspend/' + uuids.join(','),
  285. type : 'PUT',
  286. contentType: "application/json; charset=utf-8",
  287. error : function() {
  288. alter_danger('实例暂停指令发送失败!');
  289. },
  290. success : function() {
  291. alter_success('实例暂停指令发送成功!');
  292. }
  293. });
  294. }
  295. function resume(uuids) {
  296. $.ajax({
  297. url : '/api/guests/_resume/' + uuids.join(','),
  298. type : 'PUT',
  299. contentType: "application/json; charset=utf-8",
  300. error : function() {
  301. alter_danger('实例恢复指令发送失败!');
  302. },
  303. success : function() {
  304. alter_success('实例恢复指令发送成功!');
  305. }
  306. });
  307. }
  308. function remove(uuids) {
  309. $.ajax({
  310. url : '/api/guests/' + uuids.join(','),
  311. type : 'DELETE',
  312. contentType: "application/json; charset=utf-8",
  313. error : function() {
  314. alter_danger('实例删除指令发送失败!');
  315. },
  316. success : function() {
  317. alter_success('实例删除指令发送成功!');
  318. }
  319. });
  320. }
  321. function migrate(uuids, host) {
  322. $.ajax({
  323. url : '/api/guests/_migrate/' + uuids.join(',') + '/' + host,
  324. type : 'PUT',
  325. contentType: "application/json; charset=utf-8",
  326. error : function() {
  327. alter_danger('实例迁移指令发送失败!');
  328. },
  329. success : function() {
  330. alter_success('实例迁移指令发送成功!');
  331. }
  332. });
  333. }
  334. function reset_password(uuids, password) {
  335. $.ajax({
  336. url : '/api/guests/_reset_password/' + uuids.join(',') + '/' + password,
  337. type : 'PUT',
  338. contentType: "application/json; charset=utf-8",
  339. error : function() {
  340. alter_danger('实例重置密码指令发送失败!');
  341. },
  342. success : function() {
  343. alter_success('实例重置密码指令发送成功!');
  344. }
  345. });
  346. }
  347. function boot_at(me) {
  348. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  349. boot([uuid]);
  350. }
  351. function reboot_at(me) {
  352. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  353. reboot([uuid]);
  354. }
  355. function force_reboot_at(me) {
  356. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  357. force_reboot([uuid]);
  358. }
  359. function shutdown_at(me) {
  360. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  361. shutdown([uuid]);
  362. }
  363. function force_shutdown_at(me) {
  364. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  365. force_shutdown([uuid]);
  366. }
  367. function suspend_at(me) {
  368. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  369. suspend([uuid]);
  370. }
  371. function resume_at(me) {
  372. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  373. resume([uuid]);
  374. }
  375. function delete_at(me) {
  376. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  377. remove([uuid]);
  378. }
  379. function migrate_go() {
  380. var migrate_type = $('#migrate_type').val();
  381. var uuids = [];
  382. if (migrate_type === 'single') {
  383. uuids = [$('#migrate_instance_uuid').val()];
  384. } else {
  385. uuids = get_checked_uuids();
  386. }
  387. var host = $('#migrate_host').val();
  388. $('#migrate_modal').modal('hide');
  389. migrate([uuids], host);
  390. }
  391. function reset_password_go() {
  392. var migrate_type = $('#reset_password_type').val();
  393. var uuids = [];
  394. if (migrate_type === 'single') {
  395. uuids = [$('#reset_password_instance_uuid').val()];
  396. } else {
  397. uuids = get_checked_uuids();
  398. }
  399. var password = $('#new_password').val();
  400. $('#reset_password_modal').modal('hide');
  401. reset_password([uuids], password);
  402. }
  403. function get_selected_uuids() {
  404. var selected_element = get_selected_element(true);
  405. var uuids = [];
  406. selected_element.each(function(i, e) {
  407. var uuid = $(e).parent().prev().text();
  408. uuids.push(uuid);
  409. });
  410. return uuids;
  411. }
  412. function get_checked_uuids() {
  413. var uuids = get_selected_uuids();
  414. if (uuids.length < 1) {
  415. alter_warning('未选择任何可操作的实例!');
  416. return false;
  417. }
  418. return uuids;
  419. }
  420. function batch_boot() {
  421. var uuids = get_checked_uuids();
  422. if (uuids) {
  423. boot(uuids);
  424. }
  425. }
  426. function batch_reboot() {
  427. var uuids = get_checked_uuids();
  428. if (uuids) {
  429. reboot(uuids);
  430. }
  431. }
  432. function batch_force_reboot() {
  433. var uuids = get_checked_uuids();
  434. if (uuids) {
  435. force_reboot(uuids);
  436. }
  437. }
  438. function batch_shutdown() {
  439. var uuids = get_checked_uuids();
  440. if (uuids) {
  441. shutdown(uuids);
  442. }
  443. }
  444. function batch_force_shutdown() {
  445. var uuids = get_checked_uuids();
  446. if (uuids) {
  447. force_shutdown(uuids);
  448. }
  449. }
  450. function batch_suspend() {
  451. var uuids = get_checked_uuids();
  452. if (uuids) {
  453. suspend(uuids);
  454. }
  455. }
  456. function batch_resume() {
  457. var uuids = get_checked_uuids();
  458. if (uuids) {
  459. resume(uuids);
  460. }
  461. }
  462. function batch_delete() {
  463. var uuids = get_checked_uuids();
  464. if (uuids) {
  465. remove(uuids);
  466. }
  467. }
  468. </script>
  469. <div class="panel">
  470. <div class="panel-body">
  471. <h3 class="title-hero" style="font-size: 24px;">
  472. 虚拟机实例
  473. </h3>
  474. <div>
  475. <div id="datatable-row-highlight_wrapper" class="dataTables_wrapper form-inline">
  476. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  477. <div class="col-sm-12" style="padding-right: 0;">
  478. <div id="datatable-row-highlight_filter" class="dataTables_filter" style="display: inline-block;">
  479. <input id="content_search" type="search" class="form-control" placeholder="模糊搜索..." value="{%- if keyword -%} {{ keyword }} {%- endif -%}" style="margin-left: 0; border-radius: 0;">
  480. </div>
  481. <div class="pull-right">
  482. <button class="btn btn-default" onclick="refresh()" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  483. <a class="btn btn-info add-page-transition" href="/guests/create" data-transition="pt-page-moveFromRight-init" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">创建实例</a>
  484. </div>
  485. </div>
  486. </div>
  487. <table id="guest_list" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid"
  488. style="width: 100%; margin-bottom: 0; border-bottom-width: 0;">
  489. <thead>
  490. <tr role="row">
  491. <th style="display: none;">UUID</th>
  492. <th><input class="all_selector" title="选取所有" type="checkbox"></th>
  493. <th width="180px;">名称</th>
  494. <th></th>
  495. <th>状态</th>
  496. <th>计算节点</th>
  497. <th>配置</th>
  498. <th>IP</th>
  499. <th>密码</th>
  500. <th>创建时间</th>
  501. <th>操作</th>
  502. </tr>
  503. </thead>
  504. <tbody>
  505. {% for item in guests_ret.data %}
  506. <tr role="row" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">
  507. <td style="display: none;">{{ item.uuid }}</td>
  508. <td><input title="选中" type="checkbox"></td>
  509. <td>
  510. <div>
  511. <a href="javascript:;">{{ item.label }}</a>
  512. </div>
  513. <div>
  514. <p style="display: inline-block;">{{ item.remark }}</p>
  515. <a href="javascript:;" class="edit_remark_trigger" data-toggle="modal" data-target="#edit_remark_modal" style="display: none; float: right;">
  516. <span class="glyph-icon icon-elusive-pencil" style="width: 20px; height: 20px; margin-left: 10px; border-radius: 0; border: 1px solid rgb(220, 233, 255); background-color: #ffffff;"></span>
  517. </a>
  518. </div>
  519. </td>
  520. <td><span class="{{ os_template_mapping_by_id[item.os_template_id].icon }}"></span></td>
  521. <td>{{ format_guest_status(item.status)|safe }}</td>
  522. <td>{{ item.on_host }}</td>
  523. <td>CPU :&nbsp;&nbsp;{{ item.cpu }}&nbsp;核<br />内存 :&nbsp;&nbsp;{{ item.memory }}&nbsp;GB</td>
  524. <td>{{ item.ip }}</td>
  525. <td>{{ item.password }}</td>
  526. <td>{{ format_datetime_by_tus(item.create_time) }}</td>
  527. <td>
  528. <div class="dropdown inline-block">
  529. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
  530. 更多
  531. </a>
  532. <ul class="dropdown-menu">
  533. <li class="{% if item.status not in [4, 5, 6] %} disabled {% endif %}">
  534. <a href="javascript:;" onclick="boot_at(this);">启动</a>
  535. </li>
  536. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  537. <a href="javascript:;" onclick="reboot_at(this);">重启</a>
  538. </li>
  539. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  540. <a href="javascript:;" onclick="force_reboot_at(this);">强制重启</a>
  541. </li>
  542. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  543. <a href="javascript:;" onclick="shutdown_at(this);">停止</a>
  544. </li>
  545. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  546. <a href="javascript:;" onclick="force_shutdown_at(this);">强制停止</a>
  547. </li>
  548. <li class="divider"></li>
  549. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  550. <a href="javascript:;" onclick="suspend_at(this);">暂停</a>
  551. </li>
  552. <li class="{% if item.status not in [3] %} disabled {% endif %}">
  553. <a href="javascript:;" onclick="resume_at(this);">恢复</a>
  554. </li>
  555. <li class="divider"></li>
  556. <li class="">
  557. <a href="/guest/vnc/{{ item.uuid }}" target="_blank">远程连接</a>
  558. </li>
  559. <li class="divider"></li>
  560. <li class="">
  561. <a href="javascript:;" data-toggle="modal" data-target="#reset_password_modal"
  562. onclick="$('#reset_password_type').val('single')">
  563. 密码重置
  564. </a>
  565. </li>
  566. <li class="{% if item.status not in [1, 3, 4, 5, 6] %} disabled {% endif %}">
  567. <a href="javascript:;" data-toggle="modal" data-target="#migrate_modal"
  568. onclick="$('#migrate_type').val('single')">
  569. 迁移到
  570. </a>
  571. </li>
  572. <li class="divider"></li>
  573. <li class="{% if item.status not in [4, 5, 6, 255] %} disabled {% endif %}">
  574. <a href="javascript:;" onclick="delete_at(this);">删除</a>
  575. </li>
  576. </ul>
  577. </div>
  578. </td>
  579. </tr>
  580. {% endfor %}
  581. </tbody>
  582. </table>
  583. <table class="table table-bordered" style="border-top-width: 0; z-index: 99; position: sticky; bottom: 0;">
  584. <tfoot>
  585. <tr style="height: 70px;">
  586. <th><input type="checkbox" title="选取所有" class="all_selector"></th>
  587. <th>
  588. <div class="row">
  589. <div class="col-sm-6">
  590. <button class="btn btn-default btn-shortcut disabled" onclick="batch_boot();">启动</button>
  591. <button class="btn btn-default btn-shortcut disabled" onclick="batch_reboot();">重启</button>
  592. <button class="btn btn-default btn-shortcut disabled" onclick="batch_shutdown();">停止</button>
  593. <button class="btn btn-default btn-shortcut disabled" onclick="batch_suspend();">暂停</button>
  594. <button class="btn btn-default btn-shortcut disabled" onclick="batch_resume();">恢复</button>
  595. <div class="dropup inline-block">
  596. <button href="javascript:;" class="dropdown-toggle btn btn-default btn-shortcut disabled" data-toggle="dropdown">
  597. 更多
  598. </button>
  599. <ul class="dropdown-menu" style="width: 60px;">
  600. <li>
  601. <a href="javascript:;" onclick="batch_delete();">删除</a>
  602. </li>
  603. <li class="divider"></li>
  604. <li>
  605. <a href="javascript:;" onclick="$('#migrate_type').val('batch');"
  606. data-toggle="modal" data-target="#migrate_modal" >
  607. 迁移到
  608. </a>
  609. </li>
  610. <li>
  611. <a href="javascript:;" onclick="$('#reset_password_type').val('batch');"
  612. data-toggle="modal" data-target="#reset_password_modal">
  613. 密码重置
  614. </a>
  615. </li>
  616. <li class="divider"></li>
  617. <li>
  618. <a href="javascript:;" onclick="batch_force_shutdown();">强制停止</a>
  619. </li>
  620. <li>
  621. <a href="javascript:;" onclick="batch_force_reboot();">强制重启</a>
  622. </li>
  623. </ul>
  624. </div>
  625. </div>
  626. <div class="col-sm-3" style="font-size: 12px; padding-top: 5px; text-align: right;">
  627. 共有{{ guests_ret.paging.total }}条,每页显示:
  628. <select id="page_size" name="datatable-row-highlight_length" title="page_size" class="form-control" style="height: 22px; vertical-align: baseline;">
  629. <option value="10" {% if page_size == 10 %} selected {% endif %}>10</option>
  630. <option value="20" {% if page_size == 20 %} selected {% endif %}>20</option>
  631. <option value="50" {% if page_size == 50 %} selected {% endif %}>50</option>
  632. </select>&nbsp;&nbsp;条
  633. </div>
  634. <div class="col-sm-3" style="text-align: left;">
  635. <div class="dataTables_paginate paging_bootstrap" id="datatable-row-highlight_paginate">
  636. <ul id="pagination" class="pagination">
  637. <li class="{% if page == 1 %} disabled {% endif %}">
  638. <a href="{{ resource_path }}?page={{ page - 1 }}&page_size={{ page_size }}{% if keyword %}&keyword={{ keyword }}{% endif %}">«</a>
  639. </li>
  640. {% for item in pages %}
  641. <li class="{% if item == page %} active {% endif %}">
  642. <a href="{{ resource_path }}?page={{ item }}&page_size={{ page_size }}{% if keyword %}&keyword={{ keyword }}{% endif %}">{{ item }}</a>
  643. </li>
  644. {% endfor %}
  645. <li class="{% if page == last_page %} disabled {% endif %}">
  646. <a href="{{ resource_path }}?page={{ page + 1 }}&page_size={{ page_size }}{% if keyword %}&keyword={{ keyword }}{% endif %}">»</a>
  647. </li>
  648. </ul>
  649. </div>
  650. </div>
  651. </div>
  652. </th>
  653. </tr>
  654. </tfoot>
  655. </table>
  656. </div>
  657. </div>
  658. </div>
  659. </div>
  660. <div class="modal" id="edit_remark_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  661. <div class="modal-dialog modal-sm">
  662. <div class="modal-content">
  663. <div class="modal-header">
  664. <h4 class="modal-title">编辑实例名称:</h4>
  665. </div>
  666. <div class="modal-body">
  667. <input id="instance_uuid" title="实例 UUID" class="form-control" name="uuid" hidden>
  668. <input id="edit_remark" title="实例名称" class="form-control" name="remark">
  669. </div>
  670. <div class="modal-footer">
  671. <button type="button" class="btn btn-sm btn-primary" onclick="remark_update();">确定</button>
  672. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  673. </div>
  674. </div>
  675. </div>
  676. </div>
  677. <div class="modal" id="migrate_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  678. <div class="modal-dialog modal-sm">
  679. <div class="modal-content">
  680. <div class="modal-header">
  681. <h4 class="modal-title">实例迁移至:</h4>
  682. </div>
  683. <div class="modal-body">
  684. <input id="migrate_type" title="迁移类型" class="form-control" name="migrate_type" value="single" hidden>
  685. <input id="migrate_instance_uuid" title="实例 UUID" class="form-control" name="uuid" hidden>
  686. <select id="migrate_host" name="migrate_host" title="可迁移宿主机" class="chosen-select">
  687. </select>
  688. </div>
  689. <div class="modal-footer">
  690. <button type="button" class="btn btn-sm btn-primary" onclick="migrate_go();">确定</button>
  691. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  692. </div>
  693. </div>
  694. </div>
  695. </div>
  696. <div class="modal" id="reset_password_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  697. <div class="modal-dialog modal-sm">
  698. <div class="modal-content">
  699. <div class="modal-header">
  700. <h4 class="modal-title">重置密码:</h4>
  701. </div>
  702. <div class="modal-body">
  703. <div class="form-group">
  704. <input id="reset_password_type" title="重置密码类型" class="form-control" name="reset_password_type" value="single" hidden>
  705. <input id="reset_password_instance_uuid" title="实例 UUID" class="form-control" name="uuid" hidden>
  706. <input id="new_password" title="新密码" class="form-control" name="new_password" type="password" placeholder="New password">
  707. </div>
  708. </div>
  709. <div class="modal-footer">
  710. <button type="button" class="btn btn-sm btn-primary" onclick="reset_password_go();">确定</button>
  711. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  712. </div>
  713. </div>
  714. </div>
  715. </div>
  716. {% endblock content %}