os_templates_show.html 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. {% extends "layout.html" %}
  2. {% block head %}
  3. {{ super() }}
  4. <style type="text/css">
  5. @media (min-width: 768px) {
  6. .form-horizontal .control-label {
  7. text-align: left;
  8. }
  9. }
  10. label>span {
  11. color: deepskyblue;
  12. }
  13. .table {
  14. font-size: 12px;
  15. border-width: 1px;
  16. line-height: 20px;
  17. }
  18. .table > thead > tr > th,
  19. .table > tfoot > tr > th {
  20. color: #999999;
  21. font-weight: normal;
  22. border-bottom: 0 solid #e1e6eb;
  23. background-color: #F5F6FA;
  24. }
  25. .table > tbody > tr > td {
  26. color: #424547;
  27. }
  28. .table-bordered > tbody > tr {
  29. padding-top: 10px;
  30. padding-bottom: 10px;
  31. }
  32. .table-bordered > thead > tr > th,
  33. .table-bordered > tbody > tr > th,
  34. .table-bordered > tfoot > tr > th,
  35. .table-bordered > thead > tr > td,
  36. .table-bordered > tbody > tr > td,
  37. .table-bordered > tfoot > tr > td {
  38. border-style: solid;
  39. border-width: 1px 0 0 0;
  40. }
  41. .btn,
  42. .form-control,
  43. .modal-content {
  44. border-radius: 0 !important;
  45. }
  46. .btn-shortcut {
  47. font-size: 12px !important;
  48. padding: 0 26px;
  49. }
  50. .show {
  51. display: inline-block !important;
  52. }
  53. .tr-selected td,
  54. .tr-selected {
  55. color: #000 !important;
  56. background: #fafaff !important;
  57. }
  58. </style>
  59. {% endblock head %}
  60. {% block content %}
  61. <script type="text/javascript">
  62. var page = 1;
  63. var page_size = 10;
  64. var keyword = '';
  65. var resource_path = window.location.pathname;
  66. var cur_url = resource_path;
  67. $(document).ready(function() {
  68. page_size = $('#page_size').val();
  69. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  70. var last_ready = null;
  71. $('#content_search').keydown(function() {
  72. if (last_ready !== null) {
  73. clearTimeout(last_ready);
  74. }
  75. last_ready = setTimeout(function () {
  76. keyword = $('#content_search').val();
  77. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  78. if (keyword.length > 0) {
  79. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  80. }
  81. window.location.href=cur_url;
  82. }, 1000);
  83. });
  84. $('#page_size').change(function () {
  85. keyword = $('#content_search').val();
  86. page_size = $('#page_size').val();
  87. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  88. if (keyword.length > 0) {
  89. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  90. }
  91. window.location.href=cur_url;
  92. });
  93. $("thead").on('click', ".all_selector", function() {
  94. if ($("thead .all_selector").is(':checked')) {
  95. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', true);
  96. $(".all_selector").prop('checked', true);
  97. } else {
  98. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', false);
  99. $(".all_selector").prop('checked', false);
  100. }
  101. select_item_action();
  102. });
  103. $("tfoot").on('click', ".all_selector", function() {
  104. if ($("tfoot .all_selector").is(':checked')) {
  105. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', true);
  106. $(".all_selector").prop('checked', true);
  107. } else {
  108. $("tbody tr").find('td input[type="checkbox"]:eq(0)').prop('checked', false);
  109. $(".all_selector").prop('checked', false);
  110. }
  111. select_item_action();
  112. });
  113. $("tbody tr").on('click', "input[type='checkbox']", function() {
  114. select_item_action();
  115. });
  116. $('#edit_label_modal').on('show.bs.modal', function (me) {
  117. $('#os_template_id').val($(me.relatedTarget).parent().parent().prev().prev().text());
  118. $('#edit_label').val($(me.relatedTarget).prev().text());
  119. });
  120. $('#edit_path_modal').on('show.bs.modal', function (me) {
  121. $('#os_template_id').val($(me.relatedTarget).parent().parent().prev().prev().prev().prev().text());
  122. $('#edit_path').val($(me.relatedTarget).prev().text());
  123. });
  124. $('#add_os_template_modal').on('show.bs.modal', function (me) {
  125. refresh_os_template_boot_job_selectpicker($('#boot_job_id'));
  126. });
  127. $('#update_boot_job_modal').on('show.bs.modal', function (me) {
  128. refresh_os_template_boot_job_selectpicker($('#update_boot_job_id'));
  129. });
  130. $('#update_os_type_modal').on('show.bs.modal', function (me) {
  131. $('#os_template_id').val($(me.relatedTarget).parent().prev().prev().prev().prev().prev().text());
  132. $('#update_os_type_instance_desc').text($(me.relatedTarget).parent().prev().prev().prev().text());
  133. });
  134. $('#update_icon_modal').on('show.bs.modal', function (me) {
  135. $('#os_template_id').val($(me.relatedTarget).parent().prev().prev().prev().prev().prev().prev().text());
  136. $('#update_icon_instance_desc').text($(me.relatedTarget).parent().prev().prev().prev().prev().text());
  137. });
  138. $('#add_os_template_form').formValidation({
  139. framework: 'bootstrap4',
  140. icon: {
  141. valid: 'fa fa-check',
  142. invalid: 'fa fa-times',
  143. validating: 'fa fa-refresh'
  144. },
  145. // Since the Bootstrap Button hides the radio and checkbox
  146. // We exclude the disabled elements only
  147. excluded: ':disabled',
  148. locale: 'zh_CN',
  149. fields: {
  150. label: {
  151. validators: {
  152. notEmpty: {},
  153. stringLength: {
  154. min: 2,
  155. max: 255
  156. }
  157. }
  158. },
  159. icon: {
  160. validators: {
  161. notEmpty: {
  162. }
  163. }
  164. },
  165. path: {
  166. validators: {
  167. notEmpty: {},
  168. stringLength: {
  169. min: 2,
  170. max: 255
  171. }
  172. }
  173. },
  174. os_type: {
  175. validators: {
  176. notEmpty: {
  177. }
  178. }
  179. },
  180. boot_job_id: {
  181. validators: {
  182. notEmpty: {
  183. }
  184. }
  185. }
  186. }
  187. })
  188. .on('success.field.fv', function(e, data) {
  189. if (data.fv.getInvalidFields().length > 0) { // There is invalid field
  190. data.fv.disableSubmitButtons(true);
  191. }
  192. })
  193. });
  194. function refresh() {
  195. keyword = $('#content_search').val();
  196. page = $('#pagination li.active a').text();
  197. page_size = $('#page_size').val();
  198. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size;
  199. if (keyword.length > 0) {
  200. cur_url = resource_path + '?page=' + page + '&page_size=' + page_size + '&keyword=' + keyword;
  201. }
  202. window.location.href=cur_url;
  203. }
  204. function row_onmouseover(me) {
  205. $(me).find(".edit_label_trigger, .edit_path_trigger").css('display','inline-flex');
  206. }
  207. function row_onmouseout(me) {
  208. $(me).find(".edit_label_trigger, .edit_path_trigger").css('display','none');
  209. }
  210. function refresh_os_template_boot_job_selectpicker(selectpicker) {
  211. $.ajax({
  212. url : '/api/boot_jobs?filter=use_for:eq:0',
  213. type : 'GET',
  214. contentType: "application/json; charset=utf-8",
  215. dataType: 'json',
  216. error : function() {
  217. },
  218. success : function(data, textStatus, xhr) {
  219. selectpicker.empty();
  220. $.each(data.data, function(k, v) {
  221. selectpicker.append(
  222. $('<option>', {value: v['id'], text: v['name'], 'data-subtext': v['remark']})
  223. );
  224. });
  225. selectpicker.selectpicker('refresh');
  226. }
  227. });
  228. }
  229. function label_update(me) {
  230. var os_template_id = $('#os_template_id').val();
  231. var label = $('#edit_label').val();
  232. $('#edit_label_modal').modal('hide');
  233. $.ajax({
  234. url : '/api/os_template/' + os_template_id,
  235. type : 'PATCH',
  236. contentType: "application/json; charset=utf-8",
  237. data : JSON.stringify({
  238. label: label
  239. }),
  240. error : function() {
  241. alter_danger('模板名称更新失败!');
  242. },
  243. success : function() {
  244. alter_success('模板名称更新成功!');
  245. refresh()
  246. }
  247. });
  248. }
  249. function path_update(me) {
  250. var os_template_id = $('#os_template_id').val();
  251. var path = $('#edit_path').val();
  252. $('#edit_path_modal').modal('hide');
  253. $.ajax({
  254. url : '/api/os_template/' + os_template_id,
  255. type : 'PATCH',
  256. contentType: "application/json; charset=utf-8",
  257. data : JSON.stringify({
  258. path: path
  259. }),
  260. error : function() {
  261. alter_danger('模板路径更新失败!');
  262. },
  263. success : function() {
  264. alter_success('模板路径更新成功!');
  265. refresh()
  266. }
  267. });
  268. }
  269. function get_selected_element(checked) {
  270. if (checked === null) {
  271. checked = true;
  272. }
  273. if (checked) {
  274. return $('tbody :checked');
  275. } else {
  276. return $('tbody input:not(:checked)');
  277. }
  278. }
  279. function highlight_selected_element() {
  280. var selected_element = get_selected_element(true);
  281. var no_selected_element = get_selected_element(false);
  282. selected_element.each(function(i, e) {
  283. $(e).parent().parent().toggleClass('tr-selected', true);
  284. });
  285. no_selected_element.each(function(i, e) {
  286. $(e).parent().parent().toggleClass('tr-selected', false);
  287. });
  288. }
  289. function shortcut_bar_enable() {
  290. var selected_element = get_selected_element(true);
  291. if (selected_element.length > 0) {
  292. $('.btn-shortcut').toggleClass('disabled', false);
  293. } else {
  294. $('.btn-shortcut').toggleClass('disabled', true);
  295. }
  296. }
  297. function select_item_action() {
  298. highlight_selected_element();
  299. shortcut_bar_enable();
  300. }
  301. function enable(id) {
  302. $.ajax({
  303. url : '/api/os_template/' + id,
  304. type : 'PATCH',
  305. contentType: "application/json; charset=utf-8",
  306. data : JSON.stringify({
  307. active: true
  308. }),
  309. error : function() {
  310. alter_danger('启用指令发送失败!');
  311. },
  312. success : function() {
  313. alter_success('启用指令发送成功!');
  314. refresh();
  315. }
  316. });
  317. }
  318. function disable(id) {
  319. $.ajax({
  320. url : '/api/os_template/' + id,
  321. type : 'PATCH',
  322. contentType: "application/json; charset=utf-8",
  323. data : JSON.stringify({
  324. active: false
  325. }),
  326. error : function() {
  327. alter_danger('禁用指令发送失败!');
  328. },
  329. success : function() {
  330. alter_success('禁用指令发送成功!');
  331. refresh();
  332. }
  333. });
  334. }
  335. function remove(id) {
  336. $.ajax({
  337. url : '/api/os_templates/' + id,
  338. type : 'DELETE',
  339. contentType: "application/json; charset=utf-8",
  340. error : function() {
  341. alter_danger('模板删除指令发送失败!');
  342. },
  343. success : function() {
  344. alter_success('模板删除指令发送成功!');
  345. refresh();
  346. }
  347. });
  348. }
  349. function update_boot_job(id) {
  350. $.ajax({
  351. url : '/api/os_template/' + id,
  352. type : 'PATCH',
  353. contentType: "application/json; charset=utf-8",
  354. data : JSON.stringify({
  355. boot_job_id: parseInt($('#update_boot_job_id').val())
  356. }),
  357. error : function() {
  358. alter_danger('变更初始化作业指令发送失败!');
  359. },
  360. success : function() {
  361. alter_success('变更初始化作业指令发送成功!');
  362. refresh();
  363. }
  364. });
  365. }
  366. function update_os_type(id) {
  367. $.ajax({
  368. url : '/api/os_template/' + id,
  369. type : 'PATCH',
  370. contentType: "application/json; charset=utf-8",
  371. data : JSON.stringify({
  372. os_type: parseInt($('#update_os_type').val())
  373. }),
  374. error : function() {
  375. alter_danger('变更操作系统类型指令发送失败!');
  376. },
  377. success : function() {
  378. alter_success('变更操作系统类型指令发送成功!');
  379. refresh();
  380. }
  381. });
  382. }
  383. function update_icon(id) {
  384. $.ajax({
  385. url : '/api/os_template/' + id,
  386. type : 'PATCH',
  387. contentType: "application/json; charset=utf-8",
  388. data : JSON.stringify({
  389. icon: $('#update_icon').val()
  390. }),
  391. error : function() {
  392. alter_danger('变更 ICON 指令发送失败!');
  393. },
  394. success : function() {
  395. alter_success('变更 ICON 指令发送成功!');
  396. refresh();
  397. }
  398. });
  399. }
  400. function enable_at(me) {
  401. var id = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  402. enable(id);
  403. }
  404. function disable_at(me) {
  405. var id = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  406. disable(id);
  407. }
  408. function delete_at(me) {
  409. var id = $('#os_template_id').val();
  410. remove(id);
  411. $('#delete_modal').modal('hide');
  412. }
  413. function update_boot_job_at(me) {
  414. var id = $('#os_template_id').val();
  415. update_boot_job(id);
  416. $('#update_boot_job_modal').modal('hide');
  417. }
  418. function update_os_type_at(me) {
  419. var id = $('#os_template_id').val();
  420. update_os_type(id);
  421. $('#update_os_type_modal').modal('hide');
  422. }
  423. function update_icon_at(me) {
  424. var id = $('#os_template_id').val();
  425. update_icon(id);
  426. $('#update_icon_modal').modal('hide');
  427. }
  428. </script>
  429. <div class="panel">
  430. <div class="panel-body">
  431. <h3 class="title-hero" style="font-size: 24px;">
  432. 虚拟机模板
  433. </h3>
  434. <div>
  435. <div id="datatable-row-highlight_wrapper" class="dataTables_wrapper form-inline">
  436. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  437. <div class="col-sm-12" style="padding-right: 0;">
  438. <div id="datatable-row-highlight_filter" class="dataTables_filter" style="display: inline-block;">
  439. <input id="content_search" type="search" class="form-control" placeholder="模糊搜索..." value="{%- if keyword -%} {{ keyword }} {%- endif -%}" style="margin-left: 0; border-radius: 0;">
  440. </div>
  441. <div class="pull-right">
  442. <button class="btn btn-default" onclick="refresh()" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  443. <a class="btn btn-info" href="javascript:;" data-toggle="modal" data-target="#add_os_template_modal" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加模板</a>
  444. </div>
  445. </div>
  446. </div>
  447. <table id="os_template_list" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid"
  448. style="width: 100%; margin-bottom: 0; border-bottom-width: 0;">
  449. <thead>
  450. <tr role="row">
  451. <th style="display: none;">ID</th>
  452. <th><input class="all_selector" title="选取所有" type="checkbox"></th>
  453. <th width="180px;">名称</th>
  454. <th>状态</th>
  455. <th width="500px;">路径</th>
  456. <th>操作系统类型</th>
  457. <th>ICON</th>
  458. <th>初始化作业</th>
  459. <th>操作</th>
  460. </tr>
  461. </thead>
  462. <tbody>
  463. {% for item in os_templates_ret.data %}
  464. <tr role="row" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">
  465. <td style="display: none;">{{ item.id }}</td>
  466. <td><input title="选中" type="checkbox"></td>
  467. <td>
  468. <div>
  469. <p style="display: inline-block;">{{ item.label }}</p>
  470. <a href="javascript:;" class="edit_label_trigger" data-toggle="modal" data-target="#edit_label_modal" style="display: none; float: right;">
  471. <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>
  472. </a>
  473. </div>
  474. </td>
  475. <td>{% if item.active == 0 %}
  476. <span style="color: #990000;">未启用</span>
  477. {% else %}
  478. <span style="color: #00BB00;">启用</span>
  479. {% endif %}
  480. </td>
  481. <td>
  482. <div>
  483. <p style="display: inline-block;">{{ item.path }}</p>
  484. <a href="javascript:;" class="edit_path_trigger" data-toggle="modal" data-target="#edit_path_modal" style="display: none; float: right;">
  485. <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>
  486. </a>
  487. </div>
  488. </td>
  489. <td>
  490. <a href="javascript:;" data-toggle="modal" data-target="#update_os_type_modal">
  491. {{ format_os_type_id_to_name(item.os_type) }}
  492. </a>
  493. </td>
  494. <td>
  495. <a href="javascript:;" data-toggle="modal" data-target="#update_icon_modal">
  496. <span class="{{ item.icon }}"></span>
  497. </a>
  498. </td>
  499. <td>
  500. <a href="/boot_jobs?boot_job_id={{ item.boot_job_id }}">
  501. {{ boot_jobs_mapping_by_id[item.boot_job_id].name }}
  502. </a>
  503. </td>
  504. <td>
  505. <div class="dropdown inline-block">
  506. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
  507. 更多
  508. </a>
  509. <ul class="dropdown-menu">
  510. <li class="{% if item.active == true %} disabled {% endif %}" style="{% if item.sequence == 0 %} display: none; {% endif %}">
  511. <a href="javascript:;" onclick="enable_at(this);">
  512. 启用
  513. </a>
  514. </li>
  515. <li class="{% if item.active != true %} disabled {% endif %}" style="{% if item.sequence == 0 %} display: none; {% endif %}">
  516. <a href="javascript:;" onclick="disable_at(this);">
  517. 禁用
  518. </a>
  519. </li>
  520. <li class="divider" style="{% if item.sequence == 0 %} display: none; {% endif %}"></li>
  521. <li>
  522. <a href="javascript:;" data-toggle="modal" data-target="#update_boot_job_modal"
  523. onclick="$('#os_template_id').val($(this).parent().parent().parent().parent().parent().children()[0].textContent);
  524. $('#update_boot_job_instance_desc').text($(this).parent().parent().parent().parent().parent().children()[2].textContent)">
  525. 变更初始化作业
  526. </a>
  527. </li>
  528. <li class="divider" style="{% if item.sequence == 0 %} display: none; {% endif %}"></li>
  529. <li>
  530. <a href="javascript:;" data-toggle="modal" data-target="#delete_modal"
  531. onclick="$('#os_template_id').val($(this).parent().parent().parent().parent().parent().children()[0].textContent);
  532. $('#delete_instance_desc').text($(this).parent().parent().parent().parent().parent().children()[2].textContent)">
  533. 删除
  534. </a>
  535. </li>
  536. </ul>
  537. </div>
  538. </td>
  539. </tr>
  540. {% endfor %}
  541. </tbody>
  542. </table>
  543. <table class="table table-bordered" style="border-top-width: 0; z-index: 99; position: sticky; bottom: 0;">
  544. <tfoot>
  545. <tr style="height: 70px;">
  546. <th><input type="checkbox" title="选取所有" class="all_selector"></th>
  547. <th>
  548. <div class="row">
  549. <div class="col-sm-6">
  550. </div>
  551. <div class="col-sm-3" style="font-size: 12px; padding-top: 5px; text-align: right;">
  552. 共有{{ os_templates_ret.paging.total }}条,每页显示:
  553. <select id="page_size" name="datatable-row-highlight_length" title="page_size" class="form-control" style="height: 22px; vertical-align: baseline;">
  554. <option value="10" {% if page_size == 10 %} selected {% endif %}>10</option>
  555. <option value="20" {% if page_size == 20 %} selected {% endif %}>20</option>
  556. <option value="50" {% if page_size == 50 %} selected {% endif %}>50</option>
  557. </select>&nbsp;&nbsp;条
  558. </div>
  559. <div class="col-sm-3" style="text-align: left;">
  560. <div class="dataTables_paginate paging_bootstrap" id="datatable-row-highlight_paginate">
  561. <ul id="pagination" class="pagination">
  562. <li class="{% if page == 1 %} disabled {% endif %}">
  563. <a href="{{ resource_path }}?page={{ page - 1 }}&page_size={{ page_size }}{% if keyword %}&keyword={{ keyword }}{% endif %}{% if order_by %}&order_by={{ order_by }}{% endif %}{% if order %}&order={{ order }}{% endif %}">«</a>
  564. </li>
  565. {% for item in pages %}
  566. <li class="{% if item == page %} active {% endif %}">
  567. <a href="{{ resource_path }}?page={{ item }}&page_size={{ page_size }}{% if keyword %}&keyword={{ keyword }}{% endif %}{% if order_by %}&order_by={{ order_by }}{% endif %}{% if order %}&order={{ order }}{% endif %}">{{ item }}</a>
  568. </li>
  569. {% endfor %}
  570. <li class="{% if page == last_page %} disabled {% endif %}">
  571. <a href="{{ resource_path }}?page={{ page + 1 }}&page_size={{ page_size }}{% if keyword %}&keyword={{ keyword }}{% endif %}{% if order_by %}&order_by={{ order_by }}{% endif %}{% if order %}&order={{ order }}{% endif %}">»</a>
  572. </li>
  573. </ul>
  574. </div>
  575. </div>
  576. </div>
  577. </th>
  578. </tr>
  579. </tfoot>
  580. </table>
  581. </div>
  582. </div>
  583. </div>
  584. </div>
  585. <input id="os_template_id" title="模板 ID" class="form-control" name="os_template_id" hidden>
  586. <div class="modal" id="edit_label_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  587. <div class="modal-dialog modal-sm">
  588. <div class="modal-content">
  589. <div class="modal-header">
  590. <h4 class="modal-title">编辑模板名称:</h4>
  591. </div>
  592. <div class="modal-body">
  593. <input id="edit_label" title="系统模板名称" class="form-control" name="os_template_label">
  594. </div>
  595. <div class="modal-footer">
  596. <button type="button" class="btn btn-sm btn-primary" onclick="label_update();">确定</button>
  597. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  598. </div>
  599. </div>
  600. </div>
  601. </div>
  602. <div class="modal" id="edit_path_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  603. <div class="modal-dialog">
  604. <div class="modal-content">
  605. <div class="modal-header">
  606. <h4 class="modal-title">编辑模板路径:</h4>
  607. </div>
  608. <div class="modal-body">
  609. <input id="edit_path" title="系统模板路径" class="form-control" name="os_template_path">
  610. </div>
  611. <div class="modal-footer">
  612. <button type="button" class="btn btn-sm btn-primary" onclick="path_update();">确定</button>
  613. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  614. </div>
  615. </div>
  616. </div>
  617. </div>
  618. <div class="modal" id="delete_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  619. <div class="modal-dialog">
  620. <div class="modal-content">
  621. <div class="modal-header">
  622. <h4 class="modal-title">删除模板:</h4>
  623. </div>
  624. <div class="modal-body">
  625. <p>你确定要删除该模板吗?</p>
  626. <h3 style="color: orangered;" id="delete_instance_desc"></h3>
  627. </div>
  628. <div class="modal-footer">
  629. <button type="button" class="btn btn-sm btn-primary" onclick="delete_at();">确定</button>
  630. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  631. </div>
  632. </div>
  633. </div>
  634. </div>
  635. <div class="modal" id="add_os_template_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  636. <div class="modal-dialog modal-lg">
  637. <div class="modal-content">
  638. <div class="modal-header">
  639. <h4 class="modal-title">添加模板:</h4>
  640. </div>
  641. <div class="modal-body" style="padding-top: 0; padding-bottom: 0;">
  642. <div class="example-box-wrapper">
  643. <form id="add_os_template_form" class="form-horizontal bordered-row" action="/os_template" method="post">
  644. <div class="form-group">
  645. <div class="col-sm-2"></div>
  646. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;模板名称</label>
  647. <div class="col-sm-6">
  648. <input id="label" name="label" type="text" title="模板名称" class="form-control">
  649. </div>
  650. </div>
  651. <div class="form-group">
  652. <div class="col-sm-2"></div>
  653. <label class="col-sm-2 control-label"><span class="glyph-icon icon-bookmark-o"></span>&nbsp;&nbsp;ICON</label>
  654. <div class="col-sm-6">
  655. <select id="icon" name="icon" title="模板 ICON" class="selectpicker">
  656. <option value="icon-os icon-os-centos" data-icon="icon-os icon-os-centos" selected>CentOS</option>
  657. <option value="icon-os icon-os-linux" data-icon="icon-os icon-os-linux">Linux</option>
  658. <option value="icon-os icon-os-ubuntu" data-icon="icon-os icon-os-ubuntu">Ubuntu</option>
  659. <option value="icon-os icon-os-suse" data-icon="icon-os icon-os-suse">Suse</option>
  660. <option value="icon-os icon-os-gentoo" data-icon="icon-os icon-os-gentoo">Gentoo</option>
  661. <option value="icon-os icon-os-debian" data-icon="icon-os icon-os-debian">Debian</option>
  662. <option value="icon-os icon-os-redhat" data-icon="icon-os icon-os-redhat">Redhat</option>
  663. <option value="icon-os icon-os-bsd" data-icon="icon-os icon-os-bsd">BSD</option>
  664. <option value="icon-os icon-os-windows" data-icon="icon-os icon-os-windows">Windows</option>
  665. </select>
  666. </div>
  667. </div>
  668. <div class="form-group">
  669. <div class="col-sm-2"></div>
  670. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-stumbleupon"></span>&nbsp;&nbsp;模板路径</label>
  671. <div class="col-sm-6">
  672. <input id="path" name="path" type="text" title="模板路径" class="form-control">
  673. </div>
  674. </div>
  675. <div class="form-group">
  676. <div class="col-sm-2"></div>
  677. <label class="col-sm-2 control-label"><span class="glyph-icon icon-bookmark-o"></span>&nbsp;&nbsp;模板系统类型</label>
  678. <div class="col-sm-6">
  679. <select id="os_type" name="os_type" title="请选择模板系统类型" class="selectpicker">
  680. <option value="0">Linux</option>
  681. <option value="1">Windows</option>
  682. <option value="2">BSD</option>
  683. <option value="3">AIX</option>
  684. <option value="4">HP-UNIX</option>
  685. </select>
  686. </div>
  687. </div>
  688. <div class="form-group">
  689. <div class="col-sm-2"></div>
  690. <label class="col-sm-2 control-label"><span class="glyph-icon icon-file-code-o"></span>&nbsp;&nbsp;初始化作业</label>
  691. <div class="col-sm-6">
  692. <select id="boot_job_id" name="boot_job_id" title="实例的启动作业" class="selectpicker">
  693. </select>
  694. </div>
  695. </div>
  696. <div class="form-group">
  697. <div class="col-sm-4"></div>
  698. <div class="col-sm-6 pull-right">
  699. <button type="submit" class="btn btn-blue-alt" style="width: 180px; height: 40px; font-size: 16px;" disabled>创建</button>
  700. <button class="btn btn-default" style="width: 64px; height: 40px; font-size: 16px;" data-dismiss="modal">取消</button>
  701. </div>
  702. </div>
  703. </form>
  704. </div>
  705. </div>
  706. </div>
  707. </div>
  708. </div>
  709. <div class="modal" id="update_boot_job_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  710. <div class="modal-dialog">
  711. <div class="modal-content">
  712. <div class="modal-header">
  713. <h4 class="modal-title">变更初始化作业:</h4>
  714. </div>
  715. <div class="modal-body" style="padding-top: 0;">
  716. <form class="form-horizontal bordered-row">
  717. <div class="form-group">
  718. <div class="col-sm-1"></div>
  719. <label class="col-sm-3 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;模板名称</label>
  720. <div class="col-sm-8">
  721. <h3 style="color: orangered;" id="update_boot_job_instance_desc"></h3>
  722. </div>
  723. </div>
  724. <div class="form-group">
  725. <div class="col-sm-1"></div>
  726. <label class="col-sm-3 control-label"><span class="glyph-icon icon-file-code-o"></span>&nbsp;&nbsp;初始化作业</label>
  727. <div class="col-sm-8">
  728. <select id="update_boot_job_id" name="boot_job_id" title="实例的启动作业" class="selectpicker">
  729. </select>
  730. </div>
  731. </div>
  732. </form>
  733. </div>
  734. <div class="modal-footer">
  735. <button type="button" class="btn btn-sm btn-primary" onclick="update_boot_job_at();">确定</button>
  736. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  737. </div>
  738. </div>
  739. </div>
  740. </div>
  741. <div class="modal" id="update_os_type_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  742. <div class="modal-dialog">
  743. <div class="modal-content">
  744. <div class="modal-header">
  745. <h4 class="modal-title">变更操作系统类型:</h4>
  746. </div>
  747. <div class="modal-body" style="padding-top: 0;">
  748. <form class="form-horizontal bordered-row">
  749. <div class="form-group">
  750. <div class="col-sm-1"></div>
  751. <label class="col-sm-3 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;操作系统类型</label>
  752. <div class="col-sm-8">
  753. <h3 style="color: orangered;" id="update_os_type_instance_desc"></h3>
  754. </div>
  755. </div>
  756. <div class="form-group">
  757. <div class="col-sm-1"></div>
  758. <div class="col-sm-8">
  759. <select id="update_os_type" name="os_type" title="操作系统类型" class="selectpicker">
  760. <option value="0" selected>Linux</option>
  761. <option value="1">Windows</option>
  762. <option value="2">BSD</option>
  763. <option value="3">AIX</option>
  764. <option value="4">HP-UNIX</option>
  765. </select>
  766. </div>
  767. </div>
  768. </form>
  769. </div>
  770. <div class="modal-footer">
  771. <button type="button" class="btn btn-sm btn-primary" onclick="update_os_type_at();">确定</button>
  772. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  773. </div>
  774. </div>
  775. </div>
  776. </div>
  777. <div class="modal" id="update_icon_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  778. <div class="modal-dialog">
  779. <div class="modal-content">
  780. <div class="modal-header">
  781. <h4 class="modal-title">变更 ICON:</h4>
  782. </div>
  783. <div class="modal-body" style="padding-top: 0;">
  784. <form class="form-horizontal bordered-row">
  785. <div class="form-group">
  786. <div class="col-sm-1"></div>
  787. <label class="col-sm-3 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;模板名称</label>
  788. <div class="col-sm-8">
  789. <h3 style="color: orangered;" id="update_icon_instance_desc"></h3>
  790. </div>
  791. </div>
  792. <div class="form-group">
  793. <div class="col-sm-1"></div>
  794. <div class="col-sm-8">
  795. <select id="update_icon" name="icon" title="模板 ICON" class="selectpicker">
  796. <option value="icon-os icon-os-centos" data-icon="icon-os icon-os-centos" selected>CentOS</option>
  797. <option value="icon-os icon-os-linux" data-icon="icon-os icon-os-linux">Linux</option>
  798. <option value="icon-os icon-os-ubuntu" data-icon="icon-os icon-os-ubuntu">Ubuntu</option>
  799. <option value="icon-os icon-os-suse" data-icon="icon-os icon-os-suse">Suse</option>
  800. <option value="icon-os icon-os-gentoo" data-icon="icon-os icon-os-gentoo">Gentoo</option>
  801. <option value="icon-os icon-os-debian" data-icon="icon-os icon-os-debian">Debian</option>
  802. <option value="icon-os icon-os-redhat" data-icon="icon-os icon-os-redhat">Redhat</option>
  803. <option value="icon-os icon-os-bsd" data-icon="icon-os icon-os-bsd">BSD</option>
  804. <option value="icon-os icon-os-windows" data-icon="icon-os icon-os-windows">Windows</option>
  805. </select>
  806. </div>
  807. </div>
  808. </form>
  809. </div>
  810. <div class="modal-footer">
  811. <button type="button" class="btn btn-sm btn-primary" onclick="update_icon_at();">确定</button>
  812. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  813. </div>
  814. </div>
  815. </div>
  816. </div>
  817. {% endblock content %}