wf section size
This commit is contained in:
parent
289168a3b2
commit
9fd2a7ae66
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class WorkflowManagerService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public List<WfSection> listSections() {
|
||||
public Iterable<WfSection> listSections() {
|
||||
return wfSectionRepository.findAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,8 @@ export interface EmailTemplate {
|
|||
|
||||
export interface WfSection {
|
||||
id: string,
|
||||
name: string
|
||||
name: string,
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface WfConf {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue