Skip to content

Commit

Permalink
fix: sessions duration filter
Browse files Browse the repository at this point in the history
  • Loading branch information
fdewas-aneo committed Dec 13, 2024
1 parent 2f8f77b commit 21e35fa
Show file tree
Hide file tree
Showing 33 changed files with 156 additions and 144 deletions.
2 changes: 1 addition & 1 deletion src/app/applications/components/table.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<app-table [trackBy]="trackBy" [columns]="displayedColumns" [data]="data" [total]="total" [options]="options"
<app-table [trackBy]="trackBy" [columns]="columns" [data]="data()" [total]="total()" [options]="options"
[lockColumns]="lockColumns" [actions]="actions" [statusesGroups]="statusesGroups" (optionsChange)="onOptionsChange()"
(personnalizeTasksByStatus)="personalizeTasksByStatus()" (columnDrop)="onDrop($event)" />
2 changes: 1 addition & 1 deletion src/app/applications/components/table.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('TasksTableComponent', () => {
});

it('should get data', () => {
expect(component.data).toEqual(mockApplicationsDataService.data);
expect(component.data()).toEqual(mockApplicationsDataService.data);
});

it('should get total', () => {
Expand Down
1 change: 1 addition & 0 deletions src/app/applications/components/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export class ApplicationsTableComponent extends AbstractTaskByStatusTableCompone
];

ngOnInit(): void {
this.initTableDataService();
this.initStatuses();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/applications/index.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-index-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
14 changes: 7 additions & 7 deletions src/app/applications/services/applications-data.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('ApplicationDataService', () => {

describe('initialisation', () => {
it('should load data from the cache', () => {
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
name: 'application1',
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('ApplicationDataService', () => {
});

it('should set the total cached data', () => {
expect(service.total).toEqual(cachedApplications.total);
expect(service.total()).toEqual(cachedApplications.total);
});
});

Expand All @@ -107,12 +107,12 @@ describe('ApplicationDataService', () => {

it('should update the total', () => {
service.refresh$.next();
expect(service.total).toEqual(applications.total);
expect(service.total()).toEqual(applications.total);
});

it('should update the data', () => {
service.refresh$.next();
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
name: 'application1',
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('ApplicationDataService', () => {
const emptyApplications = { applications: undefined, total: 0 } as unknown as ListApplicationsResponse;
mockApplicationsGrpcService.list$.mockReturnValueOnce(of(emptyApplications));
service.refresh$.next();
expect(service.data).toEqual([]);
expect(service.data()).toEqual([]);
});

it('should catch errors', () => {
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('ApplicationDataService', () => {
});

it('should load correctly', () => {
expect(service.loading).toBeFalsy();
expect(service.loading()).toBeFalsy();
});

describe('Applying filters', () => {
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('ApplicationDataService', () => {
it('should apply the filters correctly when transforming the data', () => {
service.filters = filters;
service.refresh$.next();
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
name: 'application1',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-dashboard-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-dashboard-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-dashboard-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-dashboard-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-dashboard-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
2 changes: 1 addition & 1 deletion src/app/partitions/components/table.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<app-table [trackBy]="trackBy" [columns]="displayedColumns" [data]="data" [total]="total" [lockColumns]="lockColumns" [options]="options"
<app-table [trackBy]="trackBy" [columns]="columns" [data]="data()" [total]="total()" [lockColumns]="lockColumns" [options]="options"
(columnDrop)="onDrop($event)" (optionsChange)="onOptionsChange()" [statusesGroups]="statusesGroups"
(personnalizeTasksByStatus)="personalizeTasksByStatus()" />
1 change: 1 addition & 0 deletions src/app/partitions/components/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class PartitionsTableComponent extends AbstractTaskByStatusTableComponent
table: TableTasksByStatus = 'partitions';

ngOnInit(): void {
this.initTableDataService();
this.initStatuses();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/partitions/index.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-index-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
14 changes: 7 additions & 7 deletions src/app/partitions/services/partitions-data.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('PartitionsDataService', () => {

describe('initialisation', () => {
it('should load data from the cache', () => {
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
id: 'partition1',
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('PartitionsDataService', () => {
});

it('should set the total cached data', () => {
expect(service.total).toEqual(cachedPartitions.total);
expect(service.total()).toEqual(cachedPartitions.total);
});
});

Expand All @@ -111,12 +111,12 @@ describe('PartitionsDataService', () => {

it('should update the total', () => {
service.refresh$.next();
expect(service.total).toEqual(partitions.total);
expect(service.total()).toEqual(partitions.total);
});

it('should update the data', () => {
service.refresh$.next();
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
id: 'partition1',
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('PartitionsDataService', () => {
const partitions = { partitions: undefined, total: 0} as unknown as ListPartitionsResponse;
mockPartitionsGrpcService.list$.mockReturnValueOnce(of(partitions));
service.refresh$.next();
expect(service.data).toEqual([]);
expect(service.data()).toEqual([]);
});

it('should catch errors', () => {
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('PartitionsDataService', () => {
});

it('should load correctly', () => {
expect(service.loading).toBeFalsy();
expect(service.loading()).toBeFalsy();
});

describe('Applying filters', () => {
Expand Down Expand Up @@ -234,7 +234,7 @@ describe('PartitionsDataService', () => {
it('should apply the filters correctly when transforming the data', () => {
service.filters = filters;
service.refresh$.next();
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
id: 'partition1',
Expand Down
2 changes: 1 addition & 1 deletion src/app/results/components/table.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<app-table [trackBy]="trackBy" [columns]="displayedColumns" [data]="data" [total]="total"
<app-table [trackBy]="trackBy" [columns]="columns" [data]="data()" [total]="total()"
[options]="options" [lockColumns]="lockColumns" (optionsChange)="onOptionsChange()"
[statusesService]="statusesService" (columnDrop)="onDrop($event)" />
2 changes: 1 addition & 1 deletion src/app/results/components/table.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('TasksTableComponent', () => {
});

it('should get data', () => {
expect(component.data).toEqual(mockResultsDataService.data);
expect(component.data()).toEqual(mockResultsDataService.data);
});

it('should get total', () => {
Expand Down
8 changes: 6 additions & 2 deletions src/app/results/components/table.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ResultRawEnumField } from '@aneoconsultingfr/armonik.api.angular';
import { Component, inject } from '@angular/core';
import { Component, OnInit, inject } from '@angular/core';
import { AbstractTableComponent } from '@app/types/components/table';
import { ArmonikData } from '@app/types/data';
import { TableComponent } from '@components/table/table.component';
Expand All @@ -20,10 +20,14 @@ import { ResultRaw } from '../types';
TableComponent,
]
})
export class ResultsTableComponent extends AbstractTableComponent<ResultRaw, ResultRawEnumField> {
export class ResultsTableComponent extends AbstractTableComponent<ResultRaw, ResultRawEnumField> implements OnInit {
readonly tableDataService = inject(ResultsDataService);
readonly statusesService = inject(ResultsStatusesService);

ngOnInit(): void {
this.initTableDataService();
}

isDataRawEqual(value: ResultRaw, entry: ResultRaw): boolean {
return value.resultId === entry.resultId;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/results/index.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-index-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
12 changes: 6 additions & 6 deletions src/app/results/services/results-data.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('ResultsDataService', () => {

describe('initialisation', () => {
it('should load data from the cache', () => {
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
resultId: 'result1'
Expand All @@ -77,7 +77,7 @@ describe('ResultsDataService', () => {
});

it('should set the total cached data', () => {
expect(service.total).toEqual(cachedResults.total);
expect(service.total()).toEqual(cachedResults.total);
});
});

Expand All @@ -89,12 +89,12 @@ describe('ResultsDataService', () => {

it('should update the total', () => {
service.refresh$.next();
expect(service.total).toEqual(results.total);
expect(service.total()).toEqual(results.total);
});

it('should update the data', () => {
service.refresh$.next();
expect(service.data).toEqual([
expect(service.data()).toEqual([
{
raw: {
resultId: 'result1'
Expand All @@ -117,7 +117,7 @@ describe('ResultsDataService', () => {
const emptyResults = { results: undefined, total: 0 } as unknown as ListResultsResponse;
mockResultsGrpcService.list$.mockReturnValueOnce(of(emptyResults));
service.refresh$.next();
expect(service.data).toEqual([]);
expect(service.data()).toEqual([]);
});

it('should catch errors', () => {
Expand Down Expand Up @@ -162,6 +162,6 @@ describe('ResultsDataService', () => {
});

it('should load correctly', () => {
expect(service.loading).toBeFalsy();
expect(service.loading()).toBeFalsy();
});
});
2 changes: 1 addition & 1 deletion src/app/sessions/components/table.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<app-table [trackBy]="trackBy" [columns]="displayedColumns" [data]="data" [total]="total" [options]="options" [lockColumns]="lockColumns"
<app-table [trackBy]="trackBy" [columns]="columns" [data]="data()" [total]="total()" [options]="options" [lockColumns]="lockColumns"
[actions]="actions" [statusesService]="statusesService" [statusesGroups]="statusesGroups"
(columnDrop)="onDrop($event)" (optionsChange)="onOptionsChange()" (personnalizeTasksByStatus)="personalizeTasksByStatus()" />
2 changes: 1 addition & 1 deletion src/app/sessions/components/table.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ describe('SessionsTableComponent', () => {
});

it('should get data', () => {
expect(component.data).toEqual(mockSessionsDataService.data);
expect(component.data()).toEqual(mockSessionsDataService.data);
});

it('should get total', () => {
Expand Down
1 change: 1 addition & 0 deletions src/app/sessions/components/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class SessionsTableComponent extends AbstractTaskByStatusTableComponent<S
];

ngOnInit(): void {
this.initTableDataService();
this.initStatuses();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/sessions/index.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<mat-toolbar>
<mat-toolbar-row>
<app-table-index-actions-toolbar
[loading]="loading"
[loading]="loading()"
[refreshTooltip]="autoRefreshTooltip()"
[intervalValue]="intervalValue"
[columnsLabels]="columnsLabels"
Expand Down
Loading

0 comments on commit 21e35fa

Please sign in to comment.