os_templates_image_show.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  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_image_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_image_id').val($(me.relatedTarget).parent().parent().prev().prev().prev().prev().text());
  122. $('#edit_path').val($(me.relatedTarget).prev().text());
  123. });
  124. $('#add_os_template_image_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_image_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_image_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_image_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_image_id = $('#os_template_image_id').val();
  231. var label = $('#edit_label').val();
  232. $('#edit_label_modal').modal('hide');
  233. $.ajax({
  234. url : '/api/os_template_image/' + os_template_image_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_image_id = $('#os_template_image_id').val();
  251. var path = $('#edit_path').val();
  252. $('#edit_path_modal').modal('hide');
  253. $.ajax({
  254. url : '/api/os_template_image/' + os_template_image_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_image/' + 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_image/' + 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 enable_at(me) {
  350. var id = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  351. enable(id);
  352. }
  353. function disable_at(me) {
  354. var id = $(me).parent().parent().parent().parent().parent().children()[0].textContent;
  355. disable(id);
  356. }
  357. function delete_at(me) {
  358. var id = $('#os_template_image_id').val();
  359. remove(id);
  360. $('#delete_modal').modal('hide');
  361. }
  362. </script>
  363. <div class="panel">
  364. <div class="panel-body">
  365. <h3 class="title-hero" style="font-size: 24px;">
  366. 虚拟机模板镜像
  367. </h3>
  368. <div>
  369. <div id="datatable-row-highlight_wrapper" class="dataTables_wrapper form-inline">
  370. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  371. <div class="col-sm-12" style="padding-right: 0;">
  372. <div id="datatable-row-highlight_filter" class="dataTables_filter" style="display: inline-block;">
  373. <input id="content_search" type="search" class="form-control" placeholder="模糊搜索..." value="{%- if keyword -%} {{ keyword }} {%- endif -%}" style="margin-left: 0; border-radius: 0;">
  374. </div>
  375. <div class="pull-right">
  376. <button class="btn btn-default" onclick="refresh()" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  377. <a class="btn btn-info" href="javascript:;" data-toggle="modal" data-target="#add_os_template_image_modal" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加模板</a>
  378. </div>
  379. </div>
  380. </div>
  381. <table id="os_templates_image_list" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid"
  382. style="width: 100%; margin-bottom: 0; border-bottom-width: 0;">
  383. <thead>
  384. <tr role="row">
  385. <th style="display: none;">ID</th>
  386. <th><input class="all_selector" title="选取所有" type="checkbox"></th>
  387. <th width="180px;">名称</th>
  388. <th>状态</th>
  389. <th width="500px;">路径</th>
  390. <th>发行版本</th>
  391. <th>操作</th>
  392. </tr>
  393. </thead>
  394. <tbody>
  395. {% for item in os_templates_image_ret.data %}
  396. <tr role="row" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">
  397. <td style="display: none;">{{ item.id }}</td>
  398. <td><input title="选中" type="checkbox"></td>
  399. <td>
  400. <div>
  401. <p style="display: inline-block;">{{ item.label }}</p>
  402. <a href="javascript:;" class="edit_label_trigger" data-toggle="modal" data-target="#edit_label_modal" style="display: none; float: right;">
  403. <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>
  404. </a>
  405. </div>
  406. </td>
  407. <td>{% if item.active == 0 %}
  408. <span style="color: #990000;">未启用</span>
  409. {% else %}
  410. <span style="color: #00BB00;">启用</span>
  411. {% endif %}
  412. </td>
  413. <td>
  414. <div>
  415. <p style="display: inline-block;">{{ item.path }}</p>
  416. <a href="javascript:;" class="edit_path_trigger" data-toggle="modal" data-target="#edit_path_modal" style="display: none; float: right;">
  417. <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>
  418. </a>
  419. </div>
  420. </td>
  421. <td>
  422. <div>
  423. <span class="{{ os_templates_profile_mapping_by_id[item.id].icon }}"></span>
  424. <p style="display: inline-block;">{{ os_templates_profile_mapping_by_id[item.id].os_product_name }}</p>
  425. </div>
  426. </td>
  427. <td>
  428. <div class="dropdown inline-block">
  429. <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">
  430. 更多
  431. </a>
  432. <ul class="dropdown-menu">
  433. <li class="{% if item.active == true %} disabled {% endif %}" style="{% if item.sequence == 0 %} display: none; {% endif %}">
  434. <a href="javascript:;" onclick="enable_at(this);">
  435. 启用
  436. </a>
  437. </li>
  438. <li class="{% if item.active != true %} disabled {% endif %}" style="{% if item.sequence == 0 %} display: none; {% endif %}">
  439. <a href="javascript:;" onclick="disable_at(this);">
  440. 禁用
  441. </a>
  442. </li>
  443. <li class="divider" style="{% if item.sequence == 0 %} display: none; {% endif %}"></li>
  444. <li>
  445. <a href="javascript:;" data-toggle="modal" data-target="#update_boot_job_modal"
  446. onclick="$('#os_template_image_id').val($(this).parent().parent().parent().parent().parent().children()[0].textContent);
  447. $('#update_boot_job_instance_desc').text($(this).parent().parent().parent().parent().parent().children()[2].textContent)">
  448. 变更发行版本
  449. </a>
  450. </li>
  451. <li class="divider" style="{% if item.sequence == 0 %} display: none; {% endif %}"></li>
  452. <li>
  453. <a href="javascript:;" data-toggle="modal" data-target="#delete_modal"
  454. onclick="$('#os_template_image_id').val($(this).parent().parent().parent().parent().parent().children()[0].textContent);
  455. $('#delete_instance_desc').text($(this).parent().parent().parent().parent().parent().children()[2].textContent)">
  456. 删除
  457. </a>
  458. </li>
  459. </ul>
  460. </div>
  461. </td>
  462. </tr>
  463. {% endfor %}
  464. </tbody>
  465. </table>
  466. <table class="table table-bordered" style="border-top-width: 0; z-index: 99; position: sticky; bottom: 0;">
  467. <tfoot>
  468. <tr style="height: 70px;">
  469. <th><input type="checkbox" title="选取所有" class="all_selector"></th>
  470. <th>
  471. <div class="row">
  472. <div class="col-sm-6">
  473. </div>
  474. <div class="col-sm-3" style="font-size: 12px; padding-top: 5px; text-align: right;">
  475. 共有{{ os_templates_image_ret.paging.total }}条,每页显示:
  476. <select id="page_size" name="datatable-row-highlight_length" title="page_size" class="form-control" style="height: 22px; vertical-align: baseline;">
  477. <option value="10" {% if page_size == 10 %} selected {% endif %}>10</option>
  478. <option value="20" {% if page_size == 20 %} selected {% endif %}>20</option>
  479. <option value="50" {% if page_size == 50 %} selected {% endif %}>50</option>
  480. </select>&nbsp;&nbsp;条
  481. </div>
  482. <div class="col-sm-3" style="text-align: left;">
  483. <div class="dataTables_paginate paging_bootstrap" id="datatable-row-highlight_paginate">
  484. <ul id="pagination" class="pagination">
  485. <li class="{% if page == 1 %} disabled {% endif %}">
  486. <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>
  487. </li>
  488. {% for item in pages %}
  489. <li class="{% if item == page %} active {% endif %}">
  490. <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>
  491. </li>
  492. {% endfor %}
  493. <li class="{% if page == last_page %} disabled {% endif %}">
  494. <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>
  495. </li>
  496. </ul>
  497. </div>
  498. </div>
  499. </div>
  500. </th>
  501. </tr>
  502. </tfoot>
  503. </table>
  504. </div>
  505. </div>
  506. </div>
  507. </div>
  508. <input id="os_template_image_id" title="模板 ID" class="form-control" name="os_template_image_id" hidden>
  509. <div class="modal" id="edit_label_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  510. <div class="modal-dialog modal-sm">
  511. <div class="modal-content">
  512. <div class="modal-header">
  513. <h4 class="modal-title">编辑模板镜像名称:</h4>
  514. </div>
  515. <div class="modal-body">
  516. <input id="edit_label" title="系统模板镜像名称" class="form-control" name="os_template_image_label">
  517. </div>
  518. <div class="modal-footer">
  519. <button type="button" class="btn btn-sm btn-primary" onclick="label_update();">确定</button>
  520. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  521. </div>
  522. </div>
  523. </div>
  524. </div>
  525. <div class="modal" id="edit_path_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  526. <div class="modal-dialog">
  527. <div class="modal-content">
  528. <div class="modal-header">
  529. <h4 class="modal-title">编辑模板镜像路径:</h4>
  530. </div>
  531. <div class="modal-body">
  532. <input id="edit_path" title="系统模板镜像路径" class="form-control" name="os_template_image_path">
  533. </div>
  534. <div class="modal-footer">
  535. <button type="button" class="btn btn-sm btn-primary" onclick="path_update();">确定</button>
  536. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  537. </div>
  538. </div>
  539. </div>
  540. </div>
  541. <div class="modal" id="delete_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  542. <div class="modal-dialog">
  543. <div class="modal-content">
  544. <div class="modal-header">
  545. <h4 class="modal-title">删除模板:</h4>
  546. </div>
  547. <div class="modal-body">
  548. <p>你确定要删除该模板镜像吗?</p>
  549. <h3 style="color: orangered;" id="delete_instance_desc"></h3>
  550. </div>
  551. <div class="modal-footer">
  552. <button type="button" class="btn btn-sm btn-primary" onclick="delete_at();">确定</button>
  553. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  554. </div>
  555. </div>
  556. </div>
  557. </div>
  558. <div class="modal" id="add_os_template_image_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  559. <div class="modal-dialog modal-lg">
  560. <div class="modal-content">
  561. <div class="modal-header">
  562. <h4 class="modal-title">添加模板镜像:</h4>
  563. </div>
  564. <div class="modal-body" style="padding-top: 0; padding-bottom: 0;">
  565. <div class="example-box-wrapper">
  566. <form id="add_os_template_image_form" class="form-horizontal bordered-row" action="/os_template_image" method="post">
  567. <div class="form-group">
  568. <div class="col-sm-2"></div>
  569. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;模板镜像名称</label>
  570. <div class="col-sm-6">
  571. <input id="label" name="label" type="text" title="模板镜像名称" class="form-control">
  572. </div>
  573. </div>
  574. <div class="form-group">
  575. <div class="col-sm-2"></div>
  576. <label class="col-sm-2 control-label"><span class="glyph-icon icon-bookmark-o"></span>&nbsp;&nbsp;ICON</label>
  577. <div class="col-sm-6">
  578. <select id="icon" name="icon" title="模板 ICON" class="selectpicker">
  579. <option value="icon-os icon-os-centos" data-icon="icon-os icon-os-centos" selected>CentOS</option>
  580. <option value="icon-os icon-os-linux" data-icon="icon-os icon-os-linux">Linux</option>
  581. <option value="icon-os icon-os-ubuntu" data-icon="icon-os icon-os-ubuntu">Ubuntu</option>
  582. <option value="icon-os icon-os-suse" data-icon="icon-os icon-os-suse">Suse</option>
  583. <option value="icon-os icon-os-gentoo" data-icon="icon-os icon-os-gentoo">Gentoo</option>
  584. <option value="icon-os icon-os-debian" data-icon="icon-os icon-os-debian">Debian</option>
  585. <option value="icon-os icon-os-redhat" data-icon="icon-os icon-os-redhat">Redhat</option>
  586. <option value="icon-os icon-os-bsd" data-icon="icon-os icon-os-bsd">BSD</option>
  587. <option value="icon-os icon-os-windows" data-icon="icon-os icon-os-windows">Windows</option>
  588. </select>
  589. </div>
  590. </div>
  591. <div class="form-group">
  592. <div class="col-sm-2"></div>
  593. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-stumbleupon"></span>&nbsp;&nbsp;模板路径</label>
  594. <div class="col-sm-6">
  595. <input id="path" name="path" type="text" title="模板路径" class="form-control">
  596. </div>
  597. </div>
  598. <div class="form-group">
  599. <div class="col-sm-2"></div>
  600. <label class="col-sm-2 control-label"><span class="glyph-icon icon-bookmark-o"></span>&nbsp;&nbsp;模板系统类型</label>
  601. <div class="col-sm-6">
  602. <select id="os_type" name="os_type" title="请选择模板系统类型" class="selectpicker">
  603. <option value="0">Linux</option>
  604. <option value="1">Windows</option>
  605. <option value="2">BSD</option>
  606. <option value="3">AIX</option>
  607. <option value="4">HP-UNIX</option>
  608. </select>
  609. </div>
  610. </div>
  611. <div class="form-group">
  612. <div class="col-sm-2"></div>
  613. <label class="col-sm-2 control-label"><span class="glyph-icon icon-file-code-o"></span>&nbsp;&nbsp;初始化作业</label>
  614. <div class="col-sm-6">
  615. <select id="boot_job_id" name="boot_job_id" title="实例的启动作业" class="selectpicker">
  616. </select>
  617. </div>
  618. </div>
  619. <div class="form-group">
  620. <div class="col-sm-4"></div>
  621. <div class="col-sm-6 pull-right">
  622. <button type="submit" class="btn btn-blue-alt" style="width: 180px; height: 40px; font-size: 16px;" disabled>创建</button>
  623. <button class="btn btn-default" style="width: 64px; height: 40px; font-size: 16px;" data-dismiss="modal">取消</button>
  624. </div>
  625. </div>
  626. </form>
  627. </div>
  628. </div>
  629. </div>
  630. </div>
  631. </div>
  632. <div class="modal" id="update_os_type_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  633. <div class="modal-dialog">
  634. <div class="modal-content">
  635. <div class="modal-header">
  636. <h4 class="modal-title">变更操作系统类型:</h4>
  637. </div>
  638. <div class="modal-body" style="padding-top: 0;">
  639. <form class="form-horizontal bordered-row">
  640. <div class="form-group">
  641. <div class="col-sm-1"></div>
  642. <label class="col-sm-3 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;操作系统类型</label>
  643. <div class="col-sm-8">
  644. <h3 style="color: orangered;" id="update_os_type_instance_desc"></h3>
  645. </div>
  646. </div>
  647. <div class="form-group">
  648. <div class="col-sm-1"></div>
  649. <div class="col-sm-8">
  650. <select id="update_os_type" name="os_type" title="操作系统类型" class="selectpicker">
  651. <option value="0" selected>Linux</option>
  652. <option value="1">Windows</option>
  653. <option value="2">BSD</option>
  654. <option value="3">AIX</option>
  655. <option value="4">HP-UNIX</option>
  656. </select>
  657. </div>
  658. </div>
  659. </form>
  660. </div>
  661. <div class="modal-footer">
  662. <button type="button" class="btn btn-sm btn-primary" onclick="update_os_type_at();">确定</button>
  663. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  664. </div>
  665. </div>
  666. </div>
  667. </div>
  668. {% endblock content %}