Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sources and updates design update #690

Merged
merged 20 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
da593ba
Create and update existing models for new source list layout
nwarms Jan 6, 2025
5a3f979
Update source list UI to match new designs
nwarms Jan 6, 2025
f344190
Update TrustAreaModel for updated SourceList per Page model
nwarms Jan 6, 2025
c2004b5
Update page models and get methods to populate the data source lists
nwarms Jan 6, 2025
fbfaba2
Update existing tests to work with the new source lists
nwarms Jan 6, 2025
c3bdce3
Update CHANGELOG
nwarms Jan 6, 2025
294a23f
Move methods to string extensions
nwarms Jan 7, 2025
8363af5
Rename test to clear up confusion
nwarms Jan 7, 2025
7b1b7b0
Replace instances of hard coded strings with constants
nwarms Jan 8, 2025
c64f558
Reuse the kebabify function instead of the replace whitespaces
nwarms Jan 8, 2025
6fea524
Consolidate `RemovePunctuation` and `Kebabify` methods
dynamictulip Jan 9, 2025
b651641
Update contacts datasource selectors
dynamictulip Jan 15, 2025
dcc3fd0
Fix "Category of concern" data source
dynamictulip Jan 15, 2025
e34eabc
Enhance contacts data source assertions
dynamictulip Jan 16, 2025
dd0c900
Fix method name typo
dynamictulip Jan 16, 2025
db35f9b
Test that datasource component is not on non-trust pages
dynamictulip Jan 16, 2025
773e22e
Add custom command to expand a details element
dynamictulip Jan 16, 2025
759925c
Actually expand datasource section and check it is open in contacts test
dynamictulip Jan 16, 2025
6816e65
Add datasource tests for trust pages (except academies page)
dynamictulip Jan 16, 2025
05f0abd
Move trustpage data into a new test data store
dynamictulip Jan 17, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix Privacy page having incorrect width
- Update name of cookie consent cookie to be consistent with application name and what is displayed in the Cookie UI
- Switched to using the MIS tables to the MIS_MSTR tables
- Updated the design of the source and updates panel

## [Release-18][release-18] (production-2024-12-19.4567)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ public static partial class StringExtensions
[GeneratedRegex("-+", RegexOptions.Compiled)]
private static partial Regex DashesRegex();

[GeneratedRegex(@"[^-\w]|_+", RegexOptions.Compiled)]
private static partial Regex NonDashPunctuationRegex();

public static string Kebabify(this string text)
{
var transformedText = text.Trim();

transformedText = BracketedDigitsRegex().Replace(transformedText, "-");
transformedText = SpacesRegex().Replace(transformedText, "-");
transformedText = NonDashPunctuationRegex().Replace(transformedText, "");
transformedText = DashesRegex().Replace(transformedText, "-");

transformedText = transformedText.Trim('-');
Expand All @@ -31,7 +35,7 @@ public static string Kebabify(this string text)
public static string ToTitleCase(this string text)
{
var textInfo = CultureInfo.CurrentCulture.TextInfo;

if (string.IsNullOrWhiteSpace(text)) return string.Empty;

return textInfo.ToTitleCase(textInfo.ToLower(text));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
using DfE.FindInformationAcademiesTrusts.Services.Trust;
Expand All @@ -14,10 +15,35 @@ public abstract class AcademiesPageModel(
IDateTimeProvider dateTimeProvider
) : TrustsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { PageName = "Academies" };
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { PageName = ViewConstants.AcademiesPageName };

protected IExportService ExportService { get; } = exportService;
public IDateTimeProvider DateTimeProvider { get; } = dateTimeProvider;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();
if (pageResult is NotFoundResult) return pageResult;

var giasDataSource = await DataSourceService.GetAsync(Source.Gias);
var eesDataSource = await DataSourceService.GetAsync(Source.ExploreEducationStatistics);

DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.AcademiesDetailsPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.AcademiesPupilNumbersPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.AcademiesFreeSchoolMealsPageName, [
new DataSourceListEntry(giasDataSource, "Pupils eligible for free school meals"),
new DataSourceListEntry(eesDataSource, "Local authority average 2023/24"),
new DataSourceListEntry(eesDataSource, "National average 2023/24")
])
]);

return pageResult;
}

public virtual async Task<IActionResult> OnGetExportAsync(string uid)
{
var trustSummary = await TrustService.GetTrustSummaryAsync(uid);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.Academy;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
Expand All @@ -19,20 +18,19 @@ public class AcademiesDetailsModel(
: AcademiesPageModel(dataSourceService, trustService, exportService, logger,
dateTimeProvider)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { TabName = "Details" };
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { TabName = ViewConstants.AcademiesDetailsPageName };

public AcademyDetailsServiceModel[] Academies { get; set; } = default!;
public IOtherServicesLinkBuilder LinkBuilder { get; } = linkBuilder;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();

if (pageResult.GetType() == typeof(NotFoundResult)) return pageResult;
if (pageResult is NotFoundResult) return pageResult;

Academies = await academyService.GetAcademiesInTrustDetailsAsync(Uid);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias), ["Details"]));

