Skip to content

Commit

Permalink
Added new features / Bug fixed
Browse files Browse the repository at this point in the history
・ダッシュボード機能の追加。
・PostgreSQL15対応。
・ユーザ数が多い環境でパフォーマンスが悪化する問題を解消。
・Service.jsonのAbsoluteUriを設定している場合、PdfPulginHostに渡されるURLが正しく設定されない問題を解消。
・レスポンシブ表示での画面下に出る"お知らせ"の表示が更新ボタンなどと重なってしまう問題を解消。
・日本語、英語以外の言語を選択している場合にサイトの新規作成画面が正しく表示されない問題を解消。
・Authentication.jsonでSAMLのAttributes設定でMailAddressにnullを設定するとエラーとなる問題を解消。
・新規作成画面で複数選択可能の分類項目が自動ポストバックされた場合にJSON.parseが失敗する問題を解消。
  • Loading branch information
pierre3 committed Jul 28, 2023
1 parent 6b341fb commit b36ef80
Show file tree
Hide file tree
Showing 390 changed files with 21,211 additions and 6,628 deletions.
2 changes: 2 additions & 0 deletions Implem.CodeDefiner/Functions/Rds/Configurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ internal static void Configure(ISqlObjectFactory factory)
{
if (Environments.RdsProvider == "Local")
{
UsersConfigurator.KillTask(factory: factory);
RdsConfigurator.Configure(factory: factory);
UsersConfigurator.Configure(factory: factory);
SchemaConfigurator.Configure(factory: factory);
}
TablesConfigurator.Configure(factory: factory);
if (Environments.RdsProvider == "Local")
Expand Down
4 changes: 3 additions & 1 deletion Implem.CodeDefiner/Functions/Rds/Parts/Columns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ internal static EnumerableRowCollection<DataRow> Get(ISqlObjectFactory factory,
{
return Def.SqlIoByAdmin(factory: factory).ExecuteTable(
factory: factory,
commandText: Def.Sql.Columns.Replace("#TableName#", sourceTableName))
commandText: Def.Sql.Columns
.Replace("#TableName#", sourceTableName)
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName))
.AsEnumerable();
}

Expand Down
4 changes: 3 additions & 1 deletion Implem.CodeDefiner/Functions/Rds/Parts/Tables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ internal static bool Exists(ISqlObjectFactory factory, string sourceTableName)
{
return Def.SqlIoByAdmin(factory: factory).ExecuteTable(
factory: factory,
commandText: Def.Sql.ExistsTable.Replace("#TableName#", sourceTableName))
commandText: Def.Sql.ExistsTable
.Replace("#TableName#", sourceTableName)
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName))
.Rows.Count == 1;
}

Expand Down
17 changes: 9 additions & 8 deletions Implem.CodeDefiner/Functions/Rds/PrivilegeConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,31 @@ private static void Execute(ISqlObjectFactory factory, string connectionString)
factory: factory,
dbTransaction: null,
dbConnection: null,
commandText:
Def.Sql.GrantPrivilegeAdmin
commandText: Def.Sql.GrantPrivilegeAdmin
.Replace("#Uid#", cn["uid"])
.Replace("#ServiceName#", Environments.ServiceName));
.Replace("#ServiceName#", Environments.ServiceName)
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName));
}
else
{
Def.SqlIoByAdmin(factory).ExecuteNonQuery(
factory: factory,
dbTransaction: null,
dbConnection: null,
commandText:
Def.Sql.GrantPrivilegeUser
commandText: Def.Sql.GrantPrivilegeUser
.Replace("#Uid#", cn["uid"])
.Replace("#ServiceName#", Environments.ServiceName));
.Replace("#ServiceName#", Environments.ServiceName)
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName));
}
}

private static string CommandText(string uid)
private static string CommandText(ISqlObjectFactory factory, string uid)
{
return (uid.EndsWith("_Owner")
? Def.Sql.GrantPrivilegeAdmin.Replace("#Uid#", uid)
: Def.Sql.GrantPrivilegeUser.Replace("#Uid#", uid))
.Replace("#ServiceName#", Environments.ServiceName);
.Replace("#ServiceName#", Environments.ServiceName)
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName);
}
}
}
36 changes: 34 additions & 2 deletions Implem.CodeDefiner/Functions/Rds/RdsConfigurator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Implem.DefinitionAccessor;
using Implem.IRds;
using Implem.Libraries.Classes;
using Implem.Libraries.Utilities;
namespace Implem.CodeDefiner.Functions.Rds
{
Expand All @@ -16,19 +17,50 @@ internal static void Configure(ISqlObjectFactory factory)
private static void CreateDatabase(ISqlObjectFactory factory, string databaseName)
{
Consoles.Write(Environments.ServiceName, Consoles.Types.Info);
var ocn = new TextData(Parameters.Rds.OwnerConnectionString, ';', '=');
var ucn = new TextData(Parameters.Rds.UserConnectionString, ';', '=');
Def.SqlIoBySa(factory).ExecuteNonQuery(
factory: factory,
dbTransaction: null,
dbConnection: null,
commandText: Def.Sql.CreateDatabase.Replace("#InitialCatalog#", databaseName));
commandText: Def.Sql.CreateDatabase
.Replace("#InitialCatalog#", databaseName));
Def.SqlIoBySa(factory).ExecuteNonQuery(
factory: factory,
dbTransaction: null,
dbConnection: null,
commandText: Def.Sql.CreateUserForPostgres
.Replace("#Uid_Owner#", ocn["uid"])
.Replace("#Pwd_Owner#", ocn["pwd"])
.Replace("#Uid_User#", ucn["uid"])
.Replace("#Pwd_User#", ucn["pwd"])
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName));
Def.SqlIoBySa(factory).ExecuteNonQuery(
factory: factory,
dbTransaction: null,
dbConnection: null,
commandText: Def.Sql.CreateDatabaseForPostgres
.Replace("#InitialCatalog#", databaseName)
.Replace("#Uid_Owner#", ocn["uid"]));
}

