guest_create.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. fields: {
  48. ability: {
  49. validators: {
  50. notEmpty: {
  51. }
  52. }
  53. },
  54. os_template_id: {
  55. validators: {
  56. // choice: {
  57. // min: 1,
  58. // max: 1
  59. // // message: ''
  60. // },
  61. notEmpty: {
  62. }
  63. }
  64. }
  65. }
  66. })
  67. .on('success.field.fv', function(e, data) {
  68. if (data.fv.getInvalidFields().length > 0) { // There is invalid field
  69. data.fv.disableSubmitButtons(true);
  70. }
  71. });
  72. });
  73. $(function() { "use strict";
  74. $("#quantity").TouchSpin({
  75. max: 20,
  76. min: 1,
  77. verticalbuttons: true,
  78. verticalupclass: 'glyph-icon icon-plus',
  79. verticaldownclass: 'glyph-icon icon-minus'
  80. });
  81. });
  82. </script>
  83. <div class="container" style="padding-top: 100px;">
  84. <div class="panel">
  85. <div class="panel-body">
  86. <h3 class="title-hero" style="display: inline;">
  87. 创建实例
  88. </h3>
  89. <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;">
  90. <span class="glyph-icon icon-separator" style="transform: rotateY(-180deg);">
  91. <i class="glyph-icon icon-level-up"></i>
  92. </span>
  93. <span class="button-content">
  94. 返回虚拟机列表
  95. </span>
  96. </a>
  97. <div class="example-box-wrapper">
  98. <form id="create_guest_form" class="form-horizontal bordered-row" action="/guests/create" method="post">
  99. <div class="form-group">
  100. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-gauge"></span>&nbsp;&nbsp;运算能力</label>
  101. <div class="col-sm-10">
  102. <div class="btn-ability-line" data-toggle="buttons">
  103. <label class="btn btn-default btn-ability">
  104. <input title="1 CPU 1GB Memory" name="ability" type="radio" value="1c1g">1&nbsp;&nbsp;核&nbsp;&nbsp;1&nbsp;&nbsp;GB
  105. </label>
  106. <label class="btn btn-default btn-ability">
  107. <input title="1 CPU 2GB Memory" name="ability" type="radio" value="1c2g">1&nbsp;&nbsp;核&nbsp;&nbsp;2&nbsp;&nbsp;GB
  108. </label>
  109. <label class="btn btn-default btn-ability">
  110. <input title="2 CPU 2GB Memory" name="ability" type="radio" value="2c2g">2&nbsp;&nbsp;核&nbsp;&nbsp;2&nbsp;&nbsp;GB
  111. </label>
  112. <label class="btn btn-default btn-ability">
  113. <input title="2 CPU 4GB Memory" name="ability" type="radio" value="2c4g">2&nbsp;&nbsp;核&nbsp;&nbsp;4&nbsp;&nbsp;GB
  114. </label>
  115. <label class="btn btn-default btn-ability">
  116. <input title="4 CPU 4GB Memory" name="ability" type="radio" value="4c4g">4&nbsp;&nbsp;核&nbsp;&nbsp;4&nbsp;&nbsp;GB
  117. </label>
  118. <label class="btn btn-default btn-ability">
  119. <input title="4 CPU 8GB Memory" name="ability" type="radio" value="4c8g">4&nbsp;&nbsp;核&nbsp;&nbsp;8&nbsp;&nbsp;GB
  120. </label>
  121. <label class="btn btn-default btn-ability">
  122. <input title="8 CPU 8GB Memory" name="ability" type="radio" value="8c8g">8&nbsp;&nbsp;核&nbsp;&nbsp;8&nbsp;&nbsp;GB
  123. </label>
  124. <label class="btn btn-default btn-ability">
  125. <input title="8 CPU 16GB Memory" name="ability" type="radio" value="8c16g">8&nbsp;&nbsp;核&nbsp;&nbsp;16GB
  126. </label>
  127. <label class="btn btn-default btn-ability">
  128. <input title="1 CPU 16GB Memory" name="ability" type="radio" value="1c16g">1&nbsp;&nbsp;核&nbsp;&nbsp;16GB
  129. </label>
  130. <label class="btn btn-default btn-ability">
  131. <input title="4 CPU 32GB Memory" name="ability" type="radio" value="4c32g">4&nbsp;&nbsp;核&nbsp;&nbsp;32GB
  132. </label>
  133. <label class="btn btn-default btn-ability">
  134. <input title="4 CPU 64GB Memory" name="ability" type="radio" value="4c64g">4&nbsp;&nbsp;核&nbsp;&nbsp;64GB
  135. </label>
  136. <label class="btn btn-default btn-ability">
  137. <input title="8 CPU 64GB Memory" name="ability" type="radio" value="8c64g">8&nbsp;&nbsp;核&nbsp;&nbsp;64GB
  138. </label>
  139. <label class="btn btn-default btn-ability">
  140. <input title="16 CPU 16GB Memory" name="ability" type="radio" value="16c16g">16核&nbsp;&nbsp;16GB
  141. </label>
  142. <label class="btn btn-default btn-ability">
  143. <input title="24 CPU 24GB Memory" name="ability" type="radio" value="24c24g">24核&nbsp;&nbsp;24GB
  144. </label>
  145. <label class="btn btn-default btn-ability">
  146. <input title="32 CPU 32GB Memory" name="ability" type="radio" value="32c32g">32核&nbsp;&nbsp;32GB
  147. </label>
  148. <label class="btn btn-default btn-ability">
  149. <input title="64 CPU 64GB Memory" name="ability" type="radio" value="64c64g">64核&nbsp;&nbsp;64GB
  150. </label>
  151. </div>
  152. </div>
  153. </div>
  154. <div class="form-group">
  155. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-inbox-alt"></span>&nbsp;&nbsp;系统模板</label>
  156. <div class="col-sm-6">
  157. <select id="os_template" name="os_template_id" title="请选择系统模板..." class="selectpicker" data-width="100%">
  158. {% for item in os_template_data %}
  159. <option value="{{ item.id }}" data-icon="{{ item.icon }}">&nbsp;&nbsp;{{ item.label }}</option>
  160. {% endfor %}
  161. </select>
  162. </div>
  163. </div>
  164. <div class="form-group">
  165. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-th-list"></span>&nbsp;&nbsp;数量</label>
  166. <div class="col-sm-6">
  167. <input id="quantity" title="实例数量" class="form-control" type="text" value="1" name="quantity">
  168. </div>
  169. </div>
  170. <div class="form-group">
  171. <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span>&nbsp;&nbsp;标识&密码</label>
  172. <div class="col-sm-6">
  173. <div class="row form-group">
  174. <label class="col-sm-2 control-label">登录密码:</label>
  175. <div class="col-sm-6">
  176. <input type="password" name="password" title="实例密码" class="form-control" id="password" placeholder="如不填写,系统自动生成16位随机密码">
  177. </div>
  178. </div>
  179. <div class="row form-group">
  180. <label class="col-sm-2 control-label">确认密码:</label>
  181. <div class="col-sm-6">
  182. <input type="password" title="确认实例密码" class="form-control" id="confirm_password">
  183. </div>
  184. </div>
  185. <div style="height: 10px;"></div>
  186. <div class="row form-group">
  187. <label class="col-sm-2 control-label">实例名称:</label>
  188. <div class="col-sm-6">
  189. <input id="remark" name="remark" type="text" title="实例名称" class="form-control" placeholder="如不填写,系统自动默认生成">
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. <div class="form-group">
  195. <label class="col-sm-2 control-label"></label>
  196. <div class="col-sm-3 pull-right">
  197. <button type="submit" class="btn btn-blue-alt" style="width: 180px; height: 40px; font-size: 16px;" disabled>创建</button>
  198. </div>
  199. </div>
  200. </form>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. {% endblock body %}