Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c17a943
replaced jobs table with dynamic mat table
abdimo101 May 12, 2026
a366f2c
sourcery changes
abdimo101 May 12, 2026
5fa8505
added a cypress file for jobs with cypress commands
abdimo101 May 18, 2026
cb646d7
small fixes
abdimo101 May 18, 2026
fc730e7
fixed spec test
abdimo101 May 18, 2026
c0f22f7
cypress fix: changed jobType to align with what has been configured i…
abdimo101 Jun 10, 2026
3c4a2b0
cypress fix: updated removeJobs and removed .only
abdimo101 Jun 10, 2026
32a8a1c
Merge branch 'master' into replace-jobs-table-with-dynamic-mat-table
abdimo101 Jun 10, 2026
b00667b
cypress fix: trying a different pid_prefix from env.backend.e2e
abdimo101 Jun 15, 2026
ca93be9
Merge branch 'replace-jobs-table-with-dynamic-mat-table' of github.co…
abdimo101 Jun 15, 2026
e7877ac
cypress fix: removed pid_prefix
abdimo101 Jun 15, 2026
27260e8
added jobConfig and mounted it to docker compose file
abdimo101 Jun 15, 2026
721a28b
changed jobconfig file name
abdimo101 Jun 15, 2026
80058a5
wip: added env variable
abdimo101 Jun 15, 2026
abce7b3
resolved pid mismatch
abdimo101 Jun 15, 2026
85c83c3
only testing jobs-general file and enabled cypress video
abdimo101 Jun 15, 2026
759b410
changed to the correct test path
abdimo101 Jun 15, 2026
b2eeb5e
wip: checking first cypress error msg
abdimo101 Jun 17, 2026
1503471
wip: removing local prefix
abdimo101 Jun 17, 2026
37aa314
removed cypress video and single cypress test
abdimo101 Jun 17, 2026
ca7c4e0
copilot review suggestions added
abdimo101 Jun 24, 2026
a73b6f9
eslint fix
abdimo101 Jun 24, 2026
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
<shared-table
<dynamic-mat-table
[tableName]="tableName"
[columns]="columns"
[dataSource]="dataSource"
[columnsdef]="columns"
[pageSize]="5"
(rowClick)="onRowClick($event)"
[pagination]="pagination"
[pagingMode]="paginationMode"
[setting]="setting"
[pending]="pending"
[rowSelectionMode]="rowSelectionMode"
[showGlobalTextSearch]="true"
[globalTextSearch]="globalTextSearch"
[globalTextSearchPlaceholder]="'Initiator, Type, Parameters...'"
(globalTextSearchChange)="onGlobalTextSearchChange($event)"
(globalTextSearchApply)="onGlobalTextSearchAction()"
(onRowEvent)="onRowEvent($event)"
(settingChange)="onSettingChange($event)"
(paginationChange)="onPaginationChange($event)"
[emptyMessage]="'No jobs available'"
[emptyIcon]="'folder'"
class="mat-elevation-z2"
>
</shared-table>
</dynamic-mat-table>
125 changes: 89 additions & 36 deletions src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,85 @@
import { NO_ERRORS_SCHEMA } from "@angular/compiler";
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ActivatedRoute, Router } from "@angular/router";
import { AppConfigService } from "app-config.service";
import {
MockActivatedRoute,
MockAppConfigService,
MockAuthService,
MockHttp,
MockRouter,
} from "shared/MockStubs";
import { ExportExcelService } from "shared/services/export-excel.service";
ComponentFixture,
TestBed,
inject,
waitForAsync,
} from "@angular/core/testing";

import { JobsDashboardNewComponent } from "./jobs-dashboard-new.component";
import { SharedTableModule } from "shared/modules/shared-table/shared-table.module";
import { SharedScicatFrontendModule } from "shared/shared.module";
import { HttpClient } from "@angular/common/http";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { InternalStorage } from "shared/services/auth/base.storage";
import { AuthService } from "shared/services/auth/auth.service";
import { provideLuxonDateAdapter } from "@angular/material-luxon-adapter";
import { MockStore } from "shared/MockStubs";
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { StoreModule, Store } from "@ngrx/store";
import { Router } from "@angular/router";
import { FlexLayoutModule } from "@ngbracket/ngx-layout";
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Outdated
import { MatButtonModule } from "@angular/material/button";
import { MatIconModule } from "@angular/material/icon";
import { AppConfigService } from "app-config.service";
import { ScicatDataService } from "shared/services/scicat-data-service";
import { ExportExcelService } from "shared/services/export-excel.service";
import { RowEventType } from "shared/modules/dynamic-material-table/models/table-row.model";
import { provideMockStore } from "@ngrx/store/testing";
import { selectJobsDashboardPageViewModel } from "state-management/selectors/jobs.selectors";

const getConfig = () => ({});

describe("JobsDashboardNewComponent", () => {
let component: JobsDashboardNewComponent;
let fixture: ComponentFixture<JobsDashboardNewComponent>;

beforeEach(waitForAsync(() => {
const appconfig = new MockAppConfigService(null);
const authService = new MockAuthService();
const router = {
navigateByUrl: jasmine.createSpy("navigateByUrl"),
};
let store: MockStore;

const jobsVm = {
jobs: [],
count: 0,
currentPage: 0,
jobsPerPage: 5,
filters: {
skip: 0,
limit: 5,
sortField: "creationTime:desc",
mode: undefined,
},
tableSettings: { columns: [] },
};

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
schemas: [NO_ERRORS_SCHEMA],
declarations: [JobsDashboardNewComponent],
imports: [
SharedTableModule,
SharedScicatFrontendModule,
BrowserAnimationsModule,
FlexLayoutModule,
MatButtonModule,
MatIconModule,
StoreModule.forRoot({}),
],
providers: [
{ provide: ActivatedRoute, useClass: MockActivatedRoute },
{ provide: ExportExcelService, useValue: {} },
{ provide: Router, useClass: MockRouter },
{ provide: HttpClient, useClass: MockHttp },
{ provide: AppConfigService, useValue: appconfig },
{ provide: AuthService, useValue: authService },
{ provide: InternalStorage },
provideLuxonDateAdapter(),
],
}).compileComponents();
declarations: [JobsDashboardNewComponent],
});

TestBed.overrideComponent(JobsDashboardNewComponent, {
set: {
providers: [
{
provide: Router,
useValue: router,
},
{
provide: AppConfigService,
useValue: { getConfig },
},
{ provide: ScicatDataService, useValue: {} },
{ provide: ExportExcelService, useValue: {} },
provideMockStore({
selectors: [
{ selector: selectJobsDashboardPageViewModel, value: jobsVm },
],
}),
],
},
});

TestBed.compileComponents();
}));

beforeEach(() => {
Expand All @@ -54,11 +88,30 @@ describe("JobsDashboardNewComponent", () => {
fixture.detectChanges();
});

beforeEach(inject([Store], (mockStore: MockStore) => {
store = mockStore;
}));

afterEach(() => {
fixture.destroy();
});

it("should create", () => {
expect(component).toBeTruthy();
});

describe("#onRowEvent", () => {
it("should navigate to a Job detail", () => {
const job = { id: "job-1" };
const id = encodeURIComponent(job.id);

component.onRowEvent({
event: RowEventType.RowClick,
sender: { row: job },
} as any);

expect(router.navigateByUrl).toHaveBeenCalledTimes(1);
expect(router.navigateByUrl).toHaveBeenCalledWith("/user/jobs/" + id);
});
});
});
Loading
Loading