private static bool Exists(ISqlObjectFactory factory, string databaseName)
{
return Def.SqlIoBySa(factory).ExecuteTable(
var isExists = Def.SqlIoBySa(factory).ExecuteTable(
factory: factory,
commandText: Def.Sql.ExistsDatabase.Replace("#InitialCatalog#", databaseName))
.Rows.Count == 1;
var schemaName = isExists == false
? databaseName
: (Def.SqlIoByAdmin(factory).ExecuteTable(
factory: factory,
commandText: Def.Sql.ExistsSchema.Replace("#SchemaName#", databaseName))
.Rows.Count == 1)
? databaseName
: "public";
factory.SqlDefinitionSetting.SchemaName = schemaName;
if (!isExists) factory.SqlDefinitionSetting.IsCreatingDb = true;
return isExists;
}
}
}
27 changes: 27 additions & 0 deletions Implem.CodeDefiner/Functions/Rds/SchemaConfigurator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Implem.DefinitionAccessor;
using Implem.IRds;
using Implem.Libraries.Classes;
using Implem.Libraries.Utilities;
namespace Implem.CodeDefiner.Functions.Rds
{
internal static class SchemaConfigurator
{
internal static void Configure(ISqlObjectFactory factory)
{
Consoles.Write(factory.SqlDefinitionSetting.SchemaName, Consoles.Types.Info);
if (factory.SqlDefinitionSetting.IsCreatingDb)
{
var ocn = new TextData(Parameters.Rds.OwnerConnectionString, ';', '=');
var ucn = new TextData(Parameters.Rds.UserConnectionString, ';', '=');
Def.SqlIoByAdmin(factory).ExecuteNonQuery(
factory: factory,
dbTransaction: null,
dbConnection: null,
commandText: Def.Sql.CreateSchema
.Replace("#Uid_Owner#", ocn["uid"])
.Replace("#Uid_User#", ucn["uid"])
.Replace("#SchemaName#", factory.SqlDefinitionSetting.SchemaName));
}
}
}
}
17 changes: 16 additions & 1 deletion Implem.CodeDefiner/Functions/Rds/UsersConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ private static void Execute(ISqlObjectFactory factory, string connectionString)
{
var cn = new TextData(connectionString, ';', '=');
Consoles.Write(cn["uid"], Consoles.Types.Info);
Spids.Kill(factory: factory, uid: cn["uid"]);
if (Exists(factory: factory, uid: cn["uid"], sql: Def.Sql.ExistsUser))
{
Alter(factory: factory, uid: cn["uid"], sql: AlterLoginRoleCommandText(pwd: cn["pwd"]));
Expand Down Expand Up @@ -69,5 +68,21 @@ private static bool Exists(ISqlObjectFactory factory, string uid, string sql)
commandText: sql.Replace("#Uid#", uid).Replace("#ServiceName#", Environments.ServiceName))
.Rows.Count == 1;
}

internal static void KillTask(ISqlObjectFactory factory)
{
KillTask(
factory: factory,
connectionString: Parameters.Rds.OwnerConnectionString);
KillTask(
factory: factory,
connectionString: Parameters.Rds.UserConnectionString);
}

private static void KillTask(ISqlObjectFactory factory, string connectionString)
{
var cn = new TextData(connectionString, ';', '=');
Spids.Kill(factory: factory, uid: cn["uid"]);
}
}
}
6 changes: 3 additions & 3 deletions Implem.CodeDefiner/Implem.CodeDefiner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<TargetFramework>net6.0</TargetFramework>
<Copyright>Copyright © Implem Inc 2014 - 2023</Copyright>
<Description>This program does the automatic code creation and merging of existing code based on the definition. Also it will make the configuration change of sql server database.</Description>
<AssemblyVersion>1.3.43.0</AssemblyVersion>
<FileVersion>1.3.43.0</FileVersion>
<Version>1.3.43.0</Version>
<AssemblyVersion>1.3.44.0</AssemblyVersion>
<FileVersion>1.3.44.0</FileVersion>
<Version>1.3.44.0</Version>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions Implem.CodeDefiner/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"commandLineArgs": "def"
},
"WSL": {
"commandName": "WSL2",
"environmentVariables": {},
"distributionName": ""
"commandName": "WSL2",
"environmentVariables": {},
"distributionName": ""
},
"Docker": {
"commandName": "Docker",
Expand Down
Loading

0 comments on commit b36ef80

Please sign in to comment.