Skip to content
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
4 changes: 2 additions & 2 deletions src/Spd.Manager.Common.UnitTest/AdminManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public AdminManagerTest()
.With(i => i.Value, "test")
.Create();
var bannerItems = new List<ConfigItem>() { bannerItem };
mockConfigRepo.Setup(m => m.Query(It.Is<ConfigQuery>(q => q.Key == IConfigRepository.BANNER_MSG_CONFIG_KEY), CancellationToken.None))
mockConfigRepo.Setup(m => m.Query(It.Is<ConfigQuery>(q => q.Key == IConfigRepository.BANNER_MSG_SCREENING_CONFIG_KEY), CancellationToken.None))
.ReturnsAsync(new ConfigResult(bannerItems));

var licensingItem = fixture.Build<ConfigItem>()
Expand Down Expand Up @@ -81,7 +81,7 @@ public async void Handle_RetrieveAddressQuery_Return_AddressFindResponse()
[Fact]
public async void Handle_GetBannerMsgQuery_Return_StringResponse()
{
GetBannerMsgQuery request = new GetBannerMsgQuery();
GetBannerMsgQuery request = new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_SCREENING_CONFIG_KEY);

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

Expand Down
5 changes: 2 additions & 3 deletions src/Spd.Manager.Common/Admin/AdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public async Task<IEnumerable<AddressRetrieveResponse>> Handle(RetrieveAddressBy

public async Task<string?> Handle(GetBannerMsgQuery query, CancellationToken cancellationToken)
{
var result = await _cache.GetAsync(
IConfigRepository.BANNER_MSG_CONFIG_KEY,
async ct => (await _configRepo.Query(new ConfigQuery(IConfigRepository.BANNER_MSG_CONFIG_KEY), cancellationToken)).ConfigItems.ToList(),
var result = await _cache.GetAsync( query.BannerConfigKey,
async ct => (await _configRepo.Query(new ConfigQuery(query.BannerConfigKey), cancellationToken)).ConfigItems.ToList(),
TimeSpan.FromMinutes(15),
cancellationToken);

Expand Down
2 changes: 1 addition & 1 deletion src/Spd.Manager.Common/Admin/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface IAdminManager
public Task<IEnumerable<DogSchoolResponse>> Handle(GetAccreditedDogTrainingSchoolListQuery query, CancellationToken ct);
}

public record GetBannerMsgQuery : IRequest<string>;
public record GetBannerMsgQuery(string BannerConfigKey) : IRequest<string>;

public record GetReplacementProcessingTimeQuery : IRequest<string>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AppRoutes } from '@app/app.routes';
import { SPD_CONSTANTS } from '@app/core/constants/constants';
import { AuthProcessService } from '@app/core/services/auth-process.service';
import { CommonApplicationService } from '@app/core/services/common-application.service';
import { ConfigService } from '@app/core/services/config.service';
import { DogTrainerApplicationService } from '@app/core/services/dog-trainer-application.service';
import { GdsdTeamApplicationService } from '@app/core/services/gdsd-team-application.service';
import { RetiredDogApplicationService } from '@app/core/services/retired-dog-application.service';
Expand All @@ -16,6 +17,17 @@ import { take, tap } from 'rxjs';
template: `
<app-container>
<app-step-section>
<!-- SPDBT-4559 Temporary Notification Banner on GDSD Portal -->
@if (bannerMessage) {
<div class="row my-sm-0 my-md-2">
<div class="col-xxl-8 col-xl-10 col-lg-12 mx-auto">
<app-alert type="warning" icon="warning">
{{ bannerMessage }}
</app-alert>
</div>
</div>
}

<app-step-title heading="Log in to manage your guide dog and service dog certification"></app-step-title>

<div class="row">
Expand Down Expand Up @@ -184,10 +196,12 @@ import { take, tap } from 'rxjs';
export class GdsdLandingComponent implements OnInit, AfterViewInit {
setupAccountUrl = SPD_CONSTANTS.urls.setupAccountUrl;
serviceTypes = ServiceTypeCode;
bannerMessage: string | null = '';

constructor(
private router: Router,
private utilService: UtilService,
private configService: ConfigService,
private authProcessService: AuthProcessService,
private gdsdTeamApplicationService: GdsdTeamApplicationService,
private dogTrainerApplicationService: DogTrainerApplicationService,
Expand All @@ -197,6 +211,7 @@ export class GdsdLandingComponent implements OnInit, AfterViewInit {

ngOnInit(): void {
this.commonApplicationService.setGdsdApplicationTitle();
this.bannerMessage = this.configService.configs?.bannerMessage ?? '';
}

ngAfterViewInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Spd.Manager.Common.Admin;
using Spd.Resource.Repository.Config;
using Spd.Utilities.LogonUser.Configurations;
using Spd.Utilities.Recaptcha;
using Spd.Utilities.Shared;
Expand Down Expand Up @@ -49,7 +50,7 @@ public async Task<ConfigurationResponse> Get()
};

RecaptchaConfiguration recaptchaResp = new(_captchaOption.Value.ClientKey);
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery());
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_GDSD_CONFIG_KEY));
var version = _configuration.GetValue<string>("VERSION");

return await Task.FromResult(new ConfigurationResponse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { OidcConfiguration } from '../models/oidc-configuration';
import { RecaptchaConfiguration } from '../models/recaptcha-configuration';
import { WorkerCategoryTypeCode } from '../models/worker-category-type-code';
export interface ConfigurationResponse {
bannerMessage?: string | null;
bcscConfiguration?: OidcConfiguration;
enableAnonymousPermitFeatures?: boolean;
enableMdraFeatures?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ import { DialogComponent, DialogOptions } from './shared/components/dialog.compo
template: `
<div class="container px-0 my-0 px-md-2 my-md-3">
<app-step-section>
<!-- SPDBT-4559 Temporary Notification Banner on Security Portal -->
@if (bannerMessage) {
<div class="row my-sm-0 my-md-2">
<div class="col-xxl-8 col-xl-10 col-lg-12 mx-auto">
<app-alert type="warning" icon="warning">
{{ bannerMessage }}
</app-alert>
</div>
</div>
}

<app-step-title heading="Log in to manage your security licence or permit"></app-step-title>

<div class="row">
Expand Down Expand Up @@ -236,6 +247,7 @@ export class LandingComponent implements OnInit {
serviceTypeCodes = ServiceTypeCode;

isEnableAnonymousPermitFeatures = false;
bannerMessage: string | null = '';

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

this.isEnableAnonymousPermitFeatures = this.configService.isEnableAnonymousPermitFeatures();
this.bannerMessage = this.configService.config?.bannerMessage ?? '';
}

async onRegisterWithBceid(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.Extensions.Options;
using Spd.Manager.Common.Admin;
using Spd.Manager.Licence;
using Spd.Resource.Repository.Config;
using Spd.Utilities.LogonUser.Configurations;
using Spd.Utilities.Recaptcha;
using Spd.Utilities.Shared;
Expand Down Expand Up @@ -65,6 +66,7 @@ public async Task<ConfigurationResponse> Get()
var licenceFeesResponse = await _mediator.Send(new GetLicenceFeeListQuery(null));
var replacementProcessingTime = await _mediator.Send(new GetReplacementProcessingTimeQuery());
var version = _configuration.GetValue<string>("VERSION");
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_LICENSING_CONFIG_KEY));

