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

Perform release #385

Merged
merged 14 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/load-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
TF_VAR_cpd_search_index_name: ${{secrets.TF_VAR_CPD_SEARCH_INDEX_NAME}}
TF_VAR_cpd_search_recreate_index_on_rebuild: ${{secrets.TF_VAR_CPD_SEARCH_RECREATE_INDEX_ON_REBUILD}}
TF_VAR_cpd_gf_password: ${{secrets.TF_CPD_GF_PASSWORD}}
TF_VAR_cpd_gf_plugins: ${{secrets.TF_VAR_CPD_GF_PLUGINS}}
TF_VAR_vcs_tag: ${{github.event.release.tag_name}}
TF_WORKSPACE: Load-Test
SITE_URL: https://20.107.65.156/
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/terraform-destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
TF_VAR_cpd_search_index_name: ${{secrets.TF_VAR_CPD_SEARCH_INDEX_NAME}}
TF_VAR_cpd_search_recreate_index_on_rebuild: ${{secrets.TF_VAR_CPD_SEARCH_RECREATE_INDEX_ON_REBUILD}}
TF_VAR_cpd_gf_password: ${{secrets.TF_CPD_GF_PASSWORD}}
TF_VAR_cpd_gf_plugins: ${{secrets.TF_VAR_CPD_GF_PLUGINS}}
TF_VAR_vcs_tag: ${{github.event.release.tag_name}}
TF_WORKSPACE: ${{inputs.workspace}}

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
TF_VAR_cpd_search_index_name: ${{secrets.TF_VAR_CPD_SEARCH_INDEX_NAME}}
TF_VAR_cpd_search_recreate_index_on_rebuild: ${{secrets.TF_VAR_CPD_SEARCH_RECREATE_INDEX_ON_REBUILD}}
TF_VAR_cpd_gf_password: ${{secrets.TF_CPD_GF_PASSWORD}}
TF_VAR_cpd_gf_plugins: ${{secrets.TF_VAR_CPD_GF_PLUGINS}}
TF_VAR_vcs_tag: ${{github.event.release.tag_name}}
TF_WORKSPACE: ${{inputs.workspace}}

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
TF_VAR_cpd_search_index_name: ${{secrets.TF_VAR_CPD_SEARCH_INDEX_NAME}}
TF_VAR_cpd_search_recreate_index_on_rebuild: ${{secrets.TF_VAR_CPD_SEARCH_RECREATE_INDEX_ON_REBUILD}}
TF_VAR_cpd_gf_password: ${{secrets.TF_CPD_GF_PASSWORD}}
TF_VAR_cpd_gf_plugins: ${{secrets.TF_VAR_CPD_GF_PLUGINS}}
TF_VAR_vcs_tag: ${{github.event.release.tag_name}}
TF_WORKSPACE: ${{inputs.workspace}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Task<ResourceSearchResultsViewModel> GetSearchModel(SearchRequestModel qu
null,
string.Empty,
string.Empty,
SortOrder.MostRelevant));
SortOrder.Relevance));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static SearchResourcesResult GenerateSearchResults(int count, IDictionar
return new SearchResourcesResult(count, count, 1, 1, 1, searchResults);
}

[TestCase(SortOrder.MostRelevant, SortCategory.Relevancy, SortDirection.Descending)]
[TestCase(SortOrder.Relevance, SortCategory.Relevancy, SortDirection.Descending)]
[TestCase(SortOrder.UpdatedLatest, SortCategory.Updated, SortDirection.Descending)]
[TestCase(SortOrder.UpdatedOldest, SortCategory.Updated, SortDirection.Ascending)]
public async Task GetSearchModel_Converts_SortOrder(SortOrder sortOrder, SortCategory sortCategory, SortDirection sortDirection)
Expand Down Expand Up @@ -83,7 +83,7 @@ public async Task GetSearchModel_Passes_Term()
Term = "foo",
Tags = Array.Empty<string>(),
Page = 1,
SortOrder = SortOrder.MostRelevant
SortOrder = SortOrder.Relevance
};

// act
Expand All @@ -107,7 +107,7 @@ public async Task GetSearchModel_Model_Should_Receive_SearchResults()
Term = string.Empty,
Tags = Array.Empty<string>(),
Page = 1,
SortOrder = SortOrder.MostRelevant
SortOrder = SortOrder.Relevance
};

// act
Expand Down Expand Up @@ -136,7 +136,7 @@ public async Task GetSearchModel_Model_Should_Receive_PageContent()
Term = string.Empty,
Tags = Array.Empty<string>(),
Page = 1,
SortOrder = SortOrder.MostRelevant
SortOrder = SortOrder.Relevance
};

