Skip to content

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
neophyte57 committed Apr 25, 2024
2 parents be9f82f + ec82bf8 commit eaaf5d6
Show file tree
Hide file tree
Showing 20 changed files with 249 additions and 23 deletions.
88 changes: 88 additions & 0 deletions infrastructure/cron-jobs/populate-transaction-log-temp.cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
annotations:
description: Template for job that activates api to populate pharmanet transaction log temp
tags: cronjob
name: populate-transaction-log-temp-cronjob-template
objects:
- apiVersion: batch/v1
kind: CronJob
metadata:
name: '${CRON_NAME}'
spec:
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- command:
- bash
- '-c'
- >-
echo -e "-------- STARTING CRON --------\n"
echo -e "-------- Getting access_token --------\n"
TOKEN=$(curl -X POST
"${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/token"
\
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=${KEYCLOAK_CLIENT_ID}" \
-d "client_secret=${KEYCLOAK_CLIENT_SECRET}" | jq -r '.access_token')
echo -e ${TOKEN}
echo -e "-------- Calling PRIME API --------\n"
curl -v -X POST
http://${ENV_NAME}-webapi:8080/api/jobs/populate/transaction-log-temp?numberOfDays=15
\
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Length: 0"
echo -e "-------- CRON COMPLETE --------\n"
env:
- name: KEYCLOAK_CLIENT_SECRET
valueFrom:
secretKeyRef:
key: prime_service_account_client_secret
name: prime-service-account
- name: KEYCLOAK_CLIENT_ID
valueFrom:
secretKeyRef:
key: prime_service_account_client_id
name: prime-service-account
- name: KEYCLOAK_URL
valueFrom:
configMapKeyRef:
name: keycloak
key: KEYCLOAK_URL
- name: KEYCLOAK_REALM
valueFrom:
configMapKeyRef:
name: keycloak
key: KEYCLOAK_REALM
image: >-
public.ecr.aws/h0h9t7p1/alpine-bash-curl-jq:latest
limits:
cpu: 500m
memory: 2Gi
name: '${CRON_NAME}'
requests:
cpu: 100m
memory: 512Mi
resources: null
restartPolicy: Never
schedule: '${CRON_SCHEDULE}'
parameters:
- description: 'Cron-like schedule expression. Default: Once a day at 4 AM'
name: CRON_SCHEDULE
value: '0 10 * * *'
- name: CRON_NAME
value: prod-populate-transaction-log-temp-cronjob
- description: 'Environment name'
name: ENV_NAME
required: true
9 changes: 7 additions & 2 deletions infrastructure/mailhog-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ parameters:
value: ""
required: false
- name: MAILHOG_IMAGE
displayName: Mailhog Docker Image
value: image-registry.openshift-image-registry.svc:5000/9c33a9-dev/mailhog-server:latest
description: The mailhog docker image to use in DeploymentConfig
required: true
- name: DOCKER_IMAGE
displayName: Mailhog Docker Image
value: registry.hub.docker.com/mailhog/mailhog:latest
description: The mailhog docker image to use
description: The mailhog docker image to use in ImageStream
required: true
message: |-
The following service(s) have been created in your project:
Expand Down Expand Up @@ -50,7 +55,7 @@ objects:
tags:
- from:
kind: DockerImage
name: ${MAILHOG_IMAGE}
name: ${DOCKER_IMAGE}
generation: 2
importPolicy: {}
name: latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,4 +595,15 @@ export class SiteResource {
})
);
}

