Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into liz/fe-smoc-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
liztownd committed Jan 2, 2025
2 parents 4ee6a3a + 4c13d79 commit 4d50f7b
Show file tree
Hide file tree
Showing 459 changed files with 8,071 additions and 4,445 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/cd-deploy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Continuous Deploy Production Test Workflow

on:
workflow_dispatch:
inputs:
commit_sha:
description: Deploy specific commit
required: true

jobs:
get-workflow-environment:
runs-on: ubuntu-latest
outputs:
environment_name: ${{ steps.check-environment.outputs.env_name }}
steps:
- name: Check environment
id: check-environment
run: |
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo env_name='production' >> $GITHUB_OUTPUT
else
echo env_name='' >> $GITHUB_OUTPUT
fi
deploy:
name: Deploy
if: ${{ github.event.client_payload.github_ref == 'refs/heads/main' }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0

- name: Install dependencies
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Check if commit can be deployed
id: check-deployability
run: node ./script/github-actions/check-deployability.js
env:
BUILDTYPE: vagovprod

- name: Configure AWS credentials (1)
if: steps.check-deployability.outputs.is_deployable == 'true'
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1


- name: Get AWS IAM role
if: steps.check-deployability.outputs.is_deployable == 'true'
uses: ./.github/workflows/inject-secrets
with:
ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_PROD_ROLE
env_variable_name: AWS_FRONTEND_PROD_ROLE

- name: Configure AWS Credentials (2)
if: steps.check-deployability.outputs.is_deployable == 'true'
uses: ./.github/workflows/configure-aws-credentials
with:
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-gov-west-1
role: ${{ env.AWS_FRONTEND_NONPROD_ROLE != '' && env.AWS_FRONTEND_NONPROD_ROLE || env.AWS_FRONTEND_PROD_ROLE }}
role_duration: 900
session_name: vsp-frontendteam-githubaction

- name: Deploy
if: steps.check-deployability.outputs.is_deployable == 'true'
run: ./script/github-actions/partial-deploy.sh -s $SRC -d $DEST -a $ASSET_DEST -v

env:
SRC: s3://vetsgov-website-builds-s3-upload/${{ github.event.client_payload.github_sha }}/vagovprod.tar.bz2
DEST: s3://www.va.gov
ASSET_DEST: s3://prod-va-gov-assets

notify-failure:
name: Notify Failure
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' && (failure() || cancelled()) }}
needs: [deploy]
env:
ALERT_TEAMS: true # Alerts teams for single/grouped app builds when set to true
DEVOPS_CHANNEL_ID: C37M86Y8G #devops-deploys
VETS_WEBSITE_CHANNEL_ID: C02V265VCGH #status-vets-website

steps:
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
fetch-depth: 0

- name: Install dependencies
if: env.ALERT_TEAMS == 'true'
uses: ./.github/workflows/install
timeout-minutes: 30
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Get changed applications
id: get-changed-apps
if: env.ALERT_TEAMS == 'true'
uses: ./.github/workflows/get-changed-apps
with:
output-type: 'slack_group'

- name: Notify application team in Slack
if: env.ALERT_TEAMS == 'true' && steps.get-changed-apps.outputs.slack_groups != ''
uses: department-of-veterans-affairs/platform-release-tools-actions/slack-notify@main
continue-on-error: true
with:
payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "${{steps.get-changed-apps.outputs.slack_groups}} CI for your application failed on the `main` branch in `vets-website`: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{github.run_id}}>\n For help troubleshooting, see the <https://depo-platform-documentation.scrollhelp.site/developer-docs/Handling-failed-single%2Fgrouped-application-pipelines.2066645150.html|documentation> on failed workflow runs."}}]}]}'
channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Notify Slack
if: steps.get-changed-apps.outputs.slack_groups == ''
uses: department-of-veterans-affairs/platform-release-tools-actions/slack-notify@main
continue-on-error: true
with:
payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "`main` branch CI in `vets-website` failed: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{github.run_id}}>"}}]}]}'
channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
aws_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1 change: 0 additions & 1 deletion .github/workflows/continuous-deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
repository_dispatch:
types: [cd-production-deploy]