return pageResult;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.Academy;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
Expand All @@ -18,23 +17,17 @@ public class FreeSchoolMealsModel(
: AcademiesPageModel(dataSourceService, trustService, exportService, logger, dateTimeProvider)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { TabName = "Free school meals" };
base.TrustPageMetadata with { TabName = ViewConstants.AcademiesFreeSchoolMealsPageName };

public AcademyFreeSchoolMealsServiceModel[] Academies { get; set; } = default!;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();

if (pageResult.GetType() == typeof(NotFoundResult)) return pageResult;
if (pageResult is NotFoundResult) return pageResult;

Academies = await academyService.GetAcademiesInTrustFreeSchoolMealsAsync(Uid);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias),
["Pupils eligible for free school meals"]));

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.ExploreEducationStatistics),
["Local authority average 2023/24", "National average 2023/24"]));

return pageResult;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.Academy;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
Expand All @@ -17,19 +16,20 @@ public class PupilNumbersModel(
IDateTimeProvider dateTimeProvider)
: AcademiesPageModel(dataSourceService, trustService, exportService, logger, dateTimeProvider)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { TabName = "Pupil numbers" };
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with
{
TabName = ViewConstants.AcademiesPupilNumbersPageName
};

public AcademyPupilNumbersServiceModel[] Academies { get; set; } = default!;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();

if (pageResult.GetType() == typeof(NotFoundResult)) return pageResult;
if (pageResult is NotFoundResult) return pageResult;

Academies = await academyService.GetAcademiesInTrustPupilNumbersAsync(Uid);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias), ["Pupil numbers"]));

return pageResult;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
Contents
</h2>
<ul class="govuk-tabs__list">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf("Details")">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf(ViewConstants.AcademiesDetailsPageName)">
<a id="academies-details-link" class="govuk-tabs__tab" asp-page="./Details" asp-route-uid="@Model.TrustSummary.Uid">
<span class="govuk-visually-hidden">Academies </span>Details
</a>
</li>
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf("Pupil numbers")">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf(ViewConstants.AcademiesPupilNumbersPageName)">
<a id="academies-pupil-numbers-link" class="govuk-tabs__tab" asp-page="./PupilNumbers" asp-route-uid="@Model.TrustSummary.Uid">
<span class="govuk-visually-hidden">Academies </span>Pupil numbers
</a>
</li>
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf("Free school meals")">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf(ViewConstants.AcademiesFreeSchoolMealsPageName)">
<a id="free-school-meals-link" class="govuk-tabs__tab" asp-page="./FreeSchoolMeals" asp-route-uid="@Model.TrustSummary.Uid">
<span class="govuk-visually-hidden">Academies </span>Free school meals
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ ILogger<ContactsAreaModel> logger
)
: TrustsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { PageName = "Contacts" };
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { PageName = ViewConstants.ContactsPageName };

public Person? ChairOfTrustees { get; set; }
public Person? AccountingOfficer { get; set; }
public Person? ChiefFinancialOfficer { get; set; }
Expand All @@ -29,32 +31,40 @@ public override async Task<IActionResult> OnGetAsync()

SubNavigationLinks =
[
new TrustSubNavigationLinkModel("In DfE", "./InDfE", Uid, TrustPageMetadata.PageName!, this is InDfeModel),
new TrustSubNavigationLinkModel(ViewConstants.ContactsInDfePageName, "./InDfE", Uid,
TrustPageMetadata.PageName!, this is InDfeModel),
new TrustSubNavigationLinkModel("In the trust", "./InTrust", Uid, TrustPageMetadata.PageName!,
this is InTrustModel)
];

(TrustRelationshipManager, SfsoLead, AccountingOfficer, ChairOfTrustees, ChiefFinancialOfficer) =
await TrustService.GetTrustContactsAsync(Uid);

DataSources.Add(new DataSourceListEntry(
new DataSourceServiceModel(Source.FiatDb, TrustRelationshipManager?.LastModifiedAtTime, null,
TrustRelationshipManager?.LastModifiedByEmail),
new List<string>
{ ContactRole.TrustRelationshipManager.MapRoleToViewString() }));

