Skip to content

Commit

Permalink
Add lambda layer for template files
Browse files Browse the repository at this point in the history
Add layer that contains the templating files used for generating
the document in the lambda.

Ticket: AT-7345
  • Loading branch information
juliusfitzhugh-ccpo committed Jun 8, 2022
1 parent f81d0f5 commit c37a8f5
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 0 deletions.
93 changes: 93 additions & 0 deletions document-generation/templates/dow-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
html {
font-size: 10px;
font-family: 'Times New Roman', Times, serif;
}

body {
font-size: 1.6rem;
}

.main-wrap {
padding: 100px 120px;
margin: 0 auto;
max-width: 768px;
}

p {
margin: 0 0 1.6rem;
line-height: 2.1rem;
}

.text-right {
text-align: right;
}

.align-center {
margin: 0 auto;
}

h1 {
font-size: 1.9rem;
text-transform: uppercase;
margin-bottom: 2.4rem !important;
text-align: center;
margin-top: 0;
}

table {
border-collapse: collapse;
}

td, th {
border: 1px solid black;
padding: 8px 16px;
line-height: 2.2rem;
}

.award-mod-table {
width: 380px;
margin: 0 auto 2.4rem;
}

.award-mod-table td, .award-mod-table th {
width: 190px;
}

.contract-details-table {
width: 100%;
margin-bottom: 12px;
}

.contract-details-table th {
text-align: left;
font-weight: normal;
width: 300px;
}

hr {
margin: 0 0 12px 0;
border: none;
height: 1px;
background-color: #e0e1e2;
}

section {
padding: 12px 0;
}

.d-flex {
display: flex;
}

.number {
font-weight: bold;
flex: 0 38px;
}

.content {
flex: 1;
}

.content > p {
margin-top: -2px;
}
149 changes: 149 additions & 0 deletions document-generation/templates/dow-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ATAT Description of Work</title>
<!-- <link rel="stylesheet" href="style.css"> -->
<style type="text/css"></style>
<!-- <script src="https://cdn.jsdelivr.net/npm/handlebars@latest/dist/handlebars.js"></script> -->
<!-- <script src="index.js"></script> -->
</head>
<body>
<!-- <script id="DoW_Template" type="text/x-handlebars-template"> -->
<div class="main-wrap">

<h1>Description of Work</h1>
<table class="award-mod-table">
<thead>
<tr>
<th>Award/Mod Effective</th>
<th>Version Date</th>
</tr>
</thead>
<tbody>
{{#each award_history}}
<tr>
<td>{{this.contract_award_type}}</td>
<td class="text-right">{{this.effective_date}}</td>
</tr>
{{/each}}
<tr>
<td>Award</td>
<td class="text-right">TBD</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
</tr>
</tbody>
</table>

<table class="contract-details-table">
<tr>
<th>Contract Number:</th>
<td>TBD</td>
</tr>
<tr>
<th>Task Order (TO) Number:</th>
<td>TBD</td>
</tr>
<tr>
<th>Contractor Name:</th>
<td>TBD</td>
</tr>
<tr>
<th>Tracking Number:</th>
<td>TBD</td>
</tr>
<tr>
<th>Follow-on to Previous Contract and Task Order Number:</th>
<td>
Contract Number: {{contract_information.contract_number}} <br />
Task Order Number: {{contract_information.previous_task_order_number}}</td>
</tr>
</table>

<section class="d-flex">
<div class="number">1.</div>
<div class="content"><u>TO Title.</u> {{to_title}}</div>
</section>

<section class="d-flex">
<div class="number">2.</div>
<div class="content">
<p>
<u>Scope.</u><br />
{{scope}}
</p>
<p style="margin-bottom: 0;">
The Government may require surge capabilities during the base or any option period,
and surge modifications will be within the scope of the contract for the defined task
areas of this description of work. Surge capabilities over the life of the task order
will not exceed {{scope_surge}}% of the contractor’s total proposed price for the
base and all option periods, excluding any six-month extension of services pursuant
to Federal Acquisition Regulation (FAR) <span style="white-space: nowrap;">52.217-8.</span>
</p>

</div>
</section>

<section class="d-flex">
<div class="number">4.</div>
<div class="content">
<u>Performance Requirements.</u>
</div>
</section>

<section class="d-flex">
<div class="number">4.2</div>
<div class="content">
<u>Task 2 &mdash; XaaS</u>
</div>
</section>

<section class="d-flex">
<div class="number">4.2.2</div>
<div class="content">
<p>
<u>Subtask 2 Developer Tools and Services</u>
</p>

{{#each toolsAndServices}}
<p>
<strong>4.2.2.{{inc @index}}</strong> <u>{{classification}} &mdash; {{toolOrService}}</u><br />
Duration: {{duration}}
</p>
<p>
{{description}}
</p>
{{/each}}

</div>
</section>

<hr />

<section class="d-flex">
<div class="number">11.</div>
<div class="content">
<p>
<u>Section 508 Accessibility Standards for Cloud Computing.</u>
</p>
{{{section508Content}}}
</div>
</section>
</div>

<!-- </script> -->
</body>
</html>
13 changes: 13 additions & 0 deletions lib/atat-web-api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as cdk from "aws-cdk-lib";
import * as apigw from "aws-cdk-lib/aws-apigateway";
import * as iam from "aws-cdk-lib/aws-iam";
import * as statement from "cdk-iam-floyd";
import * as lambda from "aws-cdk-lib/aws-lambda";
import * as nodejs from "aws-cdk-lib/aws-lambda-nodejs";
import { Construct } from "constructs";
import { AtatNetStack } from "./atat-net-stack";
Expand Down Expand Up @@ -103,8 +104,20 @@ export class AtatWebApiStack extends cdk.Stack {

// APIGW Document Generation Resource
const generateDocumentResource = api.restApi.root.addResource("generate-document");
const documentGenerationLayer = new lambda.LayerVersion(this, "GenerateDocumentSupportLayer", {
compatibleRuntimes: [lambda.Runtime.NODEJS_16_X],
code: lambda.Code.fromAsset("document-generation/templates", {}),
});
// const puppeteerLayer = new lambda.LayerVersion(this, "PuppeteerSupportLayer", {
// compatibleRuntimes: [lambda.Runtime.NODEJS_16_X],
// code: lambda.Code.fromAsset("node_modules/chrome-aws-lambda/build", {}),
// });
const generateDocumentFn = new nodejs.NodejsFunction(this, "GenerateDocumentFunction", {
entry: "document-generation/generate-document.ts",
runtime: lambda.Runtime.NODEJS_16_X,
memorySize: 512,
layers: [documentGenerationLayer /* , puppeteerLayer */],
timeout: cdk.Duration.seconds(120),
});
generateDocumentResource.addMethod(HttpMethod.POST, new apigw.LambdaIntegration(generateDocumentFn));

Expand Down

0 comments on commit c37a8f5

Please sign in to comment.