Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c79d8d6
Merge pull request #532 from TechnologyEnhancedLearning/Develop/Featu…
AnjuJose011 Aug 15, 2024
b6dacef
modelversionupdate
AnjuJose011 Aug 15, 2024
1ad238d
Merge pull request #534 from TechnologyEnhancedLearning/modelversionu…
AnjuJose011 Aug 15, 2024
21b1bc0
Merge pull request #560 from TechnologyEnhancedLearning/RC
AnjuJose011 Sep 2, 2024
cad0d84
modelversionupdate
AnjuJose011 Sep 2, 2024
1559d2d
Merge pull request #562 from TechnologyEnhancedLearning/ModelVersionU…
AnjuJose011 Sep 2, 2024
fee6969
Update LearningHub.Nhs.Database.sqlproj
AnjuJose011 Sep 2, 2024
342c848
Merge pull request #563 from TechnologyEnhancedLearning/AnjuJose011-p…
AnjuJose011 Sep 2, 2024
1c63739
Merge pull request #561 from TechnologyEnhancedLearning/releases/LHAr…
AnjuJose011 Sep 2, 2024
f51b9eb
removed open api changes
AnjuJose011 Sep 2, 2024
dfb98ff
Merge pull request #564 from TechnologyEnhancedLearning/Removed-OpenA…
AnjuJose011 Sep 2, 2024
600aae9
TD-4037: Fixed Empty search error issue.
ArunimaGeorge Sep 3, 2024
9978f20
TD-4692: Fixed Issue not showing the 'elfh' logo & 'Developed with el…
ArunimaGeorge Sep 5, 2024
d0fbf8d
Merge pull request #570 from TechnologyEnhancedLearning/Develop/Fixes…
ArunimaGeorge Sep 5, 2024
0d59475
TD-4693 cache fix
OluwatobiAwe Sep 5, 2024
2dc1c94
Merge pull request #571 from TechnologyEnhancedLearning/Develop/Fixes…
OluwatobiAwe Sep 5, 2024
caa4157
TD-4038: Fixed AllCatalogue pagination issue
ArunimaGeorge Sep 6, 2024
2dec991
Merge pull request #574 from TechnologyEnhancedLearning/Develop/Fixes…
ArunimaGeorge Sep 6, 2024
79220b0
TD-4703: Fixed unknown error occuring during pagination
ArunimaGeorge Sep 10, 2024
405778a
TD-4038: Implemented search bar in AllCatalogue search results page
ArunimaGeorge Sep 10, 2024
b12edae
Merge pull request #577 from TechnologyEnhancedLearning/Develop/Fixes…
ArunimaGeorge Sep 10, 2024
b3f0436
Merge pull request #578 from TechnologyEnhancedLearning/Develop/Fixes…
ArunimaGeorge Sep 11, 2024
4ac9c16
TD-4038: Message updated for empty search in AllCatalogues and main s…
ArunimaGeorge Sep 12, 2024
666871b
Merge pull request #580 from TechnologyEnhancedLearning/Develop/Fixes…
ArunimaGeorge Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Controllers/UserGroupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public async Task<IActionResult> AddUsersToUserGroup(int userGroupId, string use
var vr = await this.userGroupService.AddUsersToUserGroup(userGroupId, userIdList);
if (vr.IsValid)
{
this.ClearUserCachedPermissions(userIdList);
return this.Json(new
{
success = true,
Expand Down Expand Up @@ -527,5 +528,16 @@ public async Task<IActionResult> UserGroupCatalogues(int id)

return this.PartialView("_UserGroupCatalogues", catalogues);
}

private void ClearUserCachedPermissions(string userIdList)
{
if (!string.IsNullOrWhiteSpace(userIdList))
{
foreach (var userId in userIdList.Split(","))
{
_ = Task.Run(async () => { await this.userService.ClearUserCachedPermissions(int.Parse(userId)); });
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
<PackageReference Include="IdentityModel" Version="4.4.0" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.33" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.38" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
Expand Down
5 changes: 5 additions & 0 deletions LearningHub.Nhs.WebUI/Configuration/FindwiseSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ public class FindwiseSettings
/// Gets or sets the CatalogueSearchPageSize.
/// </summary>
public int CatalogueSearchPageSize { get; set; }

/// <summary>
/// Gets or sets the AllCatalogueSearchPageSize.
/// </summary>
public int AllCatalogueSearchPageSize { get; set; }
}
}
5 changes: 5 additions & 0 deletions LearningHub.Nhs.WebUI/Configuration/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,10 @@ public Settings()
/// Gets or sets the MediaKindSettings.
/// </summary>
public MediaKindSettings MediaKindSettings { get; set; } = new MediaKindSettings();

/// <summary>
/// Gets or sets AllCataloguePageSize.
/// </summary>
public int AllCataloguePageSize { get; set; }
}
}
66 changes: 66 additions & 0 deletions LearningHub.Nhs.WebUI/Controllers/CatalogueController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public async Task<IActionResult> Index(int pageIndex = 1, string term = null)
BookmarkId = t.BookmarkId,
NodeId = int.Parse(t.Id),
BadgeUrl = t.BadgeUrl,
Providers = t.Providers,
}).ToList();
}
else
Expand Down Expand Up @@ -551,5 +552,70 @@ public async Task<IActionResult> RequestPreviewAccess(CatalogueRequestAccessView
return this.View("RequestPreviewAccess", viewModel);
}
}

