mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Add buttons to clear and refresh remote logs.
This commit is contained in:
parent
37feeed7ba
commit
fdae931462
@ -197,6 +197,11 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-primary mr-2" @onclick="GetRemoteLogs">Refresh</button>
|
||||
<button class="btn btn-danger" @onclick="DeleteLogs">Delete Logs</button>
|
||||
</div>
|
||||
|
||||
@if (_logLines.Any())
|
||||
{
|
||||
<div style="white-space: pre;">
|
||||
|
||||
@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Components.Web;
|
||||
using Remotely.Server.Components;
|
||||
using Remotely.Server.Hubs;
|
||||
using Remotely.Server.Services;
|
||||
using Remotely.Shared.Enums;
|
||||
using Remotely.Shared.Models;
|
||||
using Remotely.Shared.Utilities;
|
||||
using System;
|
||||
@ -22,12 +23,11 @@ namespace Remotely.Server.Pages
|
||||
private string _alertMessage;
|
||||
private string _inputDeviceId;
|
||||
|
||||
[Parameter]
|
||||
public string DeviceId { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string ActiveTab { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string DeviceId { get; set; }
|
||||
[Inject]
|
||||
private ICircuitConnection CircuitConnection { get; set; }
|
||||
|
||||
@ -36,6 +36,9 @@ namespace Remotely.Server.Pages
|
||||
|
||||
private Device Device { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IJsInterop JsInterop { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IModalService ModalService { get; set; }
|
||||
|
||||
@ -45,6 +48,7 @@ namespace Remotely.Server.Pages
|
||||
[Inject]
|
||||
private IToastService ToastService { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
@ -67,6 +71,17 @@ namespace Remotely.Server.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteLogs()
|
||||
{
|
||||
var result = await JsInterop.Confirm("Are you sure you want to delete the remote logs?");
|
||||
if (result)
|
||||
{
|
||||
var psCommmand = "Remove-Item -Path \"$env:TEMP/Remotely_Logs.log\" -Force";
|
||||
await CircuitConnection.ExecuteCommandOnAgent(ScriptingShell.PSCore, psCommmand, new string[] { Device.ID });
|
||||
ToastService.ShowToast("Delete command sent.");
|
||||
}
|
||||
}
|
||||
|
||||
private void EditFormKeyDown()
|
||||
{
|
||||
_alertMessage = string.Empty;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user