diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.Designer.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.Designer.cs similarity index 95% rename from modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.Designer.cs rename to modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.Designer.cs index fcd6c0516b..a270fbcb4e 100644 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.Designer.cs +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.Designer.cs @@ -13,7 +13,7 @@ using VoloDocs.EntityFrameworkCore; namespace Migrations { [DbContext(typeof(VoloDocsDbContext))] - [Migration("20240214150418_Initial")] + [Migration("20240707104226_Initial")] partial class Initial { /// @@ -22,7 +22,7 @@ namespace Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -262,6 +262,58 @@ namespace Migrations b.ToTable("AbpSecurityLogs", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Device") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("DeviceInfo") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IpAddresses") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("LastAccessed") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("SignedIn") + .HasColumnType("datetime2"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Device"); + + b.HasIndex("SessionId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSessions", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.cs similarity index 95% rename from modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.cs rename to modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.cs index 95f41cfd9e..12da8d1bca 100644 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240214150418_Initial.cs +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20240707104226_Initial.cs @@ -170,6 +170,26 @@ namespace Migrations table.PrimaryKey("PK_AbpSecurityLogs", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpSessions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + SessionId = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), + Device = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), + DeviceInfo = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + TenantId = table.Column(type: "uniqueidentifier", nullable: true), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + ClientId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), + IpAddresses = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + SignedIn = table.Column(type: "datetime2", nullable: false), + LastAccessed = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSessions", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpSettingDefinitions", columns: table => new @@ -573,6 +593,21 @@ namespace Migrations table: "AbpSecurityLogs", columns: new[] { "TenantId", "UserId" }); + migrationBuilder.CreateIndex( + name: "IX_AbpSessions_Device", + table: "AbpSessions", + column: "Device"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSessions_SessionId", + table: "AbpSessions", + column: "SessionId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSessions_TenantId_UserId", + table: "AbpSessions", + columns: new[] { "TenantId", "UserId" }); + migrationBuilder.CreateIndex( name: "IX_AbpSettingDefinitions_Name", table: "AbpSettingDefinitions", @@ -654,6 +689,9 @@ namespace Migrations migrationBuilder.DropTable( name: "AbpSecurityLogs"); + migrationBuilder.DropTable( + name: "AbpSessions"); + migrationBuilder.DropTable( name: "AbpSettingDefinitions"); diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs index 90fb47e28a..37601938e1 100644 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace Migrations #pragma warning disable 612, 618 modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) - .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -259,6 +259,58 @@ namespace Migrations b.ToTable("AbpSecurityLogs", (string)null); }); + modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("Device") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("DeviceInfo") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("IpAddresses") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("LastAccessed") + .HasColumnType("datetime2"); + + b.Property("SessionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("SignedIn") + .HasColumnType("datetime2"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Device"); + + b.HasIndex("SessionId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSessions", (string)null); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") diff --git a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs index e49cdc7dde..ff50ee3247 100644 --- a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs +++ b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs @@ -163,6 +163,11 @@ namespace VoloDocs.Web { options.Conventions.AddPageRoute("/Error", "error/{statusCode}"); }); + + Configure(options => + { + options.UseGoogleTranslation = true; + }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebGoogleTranslationOptions.cs b/modules/docs/src/Volo.Docs.Web/DocsWebGoogleTranslationOptions.cs new file mode 100644 index 0000000000..128914f136 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/DocsWebGoogleTranslationOptions.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Volo.Docs; + +public class DocsWebGoogleTranslationOptions +{ + public bool UseGoogleTranslation { get; set; } + + /// + /// https://cloud.google.com/translate/docs/languages + /// + public List IncludedLanguages { get; set; } + + public DocsWebGoogleTranslationOptions() + { + UseGoogleTranslation = false; + IncludedLanguages = + [ + "en", + "tr", + "zh-CN", + "zh-TW", + "ar", + "cs", + "hu", + "hr", + "fi", + "fr", + "hi", + "it", + "pt", + "ru", + "sk", + "de", + "es" + ]; + } +} diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index d0d8d250d2..6ee663a267 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -1,5 +1,11 @@ @page @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.AspNetCore.Mvc.TagHelpers +@using Microsoft.Extensions.Options +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Blockquote +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid +@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers @using Volo.Abp.AspNetCore.Mvc.UI.Layout @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Anchor @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard @@ -8,13 +14,14 @@ @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Prismjs @using Volo.Abp.AspNetCore.Mvc.UI.Theming @using Volo.Docs +@using Volo.Docs.Areas.Documents.TagHelpers @using Volo.Docs.Localization @using Volo.Docs.Pages.Documents.Project @using Volo.Docs.Pages.Documents.Shared.ErrorComponent -@using Volo.Docs.Pages.Shared.Components.Head @inject IThemeManager ThemeManager @inject IPageLayout PageLayout @inject IHtmlLocalizer L +@inject IOptions DocsWebOptions @model IndexModel @{ @@ -36,7 +43,7 @@ } @section scripts { - + @if (Model.LoadSuccess) { @@ -50,6 +57,23 @@ + if (DocsWebOptions.Value.UseGoogleTranslation) + { + + + } } else { @@ -96,6 +120,13 @@
+ @if (DocsWebOptions.Value.UseGoogleTranslation) + { +
+ Google Translate +
+
+ } @if (Model.ShowProjectsCombobox && Model.ProjectSelectItems.Count > 1) {
@@ -341,7 +372,7 @@ var rowCount = count / maxCellCount + (count % maxCellCount > 0 ? 1 : 0); var cellSize = 12 / (count > maxCellCount ? maxCellCount : count); var latestCellSize = 12 / count - (rowCount - 1) * maxCellCount; - + string BuildParameterDivClass(int index) { var row = index / maxCellCount; @@ -349,7 +380,7 @@ var currentCellSize = isLastRow ? latestCellSize : cellSize; return $"col-12 col-lg-{currentCellSize} mb-lg-{(isLastRow ? "0" : "2")} {(index == count - 1 ? "" : "mb-2")}"; } - + for (var i = 0; i < count; ++i) { var parameter = Model.DocumentPreferences.Parameters[i]; @@ -391,11 +422,11 @@ } @Html.Raw(Model.Document.Content) - + @if (Model.DocumentNavigationsDto.HasValues) {
- +