-
Notifications
You must be signed in to change notification settings - Fork 7
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
Manual check #168
base: dev
Are you sure you want to change the base?
Manual check #168
Conversation
…ckerfile - Implemented a new file upload interface in HomeComponent for uploading solicitation files. - Added file-upload.service.ts (moved to src/app/services/) to handle text extraction (PDF, DOC, DOCX, TXT) and compliance analysis. - Integrated PDF.js (with pdf.worker.min.js) and Mammoth for file processing. - Updated Home module and app.module.ts to register the new service. - Adjusted package.json and angular.json for new dependencies and asset configurations. - Added Dockerfile for containerized deployment.
looks great to me!
…On Fri, Feb 7, 2025 at 2:30 PM collinschreyer-dev ***@***.***> wrote:
image.png (view on web)
<https://github.com/user-attachments/assets/82c9275c-7053-4740-a7da-14f7bdb0cb2c>
Pull Request Summary Dockerfile Changes Stage 1: Compile and Build
Angular Codebase (Builder Stage)
-
*Base Image:*
Uses node:20-alpine (unchanged).
-
*Chrome Installation for Protractor Tests:*
The commands to install Chrome (via wget, apt-key, and apt-get) are
commented out.
-
*Build Dependencies:*
Installs Python, make, and g++ using apk add --no-cache.
-
*Dependency Cleanup:*
Uses a sed command to remove phantomjs-prebuilt from package.json
before installing dependencies.
-
*Asset Preparation:*
Creates a directory for USWDS images (./src/assets/uswds/img/) and
copies image assets from ***@***.***/uswds/dist/img/.
-
*Build Commands:*
Runs yarn run build-${environment} followed by yarn run build-dev.
Stage 2: Serve App with Nginx
-
*Base Image:*
Uses nginx:1.27.2-alpine.
-
*Working Directory:*
Sets working directory to /usr/share/nginx/html.
-
*Static Assets:*
Removes default nginx static assets and copies the build output along
with a custom nginx.conf from the builder stage.
-
*Port Exposure:*
Exposes port 80.
------------------------------
angular.json Changes
- *Script Inclusion and Order:*
- Adjusted the order and structure of USWDS script inclusions.
- Now includes uswds-init.min.js directly as a string and wraps
uswds.min.js within an object, changing how these scripts are
injected into the build.
------------------------------
package.json Changes
- *Dependency Updates:*
- Updated @types/node version from ^20.2.5 to ^22.10.1.
- Minor adjustments and formatting changes to other dependencies.
------------------------------
src/app/app.module.ts Changes
-
*Module and Import Cleanup:*
- Removed duplicate imports (e.g., TokenInterceptor and duplicate
instances of NgxGoogleAnalyticsModule).
- Consolidated module imports such as SolicitationModule and
AnalyticsModule to ensure they are imported only once.
- Tidied up LoggerModule configuration by removing redundant
entries.
-
*Service and Component Organization:*
- Reorganized and cleaned up service and component imports for better
maintainability.
------------------------------
src/app/home/home.module.ts Changes
-
*Expanded Module Dependencies:*
- Added Angular modules like HttpClientModule, FormsModule,
ReactiveFormsModule, and RouterModule.
- Integrated various PrimeNG modules (e.g., Button, Dropdown,
Calendar, Table, Tooltip, Dialog, Checkbox, ScrollTop) to enhance UI
components.
- Introduced third-party modules such as:
- NgxGoogleAnalyticsModule (with forRoot configuration),
- NgxGoogleAnalyticsRouterModule, and
- QuillEditorModule.
-
*Module Reorganization:*
- Reordered declarations, providers, and exports for a cleaner module
structure.
------------------------------
src/app/home/home/home.component.html Changes
- *Template Overhaul:*
-
*Hero Section Redesign:*
Updated the hero section with new classes (e.g., srt-home-head,
srt-head-display, srt-head-text) and refreshed text content.
-
*Tile Grid Layout Revamp:*
Redesigned the grid layout to include updated tiles/quick links for:
- *Manage/Review Solicitations* (with a reset analysis button),
- *View Analytics*,
- *Get Additional Resources*,
- *Contact Us*,
- *FAQ*, and
- *Administration*.
-
*Navigation and Interaction:*
Updated routerLink directives and click handlers (e.g., onClickTiles)
to support improved UI interactions.
------------------------------
src/app/home/home/home.component.scss Changes
- *Style Overhaul:*
-
*Responsive Grid Layout:*
Introduced a new responsive grid system for homepage tiles.
-
*Hero Section Styling:*
Adjusted background image, text alignment, and responsiveness of
the hero section.
-
*Card and Tile Styling:*
- Added styles for card wrappers, hover effects, and consistent
tile sizes.
- Introduced new utility classes (e.g., srt-head-position,
srt-head-padding, srt-icon-padding) to support the updated
design.
-
*Quick Links Container:*
Added styles to properly display the quick links container with
updated typography and spacing.
------------------------------
src/app/home/home/home.component.ts Changes
- *Component Logic Enhancements:*
- Added new event handlers (e.g., onClickTiles, resetAnalysis) to
manage interactions with the updated UI.
- Introduced new state properties and logic to handle file uploads
and analysis states.
------------------------------
src/app/services/file-upload.service.ts Changes
- *New Service Implementation:*
-
*Document Analysis:*
- Provides an analyzeDocuments method that sends a POST request to
the backend for document analysis.
- Uses RxJS’s firstValueFrom to convert the observable to a
promise.
-
*File Type Validation:*
- Implements a validateFileType method to check if a file is among
the allowed types (PDF, DOC, DOCX, TXT).
------------------------------
This pull request brings significant updates to the build process, cleans
up module imports and configurations, revamps the homepage UI/UX, and
introduces a new service for document analysis.
------------------------------
You can view, comment on, or merge this pull request online at:
#168
Commit Summary
- 4463b9a
<4463b9a>
feat(manual-check): add new Home page UI, file-upload service, and
Dockerfile
- 47558c0
<47558c0>
additional css changes to home page
File Changes
(10 files <https://github.com/GSA/srt-ui/pull/168/files>)
- *M* Dockerfile
<https://github.com/GSA/srt-ui/pull/168/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557>
(31)
- *M* angular.json
<https://github.com/GSA/srt-ui/pull/168/files#diff-2d2675bb4687601a5c7ccf707455132f90f3516a33716185687e5c41df59ac7d>
(10)
- *M* package.json
<https://github.com/GSA/srt-ui/pull/168/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519>
(4)
- *M* src/app/app.module.ts
<https://github.com/GSA/srt-ui/pull/168/files#diff-502d295b435b10ba99f5377504ca51149312e3cbebbbaa78ac5d925cb04cbfb0>
(72)
- *M* src/app/home/home.module.ts
<https://github.com/GSA/srt-ui/pull/168/files#diff-e1d47fb6f599b71e1bf4fc693e542decf4f32c0b67f7d8d6d9fc99119577f40b>
(72)
- *M* src/app/home/home/home.component.html
<https://github.com/GSA/srt-ui/pull/168/files#diff-cddb0df50c3f0393e41ee266df2105394cf5e4256af104243d638b33c41b48fd>
(361)
- *M* src/app/home/home/home.component.scss
<https://github.com/GSA/srt-ui/pull/168/files#diff-e0af7623a32be37352a6f23f13f13dcd8e85f96db4215c0cb2c48973769e9d32>
(285)
- *M* src/app/home/home/home.component.ts
<https://github.com/GSA/srt-ui/pull/168/files#diff-8238912fb8fde88d1b8f4bee008204781deb387976e3052ba278a1fcd1aaa8ab>
(402)
- *A* src/app/services/file-upload.service.ts
<https://github.com/GSA/srt-ui/pull/168/files#diff-896d8ca5b19b573e65e8726a31bb5b8866be062980413470fe81ea71751bc28b>
(46)
- *A* src/assets/pdf.worker.min.js
<https://github.com/GSA/srt-ui/pull/168/files#diff-2fdcd69ba8ac4a34f43064f25ea0eb219f6d03bd341d8394fdbb8789c306425a>
(56895)
Patch Links:
- https://github.com/GSA/srt-ui/pull/168.patch
- https://github.com/GSA/srt-ui/pull/168.diff
—
Reply to this email directly, view it on GitHub
<#168>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AU5UIBFDVFMHVRQU4I5BTI32OUCT7AVCNFSM6AAAAABWWUY5QSVHI2DSMVQWIX3LMV43ASLTON2WKOZSHAZTQOJTGUZDSNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think it looks good. Had a few questions but that is it.
Dockerfile
Outdated
RUN yarn run build-${environment} | ||
RUN mkdir -p ./src/assets/uswds/img/ | ||
RUN cp -r node_modules/@uswds/uswds/dist/img/* ./src/assets/uswds/img/ | ||
RUN yarn run build-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not hard code the build then all the environments will get the same build environment configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this and the explanation!
Dockerfile
Outdated
RUN yarn install | ||
|
||
# Add the source code to app | ||
COPY . /app/ | ||
|
||
# Generate the build of the application | ||
RUN yarn run build-${environment} | ||
RUN mkdir -p ./src/assets/uswds/img/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into some issues with some of the uswds assets when in development on this feature. I'm going to see what comes up when I remove this and test it out again. this should be handled during the build process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Usually, with angular you can point to the uswds node_modules folder to access that info.
src/app/app.module.ts
Outdated
import { AdminHeaderComponent } from './admin-header/admin-header.component'; | ||
import { TestModalComponent } from './test-modal/test-modal.component'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old code when building, needs to be removed
ChartModule, | ||
|
||
// Third Party Modules | ||
LoggerModule.forRoot({level: NgxLoggerLevel.DEBUG}), | ||
NgxGoogleAnalyticsModule.forRoot('G-RZRRP7Q0BH'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this, we probably could add this to the environment configuration file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarification, I meant the 'G-RZRRP7Q0BH' code for the Google Analytics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying!
src/app/home/home.module.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add all these new modules here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all had to do with getting the art-api to work on the home page. Now that the ART modal is working, I'll review and just keep what's necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very strange to me that the app.module and home.module need all of these imports. Seems redundant if that is required of angular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll confirm this and let you know what i find
src/app/home/home/home.component.ts
Outdated
/** | ||
* Handles the scroll event to create an infinite scroll effect. | ||
*/ | ||
private onInfiniteScroll(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we want infinite scroll?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No! Thank you
|
||
|
||
|
||
private prepareSolicitationData() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function packages the results with necessary metadata into a structured format. It's for navigation between screens. This was developed when we discussed having a button that would take them to a detail page of the manually reviewed solicitation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we sort of decided to not have that detail page because it would be rather empty. I like the thought behind it, so maybe we should keep it if we can find a way to provide a useful additional page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right about putting the detail page on hold for now. It'll be a key feature once we get the new model up and running, but I'm thinking we should just remove it for now since we're going to restructure everything anyway
src/app/home/home/home.component.ts
Outdated
} | ||
|
||
resetAnalysis(): void { | ||
console.log('UI: Resetting analysis state'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indents seem off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed!
if (!this.fileUploadService.validateFileType(file)) { | ||
throw new Error('Invalid file type'); | ||
} | ||
const text = await this.extractText(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good error catching here
Pull Request Summary
Dockerfile Changes
Stage 1: Compile and Build Angular Codebase (Builder Stage)
Base Image:
Uses
node:20-alpine
(unchanged).Chrome Installation for Protractor Tests:
The commands to install Chrome (via wget, apt-key, and apt-get) are commented out.
Build Dependencies:
Installs Python, make, and g++ using
apk add --no-cache
.Dependency Cleanup:
Uses a
sed
command to removephantomjs-prebuilt
frompackage.json
before installing dependencies.Asset Preparation:
Creates a directory for USWDS images (
./src/assets/uswds/img/
) and copies image assets fromnode_modules/@uswds/uswds/dist/img/
.Build Commands:
Runs
yarn run build-${environment}
followed byyarn run build-dev
.Stage 2: Serve App with Nginx
Base Image:
Uses
nginx:1.27.2-alpine
.Working Directory:
Sets working directory to
/usr/share/nginx/html
.Static Assets:
Removes default nginx static assets and copies the build output along with a custom
nginx.conf
from the builder stage.Port Exposure:
Exposes port 80.
angular.json Changes
uswds-init.min.js
directly as a string and wrapsuswds.min.js
within an object, changing how these scripts are injected into the build.package.json Changes
@types/node
version from^20.2.5
to^22.10.1
.src/app/app.module.ts Changes
Module and Import Cleanup:
TokenInterceptor
and duplicate instances ofNgxGoogleAnalyticsModule
).SolicitationModule
andAnalyticsModule
to ensure they are imported only once.Service and Component Organization:
src/app/home/home.module.ts Changes
Expanded Module Dependencies:
HttpClientModule
,FormsModule
,ReactiveFormsModule
, andRouterModule
.NgxGoogleAnalyticsModule
(withforRoot
configuration),NgxGoogleAnalyticsRouterModule
, andQuillEditorModule
.Module Reorganization:
src/app/home/home/home.component.html Changes
Hero Section Redesign:
Updated the hero section with new classes (e.g.,
srt-home-head
,srt-head-display
,srt-head-text
) and refreshed text content.Tile Grid Layout Revamp:
Redesigned the grid layout to include updated tiles/quick links for:
Navigation and Interaction:
Updated
routerLink
directives and click handlers (e.g.,onClickTiles
) to support improved UI interactions.src/app/home/home/home.component.scss Changes
Responsive Grid Layout:
Introduced a new responsive grid system for homepage tiles.
Hero Section Styling:
Adjusted background image, text alignment, and responsiveness of the hero section.
Card and Tile Styling:
srt-head-position
,srt-head-padding
,srt-icon-padding
) to support the updated design.Quick Links Container:
Added styles to properly display the quick links container with updated typography and spacing.
src/app/home/home/home.component.ts Changes
onClickTiles
,resetAnalysis
) to manage interactions with the updated UI.src/app/services/file-upload.service.ts Changes
Document Analysis:
analyzeDocuments
method that sends a POST request to the backend for document analysis.firstValueFrom
to convert the observable to a promise.File Type Validation:
validateFileType
method to check if a file is among the allowed types (PDF, DOC, DOCX, TXT).This pull request brings significant updates to the build process, cleans up module imports and configurations, revamps the homepage UI/UX, and introduces a new service for document analysis.