-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No more calling PHP code from LfMerge (#173)
This PR finally implements the updateCustomFieldViews logic in LfMerge, as part of the SetCustomFieldConfig method in MongoConnection (which is where the logic belongs anyway). This will allow us to move the lfmerge package into its own container in Language Forge, instead of having it so tightly coupled to the PHP container.
- Loading branch information
Showing
15 changed files
with
132 additions
and
281 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
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
86 changes: 0 additions & 86 deletions
86
src/LfMerge.Core.Tests/LanguageForge/Infrastructure/LanguageForgeProxyTests.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
63 changes: 63 additions & 0 deletions
63
src/LfMerge.Core/LanguageForge/Config/LfRoleOrUserViewConfig.cs
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,63 @@ | ||
using System.Collections.Generic; | ||
using MongoDB.Bson; | ||
|
||
namespace LfMerge.Core.LanguageForge.Config | ||
{ | ||
public class LexRoleOrUserViewConfig | ||
{ | ||
public string[] InputSystems; | ||
public Dictionary<string,LexViewFieldConfig> Fields; | ||
public Dictionary<string,bool> ShowTasks; | ||
} | ||
|
||
public class LexViewFieldConfig | ||
{ | ||
public bool Show; | ||
public string Type; | ||
|
||
public LexViewFieldConfig(string type, bool show = true) | ||
{ | ||
Show = show; | ||
Type = type; | ||
} | ||
public LexViewFieldConfig(bool show = true) : this("basic", show) {} | ||
} | ||
|
||
public class LexViewMultiTextFieldConfig: LexViewFieldConfig | ||
{ | ||
public bool OverrideInputSystems; | ||
public string[] InputSystems; | ||
|
||
public LexViewMultiTextFieldConfig(bool show = true) : base("multitext", show) | ||
{ | ||
this.OverrideInputSystems = false; | ||
this.InputSystems = new string[]{}; | ||
} | ||
} | ||
|
||
public static class LexViewFieldConfigFactory | ||
{ | ||
public static LexViewFieldConfig CreateByType(string lfCustomFieldType, bool show = true) { | ||
if (lfCustomFieldType == "MultiUnicode" || lfCustomFieldType == "MultiString" || lfCustomFieldType == "String") { | ||
return new LexViewMultiTextFieldConfig(show); | ||
} else { | ||
return new LexViewFieldConfig(show); | ||
} | ||
} | ||
|
||
public static BsonDocument CreateBsonDocumentByType(string lfCustomFieldType, bool show = true) { | ||
LexViewFieldConfig config = CreateByType(lfCustomFieldType, show); | ||
var result = new BsonDocument(); | ||
result.Set("show", new BsonBoolean(config.Show)); | ||
result.Set("type", new BsonString(config.Type)); | ||
var multiTextConfig = config as LexViewMultiTextFieldConfig; | ||
if (multiTextConfig != null) { | ||
result.Set("overrideInputSystems", new BsonBoolean(multiTextConfig.OverrideInputSystems)); | ||
if (multiTextConfig.InputSystems != null && multiTextConfig.InputSystems.Length > 0) { | ||
result.Set("inputSystems", new BsonArray(multiTextConfig.InputSystems)); | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
src/LfMerge.Core/LanguageForge/Infrastructure/ILanguageForgeProxy.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.