performance optimization to limit the number of HtmlText content versions
This commit is contained in:
@@ -31,8 +31,8 @@
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>@SharedLocalizer["CreatedOn"]</th>
|
||||
<th>@SharedLocalizer["CreatedBy"]</th>
|
||||
<th>@Localizer["CreatedOn"]</th>
|
||||
<th>@Localizer["CreatedBy"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="View" Security="SecurityAccessLevel.Edit" OnClick="@(async () => await View(context))" ResourceKey="View" /></td>
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1 align-items-center">
|
||||
<Label Class="col-sm-3" For="versions" ResourceKey="Versions" ResourceType="@resourceType" HelpText="The number of content versions to preserve (note that zero means unlimited)">Versions: </Label>
|
||||
<div class="col-sm-9">
|
||||
<input id="versions" type="number" min="0" max="9" step="1" class="form-control" @bind="@_versions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -26,12 +32,14 @@
|
||||
private bool validated = false;
|
||||
|
||||
private string _dynamictokens;
|
||||
private string _versions = "5";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
try
|
||||
{
|
||||
_dynamictokens = SettingService.GetSetting(ModuleState.Settings, "DynamicTokens", "false");
|
||||
_versions = SettingService.GetSetting(ModuleState.Settings, "Versions", "3");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -45,6 +53,10 @@
|
||||
{
|
||||
var settings = await SettingService.GetModuleSettingsAsync(ModuleState.ModuleId);
|
||||
settings = SettingService.SetSetting(settings, "DynamicTokens", _dynamictokens);
|
||||
if (int.TryParse(_versions, out int versions) && versions >= 0 && versions <= 9)
|
||||
{
|
||||
settings = SettingService.SetSetting(settings, "Versions", versions.ToString());
|
||||
}
|
||||
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -123,4 +123,10 @@
|
||||
<data name="DynamicTokens.Text" xml:space="preserve">
|
||||
<value>Dynamic Tokens?</value>
|
||||
</data>
|
||||
<data name="Versions.HelpText" xml:space="preserve">
|
||||
<value>The number of content versions to preserve (note that zero means unlimited)</value>
|
||||
</data>
|
||||
<data name="Versions.Text" xml:space="preserve">
|
||||
<value>Versions:</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user