Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into jmo-grant-digest-adju…
Browse files Browse the repository at this point in the history
…stments
  • Loading branch information
jeffsmohan committed Mar 18, 2024
2 parents 7a757e8 + f890580 commit cc12543
Show file tree
Hide file tree
Showing 11 changed files with 1,366 additions and 1,168 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
env:
CI: "true"
- name: Run linter
run: yarn lint
run: yarn lint --no-fix

tflint:
name: Lint terraform
Expand Down
103 changes: 74 additions & 29 deletions packages/client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,65 +34,110 @@ module.exports = {
{
files: [
// File list to ignore generated by `yarn run lint --no-fix --format unix | sed -E 's/:.+//g' | uniq`
'./src/App.vue',
// then organized by hand into reasonable chunks of work

// ARPA Reporter: app files
'./src/arpa_reporter/App.vue',
'./src/arpa_reporter/components/Navigation.vue',

// ARPA Reporter: basic components
'./src/arpa_reporter/components/AlertBox.vue',
'./src/arpa_reporter/components/DownloadButton.vue',
'./src/arpa_reporter/components/DownloadFileButton.vue',
'./src/arpa_reporter/components/DownloadFileButtonSmall.vue',
'./src/arpa_reporter/components/DownloadTemplateBtn.vue',
'./src/arpa_reporter/components/Navigation.vue',
'./src/arpa_reporter/components/StandardForm.vue',
'./src/arpa_reporter/views/Agencies.vue',
'./src/arpa_reporter/views/Agency.vue',

// ARPA Reporter: home/login/validation views
'./src/arpa_reporter/views/Home.vue',
'./src/arpa_reporter/views/Login.vue',
'./src/arpa_reporter/views/Validation.vue',

// ARPA Reporter: new views
'./src/arpa_reporter/views/NewTemplate.vue',
'./src/arpa_reporter/views/NewUpload.vue',

// ARPA Reporter: agency views
'./src/arpa_reporter/views/Agencies.vue',
'./src/arpa_reporter/views/Agency.vue',

// ARPA Reporter: reporting period views
'./src/arpa_reporter/views/ReportingPeriod.vue',
'./src/arpa_reporter/views/ReportingPeriods.vue',

// ARPA Reporter: subrecipient views
'./src/arpa_reporter/views/Subrecipient.vue',
'./src/arpa_reporter/views/Subrecipients.vue',

// ARPA Reporter: upload views
'./src/arpa_reporter/views/Upload.vue',
'./src/arpa_reporter/views/Uploads.vue',

// ARPA Reporter: user views
'./src/arpa_reporter/views/User.vue',
'./src/arpa_reporter/views/Users.vue',
'./src/arpa_reporter/views/Validation.vue',
'./src/components/GrantsTable.vue',

// ARPA Reporter: annual performance reporter
'./src/views/ArpaAnnualPerformanceReporter.vue',

// Grant Finder: app files
'./src/App.vue',
'./src/main.js',
'./src/components/Layout.vue',

// Grant Finder: core views
'./src/views/Home.vue',
'./src/views/Login.vue',
'./src/views/NotFound.vue',

// Grant Finder: grants tables
'./src/views/Grants.vue',
'./src/views/MyGrants.vue',
'./src/components/GrantsTable.vue',

// Grant Finder: search modals
'./src/components/Modals/AddKeyword.vue',
'./src/components/Modals/AddOrganization.vue',
'./src/components/Modals/SavedSearchPanel.vue',
'./src/components/Modals/SearchPanel.vue',
'./src/components/SearchFilter.vue',

// Grant Finder: teams
'./src/views/Teams.vue',
'./src/components/Modals/AddTeam.vue',
'./src/components/Modals/AddUser.vue',
'./src/components/Modals/EditOrganization.vue',
'./src/components/Modals/EditTeam.vue',
'./src/components/Modals/EditUser.vue',
'./src/components/Modals/GrantDetailsLegacy.vue',
'./src/components/Modals/ImportTeams.vue',
'./src/components/Uploader.vue',

// Grant Finder: users
'./src/views/Users.vue',
'./src/components/Modals/AddUser.vue',
'./src/components/Modals/EditUser.vue',
'./src/components/Modals/ImportUsers.vue',

// Grant Finder: organizations
'./src/views/Organizations.vue',
'./src/components/Modals/AddOrganization.vue',
'./src/components/Modals/EditOrganization.vue',

// Grant Finder: grant details
'./src/views/GrantDetails.vue',
'./src/components/Modals/GrantDetailsLegacy.vue',

// Grant Finder: profile
'./src/views/MyProfile.vue',
'./src/components/Modals/ProfileSettings.vue',
'./src/components/Modals/SavedSearchPanel.vue',
'./src/components/Modals/SearchPanel.vue',
'./src/components/SearchFilter.vue',
'./src/components/Uploader.vue',
'./src/components/UserAvatar.vue',
'./src/main.js',
'./src/views/ArpaAnnualPerformanceReporter.vue',

// Grant Finder: dashboard
'./src/views/Dashboard.vue',
'./src/views/EligibilityCodes.vue',
'./src/views/GrantDetails.vue',
'./src/views/Grants.vue',
'./src/views/Home.vue',
'./src/views/Keywords.vue',
'./src/views/Login.vue',
'./src/views/MyGrants.vue',
'./src/views/MyProfile.vue',
'./src/views/NotFound.vue',
'./src/views/Organizations.vue',
'./src/views/RecentActivity.vue',
'./src/views/Teams.vue',
'./src/views/UpcomingClosingDates.vue',
'./src/views/Users.vue',
'./src/components/ActivityTable.vue',
'./src/components/ClosingDatesTable.vue',

// DELETE -- no longer used
'./src/views/EligibilityCodes.vue',
'./src/views/Keywords.vue',
],
rules: {
// List of essential rules we previously had turned off
Expand Down
49 changes: 21 additions & 28 deletions packages/client/src/arpa_reporter/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,37 @@
<div class="row">
<AlertBox v-if="alert" :text="alert.text" :level="alert.level" v-on:dismiss="clearAlert" />
</div>
<div class="row mt-5 mb-5" v-if="viewingOpenPeriod">
<div class="col" v-if="this.$route.query.sync_treasury_download && isAdmin">
<DownloadButton :href="downloadTreasuryReportURL()" class="btn btn-primary btn-block">Download Treasury Report</DownloadButton>

<div class="row border border-danger rounded m-3 mb-3 p-3" v-if="!viewingOpenPeriod">
<div class="col" id="closedReportingPeriodMessage">
This reporting period is closed.
</div>
</div>

<div class="row mt-5 mb-5" v-if="viewingOpenPeriod || isAdmin">
<div class="col" v-if="isAdmin">
<button class="btn btn-primary btn-block" @click="sendTreasuryReport" :disabled="sending" id="sendTreasuryReportButton">
<span v-if="sending">Sending...</span>
<span v-else>Send Treasury Report by Email</span>
</button>
</div>

<div class="col" v-if="this.$route.query.sync_audit_download && isAdmin">
<DownloadButton :href="downloadAuditReportURL()" class="btn btn-info btn-block">Download Audit Report</DownloadButton>
</div>

<div class="col" v-if="isAdmin">
<button class="btn btn-info btn-block" @click="sendAuditReport" :disabled="sending" id="sendAuditReportButton">
<span v-if="sending">Sending...</span>
<span v-else>Send Audit Report by Email</span>
</button>
</div>

<div class="col">
<button @click.prevent="startUpload" class="btn btn-primary btn-block" id="submitWorkbookButton">Submit Workbook</button>
<div class="col" v-if="viewingOpenPeriod">
<button @click.prevent="startUpload" class="btn btn-primary btn-block" id="submitWorkbookButton" :disabled="!viewingOpenPeriod">Submit Workbook</button>
</div>

<div class="col">
<div class="col" v-if="viewingOpenPeriod">
<DownloadTemplateBtn :block="true" />
</div>
</div>

<div class="row border border-danger rounded m-3 mb-3 p-3" v-else>
<div class="col" id="closedReportingPeriodMessage">
This reporting period is closed.
</div>
</div>

<p id="welcomeToArpaReporter">
Welcome to the ARPA reporter.
To get started, click the "Download Empty Template" button, above, to get a copy of an empty template for reporting.
Expand All @@ -60,9 +53,7 @@
</template>

<script>
import { apiURL } from '@/helpers/fetchApi';
import AlertBox from '../components/AlertBox.vue';
import DownloadButton from '../components/DownloadButton.vue';
import DownloadTemplateBtn from '../components/DownloadTemplateBtn.vue';
import { getJson } from '../store/index';
Expand Down Expand Up @@ -98,14 +89,16 @@ export default {
clearAlert() {
this.alert = null;
},
downloadAuditReportURL() {
return apiURL('/api/audit_report');
},
async sendAuditReport() {
this.sending = true;
try {
const result = await getJson('/api/audit_report?queue=true');
const periodId = this.$store.getters.viewPeriod.id || 0;
const query = new URLSearchParams({ queue: true });
if (periodId && !this.viewingOpenPeriod) {
query.set('period_id', periodId);
}
const result = await getJson(`/api/audit_report?${query}`);
if (result.error) {
this.alert = {
Expand All @@ -129,15 +122,16 @@ export default {
this.sending = false;
},
downloadTreasuryReportURL() {
const periodId = this.$store.getters.viewPeriod.id || 0;
return apiURL(`/api/exports?period_id=${periodId}`);
},
async sendTreasuryReport() {
this.sending = true;
try {
const result = await getJson('/api/exports?queue=true');
const periodId = this.$store.getters.viewPeriod.id || 0;
const query = new URLSearchParams({ queue: true });
if (periodId && !this.viewingOpenPeriod) {
query.set('period_id', periodId);
}
const result = await getJson(`/api/exports?${query}`);
if (result.error) {
this.alert = {
Expand Down Expand Up @@ -168,7 +162,6 @@ export default {
},
},
components: {
DownloadButton,
DownloadTemplateBtn,
AlertBox,
},
Expand Down
12 changes: 0 additions & 12 deletions packages/client/src/assets/adjust-vue-select.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,3 @@
.vs__open-indicator {
cursor: pointer;
}

.vs__search::placeholder {
color: #878787;
}

.vs__dropdown-option--disabled {
text-transform: uppercase;
font-size: 12px;
}
.vs__dropdown-option--disabled:not(:first-child) {
margin-top: 12px;
}
32 changes: 26 additions & 6 deletions packages/client/src/helpers/gtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
// Note that the 'set' command does not appear to do anything (despite Google documentation to the contrary) so all
// runtime reconfiguration is being performed via 'config'.

function gtag(...args) {
if (typeof window.gtag === 'function' && window.APP_CONFIG?.GOOGLE_TAG_ID) {
window.gtag(...args);
if (window.APP_CONFIG?.GOOGLE_ANALYTICS_DEBUG) {
console.log(`[Google Analytics] Emitted ${args[0]} with:`, ...args.slice(1));
}
} else if (window.APP_CONFIG?.GOOGLE_ANALYTICS_DEBUG) {
console.log(`[Google Analytics][DISABLED] Would have emitted ${args[0]} with:`, ...args.slice(1));
}
}

/**
* If Google Analytics are enabled, calls the config command on the appropriate Google tag.
* If called repeatedly, appears to update the config by performing a deep merge of the existing config with the new.
Expand All @@ -13,12 +24,10 @@
*/
export function gtagConfig(config) {
// See index.html for the definition of the gtag function.
if (typeof window.gtag === 'function' && window.APP_CONFIG?.GOOGLE_TAG_ID) {
window.gtag('config', window.APP_CONFIG.GOOGLE_TAG_ID, {
...(window.APP_CONFIG?.GOOGLE_ANALYTICS_DEBUG ? { debug_mode: true } : {}),
...config,
});
}
gtag('config', window.APP_CONFIG.GOOGLE_TAG_ID, {
...(window.APP_CONFIG?.GOOGLE_ANALYTICS_DEBUG ? { debug_mode: true } : {}),
...config,
});
}

export function setUserForGoogleAnalytics(user) {
Expand All @@ -30,3 +39,14 @@ export function setUserForGoogleAnalytics(user) {
},
});
}

/**
* Emits a Google Analytics GA4 custom event. Google also defines some reserved param names to be aware of,
* such as `event_callback` to execute code once the event has been logged: https://developers.google.com/tag-platform/gtagjs/reference/parameters
*
* @param {string} eventName Canonical name of the event to emit
* @param {object} eventParams Metadata to associate with this event
*/
export function gtagEvent(eventName, eventParams) {
gtag('event', eventName, eventParams);
}
Loading

0 comments on commit cc12543

Please sign in to comment.