return await Task.FromResult(
new ConfigurationResponse(
Expand All @@ -76,6 +78,7 @@ public async Task<ConfigurationResponse> Get()
replacementProcessingTime,
version,
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Undefined",
bannerMessage ?? string.Empty,
_configuration.GetValue<bool?>("EnableMdraFeatures") ?? false,
_configuration.GetValue<bool?>("EnableSecurityBusinessMergeFeatures") ?? false,
_configuration.GetValue<bool?>("EnableAnonymousPermitFeatures") ?? false)
Expand All @@ -92,6 +95,7 @@ public record ConfigurationResponse(
string? ReplacementProcessingTime,
string? Version,
string? Environment,
string? BannerMessage,
bool EnableMdraFeatures = false,
bool EnableSecurityBusinessMergeFeatures = false,
bool EnableAnonymousPermitFeatures = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Spd.Manager.Common.Admin;
using Spd.Resource.Repository.Config;
using Spd.Utilities.LogonUser.Configurations;
using Spd.Utilities.Recaptcha;
using Spd.Utilities.Shared;
Expand Down Expand Up @@ -73,7 +74,7 @@ public async Task<ConfigurationResponse> Get()
};

RecaptchaConfiguration recaptchaResp = new(_captchaOption.Value.ClientKey);
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery());
var bannerMessage = await _mediator.Send(new GetBannerMsgQuery(IConfigRepository.BANNER_MSG_SCREENING_CONFIG_KEY));
var payBcSearchInvoiceUrl = _configuration.GetValue<string>("PayBcSearchInvoiceUrl", string.Empty);
var version = _configuration.GetValue<string>("VERSION");

Expand Down
4 changes: 3 additions & 1 deletion src/Spd.Resource.Repository/Config/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
{
public interface IConfigRepository
{
public static readonly string BANNER_MSG_CONFIG_KEY = "ScreeningPortalProcessingTimeBanner";
public static readonly string BANNER_MSG_SCREENING_CONFIG_KEY = "ScreeningPortalProcessingTimeBanner";
public static readonly string BANNER_MSG_LICENSING_CONFIG_KEY = "LicensingBanner";
public static readonly string BANNER_MSG_GDSD_CONFIG_KEY = "GdsdBanner";
public static readonly string PAYBC_GROUP = "PAYBC";
public static readonly string PAYBC_REVENUEACCOUNT_KEY = "RevenueAccount";
public static readonly string PAYBC_PBCREFNUMBER_KEY = "PbcRefNumber";
Expand Down