wf section size

This commit is contained in:
Michele Artini 2023-12-22 10:46:37 +01:00
parent 289168a3b2
commit 9fd2a7ae66
7 changed files with 30 additions and 8 deletions

View File

@ -69,4 +69,12 @@ CREATE TABLE wf_subscriptions (
PRIMARY KEY (wf_conf_id, condition, email)
);
CREATE VIEW wf_sections_view AS SELECT
s.id AS id,
s.name AS name,
count(c.*) AS count
FROM wf_sections s LEFT OUTER JOIN wf_configurations c ON (s.id = c.section)
GROUP BY s.id, s.name
ORDER BY s.name;
COMMIT;

View File

@ -64,7 +64,7 @@ public class ApiController extends DnetRestController {
}
@GetMapping("/sections")
public List<WfSection> listWfSections() throws Exception {
public Iterable<WfSection> listWfSections() throws Exception {
return wfManagerService.listSections();
}

View File

@ -59,7 +59,7 @@ public class WorkflowManagerService {
}
@Transactional
public List<WfSection> listSections() {
public Iterable<WfSection> listSections() {
return wfSectionRepository.findAll();
}

View File

@ -204,7 +204,8 @@ export interface EmailTemplate {
export interface WfSection {
id: string,
name: string
name: string,
count: number
}
export interface WfConf {

View File

@ -57,7 +57,10 @@
</mat-expansion-panel-header>
<div>
<div *ngFor="let s of wfSections">
<a class="menu-item" [routerLink]="['wfs', s.id]">{{s.name}}</a>
<a class="menu-item" [routerLink]="['wfs', s.id]">
{{s.name}}
<span class="menu-count">{{s.count}}</span>
</a>
</div>
</div>
</mat-expansion-panel>

View File

@ -8,7 +8,7 @@ import jakarta.persistence.Id;
import jakarta.persistence.Table;
@Entity
@Table(name = "wf_sections")
@Table(name = "wf_sections_view")
public class WfSection implements Serializable {
private static final long serialVersionUID = 1442544603323121950L;
@ -20,6 +20,9 @@ public class WfSection implements Serializable {
@Column(name = "name")
private String name;
@Column(name = "count")
private long count;
public String getId() {
return id;
}
@ -36,4 +39,12 @@ public class WfSection implements Serializable {
this.name = name;
}
public long getCount() {
return count;
}
public void setCount(final long count) {
this.count = count;
}
}

View File

@ -1,9 +1,8 @@
package eu.dnetlib.wfs.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import eu.dnetlib.domain.wfs.WfSection;
import eu.dnetlib.utils.ReadOnlyRepository;
public interface WfSectionRepository extends JpaRepository<WfSection, String> {
public interface WfSectionRepository extends ReadOnlyRepository<WfSection, String> {
}