diff --git a/apps/dnet-is-application/src/main/java/eu/dnetlib/manager/wf/WfConfigurationsController.java b/apps/dnet-is-application/src/main/java/eu/dnetlib/manager/wf/WfConfigurationsController.java index b927f0b4..3fb39f37 100644 --- a/apps/dnet-is-application/src/main/java/eu/dnetlib/manager/wf/WfConfigurationsController.java +++ b/apps/dnet-is-application/src/main/java/eu/dnetlib/manager/wf/WfConfigurationsController.java @@ -3,17 +3,18 @@ package eu.dnetlib.manager.wf; import java.util.List; import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.is.info.KeyValue; import eu.dnetlib.manager.wf.model.WorkflowConfiguration; +import eu.dnetlib.manager.wf.model.WorkflowSection; import eu.dnetlib.manager.wf.model.WorkflowSubscription; import eu.dnetlib.manager.wf.workflows.procs.ExecutionStatus; import io.swagger.v3.oas.annotations.parameters.RequestBody; @@ -22,18 +23,18 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; @RequestMapping("/ajax/wfs") public class WfConfigurationsController extends AbstractDnetController { + @Autowired private WorkflowManagerService wfManagerService; @GetMapping("/sections") - public List> listWfSections() throws Exception { - return wfManagerService.streamSections() - .map(x -> new KeyValue<>(x.getValue(), x.getCount())) - .collect(Collectors.toList()); + public List listWfSections() throws Exception { + return wfManagerService.listSsections(); } - @GetMapping("/search") - public List> listWfConfigurations(@RequestParam final String section) throws Exception { - return wfManagerService.streamWfConfigurationsBySection(section) + @GetMapping("/sections/{section}") + public List> listWfConfigurations(@PathVariable final String section) throws Exception { + return wfManagerService.listWfConfigurationsBySection(section) + .stream() .map(x -> new KeyValue<>(x.getId(), x.getName())) .collect(Collectors.toList()); } diff --git a/frontends/dnet-is-application/src/app/app-routing.module.ts b/frontends/dnet-is-application/src/app/app-routing.module.ts index b2a848b5..eff2fa6e 100644 --- a/frontends/dnet-is-application/src/app/app-routing.module.ts +++ b/frontends/dnet-is-application/src/app/app-routing.module.ts @@ -10,7 +10,7 @@ import { DsmSearchComponent, DsmResultsComponent, DsmApiComponent } from './dsm/ import { MdstoreInspectorComponent, MdstoresComponent } from './mdstores/mdstores.component'; import { CleanerTesterComponent } from './cleaner-tester/cleaner-tester.component'; import { EmailsComponent } from './emails/emails.component'; -import { WfInstancesComponent } from './wf-instances/wf-instances.component'; +import { WfConfsComponent } from './wf-confs/wf-confs.component'; const routes: Routes = [ { path: "", redirectTo: 'info', pathMatch: 'full' }, @@ -20,7 +20,7 @@ const routes: Routes = [ { path: "adv_resources/vocabulary", component: VocabulariesComponent }, { path: "adv_resources/protocol", component: ProtocolsComponent }, { path: "adv_resources/email", component: EmailsComponent }, - { path: "wfs", component: WfInstancesComponent }, + { path: "wfs/:section", component: WfConfsComponent }, { path: "wf_history", component: WfHistoryComponent }, { path: "ctx_viewer", component: ContextViewerComponent }, { path: "voc_editor", component: VocabularyEditorComponent }, diff --git a/frontends/dnet-is-application/src/app/app.module.ts b/frontends/dnet-is-application/src/app/app.module.ts index 59ad6a0c..4585e745 100644 --- a/frontends/dnet-is-application/src/app/app.module.ts +++ b/frontends/dnet-is-application/src/app/app.module.ts @@ -37,7 +37,7 @@ import { SpinnerHttpInterceptor } from './common/spinner.service'; import { MdstoresComponent, MdstoreInspectorComponent, MDStoreVersionsDialog, AddMDStoreDialog } from './mdstores/mdstores.component'; import { CleanerTesterComponent } from './cleaner-tester/cleaner-tester.component'; import { EmailDialog, EmailsComponent } from './emails/emails.component'; -import { WfInstancesComponent } from './wf-instances/wf-instances.component'; +import { WfConfsComponent } from './wf-confs/wf-confs.component'; import { MatTabsModule } from '@angular/material/tabs'; @NgModule({ @@ -72,7 +72,7 @@ import { MatTabsModule } from '@angular/material/tabs'; CleanerTesterComponent, EmailsComponent, EmailDialog, - WfInstancesComponent + WfConfsComponent ], imports: [ BrowserModule, diff --git a/frontends/dnet-is-application/src/app/common/is.model.ts b/frontends/dnet-is-application/src/app/common/is.model.ts index 2aa78fc8..acf0d35a 100644 --- a/frontends/dnet-is-application/src/app/common/is.model.ts +++ b/frontends/dnet-is-application/src/app/common/is.model.ts @@ -207,9 +207,15 @@ export interface EmailTemplate { message: string } +export interface WfSection { + id: string, + name: string +} export interface WfConf { id: string, + name: string, + section?: string, details: Map, priority: number, dsId?: string, diff --git a/frontends/dnet-is-application/src/app/common/is.service.ts b/frontends/dnet-is-application/src/app/common/is.service.ts index 8788d34e..2f31d362 100644 --- a/frontends/dnet-is-application/src/app/common/is.service.ts +++ b/frontends/dnet-is-application/src/app/common/is.service.ts @@ -1,24 +1,33 @@ -import { Injectable } from '@angular/core'; +import { Injectable, OnInit } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; -import { Page, DsmConf, ResourceType, Protocol, WfHistoryEntry, SimpleResource, Context, ContextNode, Vocabulary, VocabularyTerm, KeyValue, BrowseTerm, Datasource, MDStore, MDStoreVersion, MDStoreRecord, EmailTemplate, WfConf, WfSubscription, WfProcessStatus } from './is.model'; +import { Page, DsmConf, ResourceType, Protocol, WfHistoryEntry, SimpleResource, Context, ContextNode, Vocabulary, VocabularyTerm, KeyValue, BrowseTerm, Datasource, MDStore, MDStoreVersion, MDStoreRecord, EmailTemplate, WfConf, WfSubscription, WfProcessStatus, WfSection } from './is.model'; import { FormGroup } from '@angular/forms'; import { MatSnackBar } from '@angular/material/snack-bar'; +import { firstValueFrom, Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class ISService { - constructor(public client: HttpClient, public snackBar: MatSnackBar) { } - loadResourceTypes(onSuccess: Function): void { - this.httpGet("/ajax/resourceTypes", onSuccess); + constructor(public client: HttpClient, public snackBar: MatSnackBar) { } - loadResourceType(id: string, onSuccess: Function): void { + + loadResourceTypes(onSuccess: Function) { + this.httpGet("/ajax/resourceTypes", onSuccess) + } + + + loadResourceType(id: string, onSuccess: Function) { this.httpGet("/ajax/resourceTypes/" + encodeURIComponent(id), onSuccess); } + loadWfSections(onSuccess: Function) { + this.httpGet("/ajax/wfs/sections", onSuccess) + } + loadInfo(onSuccess: Function): void { this.httpGet("/ajax/info/", onSuccess); } @@ -220,12 +229,8 @@ export class ISService { this.httpDelete('./ajax/templates/email/' + encodeURIComponent(id), onSuccess); } - loadWfConfigurationSections(onSuccess: Function): void { - this.httpGet('./ajax/wfs/sections', onSuccess); - } - - loadWfConfigurations(section: string, onSuccess: Function): void { - this.httpGet('./ajax/wfs/search?section=' + encodeURIComponent(section), onSuccess); + loadWfConfigurations(sectionId: string, onSuccess: Function): void { + this.httpGet('./ajax/wfs/section/' + encodeURIComponent(sectionId), onSuccess); } loadWfConfiguration(id: string, onSuccess: Function): void { diff --git a/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.html b/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.html index d5d864d7..9e835384 100644 --- a/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.html +++ b/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.html @@ -56,7 +56,9 @@ Workflows diff --git a/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.ts b/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.ts index 5edc85c6..17faec33 100644 --- a/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.ts +++ b/frontends/dnet-is-application/src/app/main-menu-panels/main-menu-panels.component.ts @@ -1,5 +1,5 @@ import { Component, ViewChild } from '@angular/core'; -import { ResourceType } from '../common/is.model'; +import { KeyValue, ResourceType, WfSection } from '../common/is.model'; import { ISService } from '../common/is.service'; import { MatAccordion } from '@angular/material/expansion'; @@ -15,8 +15,10 @@ export class MainMenuPanelsComponent { accordion!: MatAccordion; resTypes: ResourceType[] = []; + wfSections: WfSection[] = []; constructor(public service: ISService) { - this.service.loadResourceTypes((data: ResourceType[]) => this.resTypes = data); + service.loadResourceTypes((data: ResourceType[]) => this.resTypes = data); + service.loadWfSections((data: WfSection[]) => this.wfSections = data); } } diff --git a/frontends/dnet-is-application/src/app/resources/resources.component.html b/frontends/dnet-is-application/src/app/resources/resources.component.html index 6463697a..e211abbb 100644 --- a/frontends/dnet-is-application/src/app/resources/resources.component.html +++ b/frontends/dnet-is-application/src/app/resources/resources.component.html @@ -1,4 +1,4 @@ -

{{type.name}}

+

{{type?.name}}