/// <summary>
/// Get all catelogues, filter and pagination based on alphabets.
/// </summary>
/// <param name="filterChar">filterChar.</param>
/// <returns>rk.</returns>
[Route("/allcatalogue")]
[Route("/allcatalogue/{filterChar}")]
public async Task<IActionResult> GetAllCatalogue(string filterChar = "a")
{
var pageSize = this.settings.AllCataloguePageSize;
var catalogues = await this.catalogueService.GetAllCatalogueAsync(filterChar, pageSize);
return this.View("allcatalogue", catalogues);
}

/// <summary>
/// AllCatalogues Search.
/// </summary>
/// <param name="pageIndex">pageIndex.</param>
/// <param name="term">Search term.</param>
/// <returns>IActionResult.</returns>
[Route("/allcataloguesearch")]
public async Task<IActionResult> GetAllCatalogueSearch(int pageIndex = 1, string term = null)
{
var catalogues = new AllCatalogueSearchResponseViewModel();
var searchString = term?.Trim() ?? string.Empty;
var allCatalogueSearchPageSize = this.settings.FindwiseSettings.AllCatalogueSearchPageSize;

if (!string.IsNullOrWhiteSpace(term))
{
var termCatalogues = await this.searchService.GetAllCatalogueSearchResultAsync(
new AllCatalogueSearchRequestModel
{
SearchText = searchString,
PageIndex = pageIndex - 1,
PageSize = allCatalogueSearchPageSize,
});

catalogues.TotalCount = termCatalogues.TotalHits;
catalogues.Catalogues = termCatalogues.DocumentModel.Select(t => new AllCatalogueViewModel
{
Url = t.Url,
Name = t.Name,
CardImageUrl = t.CardImageUrl,
BannerUrl = t.BannerUrl,
Description = t.Description,
RestrictedAccess = t.RestrictedAccess,
HasAccess = t.HasAccess,
IsBookmarked = t.IsBookmarked,
BookmarkId = t.BookmarkId,
NodeId = int.Parse(t.Id),
BadgeUrl = t.BadgeUrl,
Providers = t.Providers,
}).ToList();
}
else
{
catalogues.TotalCount = 0;
catalogues.Catalogues = new List<AllCatalogueViewModel>();
}

this.ViewBag.PageIndex = pageIndex;
this.ViewBag.PageSize = allCatalogueSearchPageSize;
return this.View("AllCatalogueSearch", catalogues);
}
}
}
8 changes: 8 additions & 0 deletions LearningHub.Nhs.WebUI/Interfaces/ICatalogueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,13 @@ public interface ICatalogueService
/// <param name="userUserGroupId">The user - user group id.</param>
/// <returns>The validation result.</returns>
Task<LearningHubValidationResult> RemoveUserFromRestrictedAccessUserGroup(int userUserGroupId);

/// <summary>
/// The GetAllCatalogueAsync.
/// </summary>
/// <param name="filterChar">The letter.</param>
/// <param name="pageSize">The pageSize.</param>
/// <returns>The allcatalogue result based on letters.</returns>
Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string filterChar, int pageSize);
}
}
7 changes: 7 additions & 0 deletions LearningHub.Nhs.WebUI/Interfaces/ISearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,12 @@ public interface ISearchService
/// <param name="catalogueSearchRequestModel">catalogue search request model.</param>
/// <returns>The <see cref="Task"/>.</returns>
Task<int> CreateCatalogueSearchTermEventAsync(CatalogueSearchRequestModel catalogueSearchRequestModel);

/// <summary>
/// Get AllCatalogue Search Result Async.
/// </summary>
/// <param name="catalogueSearchRequestModel">The catalogue Search Request Model.</param>
/// <returns>The <see cref="Task{SearchAllCatalogueViewModel}"/>.</returns>
Task<SearchAllCatalogueViewModel> GetAllCatalogueSearchResultAsync(AllCatalogueSearchRequestModel catalogueSearchRequestModel);
}
}
2 changes: 1 addition & 1 deletion LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<PackageReference Include="HtmlAgilityPack" Version="1.11.38" />
<PackageReference Include="IdentityModel" Version="4.3.0" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.0" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.33" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.38" />
<PackageReference Include="linqtotwitter" Version="6.9.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
<PackageReference Include="Microsoft.ApplicationInsights.EventCounterCollector" Version="2.21.0" />
Expand Down
5 changes: 5 additions & 0 deletions LearningHub.Nhs.WebUI/Models/NavigationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@ public class NavigationModel
/// Gets or sets a value indicating whether to show my account.
/// </summary>
public bool ShowMyAccount { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to show Browse Catalogues.
/// </summary>
public bool ShowBrowseCatalogues { get; set; }
}
}
28 changes: 28 additions & 0 deletions LearningHub.Nhs.WebUI/Services/CatalogueService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,5 +602,33 @@ public async Task<LearningHubValidationResult> RemoveUserFromRestrictedAccessUse

