<!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/app/config/app/update}">
        <div class="timo-detail-title">基础配置<i id="config_tips" class="fa fa-question-circle"></i></div>
        <table class="layui-table timo-detail-table">
            <tbody>
            <tr>
                <th>
                    <label class="layui-form-label">应用 ID</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="appId" readonly="readonly" th:value="${app.appId}">
                        </div>
                    </div>
                </td>
                <th>
                    <label class="layui-form-label required">应用名</label>
                </th>
                <td >
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="appName" required th:value="${app.appName}">
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <label class="layui-form-label">应用类型</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="appType" readonly="readonly" th:value="${app.appType}">
                        </div>
                    </div>
                </td>
                <th>
                    <label class="layui-form-label">所属环境</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="env" readonly="readonly" th:value="${app.env}">
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <label class="layui-form-label">应用仓库</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="appRepo" readonly required th:value="${app.appRepo}">
                        </div>
                    </div>
                </td>
                <th>
                    <label class="layui-form-label required">仓库分支</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="repoBranch" required th:value="${app.repoBranch}">
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <label class="layui-form-label required">应用路径</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="appRootPath" required th:value="${app.appRootPath}">
                        </div>
                    </div>
                </td>
                <th>
                    <label class="layui-form-label required">监听端口</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <input class="layui-input" type="text" name="bindPorts" th:value="${app.bindPorts}">
                        </div>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="timo-detail-title">构建配置</div>
        <table class="layui-table timo-detail-table">
            <tbody>
            <tr>
                <th>
                    <label class="layui-form-label required">仓库认证</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <select name="repoAuthConfig">
                                <option th:each="item : ${repoAuths}" th:value="${item.key}" th:selected="${app.repoAuthConfig?.name} eq ${item.key}">[[${item.value}]]</option>
                            </select>
                        </div>
                    </div>
                </td>
                <th>
                    <label class="layui-form-label required">编译工具</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <select name="compilerConfig">
                                <option th:each="item : ${compilers}" th:value="${item.key}" th:selected="${app.compilerConfig?.name} eq ${item.key}">[[${item.value}]]</option>
                            </select>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <label class="layui-form-label required">打包工具</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <select name="packerConfig">
                                <option th:each="item : ${packers}" th:value="${item.key}" th:selected="${app.packerConfig?.name} eq ${item.key}">[[${item.value}]]</option>
                            </select>
                        </div>
                    </div>
                </td>
                <th>
                    <label class="layui-form-label required">Dockerfile</label>
                </th>
                <td>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <textarea class="layui-textarea" name="dockerfile" th:text="${app.dockerfile}"></textarea>
                        </div>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <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">
    $(function () {
        $("#config_tips").hover(function () {
            var tips = layer.tips('带 * 号的是可修改项<br />', '#config_tips',{
                tips: [1, '#555555']
            });
            sleep(1000);
            layer.close(tips);
        })
    })

</script>
</body>
</html>