Skip to content

Commit

Permalink
feat: made some external link URLs configurable (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
banders authored May 16, 2024
1 parent 93e1282 commit 9761ead
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ spec:
value: {{ .Values.env.logLevel }}
- name: SNOWPLOW_URL
value: {{ .Values.env.snowplowUrl }}
- name: PAY_TRANSPARENCY_HOME_URL
value: {{ .Values.env.payTransparencyHomeUrl }}
- name: PAY_TRANSPARENCY_ACT_URL
value: {{ .Values.env.payTransparencyActUrl }}
- name: PAY_TRANSPARENCY_REGULATION_URL
value: {{ .Values.env.payTransparencyRegulationUrl }}
- name: GUIDANCE_FOR_REPORTING_WEB_URL
value: {{ .Values.env.guidanceForReportingWebUrl }}
- name: GUIDANCE_FOR_REPORTING_PDF_URL
value: {{ .Values.env.guidanceForReportingPdfUrl }}
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
Expand Down
6 changes: 5 additions & 1 deletion charts/fin-pay-transparency/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ frontend:
env:
logLevel: info
snowplowUrl: spm.apps.gov.bc.ca
payTransparencyHomeUrl: https://www2.gov.bc.ca/gov/content/gender-equity/pay-transparency-in-bc
payTransparencyActUrl: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/23018
payTransparencyRegulationUrl: https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/225_2023
guidanceForReportingWebUrl: https://www2.gov.bc.ca/gov/content/gender-equity/preparing-pay-transparency-reports
guidanceForReportingPdfUrl: https://www2.gov.bc.ca/assets/gov/british-columbians-our-governments/services-policies-for-government/gender-equity/guidance-for-pay-gap-reporting.pdf
autoscaling:
enabled: true
minReplicas: 3
Expand Down Expand Up @@ -278,7 +283,6 @@ doc-gen-service:
cpu: 100m
memory: 50Mi


podSecurityContext: {}
securityContext: {}
imagePullSecrets: []
Expand Down
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ screenshots
local.*
.env
.env.development
env.js
# Editor directories and files
.idea
.vscode
Expand All @@ -27,3 +28,4 @@ local.*
/playwright/
.env.playwright
user.json

9 changes: 8 additions & 1 deletion frontend/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
header {
Content-Type text/javascript
}
respond `window.config = {"SNOWPLOW_URL":"{$SNOWPLOW_URL}"};`
respond `window.config = {
"SNOWPLOW_URL":"{$SNOWPLOW_URL}",
"PAY_TRANSPARENCY_HOME_URL":"{$PAY_TRANSPARENCY_HOME_URL}",
"PAY_TRANSPARENCY_ACT_URL":"{$PAY_TRANSPARENCY_ACT_URL}",
"PAY_TRANSPARENCY_REGULATION_URL":"{$PAY_TRANSPARENCY_REGULATION_URL}",
"GUIDANCE_FOR_REPORTING_WEB_URL":"{$GUIDANCE_FOR_REPORTING_WEB_URL}",
"GUIDANCE_FOR_REPORTING_PDF_URL":"{$GUIDANCE_FOR_REPORTING_PDF_URL}"
};`
}
root * /app/dist
encode zstd gzip
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<a
target="_blank"
rel="noopener noreferrer"
href="https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/23018"
:href="sanitizeUrl(frontendConfig.PAY_TRANSPARENCY_ACT_URL)"
>Pay Transparency Act (gov.bc.ca)</a
>
and the
<a
target="_blank"
rel="noopener noreferrer"
href="https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/225_2023"
:href="sanitizeUrl(frontendConfig.PAY_TRANSPARENCY_REGULATION_URL)"
>Pay Transparency Regulation (gov.bc.ca)</a
>. The report can be saved for posting on your webpage or in your
workplace.
Expand Down Expand Up @@ -50,7 +50,9 @@
<a
target="_blank"
rel="noopener noreferrer"
href="https://www2.gov.bc.ca/gov/content/gender-equity/preparing-pay-transparency-reports"
:href="
sanitizeUrl(frontendConfig.GUIDANCE_FOR_REPORTING_WEB_URL)
"
>
Guidance for preparing pay transparency reports - Province of
British Columbia (gov.bc.ca)</a
Expand Down Expand Up @@ -141,6 +143,7 @@
import ReportSelectionManager from './util/DasboardReportManager.vue';
import { mapActions, mapState } from 'pinia';
import { authStore } from '../store/modules/auth';
import { sanitizeUrl } from '@braintree/sanitize-url';
import { useCodeStore } from '../store/modules/codeStore';
import { REPORT_STATUS } from '../utils/constant';
import ApiService from '../common/apiService';
Expand All @@ -156,12 +159,14 @@ import { useConfigStore } from '../store/modules/config';
type DashboardData = {
reports: IReport[];
userInfo?: any;
frontendConfig: any;
};
export default {
components: { ReportSelectionManager },
data: (): DashboardData => ({
reports: [],
frontendConfig: (window as any).config,
}),
computed: {
...mapState(useReportStepperStore, ['reportId']),
Expand All @@ -175,6 +180,7 @@ export default {
this.getReports();
},
methods: {
sanitizeUrl: sanitizeUrl,
...mapActions(useReportStepperStore, ['setReportInfo', 'reset', 'setMode']),
...mapActions(useConfigStore, ['loadConfig']),
formatDate(value, format = 'MMMM d, YYYY') {
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<li>2026: all employers with 50 employees or more</li>
</ul>
</p>
<p class="text-subtitle-2 mb-2">This tool enables you to easily create a pay transparency report as required under the <a target="_blank" rel="noopener noreferrer" href="https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/23018">Pay Transparency Act</a> and <a target="_blank" rel="noopener noreferrer" href="https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/225_2023">Regulation</a>.</p>
<p class="text-subtitle-2 mb-4">Below is an overview of the three steps required to produce your pay transparency report. For additional information please visit <a target="_blank" rel="noopener noreferrer" href="https://www2.gov.bc.ca/gov/content/gender-equity/pay-transparency-in-bc">Pay Transparency in B.C.</a></p>
<p class="text-subtitle-2 mb-2">This tool enables you to easily create a pay transparency report as required under the <a target="_blank" rel="noopener noreferrer" :href="sanitizeUrl(frontendConfig.PAY_TRANSPARENCY_ACT_URL)">Pay Transparency Act</a> and <a target="_blank" rel="noopener noreferrer" :href="sanitizeUrl(frontendConfig.PAY_TRANSPARENCY_REGULATION_URL)">Regulation</a>.</p>
<p class="text-subtitle-2 mb-4">Below is an overview of the three steps required to produce your pay transparency report. For additional information please visit <a target="_blank" rel="noopener noreferrer" :href="sanitizeUrl(frontendConfig.PAY_TRANSPARENCY_HOME_URL)">Pay Transparency in B.C.</a></p>
<v-btn
id="login-button"
class="btn-primary"
Expand Down Expand Up @@ -96,11 +96,10 @@

<v-row class="mt-8 mb-2">
<v-col class="d-flex justify-center pt-10">

<div v-show="stage == 'UPLOAD'">
<h3 class="mb-4">Upload your company's data</h3>
<p class="mb-8">
Please review the <a target="_blank" rel="noopener" href="https://www2.gov.bc.ca/assets/gov/british-columbians-our-governments/services-policies-for-government/gender-equity/guidance-for-pay-gap-reporting.pdf">Guidance for Preparing Pay Transparency Reports</a> to ensure you understand what must be in your report. You will also be able to include general information about your organization and any constraints or limitations with your data (For example: At ____, no overtime hours are permitted). When you are ready, upload a file of your employee data in comma-separated value (CSV) format.
Please review the <a target="_blank" rel="noopener" :href="sanitizeUrl(frontendConfig.GUIDANCE_FOR_REPORTING_PDF_URL)">Guidance for Preparing Pay Transparency Reports</a> to ensure you understand what must be in your report. You will also be able to include general information about your organization and any constraints or limitations with your data (For example: At ____, no overtime hours are permitted). When you are ready, upload a file of your employee data in comma-separated value (CSV) format.
</p>
<v-btn class="btn-secondary" href="SampleCsv.csv" download>
Download sample CSV
Expand All @@ -109,7 +108,7 @@
<p v-show="stage == 'REVIEW'">
<h3 class="mb-4">Review and validate</h3>
<p class="mb-8">
Please carefully review any error messages and confirm the information you provided is accurate before moving forward. The <a target="_blank" rel="noopener" href="https://www2.gov.bc.ca/assets/gov/british-columbians-our-governments/services-policies-for-government/gender-equity/guidance-for-pay-gap-reporting.pdf">Guidance for Preparing Pay Transparency Reports</a> details what must be included in your report.
Please carefully review any error messages and confirm the information you provided is accurate before moving forward. The <a target="_blank" rel="noopener" :href="sanitizeUrl(frontendConfig.GUIDANCE_FOR_REPORTING_PDF_URL)">Guidance for Preparing Pay Transparency Reports</a> details what must be included in your report.
</P>
</p>
<p v-show="stage == 'GENERATE'">
Expand Down Expand Up @@ -163,13 +162,15 @@ export default {
appTitle: 'Pay Transparency Reporting',
authRoutesLogin: sanitizeUrl(AuthRoutes.LOGIN_BCEID),
stage: "UPLOAD",
imageSource: uploadpng
imageSource: uploadpng,
frontendConfig: window.config
};
},
computed: {
...mapState(authStore, ['isAuthenticated']),
},
methods: {
sanitizeUrl: sanitizeUrl,
clearStorageAndRedirectToLogin() {
authStore().setJwtToken();
window.location.href = this.authRoutesLogin;
Expand Down
15 changes: 10 additions & 5 deletions frontend/src/components/__tests__/Dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { expect, describe, it, vi, beforeEach } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import { render, waitFor, fireEvent } from '@testing-library/vue';
import Dashboard from '../Dashboard.vue';
import { createTestingPinia } from '@pinia/testing';
import { authStore } from '../../store/modules/auth';
import { DateTimeFormatter, LocalDate } from '@js-joda/core';
import { Locale } from '@js-joda/locale_en';
import { createTestingPinia } from '@pinia/testing';
import { fireEvent, render, waitFor } from '@testing-library/vue';
import { authStore } from '../../store/modules/auth';
import Dashboard from '../Dashboard.vue';

//mock window.config
Object.defineProperty(window, 'config', {
value: {},
});

const pinia = createTestingPinia();
const mockRouterPush = vi.fn();
Expand Down

0 comments on commit 9761ead

Please sign in to comment.