Former-commit-id: 031dde85daa45a579e2cefef876396978f40e1f8 Former-commit-id: 393344018b0ea29532bd77448632005bc72daa3aTSXN
parent
99c237f45f
commit
788a5be7e3
@ -1,23 +1,65 @@
|
|||||||
@model string
|
@model string
|
||||||
@using System.Reflection
|
@using System.Reflection
|
||||||
@{
|
@{ Layout = null;
|
||||||
Layout = null;
|
var version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; }
|
||||||
var version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
|
||||||
}
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||||
<title>更新程序|@version</title>
|
<title>更新程序|@version</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="margin: 0 auto; width: 1000px;">
|
<div>
|
||||||
<form action="/" method="post" style="margin:0;padding:0;">
|
<input type="text" id="command" name="command" value="@Model" placeholder="ssh#" />
|
||||||
<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;" />
|
<button id="run">run</button>
|
||||||
</form>
|
<button id="update">update</button>
|
||||||
<div style="background:#666;color:#ddd;line-height:1.5em;">
|
<button id="clear">clear</button>
|
||||||
<pre>@Html.Raw(ViewBag.Output)</pre>
|
|
||||||
</div>
|
|
||||||
<div style="text-align:center">v @version</div>
|
|
||||||
</div>
|
</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>
|
</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