main.ftl 5.8 KB
Newer Older
A
ascrutae 已提交
1 2 3 4
<#import "./common/commons.ftl" as common>
<#import "./common/traceInfo.ftl" as traceInfo>
<#import "./usr/applications/applicationMaintain.ftl" as applicationMaintain>
<#import "./usr/authfile/auth.ftl" as auth>
5 6
<#import "anls-result/analysisSearchResult.ftl" as anlySearchResult>
<#import "anls-result/analysisResult.ftl" as anlyResult>
A
ascrutae 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<@common.importResources />
    <script src="${_base}/bower_components/jquery-ui/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="${_base}/bower_components/jquery-treetable/css/jquery.treetable.theme.default.css"/>
    <script src="${_base}/bower_components/jquery-treetable/jquery.treetable.js"></script>
    <link href="${_base}/bower_components/jquery-treetable/css/jquery.treetable.css" rel="stylesheet"/>
    <link href="${_base}/bower_components/skywalking/css/tracelog.css" rel="stylesheet"/>
    <script src="${_base}/bower_components/skywalking/js/tracelog.js"></script>
    <script src="${_base}/bower_components/skywalking/js/application.js"></script>
21
    <script src="${_base}/bower_components/skywalking/js/analysisSearchResult.js"></script>
A
ascrutae 已提交
22 23
<#--<script src="${_base}/bower_components/skywalking/js/analysisResult.js"></script>-->
    <script src="${_base}/bower_components/skywalking/js/analysisResultViewResovler.js"></script>
24
    <script src="${_base}/bower_components/smalot-bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
A
ascrutae 已提交
25 26
    <link href="${_base}/bower_components/smalot-bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css"
          rel="stylesheet">
A
ascrutae 已提交
27 28 29 30
    <link href="${_base}/bower_components/bootstrap-toggle/css/bootstrap-toggle.min.css" rel="stylesheet">
    <script src="${_base}/bower_components/bootstrap-toggle/js/bootstrap-toggle.min.js"></script>
</head>

A
ascrutae 已提交
31
<body style="padding-top:80px">
A
ascrutae 已提交
32 33 34 35 36 37 38 39 40 41 42
<@common.navbar/>
<!--Trace Info -->
<@traceInfo.traceTableTmpl/>
<@traceInfo.traceLogTmpl/>
<@traceInfo.traceTreeAllTmpl/>
<!--Application -->
<@applicationMaintain.applicationList/>
<@applicationMaintain.addApplication/>
<@applicationMaintain.createglobalConfig/>
<@applicationMaintain.modifyApplication/>
<@auth.downloadAuth/>
43 44 45 46 47
<@anlySearchResult.anlyResultTmpl/>
<@anlySearchResult.anlyResultDisplayTmpl/>
<@anlySearchResult.pageInfoTmpl/>
<@anlyResult.analysisResult/>
<@anlyResult.analysisResultTableTmpl/>
A
ascrutae 已提交
48
<@anlyResult.typicalCallChainTrees/>
A
ascrutae 已提交
49 50
<@anlyResult.typicalCallChainTreeTable/>
<@anlyResult.typicalCallChainCheckBox/>
A
ascrutae 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63
<p id="baseUrl" style="display: none">${_base}</p>
<div class="container" id="mainPanel">
    <p id="searchType" style="display: none">${searchType!''}</p>
    <p id="loadType" style="display: none;">${loadType!''}</p>
</div>

<script>
    $(document).ready(function () {
        //
        var loadType = $("#loadType").text();
        loadContent(loadType);
        // bind
        $("#searchBtn").click(function () {
64
            var searchKey = $("#searchKey").val();
65 66
            if (searchKey.match(/viewpoint:*/i)) {
                loadContent("showAnlySearchResult")
A
ascrutae 已提交
67
            } else if (searchKey.match(/analysisresult:*/i)) {
68
                loadContent("showAnalysisResult");
A
ascrutae 已提交
69
            } else {
70 71
                loadContent("showTraceInfo");
            }
A
ascrutae 已提交
72 73 74
        })
    });

A
ascrutae 已提交
75
    var viewResolver;
76
    function loadContent(loadType, param) {
A
ascrutae 已提交
77

78
        if (loadType == "showTraceInfo") {
A
ascrutae 已提交
79
            loadTraceTreeData("${_base}");
A
ascrutae 已提交
80
            return;
A
ascrutae 已提交
81 82
        }

83
        if (loadType == "showAnlySearchResult") {
84 85 86 87 88 89 90 91 92 93 94 95 96
            var template = $.templates("#anlyResultPanelTmpl");
            var htmlOutput = template.render({});
            $("#mainPanel").empty();
            $("#mainPanel").html(htmlOutput);
            var searchKey = $("#searchKey").val();
            var index = searchKey.indexOf(':');
            if (index != -1) {
                searchKey = searchKey.substr(index + 1);
            }
            toSearchAnlyResult(searchKey);
            return;
        }

97 98 99 100 101 102
        if (loadType == "showAnalysisResult") {
            var searchKey = $("#searchKey").val();
            var index = searchKey.indexOf(':');
            if (index != -1) {
                searchKey = searchKey.substr(index + 1);
            }
A
ascrutae 已提交
103 104
            viewResolver = new AnalysisResultViewResolver({baseUrl: "${_base}", treeId: searchKey});
            viewResolver.loadMainPage();
105 106 107
            return;
        }

A
ascrutae 已提交
108 109 110 111 112
        if (loadType == "applicationList") {
            loadAllApplications();
            return;
        }

113
        if (loadType == "addApplication") {
A
ascrutae 已提交
114 115 116 117 118 119 120 121
            var template = $.templates("#addApplicationTmpl");
            var htmlOutput = template.render({});
            $("#mainPanel").empty();
            $("#mainPanel").html(htmlOutput);
            addApplication();
            return;
        }

122
        if (loadType == "createGlobalApplication") {
A
ascrutae 已提交
123 124 125 126 127 128 129 130
            var template = $.templates("#createGlobalConfigTmpl");
            var htmlOutput = template.render({});
            $("#mainPanel").empty();
            $("#mainPanel").html(htmlOutput);
            createGlobalConfig();
            return;
        }

131
        if (loadType == "modifyApplication") {
A
ascrutae 已提交
132
            var template = $.templates("#modifyApplicationTmpl");
133
            var htmlOutput = template.render({applicationId: param});
A
ascrutae 已提交
134 135 136 137 138 139
            $("#mainPanel").empty();
            $("#mainPanel").html(htmlOutput);
            modifyApplication();
            return;
        }

140
        if (loadType == "downloadAuthFile") {
A
ascrutae 已提交
141
            var template = $.templates("#downloadAuthFileTmpl");
142
            var htmlOutput = template.render({applicationCode: param});
A
ascrutae 已提交
143 144 145 146 147 148
            $("#mainPanel").empty();
            $("#mainPanel").html(htmlOutput);
            toDownloadAuthFile();
            return;
        }

149

A
ascrutae 已提交
150 151 152 153 154
        $("#mainPanel").empty();
    }
</script>
</body>
</html>