Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crdt demo #1053

Merged
merged 28 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1264808
enable dev mode in fw lite from c#
hahn-kev Sep 7, 2024
d0d6851
add upload button to project config, display configured server when t…
hahn-kev Sep 7, 2024
e493b21
only push changes to the front end if they match the current filter. …
hahn-kev Sep 8, 2024
b138e52
use staging as default crdt server
hahn-kev Sep 11, 2024
4a37fe4
correct servers fetch path
hahn-kev Sep 11, 2024
ac5f500
remove admin required from crdt controller
hahn-kev Sep 12, 2024
79123fb
enable oauth in staging
hahn-kev Sep 12, 2024
07d8e2a
prevent crash when there's a duplicate ws between vernacular and anal…
hahn-kev Sep 12, 2024
7ec86df
ensure the first server in the list is picked, add some todos for err…
hahn-kev Sep 12, 2024
cbfe923
allow overriding the project paths in appsettings.json, add comments …
hahn-kev Sep 13, 2024
bb9c1dc
update the splash screen to use the lexbox logo, it's not shown on wi…
hahn-kev Sep 20, 2024
65a48a9
update harmony to fix bug updating fields
hahn-kev Sep 20, 2024
c8fb558
use server authority for matching projects with servers, try to retur…
hahn-kev Sep 20, 2024
96091f5
add configuration into testing fixtures since `FwDataBridgeConfig` de…
hahn-kev Sep 20, 2024
8c2a63a
properly display sync status on project page
hahn-kev Sep 23, 2024
7de1cf7
only show expand button in the entry list on the lg breakpoint, it do…
hahn-kev Sep 23, 2024
8cbed65
Merge branch 'develop' into crdt-demo
hahn-kev Sep 25, 2024
36e49a5
rename server parameter to authority to maintain consistency
hahn-kev Sep 25, 2024
a2dc2ca
simplified cleanup in crdt hub
hahn-kev Sep 25, 2024
8c19ea8
remove obsolute comment
hahn-kev Sep 25, 2024
d676915
remove redundant code setting web view hidden
hahn-kev Sep 25, 2024
d788652
remove invalid comment about memory leaks
hahn-kev Sep 25, 2024
63806f7
add FilteringTests.cs
hahn-kev Sep 25, 2024
216edb1
fix issue with environment name not getting set correctly
hahn-kev Sep 25, 2024
5b78f22
Git ignore masl.json
myieye Sep 25, 2024
fd9ad1b
Fix readonly reactivity and right column overflow
myieye Sep 25, 2024
9fefc49
apply some minor fixes
hahn-kev Sep 27, 2024
9de8d9a
Merge branch 'develop' into crdt-demo
hahn-kev Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ dump.sql
test-results/
**/*.sqlite
**/*.sqlite-*
msal.json
msal.cache
artifacts/
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FwDataMiniLcmBridge.LcmUtils;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace FwDataMiniLcmBridge.Tests.Fixtures;
Expand All @@ -8,6 +9,7 @@ public static class FwDataTestsKernel
public static IServiceCollection AddTestFwDataBridge(this IServiceCollection services)
{
services.AddFwDataBridge();
services.AddSingleton<IConfiguration>(_ => new ConfigurationRoot([]));
services.AddSingleton<MockFwProjectLoader>();
services.AddSingleton<IProjectLoader>(sp => sp.GetRequiredService<MockFwProjectLoader>());
services.AddSingleton<FieldWorksProjectList, MockFwProjectList>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0"/>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/FwDataMiniLcmBridge/Api/FwDataMiniLcmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private WritingSystem FromLcmWritingSystem(CoreWritingSystemDefinition ws)
internal void CompleteExemplars(WritingSystems writingSystems)
{
var wsExemplars = writingSystems.Vernacular.Concat(writingSystems.Analysis)
.Distinct()
.DistinctBy(ws => ws.Id)
.ToDictionary(ws => ws, ws => ws.Exemplars.Select(s => s[0]).ToHashSet());
var wsExemplarsByHandle = wsExemplars.ToFrozenDictionary(kv => GetWritingSystemHandle(kv.Key.Id), kv => kv.Value);

Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/FwDataMiniLcmBridge/FwDataBridgeKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static IServiceCollection AddFwDataBridge(this IServiceCollection service
{
services.AddMemoryCache();
services.AddLogging();
services.AddOptions<FwDataBridgeConfig>();
services.AddOptions<FwDataBridgeConfig>().BindConfiguration("FwDataBridge");
services.AddSingleton<FwDataFactory>();
services.AddSingleton<FieldWorksProjectList>();
services.AddSingleton<IProjectLoader, ProjectLoader>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="SIL.Core" Version="14.2.0-beta0009" />
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />
<PackageReference Include="SIL.LCModel" Version="11.0.0-beta0100 " />
Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/FwLiteDesktop/FwLiteDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<MauiIcon Include="Resources\AppIcon\logo_light.svg" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#152747" BaseSize="512,512" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
Expand Down
9 changes: 8 additions & 1 deletion backend/FwLite/FwLiteDesktop/FwLiteDesktopKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using LcmCrdt;
using LocalWebApp.Auth;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NReco.Logging.File;

Expand All @@ -15,7 +16,11 @@ public static void AddFwLiteDesktopServices(this IServiceCollection services,
{
services.AddSingleton<MainPage>();

var serverManager = new ServerManager(webAppBuilder =>
string environment = "Production";
#if DEBUG
environment = "Development";
#endif
var serverManager = new ServerManager(environment, webAppBuilder =>
{
webAppBuilder.Logging.AddFile(Path.Combine(FileSystem.AppDataDirectory, "web-app.log"));
webAppBuilder.Services.Configure<LcmCrdtConfig>(config =>
Expand All @@ -31,9 +36,11 @@ public static void AddFwLiteDesktopServices(this IServiceCollection services,
//using a lambda here means that the serverManager will be disposed when the app is disposed
services.AddSingleton<ServerManager>(_ => serverManager);
services.AddSingleton<IMauiInitializeService>(_ => _.GetRequiredService<ServerManager>());
services.AddSingleton<IHostEnvironment>(_ => _.GetRequiredService<ServerManager>().WebServices.GetRequiredService<IHostEnvironment>());
configuration.Add<ServerConfigSource>(source => source.ServerManager = serverManager);
services.AddOptions<LocalWebAppConfig>().BindConfiguration("LocalWebApp");
logging.AddFile(Path.Combine(FileSystem.AppDataDirectory, "app.log"));
logging.AddConsole();
#if DEBUG
logging.AddDebug();
#endif
Expand Down
2 changes: 1 addition & 1 deletion backend/FwLite/FwLiteDesktop/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FwLiteDesktop.MainPage">

<WebView x:Name="webView"/>
<WebView x:Name="webView" IsVisible="False"/>

</ContentPage>
29 changes: 26 additions & 3 deletions backend/FwLite/FwLiteDesktop/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace FwLiteDesktop;

public partial class MainPage : ContentPage
{
public MainPage(IOptionsMonitor<LocalWebAppConfig> options, ILogger<MainPage> logger)
private readonly ILogger<MainPage> _logger;
private readonly IHostEnvironment _environment;

public MainPage(IOptionsMonitor<LocalWebAppConfig> options, ILogger<MainPage> logger, IHostEnvironment environment)
{
_logger = logger;
_environment = environment;
InitializeComponent();
options.OnChange(o =>
{
Expand Down Expand Up @@ -39,7 +45,24 @@ public MainPage(IOptionsMonitor<LocalWebAppConfig> options, ILogger<MainPage> lo
logger.LogWarning("Too many navigations, stopping");
}
}
else if (!args.Url.StartsWith("https://appdir"))
{
NavigationSuccess();
}
};
}
}

private void NavigationSuccess()
{
webView.IsVisible = true;
if (_environment.IsDevelopment())
{
_logger.LogInformation("Enabling dev mode in browser");
//lang=js
webView.Eval("""
localStorage.setItem('devMode', 'true');
if (enableDevMode) enableDevMode();
""");
}
}
}
Loading
Loading