config_show.html 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  1. {% extends theme("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. #batch_change_disk_quota_form label {
  14. padding-left: 0;
  15. padding-right: 0;
  16. }
  17. .btn,
  18. .form-group>div>div,
  19. .form-control {
  20. border-radius: 0;
  21. }
  22. .bootstrap-switch-handle-on {
  23. border-top-left-radius: 0 !important;
  24. border-bottom-left-radius: 0 !important;
  25. }
  26. </style>
  27. {% endblock head %}
  28. {% block content %}
  29. <script>
  30. var sheet_tag = window.location.hash;
  31. $(document).ready(function() {
  32. $('body').addClass('add-transition');
  33. $('.add-page-transition').on('click', function(){
  34. var transAttr = $(this).attr('data-transition');
  35. $('.add-transition').attr('class', 'add-transition');
  36. $('.add-transition').addClass(transAttr);
  37. });
  38. $('#storage_mode').on('changed.bs.select', function (me) {
  39. if ($('#storage_mode').val() == '2' || $('#storage_mode').val() == '3') {
  40. $('#dfs_volume_label').css('display', 'unset');
  41. $('#dfs_volume').css('display', 'unset');
  42. } else {
  43. $('#dfs_volume_label').css('display', 'none');
  44. $('#dfs_volume').css('display', 'none');
  45. }
  46. });
  47. register_iops_bps_event();
  48. refresh_ip_pools();
  49. tokens_list_refresh();
  50. $('input.input-switch[name="activity"]').on('switchChange.bootstrapSwitch', function(event, state) {
  51. console.log(this); // DOM element
  52. console.log(event); // jQuery event
  53. console.log(state); // true | false
  54. if (state) {
  55. put_ip_pool_activity($(this).data('id'));
  56. }
  57. });
  58. $('#reserved_ip_modal').on('show.bs.modal', function (me) {
  59. reserved_ip_refresh();
  60. });
  61. $("#reserved_ip_input").keydown(function() {
  62. if (event.keyCode == "13") {//keyCode=13是回车键
  63. add_reserved_ip($('#reserved_ip_input').val())
  64. }
  65. });
  66. nav_to_sheet_tag();
  67. });
  68. function refresh() {
  69. window.location.reload();
  70. }
  71. function select_this(me) {
  72. $(me).parent().parent().children().removeClass('active');
  73. $(me).parent().addClass('active');
  74. $('#view_by_jimv_system_config, #view_by_quota, #view_by_ip_pool, #view_by_vlan, #view_by_auxiliary, #view_by_token').css('display', 'none');
  75. if (me.id === 'view_by_quota_label') {
  76. $('#view_by_quota').css('display', 'unset');
  77. history.replaceState(null, null, window.location.pathname);
  78. window.location.hash = "quota";
  79. } else if (me.id === 'view_by_ip_pool_label') {
  80. $('#view_by_ip_pool').css('display', 'unset');
  81. history.replaceState(null, null, window.location.pathname);
  82. window.location.hash = "ip_pool";
  83. } else if (me.id === 'view_by_vlan_label') {
  84. $('#view_by_vlan').css('display', 'unset');
  85. history.replaceState(null, null, window.location.pathname);
  86. window.location.hash = "vlan";
  87. } else if (me.id === 'view_by_token_label') {
  88. $('#view_by_token').css('display', 'unset');
  89. history.replaceState(null, null, window.location.pathname);
  90. window.location.hash = "token";
  91. } else if (me.id === 'view_by_auxiliary_label') {
  92. $('#view_by_auxiliary').css('display', 'unset');
  93. history.replaceState(null, null, window.location.pathname);
  94. window.location.hash = "auxiliary";
  95. } else {
  96. $('#view_by_jimv_system_config').css('display', 'unset');
  97. history.replaceState(null, null, ' ');
  98. }
  99. }
  100. function nav_to_sheet_tag() {
  101. var view_by_jimv_system_config_label = $('#view_by_jimv_system_config_label');
  102. var view_by_quota_label = $('#view_by_quota_label');
  103. var view_by_ip_pool_label = $('#view_by_ip_pool_label');
  104. var view_by_vlan_label = $('#view_by_vlan_label');
  105. var view_by_token_label = $('#view_by_token_label');
  106. var view_by_auxiliary_label = $('#view_by_auxiliary_label');
  107. view_by_jimv_system_config_label.parent().parent().children().removeClass('active');
  108. $('#view_by_jimv_system_config, #view_by_quota, #view_by_ip_pool, #view_by_vlan, #view_by_auxiliary, #view_by_token').css('display', 'none');
  109. if (sheet_tag.indexOf('#quota') != -1) {
  110. view_by_quota_label.parent().addClass('active');
  111. $('#view_by_quota').css('display', 'unset');
  112. } else if (sheet_tag.indexOf('#ip_pool') != -1) {
  113. view_by_ip_pool_label.parent().addClass('active');
  114. $('#view_by_ip_pool').css('display', 'unset');
  115. } else if (sheet_tag.indexOf('#vlan') != -1) {
  116. view_by_vlan_label.parent().addClass('active');
  117. $('#view_by_vlan').css('display', 'unset');
  118. } else if (sheet_tag.indexOf('#token') != -1) {
  119. view_by_token_label.parent().addClass('active');
  120. $('#view_by_token').css('display', 'unset');
  121. } else if (sheet_tag.indexOf('#auxiliary') != -1) {
  122. view_by_auxiliary_label.parent().addClass('active');
  123. $('#view_by_auxiliary').css('display', 'unset');
  124. } else {
  125. view_by_jimv_system_config_label.parent().addClass('active');
  126. $('#view_by_jimv_system_config').css('display', 'unset');
  127. }
  128. }
  129. $(function() { "use strict";
  130. $("#iops_base").TouchSpin({
  131. max: 10000,
  132. min: 0,
  133. verticalbuttons: true,
  134. verticalupclass: 'glyph-icon icon-plus',
  135. verticaldownclass: 'glyph-icon icon-minus'
  136. });
  137. });
  138. $(function() { "use strict";
  139. $("#iops_pre_unit").TouchSpin({
  140. max: 100,
  141. min: 0,
  142. verticalbuttons: true,
  143. verticalupclass: 'glyph-icon icon-plus',
  144. verticaldownclass: 'glyph-icon icon-minus'
  145. });
  146. });
  147. $(function() { "use strict";
  148. $("#iops_cap").TouchSpin({
  149. max: 100000,
  150. min: 0,
  151. verticalbuttons: true,
  152. verticalupclass: 'glyph-icon icon-plus',
  153. verticaldownclass: 'glyph-icon icon-minus'
  154. });
  155. });
  156. $(function() { "use strict";
  157. $("#iops_max").TouchSpin({
  158. max: 200000,
  159. min: 0,
  160. verticalbuttons: true,
  161. verticalupclass: 'glyph-icon icon-plus',
  162. verticaldownclass: 'glyph-icon icon-minus'
  163. });
  164. });
  165. $(function() { "use strict";
  166. $("#iops_max_length").TouchSpin({
  167. max: 600,
  168. min: 0,
  169. postfix: '秒',
  170. verticalbuttons: true,
  171. verticalupclass: 'glyph-icon icon-plus',
  172. verticaldownclass: 'glyph-icon icon-minus'
  173. });
  174. });
  175. $(function() { "use strict";
  176. $("#bps_base").TouchSpin({
  177. max: 1024,
  178. min: 0,
  179. postfix: 'MiB',
  180. verticalbuttons: true,
  181. verticalupclass: 'glyph-icon icon-plus',
  182. verticaldownclass: 'glyph-icon icon-minus'
  183. });
  184. });
  185. $(function() { "use strict";
  186. $("#bps_pre_unit").TouchSpin({
  187. max: 10,
  188. min: 0,
  189. step: 0.01,
  190. decimals: 2,
  191. postfix: 'MiB',
  192. verticalbuttons: true,
  193. verticalupclass: 'glyph-icon icon-plus',
  194. verticaldownclass: 'glyph-icon icon-minus'
  195. });
  196. });
  197. $(function() { "use strict";
  198. $("#bps_cap").TouchSpin({
  199. max: 1024 * 2,
  200. min: 0,
  201. postfix: 'MiB',
  202. verticalbuttons: true,
  203. verticalupclass: 'glyph-icon icon-plus',
  204. verticaldownclass: 'glyph-icon icon-minus'
  205. });
  206. });
  207. $(function() { "use strict";
  208. $("#bps_max").TouchSpin({
  209. max: 1024 * 10,
  210. min: 0,
  211. postfix: 'MiB',
  212. verticalbuttons: true,
  213. verticalupclass: 'glyph-icon icon-plus',
  214. verticaldownclass: 'glyph-icon icon-minus'
  215. });
  216. });
  217. $(function() { "use strict";
  218. $("#bps_max_length").TouchSpin({
  219. max: 600,
  220. min: 0,
  221. postfix: '秒',
  222. verticalbuttons: true,
  223. verticalupclass: 'glyph-icon icon-plus',
  224. verticaldownclass: 'glyph-icon icon-minus'
  225. });
  226. });
  227. function register_iops_bps_event() {
  228. $('#iops').on('change', function () {
  229. $("#iops_rd").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_wr').val()});
  230. $("#iops_wr").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_rd').val()});
  231. });
  232. $('#iops_rd').on('change', function () {
  233. $("#iops_wr").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_rd').val()});
  234. });
  235. $('#iops_wr').on('change', function () {
  236. $("#iops_rd").trigger("touchspin.updatesettings", {max: $('#iops').val() - $('#iops_wr').val()});
  237. });
  238. $('#bps').on('change', function () {
  239. $("#bps_rd").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_wr').val()});
  240. $("#bps_wr").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_rd').val()});
  241. });
  242. $('#bps_rd').on('change', function () {
  243. $("#bps_wr").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_rd').val()});
  244. });
  245. $('#bps_wr').on('change', function () {
  246. $("#bps_rd").trigger("touchspin.updatesettings", {max: $('#bps').val() - $('#bps_wr').val()});
  247. });
  248. }
  249. function update_quota() {
  250. $.ajax({
  251. url : '/api/config/_quota',
  252. type : 'PATCH',
  253. contentType: "application/json; charset=utf-8",
  254. data : JSON.stringify({
  255. iops_base: parseInt($('#iops_base').val()),
  256. iops_pre_unit: parseInt($('#iops_pre_unit').val()),
  257. iops_cap: parseInt($('#iops_cap').val()),
  258. iops_max: parseInt($('#iops_max').val()),
  259. iops_max_length: parseInt($('#iops_max_length').val()),
  260. bps_base: parseInt($('#bps_base').val()) * 1024 * 1024,
  261. bps_pre_unit: parseFloat($('#bps_pre_unit').val()) * 1024 * 1024,
  262. bps_cap: parseInt($('#bps_cap').val()) * 1024 * 1024,
  263. bps_max: parseInt($('#bps_max').val()) * 1024 * 1024,
  264. bps_max_length: parseInt($('#bps_max_length').val()),
  265. influence_current_guest: $('#influence_current_guest').prop('checked')
  266. }),
  267. error : function() {
  268. alter_danger('性能配额更新失败!');
  269. },
  270. success : function() {
  271. alter_success('性能配额更新成功!');
  272. setTimeout(function() {
  273. refresh();
  274. }, 1000);
  275. }
  276. });
  277. }
  278. function refresh_guest_state() {
  279. $.ajax({
  280. url : '/api/guests/_refresh_guest_state',
  281. type : 'PATCH',
  282. error : function() {
  283. alter_danger('刷新虚拟机状态失败!');
  284. },
  285. success : function() {
  286. alter_success('刷新虚拟机状态成功!');
  287. setTimeout(function() {
  288. refresh();
  289. }, 1000);
  290. }
  291. });
  292. }
  293. function exchange_ip_pool_for_panel(ip_pool) {
  294. var activity_checked = '';
  295. if (ip_pool.activity > 0) {
  296. activity_checked = 'checked';
  297. }
  298. return '<div class="panel">\n' +
  299. ' <div class="panel-body">\n' +
  300. ' <form class="form-horizontal bordered-row" style="padding-left: 8%;">\n' +
  301. ' <input title="IP Pool ID" class="form-control" name="id" type="text" value="' + ip_pool.id + '" hidden>\n' +
  302. ' <div class="form-group">\n' +
  303. ' <label class="col-sm-2 control-label">起始 IP</label>\n' +
  304. ' <div class="col-sm-3">\n' +
  305. ' <input title="起始 IP" class="form-control" name="start_ip" type="text" value="' + ip_pool.start_ip + '">\n' +
  306. ' </div>\n' +
  307. ' <label class="col-sm-2 control-label">截止 IP</label>\n' +
  308. ' <div class="col-sm-3">\n' +
  309. ' <input title="截止 IP" class="form-control" name="end_ip" type="text" value="' + ip_pool.end_ip + '">\n' +
  310. ' </div>\n' +
  311. ' </div>\n' +
  312. ' <div class="form-group">\n' +
  313. ' <label class="col-sm-2 control-label">子网掩码</label>\n' +
  314. ' <div class="col-sm-3">\n' +
  315. ' <input title="子网掩码" class="form-control" name="netmask" type="text" value="' + ip_pool.netmask + '">\n' +
  316. ' </div>\n' +
  317. ' <label class="col-sm-2 control-label">网关</label>\n' +
  318. ' <div class="col-sm-3">\n' +
  319. ' <input title="网关" class="form-control" name="gateway" type="text" value="' + ip_pool.gateway + '">\n' +
  320. ' </div>\n' +
  321. ' </div>\n' +
  322. ' <div class="form-group">\n' +
  323. ' <label class="col-sm-2 control-label">DNS1</label>\n' +
  324. ' <div class="col-sm-3">\n' +
  325. ' <input title="DNS1" class="form-control" name="dns1" type="text" value="' + ip_pool.dns1 + '">\n' +
  326. ' </div>\n' +
  327. ' <label class="col-sm-2 control-label">DNS2</label>\n' +
  328. ' <div class="col-sm-3">\n' +
  329. ' <input title="DNS2" class="form-control" name="dns2" type="text" value="' + ip_pool.dns2 + '">\n' +
  330. ' </div>\n' +
  331. ' </div>\n' +
  332. ' <div class="form-group">\n' +
  333. ' <label class="col-sm-2 control-label">名称</label>\n' +
  334. ' <div class="col-sm-3">\n' +
  335. ' <input title="名称" class="form-control" name="name" type="text" value="' + ip_pool.name + '">\n' +
  336. ' </div>\n' +
  337. ' <label class="col-sm-2 control-label">备注</label>\n' +
  338. ' <div class="col-sm-3">\n' +
  339. ' <textarea title="备注" class="form-control" name="description">'+ip_pool.description+'</textarea>\n' +
  340. ' </div>\n' +
  341. ' </div>\n' +
  342. ' <div class="form-group" style="margin-bottom: 0;">\n' +
  343. ' <div class="col-sm-6">\n' +
  344. ' <input type="checkbox" name="activity" data-on-color="info" class="input-switch" data-id="' + ip_pool.id + '" ' + activity_checked + ' data-size="medium" data-on-text="活跃" data-off-text="非活跃">\n' +
  345. ' </div>\n' +
  346. ' <div class="col-sm-6">\n' +
  347. ' <div style="padding: 0; text-align: right;">\n' +
  348. ' <button type="button" class="btn btn-sm btn-primary" style="right: 10%;" data-id="' + ip_pool.id + '" onclick="update_ip_pool(this);">更新</button>\n' +
  349. ' <button type="button" class="btn btn-sm btn-danger" style="right: 4%;" data-toggle="modal" data-target="#ip_pool_delete_modal" onclick="$(\'#ip_pool_id\').val(get_ip_pool_field_value(this, \'id\'));\n' +
  350. ' $(\'#delete_instance_desc\').text(get_ip_pool_field_value(this, \'name\'))">删除</button>\n' +
  351. ' </div>\n' +
  352. ' </div>\n' +
  353. ' </div>\n' +
  354. ' </form>\n' +
  355. ' </div>\n' +
  356. '</div>';
  357. }
  358. function get_ip_pools_html() {
  359. var html = '<div class="row" style="padding: 10px 10px 10px 0; width: 100%;">\n' +
  360. ' <div class="col-sm-12" style="padding-right: 0;">\n' +
  361. ' <div class="pull-right">\n' +
  362. ' <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>\n' +
  363. ' <a class="btn btn-info" href="javascript:;" data-toggle="modal" data-target="#add_ip_pool_modal" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加 IP 池</a>\n' +
  364. ' <a class="btn btn-black" href="javascript:;" data-toggle="modal" data-target="#reserved_ip_modal" style="border-radius: 0; padding-left: 40px; padding-right: 40px; color: white;">保留 IP</a>\n' +
  365. ' </div>\n' +
  366. ' </div>\n' +
  367. '</div>';
  368. $.ajax({
  369. url : '/api/ip_pools',
  370. type : 'GET',
  371. contentType: "application/json; charset=utf-8",
  372. dataType: 'json',
  373. async: false,
  374. error : function() {
  375. },
  376. success : function(data, textStatus, xhr) {
  377. $.each(data.data, function(k, v) {
  378. html += exchange_ip_pool_for_panel(v);
  379. });
  380. }
  381. });
  382. return html
  383. }
  384. function refresh_ip_pools() {
  385. var html = get_ip_pools_html();
  386. $('#view_by_ip_pool').append(html);
  387. }
  388. function get_ip_pool_field_value(me, name) {
  389. return $(me).parent().parent().parent().parent().serializeArray().filter(
  390. function(field) {return field.name == name})[0].value;
  391. }
  392. function update_ip_pool(me) {
  393. var id = get_ip_pool_field_value(me, 'id');
  394. var start_ip = get_ip_pool_field_value(me, 'start_ip');
  395. var end_ip = get_ip_pool_field_value(me, 'end_ip');
  396. var netmask = get_ip_pool_field_value(me, 'netmask');
  397. var gateway = get_ip_pool_field_value(me, 'gateway');
  398. var dns1 = get_ip_pool_field_value(me, 'dns1');
  399. var dns2 = get_ip_pool_field_value(me, 'dns2');
  400. var name = get_ip_pool_field_value(me, 'name');
  401. var description = get_ip_pool_field_value(me, 'description');
  402. var data = {
  403. start_ip: start_ip,
  404. end_ip: end_ip,
  405. netmask: netmask,
  406. gateway: gateway,
  407. dns1: dns1,
  408. dns2: dns2,
  409. name: name,
  410. description: description
  411. };
  412. $.ajax({
  413. url : '/api/ip_pools/' + String(id),
  414. type : 'PATCH',
  415. contentType: "application/json; charset=utf-8",
  416. async: false,
  417. dataType: "json",
  418. data : JSON.stringify(data),
  419. error : function(data, textStatus, xhr) {
  420. alter_danger(data.responseText);
  421. alter_warning('更新 IP 池失败!');
  422. },
  423. success : function(data, textStatus, xhr) {
  424. alter_success('更新 IP 池成功!');
  425. }
  426. });
  427. setTimeout(function() {
  428. window.location.reload();
  429. }, 3000);
  430. }
  431. function create_ip_pool(me) {
  432. $('#add_ip_pool_modal').modal('hide');
  433. var start_ip = get_ip_pool_field_value(me, 'start_ip');
  434. var end_ip = get_ip_pool_field_value(me, 'end_ip');
  435. var netmask = get_ip_pool_field_value(me, 'netmask');
  436. var gateway = get_ip_pool_field_value(me, 'gateway');
  437. var dns1 = get_ip_pool_field_value(me, 'dns1');
  438. var dns2 = get_ip_pool_field_value(me, 'dns2');
  439. var name = get_ip_pool_field_value(me, 'name');
  440. var description = get_ip_pool_field_value(me, 'description');
  441. var activity = $('#activity').prop('checked');
  442. var data = {
  443. start_ip: start_ip,
  444. end_ip: end_ip,
  445. netmask: netmask,
  446. gateway: gateway,
  447. dns1: dns1,
  448. dns2: dns2,
  449. name: name,
  450. description: description,
  451. activity: activity
  452. };
  453. $.ajax({
  454. url : '/api/ip_pool',
  455. type : 'POST',
  456. contentType: "application/json; charset=utf-8",
  457. async: false,
  458. dataType: "json",
  459. data : JSON.stringify(data),
  460. error : function(data, textStatus, xhr) {
  461. alter_danger(data.responseText);
  462. alter_warning('添加 IP 池失败!');
  463. },
  464. success : function(data, textStatus, xhr) {
  465. alter_success('您所提交的 IP 池已创建。页面将在3秒钟后自动跳转到 IP 池列表页面!');
  466. }
  467. });
  468. setTimeout(function() {
  469. window.location.reload();
  470. }, 3000);
  471. }
  472. function put_ip_pool_activity(id) {
  473. $.ajax({
  474. url : '/api/ip_pool/' + String(id),
  475. type : 'PUT',
  476. async: false,
  477. dataType: "json",
  478. error : function(data, textStatus, xhr) {
  479. alter_danger(data.responseText);
  480. alter_warning('IP 池激活失败!');
  481. },
  482. success : function(data, textStatus, xhr) {
  483. alter_success('IP 池激活成功!');
  484. }
  485. });
  486. setTimeout(function() {
  487. window.location.reload();
  488. }, 3000);
  489. }
  490. function ip_pool_delete_at(me) {
  491. var ip_pool_id = $('#ip_pool_id').val();
  492. ip_pool_remove(ip_pool_id);
  493. $('#ip_pool_delete_modal').modal('hide');
  494. }
  495. function ip_pool_remove(id) {
  496. $.ajax({
  497. url : '/api/ip_pools/' + id,
  498. type : 'DELETE',
  499. contentType: "application/json; charset=utf-8",
  500. error : function() {
  501. alter_danger('IP 池删除指令发送失败!');
  502. },
  503. success : function() {
  504. alter_success('IP 池删除指令发送成功!');
  505. setTimeout(function() {
  506. refresh();
  507. }, 1000);
  508. }
  509. });
  510. }
  511. function row_onmouseover(me) {
  512. $(me).find(".delete_reserved_ip_trigger").css('display','inline-flex');
  513. }
  514. function row_onmouseout(me) {
  515. $(me).find(".delete_reserved_ip_trigger").css('display','none');
  516. }
  517. function add_reserved_ip(ip) {
  518. $.ajax({
  519. url : '/api/reserved_ip',
  520. type : 'POST',
  521. contentType: "application/json; charset=utf-8",
  522. async: false,
  523. dataType: "json",
  524. data : JSON.stringify({ip: ip}),
  525. error : function(data, textStatus, xhr) {
  526. alter_danger(data.responseText);
  527. alter_warning('添加保留 IP 失败!');
  528. },
  529. success : function(data, textStatus, xhr) {
  530. var html = '<tr role="row" data-id="' + data['data']['id'] + '" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">\n' +
  531. ' <td class="text-center">\n' +
  532. data['data']['ip'] +
  533. ' <div style="display: inline;">\n' +
  534. ' <a href="javascript:;" class="delete_reserved_ip_trigger" style="display: none; float: right;">\n' +
  535. ' <span onclick="reserved_ip_delete(this);" class="glyph-icon icon-iconic-cancel" style="width: 20px; height: 20px; margin-left: 10px; border-radius: 0; color: indianred;"></span>\n' +
  536. ' </a>\n' +
  537. ' </div>\n' +
  538. ' </td>\n' +
  539. '</tr>';
  540. $('#reserved_ip_table tbody').append(html);
  541. alter_success('添加保留 IP 成功!');
  542. }
  543. });
  544. }
  545. function reserved_ip_refresh() {
  546. $.ajax({
  547. url : '/api/reserved_ips',
  548. type : 'GET',
  549. contentType: "application/json; charset=utf-8",
  550. dataType: 'json',
  551. async: false,
  552. error : function() {
  553. },
  554. success : function(data, textStatus, xhr) {
  555. var html = NaN;
  556. $('#reserved_ip_table tbody').empty();
  557. $.each(data.data, function(k, v) {
  558. html = '<tr role="row" data-id="' + v['id'] + '" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">\n' +
  559. ' <td class="text-center">\n' +
  560. v['ip'] +
  561. ' <div style="display: inline;">\n' +
  562. ' <a href="javascript:;" class="delete_reserved_ip_trigger" style="display: none; float: right;">\n' +
  563. ' <span onclick="reserved_ip_delete(this);" class="glyph-icon icon-iconic-cancel" style="width: 20px; height: 20px; margin-left: 10px; border-radius: 0; color: indianred;"></span>\n' +
  564. ' </a>\n' +
  565. ' </div>\n' +
  566. ' </td>\n' +
  567. '</tr>';
  568. $('#reserved_ip_table tbody').append(html);
  569. });
  570. }
  571. });
  572. }
  573. function reserved_ip_delete(me) {
  574. var id = $(me).parent().parent().parent().parent().data('id');
  575. $.ajax({
  576. url : '/api/reserved_ips/' + id,
  577. type : 'DELETE',
  578. contentType: "application/json; charset=utf-8",
  579. async: false,
  580. error : function(data, textStatus, xhr) {
  581. alter_danger(data.responseText);
  582. alter_warning('添加保留 IP 失败!');
  583. },
  584. success : function(data, textStatus, xhr) {
  585. $('#reserved_ip_table tbody tr[data-id="' +id + '"]').remove()
  586. alter_success('删除保留 IP 成功!');
  587. }
  588. });
  589. }
  590. function tokens_list_refresh() {
  591. $.ajax({
  592. url : '/api/tokens',
  593. type : 'GET',
  594. contentType: "application/json; charset=utf-8",
  595. dataType: 'json',
  596. async: false,
  597. error : function() {
  598. },
  599. success : function(data, textStatus, xhr) {
  600. var html = NaN;
  601. $('#tokens_list_table tbody').empty();
  602. $.each(data.data, function(k, v) {
  603. var color = 'forestgreen';
  604. var ttl = v['ttl'];
  605. if (ttl < 1) {
  606. ttl = '已过期';
  607. color = 'indianred';
  608. }
  609. html = '<tr role="row" class="odd">\n' +
  610. ' <td class="text-center">' + v['token'] + '</td>\n' +
  611. ' <td class="text-center" style="color: ' + color + ';">' + ttl + '</td>\n' +
  612. ' <td class="text-center">' + v['expire'] + '</td>\n' +
  613. '</tr>';
  614. $('#tokens_list_table tbody').append(html);
  615. });
  616. }
  617. });
  618. }
  619. function add_token() {
  620. $.ajax({
  621. url : '/api/token',
  622. type : 'POST',
  623. contentType: "application/json; charset=utf-8",
  624. async: false,
  625. error : function(data, textStatus, xhr) {
  626. alter_danger(data.responseText);
  627. alter_warning('添加 Token 失败!');
  628. },
  629. success : function(data, textStatus, xhr) {
  630. tokens_list_refresh();
  631. alter_success('添加 Token 成功!');
  632. }
  633. });
  634. }
  635. function add_vlan() {
  636. $('#add_vlan_modal').modal('hide');
  637. $.ajax({
  638. url : '/api/vlan',
  639. type : 'POST',
  640. contentType: "application/json; charset=utf-8",
  641. async: false,
  642. dataType: "json",
  643. data : JSON.stringify({
  644. vlan_name: $('#vlan_name').val(),
  645. vlan_id: parseInt($('#vlan_id').val()),
  646. vlan_description: $('#vlan_description').val()
  647. }),
  648. error : function(data, textStatus, xhr) {
  649. alter_danger(data.responseText);
  650. alter_warning('添加 VLAN 失败!');
  651. },
  652. success : function(data, textStatus, xhr) {
  653. var html = '<tr role="row" data-id="' + data['data']['id'] + '" class="odd" onmouseover="row_onmouseover(this);" onmouseout="row_onmouseout(this);">\n' +
  654. ' <td class="text-center">\n' +
  655. data['data']['vlan_name'] +
  656. ' <div style="display: inline;">\n' +
  657. ' <a href="javascript:;" class="delete_reserved_ip_trigger" style="display: none; float: right;">\n' +
  658. ' <span onclick="reserved_ip_delete(this);" class="glyph-icon icon-iconic-cancel" style="width: 20px; height: 20px; margin-left: 10px; border-radius: 0; color: indianred;"></span>\n' +
  659. ' </a>\n' +
  660. ' </div>\n' +
  661. ' </td>\n' +
  662. ' <td class="text-center">' + data['data']['vlan_id'] + '</td>\n' +
  663. ' <td class="text-center">' + data['data']['vlan_description'] + '</td>\n' +
  664. ' <td class="text-center">' + data['data']['create_time'] + '</td>\n' +
  665. '</tr>';
  666. $('#vlans_list_table tbody').append(html);
  667. alter_success('添加 VLAN 成功!');
  668. }
  669. });
  670. }
  671. </script>
  672. <div class="panel">
  673. <div class="panel-body">
  674. <ul class="nav nav-tabs mrg25B">
  675. <li class="active"><a href="javascript:;" onclick="select_this(this);" id="view_by_jimv_system_config_label">JimV 系统配置</a></li>
  676. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_ip_pool_label">IP 池</a></li>
  677. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_vlan_label">VLAN</a></li>
  678. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_quota_label">性能配额</a></li>
  679. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_token_label">Token</a></li>
  680. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_auxiliary_label">辅助</a></li>
  681. </ul>
  682. <div id="view_by_jimv_system_config" class="example-box-wrapper">
  683. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  684. <div class="form-group">
  685. <label class="col-sm-2 control-label">网桥(业务网络)</label>
  686. <div class="col-sm-3">
  687. <input title="Guest 业务网络" class="form-control" name="vm_network" type="text" disabled value="{{ config.vm_network }}">
  688. </div>
  689. <label class="col-sm-2 control-label">网桥(管理网络)</label>
  690. <div class="col-sm-3">
  691. <input title="Guest 管理网络" class="form-control" name="vm_manage_network" type="text" disabled value="{{ config.vm_manage_network }}">
  692. </div>
  693. </div>
  694. <div class="form-group">
  695. <label class="col-sm-2 control-label">虚拟机磁盘存储模式</label>
  696. <div class="col-sm-3">
  697. <select id="storage_mode" title="虚拟机磁盘存储模式" class="selectpicker" name="storage_mode" data-width="100%" disabled>
  698. <option {% if config.storage_mode == 0 %}selected{% endif %} value="0">本地存储</option>
  699. <option {% if config.storage_mode == 1 %}selected{% endif %} value="1" data-subtext="NFS">挂载共享</option>
  700. <option {% if config.storage_mode == 2 %}selected{% endif %} value="2">Ceph</option>
  701. <option {% if config.storage_mode == 3 %}selected{% endif %} value="3">GlusterFS</option>
  702. </select>
  703. </div>
  704. <label id="dfs_volume_label" class="col-sm-2 control-label" style="display: {% if config.storage_mode in [3] %}unset{% else %}none{% endif %};">分布式文件系统存储卷</label>
  705. <div class="col-sm-3">
  706. <input id="dfs_volume" title="分布式文件系统存储卷" class="form-control" name="dfs_volume" type="text" style="display: {% if config.storage_mode in [3] %}unset{% else %}none{% endif %};" disabled value="{{ config.dfs_volume }}">
  707. </div>
  708. </div>
  709. <div class="form-group">
  710. <label class="col-sm-2 control-label">虚拟机磁盘存放路径</label>
  711. <div class="col-sm-3">
  712. <input title="虚拟机磁盘存放路径" class="form-control" name="storage_path" type="text" disabled value="{{ config.storage_path }}">
  713. </div>
  714. </div>
  715. </form>
  716. </div>
  717. <div id="view_by_quota" class="example-box-wrapper" style="display: none;">
  718. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  719. <div class="form-group" style="margin-bottom: 0;">
  720. <label class="col-sm-2 control-label">
  721. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  722. &nbsp;&nbsp;IOPS 基准值
  723. </label>
  724. <div class="col-sm-3">
  725. <input id="iops_base" title="IOPS 基准值" class="form-control" type="text" value="{{ config.iops_base }}" name="iops_base">
  726. </div>
  727. <span class="col-sm-1"></span>
  728. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 基准值</label>
  729. <div class="col-sm-3">
  730. <input id="bps_base" title="BPS 基准值" class="form-control" type="text" value="{{ (config.bps_base / 1024 / 1024) | int }}" name="bps_base">
  731. </div>
  732. <span class="col-sm-1"></span>
  733. </div>
  734. <div class="form-group" style="margin-bottom: 0;">
  735. <label class="col-sm-2 control-label">
  736. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  737. &nbsp;&nbsp;IOPS/GiB 增益
  738. </label>
  739. <div class="col-sm-3">
  740. <input id="iops_pre_unit" title="IOPS/GiB 增益" class="form-control" type="text" value="{{ config.iops_pre_unit }}" name="iops_pre_unit">
  741. </div>
  742. <span class="col-sm-1"></span>
  743. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS/GiB 增益</label>
  744. <div class="col-sm-3">
  745. <input id="bps_pre_unit" title="BPS/GiB 增益 (MiB)" class="form-control" type="text" value="{{ '%0.2f'|format(config.bps_pre_unit / 1024 / 1024) }}" name="bps_pre_unit">
  746. </div>
  747. <span class="col-sm-1"></span>
  748. </div>
  749. <div class="form-group" style="margin-bottom: 0;">
  750. <label class="col-sm-2 control-label">
  751. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  752. &nbsp;&nbsp;IOPS 增益上限
  753. </label>
  754. <div class="col-sm-3">
  755. <input id="iops_cap" title="IOPS 增益上限" class="form-control" type="text" value="{{ config.iops_cap }}" name="iops_cap">
  756. </div>
  757. <span class="col-sm-1"></span>
  758. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 增益上限</label>
  759. <div class="col-sm-3">
  760. <input id="bps_cap" title="BPS 增益上限 (MiB)" class="form-control" type="text" value="{{ (config.bps_cap / 1024 / 1024) | int }}" name="bps_cap">
  761. </div>
  762. <span class="col-sm-1"></span>
  763. </div>
  764. <div class="form-group" style="margin-bottom: 0;">
  765. <label class="col-sm-2 control-label">
  766. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  767. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  768. &nbsp;&nbsp;IOPS 桶宽
  769. </label>
  770. <div class="col-sm-3">
  771. <input id="iops_max" title="IOPS 桶宽" class="form-control" type="text" value="{{ config.iops_max }}" name="iops_max">
  772. </div>
  773. <span class="col-sm-1"></span>
  774. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span><span class="glyph-icon icon-bitbucket"></span>&nbsp;&nbsp;BPS 桶宽</label>
  775. <div class="col-sm-3">
  776. <input id="bps_max" title="BPS 桶宽 (MiB)" class="form-control" type="text" value="{{ (config.bps_max / 1024 / 1024) | int }}" name="bps_max">
  777. </div>
  778. <span class="col-sm-1"></span>
  779. </div>
  780. <div class="form-group" style="margin-bottom: 0;">
  781. <label class="col-sm-2 control-label">
  782. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  783. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  784. &nbsp;&nbsp;IOPS 桶高
  785. </label>
  786. <div class="col-sm-3">
  787. <input id="iops_max_length" title="IOPS 桶高 (秒)" class="form-control" type="text" value="{{ config.iops_max_length }}" name="iops_max_length">
  788. </div>
  789. <span class="col-sm-1"></span>
  790. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span><span class="glyph-icon icon-bitbucket"></span>&nbsp;&nbsp;BPS 桶高</label>
  791. <div class="col-sm-3">
  792. <input id="bps_max_length" title="BPS 桶高 (秒)" class="form-control" type="text" value="{{ config.bps_max_length }}" name="bps_max_length">
  793. </div>
  794. <span class="col-sm-1"></span>
  795. </div>
  796. <div class="form-group" style="margin-bottom: 0;">
  797. <div class="col-sm-6">
  798. <label>
  799. <input id="influence_current_guest" type="checkbox" name="influence_current_guest">
  800. 同时更新已存在的实例
  801. </label>
  802. </div>
  803. <div class="col-sm-6">
  804. <div style="padding: 0; text-align: right;">
  805. <button type="button" class="btn btn-sm btn-primary" style="right: 10%;" onclick="update_quota();">更新</button>
  806. </div>
  807. </div>
  808. </div>
  809. </form>
  810. </div>
  811. <div id="view_by_ip_pool" class="example-box-wrapper" style="display: none;">
  812. </div>
  813. <div id="view_by_vlan" class="example-box-wrapper" style="display: none;">
  814. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  815. <div class="col-sm-12" style="padding-right: 0;">
  816. <div class="pull-right">
  817. <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  818. <a class="btn btn-info" href="javascript:;" data-toggle="modal" data-target="#add_vlan_modal" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加 VLAN</a>
  819. </div>
  820. </div>
  821. </div>
  822. <table id="vlans_list_table" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid" style="width: 100%;">
  823. <thead>
  824. <tr role="row">
  825. <th class="text-center">名称</th>
  826. <th class="text-center">VLAN ID</th>
  827. <th class="text-center">备注</th>
  828. <th class="text-center">创建时间</th>
  829. </tr>
  830. </thead>
  831. <tbody>
  832. </tbody>
  833. </table>
  834. </div>
  835. <div id="view_by_token" class="example-box-wrapper" style="display: none;">
  836. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  837. <div class="col-sm-12" style="padding-right: 0;">
  838. <div class="pull-right">
  839. <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  840. <a class="btn btn-info" href="javascript:;" onclick="add_token();" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加 Token</a>
  841. </div>
  842. </div>
  843. </div>
  844. <table id="tokens_list_table" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid" style="width: 100%;">
  845. <thead>
  846. <tr role="row">
  847. <th class="text-center">Token</th>
  848. <th class="text-center">TTL</th>
  849. <th class="text-center">逾期时间</th>
  850. </tr>
  851. </thead>
  852. <tbody>
  853. </tbody>
  854. </table>
  855. </div>
  856. <div id="view_by_auxiliary" class="example-box-wrapper" style="display: none;">
  857. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  858. <div class="form-group" style="margin-bottom: 0;">
  859. <div class="col-sm-3">
  860. <button type="button" class="btn btn-primary" onclick="refresh_guest_state();">刷新虚拟机状态</button>
  861. </div>
  862. </div>
  863. </form>
  864. </div>
  865. </div>
  866. </div>
  867. <input id="ip_pool_id" title="IP Pool ID" class="form-control" name="ip_pool_id" hidden>
  868. <div class="modal" id="add_ip_pool_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  869. <div class="modal-dialog modal-lg">
  870. <div class="modal-content">
  871. <div class="modal-header">
  872. <h4 class="modal-title">添加 IP 池:</h4>
  873. </div>
  874. <div class="panel">
  875. <div class="panel-body">
  876. <form class="form-horizontal bordered-row" style="padding-left: 16%;">
  877. <div class="form-group">
  878. <label class="col-sm-2 control-label">起始 IP</label>
  879. <div class="col-sm-3">
  880. <input title="起始 IP" class="form-control" name="start_ip" type="text">
  881. </div>
  882. <label class="col-sm-2 control-label">截止 IP</label>
  883. <div class="col-sm-3">
  884. <input title="截止 IP" class="form-control" name="end_ip" type="text">
  885. </div>
  886. </div>
  887. <div class="form-group">
  888. <label class="col-sm-2 control-label">子网掩码</label>
  889. <div class="col-sm-3">
  890. <input title="子网掩码" class="form-control" name="netmask" type="text">
  891. </div>
  892. <label class="col-sm-2 control-label">网关</label>
  893. <div class="col-sm-3">
  894. <input title="网关" class="form-control" name="gateway" type="text">
  895. </div>
  896. </div>
  897. <div class="form-group">
  898. <label class="col-sm-2 control-label">DNS1</label>
  899. <div class="col-sm-3">
  900. <input title="DNS1" class="form-control" name="dns1" type="text">
  901. </div>
  902. <label class="col-sm-2 control-label">DNS2</label>
  903. <div class="col-sm-3">
  904. <input title="DNS2" class="form-control" name="dns2" type="text">
  905. </div>
  906. </div>
  907. <div class="form-group">
  908. <label class="col-sm-2 control-label">名称</label>
  909. <div class="col-sm-3">
  910. <input title="名称" class="form-control" name="name" type="text">
  911. </div>
  912. <label class="col-sm-2 control-label">备注</label>
  913. <div class="col-sm-3">
  914. <textarea title="备注" class="form-control" name="description"></textarea>
  915. </div>
  916. </div>
  917. <div class="form-group" style="margin-bottom: 0;">
  918. <div class="col-sm-6">
  919. <div class="checkbox checkbox-info">
  920. <label>
  921. <input id="activity" name="activity" type="checkbox" checked class="custom-checkbox">
  922. 设为默认
  923. </label>
  924. </div>
  925. </div>
  926. <div class="col-sm-6">
  927. <div style="padding: 0; text-align: right;">
  928. <button type="button" class="btn btn-sm btn-primary" style="right: 20%;" onclick="create_ip_pool(this);">创建</button>
  929. <button type="button" class="btn btn-sm btn-default" style="right: 10%;" data-dismiss="modal">取消</button>
  930. </div>
  931. </div>
  932. </div>
  933. </form>
  934. </div>
  935. </div>
  936. </div>
  937. </div>
  938. </div>
  939. <div class="modal" id="ip_pool_delete_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  940. <div class="modal-dialog">
  941. <div class="modal-content">
  942. <div class="modal-header">
  943. <h4 class="modal-title">删除 IP 池:</h4>
  944. </div>
  945. <div class="modal-body">
  946. <p>您确定要删除该 IP 池吗?</p>
  947. <h3 style="color: orangered;" id="delete_instance_desc"></h3>
  948. </div>
  949. <div class="modal-footer">
  950. <button type="button" class="btn btn-sm btn-primary" onclick="ip_pool_delete_at();">确定</button>
  951. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  952. </div>
  953. </div>
  954. </div>
  955. </div>
  956. <div class="modal" id="reserved_ip_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  957. <div class="modal-dialog modal-sm">
  958. <div class="modal-content">
  959. <div class="modal-header">
  960. <h4 class="modal-title">保留 IP:</h4>
  961. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  962. <span aria-hidden="true">&times;</span>
  963. </button>
  964. </div>
  965. <div class="modal-body" style="padding-top: 0; padding-bottom: 0;">
  966. <div class="example-box-wrapper">
  967. <form id="reserved_ip_form" class="form-horizontal bordered-row" action="javascript:;">
  968. <div class="form-group">
  969. <div class="col-sm-1"></div>
  970. <div class="col-sm-10" style="height: 300px; overflow: auto;">
  971. <table id="reserved_ip_table" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid"
  972. style="width: 100%; margin-bottom: 0;">
  973. <tbody></tbody>
  974. </table>
  975. </div>
  976. <div class="col-sm-1"></div>
  977. </div>
  978. <div class="form-group">
  979. <div class="col-sm-1"></div>
  980. <div class="col-sm-10">
  981. <input id="reserved_ip_input" class="form-control" style="text-align: center;" type="text" placeholder="将要保留的 IP">
  982. </div>
  983. <div class="col-sm-1"></div>
  984. </div>
  985. </form>
  986. </div>
  987. </div>
  988. </div>
  989. </div>
  990. </div>
  991. <div class="modal" id="add_vlan_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  992. <div class="modal-dialog modal-sm">
  993. <div class="modal-content">
  994. <div class="modal-header">
  995. <h4 class="modal-title">添加 VLAN:</h4>
  996. </div>
  997. <div class="panel">
  998. <div class="panel-body">
  999. <form class="form-horizontal bordered-row" style="padding-left: 16%;">
  1000. <div class="form-group">
  1001. <label class="col-sm-3 control-label" style="padding-right: 0;">名称</label>
  1002. <div class="col-sm-8">
  1003. <input title="VLAN 名称" class="form-control" name="vlan_name" type="text">
  1004. </div>
  1005. </div>
  1006. <div class="form-group">
  1007. <label class="col-sm-3 control-label" style="padding-right: 0;">VLAN ID</label>
  1008. <div class="col-sm-8">
  1009. <input title="VLAN ID" class="form-control" name="vlan_id" type="text">
  1010. </div>
  1011. </div>
  1012. <div class="form-group">
  1013. <label class="col-sm-3 control-label" style="padding-right: 0;">备注</label>
  1014. <div class="col-sm-8">
  1015. <textarea title="备注" class="form-control" name="vlan_description"></textarea>
  1016. </div>
  1017. </div>
  1018. <div class="form-group" style="margin-bottom: 0;">
  1019. <div class="col-sm-6">
  1020. </div>
  1021. <div class="col-sm-6">
  1022. <div style="padding: 0; text-align: right;">
  1023. <button type="button" class="btn btn-sm btn-primary" style="right: 20%;" onclick="add_vlan(this);">创建</button>
  1024. <button type="button" class="btn btn-sm btn-default" style="right: 10%;" data-dismiss="modal">取消</button>
  1025. </div>
  1026. </div>
  1027. </div>
  1028. </form>
  1029. </div>
  1030. </div>
  1031. </div>
  1032. </div>
  1033. </div>
  1034. {% endblock content %}