/
status.aspx
94 lines (92 loc) · 2.22 KB
/
status.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Page Language="c#" debug="true" %>
<script runat="server">
private string getHostname()
{
return System.IO.File.ReadAllText(Server.MapPath(".")+@"\hostname.txt").ToLowerInvariant().Trim();
}
private string getLandingPageUrl()
{
if (isTraefikUsed())
return getHostname() + ":8180";
else
return getHostname();
}
private bool isTraefikUsed()
{
return System.IO.File.Exists(@"c:\programdata\bccontainerhelper\traefikforbc\traefik.txt");
}
</script>
<%
if (Request.Url.AbsoluteUri.Contains("?timesinceupdate")) {
Response.Write((int)(System.DateTime.Now - System.IO.File.GetLastWriteTime(@"c:\demo\status.txt")).TotalSeconds);
} else {
%>
<html>
<head>
<title>Microsoft Dynamics NAV Installation Status</title>
<style type="text/css">
body {
font-family: "Segoe UI","Lucida Grande",Verdana,Arial,Helvetica,sans-serif;
font-size: 16px;
color: #c0c0c0;
background: #000000;
margin-left: 20px;
}
</style>
<script type="text/JavaScript">
function timeRefresh(timeoutPeriod)
{
setTimeout("refresh();",timeoutPeriod);
}
function refresh()
{
if (window.location.href.indexOf('?norefresh') == -1)
{
location.reload(true);
}
}
</script>
</head>
<body onload="JavaScript:timeRefresh(10000);">
<p>
<a href="http://<%=getLandingPageUrl() %>">View Landing Page</a>
<%
if (Request.Url.AbsoluteUri.Contains("norefresh")) {
%>
<a href="http://<%=getLandingPageUrl() %>/status.aspx">Enable refresh</a>
<%
} else {
%>
<a href="http://<%=getLandingPageUrl() %>/status.aspx?norefresh">Disable refresh</a>
<%
}
%>
</p><hr>
<%
try
{
var lines = System.IO.File.ReadAllLines(@"c:\demo\status.txt");
Array.Reverse(lines);
foreach(var line in lines) {
%>
<%=line %><br>
<%
}
} catch(Exception)
{
%>
<p>Error loading status, page should refresh in 10 seconds.</p>
<%
}
%>
</body>
</html>
<%
}
%>