<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>

<body>
<div class="layui-form timo-compile">
    <form th:action="@{/api/build/repoauth}">
        <div class="layui-form-item">
            <label class="layui-form-label required">仓库类型<i id="repo_type_tips" class="fa fa-question-circle"></i></label>
            <div class="layui-input-inline">
                <select name="type">
                    <option th:each="item : ${repos}" th:value="${item.key}">[[${item.value}]]</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">认证名字</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="name" placeholder="请输入认证名字" required>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">认证类型<i id="repo_auth_type_tips" class="fa fa-question-circle"></i></label>
            <div class="layui-input-inline">
                <select name="authType">
                    <option th:each="item : ${auths}" th:value="${item.key}">[[${item.value}]]</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="username" placeholder="请输入用户名">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="password" placeholder="请输入密码">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">RSA 私钥</label>
            <div class="layui-input-inline">
                <textarea class="layui-textarea" name="rsaPrikey" placeholder="请输入 RSA 私钥"></textarea>
            </div>
        </div>
        <div class="layui-form-item timo-finally">
            <button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
            <button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
        </div>
    </form>
</div>

<script th:replace="/common/template :: script"></script>
<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
<script type="text/javascript" th:inline="javascript">
    $(function () {
        $("#repo_type_tips").hover(function () {
            var tips = layer.tips('目前仅支持 git 仓库<br />', '#repo_type_tips',{
                tips: [1, '#555555']
            });
            sleep(1000);
            layer.close(tips);
        })

        $("#repo_auth_type_tips").hover(function () {
            var tips = layer.tips(
                '仓库不需要认证则选择 none 类型<br/>' +
                'http 认证类型必须填写用户名和密码<br/>' +
                'ssh 认证必须填写 RSA 私钥<br/>',
                '#repo_auth_type_tips',{
                tips: [1, '#555555']
            });
            sleep(1000);
            layer.close(tips);
        })
    })
</script>
</body>
</html>