Skip to content

Commit

Permalink
fli-iam#2388-planned-executions
Browse files Browse the repository at this point in the history
- Prepare structure front + back
  • Loading branch information
jcomedouteau committed Oct 2, 2024
1 parent a37df22 commit 06e2e17
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -66,6 +65,17 @@ ResponseEntity<IdName> createExecution(
method = RequestMethod.GET)
ResponseEntity<VipExecutionDTO> 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<List<AutomaticExecution>> 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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -252,4 +246,12 @@ public ResponseEntity<String> getExecutionStderr(String identifier) {
public ResponseEntity<String> getExecutionStdout(String identifier) {
return ResponseEntity.ok(vipClient.getExecutionStdout(identifier).block());
}

@Override
public ResponseEntity<List<AutomaticExecution>> 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);
}

}
8 changes: 8 additions & 0 deletions shanoir-ng-front/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion shanoir-ng-front/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -463,7 +465,9 @@ import { CoilNodeComponent } from './coils/coil/tree/coil-node.component';
DownloadSetupAltComponent,
TestQualityCardOptionsComponent,
StudyTreeComponent,
CoilNodeComponent
CoilNodeComponent,
ExecutionPlanningList,
ExecutionPlanning
],
providers: [
AcquisitionEquipmentService,
Expand Down
7 changes: 7 additions & 0 deletions shanoir-ng-front/src/app/studies/study/study.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ <h2 class="header command-zone" i18n="Create study|Title@@studyDetailCreateTitle
</li>
<li class="tags" [class.active]="activeTab == 'tags'" [routerLink]="'.'" [fragment]="'tags'" replaceUrl="true">
<span class="tags">Tags</span>
</li>
<li [class.active]="activeTab == 'executions'" [routerLink]="'.'" [fragment]="'executions'" replaceUrl="true">
<span class="executions">Executions</span>
</li>
<ng-container *ngIf="mode == 'view'">
<li *ngIf="isStudyAdmin" [class.active]="activeTab == 'quality'" [routerLink]="'.'" [fragment]="'quality'" replaceUrl="true">Quality</li>
Expand Down Expand Up @@ -420,6 +423,10 @@ <h2 class="header command-zone" i18n="Create study|Title@@studyDetailCreateTitle
[eventHistory]="openHistory"
[study]="study">
</study-history>
</fieldset>
<fieldset [class.hidden-tab]="activeTab != 'executions'" tab="executions">
<legend>Execution planning</legend>
<execution-planning-list/>
</fieldset>
</form>
</div>
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ol>
<li>
<label i18n="Execution planning">Execution's planification</label>
<ol *ngFor="let planifiedExec of executions let i = index; let even = even; let odd = odd;" [class.even]="even" [class.odd]="odd">
<execution-planning executionPlanning="{{planifiedExec}}"/>
</ol>
</li>
</ol>
Original file line number Diff line number Diff line change
@@ -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
)
}

}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<form *ngIf="executionPlanning" (ngSubmit)="onSubmitExecutionForm()" xmlns="http://www.w3.org/1999/html">
<div>
<label>Execution Name</label>
<input type="text" id="name" formControlName="name" required [(ngModel)]="executionPlanning.name">
</div>
</form>

Original file line number Diff line number Diff line change
@@ -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");
}
}
10 changes: 10 additions & 0 deletions shanoir-ng-front/src/app/vip/execution/execution.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -42,6 +43,15 @@ export class ExecutionService {
return this.httpClient.post<IdName>(`${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<AutomaticExecution[]> {
return this.httpClient.get<AutomaticExecution[]>(`${this.executionUrl}/automatic/` + study_id).toPromise();
}


/**
* Get stderr of an execution
*
Expand Down
18 changes: 18 additions & 0 deletions shanoir-ng-front/src/app/vip/models/automatic-execution.ts
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 06e2e17

Please sign in to comment.