| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- {% extends "layout.html" %}
- {% block head %}
- {{ super() }}
- <style type="text/css">
- @media (min-width: 768px) {
- .form-horizontal .control-label {
- text-align: left;
- }
- }
-
- label>span {
- color: deepskyblue;
- }
- .btn,
- .form-group>div>div,
- .form-control {
- border-radius: 0;
- }
- .btn-ability {
- margin-right: 16px;
- height: 50px;
- padding: 8px 50px;
- margin-bottom: 30px;
- }
- .btn-ability-line {
- }
- </style>
- {% endblock head %}
- {% block body %}
- <script>
- $(document).ready(function() {
- $('body').addClass('add-transition');
- $('.add-page-transition').on('click', function(){
- var transAttr = $(this).attr('data-transition');
- $('.add-transition').attr('class', 'add-transition');
- $('.add-transition').addClass(transAttr);
- });
- $('#create_guest_form').formValidation({
- framework: 'bootstrap4',
- icon: {
- valid: 'fa fa-check',
- invalid: 'fa fa-times',
- validating: 'fa fa-refresh'
- },
- // Since the Bootstrap Button hides the radio and checkbox
- // We exclude the disabled elements only
- excluded: ':disabled',
- fields: {
- ability: {
- validators: {
- notEmpty: {
- }
- }
- },
- os_template_id: {
- validators: {
- notEmpty: {
- }
- }
- },
- quantity: {
- validators: {
- between: {
- min: 1,
- max: 20
- }
- }
- },
- password: {
- validators: {
- identical: {
- field: 'confirm_password'
- },
- stringLength: {
- max: 128
- }
- }
- },
- confirm_password: {
- validators: {
- identical: {
- field: 'password'
- }
- }
- },
- remark: {
- validators: {
- stringLength: {
- max: 64
- }
- }
- }
- }
- })
- .on('success.field.fv', function(e, data) {
- if (data.fv.getInvalidFields().length > 0) { // There is invalid field
- data.fv.disableSubmitButtons(true);
- }
- });
- });
- $(function() { "use strict";
- $("#quantity").TouchSpin({
- max: 20,
- min: 1,
- verticalbuttons: true,
- verticalupclass: 'glyph-icon icon-plus',
- verticaldownclass: 'glyph-icon icon-minus'
- });
- });
- </script>
- <div class="container" style="padding-top: 100px;">
- <div class="panel">
- <div class="panel-body">
- <h3 class="title-hero" style="display: inline;">
- 创建实例
- </h3>
- <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;">
- <span class="glyph-icon icon-separator" style="transform: rotateY(-180deg);">
- <i class="glyph-icon icon-level-up"></i>
- </span>
- <span class="button-content">
- 返回虚拟机列表
- </span>
- </a>
- <div class="example-box-wrapper">
- <form id="create_guest_form" class="form-horizontal bordered-row" action="/guests/create" method="post">
- <div class="form-group">
- <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-gauge"></span> 运算能力</label>
- <div class="col-sm-10">
- <div class="btn-ability-line" data-toggle="buttons">
- <label class="btn btn-default btn-ability">
- <input title="1 CPU 1GB Memory" name="ability" type="radio" value="1c1g">1 核 1 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="1 CPU 2GB Memory" name="ability" type="radio" value="1c2g">1 核 2 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="2 CPU 2GB Memory" name="ability" type="radio" value="2c2g">2 核 2 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="2 CPU 4GB Memory" name="ability" type="radio" value="2c4g">2 核 4 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="4 CPU 4GB Memory" name="ability" type="radio" value="4c4g">4 核 4 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="4 CPU 8GB Memory" name="ability" type="radio" value="4c8g">4 核 8 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="8 CPU 8GB Memory" name="ability" type="radio" value="8c8g">8 核 8 GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="8 CPU 16GB Memory" name="ability" type="radio" value="8c16g">8 核 16GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="1 CPU 16GB Memory" name="ability" type="radio" value="1c16g">1 核 16GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="4 CPU 32GB Memory" name="ability" type="radio" value="4c32g">4 核 32GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="4 CPU 64GB Memory" name="ability" type="radio" value="4c64g">4 核 64GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="8 CPU 64GB Memory" name="ability" type="radio" value="8c64g">8 核 64GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="16 CPU 16GB Memory" name="ability" type="radio" value="16c16g">16核 16GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="24 CPU 24GB Memory" name="ability" type="radio" value="24c24g">24核 24GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="32 CPU 32GB Memory" name="ability" type="radio" value="32c32g">32核 32GB
- </label>
- <label class="btn btn-default btn-ability">
- <input title="64 CPU 64GB Memory" name="ability" type="radio" value="64c64g">64核 64GB
- </label>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-inbox-alt"></span> 系统模板</label>
- <div class="col-sm-6">
- <select id="os_template" name="os_template_id" title="请选择系统模板..." class="selectpicker" data-width="100%">
- {% for item in os_template_data %}
- <option value="{{ item.id }}" data-icon="{{ item.icon }}"> {{ item.label }}</option>
- {% endfor %}
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-th-list"></span> 数量</label>
- <div class="col-sm-6">
- <input id="quantity" title="实例数量" class="form-control" type="text" value="1" name="quantity">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label"><span class="glyph-icon icon-elusive-compass-circled"></span> 标识&密码</label>
- <div class="col-sm-6">
- <div class="row form-group">
- <label class="col-sm-2 control-label">登录密码:</label>
- <div class="col-sm-6">
- <input type="password" name="password" title="实例密码" class="form-control" id="password" placeholder="如不填写,系统自动生成16位随机密码">
- </div>
- </div>
- <div class="row form-group">
- <label class="col-sm-2 control-label">确认密码:</label>
- <div class="col-sm-6">
- <input type="password" name="confirm_password" title="确认实例密码" class="form-control" id="confirm_password">
- </div>
- </div>
- <div style="height: 10px;"></div>
- <div class="row form-group">
- <label class="col-sm-2 control-label">实例名称:</label>
- <div class="col-sm-6">
- <input id="remark" name="remark" type="text" title="实例名称" class="form-control" placeholder="如不填写,系统自动默认生成">
- </div>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label"></label>
- <div class="col-sm-3 pull-right">
- <button type="submit" class="btn btn-blue-alt" style="width: 180px; height: 40px; font-size: 16px;" disabled>创建</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- {% endblock body %}
|