mirror of https://github.com/abpframework/abp.git
39 changed files with 2015 additions and 74 deletions
@ -0,0 +1,458 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Metadata; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.DocsTestApp.EntityFrameworkCore; |
|||
|
|||
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations |
|||
{ |
|||
[DbContext(typeof(DocsTestAppDbContext))] |
|||
[Migration("20181225063242_Added_Identity")] |
|||
partial class Added_Identity |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 128) |
|||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Regex") |
|||
.HasMaxLength(512); |
|||
|
|||
b.Property<string>("RegexDescription") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<bool>("Required"); |
|||
|
|||
b.Property<int>("ValueType"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AbpClaimTypes"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDefault") |
|||
.HasColumnName("IsDefault"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnName("IsPublic"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnName("IsStatic"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedName") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("NormalizedName"); |
|||
|
|||
b.ToTable("AbpRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleId"); |
|||
|
|||
b.ToTable("AbpRoleClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<int>("AccessFailedCount") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("AccessFailedCount") |
|||
.HasDefaultValue(0); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.IsRequired() |
|||
.HasColumnName("ConcurrencyStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<DateTime>("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime"); |
|||
|
|||
b.Property<string>("Email") |
|||
.HasColumnName("Email") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<bool>("EmailConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("EmailConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId"); |
|||
|
|||
b.Property<bool>("LockoutEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("LockoutEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<DateTimeOffset?>("LockoutEnd"); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasColumnName("Name") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("NormalizedEmail") |
|||
.HasColumnName("NormalizedEmail") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("NormalizedUserName") |
|||
.IsRequired() |
|||
.HasColumnName("NormalizedUserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PasswordHash") |
|||
.HasColumnName("PasswordHash") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("PhoneNumber") |
|||
.HasColumnName("PhoneNumber") |
|||
.HasMaxLength(16); |
|||
|
|||
b.Property<bool>("PhoneNumberConfirmed") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("PhoneNumberConfirmed") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("SecurityStamp") |
|||
.IsRequired() |
|||
.HasColumnName("SecurityStamp") |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("Surname") |
|||
.HasColumnName("Surname") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<bool>("TwoFactorEnabled") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnName("TwoFactorEnabled") |
|||
.HasDefaultValue(false); |
|||
|
|||
b.Property<string>("UserName") |
|||
.IsRequired() |
|||
.HasColumnName("UserName") |
|||
.HasMaxLength(256); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Email"); |
|||
|
|||
b.HasIndex("NormalizedEmail"); |
|||
|
|||
b.HasIndex("NormalizedUserName"); |
|||
|
|||
b.HasIndex("UserName"); |
|||
|
|||
b.ToTable("AbpUsers"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ClaimType") |
|||
.IsRequired() |
|||
.HasMaxLength(256); |
|||
|
|||
b.Property<string>("ClaimValue") |
|||
.HasMaxLength(1024); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId"); |
|||
|
|||
b.ToTable("AbpUserClaims"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderDisplayName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(196); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider"); |
|||
|
|||
b.HasIndex("LoginProvider", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpUserLogins"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<Guid>("RoleId"); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("UserId", "RoleId"); |
|||
|
|||
b.HasIndex("RoleId", "UserId"); |
|||
|
|||
b.ToTable("AbpUserRoles"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.Property<Guid>("UserId"); |
|||
|
|||
b.Property<string>("LoginProvider") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Name") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.Property<string>("Value"); |
|||
|
|||
b.HasKey("UserId", "LoginProvider", "Name"); |
|||
|
|||
b.ToTable("AbpUserTokens"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.IsRequired() |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<Guid?>("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpPermissionGrants"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ProviderKey") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("ProviderName") |
|||
.HasMaxLength(64); |
|||
|
|||
b.Property<string>("Value") |
|||
.IsRequired() |
|||
.HasMaxLength(2048); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name", "ProviderName", "ProviderKey"); |
|||
|
|||
b.ToTable("AbpSettings"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Docs.Projects.Project", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd(); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<string>("DefaultDocumentName") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("DocumentStoreType"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Format"); |
|||
|
|||
b.Property<string>("LatestVersionBranchName") |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("MainWebsiteUrl"); |
|||
|
|||
b.Property<string>("MinimumVersion"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("NavigationDocumentName") |
|||
.IsRequired() |
|||
.HasMaxLength(128); |
|||
|
|||
b.Property<string>("ShortName") |
|||
.IsRequired() |
|||
.HasMaxLength(32); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("DocsProjects"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Claims") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Logins") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityRole") |
|||
.WithMany() |
|||
.HasForeignKey("RoleId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
|
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Roles") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
|
|||
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => |
|||
{ |
|||
b.HasOne("Volo.Abp.Identity.IdentityUser") |
|||
.WithMany("Tokens") |
|||
.HasForeignKey("UserId") |
|||
.OnDelete(DeleteBehavior.Cascade); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,313 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations |
|||
{ |
|||
public partial class Added_Identity : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AbpClaimTypes", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
Name = table.Column<string>(maxLength: 256, nullable: false), |
|||
Required = table.Column<bool>(nullable: false), |
|||
IsStatic = table.Column<bool>(nullable: false), |
|||
Regex = table.Column<string>(maxLength: 512, nullable: true), |
|||
RegexDescription = table.Column<string>(maxLength: 128, nullable: true), |
|||
Description = table.Column<string>(maxLength: 256, nullable: true), |
|||
ValueType = table.Column<int>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpPermissionGrants", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
Name = table.Column<string>(maxLength: 128, nullable: false), |
|||
ProviderName = table.Column<string>(maxLength: 64, nullable: false), |
|||
ProviderKey = table.Column<string>(maxLength: 64, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpRoles", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
Name = table.Column<string>(maxLength: 256, nullable: false), |
|||
NormalizedName = table.Column<string>(maxLength: 256, nullable: false), |
|||
IsDefault = table.Column<bool>(nullable: false), |
|||
IsStatic = table.Column<bool>(nullable: false), |
|||
IsPublic = table.Column<bool>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpRoles", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpSettings", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
Name = table.Column<string>(maxLength: 128, nullable: false), |
|||
Value = table.Column<string>(maxLength: 2048, nullable: false), |
|||
ProviderName = table.Column<string>(maxLength: 64, nullable: true), |
|||
ProviderKey = table.Column<string>(maxLength: 64, nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpSettings", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUsers", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(nullable: true), |
|||
LastModifierId = table.Column<Guid>(nullable: true), |
|||
IsDeleted = table.Column<bool>(nullable: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
UserName = table.Column<string>(maxLength: 256, nullable: false), |
|||
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false), |
|||
Name = table.Column<string>(maxLength: 64, nullable: true), |
|||
Surname = table.Column<string>(maxLength: 64, nullable: true), |
|||
Email = table.Column<string>(maxLength: 256, nullable: true), |
|||
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), |
|||
EmailConfirmed = table.Column<bool>(nullable: false, defaultValue: false), |
|||
PasswordHash = table.Column<string>(maxLength: 256, nullable: true), |
|||
SecurityStamp = table.Column<string>(maxLength: 256, nullable: false), |
|||
PhoneNumber = table.Column<string>(maxLength: 16, nullable: true), |
|||
PhoneNumberConfirmed = table.Column<bool>(nullable: false, defaultValue: false), |
|||
TwoFactorEnabled = table.Column<bool>(nullable: false, defaultValue: false), |
|||
LockoutEnd = table.Column<DateTimeOffset>(nullable: true), |
|||
LockoutEnabled = table.Column<bool>(nullable: false, defaultValue: false), |
|||
AccessFailedCount = table.Column<int>(nullable: false, defaultValue: 0) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUsers", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpRoleClaims", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ClaimType = table.Column<string>(maxLength: 256, nullable: false), |
|||
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true), |
|||
RoleId = table.Column<Guid>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpRoleClaims_AbpRoles_RoleId", |
|||
column: x => x.RoleId, |
|||
principalTable: "AbpRoles", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserClaims", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
ClaimType = table.Column<string>(maxLength: 256, nullable: false), |
|||
ClaimValue = table.Column<string>(maxLength: 1024, nullable: true), |
|||
UserId = table.Column<Guid>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserClaims", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserClaims_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserLogins", |
|||
columns: table => new |
|||
{ |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
LoginProvider = table.Column<string>(maxLength: 64, nullable: false), |
|||
ProviderKey = table.Column<string>(maxLength: 196, nullable: false), |
|||
ProviderDisplayName = table.Column<string>(maxLength: 128, nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserLogins_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserRoles", |
|||
columns: table => new |
|||
{ |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
RoleId = table.Column<Guid>(nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserRoles_AbpRoles_RoleId", |
|||
column: x => x.RoleId, |
|||
principalTable: "AbpRoles", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserRoles_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpUserTokens", |
|||
columns: table => new |
|||
{ |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
LoginProvider = table.Column<string>(maxLength: 64, nullable: false), |
|||
Name = table.Column<string>(maxLength: 128, nullable: false), |
|||
Value = table.Column<string>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); |
|||
table.ForeignKey( |
|||
name: "FK_AbpUserTokens_AbpUsers_UserId", |
|||
column: x => x.UserId, |
|||
principalTable: "AbpUsers", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", |
|||
table: "AbpPermissionGrants", |
|||
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpRoleClaims_RoleId", |
|||
table: "AbpRoleClaims", |
|||
column: "RoleId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpRoles_NormalizedName", |
|||
table: "AbpRoles", |
|||
column: "NormalizedName"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpSettings_Name_ProviderName_ProviderKey", |
|||
table: "AbpSettings", |
|||
columns: new[] { "Name", "ProviderName", "ProviderKey" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserClaims_UserId", |
|||
table: "AbpUserClaims", |
|||
column: "UserId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserLogins_LoginProvider_ProviderKey", |
|||
table: "AbpUserLogins", |
|||
columns: new[] { "LoginProvider", "ProviderKey" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUserRoles_RoleId_UserId", |
|||
table: "AbpUserRoles", |
|||
columns: new[] { "RoleId", "UserId" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_Email", |
|||
table: "AbpUsers", |
|||
column: "Email"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_NormalizedEmail", |
|||
table: "AbpUsers", |
|||
column: "NormalizedEmail"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_NormalizedUserName", |
|||
table: "AbpUsers", |
|||
column: "NormalizedUserName"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpUsers_UserName", |
|||
table: "AbpUsers", |
|||
column: "UserName"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpClaimTypes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpPermissionGrants"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpRoleClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpSettings"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserLogins"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserRoles"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUserTokens"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpRoles"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "AbpUsers"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
@page |
|||
@model Volo.DocsTestApp.Pages.IndexModel |
|||
<h3>Welcome to the Docs demo application.</h3> |
|||
<a href="/Documents/">Go to Docs</a> |
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|||
|
|||
namespace Volo.DocsTestApp.Pages |
|||
{ |
|||
public class IndexModel : PageModel |
|||
{ |
|||
public void OnGet() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +1,6 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Docs.Web |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@addTagHelper *, Volo.Docs.Web |
|||
@addTagHelper *, Volo.Docs.Admin.Web |
|||
@ -0,0 +1,24 @@ |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Docs.Localization; |
|||
|
|||
namespace Volo.Docs.Admin |
|||
{ |
|||
public class DocsAdminPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var group = context.AddGroup(DocsAdminPermissions.GroupName, L("Permission:DocumentManagement")); |
|||
|
|||
var projects = group.AddPermission(DocsAdminPermissions.Projects.Default, L("Permission:Projects")); |
|||
projects.AddChild(DocsAdminPermissions.Projects.Update, L("Permission:Edit")); |
|||
projects.AddChild(DocsAdminPermissions.Projects.Delete, L("Permission:Delete")); |
|||
projects.AddChild(DocsAdminPermissions.Projects.Create, L("Permission:Create")); |
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<DocsResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Volo.Docs.Admin |
|||
{ |
|||
public class DocsAdminPermissions |
|||
{ |
|||
public const string GroupName = "Docs.Admin"; |
|||
|
|||
public static class Projects |
|||
{ |
|||
public const string Default = GroupName + ".Projects"; |
|||
public const string Delete = Default + ".Delete"; |
|||
public const string Update = Default + ".Update"; |
|||
public const string Create = Default + ".Create"; |
|||
} |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return new[] |
|||
{ |
|||
GroupName, |
|||
Projects.Default, |
|||
Projects.Delete, |
|||
Projects.Update, |
|||
Projects.Create, |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Permission:DocumentManagement": "Document Management", |
|||
"Permission:Projects": "Projects", |
|||
"Permission:Edit": "Edit", |
|||
"Permission:Delete": "Delete", |
|||
"Permission:Create": "Create" |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"Permission:DocumentManagement": "Döküman yönetimi", |
|||
"Permission:Projects": "Projeler", |
|||
"Permission:Edit": "Düzenle", |
|||
"Permission:Delete": "Sil", |
|||
"Permission:Create": "Oluştur" |
|||
} |
|||
} |
|||
@ -1,50 +0,0 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace Volo.Docs.Admin.Projects |
|||
{ |
|||
[RemoteService] |
|||
[Area("docs")] |
|||
[ControllerName("Project")] |
|||
[Route("api/docs/admin/projects")] |
|||
public class DocsAdminProjectController : AbpController, IProjectAdminAppService |
|||
{ |
|||
protected IProjectAdminAppService ProjectAppService { get; } |
|||
|
|||
public DocsAdminProjectController(IProjectAdminAppService projectAppService) |
|||
{ |
|||
ProjectAppService = projectAppService; |
|||
} |
|||
|
|||
public Task<PagedResultDto<ProjectDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
|||
{ |
|||
return ProjectAppService.GetListAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("{id}")] |
|||
public Task<ProjectDto> GetAsync(Guid id) |
|||
{ |
|||
return ProjectAppService.GetAsync(id); |
|||
} |
|||
|
|||
public Task<ProjectDto> CreateAsync(CreateProjectDto input) |
|||
{ |
|||
return ProjectAppService.CreateAsync(input); |
|||
} |
|||
|
|||
public Task<ProjectDto> UpdateAsync(Guid id, UpdateProjectDto input) |
|||
{ |
|||
return ProjectAppService.UpdateAsync(id, input); |
|||
} |
|||
|
|||
public Task DeleteAsync(Guid id) |
|||
{ |
|||
return ProjectAppService.DeleteAsync(id); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Docs.Admin.Projects; |
|||
|
|||
namespace Volo.Docs.Admin |
|||
{ |
|||
[RemoteService] |
|||
[Area("docs")] |
|||
[ControllerName("ProjectsAdmin")] |
|||
[Route("api/docs/admin/projects")] |
|||
public class ProjectsAdminController : AbpController, IProjectAdminAppService |
|||
{ |
|||
private readonly IProjectAdminAppService _projectAppService; |
|||
|
|||
public ProjectsAdminController(IProjectAdminAppService projectAdminAppService) |
|||
{ |
|||
_projectAppService = projectAdminAppService; |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("")] |
|||
public Task<PagedResultDto<ProjectDto>> GetListAsync(PagedAndSortedResultRequestDto input) |
|||
{ |
|||
return _projectAppService.GetListAsync(input); |
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("{id}")] |
|||
public Task<ProjectDto> GetAsync(Guid id) |
|||
{ |
|||
return _projectAppService.GetAsync(id); |
|||
} |
|||
|
|||
[HttpPost] |
|||
public Task<ProjectDto> CreateAsync(CreateProjectDto input) |
|||
{ |
|||
return _projectAppService.CreateAsync(input); |
|||
} |
|||
|
|||
[HttpPut] |
|||
[Route("{id}")] |
|||
public Task<ProjectDto> UpdateAsync(Guid id, UpdateProjectDto input) |
|||
{ |
|||
return _projectAppService.UpdateAsync(id, input); |
|||
} |
|||
|
|||
[HttpDelete] |
|||
public Task DeleteAsync(Guid id) |
|||
{ |
|||
return _projectAppService.DeleteAsync(id); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Localization; |
|||
using Volo.Abp.UI.Navigation; |
|||
using Volo.Docs.Localization; |
|||
|
|||
namespace Volo.Docs.Admin |
|||
{ |
|||
public class DocsMenuContributor : IMenuContributor |
|||
{ |
|||
public async Task ConfigureMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (context.Menu.Name == StandardMenus.Main) |
|||
{ |
|||
await ConfigureMainMenu(context); |
|||
} |
|||
} |
|||
|
|||
private async Task ConfigureMainMenu(MenuConfigurationContext context) |
|||
{ |
|||
var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>(); |
|||
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<DocsResource>>(); |
|||
|
|||
//if (await authorizationService.IsGrantedAsync(DocsAdminPermissions.GroupName))
|
|||
{ |
|||
var rootMenuItem = new ApplicationMenuItem("DocumentManagement", l["Menu:DocumentManagement"], "/Docs/Admin"); |
|||
|
|||
if (await authorizationService.IsGrantedAsync(DocsAdminPermissions.Projects.Default)) |
|||
{ |
|||
rootMenuItem.AddItem(new ApplicationMenuItem("ProjectManagement", l["Menu:ProjectManagement"], "/Docs/Admin/Projects")); |
|||
} |
|||
|
|||
context.Menu.AddItem(rootMenuItem); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Menu:DocumentManagement": "Documents", |
|||
"Menu:ProjectManagement": "Projects", |
|||
"CreateANewProject": "Create new project", |
|||
"Edit": "Edit", |
|||
"Create": "Create", |
|||
"Projects": "Projects", |
|||
"Name": "Name", |
|||
"ShortName": "ShortName", |
|||
"DocumentStoreType": "DocumentStoreType", |
|||
"Format": "Format", |
|||
"DisplayName:Name": "Name", |
|||
"DisplayName:ShortName": "Short name", |
|||
"DisplayName:Format": "Format", |
|||
"DisplayName:DefaultDocumentName": "Default documentName", |
|||
"DisplayName:NavigationDocumentName": "Navigation document name", |
|||
"DisplayName:MinimumVersion": "Minimum version", |
|||
"DisplayName:MainWebsiteUrl": "Main web site url", |
|||
"DisplayName:LatestVersionBranchName": "Latest version branch name", |
|||
"DisplayName:GitHubRootUrl": "GitHub root url", |
|||
"DisplayName:GitHubAccessToken": "GitHub access token" |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"Menu:DocumentManagement": "Dökümanlar", |
|||
"Menu:ProjectManagement": "Projeler", |
|||
"CreateANewProject": "Yeni proje oluştur", |
|||
"Edit": "Düzenle", |
|||
"Create": "Yeni oluştur", |
|||
"Projects": "Projeler", |
|||
"Name": "İsim", |
|||
"ShortName": "Kısa isim", |
|||
"DocumentStoreType": "Döküman saklama tipi", |
|||
"Format": "Format", |
|||
"Actions": "İşlemler", |
|||
"DisplayName:Name": "Adı", |
|||
"DisplayName:ShortName": "Kısa adı", |
|||
"DisplayName:Format": "Format", |
|||
"DisplayName:DefaultDocumentName": "Varsayılan döküman adı", |
|||
"DisplayName:NavigationDocumentName": "Navigasyon dökümanı adı", |
|||
"DisplayName:MinimumVersion": "Minimum versiyon", |
|||
"DisplayName:MainWebsiteUrl": "Ana web site url'i", |
|||
"DisplayName:LatestVersionBranchName": "Son versiyon Branch adı", |
|||
"DisplayName:GitHubRootUrl": "GitHub kök url'i", |
|||
"DisplayName:GitHubAccessToken": "GitHub erişim jetonu" |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using Microsoft.AspNetCore.Mvc.Localization; |
|||
using Microsoft.AspNetCore.Mvc.Razor.Internal; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
using Volo.Docs.Localization; |
|||
|
|||
namespace Volo.Docs.Admin.Pages.Docs.Admin |
|||
{ |
|||
public abstract class DocsAdminPage : AbpPage |
|||
{ |
|||
[RazorInject] |
|||
public IHtmlLocalizer<DocsResource> L { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
@page |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|||
@using Volo.Docs.Admin.Pages.Docs.Admin.Projects |
|||
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage |
|||
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.CreateModel |
|||
@{ |
|||
Layout = null; |
|||
} |
|||
|
|||
@if (Model.GithubProject != null) |
|||
{ |
|||
<abp-dynamic-form submit-button="false" abp-model="@Model.GithubProject" asp-page="/Docs/Admin/Projects/Create"> |
|||
<abp-modal size="@(AbpModalSize.Default)"> |
|||
<abp-modal-header title="@L["Create"].Value"></abp-modal-header> |
|||
<abp-modal-body> |
|||
<abp-form-content /> |
|||
</abp-modal-body> |
|||
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"> |
|||
</abp-modal-footer> |
|||
</abp-modal> |
|||
</abp-dynamic-form> |
|||
} |
|||
@ -0,0 +1,112 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|||
using Microsoft.AspNetCore.Mvc.Rendering; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
using Volo.Docs.Admin.Projects; |
|||
using Volo.Docs.Projects; |
|||
|
|||
namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects |
|||
{ |
|||
public class CreateModel : AbpPageModel |
|||
{ |
|||
[BindProperty] |
|||
public CreateGithubProjectViewModel GithubProject { get; set; } |
|||
|
|||
private readonly IProjectAdminAppService _projectAppService; |
|||
|
|||
public List<SelectListItem> FormatTypes { get; set; } |
|||
= new List<SelectListItem> {new SelectListItem("markdown", "md")}; |
|||
|
|||
public CreateModel(IProjectAdminAppService projectAppService) |
|||
{ |
|||
_projectAppService = projectAppService; |
|||
} |
|||
|
|||
public async Task<ActionResult> OnGetAsync(string source) |
|||
{ |
|||
if (source == "GitHub") |
|||
{ |
|||
GithubProject = new CreateGithubProjectViewModel(); |
|||
return Page(); |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("UnknowDocumentSourceExceptionMessage"); |
|||
} |
|||
} |
|||
|
|||
public async void OnPostAsync() |
|||
{ |
|||
if (GithubProject != null) |
|||
{ |
|||
var dto = GetGithubProjectAsDto(); |
|||
await _projectAppService.CreateAsync(dto); |
|||
} |
|||
} |
|||
|
|||
public CreateProjectDto GetGithubProjectAsDto() |
|||
{ |
|||
var dto = ObjectMapper.Map<CreateGithubProjectViewModel, CreateProjectDto>(GithubProject); |
|||
|
|||
dto.ExtraProperties = new Dictionary<string, object> |
|||
{ |
|||
{nameof(GithubProject.GitHubRootUrl), GithubProject.GitHubRootUrl}, |
|||
{nameof(GithubProject.GitHubAccessToken), GithubProject.GitHubAccessToken} |
|||
}; |
|||
|
|||
return dto; |
|||
} |
|||
|
|||
public abstract class CreateProjectViewModelBase |
|||
{ |
|||
[Required] |
|||
[StringLength(ProjectConsts.MaxNameLength)] |
|||
public string Name { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(ProjectConsts.MaxShortNameLength)] |
|||
public string ShortName { get; set; } |
|||
|
|||
[Required] |
|||
[SelectItems(nameof(FormatTypes))] |
|||
public string Format { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxDefaultDocumentNameLength)] |
|||
public string DefaultDocumentName { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxNavigationDocumentNameLength)] |
|||
public string NavigationDocumentName { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxVersionNameLength)] |
|||
public string MinimumVersion { get; set; } |
|||
|
|||
public string MainWebsiteUrl { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxLatestVersionBranchNameLength)] |
|||
public string LatestVersionBranchName { get; set; } |
|||
|
|||
[HiddenInput] |
|||
public string DocumentStoreType { get; set; } = "GitHub"; |
|||
} |
|||
|
|||
public class CreateGithubProjectViewModel : CreateProjectViewModelBase |
|||
{ |
|||
[DisplayOrder(10001)] |
|||
[Required] |
|||
[StringLength(256)] |
|||
public string GitHubRootUrl { get; set; } |
|||
|
|||
|
|||
[DisplayOrder(10001)] |
|||
[StringLength(512)] |
|||
public string GitHubAccessToken { get; set; } |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
@page |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
|||
@using Volo.Docs.Admin.Pages.Docs.Admin.Projects |
|||
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage |
|||
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.EditModel |
|||
@{ |
|||
Layout = null; |
|||
} |
|||
|
|||
@if (Model.GithubProject != null) |
|||
{ |
|||
<abp-dynamic-form submit-button="false" abp-model="@Model.GithubProject" asp-page="/Docs/Admin/Projects/Edit"> |
|||
<abp-modal size="@(AbpModalSize.Default)"> |
|||
<abp-modal-header title="@L["Edit"].Value"></abp-modal-header> |
|||
<abp-modal-body> |
|||
<abp-form-content /> |
|||
</abp-modal-body> |
|||
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"> |
|||
</abp-modal-footer> |
|||
</abp-modal> |
|||
</abp-dynamic-form> |
|||
} |
|||
@ -0,0 +1,119 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|||
using Microsoft.AspNetCore.Mvc.Rendering; |
|||
using Volo.Abp; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
using Volo.Docs.Admin.Projects; |
|||
using Volo.Docs.Projects; |
|||
|
|||
namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects |
|||
{ |
|||
public class EditModel : AbpPageModel |
|||
{ |
|||
[BindProperty] |
|||
public EditGithubProjectViewModel GithubProject { get; set; } |
|||
|
|||
private readonly IProjectAdminAppService _projectAppService; |
|||
|
|||
public List<SelectListItem> FormatTypes { get; set; } |
|||
= new List<SelectListItem> { new SelectListItem("markdown", "md") }; |
|||
|
|||
public EditModel(IProjectAdminAppService projectAppService) |
|||
{ |
|||
_projectAppService = projectAppService; |
|||
} |
|||
|
|||
public async Task<ActionResult> OnGetAsync(Guid id) |
|||
{ |
|||
var project = await _projectAppService.GetAsync(id); |
|||
|
|||
if (project.DocumentStoreType == "GitHub") |
|||
{ |
|||
SetGithubProjectFromDto(project); |
|||
return Page(); |
|||
} |
|||
else |
|||
{ |
|||
throw new BusinessException("UnknowDocumentSourceExceptionMessage"); |
|||
} |
|||
} |
|||
|
|||
public async void OnPostAsync() |
|||
{ |
|||
if (GithubProject != null) |
|||
{ |
|||
var dto = GetGithubProjectAsDto(); |
|||
await _projectAppService.UpdateAsync(GithubProject.Id, dto); |
|||
} |
|||
} |
|||
|
|||
public UpdateProjectDto GetGithubProjectAsDto() |
|||
{ |
|||
var dto = ObjectMapper.Map<EditGithubProjectViewModel, UpdateProjectDto>(GithubProject); |
|||
|
|||
dto.ExtraProperties = new Dictionary<string, object> |
|||
{ |
|||
{nameof(GithubProject.GitHubRootUrl), GithubProject.GitHubRootUrl}, |
|||
{nameof(GithubProject.GitHubAccessToken), GithubProject.GitHubAccessToken} |
|||
}; |
|||
|
|||
return dto; |
|||
} |
|||
|
|||
public void SetGithubProjectFromDto(ProjectDto dto) |
|||
{ |
|||
GithubProject = ObjectMapper.Map<ProjectDto,EditGithubProjectViewModel>(dto); |
|||
|
|||
GithubProject.GitHubAccessToken = (string) dto.ExtraProperties[nameof(GithubProject.GitHubAccessToken)]; |
|||
GithubProject.GitHubRootUrl = (string) dto.ExtraProperties[nameof(GithubProject.GitHubRootUrl)]; |
|||
} |
|||
|
|||
public abstract class EditProjectViewModelBase |
|||
{ |
|||
[Required] |
|||
[HiddenInput] |
|||
public Guid Id { get; set; } |
|||
|
|||
[Required] |
|||
[StringLength(ProjectConsts.MaxNameLength)] |
|||
public string Name { get; set; } |
|||
|
|||
[Required] |
|||
[SelectItems(nameof(FormatTypes))] |
|||
public string Format { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxDefaultDocumentNameLength)] |
|||
public string DefaultDocumentName { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxNavigationDocumentNameLength)] |
|||
public string NavigationDocumentName { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxVersionNameLength)] |
|||
public string MinimumVersion { get; set; } |
|||
|
|||
public string MainWebsiteUrl { get; set; } |
|||
|
|||
[StringLength(ProjectConsts.MaxLatestVersionBranchNameLength)] |
|||
public string LatestVersionBranchName { get; set; } |
|||
} |
|||
|
|||
public class EditGithubProjectViewModel : EditProjectViewModelBase |
|||
{ |
|||
[DisplayOrder(10001)] |
|||
[Required] |
|||
[StringLength(256)] |
|||
public string GitHubRootUrl { get; set; } |
|||
|
|||
|
|||
[DisplayOrder(10001)] |
|||
[StringLength(512)] |
|||
public string GitHubAccessToken { get; set; } |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
@page |
|||
@using Microsoft.AspNetCore.Authorization |
|||
@using Volo.Docs.Admin |
|||
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage |
|||
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.IndexModel |
|||
@inject IAuthorizationService Authorization |
|||
@{ |
|||
ViewBag.PageTitle = "Projects"; |
|||
} |
|||
|
|||
@section scripts { |
|||
<abp-script src="/Pages/Docs/Admin/Projects/index.js" /> |
|||
<abp-script src="/Pages/Docs/Admin/Projects/create.js" /> |
|||
<abp-script src="/Pages/Docs/Admin/Projects/edit.js" /> |
|||
} |
|||
|
|||
<abp-card> |
|||
<abp-card-header> |
|||
<abp-row> |
|||
<abp-column size-md="_6"> |
|||
<h2>@L["Projects"]</h2> |
|||
</abp-column> |
|||
<abp-column size-md="_6" class="text-right"> |
|||
@if (await Authorization.IsGrantedAsync(DocsAdminPermissions.Projects.Create)) |
|||
{ |
|||
<abp-dropdown> |
|||
<abp-dropdown-button button-type="Primary" icon="plus" text="@L["CreateANewProject"].Value"/> |
|||
<abp-dropdown-menu align="Right"> |
|||
<abp-dropdown-item href="#" id="CreateNewGithubProjectButtonId">Github</abp-dropdown-item> |
|||
</abp-dropdown-menu> |
|||
</abp-dropdown> |
|||
} |
|||
</abp-column> |
|||
</abp-row> |
|||
</abp-card-header> |
|||
<abp-card-body> |
|||
<abp-table striped-rows="true" id="ProjectsTable" class="nowrap"> |
|||
<thead> |
|||
<tr> |
|||
<th>@L["Actions"]</th> |
|||
<th>@L["Name"]</th> |
|||
<th>@L["ShortName"]</th> |
|||
<th>@L["DocumentStoreType"]</th> |
|||
<th>@L["Format"]</th> |
|||
</tr> |
|||
</thead> |
|||
</abp-table> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects |
|||
{ |
|||
public class IndexModel : AbpPageModel |
|||
{ |
|||
public void OnGet() |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
var abp = abp || {}; |
|||
$(function () { |
|||
abp.modals.projectCreate = function () { |
|||
var initModal = function (publicApi, args) { |
|||
var $form = publicApi.getForm(); |
|||
|
|||
|
|||
}; |
|||
|
|||
return { |
|||
initModal: initModal |
|||
} |
|||
}; |
|||
}); |
|||
@ -0,0 +1,14 @@ |
|||
var abp = abp || {}; |
|||
$(function () { |
|||
abp.modals.projectEdit = function () { |
|||
var initModal = function (publicApi, args) { |
|||
var $form = publicApi.getForm(); |
|||
|
|||
|
|||
}; |
|||
|
|||
return { |
|||
initModal: initModal |
|||
} |
|||
}; |
|||
}); |
|||
@ -0,0 +1,98 @@ |
|||
$(function () { |
|||
|
|||
var l = abp.localization.getResource('Docs'); |
|||
|
|||
var _createModal = new abp.ModalManager({ |
|||
viewUrl: abp.appPath + 'Docs/Admin/Projects/Create', |
|||
modalClass: 'projectCreate' |
|||
}); |
|||
|
|||
var _editModal = new abp.ModalManager({ |
|||
viewUrl: abp.appPath + 'Docs/Admin/Projects/Edit', |
|||
modalClass: 'projectEdit' |
|||
}); |
|||
|
|||
|
|||
var _dataTable = $('#ProjectsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
|||
processing: true, |
|||
serverSide: true, |
|||
paging: true, |
|||
searching: false, |
|||
autoWidth: false, |
|||
scrollCollapse: true, |
|||
order: [[2, "desc"]], |
|||
ajax: abp.libs.datatables.createAjax(volo.docs.admin.projectsAdmin.getList), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: |
|||
[ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: function () { |
|||
return true; //TODO: Check permission
|
|||
}, |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
Id: data.record.id |
|||
}); |
|||
} |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: function () { |
|||
return true; //TODO: Check permission
|
|||
}, |
|||
confirmMessage: function (data) { return l('ProjectDeletionWarningMessage') }, |
|||
action: function (data) { |
|||
volo.docs.admin.projectsAdmin |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
} |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
{ |
|||
target: 1, |
|||
data: "name" |
|||
}, |
|||
{ |
|||
target: 2, |
|||
data: "shortName" |
|||
}, |
|||
{ |
|||
target: 3, |
|||
data: "documentStoreType" |
|||
}, |
|||
{ |
|||
target: 4, |
|||
data: "format", |
|||
render: function (data) { |
|||
if (data === 'md') { |
|||
return 'markdown'; |
|||
} |
|||
|
|||
return data; |
|||
} |
|||
} |
|||
] |
|||
})); |
|||
|
|||
|
|||
$("#CreateNewGithubProjectButtonId").click(function (event) { |
|||
event.preventDefault(); |
|||
_createModal.open({source:"GitHub"}); |
|||
}); |
|||
|
|||
_createModal.onClose(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
}); |
|||
Loading…
Reference in new issue