Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Dec 9, 2022
2 parents e046172 + 599bb6e commit 3059637
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 33 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/damselfly-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ jobs:
draft: false
prerelease: false

- name: Download Desktop Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v3
with:
name: Desktop-Dist

- name: Download Server Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v3
with:
name: Server-Dist

- name: Upload Server Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
Expand Down
14 changes: 7 additions & 7 deletions Damselfly.Core.ScopedServices/NotificationsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ namespace Damselfly.Core.ScopedServices;
public class NotificationsService : IAsyncDisposable
{
private readonly ILogger<NotificationsService> _logger;
private readonly WebAssemblyStatusService _wasmState;
private readonly ApplicationStateService _appState;
private readonly HubConnection hubConnection;

public NotificationsService(NavigationManager navManager, WebAssemblyStatusService wasmState,
public NotificationsService(NavigationManager navManager, ApplicationStateService appState,
ILogger<NotificationsService> logger)
{
_logger = logger;
_wasmState = wasmState;
_appState = appState;

if ( _wasmState.IsWebAssembly )
if (_appState.IsWebAssembly )
{
var hubUrl = $"{navManager.BaseUri}{NotificationHub.NotificationRoot}";
_logger.LogInformation($"Setting up notifications listener on {hubUrl}...");
Expand Down Expand Up @@ -80,7 +80,7 @@ public void SubscribeToNotificationAsync<T>(NotificationType type, Func<T, Task>
if ( action is null )
throw new ArgumentException("Action cannot be null");

if ( !_wasmState.IsWebAssembly )
if ( !_appState.IsWebAssembly )
{
_logger.LogInformation($"Ignoring subscription to {type} in Blazor Server mode.");
return;
Expand Down Expand Up @@ -116,7 +116,7 @@ public void SubscribeToNotification<T>(NotificationType type, Action<T> action)
if ( action is null )
throw new ArgumentException("Action cannot be null");

if ( !_wasmState.IsWebAssembly )
if ( !_appState.IsWebAssembly )
{
_logger.LogInformation($"Ignoring subscription to {type} in Blazor Server mode.");
return;
Expand Down Expand Up @@ -149,7 +149,7 @@ public void SubscribeToNotification<T>(NotificationType type, Action<T> action)
/// <param name="action"></param>
public void SubscribeToNotification(NotificationType type, Action action)
{
if ( !_wasmState.IsWebAssembly )
if ( !_appState.IsWebAssembly )
{
_logger.LogInformation($"Ignoring subscription to {type} in Blazor Server mode.");
return;
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core.ScopedServices/ServiceRegistrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static IServiceCollection AddDamselflyUIServices(this IServiceCollection
services.AddSingleton<ClientTaskService>();
services.AddSingleton<ClientWordpressService>();
services.AddSingleton<ClientPeopleService>();
services.AddSingleton<WebAssemblyStatusService>();
services.AddSingleton<ApplicationStateService>();
services.AddSingleton<ClientUserMgmtService>();
services.AddSingleton<ClientExportService>();

Expand Down
5 changes: 3 additions & 2 deletions Damselfly.Core.ScopedServices/WebAssemblyStatusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Damselfly.Core.ScopedServices;

public class WebAssemblyStatusService
public class ApplicationStateService
{
public WebAssemblyStatusService(IJSRuntime jsRuntime)
public ApplicationStateService(IJSRuntime jsRuntime)
{
IsWebAssembly = jsRuntime is IJSInProcessRuntime;
}

public bool IsMobile { get; set; }
public bool IsWebAssembly { get; }
}
2 changes: 1 addition & 1 deletion Damselfly.Core/Utils/ServiceRegistrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static IServiceCollection AddBlazorServerScopedServices(this IServiceColl
services.AddScoped<ServerUserStatusService>();
services.AddScoped<WordpressService>();
services.AddScoped<SystemSettingsService>();
services.AddScoped<WebAssemblyStatusService>();
services.AddScoped<ApplicationStateService>();
services.AddScoped<UserManagementService>();

services.AddScoped<IRecentTagService>(x => x.GetRequiredService<UserTagRecentsService>());
Expand Down
1 change: 0 additions & 1 deletion Damselfly.Web.Client/Shared/Config.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@inject IWorkService workService
@inject IUserService userService
@inject IDialogService DialogService
@inject WebAssemblyStatusService wasmStatus
@inject ILogger<Config> logger

<div class="damselfly-config">
Expand Down
4 changes: 2 additions & 2 deletions Damselfly.Web.Client/Shared/ConnectionStatus.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@inject NavigationManager Navigation
@inject NotificationsService notifications
@inject WebAssemblyStatusService wasmState
@inject ApplicationStateService appState
@using Microsoft.AspNetCore.SignalR.Client
@implements IDisposable

@if( wasmState.IsWebAssembly )
@if( appState.IsWebAssembly )
{
<div class="damselfly-statusbarpanel" title="Server link is @Status">
<label>
Expand Down
3 changes: 2 additions & 1 deletion Damselfly.Web.Client/Shared/DamselflyLogo.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<NavLink href="/">
<img src="damselfly-logo.png" title="Damselfly"/>
</NavLink>
</div>
</div>

10 changes: 8 additions & 2 deletions Damselfly.Web.Client/Shared/Dialogs/UserDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,14 @@
if( allUsers.Any() )
{
allRoles.AddRange(systemRoles);
var role = User.UserRoles.First();
selectedRole = role.Role.Name;

if( User.UserRoles != null )
{
var role = User.UserRoles.First();
selectedRole = role.Role.Name;
}
else
selectedRole = RoleDefinitions.s_AdminRole;
}
else
{
Expand Down
37 changes: 29 additions & 8 deletions Damselfly.Web.Client/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
@inject AuthenticationStateProvider authProvider
@inject IConfigService configService
@inject IUserMgmtService userService
@inject IJSRuntime jsRuntime
@inject ApplicationStateService appStatusService

@implements IDisposable

<MudDialogProvider FullWidth="true" MaxWidth="MaxWidth.Small" />
Expand All @@ -31,14 +34,22 @@
{
<div class="damselfly-container">
<div class="damselfly-application">
<SplitView>
<LeftPane>
<SideBar />
</LeftPane>
<RightPane>
@Body
</RightPane>
</SplitView>
@if (appStatusService.IsMobile)
{
@Body
<SideBar />
}
else
{
<SplitView>
<LeftPane>
<SideBar />
</LeftPane>
<RightPane>
@Body
</RightPane>
</SplitView>
}
</div>
<DetailedErrorBoundary>
<Statusbar />
Expand Down Expand Up @@ -72,6 +83,16 @@
authProvider.AuthenticationStateChanged -= AuthStateChanged;
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
int innerWidth = await jsRuntime.InvokeAsync<int>("getInnerWidth");

appStatusService.IsMobile = (innerWidth <= 480);
}
}

protected override async Task OnInitializedAsync()
{
authProvider.AuthenticationStateChanged += AuthStateChanged;
Expand Down
8 changes: 4 additions & 4 deletions Damselfly.Web.Client/Shared/Statusbar.razor
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@implements IDisposable

@inject IUserStatusService userStatusService
@inject WebAssemblyStatusService wasmState
@inject ApplicationStateService appState


<div class="damselfly-statusbar">
<TimedStatus DisplayIntervalSecs="30" StatusText="@StatusText" />
<WorkStatus />
<ConnectionStatus />
@if (wasmState.IsWebAssembly)
@if (appState.IsWebAssembly)
{
<LoginDisplayWasm />
}
Expand All @@ -27,7 +27,7 @@
{
InvokeAsync(() =>
{
if( StatusText != newText )
if (StatusText != newText)
{
StatusText = newText;
StateHasChanged();
Expand All @@ -37,7 +37,7 @@

protected override void OnAfterRender(bool firstRender)
{
if( firstRender )
if (firstRender)
{
userStatusService.OnStatusChanged += UpdateStatus;
}
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/Shared/UserManagement.razor
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

private async Task OpenUserDialog(AppIdentityUser user)
{
var parameters = new DialogParameters { ["userid"] = user.Id };
var parameters = new DialogParameters { ["userid"] = user == null ? null : user.Id };

await InvokeAsync(async () =>
{
Expand Down
30 changes: 30 additions & 0 deletions Damselfly.Web.Client/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,36 @@ f
.damselfly-searchbar {
flex-flow: column wrap;
}

.wrapping-table-mini img {
width: 50px;
min-height: 50px;
}

.wrapping-table-small img {
width: 50px;
max-width: 50px;
max-height: 50px;
min-height: 50px;
}

.wrapping-table-medium img {
height: 80px;
min-height: 200px;
min-width: 80px;
}

.wrapping-table-large img {
height: 150px;
min-height: 250px;
min-width: 100px;
}

.wrapping-table-x-large img {
height: 300px;
min-height: 300px;
min-width: 100px;
}
}

.damselfly-imagegrid {
Expand Down
11 changes: 10 additions & 1 deletion Damselfly.Web.Client/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@
<script src="_content/BlazorPanzoom/panzoom.min.js"></script>
<script src="_content/BlazorPanzoom/blazorpanzoom.js"></script>

<script>function setStyleSheet(url) {
<script>
function isDevice() {
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i.test(navigator.userAgent);
}

function getInnerWidth () {
return window.innerWidth;
}

function setStyleSheet(url) {
var stylesheet = document.getElementById("themeStyleSheet");
stylesheet.setAttribute('href', url);
}
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Web.Client/wwwroot/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const CACHE_VERSION='4.0.1-20221205090133'
const CACHE_VERSION='4.0.2-20221209173718'
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.2
4.0.3

0 comments on commit 3059637

Please sign in to comment.