<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('日志监控')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <label th:text="#{switchconf.log.error.label}"></label>
                <textarea style="width: 100%;height: 150px" id="errorLogs" readonly></textarea>
            </div>
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>uuid：</label>
                                <input type="text" id="uuid"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" id="queryBtn"><i class="fa fa-search"></i>&nbsp;<span th:text="#{btn.search}"></span></a>
                                <a class="btn btn-primary btn-rounded btn-sm" id="downloadBtn"><i class="fa fa-download"></i>&nbsp;<span th:text="#{btn.export}"></span></a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <label th:text="#{switchconf.log.fs.label}"></label>
                <textarea style="width: 100%;height: 350px" id="fsLogs" readonly></textarea>

                <label th:text="#{switchconf.log.cc.label}"></label>
                <textarea style="width: 100%;height: 700px" id="ccLogs" readonly></textarea>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('cc:bizgroup:edit')}]];
        var removeFlag = [[${@permission.hasPermi('cc:bizgroup:remove')}]];
        var errorLogs = [[${errorLogs}]]
        var prefix = ctx + "cc/fsconf";

        $("#queryBtn").click(function() {
            var uuid = $("#uuid").val()
            $("#fsLogs").html("");
            $("#ccLogs").html("");
            $.ajax({
                url: prefix + '/getLogs?uuid=' + uuid , // 假设后端保存配置的接口是 /setConfig
                type: 'GET',
                contentType: 'application/json',
                beforeSend: function () {
                    $.modal.loading(i18n("common.tip.loading"));
                    $.modal.disable();
                },
                success: function(_data) {
                    var data = _data.data;
                    $("#fsLogs").val(data.fsLogs);
                    $("#ccLogs").val(data.ccLogs);
                    $.modal.closeLoading();
                    $.modal.enable();
                }
            });
        });
        $("#errorLogs").val(errorLogs);


        $("#downloadBtn").click(function() {
            var uuid = $("#uuid").val();
            window.open(prefix + '/downloadLogs?uuid=' + uuid);
        });

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