guest_show.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  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 cur_url = '/guests';
  60. $(document).ready(function() {
  61. page_size = $('#page_size').val();
  62. cur_url = '/guests?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 = '/guests?page=' + page + '&page_size=' + page_size;
  71. if (keyword.length > 0) {
  72. cur_url = '/guests?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 = '/guests?page=' + page + '&page_size=' + page_size;
  81. if (keyword.length > 0) {
  82. cur_url = '/guests?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. });
  144. function refresh() {
  145. keyword = $('#content_search').val();
  146. page = $('#pagination li.active a').text();
  147. page_size = $('#page_size').val();
  148. cur_url = '/guests?page=' + page + '&page_size=' + page_size;
  149. if (keyword.length > 0) {
  150. cur_url = '/guests?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  151. }
  152. window.location.href=cur_url;
  153. }
  154. function row_onmouseover(me) {
  155. $(me).find(".edit_remark_trigger").css('display','inline-flex');
  156. }
  157. function row_onmouseout(me) {
  158. $(me).find(".edit_remark_trigger").css('display','none');
  159. }
  160. function remark_update(me) {
  161. var uuid = $('#instance_uuid').val();
  162. var remark = $('#edit_remark').val();
  163. $('#edit_remark_modal').modal('hide');
  164. $.ajax({
  165. url : '/api/guest/' + uuid,
  166. type : 'PATCH',
  167. contentType: "application/json; charset=utf-8",
  168. data : JSON.stringify({
  169. remark: remark
  170. }),
  171. error : function() {
  172. alter_danger('实例备注更新失败!');
  173. },
  174. success : function() {
  175. $('#guest_list tbody').find('td:contains(' + uuid + ')').next().next().find('p').text(remark);
  176. alter_success('实例备注更新成功!');
  177. }
  178. });
  179. }
  180. function get_selected_element(checked) {
  181. if (checked === null) {
  182. checked = true;
  183. }
  184. if (checked) {
  185. return $('tbody :checked');
  186. } else {
  187. return $('tbody input:not(:checked)');
  188. }
  189. }
  190. function highlight_selected_element() {
  191. var selected_element = get_selected_element(true);
  192. var no_selected_element = get_selected_element(false);
  193. selected_element.each(function(i, e) {
  194. $(e).parent().parent().toggleClass('tr-selected', true);
  195. });
  196. no_selected_element.each(function(i, e) {
  197. $(e).parent().parent().toggleClass('tr-selected', false);
  198. });
  199. }
  200. function shortcut_bar_enable() {
  201. var selected_element = get_selected_element(true);
  202. if (selected_element.length > 0) {
  203. $('.btn-shortcut').toggleClass('disabled', false);
  204. } else {
  205. $('.btn-shortcut').toggleClass('disabled', true);
  206. }
  207. }
  208. function select_item_action() {
  209. highlight_selected_element();
  210. shortcut_bar_enable();
  211. }
  212. function boot(uuids) {
  213. $.ajax({
  214. url : '/api/guests/_boot/' + uuids.join(','),
  215. type : 'PUT',
  216. contentType: "application/json; charset=utf-8",
  217. error : function() {
  218. alter_danger('实例启动指令发送失败!');
  219. },
  220. success : function() {
  221. alter_success('实例启动指令发送成功!');
  222. }
  223. });
  224. }
  225. function reboot(uuids) {
  226. $.ajax({
  227. url : '/api/guests/_reboot/' + uuids.join(','),
  228. type : 'PUT',
  229. contentType: "application/json; charset=utf-8",
  230. error : function() {
  231. alter_danger('实例重启指令发送失败!');
  232. },
  233. success : function() {
  234. alter_success('实例重启指令发送成功!');
  235. }
  236. });
  237. }
  238. function force_reboot(uuids) {
  239. $.ajax({
  240. url : '/api/guests/_force_reboot/' + uuids.join(','),
  241. type : 'PUT',
  242. contentType: "application/json; charset=utf-8",
  243. error : function() {
  244. alter_danger('实例强制重启指令发送失败!');
  245. },
  246. success : function() {
  247. alter_success('实例强制重启指令发送成功!');
  248. }
  249. });
  250. }
  251. function shutdown(uuids) {
  252. $.ajax({
  253. url : '/api/guests/_shutdown/' + uuids.join(','),
  254. type : 'PUT',
  255. contentType: "application/json; charset=utf-8",
  256. error : function() {
  257. alter_danger('实例停止指令发送失败!');
  258. },
  259. success : function() {
  260. alter_success('实例停止指令发送成功!');
  261. }
  262. });
  263. }
  264. function force_shutdown(uuids) {
  265. $.ajax({
  266. url : '/api/guests/_force_shutdown/' + uuids.join(','),
  267. type : 'PUT',
  268. contentType: "application/json; charset=utf-8",
  269. error : function() {
  270. alter_danger('实例强制停止指令发送失败!');
  271. },
  272. success : function() {
  273. alter_success('实例强制停止指令发送成功!');
  274. }
  275. });
  276. }
  277. function suspend(uuids) {
  278. $.ajax({
  279. url : '/api/guests/_suspend/' + uuids.join(','),
  280. type : 'PUT',
  281. contentType: "application/json; charset=utf-8",
  282. error : function() {
  283. alter_danger('实例暂停指令发送失败!');
  284. },
  285. success : function() {
  286. alter_success('实例暂停指令发送成功!');
  287. }
  288. });
  289. }
  290. function resume(uuids) {
  291. $.ajax({
  292. url : '/api/guests/_resume/' + uuids.join(','),
  293. type : 'PUT',
  294. contentType: "application/json; charset=utf-8",
  295. error : function() {
  296. alter_danger('实例恢复指令发送失败!');
  297. },
  298. success : function() {
  299. alter_success('实例恢复指令发送成功!');
  300. }
  301. });
  302. }
  303. function remove(uuids) {
  304. $.ajax({
  305. url : '/api/guests/' + uuids.join(','),
  306. type : 'DELETE',
  307. contentType: "application/json; charset=utf-8",
  308. error : function() {
  309. alter_danger('实例删除指令发送失败!');
  310. },
  311. success : function() {
  312. alter_success('实例删除指令发送成功!');
  313. }
  314. });
  315. }
  316. function migrate(uuids, host) {
  317. $.ajax({
  318. url : '/api/guests/_migrate/' + uuids.join(',') + '/' + host,
  319. type : 'PUT',
  320. contentType: "application/json; charset=utf-8",
  321. error : function() {
  322. alter_danger('实例迁移指令发送失败!');
  323. },
  324. success : function() {
  325. alter_success('实例迁移指令发送成功!');
  326. }
  327. });
  328. }
  329. function boot_at(me) {
  330. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  331. boot([uuid]);
  332. }
  333. function reboot_at(me) {
  334. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  335. reboot([uuid]);
  336. }
  337. function force_reboot_at(me) {
  338. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  339. force_reboot([uuid]);
  340. }
  341. function shutdown_at(me) {
  342. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  343. shutdown([uuid]);
  344. }
  345. function force_shutdown_at(me) {
  346. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  347. force_shutdown([uuid]);
  348. }
  349. function suspend_at(me) {
  350. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  351. suspend([uuid]);
  352. }
  353. function resume_at(me) {
  354. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  355. resume([uuid]);
  356. }
  357. function delete_at(me) {
  358. var uuid = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  359. remove([uuid]);
  360. }
  361. function migrate_go() {
  362. var migrate_type = $('#migrate_type').val();
  363. var uuid = [];
  364. if (migrate_type === 'single') {
  365. uuid = [$('#migrate_instance_uuid').val()];
  366. } else {
  367. uuid = get_checked_uuids();
  368. }
  369. var host = $('#migrate_host').val();
  370. $('#migrate_modal').modal('hide');
  371. migrate([uuid], host);
  372. }
  373. function get_selected_uuids() {
  374. var selected_element = get_selected_element(true);
  375. var uuids = [];
  376. selected_element.each(function(i, e) {
  377. var uuid = $(e).parent().prev().text();
  378. uuids.push(uuid);
  379. });
  380. return uuids;
  381. }
  382. function get_checked_uuids() {
  383. var uuids = get_selected_uuids();
  384. if (uuids.length < 1) {
  385. alter_warning('未选择任何可操作的实例!');
  386. return false;
  387. }
  388. return uuids;
  389. }
  390. function batch_boot() {
  391. var uuids = get_checked_uuids();
  392. if (uuids) {
  393. boot(uuids);
  394. }
  395. }
  396. function batch_reboot() {
  397. var uuids = get_checked_uuids();
  398. if (uuids) {
  399. reboot(uuids);
  400. }
  401. }
  402. function batch_force_reboot() {
  403. var uuids = get_checked_uuids();
  404. if (uuids) {
  405. force_reboot(uuids);
  406. }
  407. }
  408. function batch_shutdown() {
  409. var uuids = get_checked_uuids();
  410. if (uuids) {
  411. shutdown(uuids);
  412. }
  413. }
  414. function batch_force_shutdown() {
  415. var uuids = get_checked_uuids();
  416. if (uuids) {
  417. force_shutdown(uuids);
  418. }
  419. }
  420. function batch_suspend() {
  421. var uuids = get_checked_uuids();
  422. if (uuids) {
  423. suspend(uuids);
  424. }
  425. }
  426. function batch_resume() {
  427. var uuids = get_checked_uuids();
  428. if (uuids) {
  429. resume(uuids);
  430. }
  431. }
  432. function batch_delete() {
  433. var uuids = get_checked_uuids();
  434. if (uuids) {
  435. remove(uuids);
  436. }
  437. }
  438. </script>
  439. <div class="panel">
  440. <div class="panel-body">
  441. <h3 class="title-hero" style="font-size: 24px;">
  442. 虚拟机实例
  443. </h3>
  444. <div>
  445. <div id="datatable-row-highlight_wrapper" class="dataTables_wrapper form-inline">
  446. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  447. <div class="col-sm-12" style="padding-right: 0;">
  448. <div id="datatable-row-highlight_filter" class="dataTables_filter" style="display: inline-block;">
  449. <input id="content_search" type="search" class="form-control" placeholder="模糊搜索..." value="{%- if keyword -%} {{ keyword }} {%- endif -%}" style="margin-left: 0; border-radius: 0;">
  450. </div>
  451. <div class="pull-right">
  452. <button class="btn btn-default" onclick="refresh()" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  453. <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>
  454. </div>
  455. </div>
  456. </div>
  457. <table id="guest_list" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid"
  458. style="width: 100%; margin-bottom: 0; border-bottom-width: 0;">
  459. <thead>
  460. <tr role="row">
  461. <th style="display: none;">UUID</th>
  462. <th><input class="all_selector" title="选取所有" type="checkbox"></th>
  463. <th width="180px;">名称</th>
  464. <th></th>
  465. <th>状态</th>
  466. <th>计算节点</th>
  467. <th>配置</th>
  468. <th>IP</th>
  469. <th>密码</th>
  470. <th>创建时间</th>
  471. <th>操作</th>
  472. </tr>
  473. </thead>
  474. <tbody>
  475. {% for item in guests_ret.data %}
  476. <tr role="row" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">
  477. <td style="display: none;">{{ item.uuid }}</td>
  478. <td><input title="选中" type="checkbox"></td>
  479. <td>
  480. <div>
  481. <a href="javascript:;">{{ item.name }}</a>
  482. </div>
  483. <div>
  484. <p style="display: inline-block;">{{ item.remark }}</p>
  485. <a href="javascript:;" class="edit_remark_trigger" data-toggle="modal" data-target="#edit_remark_modal" style="display: none; float: right;">
  486. <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>
  487. </a>
  488. </div>
  489. </td>
  490. <td><span class="{{ os_template_mapping_by_id[item.os_template_id].icon }}"></span></td>
  491. <td>{{ format_guest_status(item.status)|safe }}</td>
  492. <td>{{ item.on_host }}</td>
  493. <td>CPU :&nbsp;&nbsp;{{ item.cpu }}&nbsp;核<br />内存 :&nbsp;&nbsp;{{ item.memory }}&nbsp;GB</td>
  494. <td>{{ item.ip }}</td>
  495. <td>{{ item.password }}</td>
  496. <td>{{ format_datetime_by_tus(item.create_time) }}</td>
  497. <td>
  498. <div class="dropdown inline-block">
  499. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
  500. 更多
  501. </a>
  502. <ul class="dropdown-menu">
  503. <li class="{% if item.status not in [4, 5, 6] %} disabled {% endif %}">
  504. <a href="javascript:;" onclick="boot_at(this);">启动</a>
  505. </li>
  506. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  507. <a href="javascript:;" onclick="reboot_at(this);">重启</a>
  508. </li>
  509. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  510. <a href="javascript:;" onclick="force_reboot_at(this);">强制重启</a>
  511. </li>
  512. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  513. <a href="javascript:;" onclick="shutdown_at(this);">停止</a>
  514. </li>
  515. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  516. <a href="javascript:;" onclick="force_shutdown_at(this);">强制停止</a>
  517. </li>
  518. <li class="divider"></li>
  519. <li class="{% if item.status not in [1] %} disabled {% endif %}">
  520. <a href="javascript:;" onclick="suspend_at(this);">暂停</a>
  521. </li>
  522. <li class="{% if item.status not in [3] %} disabled {% endif %}">
  523. <a href="javascript:;" onclick="resume_at(this);">恢复</a>
  524. </li>
  525. <li class="divider"></li>
  526. <li class="">
  527. <a href="/guest/vnc/{{ item.uuid }}" target="_blank">远程连接</a>
  528. </li>
  529. <li class="divider"></li>
  530. <li class="">
  531. <a href="javascript:;">密码重置</a>
  532. </li>
  533. <li class="{% if item.status not in [1, 3, 4, 5, 6] %} disabled {% endif %}">
  534. <a href="javascript:;" data-toggle="modal" data-target="#migrate_modal"
  535. onclick="$('#migrate_type').val('single')">
  536. 迁移到
  537. </a>
  538. </li>
  539. <li class="divider"></li>
  540. <li class="{% if item.status not in [4, 5, 6, 255] %} disabled {% endif %}">
  541. <a href="javascript:;" onclick="delete_at(this);">删除</a>
  542. </li>
  543. </ul>
  544. </div>
  545. </td>
  546. </tr>
  547. {% endfor %}
  548. </tbody>
  549. </table>
  550. <table class="table table-bordered" style="border-top-width: 0; z-index: 99; position: sticky; bottom: 0;">
  551. <tfoot>
  552. <tr style="height: 70px;">
  553. <th><input type="checkbox" title="选取所有" class="all_selector"></th>
  554. <th>
  555. <div class="row">
  556. <div class="col-sm-6">
  557. <button class="btn btn-default btn-shortcut disabled" onclick="batch_boot();">启动</button>
  558. <button class="btn btn-default btn-shortcut disabled" onclick="batch_reboot();">重启</button>
  559. <button class="btn btn-default btn-shortcut disabled" onclick="batch_shutdown();">停止</button>
  560. <button class="btn btn-default btn-shortcut disabled" onclick="batch_suspend();">暂停</button>
  561. <button class="btn btn-default btn-shortcut disabled" onclick="batch_resume();">恢复</button>
  562. <div class="dropup inline-block">
  563. <button href="javascript:;" class="dropdown-toggle btn btn-default btn-shortcut disabled" data-toggle="dropdown">
  564. 更多
  565. </button>
  566. <ul class="dropdown-menu" style="width: 60px;">
  567. <li>
  568. <a href="javascript:;" onclick="batch_delete();">删除</a>
  569. </li>
  570. <li class="divider"></li>
  571. <li>
  572. <a href="javascript:;" onclick="$('#migrate_type').val('batch');"
  573. data-toggle="modal" data-target="#migrate_modal" >
  574. 迁移到
  575. </a>
  576. </li>
  577. <li>
  578. <a href="javascript:;">密码重置</a>
  579. </li>
  580. <li class="divider"></li>
  581. <li>
  582. <a href="javascript:;" onclick="batch_force_shutdown();">强制停止</a>
  583. </li>
  584. <li>
  585. <a href="javascript:;" onclick="batch_force_reboot();">强制重启</a>
  586. </li>
  587. </ul>
  588. </div>
  589. </div>
  590. <div class="col-sm-3" style="font-size: 12px; padding-top: 5px; text-align: right;">
  591. 共有{{ guests_ret.paging.total }}条,每页显示:
  592. <select id="page_size" name="datatable-row-highlight_length" title="page_size" class="form-control" style="height: 22px; vertical-align: baseline;">
  593. <option value="1" {% if page_size == 1 %} selected {% endif %}>1</option>
  594. <option value="2" {% if page_size == 2 %} selected {% endif %}>2</option>
  595. <option value="10" {% if page_size == 10 %} selected {% endif %}>10</option>
  596. <option value="20" {% if page_size == 20 %} selected {% endif %}>20</option>
  597. <option value="50" {% if page_size == 50 %} selected {% endif %}>50</option>
  598. </select>&nbsp;&nbsp;条
  599. </div>
  600. <div class="col-sm-3" style="text-align: left;">
  601. <div class="dataTables_paginate paging_bootstrap" id="datatable-row-highlight_paginate">
  602. <ul id="pagination" class="pagination">
  603. <li class="{% if page == 1 %} disabled {% endif %}">
  604. <a href="/guests?page={{ page - 1 }}&page_size={{ page_size }}{% if keyword %} &keyword={{ keyword }} {% endif %}">«</a>
  605. </li>
  606. {% for item in pages %}
  607. <li class="{% if item == page %} active {% endif %}">
  608. <a href="/guests?page={{ item }}&page_size={{ page_size }}{% if keyword %} &keyword={{ keyword }} {% endif %}">{{ item }}</a>
  609. </li>
  610. {% endfor %}
  611. <li class="{% if page == last_page %} disabled {% endif %}">
  612. <a href="/guests?page={{ page + 1 }}&page_size={{ page_size }}{% if keyword %} &keyword={{ keyword }} {% endif %}">»</a>
  613. </li>
  614. </ul>
  615. </div>
  616. </div>
  617. </div>
  618. </th>
  619. </tr>
  620. </tfoot>
  621. </table>
  622. </div>
  623. </div>
  624. </div>
  625. </div>
  626. <div class="modal" id="edit_remark_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  627. <div class="modal-dialog modal-sm">
  628. <div class="modal-content">
  629. <div class="modal-header">
  630. <h4 class="modal-title">编辑实例名称:</h4>
  631. </div>
  632. <div class="modal-body">
  633. <input id="instance_uuid" title="实例 UUID" class="form-control" name="uuid" hidden>
  634. <input id="edit_remark" title="实例名称" class="form-control" name="remark">
  635. </div>
  636. <div class="modal-footer">
  637. <button type="button" class="btn btn-sm btn-primary" onclick="remark_update();">确定</button>
  638. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  639. </div>
  640. </div>
  641. </div>
  642. </div>
  643. <div class="modal" id="migrate_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  644. <div class="modal-dialog modal-sm">
  645. <div class="modal-content">
  646. <div class="modal-header">
  647. <h4 class="modal-title">实例迁移至:</h4>
  648. </div>
  649. <div class="modal-body">
  650. <input id="migrate_type" title="迁移类型" class="form-control" name="migrate_type" value="single" hidden>
  651. <input id="migrate_instance_uuid" title="实例 UUID" class="form-control" name="uuid" hidden>
  652. <select id="migrate_host" name="migrate_host" title="可迁移宿主机" class="chosen-select">
  653. </select>
  654. </div>
  655. <div class="modal-footer">
  656. <button type="button" class="btn btn-sm btn-primary" onclick="migrate_go();">确定</button>
  657. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  658. </div>
  659. </div>
  660. </div>
  661. </div>
  662. {% endblock content %}