DataSources.Add(new DataSourceListEntry(
new DataSourceServiceModel(Source.FiatDb, SfsoLead?.LastModifiedAtTime, null,
SfsoLead?.LastModifiedByEmail),
new List<string>
{ ContactRole.SfsoLead.MapRoleToViewString() }));

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias), new List<string>
{ "Accounting officer name", "Chief financial officer name", "Chair of trustees name" }));
// Add data sources
var giasDataSource = await DataSourceService.GetAsync(Source.Gias);
var mstrDataSource = await DataSourceService.GetAsync(Source.Mstr);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Mstr),
new List<string>
{ "Accounting officer email", "Chief financial officer email", "Chair of trustees email" }));
DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.ContactsInDfePageName, [
new DataSourceListEntry(new DataSourceServiceModel(Source.FiatDb,
TrustRelationshipManager?.LastModifiedAtTime, null,
TrustRelationshipManager?.LastModifiedByEmail),
ContactRole.TrustRelationshipManager.MapRoleToViewString()),
new DataSourceListEntry(new DataSourceServiceModel(Source.FiatDb, SfsoLead?.LastModifiedAtTime,
null,
SfsoLead?.LastModifiedByEmail), ContactRole.SfsoLead.MapRoleToViewString())
]
),
new DataSourcePageListEntry("In the trust", [
new DataSourceListEntry(giasDataSource, "Accounting officer name"),
new DataSourceListEntry(giasDataSource, "Chief financial officer name"),
new DataSourceListEntry(giasDataSource, "Chair of trustees name"),
new DataSourceListEntry(mstrDataSource, "Accounting officer email"),
new DataSourceListEntry(mstrDataSource, "Chief financial officer email"),
new DataSourceListEntry(mstrDataSource, "Chair of trustees email")
]
)
]);

return pageResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class EditContactModel(
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with
{
SubPageName = $"Edit {role.MapRoleToViewString()} details",
PageName = "Contacts"
PageName = ViewConstants.ContactsPageName
};

public const string NameField = "Name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class InDfeModel(
: ContactsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "In DfE" };
base.TrustPageMetadata with { SubPageName = ViewConstants.ContactsInDfePageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GovernanceAreaModel(
: TrustsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { PageName = "Governance" };
base.TrustPageMetadata with { PageName = ViewConstants.GovernancePageName };

public TrustGovernanceServiceModel TrustGovernance { get; set; } = default!;

Expand All @@ -26,18 +26,35 @@ public override async Task<IActionResult> OnGetAsync()

SubNavigationLinks =
[
new TrustSubNavigationLinkModel($"Trust leadership ({TrustGovernance.CurrentTrustLeadership.Length})",
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceTrustLeadershipPageName} ({TrustGovernance.CurrentTrustLeadership.Length})",
"./TrustLeadership", Uid, TrustPageMetadata.PageName!, this is TrustLeadershipModel),
new TrustSubNavigationLinkModel($"Trustees ({TrustGovernance.CurrentTrustees.Length})", "./Trustees", Uid,
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceTrusteesPageName} ({TrustGovernance.CurrentTrustees.Length})", "./Trustees",
Uid,
TrustPageMetadata.PageName!, this is TrusteesModel),
new TrustSubNavigationLinkModel($"Members ({TrustGovernance.CurrentMembers.Length})", "./Members", Uid,
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceMembersPageName} ({TrustGovernance.CurrentMembers.Length})", "./Members",
Uid,
TrustPageMetadata.PageName!, this is MembersModel),
new TrustSubNavigationLinkModel($"Historic members ({TrustGovernance.HistoricMembers.Length})",
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceHistoricMembersPageName} ({TrustGovernance.HistoricMembers.Length})",
"./HistoricMembers", Uid, TrustPageMetadata.PageName!, this is HistoricMembersModel)
];

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias),
new List<string> { "Governance" }));
// Add data sources
var giasDataSource = await DataSourceService.GetAsync(Source.Gias);

DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.GovernanceTrustLeadershipPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.GovernanceTrusteesPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.GovernanceMembersPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.GovernanceHistoricMembersPageName,
[new DataSourceListEntry(giasDataSource)])
]);

return pageResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class HistoricMembersModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Historic members" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceHistoricMembersPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class MembersModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Members" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceMembersPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class TrustLeadershipModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Trust leadership" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceTrustLeadershipPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class TrusteesModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Trustees" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceTrusteesPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface ITrustsAreaModel
{
TrustSummaryServiceModel TrustSummary { get; }

List<DataSourceListEntry> DataSources { get; }
List<DataSourcePageListEntry> DataSourcesPerPage { get; }

TrustPageMetadata TrustPageMetadata { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public class CurrentRatingsModel(
academyService, exportService, dateTimeProvider, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Current ratings" };
base.TrustPageMetadata with { SubPageName = ViewConstants.OfstedCurrentRatingsPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public class ImportantDatesModel(
academyService, exportService, dateTimeProvider, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Important dates" };
base.TrustPageMetadata with { SubPageName = ViewConstants.OfstedImportantDatesPageName };
}
Loading
Loading