server_form.hbs 6.28 KB

<div class="pageheader">
    <div class="media">
        <div class="pageicon pull-left">
            <i class="fa fa-th-list"></i>
        </div>
        <div class="media-body">
            <ul class="breadcrumb">
                <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
                <li><a href="">服务器管理</a></li>
                <li>服务器信息</li>
            </ul>
            <h4>服务器信息</h4>
        </div>
    </div>
    <!-- media -->
</div>
<!-- pageheader -->
<div class="panel panel-default">
    <div class="panel-heading">
        <p>请配置服务器连接信息,请确保配置的部署目录有读写权限.</p>
    </div>
    <form id="server-form" action="/servers/save" method="POST" data-pjax>
        <input type="hidden" name="_id" value="{{_id}}">
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Host</label>
                        <input type="text" name="host" value="{{host}}" class="form-control" placeholder="服务器地址">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->

                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Username</label>
                        <input type="text" name="username" value="{{username}}" class="form-control" placeholder="用户名">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
            </div>
            <!-- row -->

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Password</label>
                        <input type="text" name="password" value="{{password}}" class="form-control" placeholder="密码">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->

                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Port</label>
                        <input type="text" name="port" value="{{port}}" class="form-control" value="22" placeholder="端口">
                    </div>
                    <!-- form-group -->
                </div>
                <!-- col-sm-6 -->
            </div>
            <div class="row">
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label">Env</label>
                        <div class="rdio rdio-primary">
                            <input type="radio" name="env" id="proEnv" value="production" {{#equals env 'production'}}checked="checked"{{/equals}}>
                            <label for="proEnv">线上环境</label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-2">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="env" id="previewEnv" value="preview" {{#equals env 'preview'}}checked="checked"{{/equals}}>
                        <label for="previewEnv">灰度环境</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="env" id="testEnv" value="test" {{#equals env 'test'}}checked="checked"{{/equals}}>
                        <label for="testEnv">测试环境</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label">Cloud</label>
                        <div class="rdio rdio-primary">
                            <input type="radio" name="cloud" id="cloudAws" value="aws" {{#equals cloud 'aws'}}checked="checked"{{/equals}}>
                            <label for="cloudAws">AWS</label>
                        </div>
                    </div>
                </div>
                <div class="col-sm-2">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="cloud" id="cloudQQ" value="qcloud" {{#equals cloud 'qcloud'}}checked="checked"{{/equals}}>
                        <label for="cloudQQ">QCloud</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <label class="control-label">&nbsp;</label>
                    <div class="rdio rdio-primary">
                        <input type="radio" name="cloud" id="cloudLocal" value="local" {{#equals cloud 'local'}}checked="checked"{{/equals}}>
                        <label for="cloudLocal">测试环境</label>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">Deploy Path</label>
                        <input type="text" name="deployDir" class="form-control" placeholder="部署目录" value="{{deployDir}}">
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="control-label">密钥</label>
                        <textarea name="privateKey" placeholder="私钥" class="form-control" style="height: 100px">{{privateKey}}</textarea>
                    </div>
                </div>
            </div>

            <!-- row -->
        </div>
        <!-- panel-body -->
        <div class="panel-footer">
            <button type="submit" class="btn btn-primary">保存</button>
        </div>
    </form>
    <!-- panel-footer -->
</div>

<script>
    $(document).on('ready pjax:success', function() {
        $('#server-form').ajaxForm(function() {
            location.href = '/servers/setting';
        });
    });
</script>