// act
Expand All @@ -160,7 +160,7 @@ public async Task GetSearchModel_Model_Should_Receive_SearchTerm()
Term = term,
Tags = Array.Empty<string>(),
Page = 1,
SortOrder = SortOrder.MostRelevant
SortOrder = SortOrder.Relevance
};

// act
Expand Down Expand Up @@ -196,7 +196,7 @@ public async Task GetSearchModel_Model_Should_Receive_SortOrder()

[TestCase(SortOrder.UpdatedLatest, "/foo?q=foo")]
[TestCase(SortOrder.UpdatedOldest, "/foo?q=foo&so=1")]
[TestCase(SortOrder.MostRelevant, "/foo?q=foo&so=2")]
[TestCase(SortOrder.Relevance, "/foo?q=foo&so=2")]
public async Task GetSearchModel_Model_Should_Receive_ClearFiltersUri(SortOrder sortOrder, string expected)
{
// arrange
Expand Down Expand Up @@ -248,7 +248,7 @@ public async Task GetSearchModel_Model_Should_Receive_ClearFiltersUri_That_Has_B

[TestCase(SortOrder.UpdatedLatest, "/foo?p={0}&q=foo")]
[TestCase(SortOrder.UpdatedOldest, "/foo?p={0}&so=1&q=foo")]
[TestCase(SortOrder.MostRelevant, "/foo?p={0}&so=2&q=foo")]
[TestCase(SortOrder.Relevance, "/foo?p={0}&so=2&q=foo")]
public async Task GetSearchModel_Model_Should_Receive_PagingFormatString(SortOrder sortOrder, string expected)
{
// arrange
Expand Down Expand Up @@ -358,7 +358,7 @@ public async Task GetSearchModel_Truncates_Search_Term()
Term = new string('x', 300),
Tags = Array.Empty<string>(),
Page = 1,
SortOrder = SortOrder.MostRelevant
SortOrder = SortOrder.Relevance
};

// act
Expand All @@ -382,7 +382,7 @@ public async Task GetSearchModel_Handles_Null_Term()
Term = null,
Tags = Array.Empty<string>(),
Page = 1,
SortOrder = SortOrder.MostRelevant
SortOrder = SortOrder.Relevance
};

// act
Expand Down
17 changes: 17 additions & 0 deletions Childrens-Social-Care-CPD-Tests/Services/SearchServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,23 @@ public async Task SearchResourcesAsync_Uses_Simple_Query_Parser()
options.QueryType.Should().Be(SearchQueryType.Simple);
}

[TestCase("Title")]
[TestCase("Body")]
public async Task SearchResourcesAsync_Searches_Field(string fieldName)
{
// arrange
SearchOptions options = null;
var query = new KeywordSearchQuery("foo");
var response = GenerateResponse();
_searchClient.SearchAsync<CpdDocument>(Arg.Any<string>(), Arg.Do<SearchOptions>(x => options = x)).Returns(response);

// act
await _sut.SearchResourcesAsync(query);

// assert
options.SearchFields.Should().Contain(fieldName);
}

[TestCase("foo*", "foo")]
[TestCase("foo* foo*", "foo foo")]
[TestCase("!£$foo%^&*()_+#'~@|\\-=", "foo")]
Expand Down
2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/Models/SearchRequestModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public enum SortOrder
{
UpdatedLatest,
UpdatedOldest,
MostRelevant,
Relevance,
}

