Former-commit-id: 031dde85daa45a579e2cefef876396978f40e1f8 Former-commit-id: 393344018b0ea29532bd77448632005bc72daa3aTSXN
parent
99c237f45f
commit
788a5be7e3
@ -1,23 +1,65 @@
|
||||
@model string
|
||||
@using System.Reflection
|
||||
@{
|
||||
Layout = null;
|
||||
var version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
}
|
||||
@using System.Reflection
|
||||
@{ Layout = null;
|
||||
var version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; }
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<title>更新程序|@version</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin: 0 auto; width: 1000px;">
|
||||
<form action="/" method="post" style="margin:0;padding:0;">
|
||||
<input type="text" name="command" value="@Model" placeholder="#" style="width:100%;background:#666;color:#ddd;border:none;height:1.5em;line-height:1.5em;outline:none;" />
|
||||
</form>
|
||||
<div style="background:#666;color:#ddd;line-height:1.5em;">
|
||||
<pre>@Html.Raw(ViewBag.Output)</pre>
|
||||
</div>
|
||||
<div style="text-align:center">v @version</div>
|
||||
<div>
|
||||
<input type="text" id="command" name="command" value="@Model" placeholder="ssh#" />
|
||||
<button id="run">run</button>
|
||||
<button id="update">update</button>
|
||||
<button id="clear">clear</button>
|
||||
</div>
|
||||
<pre id="log" style="background: #666; color: #ddd; line-height: 1.5em;"></pre>
|
||||
<div style="text-align:center">v @version</div>
|
||||
<script src="~/lib/jquery/jquery.min.js"></script>
|
||||
<script src="~/lib/signalr/signalr.min.js"></script>
|
||||
<script>
|
||||
var connection = new signalR.HubConnectionBuilder().withUrl('/hub').build();
|
||||
function log(message) {
|
||||
$('#log').append(message + '\n');
|
||||
};
|
||||
function connect() {
|
||||
log('check connection state :' + connection.state);
|
||||
if (connection.state === signalR.HubConnectionState.Disconnected) {
|
||||
connection.start().then(function () {
|
||||
log('connect successful');
|
||||
}).catch(function () {
|
||||
'connect closed'
|
||||
log('connect failed');
|
||||
setTimeout(connect, 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
connection.onclose(function () {
|
||||
log('connect closed');
|
||||
connect();
|
||||
});
|
||||
connection.on("ServerToClient", function (message) {
|
||||
log(message);
|
||||
});
|
||||
connect();
|
||||
$('#run').click(function () {
|
||||
$.get('/Home/Command', { command: $('#command').val() }, function (data) {
|
||||
if (data) {
|
||||
log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#update').click(function () {
|
||||
$.get('/Home/Update', function (data) {
|
||||
if (data) {
|
||||
log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#clear').click(function () {
|
||||
$('#log').html('');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue