Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
fixes #144
Browse files Browse the repository at this point in the history
  • Loading branch information
valdisiljuconoks committed Mar 5, 2024
1 parent 91197df commit b4d1dec
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>8.0.0</Version>
<PackageVersion>8.0.0</PackageVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<FileVersion>8.0.0.0</FileVersion>
<Version>8.0.1</Version>
<Nullable>enable</Nullable>
<PackageVersion>8.0.1</PackageVersion>
<AssemblyVersion>8.0.1.0</AssemblyVersion>
<FileVersion>8.0.1.0</FileVersion>
<Authors>Valdis Iljuconoks, https://tech-fellow.net</Authors>
<Company>Valdis Iljuconoks, https://tech-fellow.net</Company>
<Product>DbLocalizationProvider</Product>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>8.0.0</Version>
<PackageVersion>8.0.0</PackageVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<FileVersion>8.0.0.0</FileVersion>
<Version>8.0.1</Version>
<Nullable>enable</Nullable>
<PackageVersion>8.0.1</PackageVersion>
<AssemblyVersion>8.0.1.0</AssemblyVersion>
<FileVersion>8.0.1.0</FileVersion>
<Authors>Valdis Iljuconoks, https://tech-fellow.net</Authors>
<Company>Valdis Iljuconoks, https://tech-fellow.net</Company>
<Product>DbLocalizationProvider</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
box-sizing: border-box;
border-color: #A9A9A9;
border-width: 1px;
padding: 2px;
}
textarea::placeholder {
Expand Down Expand Up @@ -543,8 +544,8 @@
<importmodal v-if="model.showImportModal" @@cancel="model.showImportModal=false" @@close="model.showImportModal = false; loadData();" :model="model.filemodel"></importmodal>

<div class="d-flex flex-row justify-content-end mb-4">
<div class="form-group offset-lg-9 col-lg-3 ma-4">
<input type="text" class="form-control" id="search-input" v-model="model.searchKeyword" placeholder="@(UiContext.Value.EnableDbSearch ? LocalizationProvider.GetStringWithInvariantFallback(() => Resources.SearchPlaceholderDbSearchEnabled) : LocalizationProvider.GetStringWithInvariantFallback(() => Resources.SearchPlaceholder))" />
<div class="form-group offset-lg-9 col-lg-4 ma-4">
<input type="text" class="form-control" id="search-input" v-model="model.searchKeyword" placeholder="@(UiContext.Value.EnableDbSearch ? LocalizationProvider.GetStringWithInvariantFallback(() => Resources.SearchPlaceholderDbSearchEnabled) : LocalizationProvider.GetStringWithInvariantFallback(() => Resources.SearchPlaceholder))" />
</div>
</div>

Expand Down Expand Up @@ -590,6 +591,12 @@
</tr>
</table>
<div v-if="model.loading" class="resources-table--loading">@LocalizationProvider.GetStringWithInvariantFallback(() => Resources.Loading)</div>
@if (UiContext.Value.EnableDbSearch)
{
<div class="d-flex justify-content-center" v-if="!model.searchKeyword">
<button type="button" class="btn btn-light" id="loadAll" @@click="loadAll" aria-expanded="false">@LocalizationProvider.GetStringWithInvariantFallback(() => Resources.LoadAll)</button>
</div>
}
</div>
</div>

Expand Down Expand Up @@ -803,6 +810,10 @@
}).catch(function(error) { alert('error retrieving resources: ' + error); });
},
loadAll() {
this.model.searchKeyword = '*';
},
edit(resource, lang) {
this.model.currentResource = {
titleKey: resource.titleKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
box-sizing: border-box;
border-color: #A9A9A9;
border-width: 1px;
padding: 2px;
}
textarea::placeholder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>8.0.0</Version>
<PackageVersion>8.0.0</PackageVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<FileVersion>8.0.0.0</FileVersion>
<Nullable>enable</Nullable>
<Version>8.0.1</Version>
<PackageVersion>8.0.1</PackageVersion>
<AssemblyVersion>8.0.1.0</AssemblyVersion>
<FileVersion>8.0.1.0</FileVersion>
<Authors>Valdis Iljuconoks, https://tech-fellow.net</Authors>
<Company>Valdis Iljuconoks, https://tech-fellow.net</Company>
<Product>DbLocalizationProvider</Product>
Expand Down Expand Up @@ -69,7 +70,7 @@
</Target>

<ItemGroup>
<None Include="..\\..\\README.md" Pack="true" PackagePath="\"/>
<None Include="..\\..\\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
Expand Down
1 change: 1 addition & 0 deletions src/DbLocalizationProvider.AdminUI.AspNetCore/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ public class Resources
public static string ImportOperationLabel = "Operation";
public static string Close = "Close";
public static string Loading = "Loading data...";
public static string LoadAll = "Load All Resources";
}
31 changes: 20 additions & 11 deletions src/DbLocalizationProvider.AdminUI.AspNetCore/ServiceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,17 @@ private LocalizationResourceApiModel PrepareViewModel(string keyword)
{
if (!string.IsNullOrEmpty(keyword))
{
resources = GetResources()
.Where(r => r.ResourceKey.Contains(keyword, StringComparison.InvariantCultureIgnoreCase))
.Take(_config.Value.PageSize)
.ToList();
if (keyword.Equals("*", StringComparison.OrdinalIgnoreCase))
{
resources = GetResources();
}
else
{
resources = GetResources()
.Where(r => r.ResourceKey.Contains(keyword, StringComparison.InvariantCultureIgnoreCase))
.Take(_config.Value.PageSize)
.ToList();
}
}
}
else
Expand All @@ -191,7 +198,7 @@ private LocalizationResourceApiModel PrepareViewModel(string keyword)
return result;
}

private IEnumerable<AvailableLanguage> GetVisibleLanguages(IEnumerable<AvailableLanguage> availableLanguages)
private IEnumerable<AvailableLanguage>? GetVisibleLanguages(IEnumerable<AvailableLanguage> availableLanguages)
{
var cookie = Request.Cookies["LocalizationProvider_VisibleLanguages"];
if (string.IsNullOrEmpty(cookie))
Expand All @@ -214,12 +221,14 @@ private LocalizationResourceApiTreeModel PrepareTreeViewModel()

var visibleLanguages = GetVisibleLanguages(languages);

var result = new LocalizationResourceApiTreeModel(resources,
languages,
visibleLanguages ?? languages,
_config.Value.MaxResourceKeyPopupTitleLength,
_config.Value.MaxResourceKeyDisplayLength,
BuildOptions());
var result = new LocalizationResourceApiTreeModel(
resources,
languages,
visibleLanguages ?? languages,
_config.Value.MaxResourceKeyPopupTitleLength,
_config.Value.MaxResourceKeyDisplayLength,
BuildOptions(),
_configurationContext.Value.EnableLegacyMode());

return result;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>8.0.0</Version>
<PackageVersion>8.0.0</PackageVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<FileVersion>8.0.0.0</FileVersion>
<Version>8.0.1</Version>
<Nullable>enable</Nullable>
<PackageVersion>8.0.1</PackageVersion>
<AssemblyVersion>8.0.1.0</AssemblyVersion>
<FileVersion>8.0.1.0</FileVersion>
<Authors>Valdis Iljuconoks, https://tech-fellow.net</Authors>
<Company>Valdis Iljuconoks, https://tech-fellow.net</Company>
<Product>DbLocalizationProvider</Product>
Expand Down

0 comments on commit b4d1dec

Please sign in to comment.