public static class SearchRequestPropertyNames
Expand Down
2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/Search/SearchResultsVMFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private static KeywordSearchQuery GetQuery(SearchRequestModel request, IEnumerab

var sortCategory = sortOrder switch
{
SortOrder.MostRelevant => SortCategory.Relevancy,
SortOrder.Relevance => SortCategory.Relevancy,
_ => SortCategory.Updated,
};

Expand Down
1 change: 1 addition & 0 deletions Childrens-Social-Care-CPD/Services/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public Task<SearchResourcesResult> SearchResourcesAsync(KeywordSearchQuery query
QueryType = SearchQueryType.Simple,
SearchMode = SearchMode.Any,
IncludeTotalCount = true,
SearchFields = { "Title", "Body" },
HighlightFields = { "Body" },
Facets = { "Tags,count:100" },
Filter = string.IsNullOrEmpty(filter) ? null : filter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<select asp-for="SortOrder" class="js-order-results govuk-select sort-options__select" name="@SearchRequestPropertyNames.SortOrder" id="sortOrder" onchange="document.getElementById('searchForm').submit()">
<option value="0">Updated (newest)</option>
<option value="1">Updated (oldest)</option>
<option value="2">Most relevant</option>
<option value="2">Relevance</option>
</select>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions Childrens-Social-Care-CPD/Views/Shared/_ColumnLayout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

@foreach (var group in Model.Items.Select((e, i) => new { ContentItem = e, Grouping = (i / Model.ColumnCount) }).GroupBy(e => e.Grouping))
{
<div class="govuk-grid-row">
<div class="govuk-grid-row columns-layout">
@foreach (var item in group)
{
<div class="@gridClass govuk-!-margin-bottom-4" style="display: flex">
<div class="@gridClass govuk-!-margin-bottom-4 columns-layout-col">
@{ await Html.RenderContentfulPartialAsync(item.ContentItem); }
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private static void AddSearch(this IServiceCollection services)
public static void AddFeatures(this WebApplicationBuilder builder)
{
ArgumentNullException.ThrowIfNull(builder);
builder.Configuration.AddUserSecrets<Program>();

var applicationConfiguration = new ApplicationConfiguration(builder.Configuration);

Expand Down
9 changes: 9 additions & 0 deletions Childrens-Social-Care-CPD/styles/scss/overrides/_site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,13 @@
background-color: #ffdd00;
font-weight: bold;
font-style: normal;
}

.columns-layout {
display: flex;
flex-wrap: wrap;
}

.columns-layout-col {
display: flex;
}
9 changes: 9 additions & 0 deletions Childrens-Social-Care-CPD/wwwroot/css/application.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/wwwroot/css/application.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/wwwroot/css/application.min.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ No modules.
| <a name="input_cpd_delivery_key"></a> [cpd\_delivery\_key](#input\_cpd\_delivery\_key) | Contentful Delivery Key | `string` | n/a | yes |
| <a name="input_cpd_feature_polling_interval"></a> [cpd\_feature\_polling\_interval](#input\_cpd\_feature\_polling\_interval) | Feature polling interval | `number` | n/a | yes |
| <a name="input_cpd_gf_password"></a> [cpd\_gf\_password](#input\_cpd\_gf\_password) | Grafana password | `string` | n/a | yes |
| <a name="input_cpd_gf_plugins"></a> [cpd\_gf\_plugins](#input\_cpd\_gf\_plugins) | List of Grafana plugins to install | `string` | n/a | yes |
| <a name="input_cpd_googleanalyticstag"></a> [cpd\_googleanalyticstag](#input\_cpd\_googleanalyticstag) | Google Analytics Tag | `string` | n/a | yes |
| <a name="input_cpd_image_tag"></a> [cpd\_image\_tag](#input\_cpd\_image\_tag) | Docker image tag of application | `string` | n/a | yes |
| <a name="input_cpd_instrumentation_connectionstring"></a> [cpd\_instrumentation\_connectionstring](#input\_cpd\_instrumentation\_connectionstring) | The Azure ApplicationInsights connection string | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions Terraform/grafana.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ resource "azurerm_linux_web_app" "grafana-web-app" {
GF_SECURITY_CSRF_ADDITIONAL_HEADERS = "X-Forwarded-Host"
GF_SECURITY_CSRF_TRUSTED_ORIGINS = var.origins[terraform.workspace]
GF_SECURITY_ADMIN_PASSWORD = var.cpd_gf_password
GF_INSTALL_PLUGINS = var.cpd_gf_plugins
}

site_config {
Expand Down
13 changes: 9 additions & 4 deletions Terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,11 @@ variable "cpd_search_index_name" {
type = string
}

variable "cpd_gf_plugins" {
type = string
description = "List of Grafana plugins to install"
}

variable "cpd_search_recreate_index_on_rebuild" {
description = "Whether to delete the index and recreate before populating"
type = bool
Expand Down Expand Up @@ -892,11 +897,11 @@ variable "hostname" {
variable "origins" {
type = map(string)
default = {
Dev = "www.dev.develop-child-family-social-work-career.education.gov.uk,dev.develop-child-family-social-work-career.education.gov.uk"
Test = "www.test.develop-child-family-social-work-career.education.gov.uk,test.develop-child-family-social-work-career.education.gov.uk"
Dev = "www.dev.develop-child-family-social-work-career.education.gov.uk"
Test = "www.test.develop-child-family-social-work-career.education.gov.uk"
Load-Test = "20.107.65.156.nip.io"
Pre-Prod = "www.pre-proddevelop-child-family-social-work-career.education.gov.uk,pre-proddevelop-child-family-social-work-career.education.gov.uk"
Prod = "www.develop-child-family-social-work-career.education.gov.uk,develop-child-family-social-work-career.education.gov.uk"
Pre-Prod = "www.pre-prod.develop-child-family-social-work-career.education.gov.uk"
Prod = "www.develop-child-family-social-work-career.education.gov.uk"
}
description = "Origins for Grafana"
}
Expand Down
Loading