guest_create.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. {% extends "layout.html" %}
  2. {% block head %}
  3. {{ super() }}
  4. <style type="text/css">
  5. @media (min-width: 768px) {
  6. .form-horizontal .control-label {
  7. text-align: left;
  8. }
  9. }
  10. label>span {
  11. color: deepskyblue;
  12. }
  13. .btn,
  14. .form-group>div>div,
  15. .form-control {
  16. border-radius: 0;
  17. }
  18. .btn-ability {
  19. margin-right: 16px;
  20. height: 50px;
  21. padding: 8px 50px;
  22. margin-bottom: 30px;
  23. }
  24. .btn-ability-line {
  25. }
  26. </style>
  27. {% endblock head %}
  28. {% block body %}
  29. <script>
  30. $(document).ready(function() {
  31. $('body').addClass('add-transition');
  32. $('.add-page-transition').on('click', function(){
  33. var transAttr = $(this).attr('data-transition');
  34. $('.add-transition').attr('class', 'add-transition');
  35. $('.add-transition').addClass(transAttr);
  36. });
  37. $('#create_guest_form').formValidation({
  38. framework: 'bootstrap4',
  39. icon: {
  40. valid: 'fa fa-check',
  41. invalid: 'fa fa-times',
  42. validating: 'fa fa-refresh'
  43. },
  44. // Since the Bootstrap Button hides the radio and checkbox
  45. // We exclude the disabled elements only
  46. excluded: ':disabled',
  47. locale: 'zh_CN',
  48. fields: {
  49. ability: {
  50. validators: {
  51. notEmpty: {
  52. }
  53. }
  54. },
  55. os_template_id: {
  56. validators: {
  57. notEmpty: {
  58. }
  59. }
  60. },
  61. quantity: {
  62. validators: {
  63. between: {
  64. min: 1,
  65. max: 20
  66. }
  67. }
  68. },
  69. password: {
  70. validators: {
  71. notEmpty: {
  72. },
  73. identical: {
  74. field: 'confirm_password'
  75. },
  76. stringLength: {
  77. max: 128
  78. }
  79. }
  80. },
  81. confirm_password: {
  82. validators: {
  83. identical: {
  84. field: 'password'
  85. }
  86. }
  87. },
  88. remark: {
  89. validators: {
  90. stringLength: {
  91. max: 64
  92. }
  93. }
  94. }
  95. }
  96. })
  97. .on('success.field.fv', function(e, data) {
  98. if (data.fv.getInvalidFields().length > 0) { // There is invalid field
  99. data.fv.disableSubmitButtons(true);
  100. }
  101. });
  102. });
  103. $(function() { "use strict";
  104. $("#quantity").TouchSpin({
  105. max: 20,
  106. min: 1,
  107. verticalbuttons: true,
  108. verticalupclass: 'glyph-icon icon-plus',
  109. verticaldownclass: 'glyph-icon icon-minus'
  110. });
  111. });
  112. </script>
  113. <div class="container" style="padding-top: 100px;">
  114. <div class="panel">
  115. <div class="panel-body">
  116. <h3 class="title-hero" style="display: inline;">
  117. 创建实例
  118. </h3>
  119. <a href="/guests" class="btn btn-xs btn-default add-page-transition" data-transition="pt-page-moveFromLeft-init" style="margin-bottom: 4px; margin-left: 10px;">
  120. <span class="glyph-icon icon-separator" style="transform: rotateY(-180deg);">
  121. <i class="glyph-icon icon-level-up"></i>
  122. </span>
  123. <span class="button-content">
  124. 返回虚拟机列表
  125. </span>
  126. </a>
  127. <div class="example-box-wrapper">
  128. <form id="create_guest_form" class="form-horizontal bordered-row" action="/guests/create" method="post">
  129. <div class="form-group">
  130. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-gauge"></span>&nbsp;&nbsp;运算能力</label>
  131. <div class="col-sm-10">
  132. <div class="btn-ability-line" data-toggle="buttons">
  133. <label class="btn btn-default btn-ability">
  134. <input title="1 CPU 1GB Memory" name="ability" type="radio" value="1c1g">1&nbsp;&nbsp;核&nbsp;&nbsp;1&nbsp;&nbsp;GB
  135. </label>
  136. <label class="btn btn-default btn-ability">
  137. <input title="1 CPU 2GB Memory" name="ability" type="radio" value="1c2g">1&nbsp;&nbsp;核&nbsp;&nbsp;2&nbsp;&nbsp;GB
  138. </label>
  139. <label class="btn btn-default btn-ability">
  140. <input title="2 CPU 2GB Memory" name="ability" type="radio" value="2c2g">2&nbsp;&nbsp;核&nbsp;&nbsp;2&nbsp;&nbsp;GB
  141. </label>
  142. <label class="btn btn-default btn-ability">
  143. <input title="2 CPU 4GB Memory" name="ability" type="radio" value="2c4g">2&nbsp;&nbsp;核&nbsp;&nbsp;4&nbsp;&nbsp;GB
  144. </label>
  145. <label class="btn btn-default btn-ability">
  146. <input title="4 CPU 4GB Memory" name="ability" type="radio" value="4c4g">4&nbsp;&nbsp;核&nbsp;&nbsp;4&nbsp;&nbsp;GB
  147. </label>
  148. <label class="btn btn-default btn-ability">
  149. <input title="4 CPU 8GB Memory" name="ability" type="radio" value="4c8g">4&nbsp;&nbsp;核&nbsp;&nbsp;8&nbsp;&nbsp;GB
  150. </label>
  151. <label class="btn btn-default btn-ability">
  152. <input title="8 CPU 8GB Memory" name="ability" type="radio" value="8c8g">8&nbsp;&nbsp;核&nbsp;&nbsp;8&nbsp;&nbsp;GB
  153. </label>
  154. <label class="btn btn-default btn-ability">
  155. <input title="8 CPU 16GB Memory" name="ability" type="radio" value="8c16g">8&nbsp;&nbsp;核&nbsp;&nbsp;16GB
  156. </label>
  157. <label class="btn btn-default btn-ability">
  158. <input title="1 CPU 16GB Memory" name="ability" type="radio" value="1c16g">1&nbsp;&nbsp;核&nbsp;&nbsp;16GB
  159. </label>
  160. <label class="btn btn-default btn-ability">
  161. <input title="4 CPU 32GB Memory" name="ability" type="radio" value="4c32g">4&nbsp;&nbsp;核&nbsp;&nbsp;32GB
  162. </label>
  163. <label class="btn btn-default btn-ability">
  164. <input title="4 CPU 64GB Memory" name="ability" type="radio" value="4c64g">4&nbsp;&nbsp;核&nbsp;&nbsp;64GB
  165. </label>
  166. <label class="btn btn-default btn-ability">
  167. <input title="8 CPU 64GB Memory" name="ability" type="radio" value="8c64g">8&nbsp;&nbsp;核&nbsp;&nbsp;64GB
  168. </label>
  169. <label class="btn btn-default btn-ability">
  170. <input title="16 CPU 16GB Memory" name="ability" type="radio" value="16c16g">16核&nbsp;&nbsp;16GB
  171. </label>
  172. <label class="btn btn-default btn-ability">
  173. <input title="24 CPU 24GB Memory" name="ability" type="radio" value="24c24g">24核&nbsp;&nbsp;24GB
  174. </label>
  175. <label class="btn btn-default btn-ability">
  176. <input title="32 CPU 32GB Memory" name="ability" type="radio" value="32c32g">32核&nbsp;&nbsp;32GB
  177. </label>
  178. <label class="btn btn-default btn-ability">
  179. <input title="64 CPU 64GB Memory" name="ability" type="radio" value="64c64g">64核&nbsp;&nbsp;64GB
  180. </label>
  181. </div>
  182. </div>
  183. </div>
  184. <div class="form-group">
  185. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-inbox-alt"></span>&nbsp;&nbsp;系统模板</label>
  186. <div class="col-sm-6">
  187. <select id="os_template" name="os_template_id" title="请选择系统模板..." class="selectpicker" data-width="100%">
  188. {% for item in os_template_data %}
  189. <option value="{{ item.id }}" data-icon="{{ item.icon }}">&nbsp;&nbsp;{{ item.label }}</option>
  190. {% endfor %}
  191. </select>
  192. </div>
  193. </div>
  194. <div class="form-group">
  195. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-th-list"></span>&nbsp;&nbsp;数量</label>
  196. <div class="col-sm-6">
  197. <input id="quantity" title="实例数量" class="form-control" type="text" value="1" name="quantity">
  198. </div>
  199. </div>
  200. <div class="form-group">
  201. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;标识&密码</label>
  202. <div class="col-sm-6">
  203. <div class="row form-group">
  204. <label class="col-sm-2 control-label">登录密码:</label>
  205. <div class="col-sm-6">
  206. <input type="password" name="password" title="实例密码" class="form-control" id="password" placeholder="如不填写,系统自动生成16位随机密码">
  207. </div>
  208. </div>
  209. <div class="row form-group">
  210. <label class="col-sm-2 control-label">确认密码:</label>
  211. <div class="col-sm-6">
  212. <input type="password" name="confirm_password" title="确认实例密码" class="form-control" id="confirm_password">
  213. </div>
  214. </div>
  215. <div style="height: 10px;"></div>
  216. <div class="row form-group">
  217. <label class="col-sm-2 control-label">实例名称:</label>
  218. <div class="col-sm-6">
  219. <input id="remark" name="remark" type="text" title="实例名称" class="form-control" placeholder="如不填写,系统自动默认生成">
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. <div class="form-group">
  225. <label class="col-sm-2 control-label"></label>
  226. <div class="col-sm-3 pull-right">
  227. <button type="submit" class="btn btn-blue-alt" style="width: 180px; height: 40px; font-size: 16px;" disabled>创建</button>
  228. </div>
  229. </div>
  230. </form>
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. {% endblock body %}