Skip to content
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

199 frontend module refactor homepage design #200

Merged
merged 8 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions apps/frontend/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
routerLinkActive="active"
routerLink="email-receiver"
class="nav-text"
>Email Receiver</span
>Email Receiver</span
>
</button>
</clr-dropdown-menu>
Expand All @@ -41,10 +41,19 @@
clrVerticalNavLink
clrAriaCurrentLink
routerLink="/"
[routerLinkActiveOptions]="{ exact: true }"
routerLinkActive="active"
class="nav-link"
><span class="nav-text">Overview</span></a
>
><span class="nav-text">Overview</span></a>
<a
clrVerticalNavLink
clrAriaCurrentLink
routerLink="/backup-statistics"
[routerLinkActiveOptions]="{ exact: true }"
routerLinkActive="active"
class="nav-link"
><span class="nav-text">Backup Statistics</span>
</a>
</clr-vertical-nav-group-children>
</clr-vertical-nav-group>

Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('AppComponent', () => {

it('should have navigation items', () => {
const navItems = fixture.debugElement.queryAll(By.css('.nav-text'));
const expectedNavItems = ['Dashboard', 'Overview', 'Upload', 'Find Data'];
const expectedNavItems = ['Dashboard', 'Overview', 'Backup Statistics', 'Upload', 'Find Data'];

// Use a Set to get unique nav item texts
const uniqueNavItems = [
Expand All @@ -67,7 +67,7 @@ describe('AppComponent', () => {

it('should have router links configured', () => {
const routerLinks = fixture.debugElement.queryAll(By.css('[routerLink]'));
const expectedRoutes = ['/', '/', '/upload', '/findData'];
const expectedRoutes = ['/', '/', '/backup-statistics', '/upload', '/findData'];

routerLinks.forEach((link, index) => {
expect(link.nativeElement.getAttribute('routerLink')).toBe(
Expand Down
20 changes: 12 additions & 8 deletions apps/frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
envelopeIcon,
errorStandardIcon,
filterIcon,
helpIcon,
homeIcon,
lockIcon,
plusIcon,
Expand All @@ -30,23 +31,24 @@ import {
import { NgxEchartsModule } from 'ngx-echarts';
import { TestUploadComponent } from './test-upload/component/test-upload/test-upload.component';
import { FindTestDataComponent } from './test-upload/component/find-test-data/find-test-data.component';
import { BackupsComponent } from './backups-overview/component/backups.component';
import { OverviewPageComponent } from './backups-overview-page/component/overview-page.component';
import { BASE_URL } from './shared/types/configuration';
import { AlertComponent } from './alert/component/alert.component';
import { AlertComponent } from './backups-overview-page/component/alert-panel/component/alert.component';
import { NotificationSettingsComponent } from './management/components/settings/notification-settings/notification-settings.component';
import { EmailReceiverSettingsComponent } from './management/components/settings/email-receiver-settings/email-receiver-settings.component';
import { ConfirmDialogComponent } from './shared/components/confirm-dialog/component/confirm-dialog/confirm-dialog.component';
import { DataStoresComponent } from './data-stores/component/data-stores.component';
import { InformationPanelComponent } from './backups-overview/component/information-panel/information-panel.component';
import { BackupTableComponent } from './backups-overview/component/backup-table/backup-table.component';
import { SidePanelComponent } from './backups-overview/component/side-panel/side-panel.component';
import { DataStoresComponent } from './backups-overview-page/component/data-stores-panel/data-stores.component';
import { InformationPanelComponent } from './backups-overview-page/component/information-panel/information-panel.component';
import { BackupTableComponent } from './backup-statistics-page/component/backup-table/backup-table.component';
import { SidePanelComponent } from './shared/components/filter-side-panel/side-panel.component';
import { BackupStatisticsPageComponent } from './backup-statistics-page/component/backup-statistics-page.component';

@NgModule({
declarations: [
AppComponent,
TestUploadComponent,
FindTestDataComponent,
BackupsComponent,
OverviewPageComponent,
AlertComponent,
NotificationSettingsComponent,
EmailReceiverSettingsComponent,
Expand All @@ -55,6 +57,7 @@ import { SidePanelComponent } from './backups-overview/component/side-panel/side
InformationPanelComponent,
BackupTableComponent,
SidePanelComponent,
BackupStatisticsPageComponent
],
imports: [
BrowserModule,
Expand Down Expand Up @@ -88,7 +91,8 @@ export class AppModule {
envelopeIcon,
plusIcon,
lockIcon,
trashIcon
trashIcon,
helpIcon
);
}
}
6 changes: 4 additions & 2 deletions apps/frontend/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Route } from '@angular/router';
import { TestUploadComponent } from './test-upload/component/test-upload/test-upload.component';
import { FindTestDataComponent } from './test-upload/component/find-test-data/find-test-data.component';
import { BackupsComponent } from './backups-overview/component/backups.component';
import { OverviewPageComponent } from './backups-overview-page/component/overview-page.component';
import { EmailReceiverSettingsComponent } from './management/components/settings/email-receiver-settings/email-receiver-settings.component';
import { BackupStatisticsPageComponent } from './backup-statistics-page/component/backup-statistics-page.component';

export const appRoutes: Route[] = [
{ path: 'upload', component: TestUploadComponent },
{ path: 'findData', component: FindTestDataComponent },
{ path: 'email-receiver', component: EmailReceiverSettingsComponent},
{ path: '', component: BackupsComponent },
{ path: 'backup-statistics', component: BackupStatisticsPageComponent },
{ path: '', component: OverviewPageComponent },

];
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.header {
background-color: white;
justify-content: space-around;
position: relative;
}

.card-block {
padding: 20px;
}

.clr-form-control {
margin-top: 0;
}

.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}

.card-header-title {
margin: 0;
font-weight: 500;
}

.card-header-actions {
display: flex;
align-items: center;
}

:host ::ng-deep .card-header {
border-bottom: none !important;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<h1 class="header">Backups Overview</h1>
<div class="alert-info-section">
<app-alert class="alert-panel"></app-alert>
<app-information-panel class="info"></app-information-panel>
</div>
<h1 class="header">Backups Statistics</h1>

<div class="clr-row">
<app-data-stores class="clr-col-12"></app-data-stores>
<app-backup-table class="clr-col-lg-12 clr-col-lg-12"></app-backup-table>
</div>

<div class="clr-row">
Expand All @@ -27,7 +23,7 @@ <h1 class="header">Backups Overview</h1>
</div>
<div class="card-block">
<div
id="overviewSizeColumnChart"
id="backupStatisticsPageSizeColumnChart"
class="mt-4"
style="width: 100%; height: 400px"
></div>
Expand All @@ -53,13 +49,10 @@ <h1 class="header">Backups Overview</h1>
</div>

<div class="card-block">
<div id="overviewSizePieChart" style="width: 100%; height: 400px"></div>
<div id="backupStatisticsPageSizePieChart" style="width: 100%; height: 400px"></div>
</div>
</div>
</div>
</div>
<div class="clr-row">
<app-backup-table class="clr-col-lg-12 clr-col-lg-12"></app-backup-table>
</div>

<app-side-panel [isOpen]="filterPanel" [charts]="charts"></app-side-panel>
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { TestBed } from '@angular/core/testing';
import { BackupStatisticsPageComponent } from './backup-statistics-page.component';

import { BackupsComponent } from './backups.component';

describe('BackupsComponent', () => {
let component: BackupsComponent;
describe('BackupStatisticsPageComponent', () => {
let component: BackupStatisticsPageComponent;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [BackupsComponent],
providers: [BackupStatisticsPageComponent],
});

component = TestBed.inject(BackupsComponent);
component = TestBed.inject(BackupStatisticsPageComponent);
});

it('should create the component', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { ChartInformation } from '../../shared/types/chartInformation';
import { ChartType } from '../../shared/enums/chartType';
import { SidePanelComponent } from '../../shared/components/filter-side-panel/side-panel.component';
import { BehaviorSubject } from 'rxjs';
import { BackupTask } from '../../shared/types/backup.task';

@Component({
selector: 'app-backup-statistics-page',
templateUrl: './backup-statistics-page.component.html',
styleUrl: './backup-statistics-page.component.css',
})
export class BackupStatisticsPageComponent implements AfterViewInit {
@ViewChild(SidePanelComponent) sidePanelComponent!: SidePanelComponent;
backupTaskSubject$: BehaviorSubject<BackupTask[]> | undefined;
protected filterPanel = false;

readonly charts: ChartInformation[] = [
{
id: 'backupStatisticsPageSizePieChart',
type: ChartType.SIZEPIECHART,
},
{
id: 'backupStatisticsPageSizeColumnChart',
type: ChartType.SIZECOLUMNCHART,
},
];

ngAfterViewInit(): void {
this.backupTaskSubject$ = this.sidePanelComponent.backupTaskSubject$;
}

/**
* Change the state of the filter panel to open or close it
*/
protected changeFilterPanelState(): void {
this.filterPanel = !this.filterPanel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { BackupTableComponent } from './backup-table.component';
import { Backup } from '../../../shared/types/backup';
import { APIResponse } from '../../../shared/types/api-response';
import { BackupType } from '../../../shared/enums/backup.types';
import { BackupService } from '../../service/backup-service/backup-service.service';
import { BackupService } from '../../../shared/services/backup-service/backup-service.service';
import { ClrDatagridStateInterface } from '@clr/angular';
import { CustomFilter } from '../backupfilter';
import { CustomFilter } from '../../../backups-overview-page/component/backupfilter';

describe('BackupTableComponent', () => {
let component: BackupTableComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { CustomFilter } from '../backupfilter';
import { CustomFilter } from '../../../backups-overview-page/component/backupfilter';
import {
BehaviorSubject,
combineLatest,
Expand All @@ -12,7 +12,7 @@ import {
} from 'rxjs';
import { APIResponse } from '../../../shared/types/api-response';
import { Backup } from '../../../shared/types/backup';
import { BackupService } from '../../service/backup-service/backup-service.service';
import { BackupService } from '../../../shared/services/backup-service/backup-service.service';
import { BackupFilterParams } from '../../../shared/types/backup-filter-type';
import { BackupType } from '../../../shared/enums/backup.types';
import { ClrDatagridSortOrder, ClrDatagridStateInterface } from '@clr/angular';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { beforeEach, describe, expect, it, Mock, vi } from 'vitest';
import { AlertComponent } from './alert.component';
import { of } from 'rxjs';
import { Alert, SizeAlert } from '../../shared/types/alert';
import { Alert, SizeAlert } from '../../../../shared/types/alert';
import { randomUUID } from 'crypto';
import { SeverityType } from '../../shared/enums/severityType';
import { SeverityType } from '../../../../shared/enums/severityType';

describe('AlertComponent', () => {
let component: AlertComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { AlertServiceService } from '../service/alert-service.service';
import { AlertServiceService } from '../../../../shared/services/alert-service/alert-service.service';
import {
Alert,
CreationDateAlert,
SizeAlert,
StorageFillAlert,
} from '../../shared/types/alert';
} from '../../../../shared/types/alert';
import { DatePipe } from '@angular/common';
import { Subject, takeUntil, tap } from 'rxjs';
import { SeverityType } from '../../shared/enums/severityType';
import { SeverityType } from '../../../../shared/enums/severityType';

@Component({
selector: 'app-alert',
Expand All @@ -21,9 +21,9 @@ export class AlertComponent implements OnInit, OnDestroy {
readonly DAYS = 7;

alerts: Alert[] = [];
criticalAlertsCount: number = 0;
warningAlertsCount: number = 0;
infoAlertsCount: number = 0;
criticalAlertsCount = 0;
warningAlertsCount = 0;
infoAlertsCount = 0;

status: 'OK' | 'Warning' | 'Critical' = 'OK';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

.progress-bar-container {
position: relative;
width: 70%;
width: 100%;
display: inline-block;
vertical-align: middle;
--clr-progress-bg-color: #C6DCF2;
Expand All @@ -34,7 +34,7 @@
}

.card-header {
background-color: #f5f5f5;
background-color: #f3f8fb;
padding: 10px;
border-bottom: 1px solid #dcdcdc;
display: flex;
Expand All @@ -51,7 +51,7 @@
}

.card-footer {
background-color: #f5f5f5;
background-color: #f3f8fb;
border-top: 1px solid #dcdcdc;
text-align: right;
border-bottom-left-radius: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, Mock, vi } from 'vitest';
import { of } from 'rxjs';
import { randomUUID } from 'crypto';
import { DataStoresComponent } from './data-stores.component';
import { DataStore } from '../../shared/types/data-store';
import { DataStore } from '../../../shared/types/data-store';

const dataStores: DataStore[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnDestroy } from '@angular/core';
import { DataStoresService } from '../service/data-stores-service.service';
import { DataStoresService } from '../../../shared/services/data-stores-service/data-stores-service.service';
import { map, Observable, shareReplay, Subject, takeUntil } from 'rxjs';
import { DataStore } from '../../shared/types/data-store';
import { DataStore } from '../../../shared/types/data-store';

@Component({
selector: 'app-data-stores',
Expand Down
Loading
Loading