Resolve "Max display length for listing" #61
41
.idea/.idea.HopFrame/.idea/workspace.xml
generated
41
.idea/.idea.HopFrame/.idea/workspace.xml
generated
@@ -11,15 +11,7 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="Added a simple web api abstraction method">
|
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="Added maximum display length" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/PropertyConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/PropertyConfig.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/TableConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/TableConfig.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Services/ITableManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Services/ITableManager.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Services/Implementations/TableManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Services/Implementations/TableManager.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Components/Dialogs/HopFrameEditor.razor" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Components/Dialogs/HopFrameEditor.razor" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
@@ -38,7 +30,7 @@
|
|||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
<map>
|
<map>
|
||||||
<entry key="$PROJECT_DIR$" value="feature/api-abstraction" />
|
<entry key="$PROJECT_DIR$" value="feature/async-delegates" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
@@ -78,6 +70,7 @@
|
|||||||
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Core/Config/PropertyConfig.cs" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Core/Config/PropertyConfig.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Core/Config/PropertyConfig.cs" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Core/Config/PropertyConfig.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Web/Components/Dialogs/HopFrameEditor.razor" root0="SKIP_HIGHLIGHTING" root1="FORCE_HIGHLIGHTING" root2="FORCE_HIGHLIGHTING" />
|
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Web/Components/Dialogs/HopFrameEditor.razor" root0="SKIP_HIGHLIGHTING" root1="FORCE_HIGHLIGHTING" root2="FORCE_HIGHLIGHTING" />
|
||||||
|
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/tests/HopFrame.Tests.Core/Services/DisplayPropertyTests.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
</component>
|
</component>
|
||||||
<component name="KubernetesApiPersistence">{}</component>
|
<component name="KubernetesApiPersistence">{}</component>
|
||||||
<component name="KubernetesApiProvider">{
|
<component name="KubernetesApiProvider">{
|
||||||
@@ -106,7 +99,7 @@
|
|||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"b5f11219-dfc4-47a1-b02c-90ab603034fb.executor": "Debug",
|
"b5f11219-dfc4-47a1-b02c-90ab603034fb.executor": "Debug",
|
||||||
"dcdf1689-dc07-47e4-8824-2e60a4fbf301.executor": "Debug",
|
"dcdf1689-dc07-47e4-8824-2e60a4fbf301.executor": "Debug",
|
||||||
"git-widget-placeholder": "!22 on feature/async-delegates",
|
"git-widget-placeholder": "!23 on feature/max-length",
|
||||||
"list.type.of.created.stylesheet": "CSS",
|
"list.type.of.created.stylesheet": "CSS",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
@@ -211,7 +204,8 @@
|
|||||||
<workItem from="1737293153907" duration="8953000" />
|
<workItem from="1737293153907" duration="8953000" />
|
||||||
<workItem from="1737390240714" duration="60000" />
|
<workItem from="1737390240714" duration="60000" />
|
||||||
<workItem from="1737390360987" duration="601000" />
|
<workItem from="1737390360987" duration="601000" />
|
||||||
<workItem from="1737993570961" duration="3116000" />
|
<workItem from="1737993570961" duration="4163000" />
|
||||||
|
<workItem from="1738054766160" duration="741000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Added basic configuration">
|
<task id="LOCAL-00001" summary="Added basic configuration">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -405,7 +399,23 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1737995782424</updated>
|
<updated>1737995782424</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="25" />
|
<task id="LOCAL-00025" summary="Implemented async delegates">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1737997122807</created>
|
||||||
|
<option name="number" value="00025" />
|
||||||
|
<option name="presentableId" value="LOCAL-00025" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1737997122807</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00026" summary="Added maximum display length">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1738055497527</created>
|
||||||
|
<option name="number" value="00026" />
|
||||||
|
<option name="presentableId" value="LOCAL-00026" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1738055497527</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="27" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -456,7 +466,6 @@
|
|||||||
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||||
<MESSAGE value="Added basic configuration" />
|
|
||||||
<MESSAGE value="Added admin page navigation" />
|
<MESSAGE value="Added admin page navigation" />
|
||||||
<MESSAGE value="Added database loading logic" />
|
<MESSAGE value="Added database loading logic" />
|
||||||
<MESSAGE value="Started working on listing page" />
|
<MESSAGE value="Started working on listing page" />
|
||||||
@@ -480,6 +489,8 @@
|
|||||||
<MESSAGE value="Included readme file in projects" />
|
<MESSAGE value="Included readme file in projects" />
|
||||||
<MESSAGE value="Added missing files" />
|
<MESSAGE value="Added missing files" />
|
||||||
<MESSAGE value="Added a simple web api abstraction method" />
|
<MESSAGE value="Added a simple web api abstraction method" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Added a simple web api abstraction method" />
|
<MESSAGE value="Implemented async delegates" />
|
||||||
|
<MESSAGE value="Added maximum display length" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Added maximum display length" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -25,6 +25,7 @@ public class PropertyConfig(PropertyInfo info, TableConfig table, int nthPropert
|
|||||||
public bool IsEnumerable { get; internal set; }
|
public bool IsEnumerable { get; internal set; }
|
||||||
public bool IsListingProperty { get; set; }
|
public bool IsListingProperty { get; set; }
|
||||||
public int Order { get; set; } = nthProperty;
|
public int Order { get; set; } = nthProperty;
|
||||||
|
public int DisplayLength { get; set; } = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -190,4 +191,13 @@ public class PropertyConfigurator<TProp>(PropertyConfig config) {
|
|||||||
InnerConfig.Order = index;
|
InnerConfig.Order = index;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the maximum character length displayed in the admin ui (not in the editor dialog)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="maxLength">The maximum length of characters to be displayed</param>
|
||||||
|
public PropertyConfigurator<TProp> SetDisplayLength(int maxLength) {
|
||||||
|
InnerConfig.DisplayLength = maxLength;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
@foreach (var property in _config!.Properties.Where(prop => prop.List).OrderBy(prop => prop.Order)) {
|
@foreach (var property in _config!.Properties.Where(prop => prop.List).OrderBy(prop => prop.Order)) {
|
||||||
<PropertyColumn
|
<PropertyColumn
|
||||||
Title="@property.Name" Property="o => _manager!.DisplayProperty(o, property, null).Result"
|
Title="@property.Name" Property="o => DisplayProperty(property, o).Result"
|
||||||
Style="min-width: max-content; height: 44px;"
|
Style="min-width: max-content; height: 44px;"
|
||||||
Sortable="@property.Sortable"/>
|
Sortable="@property.Sortable"/>
|
||||||
}
|
}
|
||||||
@@ -283,4 +283,13 @@
|
|||||||
|
|
||||||
_allSelected = selected;
|
_allSelected = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<string> DisplayProperty(PropertyConfig config, object entry) {
|
||||||
|
var display = await _manager!.DisplayProperty(entry, config);
|
||||||
|
|
||||||
|
if (display.Length > config.DisplayLength)
|
||||||
|
display = display.Substring(0, config.DisplayLength) + "...";
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,7 @@ builder.Services.AddHopFrame(options => {
|
|||||||
|
|
||||||
context.Table<Post>()
|
context.Table<Post>()
|
||||||
.Property(p => p.Content)
|
.Property(p => p.Content)
|
||||||
|
.SetDisplayLength(100)
|
||||||
.IsTextArea(true)
|
.IsTextArea(true)
|
||||||
/*.Validator(input => {
|
/*.Validator(input => {
|
||||||
var errors = new List<string>();
|
var errors = new List<string>();
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ public class HopFrameTablePageTests : TestContext {
|
|||||||
var tableManagerMock = new Mock<ITableManager>();
|
var tableManagerMock = new Mock<ITableManager>();
|
||||||
var items = new List<object> { new MyTable(), new MyTable() };
|
var items = new List<object> { new MyTable(), new MyTable() };
|
||||||
tableManagerMock.Setup(m => m.LoadPage(It.IsAny<int>(), It.IsAny<int>())).Returns(items.AsAsyncQueryable());
|
tableManagerMock.Setup(m => m.LoadPage(It.IsAny<int>(), It.IsAny<int>())).Returns(items.AsAsyncQueryable());
|
||||||
|
tableManagerMock.Setup(t => t.DisplayProperty(It.IsAny<object>(), It.IsAny<PropertyConfig>(), null))
|
||||||
|
.ReturnsAsync(string.Empty);
|
||||||
|
|
||||||
contextExplorerMock.Setup(e => e.GetTable("Table1")).Returns(tableConfig);
|
contextExplorerMock.Setup(e => e.GetTable("Table1")).Returns(tableConfig);
|
||||||
contextExplorerMock.Setup(e => e.GetTableManager("Table1")).Returns(tableManagerMock.Object);
|
contextExplorerMock.Setup(e => e.GetTableManager("Table1")).Returns(tableManagerMock.Object);
|
||||||
|
|||||||
Reference in New Issue
Block a user