Skip to content

Commit 392c414

Browse files
[SPDBT-4559] Temporary Notification Banners (#3041)
# Description This PR includes the following proposed change(s): - add banner to security and gdsd
1 parent 338a969 commit 392c414

File tree

10 files changed

+45
-9
lines changed

10 files changed

+45
-9
lines changed

src/Spd.Manager.Common.UnitTest/AdminManagerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public AdminManagerTest()
4141
.With(i => i.Value, "test")
4242
.Create();
4343
var bannerItems = new List<ConfigItem>() { bannerItem };
44-
mockConfigRepo.Setup(m => m.Query(It.Is<ConfigQuery>(q => q.Key == IConfigRepository.BANNER_MSG_CONFIG_KEY), CancellationToken.None))
44+
mockConfigRepo.Setup(m => m.Query(It.Is<ConfigQuery>(q => q.Key == IConfigRepository.BANNER_MSG_SCREENING_CONFIG_KEY), CancellationToken.None))
4545
.ReturnsAsync(new ConfigResult(bannerItems));
4646

4747
var licensingItem = fixture.Build<ConfigItem>()
@@ -81,7 +81,7 @@ public async void Handle_RetrieveAddressQuery_Return_AddressFindResponse()
8181
[Fact]
8282
public async void Handle_GetBannerMsgQuery_Return_StringResponse()
8383
{
84-
GetBannerMsgQuery request = new GetBannerMsgQuery();
84+
GetBannerMsgQuery request = new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_SCREENING_CONFIG_KEY);
8585

8686
var result = await sut.Handle(request, CancellationToken.None);
8787

src/Spd.Manager.Common/Admin/AdminManager.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ public async Task<IEnumerable<AddressRetrieveResponse>> Handle(RetrieveAddressBy
4040

4141
public async Task<string?> Handle(GetBannerMsgQuery query, CancellationToken cancellationToken)
4242
{
43-
var result = await _cache.GetAsync(
44-
IConfigRepository.BANNER_MSG_CONFIG_KEY,
45-
async ct => (await _configRepo.Query(new ConfigQuery(IConfigRepository.BANNER_MSG_CONFIG_KEY), cancellationToken)).ConfigItems.ToList(),
43+
var result = await _cache.GetAsync( query.BannerConfigKey,
44+
async ct => (await _configRepo.Query(new ConfigQuery(query.BannerConfigKey), cancellationToken)).ConfigItems.ToList(),
4645
TimeSpan.FromMinutes(15),
4746
cancellationToken);
4847

src/Spd.Manager.Common/Admin/Contract.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public interface IAdminManager
1717
public Task<IEnumerable<DogSchoolResponse>> Handle(GetAccreditedDogTrainingSchoolListQuery query, CancellationToken ct);
1818
}
1919

20-
public record GetBannerMsgQuery : IRequest<string>;
20+
public record GetBannerMsgQuery(string BannerConfigKey) : IRequest<string>;
2121

2222
public record GetReplacementProcessingTimeQuery : IRequest<string>;
2323

src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/gdsd-landing.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AppRoutes } from '@app/app.routes';
55
import { SPD_CONSTANTS } from '@app/core/constants/constants';
66
import { AuthProcessService } from '@app/core/services/auth-process.service';
77
import { CommonApplicationService } from '@app/core/services/common-application.service';
8+
import { ConfigService } from '@app/core/services/config.service';
89
import { DogTrainerApplicationService } from '@app/core/services/dog-trainer-application.service';
910
import { GdsdTeamApplicationService } from '@app/core/services/gdsd-team-application.service';
1011
import { RetiredDogApplicationService } from '@app/core/services/retired-dog-application.service';
@@ -16,6 +17,17 @@ import { take, tap } from 'rxjs';
1617
template: `
1718
<app-container>
1819
<app-step-section>
20+
<!-- SPDBT-4559 Temporary Notification Banner on GDSD Portal -->
21+
@if (bannerMessage) {
22+
<div class="row my-sm-0 my-md-2">
23+
<div class="col-xxl-8 col-xl-10 col-lg-12 mx-auto">
24+
<app-alert type="warning" icon="warning">
25+
{{ bannerMessage }}
26+
</app-alert>
27+
</div>
28+
</div>
29+
}
30+
1931
<app-step-title heading="Log in to manage your guide dog and service dog certification"></app-step-title>
2032
2133
<div class="row">
@@ -184,10 +196,12 @@ import { take, tap } from 'rxjs';
184196
export class GdsdLandingComponent implements OnInit, AfterViewInit {
185197
setupAccountUrl = SPD_CONSTANTS.urls.setupAccountUrl;
186198
serviceTypes = ServiceTypeCode;
199+
bannerMessage: string | null = '';
187200

188201
constructor(
189202
private router: Router,
190203
private utilService: UtilService,
204+
private configService: ConfigService,
191205
private authProcessService: AuthProcessService,
192206
private gdsdTeamApplicationService: GdsdTeamApplicationService,
193207
private dogTrainerApplicationService: DogTrainerApplicationService,
@@ -197,6 +211,7 @@ export class GdsdLandingComponent implements OnInit, AfterViewInit {
197211

198212
ngOnInit(): void {
199213
this.commonApplicationService.setGdsdApplicationTitle();
214+
this.bannerMessage = this.configService.configs?.bannerMessage ?? '';
200215
}
201216

202217
ngAfterViewInit(): void {

src/Spd.Presentation.GuideDogServiceDog/Controllers/ConfigurationController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.Extensions.Options;
44
using Spd.Manager.Common.Admin;
5+
using Spd.Resource.Repository.Config;
56
using Spd.Utilities.LogonUser.Configurations;
67
using Spd.Utilities.Recaptcha;
78
using Spd.Utilities.Shared;
@@ -49,7 +50,7 @@ public async Task<ConfigurationResponse> Get()
4950
};
5051

5152
RecaptchaConfiguration recaptchaResp = new(_captchaOption.Value.ClientKey);
52-
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery());
53+
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_GDSD_CONFIG_KEY));
5354
var version = _configuration.GetValue<string>("VERSION");
5455

5556
return await Task.FromResult(new ConfigurationResponse()

src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/configuration-response.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { OidcConfiguration } from '../models/oidc-configuration';
77
import { RecaptchaConfiguration } from '../models/recaptcha-configuration';
88
import { WorkerCategoryTypeCode } from '../models/worker-category-type-code';
99
export interface ConfigurationResponse {
10+
bannerMessage?: string | null;
1011
bcscConfiguration?: OidcConfiguration;
1112
enableAnonymousPermitFeatures?: boolean;
1213
enableMdraFeatures?: boolean;

src/Spd.Presentation.Licensing/ClientApp/src/app/landing.component.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ import { DialogComponent, DialogOptions } from './shared/components/dialog.compo
1818
template: `
1919
<div class="container px-0 my-0 px-md-2 my-md-3">
2020
<app-step-section>
21+
<!-- SPDBT-4559 Temporary Notification Banner on Security Portal -->
22+
@if (bannerMessage) {
23+
<div class="row my-sm-0 my-md-2">
24+
<div class="col-xxl-8 col-xl-10 col-lg-12 mx-auto">
25+
<app-alert type="warning" icon="warning">
26+
{{ bannerMessage }}
27+
</app-alert>
28+
</div>
29+
</div>
30+
}
31+
2132
<app-step-title heading="Log in to manage your security licence or permit"></app-step-title>
2233
2334
<div class="row">
@@ -236,6 +247,7 @@ export class LandingComponent implements OnInit {
236247
serviceTypeCodes = ServiceTypeCode;
237248

238249
isEnableAnonymousPermitFeatures = false;
250+
bannerMessage: string | null = '';
239251

240252
constructor(
241253
private router: Router,
@@ -251,6 +263,7 @@ export class LandingComponent implements OnInit {
251263
this.commonApplicationService.setApplicationTitle();
252264

253265
this.isEnableAnonymousPermitFeatures = this.configService.isEnableAnonymousPermitFeatures();
266+
this.bannerMessage = this.configService.config?.bannerMessage ?? '';
254267
}
255268

256269
async onRegisterWithBceid(): Promise<void> {

src/Spd.Presentation.Licensing/Controllers/ConfigurationController.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.Extensions.Options;
44
using Spd.Manager.Common.Admin;
55
using Spd.Manager.Licence;
6+
using Spd.Resource.Repository.Config;
67
using Spd.Utilities.LogonUser.Configurations;
78
using Spd.Utilities.Recaptcha;
89
using Spd.Utilities.Shared;
@@ -65,6 +66,7 @@ public async Task<ConfigurationResponse> Get()
6566
var licenceFeesResponse = await _mediator.Send(new GetLicenceFeeListQuery(null));
6667
var replacementProcessingTime = await _mediator.Send(new GetReplacementProcessingTimeQuery());
6768
var version = _configuration.GetValue<string>("VERSION");
69+
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_LICENSING_CONFIG_KEY));
6870

6971
return await Task.FromResult(
7072
new ConfigurationResponse(
@@ -76,6 +78,7 @@ public async Task<ConfigurationResponse> Get()
7678
replacementProcessingTime,
7779
version,
7880
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Undefined",
81+
bannerMessage ?? string.Empty,
7982
_configuration.GetValue<bool?>("EnableMdraFeatures") ?? false,
8083
_configuration.GetValue<bool?>("EnableSecurityBusinessMergeFeatures") ?? false,
8184
_configuration.GetValue<bool?>("EnableAnonymousPermitFeatures") ?? false)
@@ -92,6 +95,7 @@ public record ConfigurationResponse(
9295
string? ReplacementProcessingTime,
9396
string? Version,
9497
string? Environment,
98+
string? BannerMessage,
9599
bool EnableMdraFeatures = false,
96100
bool EnableSecurityBusinessMergeFeatures = false,
97101
bool EnableAnonymousPermitFeatures = false

src/Spd.Presentation.Screening/Controllers/ConfigurationController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.AspNetCore.Mvc;
33
using Microsoft.Extensions.Options;
44
using Spd.Manager.Common.Admin;
5+
using Spd.Resource.Repository.Config;
56
using Spd.Utilities.LogonUser.Configurations;
67
using Spd.Utilities.Recaptcha;
78
using Spd.Utilities.Shared;
@@ -73,7 +74,7 @@ public async Task<ConfigurationResponse> Get()
7374
};
7475

7576
RecaptchaConfiguration recaptchaResp = new(_captchaOption.Value.ClientKey);
76-
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery());
77+
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_SCREENING_CONFIG_KEY));
7778
var payBcSearchInvoiceUrl = _configuration.GetValue<string>("PayBcSearchInvoiceUrl", string.Empty);
7879
var version = _configuration.GetValue<string>("VERSION");
7980

src/Spd.Resource.Repository/Config/Contract.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
{
33
public interface IConfigRepository
44
{
5-
public static readonly string BANNER_MSG_CONFIG_KEY = "ScreeningPortalProcessingTimeBanner";
5+
public static readonly string BANNER_MSG_SCREENING_CONFIG_KEY = "ScreeningPortalProcessingTimeBanner";
6+
public static readonly string BANNER_MSG_LICENSING_CONFIG_KEY = "LicensingBanner";
7+
public static readonly string BANNER_MSG_GDSD_CONFIG_KEY = "GdsdBanner";
68
public static readonly string PAYBC_GROUP = "PAYBC";
79
public static readonly string PAYBC_REVENUEACCOUNT_KEY = "RevenueAccount";
810
public static readonly string PAYBC_PBCREFNUMBER_KEY = "PbcRefNumber";

0 commit comments

Comments
 (0)