Compare commits
4 changed files with 116 additions and 158 deletions
|
|
@ -24,65 +24,51 @@
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<WrapPanel Grid.Row="0" HorizontalAlignment="Stretch">
|
|
||||||
<TextBlock Text="Blog Posts" FontSize="22" FontWeight="SemiBold" />
|
|
||||||
<TextBox Text="{Binding SearchText, Mode=TwoWay}" PlaceholderText="Filter by title or author..." />
|
|
||||||
<CommandBar IsDynamicOverflowEnabled="True">
|
|
||||||
<CommandBar.PrimaryCommands>
|
|
||||||
|
|
||||||
<CommandBarButton Label="Filter" Command="{Binding SearchAsync}">
|
<Border Grid.Row="0"
|
||||||
<CommandBarButton.Icon>
|
HorizontalAlignment="Stretch"
|
||||||
<PathIcon Data="{StaticResource FilterIcon}" />
|
VerticalAlignment="Top"
|
||||||
</CommandBarButton.Icon>
|
Padding="0">
|
||||||
</CommandBarButton>
|
<WrapPanel Orientation="Horizontal">
|
||||||
<CommandBarButton Label="Refresh" Command="{Binding RefreshAsync}">
|
<Button Command="{Binding RefreshAsync}" Content="🗘 Refresh" />
|
||||||
<CommandBarButton.Icon>
|
<Button Command="{Binding SearchAsync}" Content="🔍 Filter" />
|
||||||
<PathIcon Data="{StaticResource RefreshIcon}" />
|
<Button Command="{Binding SaveAsync}" Content="Save" />
|
||||||
</CommandBarButton.Icon>
|
<Button Command="{Binding DeleteAsync}" Content="Delete" />
|
||||||
</CommandBarButton>
|
<Button x:Name="AddAttachmentButton"
|
||||||
<CommandBarButton Label="Save" Command="{Binding SaveAsync}">
|
Content="Ajouter fichiers"
|
||||||
<CommandBarButton.Icon>
|
Click="AddAttachment_Click" />
|
||||||
<PathIcon Data="{StaticResource SaveIcon}" />
|
<Button x:Name="ManageAclButton"
|
||||||
</CommandBarButton.Icon>
|
Command="{Binding ManageAclAsync}"
|
||||||
</CommandBarButton>
|
Content="ACL" />
|
||||||
<CommandBarButton Label="Delete" Command="{Binding DeleteAsync}">
|
<Button x:Name="OpenCirclesButton"
|
||||||
<CommandBarButton.Icon>
|
Command="{Binding OpenCirclesAsync}"
|
||||||
<PathIcon Data="{StaticResource DeleteIcon}" />
|
Content="Mes cercles" />
|
||||||
</CommandBarButton.Icon>
|
<!-- Publication toggle: a CheckBox wired to
|
||||||
</CommandBarButton>
|
DraftIsPublished. Clicking it fires
|
||||||
<CommandBarButton Label="Ajouter fichiers" Click="AddAttachment_Click"
|
TogglePublishCommand, which pushes the
|
||||||
x:Name="AddAttachmentButton">
|
new state to /api/blog/{id}/publish.
|
||||||
<CommandBarButton.Icon>
|
The CheckBox is the canonical
|
||||||
<PathIcon Data="{StaticResource AddIcon}" />
|
AvaloniaXaml 'toggle' surface; binding
|
||||||
</CommandBarButton.Icon>
|
IsChecked TwoWay keeps the visual state
|
||||||
</CommandBarButton>
|
and the buffer in sync. -->
|
||||||
<CommandBarButton x:Name="ManageAclButton"
|
<CheckBox Content="Publié"
|
||||||
Label="ACL" Command="{Binding ManageAclAsync}">
|
IsChecked="{Binding DraftIsPublished, Mode=TwoWay}"
|
||||||
<CommandBarButton.Icon>
|
Command="{Binding TogglePublishAsync}"
|
||||||
<PathIcon Data="{StaticResource AclIcon}" />
|
VerticalAlignment="Center"/>
|
||||||
</CommandBarButton.Icon>
|
<!--
|
||||||
</CommandBarButton>
|
DEV ONLY: temporary shortcut to open the signature
|
||||||
<CommandBarButton x:Name="OpenCirclesButton"
|
capture page. Production entry point is a SignalR
|
||||||
Label="Mes cercles" Command="{Binding OpenCirclesAsync}">
|
push from Yavsc.Org ("devis received, sign here").
|
||||||
<CommandBarButton.Icon>
|
Remove this button and its Click handler in
|
||||||
<PathIcon Data="{StaticResource CircleIcon}" />
|
MainPage.axaml.cs once the SignalR handler lands.
|
||||||
</CommandBarButton.Icon>
|
-->
|
||||||
</CommandBarButton>
|
<Button x:Name="OpenSignatureDevButton"
|
||||||
<CommandBarToggleButton Label="Publié"
|
Command="{Binding OpenSignatureDevAsync}"
|
||||||
IsChecked="{Binding DraftIsPublished, Mode=TwoWay}">
|
Content="[DEV] Signature"
|
||||||
<CommandBarToggleButton.Icon>
|
ToolTip.Tip="DEV ONLY — to remove when SignalR handler lands" />
|
||||||
<PathIcon Data="{StaticResource PublishedIcon}" />
|
|
||||||
</CommandBarToggleButton.Icon>
|
|
||||||
</CommandBarToggleButton>
|
|
||||||
<CommandBarButton x:Name="OpenSignatureDevButton"
|
|
||||||
Label="[DEV] Signature" Command="{Binding OpenSignatureDevAsync}">
|
|
||||||
<CommandBarButton.Icon>
|
|
||||||
<PathIcon Data="{StaticResource SignIcon}" />
|
|
||||||
</CommandBarButton.Icon>
|
|
||||||
</CommandBarButton>
|
|
||||||
</CommandBar.PrimaryCommands>
|
|
||||||
</CommandBar>
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Padding="8">
|
<Border Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Padding="8">
|
||||||
<ListBox ItemsSource="{Binding FilteredPosts}" SelectedItem="{Binding SelectedPost, Mode=TwoWay}"
|
<ListBox ItemsSource="{Binding FilteredPosts}" SelectedItem="{Binding SelectedPost, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="40">
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="40">
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,20 @@
|
||||||
|
|
||||||
using Microsoft.Data.Sqlite;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
|
||||||
using Yavsc.Models;
|
|
||||||
|
|
||||||
namespace Yavsc.Org.Tests.Mandatory
|
namespace Yavsc.Org.Tests.Mandatory
|
||||||
{[Collection("Database")]
|
{
|
||||||
|
|
||||||
|
[Collection("Database")]
|
||||||
[Trait("regression", "II")]
|
[Trait("regression", "II")]
|
||||||
[Trait("dev", "wip")]
|
[Trait("dev", "wip")]
|
||||||
public class Database: IClassFixture<WebServerFixture>, IDisposable
|
public class Database: IClassFixture<WebServerFixture>, IDisposable
|
||||||
{
|
{
|
||||||
readonly ITestOutputHelper output;
|
|
||||||
readonly WebServerFixture _serverFixture;
|
readonly WebServerFixture _serverFixture;
|
||||||
|
readonly ITestOutputHelper output;
|
||||||
public Database(ITestOutputHelper output, WebServerFixture _serverFixture)
|
public Database(WebServerFixture serverFixture, ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this._serverFixture = _serverFixture;
|
_serverFixture = serverFixture;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -32,13 +30,5 @@ namespace Yavsc.Org.Tests.Mandatory
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void TestDatabaseMigration()
|
|
||||||
{
|
|
||||||
// Test logic goes here
|
|
||||||
_serverFixture.ResetAndMigrateDatabase();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -189,20 +189,6 @@ public sealed class WebServerFixture : WebHostFixture
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResetAndMigrateDatabase()
|
|
||||||
{
|
|
||||||
using var scope = Services.CreateScope();
|
|
||||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
|
||||||
db.Database.EnsureDeleted();
|
|
||||||
if (db.Database.IsRelational())
|
|
||||||
{
|
|
||||||
db.Database.Migrate();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
db.Database.EnsureCreated();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task<WebApplication> ConfigurePipelineAsync(WebApplication app)
|
protected override async Task<WebApplication> ConfigurePipelineAsync(WebApplication app)
|
||||||
{
|
{
|
||||||
// The MSBuild target CopyYavscOrgStaticAssets in
|
// The MSBuild target CopyYavscOrgStaticAssets in
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,6 @@ namespace Yavsc.Migrations
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
var declarationDateDefaultSql = ActiveProvider == "Microsoft.EntityFrameworkCore.Sqlite"
|
|
||||||
? "CURRENT_TIMESTAMP"
|
|
||||||
: "LOCALTIMESTAMP";
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Activities",
|
name: "Activities",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
|
|
@ -1488,7 +1484,7 @@ namespace Yavsc.Migrations
|
||||||
Platform = table.Column<string>(type: "text", nullable: true),
|
Platform = table.Column<string>(type: "text", nullable: true),
|
||||||
Version = table.Column<string>(type: "text", nullable: true),
|
Version = table.Column<string>(type: "text", nullable: true),
|
||||||
DeviceOwnerId = table.Column<string>(type: "text", nullable: true),
|
DeviceOwnerId = table.Column<string>(type: "text", nullable: true),
|
||||||
DeclarationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: declarationDateDefaultSql),
|
DeclarationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "LOCALTIMESTAMP"),
|
||||||
LatestActivityUpdate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
LatestActivityUpdate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue