diff --git a/Server/Components/Devices/DeviceCard.razor b/Server/Components/Devices/DeviceCard.razor index 93863bae..e13ea40b 100644 --- a/Server/Components/Devices/DeviceCard.razor +++ b/Server/Components/Devices/DeviceCard.razor @@ -2,8 +2,11 @@ @inherits AuthComponentBase
+ @onclick="ExpandCard" + @onclick:stopPropagation="true" + @oncontextmenu="ContextMenuOpening" + @oncontextmenu:preventDefault="GetCardState() == DeviceCardState.Normal" + @oncontextmenu:stopPropagation="GetCardState() == DeviceCardState.Normal">
diff --git a/Server/Components/Devices/DeviceCard.razor.cs b/Server/Components/Devices/DeviceCard.razor.cs index e7a5d0aa..2eff702e 100644 --- a/Server/Components/Devices/DeviceCard.razor.cs +++ b/Server/Components/Devices/DeviceCard.razor.cs @@ -89,7 +89,7 @@ namespace Remotely.Server.Components.Devices return string.Empty; } - private void ExpandCard() + private void ExpandCard(MouseEventArgs args) { if (AppState.DevicesFrameFocusedDevice == Device.ID) { @@ -105,6 +105,14 @@ namespace Remotely.Server.Components.Devices JsInterop.ScrollToElement(_card); } + private void ContextMenuOpening(MouseEventArgs args) + { + if (GetCardState() == DeviceCardState.Normal) + { + JsInterop.OpenWindow($"/device-details/{Device.ID}", "_blank"); + } + } + private DeviceCardState GetCardState() { if (AppState.DevicesFrameFocusedDevice == Device.ID) @@ -173,7 +181,7 @@ namespace Remotely.Server.Components.Devices private void OpenDeviceDetails() { - JsInterop.OpenWindow($"/DeviceDetails/{Device.ID}", "_blank"); + JsInterop.OpenWindow($"/device-details/{Device.ID}", "_blank"); } private void SetCardStateNormal() diff --git a/Server/Components/Scripts/ScriptSchedules.razor.cs b/Server/Components/Scripts/ScriptSchedules.razor.cs index 716454ee..80424cf9 100644 --- a/Server/Components/Scripts/ScriptSchedules.razor.cs +++ b/Server/Components/Scripts/ScriptSchedules.razor.cs @@ -75,7 +75,7 @@ namespace Remotely.Server.Components.Scripts { if (User.Id != _selectedSchedule.CreatorId) { - ToastService.ShowToast("You can't delete other people's scripts.", classString: "bg-warning"); + ToastService.ShowToast("You can't delete other people's script schedules.", classString: "bg-warning"); return; } diff --git a/Server/Pages/DeviceDetails.razor b/Server/Pages/DeviceDetails.razor index e65387a1..1d2d3916 100644 --- a/Server/Pages/DeviceDetails.razor +++ b/Server/Pages/DeviceDetails.razor @@ -1,10 +1,35 @@ -@page "/DeviceDetails/{deviceId}" +@page "/device-details/{deviceId?}" @attribute [Authorize] @inherits AuthComponentBase -@if (Device is null) +@if (string.IsNullOrWhiteSpace(DeviceId)) +{ +
+
+ +

Device ID:

+
+ +
+ +
+
+
+ You can also go directly to a device's details by: +
    +
  • Right-clicking a device card on the main page while it's collapsed
  • +
  • Clicking the "Open in New Tab" button in a device card's header while it's expanded
  • +
+
+
+
+} +else if (Device is null) {

Device not found.

} @@ -121,9 +146,9 @@ else
@foreach (var setting in Enum.GetValues(typeof(WebRtcSetting))) - { + { - } + }
@@ -136,9 +161,9 @@ else @foreach (var group in DataService.GetDeviceGroups(Username)) - { + { - } + }
@@ -163,7 +188,7 @@ else
- +
@if (!Device.IsOnline) @@ -190,7 +215,7 @@ else
- +

@@ -212,19 +237,19 @@ else @foreach (var scriptResult in _scriptResults) { - - @scriptResult.Shell - @scriptResult.TimeStamp - @scriptResult.SenderUserName - @scriptResult.RunTime - @GetTrimmedText(scriptResult.ScriptInput, 25) - @GetTrimmedText(scriptResult.StandardOutput, 25) - @GetTrimmedText(scriptResult.ErrorOutput, 25) - - - - - } + + @scriptResult.Shell + @scriptResult.TimeStamp + @scriptResult.SenderUserName + @scriptResult.RunTime + @GetTrimmedText(scriptResult.ScriptInput, 25) + @GetTrimmedText(scriptResult.StandardOutput, 25) + @GetTrimmedText(scriptResult.ErrorOutput, 25) + + + + + } diff --git a/Server/Pages/DeviceDetails.razor.cs b/Server/Pages/DeviceDetails.razor.cs index 269c859b..f8c6e2dc 100644 --- a/Server/Pages/DeviceDetails.razor.cs +++ b/Server/Pages/DeviceDetails.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; +using Microsoft.AspNetCore.Components.Web; using Remotely.Server.Components; using Remotely.Server.Hubs; using Remotely.Server.Services; @@ -7,9 +8,7 @@ using Remotely.Shared.Models; using Remotely.Shared.Utilities; using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Text.Json; using System.Threading.Tasks; @@ -21,6 +20,7 @@ namespace Remotely.Server.Pages private readonly ConcurrentQueue _scriptResults = new(); private string _alertMessage; + private string _inputDeviceId; [Parameter] public string DeviceId { get; set; } @@ -36,8 +36,12 @@ namespace Remotely.Server.Pages [Inject] private IModalService ModalService { get; set; } + [Inject] + private NavigationManager NavManager { get; set; } + [Inject] private IToastService ToastService { get; set; } + protected override Task OnInitializedAsync() { if (!string.IsNullOrWhiteSpace(DeviceId)) @@ -65,6 +69,14 @@ namespace Remotely.Server.Pages _alertMessage = string.Empty; } + private void EvaluateDeviceIdInputKeyDown(KeyboardEventArgs args) + { + if (args.Key.Equals("Enter", StringComparison.OrdinalIgnoreCase)) + { + NavManager.NavigateTo($"/device-details/{_inputDeviceId}"); + } + } + private void GetRemoteLogs() { _logLines.Clear(); @@ -84,7 +96,7 @@ namespace Remotely.Server.Pages var results = DataService .GetAllScriptResults(User.OrganizationID, Device.ID) .OrderByDescending(x => x.TimeStamp); - + foreach (var result in results) { _scriptResults.Enqueue(result); @@ -117,6 +129,7 @@ namespace Remotely.Server.Pages return source[0..25] + "..."; } + private string GetTrimmedText(string[] source, int stringLength) { return GetTrimmedText(string.Join("", source), stringLength); @@ -137,6 +150,11 @@ namespace Remotely.Server.Pages return Task.CompletedTask; } + private void NavigateToDeviceId() + { + NavManager.NavigateTo($"/device-details/{_inputDeviceId}"); + } + private void ShowAllDisks() { var disksString = JsonSerializer.Serialize(Device.Drives, JsonSerializerHelper.IndentedOptions); @@ -166,4 +184,4 @@ namespace Remotely.Server.Pages ModalService.ShowModal("Script Input/Output", outputModal); } } -} +} \ No newline at end of file diff --git a/Server/Shared/NavMenu.razor b/Server/Shared/NavMenu.razor index 17249be4..578630fc 100644 --- a/Server/Shared/NavMenu.razor +++ b/Server/Shared/NavMenu.razor @@ -48,7 +48,11 @@ Scripts - +