SomeFire commented on a change in pull request #40: IGNITE-9939 BuildObserver 
UNKNOWN build state handling added
URL: https://github.com/apache/ignite-teamcity-bot/pull/40#discussion_r229273513
 
 

 ##########
 File path: ignite-tc-helper-web/src/main/webapp/visas.html
 ##########
 @@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html lang="en">
+    <head>
+        <meta charset="UTF-8">
+        <title>Ignite Teamcity - Visas history</title>
+        <link rel="icon" href="img/leaf-icon-png-7066.png">
+        <script src="https://code.jquery.com/jquery-1.12.4.js";></script>
+        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js";></script>
+        <script type="text/javascript" 
src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js";></script>
+        <script type="text/javascript" 
src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js";></script>
+        <link rel="stylesheet" type="text/css" 
href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"; />
+        <link rel="stylesheet" href="css/style-1.5.css">
+        <link rel="stylesheet" 
href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css";>
+        <script src="js/common-1.6.js"></script>
+        <script src="https://d3js.org/d3.v4.min.js";></script>
+        <script 
src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js";></script>
+        <script 
src="https://cdn.datatables.net/1.10.16/js/dataTables.jqueryui.js";></script>
+        <link rel="stylesheet" 
href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css";>
+        <link rel="stylesheet" 
href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css";>
+    </head>
+<body>
+    <br>
+    <div id="loadStatus"></div>
+    <br>
+    <table id="visasTable" class="cell-border" style="width:100%">
+        <thead>
+            <tr class="ui-widget-header ">
+                <th>.</th>
+                <th>.</th>
+                <th>.</th>
+                <th>.</th>
+                <th>.</th>
+                <th>.</th>
+            </tr>
+        </thead>
+    </table>
+    <br>
+    <div id="version"></div>
+<script>
+function showErrInLoadStatus(jqXHR, exception) {
+    if (jqXHR.status === 0) {
+        $("#loadStatus").html('Not connect.\n Verify Network.');
+    } else if (jqXHR.status === 404) {
+        $("#loadStatus").html('Requested page not found. [404]');
+    } else if (jqXHR.status === 401) {
+        $("#loadStatus").html('Unauthorized [401]');
+
+        setTimeout(function() {
+            window.location.href = "/login.html" + "?backref=" + 
encodeURIComponent(window.location.href);
+        }, 1000);
+    } else if (jqXHR.status === 403) {
+        $("#loadStatus").html('Forbidden [403]');
+    } else if( jqXHR.status === 418) {
+        $("#loadStatus").html('Services are starting [418], I\'m a teapot');
+    } else if (jqXHR.status === 424) {
+        $("#loadStatus").html('Dependency problem: [424]: ' + 
jqXHR.responseText);
+    } else if (jqXHR.status === 500) {
+        $("#loadStatus").html('Internal Server Error [500].');
+    } else if (exception === 'parsererror') {
+        $("#loadStatus").html('Requested JSON parse failed.');
+    } else if (exception === 'timeout') {
+        $("#loadStatus").html('Time out error.');
+    } else if (exception === 'abort') {
+        $("#loadStatus").html('Ajax request aborted.');
+    } else {
+        $("#loadStatus").html('Uncaught Error.\n' + jqXHR.responseText);
+    }
+}
+
+$(document).ready(function() {
+    loadData();
+
+    $.ajax({ url: "rest/branches/version",  success: showVersionInfo, error: 
showErrInLoadStatus });
+});
+
+function showVisasTable(result) {
+    let visasTable = $('#visasTable');
+
+    visasTable.dataTable().fnDestroy();
+
+    var table = visasTable.DataTable({
+        "order": [[ 1, 'desc' ]],
+        data: result,
+        "iDisplayLength": 30, //rows to be shown by default
+        stateSave: true,
+        columnDefs: [
+            {
+                targets: '_all',
+                className: 'dt-body-center'
+            },
+        ],
+        columns: [
+            {
+                "data": "state",
+                title: "Status",
+                "render": function (data, type, row, meta) {
+                    if (type === 'display') {
+                        if (data ==='finished' && row.commentUrl)
+                            data = "<a href='" + row.commentUrl + "'>" + data 
+ "</a>";
+                    }
+
+                    return data;
+                }
+            },
+            {
+                "data": "date",
+                title: "Date"
+            },
+            {
+                "data": "userName",
+                title: "User"
+            },
+            {
+                "data": "branchName",
+                title: "Branch"
+            },
+            {
+                "data": "ticket",
+                title: "Ticket"
+            },
+            {
+                "data": "blockers",
+                title: "Blockers",
+                "render": function (data, type, row, meta) {
+                    if (type === 'display') {
+                        if (row.state != 'finished')
+                            data = "";
+                    }
+
+                    return data;
+                }
+            }
+
+        ]
+    });
+}
+
+function loadData() {
+    $.ajax(
+        {
+            url: "rest/visa/history?serverId=apache",
+            success: function (result) {
+                showVisasTable(result);
+            },
+            error: showErrInLoadStatus
+        }
+    );
+}
+</script>
+</body>
+</html>
 
 Review comment:
   Missed last empty line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to