diff --git a/src/app/datasets/admin-tab/admin-tab.component.ts b/src/app/datasets/admin-tab/admin-tab.component.ts index 468745310..8bfb10474 100644 --- a/src/app/datasets/admin-tab/admin-tab.component.ts +++ b/src/app/datasets/admin-tab/admin-tab.component.ts @@ -45,24 +45,11 @@ export class AdminTabComponent implements OnInit, OnDestroy { .subscribe((user) => { if (user && this.dataset) { const job = new Job(); - job.emailJobInitiator = user.email; - job.jobParams = {}; - job.jobParams["username"] = user.username; - job.creationTime = new Date(); + job.createdBy = user.username; + job.createdAt = new Date(); job.type = "reset"; - const fileObj: FileObject = { - pid: "", - files: [], - }; - const fileList: string[] = []; - fileObj.pid = this.dataset["pid"]; - if (this.dataset["datablocks"]) { - this.dataset["datablocks"].map((d) => { - fileList.push(d["archiveId"]); - }); - } - fileObj.files = fileList; - job.datasetList = [fileObj]; + job.jobParams = {}; + job.jobParams["datasetIds"] = [this.dataset["pid"]]; console.log(job); this.store.dispatch(submitJobAction({ job })); } diff --git a/src/app/datasets/archiving.service.spec.ts b/src/app/datasets/archiving.service.spec.ts index f13153cc7..4bdb90035 100644 --- a/src/app/datasets/archiving.service.spec.ts +++ b/src/app/datasets/archiving.service.spec.ts @@ -48,10 +48,7 @@ describe("ArchivingService", () => { it("should create a new object of type Job", () => { const user = new User({ username: "testName", email: "test@email.com" }); const datasets = [new Dataset()]; - const datasetList = datasets.map((dataset) => ({ - pid: dataset.pid, - files: [], - })); + const datasetList = datasets.map((dataset) => dataset.pid); const archive = true; const destinationPath = { destinationPath: "/test/path/" }; @@ -63,9 +60,8 @@ describe("ArchivingService", () => { ); expect(job).toBeInstanceOf(Job); - expect(job["emailJobInitiator"]).toEqual("test@email.com"); - expect(job["jobParams"]["username"]).toEqual("testName"); - expect(job["datasetList"]).toEqual(datasetList); + expect(job["createdBy"]).toEqual("testName"); + expect(job["jobParams"]["datasetIds"]).toEqual(datasetList); expect(job["type"]).toEqual("archive"); }); }); @@ -85,16 +81,12 @@ describe("ArchivingService", () => { const user = new User({ username: "testName", email: "test@email.com" }); const datasets = [new Dataset()]; - const datasetList = datasets.map((dataset) => ({ - pid: dataset.pid, - files: [], - })); + const datasetList = datasets.map((dataset) => dataset.pid); const archive = true; const job = new Job({ - jobParams: { username: user.username }, - emailJobInitiator: user.email, - creationTime: new Date(), - datasetList, + jobParams: { datasetIds: datasetList }, + createdBy: user.username, + createdAt: new Date(), type: "archive", }); const createJobSpy = spyOn( diff --git a/src/app/datasets/archiving.service.ts b/src/app/datasets/archiving.service.ts index 8913c3b9c..81ed4797e 100644 --- a/src/app/datasets/archiving.service.ts +++ b/src/app/datasets/archiving.service.ts @@ -27,7 +27,7 @@ export class ArchivingService { ): Job { const extra = archive ? {} : destinationPath; const jobParams = { - username: user.username, + datasetIds: datasets.map((dataset) => dataset.pid), ...extra, }; @@ -37,12 +37,8 @@ export class ArchivingService { const data = { jobParams, - emailJobInitiator: user.email, + createdBy: user.username, // Revise this, files == []...? See earlier version of this method in dataset-table component for context - datasetList: datasets.map((dataset) => ({ - pid: dataset.pid, - files: [], - })), type: archive ? "archive" : "retrieve", }; diff --git a/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts b/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts index bfb2e2ce0..b1faffb85 100644 --- a/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts +++ b/src/app/datasets/datafiles-actions/datafiles-action.component.spec.ts @@ -177,7 +177,7 @@ describe("1000: DatafilesActionComponent", () => { beforeEach(() => { fixture = TestBed.createComponent(DatafilesActionComponent); component = fixture.componentInstance; - component.files = structuredClone(actionFiles); + component.files = JSON.parse(JSON.stringify(actionFiles)); component.actionConfig = actionsConfig[0]; component.actionDataset = actionDataset; component.maxFileSize = lowerMaxFileSizeLimit; @@ -476,7 +476,7 @@ describe("1000: DatafilesActionComponent", () => { component.maxFileSize = lowerMaxFileSizeLimit; break; } - component.files = structuredClone(actionFiles); + component.files = JSON.parse(JSON.stringify(actionFiles)); switch (selectedFiles) { case selectedFilesType.file1: component.files[0].selected = true; diff --git a/src/app/datasets/datafiles/datafiles.component.ts b/src/app/datasets/datafiles/datafiles.component.ts index 136e192bd..17dfa9976 100644 --- a/src/app/datasets/datafiles/datafiles.component.ts +++ b/src/app/datasets/datafiles/datafiles.component.ts @@ -268,15 +268,12 @@ export class DatafilesComponent if (email) { this.getSelectedFiles(); const data = { - emailJobInitiator: email, - creationTime: new Date(), + createdBy: email, + createdAt: new Date(), type: "public", - datasetList: [ - { - pid: this.datasetPid, - files: this.getSelectedFiles(), - }, - ], + jobParams: { + datasetIds: [this.datasetPid], + }, }; const job = new Job(data); this.store.dispatch(submitJobAction({ job })); diff --git a/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts b/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts index 753b181cb..b0de32c8a 100644 --- a/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts +++ b/src/app/jobs/jobs-dashboard-new/jobs-dashboard-new.component.ts @@ -4,6 +4,7 @@ import { Component, OnDestroy, } from "@angular/core"; +import { Router } from "@angular/router"; import { SciCatDataSource } from "../../shared/services/scicat.datasource"; import { ScicatDataService } from "../../shared/services/scicat-data-service"; import { ExportExcelService } from "../../shared/services/export-excel.service"; @@ -30,11 +31,11 @@ export class JobsDashboardNewComponent implements OnDestroy, AfterViewChecked { hideOrder: 0, }, { - id: "emailJobInitiator", - label: "Initiator", + id: "createdBy", + label: "Creator", icon: "person", canSort: true, - matchMode: "contains", + matchMode: "is", hideOrder: 1, }, { @@ -46,7 +47,7 @@ export class JobsDashboardNewComponent implements OnDestroy, AfterViewChecked { hideOrder: 2, }, { - id: "creationTime", + id: "createdAt", icon: "schedule", label: "Created at local time", format: "date medium ", @@ -64,22 +65,13 @@ export class JobsDashboardNewComponent implements OnDestroy, AfterViewChecked { hideOrder: 4, }, { - id: "jobStatusMessage", + id: "statusCode", icon: "traffic", label: "Status", - format: "json", canSort: true, matchMode: "contains", hideOrder: 5, }, - { - id: "datasetList", - icon: "list", - label: "Datasets", - format: "json", - canSort: true, - hideOrder: 6, - }, { id: "jobResultObject", icon: "work_outline", @@ -102,6 +94,7 @@ export class JobsDashboardNewComponent implements OnDestroy, AfterViewChecked { private cdRef: ChangeDetectorRef, private dataService: ScicatDataService, private exportService: ExportExcelService, + private router: Router, ) { this.dataSource = new SciCatDataSource( this.appConfigService, @@ -120,9 +113,7 @@ export class JobsDashboardNewComponent implements OnDestroy, AfterViewChecked { } onRowClick(job: Job) { - // currently deactivated, no extra data available - /* console.log("Row clicked:", job); const id = encodeURIComponent(job.id); - this.router.navigateByUrl("/user/jobs/" + id); */ + this.router.navigateByUrl("/user/jobs/" + id); } } diff --git a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts index f2e118367..295e7f2f5 100644 --- a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts +++ b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.spec.ts @@ -100,8 +100,8 @@ describe("JobsDashboardComponent", () => { dispatchSpy = spyOn(store, "dispatch"); const mode = JobViewMode.myJobs; - component.email = "test@email.com"; - const viewMode = { emailJobInitiator: component.email }; + component.username = "testName"; + const viewMode = { createdBy: component.username }; component.onModeChange(mode); expect(dispatchSpy).toHaveBeenCalledTimes(1); diff --git a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts index 04b7ce599..138747b15 100644 --- a/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts +++ b/src/app/jobs/jobs-dashboard/jobs-dashboard.component.ts @@ -48,7 +48,7 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { jobs: JobsTableData[] = []; profile: any; - email = ""; + username = ""; subscriptions: Subscription[] = []; @@ -96,13 +96,10 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { if (jobs) { tableData = jobs.map((job) => ({ id: job.id, - initiator: job.emailJobInitiator, + initiator: job.createdBy, type: job.type, - createdAt: this.datePipe.transform( - job.creationTime, - "yyyy-MM-dd HH:mm", - ), - statusMessage: job.jobStatusMessage, + createdAt: this.datePipe.transform(job.createdAt, "yyyy-MM-dd HH:mm"), + statusMessage: job.statusMessage, })); } return tableData; @@ -129,7 +126,7 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { break; } case JobViewMode.myJobs: { - viewMode = { emailJobInitiator: this.email }; + viewMode = { createdBy: this.username }; break; } default: { @@ -154,11 +151,11 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { // map column names back to original names switch (event.active) { case "statusMessage": { - event.active = "jobStatusMessage"; + event.active = "statusMessage"; break; } case "initiator": { - event.active = "emailJobInitiator"; + event.active = "createdBy"; break; } default: { @@ -181,13 +178,13 @@ export class JobsDashboardComponent implements OnInit, OnDestroy { this.subscriptions.push( this.store.select(selectCurrentUser).subscribe((current) => { if (current) { - this.email = current.email; + this.username = current.username; if (!current.realm) { this.store.select(selectProfile).subscribe((profile) => { if (profile) { this.profile = profile; - this.email = profile.email; + this.username = profile.username; } this.onModeChange(JobViewMode.myJobs); }); diff --git a/src/app/jobs/jobs-detail/jobs-detail.component.html b/src/app/jobs/jobs-detail/jobs-detail.component.html index ac4678930..42b3234ba 100644 --- a/src/app/jobs/jobs-detail/jobs-detail.component.html +++ b/src/app/jobs/jobs-detail/jobs-detail.component.html @@ -1,73 +1,132 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- {{ daSet.pid | json }} +
+
+ + +
+ description
-
- - - - - - - - -
- mail - Email Job Initiator - {{ job.emailJobInitiator }}
- bubble_chart - Type - {{ value }}
- brightness_high - Creation Time - {{ value | date: "yyyy-MM-dd HH:mm" }}
- gavel - Execution Time - {{ value | date: "yyyy-MM-dd HH:mm" }}
- settings - Job Params - {{ value | json }}
- markunread - Date Of Last Message - {{ value | date: "yyyy-MM-dd HH:mm" }}
- folder - Dataset List -
- calendar_today - Created At - {{ value | date: "yyyy-MM-dd HH:mm" }}
- calendar_today - Updated At - {{ value | date: "yyyy-MM-dd HH:mm" }}
-
-
-
+ General Information + + + + + + + + + + + + + + + +
ID{{ value }}
Type{{ value }}
Created At{{ value | date: "yyyy-MM-dd HH:mm" }}
+
+ + + +
+ person +
+ Users and Ownership +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Created By{{ value }}
Contact Email{{ value }}
Owner User{{ value }}
Owner Group{{ value }}
Access Groups{{ value }}
Updated By{{ value }}
+
+
+ + +
+ analytics +
+ Status +
+ + + + + + + + + + + + + + +
Status Code{{ value }}
Status Message{{ value }}
Updated At{{ value }}
+
+
+ + +
+ library_books +
+ Parameters and Configuration +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Job Parameters{{ value | json }}
Configuration Version{{ value }}
Job Result Object{{ value | json }}
Datasets ValidationNo
Datasets ValidationYes
Is PublishedNo
Is PublishedYes
+
+
+ + diff --git a/src/app/jobs/jobs-detail/jobs-detail.component.scss b/src/app/jobs/jobs-detail/jobs-detail.component.scss index 2687093ee..2d1be484f 100644 --- a/src/app/jobs/jobs-detail/jobs-detail.component.scss +++ b/src/app/jobs/jobs-detail/jobs-detail.component.scss @@ -1,20 +1,25 @@ -.job-detail { - mat-card { - margin: 1em; +mat-card { + margin: 1em; - table { - td { - padding: 0.3em; - } + .section-icon { + height: auto !important; + width: auto !important; - th { - text-align: left; - padding-right: 0.5em; + mat-icon { + vertical-align: middle; + } + } + + table { + th { + min-width: 10rem; + padding-right: 0.5rem; + text-align: left; + } - mat-icon { - vertical-align: middle; - } - } + td { + width: 100%; + padding: 0.5rem 0; } } } diff --git a/src/app/shared/modules/shared-table/_shared-table-theme.scss b/src/app/shared/modules/shared-table/_shared-table-theme.scss index 4124c88a0..735cd8512 100644 --- a/src/app/shared/modules/shared-table/_shared-table-theme.scss +++ b/src/app/shared/modules/shared-table/_shared-table-theme.scss @@ -31,6 +31,7 @@ mat-row:hover { background-color: mat.get-color-from-palette($hover, "lighter"); + cursor: pointer; } .mat-form-field-appearance-outline { diff --git a/src/app/shared/sdk/models/Job.ts b/src/app/shared/sdk/models/Job.ts index 52e0e77a8..778938bec 100644 --- a/src/app/shared/sdk/models/Job.ts +++ b/src/app/shared/sdk/models/Job.ts @@ -3,34 +3,43 @@ declare var Object: any; export interface JobInterface { id?: string; - emailJobInitiator: string; - type: string; - creationTime?: Date; - executionTime?: Date; + ownerUser?: string; + type?: string; + statusCode?: string; + statusMessage?: string; jobParams?: any; - jobStatusMessage?: string; - datasetList?: any; + datasetsValidation?: boolean; + contactEmail?: string; + configVersion?: string; jobResultObject?: any; createdBy?: string; updatedBy?: string; createdAt?: Date; updatedAt?: Date; + ownerGroup?: string; + accessGroups?: any; + isPublished?: boolean; } export class Job implements JobInterface { "id": string; - "emailJobInitiator": string; + "ownerUser": string; "type": string; - "creationTime": Date; - "executionTime": Date; + "statusCode": string; + "statusMessage": string; "jobParams": any; - "jobStatusMessage": string; - "datasetList": any; + "datasetsValidation": boolean; + "contactEmail": string; + "configVersion": string; "jobResultObject": any; "createdBy": string; "updatedBy": string; "createdAt": Date; "updatedAt": Date; + "ownerGroup": string; + "accessGroups": any; + "isPublished": boolean; + constructor(data?: JobInterface) { Object.assign(this, data); } @@ -68,8 +77,8 @@ export class Job implements JobInterface { name: "id", type: "string", }, - emailJobInitiator: { - name: "emailJobInitiator", + ownerUser: { + name: "ownerUser", type: "string", }, type: { @@ -77,25 +86,29 @@ export class Job implements JobInterface { type: "string", default: "retrieve", }, - creationTime: { - name: "creationTime", - type: "Date", + statusCode: { + name: "statusCode", + type: "string", }, - executionTime: { - name: "executionTime", - type: "Date", + statusMessage: { + name: "statusMessage", + type: "string", }, jobParams: { name: "jobParams", type: "any", }, - jobStatusMessage: { - name: "jobStatusMessage", + datasetsValidation: { + name: "datasetsValidation", + type: "boolean", + }, + contactEmail: { + name: "contactEmail", type: "string", }, - datasetList: { - name: "datasetList", - type: "any", + configVersion: { + name: "configVersion", + type: "string", }, jobResultObject: { name: "jobResultObject", @@ -117,6 +130,18 @@ export class Job implements JobInterface { name: "updatedAt", type: "Date", }, + ownerGroup: { + name: "ownerGroup", + type: "string", + }, + accessGroups: { + name: "accessGroups", + type: "any", + }, + isPublished: { + name: "isPublished", + type: "boolean", + }, }, relations: {}, }; diff --git a/src/app/state-management/effects/jobs.effects.spec.ts b/src/app/state-management/effects/jobs.effects.spec.ts index c67d08655..53a9eec8b 100644 --- a/src/app/state-management/effects/jobs.effects.spec.ts +++ b/src/app/state-management/effects/jobs.effects.spec.ts @@ -18,9 +18,11 @@ import { Type } from "@angular/core"; const data: JobInterface = { id: "testId", - emailJobInitiator: "test@email.com", + createdBy: "testName", type: "archive", - datasetList: {}, + jobParams: { + datasetIds: [], + }, }; const job = new Job(data); diff --git a/src/app/state-management/reducers/jobs.reducer.spec.ts b/src/app/state-management/reducers/jobs.reducer.spec.ts index 21460d7c7..e1d57bece 100644 --- a/src/app/state-management/reducers/jobs.reducer.spec.ts +++ b/src/app/state-management/reducers/jobs.reducer.spec.ts @@ -5,9 +5,11 @@ import { initialJobsState } from "state-management/state/jobs.store"; const data: JobInterface = { id: "testId", - emailJobInitiator: "test@email.com", + createdBy: "testName", type: "archive", - datasetList: {}, + jobParams: { + datasetIds: [], + }, }; const job = new Job(data); diff --git a/src/app/state-management/selectors/jobs.selectors.spec.ts b/src/app/state-management/selectors/jobs.selectors.spec.ts index c20da5203..f741a4f1b 100644 --- a/src/app/state-management/selectors/jobs.selectors.spec.ts +++ b/src/app/state-management/selectors/jobs.selectors.spec.ts @@ -5,9 +5,11 @@ import { JobInterface, Job } from "shared/sdk"; const data: JobInterface = { id: "testId", - emailJobInitiator: "test@email.com", + createdBy: "testName", type: "archive", - datasetList: {}, + jobParams: { + datasetIds: [], + }, }; const job = new Job(data);