repo-hi info
This commit is contained in:
parent
530f2c85a5
commit
731ce580d8
|
@ -3,6 +3,7 @@ package eu.dnetlib.wfs.manager.service;
|
|||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
@ -154,14 +155,25 @@ public class WorkflowManagerService {
|
|||
}
|
||||
|
||||
public List<WfRepoHiDesc> listRepoHis() {
|
||||
return clientFactory.getClient(SimpleResourceClient.class)
|
||||
.findResources(WorkflowsConstants.WF_TEMPLATE, WorkflowsConstants.REPO_HI_JOB)
|
||||
final SimpleResourceClient client = clientFactory.getClient(SimpleResourceClient.class);
|
||||
|
||||
return client.findResources(WorkflowsConstants.WF_TEMPLATE, WorkflowsConstants.REPO_HI_JOB)
|
||||
.stream()
|
||||
.map(r -> {
|
||||
final WfTemplate tmpl = client.findResourceContent(r.getId(), WfTemplate.class);
|
||||
|
||||
final WfRepoHiDesc repohi = new WfRepoHiDesc();
|
||||
repohi.setId(r.getId());
|
||||
repohi.setName(r.getName());
|
||||
repohi.setDescription(r.getDescription());
|
||||
repohi.setGraph(tmpl.getGraph());
|
||||
repohi.setParameters(tmpl.getParameters());
|
||||
repohi.setInfo(tmpl.getInfo());
|
||||
|
||||
// TODO (MEDIUM PRIORITY)
|
||||
repohi.setExpectedEoscDsTypes(new HashSet<>());
|
||||
repohi.setExpectedCompliances(new HashSet<>());
|
||||
|
||||
return repohi;
|
||||
})
|
||||
.sorted(Comparator.comparing(WfRepoHiDesc::getName))
|
||||
|
|
|
@ -256,15 +256,10 @@ export interface WfProcessStatus {
|
|||
// TODO
|
||||
}
|
||||
|
||||
export interface WfRepoHi {
|
||||
id: string,
|
||||
name: string,
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface WfTemplate {
|
||||
parameters: any,
|
||||
graph: any
|
||||
graph: any,
|
||||
info: Map<string, string>
|
||||
}
|
||||
|
||||
export interface WfTemplateDesc extends WfTemplate {
|
||||
|
@ -272,3 +267,8 @@ export interface WfTemplateDesc extends WfTemplate {
|
|||
name: string,
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface WfRepoHi extends WfTemplateDesc {
|
||||
expectedEoscDsTypes: string[],
|
||||
expectedCompliances: string[]
|
||||
}
|
||||
|
|
|
@ -7,7 +7,26 @@
|
|||
<mat-card-subtitle>{{wf.description}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
...
|
||||
<table class="dsm-result-table">
|
||||
<tr>
|
||||
<th align="left" width="20%">Expected Eosc Types</th>
|
||||
<td>
|
||||
<span *ngIf="!wf.expectedEoscDsTypes.length">ALL</span>
|
||||
<span *ngIf="wf.expectedEoscDsTypes.length">{{wf.expectedEoscDsTypes.join(', ')}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">Expected Compliances</th>
|
||||
<td>
|
||||
<span *ngIf="!wf.expectedCompliances.length">ALL</span>
|
||||
<span *ngIf="wf.expectedCompliances.length">{{wf.expectedCompliances.join(', ')}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngFor="let item of wf.info | keyvalue">
|
||||
<th align="left">{{item.key}}</th>
|
||||
<td>{{item.value}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-stroked-button color="primary" mat-dialog-close (click)="startRepoHiWf(wf.id)">
|
||||
|
|
|
@ -45,10 +45,6 @@ export class DsmClient extends ISClient {
|
|||
this.httpGet<WfRepoHi>('/proxy/byType/wf_manager/api/repo-his', onSuccess);
|
||||
}
|
||||
|
||||
dsmGetRepoHiTemplate(id: string, onSuccess: Function) {
|
||||
this.httpGet<WfTemplate>('/proxy/byType/wf_manager/api/template/' + encodeURIComponent(id), onSuccess);
|
||||
}
|
||||
|
||||
dsmRepoHiWf(wfId: string, onSuccess: Function) {
|
||||
alert('TODO');
|
||||
}
|
||||
|
|
|
@ -358,18 +358,7 @@ export class DsmAddWorkflowDialog {
|
|||
}
|
||||
|
||||
showGraphModal(wf: WfRepoHi): void {
|
||||
this.client.dsmGetRepoHiTemplate(wf.id, (tmpl: WfTemplate) => {
|
||||
const dialogRef = this.dialog.open(WfTemplateDialog, {
|
||||
data: {
|
||||
id: wf.id,
|
||||
name: wf.name,
|
||||
description: wf.description,
|
||||
graph: tmpl.graph,
|
||||
parameters: tmpl.parameters
|
||||
},
|
||||
width: '80%'
|
||||
});
|
||||
});
|
||||
const dialogRef = this.dialog.open(WfTemplateDialog, { data: wf, width: '80%' });
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
package eu.dnetlib.domain.wfs;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class WfRepoHiDesc implements Serializable {
|
||||
public class WfRepoHiDesc extends WfTemplate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5192964707849869720L;
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private Set<String> expectedEoscDsTypes = new HashSet<>();
|
||||
private Set<String> expectedCompliances = new HashSet<>();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
@ -34,4 +38,20 @@ public class WfRepoHiDesc implements Serializable {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public Set<String> getExpectedEoscDsTypes() {
|
||||
return expectedEoscDsTypes;
|
||||
}
|
||||
|
||||
public void setExpectedEoscDsTypes(final Set<String> expectedEoscDsTypes) {
|
||||
this.expectedEoscDsTypes = expectedEoscDsTypes;
|
||||
}
|
||||
|
||||
public Set<String> getExpectedCompliances() {
|
||||
return expectedCompliances;
|
||||
}
|
||||
|
||||
public void setExpectedCompliances(final Set<String> expectedCompliances) {
|
||||
this.expectedCompliances = expectedCompliances;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.dnetlib.domain.wfs;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -21,6 +22,7 @@ public class WfTemplate implements Serializable {
|
|||
|
||||
private List<WfParam> parameters = new ArrayList<>();
|
||||
private List<Node> graph = new ArrayList<>();
|
||||
private Map<String, String> info = new LinkedHashMap<>();
|
||||
|
||||
public List<Node> getGraph() {
|
||||
return graph;
|
||||
|
@ -38,6 +40,14 @@ public class WfTemplate implements Serializable {
|
|||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public Map<String, String> getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(final Map<String, String> info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public static enum WfParamType {
|
||||
STRING,
|
||||
NUMBER,
|
||||
|
@ -60,12 +70,12 @@ public class WfTemplate implements Serializable {
|
|||
|
||||
public WfParam(final String name) {
|
||||
this.name = name;
|
||||
this.description = name;
|
||||
description = name;
|
||||
}
|
||||
|
||||
public WfParam(final String name, final WfParamType type) {
|
||||
this.name = name;
|
||||
this.description = name;
|
||||
description = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
@ -208,14 +218,14 @@ public class WfTemplate implements Serializable {
|
|||
|
||||
public Map<String, String> findEnvParams() {
|
||||
return input.stream()
|
||||
.filter(p -> StringUtils.isNotBlank(p.getEnv()))
|
||||
.collect(Collectors.toMap(NodeInputParam::getName, NodeInputParam::getEnv));
|
||||
.filter(p -> StringUtils.isNotBlank(p.getEnv()))
|
||||
.collect(Collectors.toMap(NodeInputParam::getName, NodeInputParam::getEnv));
|
||||
}
|
||||
|
||||
public Map<String, String> calculateInitialParams(final Map<String, String> globalParams, final Environment environment) {
|
||||
return input.stream()
|
||||
.filter(p -> StringUtils.isBlank(p.getEnv()))
|
||||
.collect(Collectors.toMap(NodeInputParam::getName, p -> calculateSimpleValue(p, globalParams, environment)));
|
||||
.filter(p -> StringUtils.isBlank(p.getEnv()))
|
||||
.collect(Collectors.toMap(NodeInputParam::getName, p -> calculateSimpleValue(p, globalParams, environment)));
|
||||
}
|
||||
|
||||
private String calculateSimpleValue(final NodeInputParam p, final Map<String, String> globalParams, final Environment environment) {
|
||||
|
@ -223,9 +233,8 @@ public class WfTemplate implements Serializable {
|
|||
final String ref = p.getRef();
|
||||
final String prop = p.getProperty();
|
||||
|
||||
if (StringUtils.isNotBlank(ref) && StringUtils.isNotBlank(globalParams.get(ref))) {
|
||||
return globalParams.get(ref);
|
||||
} else if (StringUtils.isNotBlank(value)) {
|
||||
if (StringUtils.isNotBlank(ref) && StringUtils.isNotBlank(globalParams.get(ref))) { return globalParams.get(ref); }
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
final Matcher matcher = Pattern.compile(regExRef, Pattern.MULTILINE).matcher(value);
|
||||
while (matcher.find()) {
|
||||
final String rName = matcher.group(1);
|
||||
|
@ -234,11 +243,9 @@ public class WfTemplate implements Serializable {
|
|||
value = value.replaceAll(Pattern.quote(matcher.group(0)), rValue);
|
||||
}
|
||||
return value;
|
||||
} else if (StringUtils.isNotBlank(prop)) {
|
||||
return environment.getProperty(prop);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (StringUtils.isNotBlank(prop)) { return environment.getProperty(prop); }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue