Skip to content

Commit 9e715fd

Browse files
authored
Merge pull request #3726 from bcgov/feat/3593
Feat/3593
2 parents 8328712 + 4a65e3f commit 9e715fd

10 files changed

+274
-43
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as React from 'react';
2+
import { samplePrivateRequest } from './_components/Params';
3+
import CreateRequestApprovalTemplate from './_templates/private-cloud/CreateRequestApproval';
4+
5+
export default function CreateRequestApproval() {
6+
return <CreateRequestApprovalTemplate request={samplePrivateRequest} />;
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as React from 'react';
2+
import { samplePrivateRequest } from './_components/Params';
3+
import DeleteRequestApprovalTemplate from './_templates/private-cloud/DeleteRequestApproval';
4+
5+
export default function DeleteRequestApproval() {
6+
return <DeleteRequestApprovalTemplate request={samplePrivateRequest} />;
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as React from 'react';
2+
import { samplePrivateRequest } from './_components/Params';
3+
import EditRequestApprovalTemplate from './_templates/private-cloud/EditRequestApproval';
4+
5+
export default function EditRequestApproval() {
6+
return <EditRequestApprovalTemplate request={samplePrivateRequest} />;
7+
}

app/emails/PrivateCloudRequestApproval.tsx

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { Button, Heading, Text, Link } from '@react-email/components';
2+
import * as React from 'react';
3+
import Closing from '@/emails/_components/Closing';
4+
import Layout from '@/emails/_components/layout/Layout';
5+
import ProductDetails from '@/emails/_components/ProductDetails';
6+
import { PrivateCloudRequestDetail } from '@/types/private-cloud';
7+
8+
interface EmailProp {
9+
request: PrivateCloudRequestDetail;
10+
}
11+
12+
const CreateRequestApprovalTemplate = ({ request }: EmailProp) => {
13+
return (
14+
<Layout>
15+
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
16+
<Heading className="text-lg text-black">Success! Your create request was approved!</Heading>
17+
<Text>Hi Product Team, </Text>
18+
<Text className="">
19+
We are pleased to inform you that your request to create the product {request.decisionData.name} has been
20+
approved on the Private Cloud OpenShift platform. Please allow 3-5 minutes for the request to be processed. If
21+
it takes longer, don&apos;t hesitate to reach out to us. You can now log in to{' '}
22+
<Link className="mt-0 h-4" href={`https://console.apps.${request.decisionData.cluster}.devops.gov.bc.ca/`}>
23+
OpenShift cluster console{' '}
24+
</Link>{' '}
25+
to manage your product.
26+
</Text>
27+
<Text className="">
28+
If you have any more questions or need assistance, please reach out to the Platform Services team in the
29+
Rocket.Chat channel{' '}
30+
<Link className="mt-0 h-4" href={`https://chat.developer.gov.bc.ca/channel/devops-operations`}>
31+
#devops-operations
32+
</Link>
33+
.
34+
</Text>
35+
<Button href="https://registry.developer.gov.bc.ca/" className="bg-bcorange rounded-md px-4 py-2 text-white">
36+
Log in to Console
37+
</Button>
38+
</div>
39+
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
40+
<ProductDetails
41+
name={request.decisionData.name}
42+
description={request.decisionData.description}
43+
ministry={request.decisionData.ministry}
44+
po={request.decisionData.projectOwner}
45+
tl1={request.decisionData.primaryTechnicalLead}
46+
tl2={request.decisionData.secondaryTechnicalLead}
47+
/>
48+
</div>
49+
<div>
50+
<Closing />
51+
</div>
52+
</Layout>
53+
);
54+
};
55+
56+
export default CreateRequestApprovalTemplate;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { Button, Heading, Text, Link } from '@react-email/components';
2+
import * as React from 'react';
3+
import Closing from '@/emails/_components/Closing';
4+
import Layout from '@/emails/_components/layout/Layout';
5+
import ProductDetails from '@/emails/_components/ProductDetails';
6+
import { PrivateCloudRequestDetail } from '@/types/private-cloud';
7+
8+
interface EmailProp {
9+
request: PrivateCloudRequestDetail;
10+
}
11+
12+
const DeleteRequestApprovalTemplate = ({ request }: EmailProp) => {
13+
if (!request || !request.project || !request.decisionData) return <></>;
14+
15+
return (
16+
<Layout>
17+
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
18+
<Heading className="text-lg text-black">Success! Your delete request was approved!</Heading>
19+
<Text>Hi Product Team, </Text>
20+
<Text className="">
21+
We are pleased to inform you that your product {request.decisionData.name} has been approved for deletion on
22+
the Private Cloud OpenShift platform. Please allow 3-5 minutes for the request to be processed. If it takes
23+
longer, don&apos;t hesitate to reach out to us. You can log in to{' '}
24+
<Link className="mt-0 h-4" href={`https://console.apps.${request.decisionData.cluster}.devops.gov.bc.ca/`}>
25+
OpenShift cluster console{' '}
26+
</Link>{' '}
27+
to confirm that your product has been deleted.
28+
</Text>
29+
<Text className="">
30+
If you have any more questions or need assistance, please reach out to the Platform Services team in the
31+
Rocket.Chat channel{' '}
32+
<Link className="mt-0 h-4" href={`https://chat.developer.gov.bc.ca/channel/devops-operations`}>
33+
#devops-operations
34+
</Link>
35+
.
36+
</Text>
37+
<Button href="https://registry.developer.gov.bc.ca/" className="bg-bcorange rounded-md px-4 py-2 text-white">
38+
Log in to Console
39+
</Button>
40+
</div>
41+
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
42+
<ProductDetails
43+
name={request.decisionData.name}
44+
description={request.decisionData.description}
45+
ministry={request.decisionData.ministry}
46+
po={request.decisionData.projectOwner}
47+
tl1={request.decisionData.primaryTechnicalLead}
48+
tl2={request.decisionData.secondaryTechnicalLead}
49+
/>
50+
</div>
51+
<div>
52+
<Closing />
53+
</div>
54+
</Layout>
55+
);
56+
};
57+
58+
export default DeleteRequestApprovalTemplate;

app/emails/_templates/private-cloud/RequestApproval.tsx renamed to app/emails/_templates/private-cloud/EditRequestApproval.tsx

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $Enums } from '@prisma/client';
21
import { Button, Heading, Text, Link } from '@react-email/components';
32
import * as React from 'react';
43
import Closing from '@/emails/_components/Closing';
@@ -9,43 +8,34 @@ import QuotaChanges from '@/emails/_components/Edit/QuotaChanges';
98
import { comparePrivateCloudProjects } from '@/emails/_components/Edit/utils/compare-projects';
109
import Layout from '@/emails/_components/layout/Layout';
1110
import ProductDetails from '@/emails/_components/ProductDetails';
12-
import { isQuotaUpgrade } from '@/helpers/quota-change';
1311
import { PrivateCloudRequestDetail } from '@/types/private-cloud';
1412

1513
interface EmailProp {
1614
request: PrivateCloudRequestDetail;
1715
}
1816

19-
const RequestApprovalTemplate = ({ request }: EmailProp) => {
17+
const EditRequestApprovalTemplate = ({ request }: EmailProp) => {
2018
if (!request || !request.project || !request.decisionData) return <></>;
2119
const current = request.project;
2220
const requested = request.decisionData;
2321
const changed = comparePrivateCloudProjects(current, requested);
24-
const isQuotaUpgraded = isQuotaUpgrade(requested, current);
2522
const requestComment = request.requestComment ?? undefined;
26-
2723
const hasQuotaChanged =
2824
changed.productionQuota || changed.testQuota || changed.developmentQuota || changed.toolsQuota;
2925

3026
return (
3127
<Layout>
3228
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
33-
<Heading className="text-lg text-black">Success! Your request was approved!</Heading>
29+
<Heading className="text-lg text-black">Success! Your edit request was approved!</Heading>
3430
<Text>Hi Product Team, </Text>
3531
<Text className="">
36-
We are pleased to inform you that your
37-
{(request.type === $Enums.RequestType.CREATE || request.type === $Enums.RequestType.DELETE) &&
38-
`request for your product ${!hasQuotaChanged ? request.decisionData.name : ' '}`}
39-
{hasQuotaChanged && 'request for a resource quota'} has been approved on the Private Cloud OpenShift platform.
40-
You can now log in to{' '}
32+
We are pleased to inform you that your request for a resource quota has been approved on the Private Cloud
33+
OpenShift platform. Please allow 3-5 minutes for the request to be processed. If it takes longer, don&apos;t
34+
hesitate to reach out to us. You can now log in to{' '}
4135
<Link className="mt-0 h-4" href={`https://console.apps.${request.decisionData.cluster}.devops.gov.bc.ca/`}>
4236
OpenShift cluster console{' '}
4337
</Link>{' '}
44-
{hasQuotaChanged ? 'and you will see your new resource quota values.' : 'to manage your product.'}
45-
</Text>
46-
<Text>
47-
Please allow 3-5 minutes for the request to be processed. If it takes longer, don&apos;t hesitate to reach out
48-
to us.
38+
and you will see your new resource quota values.
4939
</Text>
5040
<Text className="">
5141
If you have any more questions or need assistance, please reach out to the Platform Services team in the
@@ -69,13 +59,13 @@ const RequestApprovalTemplate = ({ request }: EmailProp) => {
6959
tl2={request.decisionData.secondaryTechnicalLead}
7060
/>
7161
</div>
72-
{!isQuotaUpgraded && requestComment && (
62+
{requestComment && (
7363
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
7464
<Heading className="text-lg text-black">Comments</Heading>
7565
<Comment requestComment={requestComment} />
7666
</div>
7767
)}
78-
{!isQuotaUpgraded && (changed.name || changed.description || changed.ministry || changed.cluster) && (
68+
{(changed.name || changed.description || changed.ministry || changed.cluster) && (
7969
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
8070
<DescriptionChanges
8171
nameCurrent={current.name}
@@ -87,19 +77,18 @@ const RequestApprovalTemplate = ({ request }: EmailProp) => {
8777
/>
8878
</div>
8979
)}
90-
{!isQuotaUpgraded &&
91-
(changed.projectOwnerId || changed.primaryTechnicalLeadId || changed.secondaryTechnicalLeadId) && (
92-
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
93-
<ContactChanges
94-
poCurrent={current.projectOwner}
95-
tl1Current={current.primaryTechnicalLead}
96-
tl2Current={current?.secondaryTechnicalLead}
97-
poRequested={requested.projectOwner}
98-
tl1Requested={requested.primaryTechnicalLead}
99-
tl2Requested={requested?.secondaryTechnicalLead}
100-
/>
101-
</div>
102-
)}
80+
{(changed.projectOwnerId || changed.primaryTechnicalLeadId || changed.secondaryTechnicalLeadId) && (
81+
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
82+
<ContactChanges
83+
poCurrent={current.projectOwner}
84+
tl1Current={current.primaryTechnicalLead}
85+
tl2Current={current?.secondaryTechnicalLead}
86+
poRequested={requested.projectOwner}
87+
tl1Requested={requested.primaryTechnicalLead}
88+
tl2Requested={requested?.secondaryTechnicalLead}
89+
/>
90+
</div>
91+
)}
10392
{hasQuotaChanged && (
10493
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
10594
<h3 className="mb-0 text-black">Resource quota changes</h3>
@@ -158,4 +147,4 @@ const RequestApprovalTemplate = ({ request }: EmailProp) => {
158147
);
159148
};
160149

161-
export default RequestApprovalTemplate;
150+
export default EditRequestApprovalTemplate;

app/emails/_templates/private-cloud/Provisioned.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const ProvisionedTemplate = ({ product }: EmailProp) => {
1616
return (
1717
<Layout>
1818
<div className="pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300">
19-
<Heading className="text-lg text-black">Success! Your provisioning request was approved and completed!</Heading>
19+
<Heading className="text-lg text-black">Success! Your provisioning request is complete!</Heading>
2020
<Text>Hi Product Team, </Text>
2121
<Text className="">
22-
Your request for your product on the Private Cloud Openshift platform is complete.{' '}
22+
The request for your product on the Private Cloud Openshift platform is complete.{' '}
2323
<Link className="mt-0 h-4" href={`https://console.apps.${product.cluster}.devops.gov.bc.ca/`}>
2424
Log in to the cluster console
2525
</Link>{' '}

app/package-lock.json

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)