jobs:
deploy:
name: Deploy
Expand Down
1 change: 1 addition & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
"test": {
"presets": ["@babel/env", "@babel/preset-react"],
"plugins": [
["babel-plugin-transform-import-ignore", { "patterns": [".scss", ".css", ".sass"] }],
["istanbul", { "exclude": ["**/tests/**/*", "**/mocks/**/*"] }],
"transform-class-properties",
"dynamic-import-node",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"babel-plugin-lodash": "^3.2.8",
"babel-plugin-module-resolver": "^5.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-import-ignore": "^1.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-polyfill": "^6.26.0",
"browserify-zlib": "^0.2.0",
Expand Down Expand Up @@ -261,7 +262,7 @@
"@babel/runtime": "^7.15.4",
"@datadog/browser-logs": "^5.8.0",
"@datadog/browser-rum": "^4.49.0",
"@department-of-veterans-affairs/component-library": "^48.2.0",
"@department-of-veterans-affairs/component-library": "^48.3.0",
"@department-of-veterans-affairs/css-library": "^0.16.1",
"@department-of-veterans-affairs/react-jsonschema-form": "^1.2.5",
"@department-of-veterans-affairs/va-forms-system-core": "1.6.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -185,28 +185,22 @@ export const formConfig = {
path: 'options-selection',
uiSchema: addOrRemoveDependents.uiSchema,
schema: addOrRemoveDependents.schema,
depends: () =>
!window.location.pathname.includes('review-and-submit'),
},
addDependentOptions: {
hideHeaderRow: true,
title: 'What do you like to do?',
path: 'options-selection/add-dependents',
uiSchema: addDependentOptions.uiSchema,
schema: addDependentOptions.schema,
depends: form =>
form?.['view:addOrRemoveDependents']?.add &&
!window.location.pathname.includes('review-and-submit'),
depends: form => form?.['view:addOrRemoveDependents']?.add,
},
removeDependentOptions: {
hideHeaderRow: true,
title: 'What do you like to do?',
path: 'options-selection/remove-dependents',
uiSchema: removeDependentOptions.uiSchema,
schema: removeDependentOptions.schema,
depends: form =>
form?.['view:addOrRemoveDependents']?.remove &&
!window.location.pathname.includes('review-and-submit'),
depends: form => form?.['view:addOrRemoveDependents']?.remove,
},
},
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,47 +1,66 @@
import React from 'react';
import { connect } from 'react-redux';
import RoutedSavableApp from 'platform/forms/save-in-progress/RoutedSavableApp';
import { VA_FORM_IDS } from '@department-of-veterans-affairs/platform-forms/constants';
// import manifest from '../manifest.json';
import { useBrowserMonitoring } from '~/platform/utilities/real-user-monitoring';
import { useFeatureToggle } from '~/platform/utilities/feature-toggles';
import manifest from '../manifest.json';
import formConfig from '../config/form';
import { DOC_TITLE } from '../config/constants';

function App({ location, children, isLoading, featureToggles, savedForms }) {
function App({
location,
children,
isLoggedIn,
isLoading,
vaFileNumber,
featureToggles,
}) {
const { TOGGLE_NAMES } = useFeatureToggle();
useBrowserMonitoring({
location,
toggleName: TOGGLE_NAMES.disablityBenefitsBrowserMonitoringEnabled,
});

// Must match the H1
document.title = DOC_TITLE;

// Handle loading
if (isLoading || !featureToggles || featureToggles.loading) {
return <va-loading-indicator message="Loading your information..." />;
}

const flipperV2 = featureToggles.vaDependentsV2;
const hasV1Form = savedForms.some(
form => form.form === VA_FORM_IDS.FORM_21_686C,
);
const hasV2Form = savedForms.some(
form => form.form === VA_FORM_IDS.FORM_21_686CV2,
);

const shouldUseV2 = hasV2Form || (flipperV2 && !hasV1Form);
if (!shouldUseV2) {
if (!featureToggles.vaDependentsV2) {
window.location.href = '/view-change-dependents/add-remove-form-21-686c/';
return <></>;
}

return (
const content = (
<article id="form-686c" data-location={`${location?.pathname?.slice(1)}`}>
<RoutedSavableApp formConfig={formConfig} currentLocation={location}>
{children}
</RoutedSavableApp>
</article>
);

// If on intro page, just return
if (location.pathname === '/introduction') {
return content;
}

// If a user is not logged in OR
// a user is logged in, but hasn't gone through va file number validation
// redirect them to the introduction page.
if (
!isLoggedIn ||
(isLoggedIn && !vaFileNumber?.hasVaFileNumber?.VALIDVAFILENUMBER)
) {
document.location.replace(`${manifest.rootUrl}`);
return (
<va-loading-indicator message="Redirecting to introduction page..." />
);
}

return content;
}

const mapStateToProps = state => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@import "~@department-of-veterans-affairs/css-library/dist/tokens/scss/variables";
@import "~@department-of-veterans-affairs/css-library/dist/stylesheets/modules/m-process-list";
@import "~@department-of-veterans-affairs/css-library/dist/stylesheets/modules/m-form-process";
@import "../../../../platform/forms/sass/m-schemaform";
@import "../../../platform/forms/sass/m-schemaform";
@import "~@department-of-veterans-affairs/css-library/dist/stylesheets/modules/m-modal";
@import "~@department-of-veterans-affairs/css-library/dist/stylesheets/modules/m-omb-info";
@import "../../../../platform/forms/sass/m-form-confirmation";
@import "../../../platform/forms/sass/m-form-confirmation";

// a11y - Change gray box to white box with gray border.
// Needed because when using a web component which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import startReactApp from '@department-of-veterans-affairs/platform-startup/reac
import { connectFeatureToggle } from 'platform/utilities/feature-toggles';

import './sass/accredited-representative-portal.scss';
import './sass/POARequestsCard.scss';
import './sass/POARequestCard.scss';
import './sass/POARequestDetails.scss';

import manifest from './manifest.json';
Expand Down
21 changes: 21 additions & 0 deletions src/applications/accredited-representative-portal/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';

let user = null;

export async function fetchUser() {
try {
user = await apiRequest('/accredited_representative_portal/v0/user');
return user;
} catch (error) {
user = null;
throw error;
}
}

export function getUser() {
return user;
}

export function isAuthenticated() {
return user !== null;
}
Loading

0 comments on commit 4d50f7b

Please sign in to comment.