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

Pipdp 1091 sonarcloud frontend fields mark as readonly #657

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
4 changes: 2 additions & 2 deletions charts/frontend/templates/config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ data:
environment.json: |-
{
"environmentName": "{{ .Values.settings.environmentName }}",
"apiEndpoint": "https://{{ if $isProd }}{{else}}{{ $release }}.{{end}}{{ $domain }}/api/v1",
"applicationUrl": "https://{{ if $isProd }}{{else}}{{ $release }}.{{end}}{{ $domain }}",
"apiEndpoint": "https://{{ if $isProd }}{{ else }}{{ $release }}.{{ end }}{{ $domain }}/api/v1",
"applicationUrl": "https://{{ if $isProd }}{{ else }}{{ $release }}.{{ end }}{{ $domain }}",
"keycloakConfig": {
"config": {
"url": "{{ .Values.settings.keycloak.url }}",
Expand Down
12 changes: 6 additions & 6 deletions workspace/apps/pidp/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import { UtilsService } from '@core/services/utils.service';
})
export class AppComponent implements OnInit {
public constructor(
private activatedRoute: ActivatedRoute,
private titleService: Title,
private routeStateService: RouteStateService,
private utilsService: UtilsService,
private router: Router,
private snowplowService: SnowplowService,
private readonly activatedRoute: ActivatedRoute,
private readonly titleService: Title,
private readonly routeStateService: RouteStateService,
private readonly utilsService: UtilsService,
private readonly router: Router,
private readonly snowplowService: SnowplowService,
) {
this.router.events.subscribe((evt) => {
if (evt instanceof NavigationEnd) {
Expand Down
15 changes: 9 additions & 6 deletions workspace/apps/pidp/src/app/core/guards/admin.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { Role } from '@app/shared/enums/roles.enum';
import { adminGuard } from './admin.guard';

describe('adminGuard', () => {
let activatedRouteSnapshotSpy: Spy<ActivatedRouteSnapshot>;
let routerStateSnapshotSpy: Spy<RouterStateSnapshot>;
let activatedRouteSpy: Spy<ActivatedRouteSnapshot>;
let routerStateSpy: Spy<RouterStateSnapshot>;
let authorizedUserServiceSpy: Spy<AuthorizedUserService>;
let router: Router;

Expand All @@ -29,9 +29,12 @@ describe('adminGuard', () => {
}),
},
provideAutoSpy(Router),
provideAutoSpy(ActivatedRouteSnapshot),
provideAutoSpy(RouterStateSnapshot),
],
});

activatedRouteSpy = TestBed.inject<any>(ActivatedRouteSnapshot);
routerStateSpy = TestBed.inject<any>(RouterStateSnapshot);
authorizedUserServiceSpy = TestBed.inject<any>(AuthorizedUserService);
router = TestBed.inject(Router);
});
Expand All @@ -42,7 +45,7 @@ describe('adminGuard', () => {

when('the guard is called', () => {
TestBed.runInInjectionContext(() =>
adminGuard(activatedRouteSnapshotSpy, routerStateSnapshotSpy),
adminGuard(activatedRouteSpy, routerStateSpy),
);

then('the user should be redirected to the root route', () => {
Expand All @@ -58,7 +61,7 @@ describe('adminGuard', () => {

when('the guard is called', () => {
TestBed.runInInjectionContext(() =>
adminGuard(activatedRouteSnapshotSpy, routerStateSnapshotSpy),
adminGuard(activatedRouteSpy, routerStateSpy),
);

then('the user should be redirected to the root route', () => {
Expand All @@ -73,7 +76,7 @@ describe('adminGuard', () => {
]);
when('the guard is called', () => {
const result = TestBed.runInInjectionContext(() =>
adminGuard(activatedRouteSnapshotSpy, routerStateSnapshotSpy),
adminGuard(activatedRouteSpy, routerStateSpy),
);
then('the user should access the route', () => {
expect(result).toBeTruthy();
Expand Down
5 changes: 4 additions & 1 deletion workspace/apps/pidp/src/app/core/guards/user.guard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ describe('userGuard', () => {
useValue: APP_DI_CONFIG,
},
provideAutoSpy(Router),
provideAutoSpy(ActivatedRouteSnapshot),
provideAutoSpy(RouterStateSnapshot),
],
});

activatedRouteSnapshotSpy = TestBed.inject<any>(ActivatedRouteSnapshot);
routerStateSnapshotSpy = TestBed.inject<any>(RouterStateSnapshot);
authorizedUserServiceSpy = TestBed.inject<any>(AuthorizedUserService);
router = TestBed.inject(Router);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ describe('partyResolver', () => {
provideAutoSpy(DocumentService),
provideAutoSpy(Router),
provideAutoSpy(KeycloakService),
provideAutoSpy(ActivatedRouteSnapshot),
provideAutoSpy(RouterStateSnapshot),
],
});

activatedRouteSnapshotSpy = TestBed.inject<any>(ActivatedRouteSnapshot);
routerStateSnapshotSpy = TestBed.inject<any>(RouterStateSnapshot);
router = TestBed.inject(Router);
partyResourceSpy = TestBed.inject<any>(DiscoveryResource);
partyServiceSpy = TestBed.inject<any>(PartyService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export enum MicrosoftLogLevel {
providedIn: 'root',
})
export class ClientLogsService {
public constructor(private apiResource: ApiHttpClient) {}
public constructor(private readonly apiResource: ApiHttpClient) {}

public createClientLog(log: ClientLog): NoContent {
return this.apiResource.post<NoContent>('client-logs', log).pipe(
Expand Down
4 changes: 2 additions & 2 deletions workspace/apps/pidp/src/app/core/services/document.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export interface IDocument extends IDocumentMetaData {
providedIn: 'root',
})
export class DocumentService {
private documents: IDocumentMetaData[];
private readonly documents: IDocumentMetaData[];

public constructor(@Inject(APP_CONFIG) private config: AppConfig) {
public constructor(@Inject(APP_CONFIG) private readonly config: AppConfig) {
this.documents = [
{
type: DocumentType.PIDP_COLLECTION_NOTICE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { filter } from 'rxjs/operators';
providedIn: 'root',
})
export class RouteStateService {
public constructor(private router: Router) {}
public constructor(private readonly router: Router) {}

/**
* @description
Expand Down
26 changes: 13 additions & 13 deletions workspace/apps/pidp/src/app/features/access/access.routes.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export class AccessRoutes {
public static BASE_PATH = 'access';
public static readonly BASE_PATH = 'access';

public static ACCESS_REQUESTS = 'access-requests';
public static BC_PROVIDER_APPLICATION = 'bc-provider-application';
public static BC_PROVIDER_EDIT = 'bc-provider-edit';
public static DRIVER_FITNESS = 'driver-fitness';
public static HCIM_ACCOUNT_TRANSFER = 'hcim-account-transfer';
public static IMMSBC_EFORMS = 'immsbc-eforms';
public static MS_TEAMS_PRIVACY_OFFICER = 'ms-teams-privacy-officer';
public static MS_TEAMS_CLINIC_MEMBER = 'ms-teams-clinic-member';
public static PRESCRIPTION_REFILL_EFORMS = 'prescription-refill-eforms';
public static PROVIDER_REPORTING_PORTAL = 'provider-reporting-portal';
public static SPECIAL_AUTH_EFORMS = 'sa-eforms';
public static PROVINCIAL_ATTACHMENT_SYSTEM = 'provincial-attachment-system';
public static readonly ACCESS_REQUESTS = 'access-requests';
public static readonly BC_PROVIDER_APPLICATION = 'bc-provider-application';
public static readonly BC_PROVIDER_EDIT = 'bc-provider-edit';
public static readonly DRIVER_FITNESS = 'driver-fitness';
public static readonly HCIM_ACCOUNT_TRANSFER = 'hcim-account-transfer';
public static readonly IMMSBC_EFORMS = 'immsbc-eforms';
public static readonly MS_TEAMS_PRIVACY_OFFICER = 'ms-teams-privacy-officer';
public static readonly MS_TEAMS_CLINIC_MEMBER = 'ms-teams-clinic-member';
public static readonly PRESCRIPTION_REFILL_EFORMS = 'prescription-refill-eforms';
public static readonly PROVIDER_REPORTING_PORTAL = 'provider-reporting-portal';
public static readonly SPECIAL_AUTH_EFORMS = 'sa-eforms';
public static readonly PROVINCIAL_ATTACHMENT_SYSTEM = 'provincial-attachment-system';

/**
* @description
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncPipe, NgClass, NgFor, NgIf } from '@angular/common';
import { NgFor, NgIf } from '@angular/common';
import {
Component,
HostListener,
Expand All @@ -18,7 +18,6 @@ import {

import {
InjectViewportCssClassDirective,
LayoutHeaderFooterComponent,
} from '@bcgov/shared/ui';

import { APP_CONFIG, AppConfig } from '@app/app.config';
Expand All @@ -42,12 +41,9 @@ import { AccessRequestCardComponent } from '../../components/access-request-card
FaIconComponent,
InjectViewportCssClassDirective,
MatButtonModule,
NgClass,
NgIf,
LayoutHeaderFooterComponent,
AccessRequestCardComponent,
NgFor,
AsyncPipe,
],
})
export class AccessRequestsPage implements OnInit, OnDestroy {
Expand All @@ -70,13 +66,13 @@ export class AccessRequestsPage implements OnInit, OnDestroy {
{ title: 'Home', path: '' },
{ title: 'Access', path: '' },
];
private destroy$ = new Subject<void>();
private readonly destroy$ = new Subject<void>();

public constructor(
@Inject(APP_CONFIG) private config: AppConfig,
private partyService: PartyService,
private portalService: PortalService,
private portalResource: PortalResource,
@Inject(APP_CONFIG) private readonly config: AppConfig,
private readonly partyService: PartyService,
private readonly portalService: PortalService,
private readonly portalResource: PortalResource,
) {
this.accessState$ = this.portalService.accessState$;
this.providerIdentitySupport = this.config.emails.providerIdentitySupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface BcProviderApplicationFormData {
}

export class BcProviderApplicationFormState extends AbstractFormState<BcProviderApplicationFormData> {
public constructor(private fb: FormBuilder) {
public constructor(private readonly fb: FormBuilder) {
super();

this.buildForm();
Expand All @@ -30,7 +30,7 @@ export class BcProviderApplicationFormState extends AbstractFormState<BcProvider

public get json(): BcProviderApplicationFormData | undefined {
if (!this.formInstance) {
return;
return undefined;
}

const values = this.formInstance.getRawValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { PortalResource } from '@app/features/portal/portal-resource.service';
})
export class BcProviderApplicationResource {
public constructor(
private apiResource: ApiHttpClient,
private portalResource: PortalResource,
private readonly apiResource: ApiHttpClient,
private readonly portalResource: PortalResource,
) {}

public getProfileStatus(partyId: number): Observable<ProfileStatus | null> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,19 @@ export class BcProviderApplicationPage
}

public constructor(
@Inject(APP_CONFIG) private config: AppConfig,
@Inject(APP_CONFIG) private readonly config: AppConfig,
dependenciesService: AbstractFormDependenciesService,
fb: FormBuilder,
private authService: AuthService,
private documentService: DocumentService,
private loadingOverlayService: LoadingOverlayService,
private logger: LoggerService,
private router: Router,
private navigationService: NavigationService,
private partyService: PartyService,
private resource: BcProviderApplicationResource,
private route: ActivatedRoute,
private utilsService: UtilsService,
private readonly authService: AuthService,
private readonly documentService: DocumentService,
private readonly loadingOverlayService: LoadingOverlayService,
private readonly logger: LoggerService,
private readonly router: Router,
private readonly navigationService: NavigationService,
private readonly partyService: PartyService,
private readonly resource: BcProviderApplicationResource,
private readonly route: ActivatedRoute,
private readonly utilsService: UtilsService,
) {
super(dependenciesService);
this.formState = new BcProviderApplicationFormState(fb);
Expand Down Expand Up @@ -295,7 +295,7 @@ export class BcProviderApplicationPage
);
}),
catchError(() => {
// TODO: what to do on error?

this.logger.error('Link Request creation failed');

return of(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface BcProviderEditFormData {
}

export class BcProviderEditFormState extends AbstractFormState<BcProviderEditFormData> {
public constructor(private fb: FormBuilder) {
public constructor(private readonly fb: FormBuilder) {
super();

this.buildForm();
Expand All @@ -31,7 +31,7 @@ export class BcProviderEditFormState extends AbstractFormState<BcProviderEditFor

public get json(): BcProviderEditFormData | undefined {
if (!this.formInstance) {
return;
return undefined;
}

const values = this.formInstance.getRawValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface BcProviderChangePasswordRequest {

@Injectable({ providedIn: 'root' })
export class BcProviderEditResource {
public constructor(private apiResource: ApiHttpClient) {}
public constructor(private readonly apiResource: ApiHttpClient) {}

public get(partyId: number): Observable<BcProviderEditInitialStateModel> {
const url = `parties/${partyId}/credentials/bc-provider`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
DialogOptions,
HtmlComponent,
InjectViewportCssClassDirective,
TextButtonDirective,
TooltipComponent,
} from '@bcgov/shared/ui';

Expand Down Expand Up @@ -87,7 +86,6 @@ export interface BcProviderEditInitialStateModel {
ReactiveFormsModule,
SuccessDialogComponent,
NgOptimizedImage,
TextButtonDirective,
AsyncPipe,
MatProgressBarModule,
ConfirmDialogComponent,
Expand Down Expand Up @@ -141,15 +139,15 @@ export class BcProviderEditPage
}

public constructor(
@Inject(APP_CONFIG) private config: AppConfig,
@Inject(APP_CONFIG) private readonly config: AppConfig,
dependenciesService: AbstractFormDependenciesService,
fb: FormBuilder,
private navigationService: NavigationService,
private partyService: PartyService,
private resource: BcProviderEditResource,
private router: Router,
private authorizedUserService: AuthorizedUserService,
private authService: AuthService,
private readonly navigationService: NavigationService,
private readonly partyService: PartyService,
private readonly resource: BcProviderEditResource,
private readonly router: Router,
private readonly authorizedUserService: AuthorizedUserService,
private readonly authService: AuthService,
) {
super(dependenciesService);
this.formState = new BcProviderEditFormState(fb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { PortalResource } from '@app/features/portal/portal-resource.service';
})
export class DriverFitnessResource {
public constructor(
private apiResource: ApiHttpClient,
private portalResource: PortalResource,
private readonly apiResource: ApiHttpClient,
private readonly portalResource: PortalResource,
) {}

public getProfileStatus(partyId: number): Observable<ProfileStatus | null> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1 class="title">Enrolment</h1>
</header>

<div class="content">
<!-- TODO: Extract this into a separate component or refactor ui-alert -->
<!-- TO DO: Extract this into a separate component or refactor ui-alert -->
<section *ngIf="accessRequestFailed" class="alert">
<h2>Error Requesting Access</h2>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ export class DriverFitnessPage implements OnInit, AfterViewInit {
];

public constructor(
private loadingOverlayService: LoadingOverlayService,
private route: ActivatedRoute,
private router: Router,
private partyService: PartyService,
private resource: DriverFitnessResource,
private logger: LoggerService,
private snowplowService: SnowplowService,
private readonly loadingOverlayService: LoadingOverlayService,
private readonly route: ActivatedRoute,
private readonly router: Router,
private readonly partyService: PartyService,
private readonly resource: DriverFitnessResource,
private readonly logger: LoggerService,
private readonly snowplowService: SnowplowService,
) {
const routeData = this.route.snapshot.data;
this.completed = routeData.driverFitnessStatusCode === StatusCode.COMPLETED;
Expand Down
Loading
Loading