Skip to content

Commit 4df4768

Browse files
authored
Merge pull request #1337 from bcgov/dev
Dev
2 parents 7656051 + 24c9890 commit 4df4768

6 files changed

Lines changed: 129 additions & 3 deletions

File tree

applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Domain/NotificationsDataSeedContributor.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ await _templateVariablesRepository.InsertAsync(
5454
autoSave: true
5555
);
5656
}
57+
else if (existingVariable.Token == "category" && existingVariable.MapTo == "category")
58+
{
59+
existingVariable.MapTo = "applicationForm.category";
60+
await _templateVariablesRepository.UpdateAsync(existingVariable, autoSave: true);
61+
}
5762
}
5863
}
5964
}

applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Domain/PaymentRequests/PaymentRequest.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ public PaymentRequest SetPaymentDate(string paymentDate)
151151
{
152152
PaymentDate = date.ToString("yyyy-MM-dd");
153153
}
154+
else if(!string.IsNullOrEmpty(paymentDate))
155+
{
156+
PaymentDate = paymentDate;
157+
}
154158
return this;
155159
}
156160

applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Integrations/Cas/InvoiceService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ public InvoiceService(
7070
if (site != null && site.Supplier != null && site.Supplier.Number != null && accountDistributionCode != null)
7171
{
7272
// This can not be UTC Now it is sent to cas and can not be in the future - this is not being stored in Unity as a date
73-
var currentMonth = DateTime.Now.ToString("MMM").Trim('.');
74-
var currentDay = DateTime.Now.ToString("dd");
75-
var currentYear = DateTime.Now.ToString("yyyy");
73+
var localDateTime = DateTime.UtcNow.ToLocalTime();
74+
var currentMonth = localDateTime.ToString("MMM").Trim('.');
75+
var currentDay = localDateTime.ToString("dd");
76+
var currentYear = localDateTime.ToString("yyyy");
7677
var dateStringDayMonYear = $"{currentDay}-{currentMonth}-{currentYear}";
7778

7879
casInvoice.SupplierNumber = site.Supplier.Number; // This is from each Applicant
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Prompt the user to optionally login to OpenShift
2+
Write-Host "Do you want to log in to OpenShift now? (y/n)" -ForegroundColor Green
3+
$loginResponse = Read-Host
4+
if ($loginResponse -match '^(y|yes)$') {
5+
try {
6+
oc login --web --server=https://api.silver.devops.gov.bc.ca:6443
7+
}
8+
catch {
9+
Write-Host "Login failed. Please check your connection and credentials." -ForegroundColor Red
10+
exit 1
11+
}
12+
}
13+
14+
# Prompt user for environment selection
15+
$validEnvironments = @("dev", "dev2", "test", "uat", "prod")
16+
do {
17+
Write-Host "Enter environment (dev, dev2, test, uat, prod)" -ForegroundColor Green
18+
$environment = Read-Host
19+
} while (-not ($validEnvironments -contains $environment))
20+
21+
# Configuration parameters (dynamically updated based on environment)
22+
$NameSpace = "d18498-$environment" # OpenShift project namespace
23+
$ClusterName = "$environment-crunchy-postgres"
24+
$LocalPort = 5436
25+
$RemotePort = 5432
26+
$ListenInterface = "localhost"
27+
$RetrySeconds = 3
28+
29+
# Check if oc is installed
30+
if (-not (Get-Command oc -ErrorAction SilentlyContinue)) {
31+
Write-Host "The OpenShift CLI (oc) is not installed or not available in PATH." -ForegroundColor Red
32+
exit 1
33+
}
34+
35+
# Set the OpenShift project namespace
36+
Write-Host "Setting OpenShift project to $NameSpace..." -ForegroundColor Cyan
37+
try {
38+
oc project $NameSpace
39+
}
40+
catch {
41+
Write-Host "Error setting project: $_" -ForegroundColor Red
42+
Write-Host "Please ensure you're logged in to OpenShift before running this script." -ForegroundColor Yellow
43+
exit 1
44+
}
45+
46+
# Function to get the current primary pod using selectors
47+
function Get-PrimaryPod {
48+
$selector = "postgres-operator.crunchydata.com/cluster=$ClusterName,postgres-operator.crunchydata.com/role=master"
49+
try {
50+
$primaryPod = oc get pod -o name --selector=$selector
51+
if ([string]::IsNullOrEmpty($primaryPod)) {
52+
Write-Host "No primary pod found with selector: $selector" -ForegroundColor Yellow
53+
return $null
54+
}
55+
return ($primaryPod -replace "^pod/", "").Trim()
56+
}
57+
catch {
58+
Write-Host "Error getting primary pod: $_" -ForegroundColor Red
59+
return $null
60+
}
61+
}
62+
63+
# Function to check if still logged in
64+
function Test-OCLogin {
65+
try {
66+
$null = oc project $NameSpace 2>&1
67+
return $true
68+
}
69+
catch {
70+
Write-Host "OpenShift login has expired or cannot access namespace '$NameSpace'. Please run the script again to re-authenticate." -ForegroundColor Red
71+
return $false
72+
}
73+
}
74+
75+
# Main connection loop
76+
while ($true) {
77+
Write-Host ""
78+
$datetime = Get-Date -Format "yyyy-MM-dd HH:mm:ss K"
79+
Write-Host $datetime -ForegroundColor Cyan
80+
81+
# Get the current primary pod
82+
$primaryPod = Get-PrimaryPod
83+
84+
if ($primaryPod) {
85+
Write-Host "Connecting to primary pod: $primaryPod" -ForegroundColor Green
86+
87+
# Forward the port
88+
try {
89+
oc port-forward --address $ListenInterface $primaryPod "${LocalPort}:${RemotePort}"
90+
}
91+
catch {
92+
Write-Host "Error occurred during port forwarding: $_" -ForegroundColor Red
93+
}
94+
}
95+
else {
96+
Write-Host "Unable to find primary PostgreSQL pod. Retrying in $RetrySeconds seconds..." -ForegroundColor Yellow
97+
}
98+
99+
# Pause before retry
100+
Start-Sleep -Seconds $RetrySeconds
101+
102+
# Check login status
103+
if (-not (Test-OCLogin)) {
104+
break
105+
}
106+
}
107+
108+
Write-Host "Press any key to exit..." -ForegroundColor Yellow
109+
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

applications/Unity.GrantManager/src/Unity.GrantManager.Web/Unity.GrantManager.Web.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
<None Update="Views\Shared\**\*.css">
4242
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
4343
</None>
44+
<None Update="Views\Settings\**\*.js">
45+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
46+
</None>
47+
<None Update="Views\Settings\**\*.css">
48+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
49+
</None>
4450
<None Update="Components\**\*.js">
4551
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
4652
</None>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
abp.log.debug('BackgroundJobs initialized!');

0 commit comments

Comments
 (0)