|
30 | 30 | <%@ page import="org.labkey.api.settings.AppProps" %> |
31 | 31 | <%@ page import="org.labkey.api.util.Formats" %> |
32 | 32 | <%@ page import="org.labkey.api.util.HtmlString"%> |
| 33 | +<%@ page import="org.labkey.api.util.HtmlStringBuilder" %> |
33 | 34 | <%@ page import="org.labkey.api.view.NavTree" %> |
34 | 35 | <%@ page import="org.labkey.core.admin.AdminController" %> |
35 | 36 | <%@ page import="java.text.DecimalFormat" %> |
|
51 | 52 | .lk-admin-section { display: none; } |
52 | 53 | .header-title { margin-bottom: 5px; } |
53 | 54 | .header-link { margin: 0 5px 20px 0; } |
| 55 | + .lk-server-time-warning { color: red; } |
54 | 56 | </style> |
55 | 57 | <div class="row"> |
56 | 58 | <div class="col-sm-12 col-md-3"> |
|
87 | 89 | <br/> |
88 | 90 | <% |
89 | 91 | row = 0; |
| 92 | + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DateUtil.getJsonDateTimeFormatString()); |
| 93 | + String timeCellCls = ""; |
| 94 | + HtmlString warning = HtmlString.EMPTY_STRING; |
90 | 95 |
|
91 | 96 | SqlDialect.ServerDatabaseTimeDifference timeDifference = SqlDialect.getServerDatabaseTimeDifference(DbScope.getLabKeyScope()); |
92 | | - boolean exceedsThreshold = timeDifference.exceedsWarningThreshold(); |
93 | | -
|
94 | | - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DateUtil.getJsonDateTimeFormatString()); |
95 | | - HtmlString style = unsafe(exceedsThreshold ? " style=\"color:red;\"" : ""); |
96 | | - HtmlString warning = unsafe(exceedsThreshold ? " - Warning: Web and database server times differ by " + timeDifference.getSeconds() + " seconds!" : ""); |
| 97 | + if (timeDifference.exceedsWarningThreshold()) |
| 98 | + { |
| 99 | + timeCellCls = "lk-server-time-warning"; |
| 100 | + warning = HtmlStringBuilder.of(" - Warning: Web and database server times differ by ") |
| 101 | + .append(timeDifference.getSeconds()) |
| 102 | + .append(" seconds!") |
| 103 | + .getHtmlString(); |
| 104 | + } |
97 | 105 | %> |
98 | 106 | <h4>Runtime Information</h4> |
99 | 107 | <table class="labkey-data-region-legacy labkey-show-borders"> |
|
118 | 126 | <tr class="<%=getShadeRowClass(row++)%>"><td>Working Dir</td><td><%=h(AdminBean.workingDir)%></td></tr> |
119 | 127 | <tr class="<%=getShadeRowClass(row++)%>"><td>Server GUID</td><td style="font-family:monospace"><%=h(AdminBean.serverGuid)%></td></tr> |
120 | 128 | <tr class="<%=getShadeRowClass(row++)%>"><td>Server Session GUID</td><td style="font-family:monospace"><%=h(AdminBean.serverSessionGuid)%></td></tr> |
121 | | - <tr class="<%=getShadeRowClass(row++)%>"><td>Server Startup Time</td><td<%=style%>><%=h(AdminBean.serverStartupTime)%></td></tr> |
122 | | - <tr class="<%=getShadeRowClass(row++)%>"><td>Web Server Time</td><td<%=style%>><%=h(timeDifference.serverTime().format(dateTimeFormatter))%><%=warning%></td></tr> |
123 | | - <tr class="<%=getShadeRowClass(row++)%>"><td>Database Server Time</td><td<%=style%>><%=h(timeDifference.databaseTime().format(dateTimeFormatter))%><%=warning%></td></tr> |
| 129 | + <tr class="<%=getShadeRowClass(row++)%>"><td>Server Startup Time</td><td class="<%=h(timeCellCls)%>"><%=h(AdminBean.serverStartupTime)%></td></tr> |
| 130 | + <tr class="<%=getShadeRowClass(row++)%>"><td>Web Server Time</td><td class="<%=h(timeCellCls)%>"><%=h(timeDifference.serverTime().format(dateTimeFormatter))%><%=warning%></td></tr> |
| 131 | + <tr class="<%=getShadeRowClass(row++)%>"><td>Database Server Time</td><td class="<%=h(timeCellCls)%>"><%=h(timeDifference.databaseTime().format(dateTimeFormatter))%><%=warning%></td></tr> |
124 | 132 | </table> |
125 | 133 | </labkey:panel> |
126 | 134 | <labkey:panel id="links" className="lk-admin-section"> |
|
0 commit comments