config_show.html 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  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. label: $('#vlan_label').val(),
  645. vlan_id: parseInt($('#vlan_id').val()),
  646. 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']['label'] +
  656. ' </td>\n' +
  657. ' <td class="text-center">' + data['data']['vlan_id'] + '</td>\n' +
  658. ' <td class="text-center">' + data['data']['description'] + '</td>\n' +
  659. ' <td class="text-center">' + data['data']['create_time'] + '</td>\n' +
  660. '</tr>';
  661. $('#vlans_list_table tbody').append(html);
  662. alter_success('添加 VLAN 成功!');
  663. }
  664. });
  665. }
  666. </script>
  667. <div class="panel">
  668. <div class="panel-body">
  669. <ul class="nav nav-tabs mrg25B">
  670. <li class="active"><a href="javascript:;" onclick="select_this(this);" id="view_by_jimv_system_config_label">JimV 系统配置</a></li>
  671. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_ip_pool_label">IP 池</a></li>
  672. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_vlan_label">VLAN</a></li>
  673. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_quota_label">性能配额</a></li>
  674. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_token_label">Token</a></li>
  675. <li><a href="javascript:;" onclick="select_this(this);" id="view_by_auxiliary_label">辅助</a></li>
  676. </ul>
  677. <div id="view_by_jimv_system_config" class="example-box-wrapper">
  678. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  679. <div class="form-group">
  680. <label class="col-sm-2 control-label">网桥(业务网络)</label>
  681. <div class="col-sm-3">
  682. <input title="Guest 业务网络" class="form-control" name="vm_network" type="text" disabled value="{{ config.vm_network }}">
  683. </div>
  684. <label class="col-sm-2 control-label">网桥(管理网络)</label>
  685. <div class="col-sm-3">
  686. <input title="Guest 管理网络" class="form-control" name="vm_manage_network" type="text" disabled value="{{ config.vm_manage_network }}">
  687. </div>
  688. </div>
  689. <div class="form-group">
  690. <label class="col-sm-2 control-label">虚拟机磁盘存储模式</label>
  691. <div class="col-sm-3">
  692. <select id="storage_mode" title="虚拟机磁盘存储模式" class="selectpicker" name="storage_mode" data-width="100%" disabled>
  693. <option {% if config.storage_mode == 0 %}selected{% endif %} value="0">本地存储</option>
  694. <option {% if config.storage_mode == 1 %}selected{% endif %} value="1" data-subtext="NFS">挂载共享</option>
  695. <option {% if config.storage_mode == 2 %}selected{% endif %} value="2">Ceph</option>
  696. <option {% if config.storage_mode == 3 %}selected{% endif %} value="3">GlusterFS</option>
  697. </select>
  698. </div>
  699. <label id="dfs_volume_label" class="col-sm-2 control-label" style="display: {% if config.storage_mode in [3] %}unset{% else %}none{% endif %};">分布式文件系统存储卷</label>
  700. <div class="col-sm-3">
  701. <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 }}">
  702. </div>
  703. </div>
  704. <div class="form-group">
  705. <label class="col-sm-2 control-label">虚拟机磁盘存放路径</label>
  706. <div class="col-sm-3">
  707. <input title="虚拟机磁盘存放路径" class="form-control" name="storage_path" type="text" disabled value="{{ config.storage_path }}">
  708. </div>
  709. </div>
  710. </form>
  711. </div>
  712. <div id="view_by_quota" class="example-box-wrapper" style="display: none;">
  713. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  714. <div class="form-group" style="margin-bottom: 0;">
  715. <label class="col-sm-2 control-label">
  716. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  717. &nbsp;&nbsp;IOPS 基准值
  718. </label>
  719. <div class="col-sm-3">
  720. <input id="iops_base" title="IOPS 基准值" class="form-control" type="text" value="{{ config.iops_base }}" name="iops_base">
  721. </div>
  722. <span class="col-sm-1"></span>
  723. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 基准值</label>
  724. <div class="col-sm-3">
  725. <input id="bps_base" title="BPS 基准值" class="form-control" type="text" value="{{ (config.bps_base / 1024 / 1024) | int }}" name="bps_base">
  726. </div>
  727. <span class="col-sm-1"></span>
  728. </div>
  729. <div class="form-group" style="margin-bottom: 0;">
  730. <label class="col-sm-2 control-label">
  731. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  732. &nbsp;&nbsp;IOPS/GiB 增益
  733. </label>
  734. <div class="col-sm-3">
  735. <input id="iops_pre_unit" title="IOPS/GiB 增益" class="form-control" type="text" value="{{ config.iops_pre_unit }}" name="iops_pre_unit">
  736. </div>
  737. <span class="col-sm-1"></span>
  738. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS/GiB 增益</label>
  739. <div class="col-sm-3">
  740. <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">
  741. </div>
  742. <span class="col-sm-1"></span>
  743. </div>
  744. <div class="form-group" style="margin-bottom: 0;">
  745. <label class="col-sm-2 control-label">
  746. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  747. &nbsp;&nbsp;IOPS 增益上限
  748. </label>
  749. <div class="col-sm-3">
  750. <input id="iops_cap" title="IOPS 增益上限" class="form-control" type="text" value="{{ config.iops_cap }}" name="iops_cap">
  751. </div>
  752. <span class="col-sm-1"></span>
  753. <label class="col-sm-2 control-label"><span class="glyph-icon icon-openid"></span>&nbsp;&nbsp;BPS 增益上限</label>
  754. <div class="col-sm-3">
  755. <input id="bps_cap" title="BPS 增益上限 (MiB)" class="form-control" type="text" value="{{ (config.bps_cap / 1024 / 1024) | int }}" name="bps_cap">
  756. </div>
  757. <span class="col-sm-1"></span>
  758. </div>
  759. <div class="form-group" style="margin-bottom: 0;">
  760. <label class="col-sm-2 control-label">
  761. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  762. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  763. &nbsp;&nbsp;IOPS 桶宽
  764. </label>
  765. <div class="col-sm-3">
  766. <input id="iops_max" title="IOPS 桶宽" class="form-control" type="text" value="{{ config.iops_max }}" name="iops_max">
  767. </div>
  768. <span class="col-sm-1"></span>
  769. <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>
  770. <div class="col-sm-3">
  771. <input id="bps_max" title="BPS 桶宽 (MiB)" class="form-control" type="text" value="{{ (config.bps_max / 1024 / 1024) | int }}" name="bps_max">
  772. </div>
  773. <span class="col-sm-1"></span>
  774. </div>
  775. <div class="form-group" style="margin-bottom: 0;">
  776. <label class="col-sm-2 control-label">
  777. <span class="glyph-icon icon-exchange" style="transform: rotate(90deg); display: inline-flex;"></span>
  778. <span class="glyph-icon icon-bitbucket" style="margin-left: -4px;"></span>
  779. &nbsp;&nbsp;IOPS 桶高
  780. </label>
  781. <div class="col-sm-3">
  782. <input id="iops_max_length" title="IOPS 桶高 (秒)" class="form-control" type="text" value="{{ config.iops_max_length }}" name="iops_max_length">
  783. </div>
  784. <span class="col-sm-1"></span>
  785. <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>
  786. <div class="col-sm-3">
  787. <input id="bps_max_length" title="BPS 桶高 (秒)" class="form-control" type="text" value="{{ config.bps_max_length }}" name="bps_max_length">
  788. </div>
  789. <span class="col-sm-1"></span>
  790. </div>
  791. <div class="form-group" style="margin-bottom: 0;">
  792. <div class="col-sm-6">
  793. <label>
  794. <input id="influence_current_guest" type="checkbox" name="influence_current_guest">
  795. 同时更新已存在的实例
  796. </label>
  797. </div>
  798. <div class="col-sm-6">
  799. <div style="padding: 0; text-align: right;">
  800. <button type="button" class="btn btn-sm btn-primary" style="right: 10%;" onclick="update_quota();">更新</button>
  801. </div>
  802. </div>
  803. </div>
  804. </form>
  805. </div>
  806. <div id="view_by_ip_pool" class="example-box-wrapper" style="display: none;">
  807. </div>
  808. <div id="view_by_vlan" class="example-box-wrapper" style="display: none;">
  809. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  810. <div class="col-sm-12" style="padding-right: 0;">
  811. <div class="pull-right">
  812. <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  813. <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>
  814. </div>
  815. </div>
  816. </div>
  817. <table id="vlans_list_table" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid" style="width: 100%;">
  818. <thead>
  819. <tr role="row">
  820. <th class="text-center">名称</th>
  821. <th class="text-center">VLAN ID</th>
  822. <th class="text-center">备注</th>
  823. <th class="text-center">创建时间</th>
  824. </tr>
  825. </thead>
  826. <tbody>
  827. </tbody>
  828. </table>
  829. </div>
  830. <div id="view_by_token" class="example-box-wrapper" style="display: none;">
  831. <div class="row" style="padding: 10px 10px 10px 0; width: 100%;">
  832. <div class="col-sm-12" style="padding-right: 0;">
  833. <div class="pull-right">
  834. <button class="btn btn-default" onclick="window.location.reload();" style="border-radius: 0;"><span class="glyph-icon icon-elusive-arrows-cw"></span></button>
  835. <a class="btn btn-info" href="javascript:;" onclick="add_token();" style="border-radius: 0; padding-left: 40px; padding-right: 40px;">添加 Token</a>
  836. </div>
  837. </div>
  838. </div>
  839. <table id="tokens_list_table" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid" style="width: 100%;">
  840. <thead>
  841. <tr role="row">
  842. <th class="text-center">Token</th>
  843. <th class="text-center">TTL</th>
  844. <th class="text-center">逾期时间</th>
  845. </tr>
  846. </thead>
  847. <tbody>
  848. </tbody>
  849. </table>
  850. </div>
  851. <div id="view_by_auxiliary" class="example-box-wrapper" style="display: none;">
  852. <form class="form-horizontal bordered-row" style="padding-left: 8%;">
  853. <div class="form-group" style="margin-bottom: 0;">
  854. <div class="col-sm-3">
  855. <button type="button" class="btn btn-primary" onclick="refresh_guest_state();">刷新虚拟机状态</button>
  856. </div>
  857. </div>
  858. </form>
  859. </div>
  860. </div>
  861. </div>
  862. <input id="ip_pool_id" title="IP Pool ID" class="form-control" name="ip_pool_id" hidden>
  863. <div class="modal" id="add_ip_pool_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  864. <div class="modal-dialog modal-lg">
  865. <div class="modal-content">
  866. <div class="modal-header">
  867. <h4 class="modal-title">添加 IP 池:</h4>
  868. </div>
  869. <div class="panel">
  870. <div class="panel-body">
  871. <form class="form-horizontal bordered-row" style="padding-left: 16%;">
  872. <div class="form-group">
  873. <label class="col-sm-2 control-label">起始 IP</label>
  874. <div class="col-sm-3">
  875. <input title="起始 IP" class="form-control" name="start_ip" type="text">
  876. </div>
  877. <label class="col-sm-2 control-label">截止 IP</label>
  878. <div class="col-sm-3">
  879. <input title="截止 IP" class="form-control" name="end_ip" type="text">
  880. </div>
  881. </div>
  882. <div class="form-group">
  883. <label class="col-sm-2 control-label">子网掩码</label>
  884. <div class="col-sm-3">
  885. <input title="子网掩码" class="form-control" name="netmask" type="text">
  886. </div>
  887. <label class="col-sm-2 control-label">网关</label>
  888. <div class="col-sm-3">
  889. <input title="网关" class="form-control" name="gateway" type="text">
  890. </div>
  891. </div>
  892. <div class="form-group">
  893. <label class="col-sm-2 control-label">DNS1</label>
  894. <div class="col-sm-3">
  895. <input title="DNS1" class="form-control" name="dns1" type="text">
  896. </div>
  897. <label class="col-sm-2 control-label">DNS2</label>
  898. <div class="col-sm-3">
  899. <input title="DNS2" class="form-control" name="dns2" type="text">
  900. </div>
  901. </div>
  902. <div class="form-group">
  903. <label class="col-sm-2 control-label">名称</label>
  904. <div class="col-sm-3">
  905. <input title="名称" class="form-control" name="name" type="text">
  906. </div>
  907. <label class="col-sm-2 control-label">备注</label>
  908. <div class="col-sm-3">
  909. <textarea title="备注" class="form-control" name="description"></textarea>
  910. </div>
  911. </div>
  912. <div class="form-group" style="margin-bottom: 0;">
  913. <div class="col-sm-6">
  914. <div class="checkbox checkbox-info">
  915. <label>
  916. <input id="activity" name="activity" type="checkbox" checked class="custom-checkbox">
  917. 设为默认
  918. </label>
  919. </div>
  920. </div>
  921. <div class="col-sm-6">
  922. <div style="padding: 0; text-align: right;">
  923. <button type="button" class="btn btn-sm btn-primary" style="right: 20%;" onclick="create_ip_pool(this);">创建</button>
  924. <button type="button" class="btn btn-sm btn-default" style="right: 10%;" data-dismiss="modal">取消</button>
  925. </div>
  926. </div>
  927. </div>
  928. </form>
  929. </div>
  930. </div>
  931. </div>
  932. </div>
  933. </div>
  934. <div class="modal" id="ip_pool_delete_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  935. <div class="modal-dialog">
  936. <div class="modal-content">
  937. <div class="modal-header">
  938. <h4 class="modal-title">删除 IP 池:</h4>
  939. </div>
  940. <div class="modal-body">
  941. <p>您确定要删除该 IP 池吗?</p>
  942. <h3 style="color: orangered;" id="delete_instance_desc"></h3>
  943. </div>
  944. <div class="modal-footer">
  945. <button type="button" class="btn btn-sm btn-primary" onclick="ip_pool_delete_at();">确定</button>
  946. <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
  947. </div>
  948. </div>
  949. </div>
  950. </div>
  951. <div class="modal" id="reserved_ip_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  952. <div class="modal-dialog modal-sm">
  953. <div class="modal-content">
  954. <div class="modal-header">
  955. <h4 class="modal-title">保留 IP:</h4>
  956. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  957. <span aria-hidden="true">&times;</span>
  958. </button>
  959. </div>
  960. <div class="modal-body" style="padding-top: 0; padding-bottom: 0;">
  961. <div class="example-box-wrapper">
  962. <form id="reserved_ip_form" class="form-horizontal bordered-row" action="javascript:;">
  963. <div class="form-group">
  964. <div class="col-sm-1"></div>
  965. <div class="col-sm-10" style="height: 300px; overflow: auto;">
  966. <table id="reserved_ip_table" class="table table-bordered table-hover" cellspacing="0" width="100%" role="grid"
  967. style="width: 100%; margin-bottom: 0;">
  968. <tbody></tbody>
  969. </table>
  970. </div>
  971. <div class="col-sm-1"></div>
  972. </div>
  973. <div class="form-group">
  974. <div class="col-sm-1"></div>
  975. <div class="col-sm-10">
  976. <input id="reserved_ip_input" class="form-control" style="text-align: center;" type="text" placeholder="将要保留的 IP">
  977. </div>
  978. <div class="col-sm-1"></div>
  979. </div>
  980. </form>
  981. </div>
  982. </div>
  983. </div>
  984. </div>
  985. </div>
  986. <div class="modal" id="add_vlan_modal" tabindex="-1" role="dialog" style="margin-top: 100px;">
  987. <div class="modal-dialog modal-sm">
  988. <div class="modal-content">
  989. <div class="modal-header">
  990. <h4 class="modal-title">添加 VLAN:</h4>
  991. </div>
  992. <div class="panel">
  993. <div class="panel-body">
  994. <form class="form-horizontal bordered-row" style="padding-left: 16%;">
  995. <div class="form-group">
  996. <label class="col-sm-3 control-label" style="padding-right: 0;">名称</label>
  997. <div class="col-sm-8">
  998. <input title="VLAN 名称" class="form-control" id="vlan_label" name="vlan_label" type="text">
  999. </div>
  1000. </div>
  1001. <div class="form-group">
  1002. <label class="col-sm-3 control-label" style="padding-right: 0;">VLAN ID</label>
  1003. <div class="col-sm-8">
  1004. <input title="VLAN ID" class="form-control" id="vlan_id" name="vlan_id" type="text">
  1005. </div>
  1006. </div>
  1007. <div class="form-group">
  1008. <label class="col-sm-3 control-label" style="padding-right: 0;">备注</label>
  1009. <div class="col-sm-8">
  1010. <textarea title="备注" class="form-control" id="vlan_description" name="vlan_description"></textarea>
  1011. </div>
  1012. </div>
  1013. <div class="form-group" style="margin-bottom: 0;">
  1014. <div class="col-sm-6">
  1015. </div>
  1016. <div class="col-sm-6">
  1017. <div style="padding: 0; text-align: right;">
  1018. <button type="button" class="btn btn-sm btn-primary" style="right: 20%;" onclick="add_vlan(this);">创建</button>
  1019. <button type="button" class="btn btn-sm btn-default" style="right: 10%;" data-dismiss="modal">取消</button>
  1020. </div>
  1021. </div>
  1022. </div>
  1023. </form>
  1024. </div>
  1025. </div>
  1026. </div>
  1027. </div>
  1028. </div>
  1029. {% endblock content %}