-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow_description.html
More file actions
105 lines (99 loc) · 3.85 KB
/
workflow_description.html
File metadata and controls
105 lines (99 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Workflow Description</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50 text-gray-800 p-6 font-sans">
<div class="w-full flex justify-center px-4">
<h1 class="text-3xl font-bold mb-6 text-center"></h1>
<div class="w-full overflow-x-auto shadow rounded-lg">
<div class="mb-4 flex flex-wrap gap-4 text-sm">
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-red-100 border border-red-300 rounded"></div>
<span>Mandatory</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-orange-100 border border-orange-300 rounded"></div>
<span>Optional</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-green-100 border border-green-300 rounded"></div>
<span>Automatic</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-gray-50 border border-gray-300 rounded"></div>
<span>Default / Unspecified</span>
</div>
</div>
<table class="w-full table-auto bg-white border border-gray-300 text-sm text-left">
<thead class="bg-gray-100 text-gray-700 uppercase">
<tr>
<th class="px-4 py-3 border-b cursor-pointer" data-key="label (source)">Label</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="cardinality">Cardinality</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="type">Type</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="description">Description</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="example">Example</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="cff">CFF</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="ro-crate">ROCrate</th>
<th class="px-4 py-3 border-b cursor-pointer" data-key="Bioschemas">Bioschemas</th>
</tr>
</thead>
<tbody id="peopleTable" class="divide-y divide-gray-200">
<!-- Data rows will be injected here -->
</tbody>
</table>
</div>
</div>
<script>
let tableData = [];
function renderTable(data) {
const tbody = document.getElementById("peopleTable");
tbody.innerHTML = "";
data.forEach(person => {
let rowColor = "bg-gray-50";
switch (person.required) {
case "mandatory": rowColor = "bg-red-100 hover:bg-red-300"; break;
case "optional": rowColor = "bg-orange-100 hover:bg-orange-200"; break;
case "automatic": rowColor = "bg-green-100 hover:bg-green-200"; break;
}
const row = `
<tr class="${rowColor}">
<td class="px-4 py-2 border-b">${person["label (source)"]}</td>
<td class="px-4 py-2 border-b">${person.cardinality}</td>
<td class="px-4 py-2 border-b">${person.type}</td>
<td class="px-4 py-2 border-b">${person.description}</td>
<td class="px-4 py-2 border-b">${person.example}</td>
<td class="px-4 py-2 border-b">${person.cff}</td>
<td class="px-4 py-2 border-b">${person["ro-crate"]}</td>
<td class="px-4 py-2 border-b">${person["Bioschemas"]}</td>
</tr>`;
tbody.innerHTML += row;
});
}
// Load and render initial data
fetch('workflow_description.json')
.then(response => response.json())
.then(data => {
tableData = data;
renderTable(tableData);
});
// Add sorting to headers
let sortOrder = 1;
document.querySelectorAll("th[data-key]").forEach(th => {
th.addEventListener("click", () => {
const key = th.getAttribute("data-key");
sortOrder *= -1;
tableData.sort((a, b) => {
const aVal = (a[key] || "").toString().toLowerCase();
const bVal = (b[key] || "").toString().toLowerCase();
return aVal.localeCompare(bVal) * sortOrder;
});
renderTable(tableData);
});
});
</script>
</body>
</html>