Skip to content

Commit 9755a96

Browse files
committed
Begin integration policies
1 parent d672198 commit 9755a96

5 files changed

Lines changed: 88 additions & 10 deletions

File tree

public/.hermes/process/transport.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,20 @@
482482
{"conflict": "Curation"}
483483
],
484484

485-
"policy-report":{"policy 1": "Validated"}
485+
"policies": [{"policy 1": {"conforms": true}},
486+
{"policy 2": {"conforms": false,
487+
"resultMessage": "String length not >= Literal(\"100\", datatype=xsd:integer)" ,
488+
"resultPath": "https://schema.org/description" ,
489+
"resultSeverity": "Violation" ,
490+
"sourceConstraintComponent": "MinLengthConstraintComponent" ,
491+
"sourceShape": { "datatype": "string" ,
492+
"description": "The software description must have a certain length.",
493+
"minLength": 100 ,
494+
"name": "Long description" ,
495+
"path": "https://schema.org/description" },
496+
"value": "Proof-of-concept implementation of the HERMES workflow."
497+
}}
498+
499+
]
486500
}
487501

public/curation/curation.js

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,59 @@ export function displayJSON(json_document){
1616
document.body.appendChild(back);
1717
}
1818

19-
20-
21-
//document.getElementById("test").innerHTML = 'Project <b>'+data.name[0]+'</b>';
2219
const keys = Object.keys(data);
20+
2321
const metadateTemp = document.querySelector("#metadate");
2422
const tbody = document.querySelector("#metadata");
23+
const policyTemp = document.querySelector("#policy"),
24+
policyDiv = document.querySelector("#sw-policies");
25+
26+
27+
const header = document.querySelector("#header-policies");
28+
header.style.display = "none";
29+
30+
keys.forEach(element => {
31+
if(element.toLowerCase().includes("name")){
32+
console.log(element);
33+
document.getElementById("project-name").innerHTML = element.charAt(0).toUpperCase() + element.slice(1) +' <b> '+data[element][0]+'</b>';
34+
}
35+
if(element=="policies"){
36+
header.style.display = "block";
37+
console.log("policies");
38+
data[element].forEach(pol =>{
39+
console.log(pol);
40+
const policy = document.importNode(policyTemp.content, true);
41+
console.log(policy);
42+
const tbodyPol = policy.querySelector("tbody"),
43+
polname = policy.querySelector("#policy-name");
44+
const policyId = Object.keys(pol)[0];
45+
polname.textContent = `${policyId}`;
46+
policyDiv.appendChild(policy);
47+
const policyReportTemp = document.querySelector("#policy-report");
48+
const polKeys = Object.keys(pol[policyId]);
49+
console.log(polKeys);
50+
polKeys.forEach(report =>{
51+
console.log(report);
52+
const prow = document.importNode(policyReportTemp.content, true);
53+
54+
const pkey = prow.querySelector("#pkey"),
55+
pvalue = prow.querySelector("#pvalue");
56+
//pconforms = prow.querySelector("#policy-conforms");
57+
if(report=="conforms"){
58+
console.log("conforms");
59+
}
60+
console.log(report,pol[policyId][report]);
61+
pkey.textContent = `${report}`;
62+
extract_info(pvalue, pol[policyId][report]);
63+
//pvalue.textContent = `${pol[policyId][report]}`;
64+
tbodyPol.appendChild(prow);
65+
})
66+
})
2567

26-
keys.forEach(element => {
68+
return;
69+
}
2770
const row = document.importNode(metadateTemp.content, true);
71+
console.log(row);
2872
const mkey = row.querySelector("#key"),
2973
mvalue = row.querySelector("#value"),
3074
mtag = row.querySelector("#tag");

public/curation/extract.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function extract_info(cell, obj, tag, category){
22
if(!Array.isArray(obj)){
33
obj = [obj];
44
}
5-
if(typeof obj[0] === "string" || typeof obj[0] == "number"){
5+
if(typeof obj[0] === "string" || typeof obj[0] == "number" || typeof obj[0] == "boolean"){
66
if(obj[2] && obj[2]["conflict"] == "Curation"){
77
console.log(`${Object.keys(obj[2])}`);
88
const element = document.createElement("div");

public/curation/index.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1><a href="../">Software CaRD</a>
2020
</canvas>
2121
</div>
2222

23-
<p id="test"></p>
23+
<p id="project-name"><b>Metadata</b></p>
2424
<input type="checkbox" id="extended" name="extended" value=1 checked>
2525
<label for="extended">Extended view</label><br>
2626

@@ -46,10 +46,22 @@ <h1><a href="../">Software CaRD</a>
4646
</table>
4747

4848
</div>
49-
<template id="policy-report">
50-
<h3>Policy Report</h3>
51-
49+
<div id="sw-policies">
50+
<h3 id="header-policies">Policy Report</h3>
51+
<template id="policy">
52+
<b id="policy-name"></b>
53+
<table>
54+
<tbody>
55+
<template id="policy-report">
56+
<tr id="tr">
57+
<td id="pkey"></td>
58+
<td id="pvalue"></td>
59+
</tr>
60+
</template>
61+
</tbody>
62+
</table>
5263
</template>
64+
</div>
5365
</div>
5466

5567

public/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ button{
3535
justify-content: center;
3636
padding: 1%;
3737
}
38+
#header-policies{
39+
display: none;
40+
;
41+
}
3842

3943
#content{
4044
display: flex;
4145
justify-content: center;
46+
align-items: center;
47+
flex-direction: column;
4248
}
4349
#hermes{
4450
width: 80%;
51+
display: flex;
52+
justify-content: center;
4553
}
4654

4755
.tooltip {

0 commit comments

Comments
 (0)