Skip to content

Commit

Permalink
Merge pull request #1998 from fecgov/release/sprint-43
Browse files Browse the repository at this point in the history
Release/sprint 43
  • Loading branch information
dheitzer authored Jun 18, 2024
2 parents d08a3b1 + 0f81725 commit c1bcf3c
Show file tree
Hide file tree
Showing 82 changed files with 2,144 additions and 1,388 deletions.
2 changes: 2 additions & 0 deletions front-end/cypress/e2e/pages/loginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function legacyLogin() {
});

cy.visit('/');
cy.get('#dropdownMenuButton').click();
cy.get('[data-test="debug-login-button"]').click();
cy.get(fieldEmail).type(email);
cy.get(fieldCommittee).type(committeeID);
cy.get(fieldPassword).type(testPassword).type('{enter}');
Expand Down
1,994 changes: 1,095 additions & 899 deletions front-end/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3",
"class-transformer": "^0.5.1",
"fecfile-validate": "https://github.com/fecgov/fecfile-validate#2b8765a913034f90f1475394f5aea9a2fa349f50",
"fecfile-validate": "https://github.com/fecgov/fecfile-validate#0f8b966b623fbca644aebb2054fe4829eb0e0a93",
"intl-tel-input": "^23.0.4",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<app-table
title="Existing Users"
title="Existing users"
[items]="items"
[totalItems]="totalItems"
[loading]="loading"
Expand All @@ -18,10 +18,10 @@
<ng-template #toolbar>
<p-toolbar>
<ng-template pTemplate="left">
<h1 class="m-0">Manage Users</h1>
<h1 class="m-0">Manage users</h1>
</ng-template>
<ng-template pTemplate="right">
<button (click)="addItem()" class="p-button" icon="pi pi-plus" label="Add User" pButton pRipple></button>
<button (click)="addItem()" class="add-button" icon="pi pi-plus" label="Add user" pButton pRipple></button>
</ng-template>
</p-toolbar>
</ng-template>
Expand Down
22 changes: 11 additions & 11 deletions front-end/src/app/contacts/contact-list/contact-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ng-template #toolbar>
<p-toolbar>
<ng-template pTemplate="left">
<h1 class="m-0">Manage Contacts</h1>
<h1 class="m-0">Manage contacts</h1>
</ng-template>
<ng-template pTemplate="right">
<button
Expand Down Expand Up @@ -53,7 +53,7 @@ <h1 class="m-0">Manage Contacts</h1>
></button>
</ng-template>
<ng-template #header>
<th id="buttons" role="columnheader" style="text-align: center">Delete</th>
<th id="actions" role="columnheader">Actions</th>
</ng-template>
<ng-template #body let-item>
<td>
Expand All @@ -63,15 +63,15 @@ <h1 class="m-0">Manage Contacts</h1>
<td>{{ item.candidate_id || item.committee_id }}</td>
<td>{{ item.employer }}</td>
<td>{{ item.occupation }}</td>
<td style="text-align: center">
<p-button
icon="pi pi-trash"
[text]="true"
[ngClass]="{ disabled: !canDeleteItem(item) }"
pTooltip="This contact can not be deleted because it has associated transactions or reports."
[tooltipDisabled]="canDeleteItem(item)"
(onClick)="canDeleteItem(item) && deleteItem(item)"
></p-button>
<td>
<app-table-actions-button
[tableActions]="rowActions"
[actionItem]="item"
(tableActionClick)="onRowActionClick($event.action, $event.actionItem)"
buttonIcon="pi pi-ellipsis-v"
buttonStyleClass="flex justify-content-center p-button-rounded p-button-primary p-button-text mr-2"
[buttonAriaLabel]="'edit ' + displayName(item)"
></app-table-actions-button>
</td>
</ng-template>
</app-table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ describe('ContactListComponent', () => {
expect(component).toBeTruthy();
});

it('should test TableAction behavior', () => {
const deleteAction = component.rowActions[1];
expect(deleteAction.isAvailable()).toBe(true);
expect(deleteAction.isEnabled(contact)).toBe(true);
contact.has_transaction_or_report = true;
expect(deleteAction.isEnabled(contact)).toBe(false);
});

