Skip to content

Commit 9949051

Browse files
Fix asset selector.
1 parent c375962 commit 9949051

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

backend/src/Squidex.Data.EntityFramework/ServiceExtensions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ public static void AddSquidexEntityFramework(this IServiceCollection services, I
104104
services.AddSingleton(typeof(ISnapshotStore<>), typeof(SqlServerSnapshotStore<>));
105105
services.AddSingleton(SqlServerDialect.Instance);
106106
services.AddSquidexEntityFramework<SqlServerDbContext>(config);
107-
},
107+
}
108108
});
109109
}
110110

111111
private static void AddSquidexEntityFramework<TContext>(this IServiceCollection services, IConfiguration config) where TContext : AppDbContext
112112
{
113-
services.AddSingletonAs<DatabaseMigrator<TContext>>();
113+
if (config.GetValue<bool>("store:sql:runMigration"))
114+
{
115+
services.AddSingletonAs<DatabaseMigrator<TContext>>();
116+
}
114117

115118
services.AddOpenIddict()
116119
.AddCore(builder =>

backend/src/Squidex/Config/Domain/EventSourcingServices.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using EventStore.Client;
99
using Squidex.Events.GetEventStore;
10+
using Squidex.Hosting.Configuration;
1011
using Squidex.Infrastructure.Commands;
1112
using Squidex.Infrastructure.EventSourcing;
1213
using Squidex.Infrastructure.EventSourcing.Consume;
@@ -26,6 +27,14 @@ public static void AddSquidexEventSourcing(this IServiceCollection services, ICo
2627
},
2728
["Sql"] = () =>
2829
{
30+
if (!string.Equals(config.GetValue<string>("store:type"), "Sql", StringComparison.OrdinalIgnoreCase))
31+
{
32+
throw new ConfigurationException(
33+
new ConfigurationError(
34+
"Sql event store is only allowed, when 'store:type' is also set to 'Sql'.",
35+
"messaging:type"));
36+
}
37+
2938
services.AddSquidexEntityFrameworkEventStore(config);
3039
},
3140
["GetEventStore"] = () =>

backend/src/Squidex/Config/Messaging/MessagingServices.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// All rights reserved. Licensed under the MIT license.
66
// ==========================================================================
77

8+
using System.IO;
89
using System.Text.Json;
910
using Squidex.AI;
1011
using Squidex.Domain.Apps.Core.Subscriptions;
@@ -18,6 +19,7 @@
1819
using Squidex.Domain.Apps.Entities.Rules;
1920
using Squidex.Domain.Apps.Entities.Rules.Runner;
2021
using Squidex.Domain.Apps.Entities.Rules.UsageTracking;
22+
using Squidex.Hosting.Configuration;
2123
using Squidex.Infrastructure.EventSourcing;
2224
using Squidex.Infrastructure.EventSourcing.Consume;
2325
using Squidex.Messaging;
@@ -141,6 +143,14 @@ public static MessagingBuilder AddSquidexTransport(this MessagingBuilder builder
141143

142144
if (string.Equals(type, "Sql", StringComparison.OrdinalIgnoreCase))
143145
{
146+
if (!string.Equals(config.GetValue<string>("store:type"), "Sql", StringComparison.OrdinalIgnoreCase))
147+
{
148+
throw new ConfigurationException(
149+
new ConfigurationError(
150+
"Sql messaging transport is only allowed, when 'store:type' is also set to 'Sql'.",
151+
"messaging:type"));
152+
}
153+
144154
return builder.AddSquidexEntityFrameworkTransport(config);
145155
}
146156

backend/src/Squidex/appsettings.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,11 @@
581581

582582
// The database provider.
583583
//
584-
// SUPPORTED: MySql, Postgres, SqlServer,
585-
"provider": "Postgres"
584+
// SUPPORTED: MySql, Postgres, SqlServer,
585+
"provider": "Postgres",
586+
587+
// Run the migration.
588+
"runMigration": true
586589
},
587590

588591
"mongoDb": {

frontend/src/app/features/content/shared/forms/assets-editor.component.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
<div class="row gx-1" [class.disabled]="snapshot.isDisabled">
2-
<div class="col" [class.disabled]="snapshot.isDisabled">
3-
<button class="btn btn-outline-secondary btn-dashed btn-block btn-add" (click)="assetsDialog.show()" type="button">
4-
{{ "contents.assetsUpload" | sqxTranslate }}
5-
</button>
6-
</div>
7-
<div class="col" [class.disabled]="snapshot.isDisabled">
2+
<div class="col">
83
<div
94
class="btn btn-outline-secondary btn-dashed btn-block btn-add"
105
(click)="fileInput.click()"
116
[sqxDropDisabled]="snapshot.isDisabled"
127
(sqxDropFile)="addFiles($event)">
13-
{{ "contents.assetsSelect" | sqxTranslate }}
8+
{{ "contents.assetsUpload" | sqxTranslate }}
149
<input
1510
class="file-drop-button-input hidden"
1611
#fileInput
@@ -19,6 +14,11 @@
1914
type="file" />
2015
</div>
2116
</div>
17+
<div class="col">
18+
<button class="btn btn-outline-secondary btn-dashed btn-block btn-add" (click)="assetsDialog.show()" type="button">
19+
{{ "contents.assetsSelect" | sqxTranslate }}
20+
</button>
21+
</div>
2222

2323
@if (hasChatBot) {
2424
<div class="col-auto">

0 commit comments

Comments
 (0)