public pecExistsWithinHa(siteId: number, pec: string): Observable<boolean> {
return this.apiResource.get(`sites/${siteId}/pec/${pec}/exists-within-ha`)
.pipe(
map((response: ApiHttpResponse<boolean>) => response.result),
catchError((error: any) => {
this.logger.error('[SiteRegistration] SiteResource::pecExistsWithinHa error has occurred: ', error);
throw error;
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@
<mat-form-field class="w-100">
<input matInput
placeholder="Site ID"
formControlName="pec">
formControlName="pec"
appToUppercase>
<mat-error *ngIf="pec.hasError('required')">
Required
</mat-error>
<mat-error *ngIf="pec.hasError('assignable')">
Site ID has already been used by another site
Site ID already used by another organization
</mat-error>
</mat-form-field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { DialogOptions } from '@shared/components/dialogs/dialog-options.model';
import { ChangeVendorNoteComponent } from '@shared/components/dialogs/content/change-vendor-note/change-vendor-note.component';
import { MatDialog } from '@angular/material/dialog';
import { HealthAuthority } from '@shared/models/health-authority.model';
import { ConfirmDialogComponent } from '@shared/components/dialogs/confirm-dialog/confirm-dialog.component';

interface HealthAuthorityVendorMap extends VendorConfig {
id?: number;
Expand Down Expand Up @@ -57,11 +58,36 @@ export class SiteOverviewPageComponent implements OnInit {
if (this.pec.valid) {
const siteId = +this.route.snapshot.params.sid;
const pec = this.form.value.pec;
this.busy = this.siteResource.updatePecCode(siteId, pec)
.subscribe(() => {
this.refresh.next(true);
this.site.pec = pec;
});

this.siteResource.pecExistsWithinHa(siteId, pec).subscribe((result) => {
if (result) {
const data: DialogOptions = {
title: 'Site ID is in use',
message: 'This Site ID is already in use in your organization. Allow multiple sites?',
actionText: "Yes"
};
this.busy = this.dialog.open(ConfirmDialogComponent, { data })
.afterClosed()
.subscribe((result) => {
if (result) {
this.busy = this.siteResource.updatePecCode(siteId, pec)
.subscribe(() => {
this.refresh.next(true);
this.site.pec = pec;
});
} else {
this.pec.setValue(this.site.pec);
}
});
} else {
this.busy = this.siteResource.updatePecCode(siteId, pec)
.subscribe(() => {
this.refresh.next(true);
this.site.pec = pec;
});
}
});

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@
<mat-form-field class="w-100">
<input matInput
placeholder="Site ID"
formControlName="pec">
formControlName="pec"
appToUppercase>
<mat-error *ngIf="pec.hasError('required')">
Required
</mat-error>
<mat-error *ngIf="pec.hasError('assignable')">
Site ID has already been used by another site
Site ID already used by another organization
</mat-error>
</mat-form-field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@
*matHeaderCellDef
scope="col"> Site ID (PEC) </th>
<td mat-cell
*matCellDef="let row;"> {{ row.pec | default }} </td>
*matCellDef="let row;">
<div class="d-flex align-items-center">
{{ row.pec | default }}
<mat-icon *ngIf="row?.duplicatePecSiteCount && row?.duplicatePecSiteCount > 0"
[matTooltip]="getDuplicatePecText(row)"
class="pec-alert"
(click)="onPecFilter(row.pec)"
matTooltipPosition="after">info
</mat-icon>
</div>
</td>
</ng-container>

<ng-container matColumnDef="careType">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
color: theme-palette(red);
}

.pec-alert {
color: theme-palette(yellow);
font-size: large;
}

.health-auth-menu {
color: theme-palette(yellow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class HealthAuthorityTableComponent implements OnInit, OnChanges {
@Output() public notify: EventEmitter<{ siteId: number, healthAuthorityOrganizationId: HealthAuthorityEnum }>;
@Output() public reload: EventEmitter<number>;
@Output() public route: EventEmitter<string | (string | number)[]>;
@Output() public pecFilter: EventEmitter<string>;

public dataSource: MatTableDataSource<HealthAuthorityRow | HealthAuthoritySiteAdminList>;
public healthAuthorities: HealthAuthorityRow[];
Expand Down Expand Up @@ -62,6 +63,7 @@ export class HealthAuthorityTableComponent implements OnInit, OnChanges {
this.notify = new EventEmitter<{ siteId: number, healthAuthorityOrganizationId: HealthAuthorityEnum }>();
this.reload = new EventEmitter<number>();
this.route = new EventEmitter<string | (string | number)[]>();
this.pecFilter = new EventEmitter<string>();

this.dataSource = new MatTableDataSource<HealthAuthorityRow | HealthAuthoritySiteAdminList>([]);
}
Expand All @@ -86,6 +88,10 @@ export class HealthAuthorityTableComponent implements OnInit, OnChanges {
this.route.emit(routePath);
}

public onPecFilter(pec: string) {
this.pecFilter.emit(pec);
}

public isHealthAuthority(row: HealthAuthorityRow | HealthAuthoritySiteAdminList): boolean {
return row.hasOwnProperty('hasUnderReviewUsers');
}
Expand All @@ -109,7 +115,9 @@ export class HealthAuthorityTableComponent implements OnInit, OnChanges {
);
this.healthAuthorities = has;
this.dataSource.data = Object.assign([], this.sites).concat(has).sort(this.sortData());
})
});


} else {
this.dataSource.data = Object.assign([], this.sites).sort(this.sortData());
}
Expand All @@ -123,6 +131,10 @@ export class HealthAuthorityTableComponent implements OnInit, OnChanges {
}
}

public getDuplicatePecText(row: HealthAuthoritySiteAdminList) {
return `${row.duplicatePecSiteCount + 1} sites share the same site ID`;
}

/**
* @description
* Sort health authorities and their grouped sites in ascending order by ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
[id]="CareSettingEnum.HEALTH_AUTHORITY">
<ng-template matTabContent>
<div class="mt-3">
<app-search-ha-form (search)="onSearch($event)"
<app-search-ha-form #searchHaForm
(search)="onSearch($event)"
(siteStatus)="onSiteStatusChange($event)"
(vendor)="onVendorChange($event)"
(careType)="onCareTypeChange($event)"
Expand All @@ -55,7 +56,8 @@
(reassign)="onReassign($event)"
(notify)="onNotify($event)"
(route)="onRoute($event)"
(reload)="onRefresh()"></app-health-authority-table>
(reload)="onRefresh()"
(pecFilter)="onTextSearch($event)"></app-health-authority-table>
</div>
</ng-template>
</mat-tab>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { MatTableDataSource } from '@angular/material/table';
import { MatDialog } from '@angular/material/dialog';
Expand All @@ -22,7 +22,7 @@ import { AbstractSiteAdminPage } from '@adjudication/shared/classes/abstract-sit
import { HealthAuthoritySiteAdminList } from '@health-auth/shared/models/health-authority-admin-site-list.model';
import { SiteRegistrationListViewModel } from '@registration/shared/models/site-registration.model';
import { AuthService } from '@auth/shared/services/auth.service';
import { BcscUser } from '@auth/shared/models/bcsc-user.model';
import { SearchHAFormComponent } from '../search-ha-form/search-ha-form.component';

@Component({
selector: 'app-site-registration-tabs',
Expand All @@ -32,6 +32,7 @@ import { BcscUser } from '@auth/shared/models/bcsc-user.model';
export class SiteRegistrationTabsComponent extends AbstractSiteAdminPage implements OnInit {
public busy: Subscription;
@Input() public refresh: Observable<boolean>;
@ViewChild('searchHaForm') searchHaForm: SearchHAFormComponent;

public dataSource: MatTableDataSource<SiteRegistrationListViewModel>;
public healthAuthoritySites: HealthAuthoritySiteAdminList[];
Expand Down Expand Up @@ -128,6 +129,11 @@ export class SiteRegistrationTabsComponent extends AbstractSiteAdminPage impleme
this.routeUtils.removeQueryParams({ careSetting: this.tabIndexToCareSettingMap[tabChangeEvent.index], page: null });
}

public onTextSearch(textSearch: string | null): void {
this.routeUtils.updateQueryParams({ textSearch, page: null });
this.searchHaForm.textSearch.setValue(textSearch);
}

public ngOnInit(): void {
// Use existing query params for initial search, and
// update results on query param change
Expand Down Expand Up @@ -159,7 +165,13 @@ export class SiteRegistrationTabsComponent extends AbstractSiteAdminPage impleme
if (careSettingCode === CareSettingEnum.HEALTH_AUTHORITY) {
const { textSearch, careType, statusId, vendorId, assignToMe } = queryParams;
this.healthAuthResource.getHealthAuthoritySitesByQuery({ textSearch, careType, statusId, vendorId, assignToMe })
.subscribe((sites: HealthAuthoritySiteAdminList[]) => this.healthAuthoritySites = sites)
.subscribe((sites: HealthAuthoritySiteAdminList[]) => {
sites.forEach((s: HealthAuthoritySiteAdminList) => {
s.duplicatePecSiteCount = sites.filter((innerSite: HealthAuthoritySiteAdminList) => innerSite.id !== s.id
&& innerSite.pec && innerSite.pec === s.pec).length;
});
this.healthAuthoritySites = sites;
})
} else {
this.busy = this.getPaginatedSites({ careSettingCode, ...queryParams })
.subscribe((paginatedList: PaginatedList<SiteRegistrationListViewModel>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@
<mat-form-field class="w-100">
<mat-label></mat-label>
<input matInput
[formControl]="formState.pec" />
[formControl]="formState.pec"
appToUppercase />
<mat-error *ngIf="formState.pec.hasError('required')">Required</mat-error>
<mat-error *ngIf="formState.pec.hasError('assignable')">
Site ID/PEC Code exists in another Health Authority
Site ID/PEC Code exists in another organization
</mat-error>
</mat-form-field>
</div>
Expand Down
Loading

0 comments on commit eaaf5d6

Please sign in to comment.