return apiResponse.ValidationResult;
}

/// <summary>
/// GetAllCatalogueAsync.
/// </summary>
/// <param name="filterChar">The filterChar.</param>
/// <param name="pageSize">the pageSize.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
public async Task<AllCatalogueResponseViewModel> GetAllCatalogueAsync(string filterChar, int pageSize)
{
AllCatalogueResponseViewModel viewmodel = new AllCatalogueResponseViewModel { };
var client = await this.LearningHubHttpClient.GetClientAsync();

var request = $"catalogue/allcatalogues/{pageSize}/{filterChar}";
var response = await client.GetAsync(request).ConfigureAwait(false);

if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
viewmodel = JsonConvert.DeserializeObject<AllCatalogueResponseViewModel>(result);
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized ||
response.StatusCode == System.Net.HttpStatusCode.Forbidden)
{
throw new Exception("AccessDenied");
}

return viewmodel;
}
}
}
7 changes: 7 additions & 0 deletions LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public NavigationModel NotAuthenticated()
ShowRegister = false,
ShowSignOut = false,
ShowMyAccount = false,
ShowBrowseCatalogues = false,
};
}

Expand All @@ -104,6 +105,7 @@ private NavigationModel AuthenticatedAdministrator(string controllerName)
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = true,
ShowBrowseCatalogues = true,
};
}

Expand All @@ -128,6 +130,7 @@ private NavigationModel AuthenticatedBlueUser(string controllerName)
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = true,
ShowBrowseCatalogues = true,
};
}

Expand All @@ -151,6 +154,7 @@ private NavigationModel AuthenticatedGuest()
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = false,
ShowBrowseCatalogues = false,
};
}

Expand All @@ -175,6 +179,7 @@ private async Task<NavigationModel> AuthenticatedReadOnly(string controllerName)
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = false,
ShowBrowseCatalogues = true,
};
}

Expand All @@ -198,6 +203,7 @@ private async Task<NavigationModel> AuthenticatedBasicUserOnly()
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = true,
ShowBrowseCatalogues = true,
};
}

Expand All @@ -221,6 +227,7 @@ private NavigationModel InLoginWizard()
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = false,
ShowBrowseCatalogues = false,
};
}
}
Expand Down
47 changes: 47 additions & 0 deletions LearningHub.Nhs.WebUI/Services/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,53 @@ public async Task<int> CreateCatalogueSearchTermEventAsync(CatalogueSearchReques
}
}

/// <summary>
/// GetAllCatalogueSearchResultAsync.
/// </summary>
/// <param name="catalogueSearchRequestModel">catalogueSearchRequestModel.</param>
/// <returns>The <see cref="Task"/>.</returns>
public async Task<SearchAllCatalogueViewModel> GetAllCatalogueSearchResultAsync(AllCatalogueSearchRequestModel catalogueSearchRequestModel)
{
SearchAllCatalogueViewModel searchViewModel = new SearchAllCatalogueViewModel();

try
{
var client = await this.LearningHubHttpClient.GetClientAsync();

catalogueSearchRequestModel.SearchText = this.DecodeProblemCharacters(catalogueSearchRequestModel.SearchText);

var json = JsonConvert.SerializeObject(catalogueSearchRequestModel);
var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");

var request = $"Search/GetAllCatalogueSearchResult";
var response = await client.PostAsync(request, stringContent).ConfigureAwait(false);

if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
searchViewModel = JsonConvert.DeserializeObject<SearchAllCatalogueViewModel>(result);

if (searchViewModel.DocumentModel != null
&& searchViewModel.DocumentModel.Count != 0)
{
searchViewModel.DocumentModel.ForEach(x => x.Description = this.RemoveHtmlTags(x.Description));
}
}
else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.Forbidden)
{
throw new Exception("AccessDenied");
}

return searchViewModel;
}
catch (Exception ex)
{
searchViewModel.ErrorOnAPI = true;
this.Logger.LogError(string.Format("Error occurred in GetAllCatalogueSearchResultAsync: {0}", ex.Message));
return searchViewModel;
}
}

/// <summary>
/// The RemoveHtmlTags.
/// </summary>
Expand Down
13 changes: 12 additions & 1 deletion LearningHub.Nhs.WebUI/Styles/nhsuk/pages/catalogue.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,15 @@ textarea {
font-weight: 700;
line-height: 24px;
word-wrap: break-word
}
}
.allCatalogue-lettercard {
background: $nhsuk-blue !important;
padding: 12px 8px;
margin-left: 16px;
width: 52px;
height: 56px;
display: flex;
align-items: center;
justify-content: center;
color: $nhsuk-white !important;
}
Loading
Loading