diff --git a/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/AutomaticExecution.java b/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/AutomaticExecution.java new file mode 100644 index 0000000000..0d94016aed --- /dev/null +++ b/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/AutomaticExecution.java @@ -0,0 +1,17 @@ +package org.shanoir.ng.vip; + +/** + * This class represents the associated criterias for an automatic execution realized after an import in shanoir. + */ +public class AutomaticExecution { + + String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApi.java b/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApi.java index 8b8e9fc228..5a564220d6 100644 --- a/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApi.java +++ b/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApi.java @@ -24,16 +24,15 @@ import org.shanoir.ng.shared.exception.EntityNotFoundException; import org.shanoir.ng.shared.exception.RestServiceException; import org.shanoir.ng.shared.exception.SecurityException; +import org.shanoir.ng.vip.AutomaticExecution; import org.shanoir.ng.vip.dto.ExecutionCandidateDTO; import org.shanoir.ng.vip.dto.VipExecutionDTO; import org.shanoir.ng.vip.monitoring.model.ExecutionStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.*; import java.io.IOException; +import java.util.List; /** * @author Alae Es-saki @@ -66,6 +65,17 @@ ResponseEntity createExecution( method = RequestMethod.GET) ResponseEntity getExecution(@Parameter(description = "The execution identifier", required=true) @PathVariable("identifier") String identifier) throws IOException, RestServiceException, EntityNotFoundException, SecurityException; + @Operation(summary = "Get list of existing automatic executions for the given study_id", description = "Returns the list of existing automatic executions for the given study id", tags={ }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "successful response, returns the list of automatic executions"), + @ApiResponse(responseCode = "403", description = "forbidden"), + @ApiResponse(responseCode = "500", description = "unexpected error"), + @ApiResponse(responseCode = "503", description = "Internal error")}) + @GetMapping(value = "/automatic/{studyId}", + produces = { "application/json", "application/octet-stream" }) + ResponseEntity> getAutomaticExecutions(@Parameter(description = "The study Id", required=true) @PathVariable("studyId") Long studyId) throws IOException, RestServiceException, EntityNotFoundException, SecurityException; + + @Operation(summary = "Get stderr logs for the given VIP execution identifier", description = "Returns the stderr logs of the VIP execution that has the given identifier in parameter.", tags={ }) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful response, returns the status"), diff --git a/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApiController.java b/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApiController.java index c4902ac989..79e8149da1 100644 --- a/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApiController.java +++ b/shanoir-ng-datasets/src/main/java/org/shanoir/ng/vip/controller/ExecutionApiController.java @@ -15,21 +15,19 @@ package org.shanoir.ng.vip.controller; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.v3.oas.annotations.Parameter; import org.shanoir.ng.dataset.model.Dataset; import org.shanoir.ng.dataset.security.DatasetSecurityService; import org.shanoir.ng.dataset.service.DatasetService; import org.shanoir.ng.processing.dto.ParameterResourceDTO; import org.shanoir.ng.processing.model.DatasetProcessingType; -import org.shanoir.ng.shared.core.model.AbstractEntity; import org.shanoir.ng.shared.core.model.IdName; import org.shanoir.ng.shared.exception.EntityNotFoundException; import org.shanoir.ng.shared.exception.ErrorModel; import org.shanoir.ng.shared.exception.RestServiceException; import org.shanoir.ng.shared.exception.SecurityException; import org.shanoir.ng.utils.KeycloakUtil; +import org.shanoir.ng.vip.AutomaticExecution; import org.shanoir.ng.vip.dto.DatasetParameterDTO; import org.shanoir.ng.vip.dto.ExecutionCandidateDTO; import org.shanoir.ng.vip.dto.VipExecutionDTO; @@ -45,14 +43,10 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; -import reactor.core.publisher.Mono; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Controller public class ExecutionApiController implements ExecutionApi { @@ -252,4 +246,12 @@ public ResponseEntity getExecutionStderr(String identifier) { public ResponseEntity getExecutionStdout(String identifier) { return ResponseEntity.ok(vipClient.getExecutionStdout(identifier).block()); } + + @Override + public ResponseEntity> getAutomaticExecutions(@Parameter(description = "The study Id", required=true) @PathVariable("studyId") Long studyId) { + AutomaticExecution autoExec = new AutomaticExecution(); + autoExec.setName("superbname"); + return new ResponseEntity<>(Collections.singletonList(autoExec), HttpStatus.OK); + } + } diff --git a/shanoir-ng-front/src/app/app-routing.module.ts b/shanoir-ng-front/src/app/app-routing.module.ts index 178e271d93..725cfffee7 100644 --- a/shanoir-ng-front/src/app/app-routing.module.ts +++ b/shanoir-ng-front/src/app/app-routing.module.ts @@ -86,6 +86,8 @@ import { AccessRequestComponent } from './users/access-request/access-request.co import { PipelinesComponent } from './vip/pipelines/pipelines.component'; import { ExecutionComponent } from './vip/execution/execution.component'; import { ExecutionMonitoringsComponent } from './vip/execution-monitorings/execution-monitorings.component'; +import { ExecutionPlanningList } from "./vip/execution-planning/execution-planning-list.component" +import { ExecutionPlanning } from "./vip/execution-planning/execution-planning.component"; import { MetadataComponent } from './datasets/dataset/metadata/metadata.component'; import { ApplyStudyCardOnComponent } from './study-cards/apply-study-card-on/apply-study-card-on.component'; import { PreClinicalContextComponent } from './import/pre-clinical-context/pre-clinical-context.component'; @@ -127,6 +129,12 @@ let routes: Routes = [ }, { path: 'execution-monitoring', component: ExecutionMonitoringsComponent + }, { + path: 'execution-planning', + component: ExecutionPlanning + }, { + path: 'execution-monitoring-list', + component: ExecutionPlanningList }, { path: 'pipelines', component: PipelinesComponent diff --git a/shanoir-ng-front/src/app/app.module.ts b/shanoir-ng-front/src/app/app.module.ts index dcceb9bd69..ae43c217bc 100644 --- a/shanoir-ng-front/src/app/app.module.ts +++ b/shanoir-ng-front/src/app/app.module.ts @@ -273,6 +273,8 @@ import {StudyHistoryComponent} from "./studies/study-history/study-history.compo import { StudyTreeComponent } from './studies/study/study-tree.component'; import { TreeService } from './studies/study/tree.service'; import { CoilNodeComponent } from './coils/coil/tree/coil-node.component'; +import {ExecutionPlanningList} from "./vip/execution-planning/execution-planning-list.component"; +import {ExecutionPlanning} from "./vip/execution-planning/execution-planning.component"; @NgModule({ imports: [ @@ -463,7 +465,9 @@ import { CoilNodeComponent } from './coils/coil/tree/coil-node.component'; DownloadSetupAltComponent, TestQualityCardOptionsComponent, StudyTreeComponent, - CoilNodeComponent + CoilNodeComponent, + ExecutionPlanningList, + ExecutionPlanning ], providers: [ AcquisitionEquipmentService, diff --git a/shanoir-ng-front/src/app/studies/study/study.component.html b/shanoir-ng-front/src/app/studies/study/study.component.html index 1ada6b9dfc..c8585c4cb0 100644 --- a/shanoir-ng-front/src/app/studies/study/study.component.html +++ b/shanoir-ng-front/src/app/studies/study/study.component.html @@ -53,6 +53,9 @@

Tags + +
  • + Executions
  • Quality
  • @@ -420,6 +423,10 @@

    + +
    + Execution planning +
    diff --git a/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.css b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.html b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.html new file mode 100644 index 0000000000..67d4c96405 --- /dev/null +++ b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.html @@ -0,0 +1,8 @@ +
      +
    1. + +
        + +
      +
    2. +
    diff --git a/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.ts b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.ts new file mode 100644 index 0000000000..ee0e9dee4d --- /dev/null +++ b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning-list.component.ts @@ -0,0 +1,23 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {ExecutionService} from "../execution/execution.service"; +import {AutomaticExecution} from "../models/automatic-execution"; + +@Component({ + selector: 'execution-planning-list', + templateUrl: './execution-planning-list.component.html', + styleUrls: ['./execution-planning-list.component.css'] +}) +export class ExecutionPlanningList { + + @Input() studyId: number + executions: AutomaticExecution[] + + constructor(protected executionService: ExecutionService) {} + + ngOnInit(): void { + this.executionService.getAutomaticExecutions(this.studyId).then( + executionsReturned => this.executions = executionsReturned + ) + } + +} diff --git a/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.css b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.html b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.html new file mode 100644 index 0000000000..045958d5a2 --- /dev/null +++ b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.html @@ -0,0 +1,7 @@ +
    +
    + + +
    +
    + diff --git a/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.ts b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.ts new file mode 100644 index 0000000000..4c15c9defd --- /dev/null +++ b/shanoir-ng-front/src/app/vip/execution-planning/execution-planning.component.ts @@ -0,0 +1,16 @@ +import {Component, Input} from '@angular/core'; +import {AutomaticExecution} from "../models/automatic-execution"; + + + +@Component({ + selector: 'execution-planning', + templateUrl: './execution-planning.component.html', + styleUrls: ['./execution-planning-component.css'] +}) +export class ExecutionPlanning { + @Input() executionPlanning: AutomaticExecution + onSubmitExecutionForm() { + console.log("we send the form, but actually no"); + } +} diff --git a/shanoir-ng-front/src/app/vip/execution/execution.service.ts b/shanoir-ng-front/src/app/vip/execution/execution.service.ts index e69cda2c18..0c6aa33dfc 100644 --- a/shanoir-ng-front/src/app/vip/execution/execution.service.ts +++ b/shanoir-ng-front/src/app/vip/execution/execution.service.ts @@ -20,6 +20,7 @@ import {Execution} from "../models/execution"; import {ExecutionCandidateDto} from "../models/execution-candidate.dto"; import {IdName} from "../../shared/models/id-name.model"; import {Id} from "../../shared/models/id.model"; +import {AutomaticExecution} from "../models/automatic-execution"; @Injectable() export class ExecutionService { @@ -42,6 +43,15 @@ export class ExecutionService { return this.httpClient.post(`${this.executionUrl}/`,execution).toPromise(); } + /** + * Get all automatic executions linked to a study + * @param study_id the study id we want the automatic executions from + */ + public getAutomaticExecutions(study_id: number): Promise { + return this.httpClient.get(`${this.executionUrl}/automatic/` + study_id).toPromise(); + } + + /** * Get stderr of an execution * diff --git a/shanoir-ng-front/src/app/vip/models/automatic-execution.ts b/shanoir-ng-front/src/app/vip/models/automatic-execution.ts new file mode 100644 index 0000000000..7321f1629b --- /dev/null +++ b/shanoir-ng-front/src/app/vip/models/automatic-execution.ts @@ -0,0 +1,18 @@ +/** + * Shanoir NG - Import, manage and share neuroimaging data + * Copyright (C) 2009-2022 Inria - https://www.inria.fr/ + * Contact us on https://project.inria.fr/shanoir/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/gpl-3.0.html + */ +import {DatasetProcessingType} from "../../enum/dataset-processing-type.enum"; + +export class AutomaticExecution { + name: string +}