guest_show.html 32 KB

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