it('#addItem opens the dialog to add an item', () => {
component.isNewItem = false;
component.addItem();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, ElementRef } from '@angular/core';
import { TableListBaseComponent } from 'app/shared/components/table-list-base/table-list-base.component';
import { TableAction, TableListBaseComponent } from 'app/shared/components/table-list-base/table-list-base.component';
import { ConfirmationService, MessageService } from 'primeng/api';
import { ListRestResponse } from 'app/shared/models/rest-api.model';
import { LabelList, LabelUtils, PrimeOptions } from 'app/shared/utils/label.utils';
Expand Down Expand Up @@ -27,6 +27,16 @@ export class ContactListComponent extends TableListBaseComponent<Contact> {
ContactTypes.INDIVIDUAL,
]);

public rowActions: TableAction[] = [
new TableAction('Edit', this.editItem.bind(this)),
new TableAction(
'Delete',
this.deleteItem.bind(this),
() => true,
(contact: Contact) => this.canDeleteItem(contact),
),
];

sortableHeaders: { field: string; label: string }[] = [
{ field: 'sort_name', label: 'Name' },
{ field: 'type', label: 'Type' },
Expand Down
3 changes: 2 additions & 1 deletion front-end/src/app/layout/banner/banner.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
font-family: karla, sans-serif;
margin-bottom: 0;
margin-top: 0;
font-size: 0.9rem;
font-size: 13px;
line-height: 1.1;
}

Expand Down Expand Up @@ -114,6 +114,7 @@

.usa-banner__button-text {
text-decoration: underline;
font-size: 13px;
}

.usa-banner__icon {
Expand Down
9 changes: 7 additions & 2 deletions front-end/src/app/layout/footer/footer.component.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.full-version {
position: absolute;
bottom: 0;
width: 100%;
}

Expand All @@ -21,12 +20,18 @@ footer label {
}

#footer-lower {
height: 234px;
height: 300px;
background-color: #164f85;
padding: 5px;
padding-left: 28px;
}

@media (min-width: 768px) {
#footer-lower {
height: 234px;
}
}

#fec-seal {
height: 100px;
width: 100px;
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/app/layout/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light px-2 py-0">
<button class="seal-link navbar-brand">
<button class="seal-link navbar-brand pb-0">
<img ngSrc="assets/img/seal-and-title.svg" class="seal-and-title mr-2" alt="FEC Seal" height="48" width="181" />
</button>
<button
Expand Down
4 changes: 2 additions & 2 deletions front-end/src/app/layout/layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<!-- End Sidebar section -->

<!-- Begin No Sidebar section -->
<div *ngIf="!layoutControls.showSidebar" class="content-offset">
<div *ngIf="!layoutControls.showSidebar" id="content-offset">
<div class="container">
<div class="header-container" *ngIf="layoutControls.showHeader">
<app-header [headerStyle]="layoutControls.headerStyle"></app-header>
Expand All @@ -45,7 +45,7 @@
</div>
</div>
<div class="grid">
<div class="col-12 router-outlet">
<div class="col-12 router-outlet p-0">
<router-outlet></router-outlet>
</div>
</div>
Expand Down
8 changes: 2 additions & 6 deletions front-end/src/app/layout/layout.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

.header-container {
padding: 0 32px 5px 32px;
padding: 0 32px 64px 32px;
}

