-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
・カスタムアプリ機能を追加。 ・CodeDefinerにパラメータファイルをマージする機能を追加。 ・死活監視のエンドポイントを追加。 ・サーバスクリプトのHttpClientにResponseHeadersプロパティを追加。 ・SAML認証時に認証Cookieを保存しないオプションを追加。 ・サイトトップからの移動を禁止/許可するオプションを追加。 ・通知機能で変更内容をDiffMatchPatchで表示するモードを追加。 ・一覧画面からレコードを別タブで開く機能を追加。 ・添付ファイル項目でファイル名の左側のアイコンをクリックした際にファイルが別タブで開くように変更。 ・CodeDefinerでデータベースの更新時にコマンドタイムアウトでエラーになる問題を解消。 ・サーバスクリプトのitem.Getで添付ファイルの情報が取得できない問題を解消。 ・ログイン失敗時のシステムログのステータスが正しく記録されない問題を解消。 ・特定の条件下でパンくずリスト左側のリンクコピーボタンが機能しない問題を解消。 ・新UIで「状況」項目のスタイル指定が正しく反映されない問題を解消。 ・新UIの画面レイアウトを調整。
- Loading branch information
Showing
96 changed files
with
6,825 additions
and
8,419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using JsonDiffPatchDotNet; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Implem.CodeDefiner.Functions.Patch | ||
{ | ||
internal class PatchParameters | ||
{ | ||
public static void ApplyToPatch(string patchSourcePath, string parameterDir, string newVersion, string currentVersion) | ||
{ | ||
var patchDir = new DirectoryInfo(patchSourcePath); | ||
DirectoryInfo[] dirs = patchDir.GetDirectories(); | ||
var targetDir = dirs | ||
.OrderBy(o => o.Name) | ||
.SkipWhile(o => o.Name != currentVersion); | ||
var jdp = new JsonDiffPatch(); | ||
foreach (var dir in targetDir) | ||
{ | ||
if (currentVersion == dir.Name) | ||
{ | ||
continue; | ||
} | ||
foreach (var file in Directory.GetFiles(parameterDir, "*.*", SearchOption.AllDirectories)) | ||
{ | ||
var fileName = Path.GetFileName(file); | ||
string fileContent = null; | ||
foreach (var patch in Directory.GetFiles(dir.FullName, "*.*", SearchOption.AllDirectories)) | ||
{ | ||
var patchName = Path.GetFileName(patch); | ||
if (fileName == patchName) | ||
{ | ||
if (fileContent == null) | ||
{ | ||
fileContent = File.ReadAllText(file); | ||
} | ||
var patchContent = File.ReadAllText(patch); | ||
var fileContentToken = JToken.Parse(fileContent); | ||
var patchContentToken = JToken.Parse(patchContent); | ||
fileContent = SerializeWithIndent(jdp.Patch(fileContentToken, patchContentToken)); | ||
} | ||
} | ||
if (fileContent != null) | ||
{ | ||
File.WriteAllText(file, fileContent); | ||
} | ||
} | ||
if (newVersion == dir.Name) | ||
{ | ||
var newVersionObj = new System.Version(newVersion); | ||
Console.WriteLine("Patch application was successful." + newVersionObj); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public static string SerializeWithIndent(object obj, int indent = 4) | ||
{ | ||
var sb = new StringBuilder(); | ||
using (var writer = new System.IO.StringWriter(sb)) | ||
using (var jsonWriter = new JsonTextWriter(writer) | ||
{ | ||
Formatting = Formatting.Indented, | ||
Indentation = indent, | ||
}) | ||
{ | ||
new JsonSerializer().Serialize(jsonWriter, obj); | ||
} | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,179 @@ | ||
using Implem.IRds; | ||
using CsvHelper; | ||
using Implem.CodeDefiner.Functions.Rds.Parts; | ||
using Implem.DefinitionAccessor; | ||
using Implem.IRds; | ||
using Implem.Libraries.Classes; | ||
using Implem.Libraries.Utilities; | ||
using Npgsql; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data.SqlClient; | ||
using System.Linq; | ||
|
||
namespace Implem.CodeDefiner.Functions.Rds | ||
{ | ||
internal class Configurator | ||
{ | ||
internal static void Configure(ISqlObjectFactory factory) | ||
internal static bool Configure(ISqlObjectFactory factory, bool force, bool noInput) | ||
{ | ||
try | ||
if (Environments.RdsProvider == "Local") | ||
{ | ||
UsersConfigurator.KillTask(factory: factory); | ||
RdsConfigurator.Configure(factory: factory); | ||
UsersConfigurator.Configure(factory: factory); | ||
SchemaConfigurator.Configure(factory: factory); | ||
} | ||
if (CheckColumnsShrinkage( | ||
factory: factory, | ||
force: force, | ||
noInput: noInput)) | ||
{ | ||
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") | ||
{ | ||
PrivilegeConfigurator.Configure(factory: factory); | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
private static bool CheckColumnsShrinkage( | ||
ISqlObjectFactory factory, | ||
bool force = false, | ||
bool noInput = false) | ||
{ | ||
OutputLicenseInfo(); | ||
var defIssuesColumns = ExtractColumnsFromColumnDefinitionCollection("Issues"); | ||
var defResultsColumns = ExtractColumnsFromColumnDefinitionCollection("Results"); | ||
var currentIssuesColumns = GetCurrentColumns( | ||
factory: factory, | ||
tableName: "Issues"); | ||
var currentResultsColumns = GetCurrentColumns( | ||
factory: factory, | ||
tableName: "Results"); | ||
var issuesShrinked = HasColumnsChanges( | ||
defColumns: defIssuesColumns, | ||
currentColumns: currentIssuesColumns, | ||
tableName: "Issues"); | ||
var resultsShrinked = HasColumnsChanges( | ||
defColumns: defResultsColumns, | ||
currentColumns: currentResultsColumns, | ||
tableName: "Results"); | ||
if ((issuesShrinked || resultsShrinked) && !force) | ||
{ | ||
Consoles.Write( | ||
text: DisplayAccessor.Displays.Get("CodeDefinerErrorColumnsShrinked"), | ||
type: Consoles.Types.Error); | ||
return false; | ||
} | ||
if (noInput) | ||
{ | ||
Consoles.Write( | ||
text: DisplayAccessor.Displays.Get("CodeDefinerSkipUserInput"), | ||
type: Consoles.Types.Info); | ||
return true; | ||
} | ||
catch (System.Data.SqlClient.SqlException e) | ||
Console.WriteLine(DisplayAccessor.Displays.Get("CodeDefinerInputYesOrNo")); | ||
var inputKey = Console.ReadLine().ToLower(); | ||
if (inputKey != "y" && inputKey != "yes") | ||
{ | ||
Consoles.Write($"[{e.Number}] {e.Message}", Consoles.Types.Error, true); | ||
Consoles.Write( | ||
text: DisplayAccessor.Displays.Get("CodeDefinerRdsCanceled"), | ||
type: Consoles.Types.Error); | ||
return false; | ||
} | ||
catch (System.Exception e) | ||
return true; | ||
} | ||
|
||
private static List<string> ExtractColumnsFromColumnDefinitionCollection(string tableName) | ||
{ | ||
return Def.ColumnDefinitionCollection | ||
.Where(o => o.TableName == tableName) | ||
.Select(o => o["ColumnName"].ToString()) | ||
.ToList(); | ||
} | ||
|
||
private static List<string> GetCurrentColumns(ISqlObjectFactory factory, string tableName) | ||
{ | ||
return Columns | ||
.Get(factory: factory, sourceTableName: tableName) | ||
.Select(o => o["ColumnName"].ToString()) | ||
.ToList(); | ||
} | ||
|
||
private static void OutputLicenseInfo() | ||
{ | ||
string serverName = string.Empty; | ||
string database = string.Empty; | ||
switch (Parameters.Rds.Dbms) | ||
{ | ||
case "SQLServer": | ||
serverName = new SqlConnectionStringBuilder(Parameters.Rds.SaConnectionString).DataSource; | ||
database = new SqlConnectionStringBuilder(Parameters.Rds.SaConnectionString).InitialCatalog; | ||
break; | ||
case "PostgreSQL": | ||
serverName = new NpgsqlConnectionStringBuilder(Parameters.Rds.SaConnectionString).Host; | ||
database = new NpgsqlConnectionStringBuilder(Parameters.Rds.SaConnectionString).Database; | ||
break; | ||
default: | ||
serverName = new SqlConnectionStringBuilder(Parameters.Rds.SaConnectionString).DataSource; | ||
database = new SqlConnectionStringBuilder(Parameters.Rds.SaConnectionString).InitialCatalog; | ||
break; | ||
} | ||
Consoles.Write( | ||
string.Format( | ||
DisplayAccessor.Displays.Get("CodeDefinerLicenseInfo"), | ||
serverName, | ||
database, | ||
Parameters.LicenseDeadline().ToString("d"), | ||
Parameters.Licensee() ?? String.Empty, | ||
Parameters.LicensedUsers()), | ||
Consoles.Types.Info); | ||
if (Parameters.LicenseDeadline() == DateTime.MinValue | ||
&& Parameters.Licensee().IsNullOrEmpty() | ||
&& Parameters.LicensedUsers() == 0) | ||
{ | ||
Consoles.Write( | ||
DisplayAccessor.Displays.Get("CodeDefinerCommunityEdition"), | ||
Consoles.Types.Info); | ||
return; | ||
} | ||
if (Parameters.LicenseDeadline() < DateTime.Now) | ||
{ | ||
Consoles.Write( | ||
DisplayAccessor.Displays.Get("CodeDefinerIssueNewLicense"), | ||
Consoles.Types.Info); | ||
return; | ||
} | ||
if (Parameters.CommercialLicense()) | ||
{ | ||
Consoles.Write( | ||
DisplayAccessor.Displays.Get("CodeDefinerEnterpriseEdition"), | ||
Consoles.Types.Info); | ||
return; | ||
} | ||
} | ||
|
||
private static bool HasColumnsChanges( | ||
List<string> defColumns, | ||
List<string> currentColumns, | ||
string tableName) | ||
{ | ||
var reducedColumns = currentColumns | ||
.Where(column => !defColumns.Contains(column)) | ||
.ToList(); | ||
if (reducedColumns.Any()) | ||
{ | ||
Consoles.Write(e.ToString(), Consoles.Types.Error, true); | ||
Consoles.Write( | ||
string.Format( | ||
DisplayAccessor.Displays.Get("CodeDefinerReducedColumnList"), | ||
tableName), | ||
Consoles.Types.Info); | ||
reducedColumns.ForEach(column => { Console.WriteLine(column); }); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Implem.CodeDefiner.Settings | ||
{ | ||
internal class DefaultParameters | ||
{ | ||
public readonly string InstallDirForWindows = "C:\\web\\pleasanter"; | ||
public readonly string InstallDirForLinux = "/web/pleasanter"; | ||
public readonly string PatchZipPathForWindows = "C:\\web\\pleasanter\\ParametersPatch.zip"; | ||
public readonly string PatchZIpPathForLinux = "/web/pleasanter/ParametersPatch.zip"; | ||
} | ||
} |
Oops, something went wrong.