.row {
Expand All @@ -29,10 +29,6 @@ app-footer {
min-height: 100vh;
}

.content-offset {
padding-bottom: 314px;
}

.sidebar-content-container {
min-height: calc(100vh - 2rem);
width: 100%;
Expand All @@ -41,7 +37,7 @@ app-footer {
}

.login-background {
background-color: #ece8e8;
background-color: #ffffff;
max-height: 100vh;
}

Expand Down
27 changes: 24 additions & 3 deletions front-end/src/app/layout/layout.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Component, OnInit, ViewChild, AfterViewChecked, RendererFactory2, Renderer2 } from '@angular/core';

import { NavigationEnd, Router } from '@angular/router';
import { DestroyerComponent } from 'app/shared/components/app-destroyer.component';
Expand All @@ -18,13 +18,34 @@ export enum BackgroundStyles {
templateUrl: './layout.component.html',
styleUrls: ['./layout.component.scss'],
})
export class LayoutComponent extends DestroyerComponent implements OnInit {
export class LayoutComponent extends DestroyerComponent implements OnInit, AfterViewChecked {
@ViewChild(FeedbackOverlayComponent) feedbackOverlay!: FeedbackOverlayComponent;

layoutControls = new LayoutControls();
private renderer: Renderer2;

constructor(private router: Router) {
constructor(
private router: Router,
rendererFactory: RendererFactory2,
) {
super();
this.renderer = rendererFactory.createRenderer(null, null);
}
ngAfterViewChecked(): void {
this.updateContentOffset();
}

updateContentOffset() {
if (this.layoutControls.showSidebar) return;
const contentOffset = this.renderer.selectRootElement('#content-offset', true);
if (!contentOffset) return;
const height = contentOffset.offsetHeight;
let headerFooterOffset = window.innerWidth < 768 ? 332 : 265;
if (this.layoutControls.showUpperFooter) headerFooterOffset += 80;
const marginBottom = Math.max(64, window.innerHeight - height - headerFooterOffset);

// Apply the margin-bottom to the div
contentOffset.style.marginBottom = marginBottom + 'px';
}

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="col-12">
<div class="title-2">REPORT PROGRESS</div>
<div class="report-type">{{ formLabel }}</div>
<div class="sub-heading">{{ report_code | reportCodeLabel }}</div>
<div class="sub-heading">{{ subLabel }}</div>
<div class="sub-heading">
{{ coverage_from_date | fecDate }} — <wbr />
{{ coverage_through_date | fecDate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { MenuItem } from 'primeng/api';
import { Report } from '../../../../shared/models/report.model';
import { ReportService } from '../../../../shared/services/report.service';
import { ReportSidebarSection, SidebarState } from '../../sidebar.component';
import { F3xReportCodes } from 'app/shared/utils/report-code.utils';
import { AbstractMenuComponent } from '../abstract-menu.component';
import { takeUntil } from 'rxjs';
import { Form3X } from '../../../../shared/models/form-3x.model';
Expand All @@ -17,7 +16,7 @@ import { Router } from '@angular/router';
})
export class F3XMenuComponent extends AbstractMenuComponent implements OnInit {
formLabel?: string;
report_code?: F3xReportCodes;
subLabel?: string;
coverage_from_date?: Date;
coverage_through_date?: Date;

Expand All @@ -31,7 +30,7 @@ export class F3XMenuComponent extends AbstractMenuComponent implements OnInit {
if (!this.activeReport$) return;
this.activeReport$.pipe(takeUntil(this.destroy$)).subscribe((report) => {
this.formLabel = report?.formLabel;
this.report_code = (report as Form3X).report_code;
this.subLabel = report?.formSubLabel;
this.coverage_from_date = (report as Form3X).coverage_from_date;
this.coverage_through_date = (report as Form3X).coverage_through_date;
});
Expand Down
2 changes: 2 additions & 0 deletions front-end/src/app/login/login.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { CheckboxModule } from 'primeng/checkbox';
import { LoginRoutingModule } from './login-routing.module';
import { InputTextModule } from 'primeng/inputtext';
import { PasswordModule } from 'primeng/password';
import { DialogModule } from 'primeng/dialog';

@NgModule({
declarations: [LoginComponent, DebugLoginComponent, SecurityNoticeComponent],
Expand All @@ -28,6 +29,7 @@ import { PasswordModule } from 'primeng/password';
CheckboxModule,
InputTextModule,
PasswordModule,
DialogModule,
],
})
export class LoginModule {}
Loading

0 comments on commit c1bcf3c

Please sign in to comment.