-
Notifications
You must be signed in to change notification settings - Fork 72
/
index.html
196 lines (180 loc) · 6.3 KB
/
index.html
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gloo Workshops</title>
<style>
table {
border-collapse: collapse;
margin: 25px;
font-size: 0.9em;
font-family: sans-serif;
min-width: 400px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}
thead tr {
background-color: #048ced;
color: #ffffff;
text-align: center;
}
table td, th {
padding: 15px 50px;
}
table tbody tr {
border-bottom: 1px solid #dddddd;
}
table tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
table tbody tr:last-of-type {
border-bottom: 2px solid #048ced;
}
</style>
</head>
<body>
<h1>Gloo Workshops in Markdown Format</h1>
<div id="table1"></div>
<h1>Gloo Workshops in Instruqt</h1>
<div id="table2"></div>
<script>
// JSON data for "Gloo Workshops in Markdown Format"
const jsonTable1 = {
"headers": ["Workshop", "default", "airgap", "gitops", "openshift", "ambient"],
"rows": [
{
"Workshop": "Gloo Mesh Core",
"default": [
{ "text": "2.5", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/core/2-5/default" },
{ "text": "2.6", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/core/2-6/default" }
],
"ambient": [
{ "text": "2.6", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/core/2-6/ambient" }
]
},
{
"Workshop": "Gloo Mesh Enterprise",
"default": [
{ "text": "2.5", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-5/default" },
{ "text": "2.6", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-6/default" }
],
"airgap": [
{ "text": "2.5", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-5/airgap/default" },
{ "text": "2.6", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-6/airgap/default" }
],
"gitops": [
{ "text": "2.5", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-5/gitops/default" },
{ "text": "2.6", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-6/gitops/default" }
],
"openshift": [
{ "text": "2.5", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-5/openshift/default" },
{ "text": "2.6", "url": "https://github.com/solo-io/workshops/tree/master/gloo-mesh/enterprise/2-6/openshift/default" }
],
},
{
"Workshop": "Gloo Edge",
"default": [
{ "text": "1.16", "url": "https://github.com/solo-io/workshops/tree/master/gloo-edge" }
],
},
{
"Workshop": "Gloo Gateway Open Source",
"default": [
{ "text": "1.17", "url": "https://github.com/solo-io/workshops/tree/master/gloo-gateway/1-17/oss/default" },
{ "text": "1.18", "url": "https://github.com/solo-io/workshops/tree/master/gloo-gateway/1-18/oss/default" }
],
},
{
"Workshop": "Gloo Gateway Enterprise",
"default": [
{ "text": "1.17", "url": "https://github.com/solo-io/workshops/tree/master/gloo-gateway/1-17/enterprise/default" },
{ "text": "1.18", "url": "https://github.com/solo-io/workshops/tree/master/gloo-gateway/1-18/enterprise/default" }
],
}
]
};
// JSON data for "Gloo Workshops in Instruqt"
const jsonTable2 = {
"headers": ["Workshop", "default", "ambient"],
"rows": [
{
"Workshop": "Gloo Mesh Core",
"default": [
{ "text": "2.5", "url": "https://play.instruqt.com/manage/soloio/tracks/core-2-5-default" },
{ "text": "2.6", "url": "https://play.instruqt.com/manage/soloio/tracks/core-2-6-default" }
],
"ambient": [
{ "text": "2.6", "url": "https://play.instruqt.com/manage/soloio/tracks/core-2-6-ambient" }
]
},
{
"Workshop": "Gloo Mesh Enterprise",
"default": [
{ "text": "2.5", "url": "https://play.instruqt.com/manage/soloio/tracks/enterprise-2-5-default" },
{ "text": "2.6", "url": "https://play.instruqt.com/manage/soloio/tracks/enterprise-2-6-default" }
],
},
{
"Workshop": "Gloo Edge",
"default": [
{ "text": "1.16", "url": "https://play.instruqt.com/manage/soloio/tracks/gloo-edge" }
],
},
{
"Workshop": "Gloo Gateway Open Source",
"default": [
{ "text": "1.17", "url": "https://play.instruqt.com/manage/soloio/tracks/1-17-oss-default" },
{ "text": "1.18", "url": "https://play.instruqt.com/manage/soloio/tracks/1-18-oss-default" }
],
},
{
"Workshop": "Gloo Gateway Enterprise",
"default": [
{ "text": "1.17", "url": "https://play.instruqt.com/manage/soloio/tracks/1-17-enterprise-default" },
{ "text": "1.18", "url": "https://play.instruqt.com/manage/soloio/tracks/1-18-enterprise-default" }
],
}
]
};
/**
* Function to convert link objects to HTML anchor tags.
* @param {Array} links - Array of link objects with text and url.
* @returns {string} - HTML string with anchor tags.
*/
function convertLinksToHtml(links) {
if (!links || links.length === 0) return '';
return links.map(link => `<a href="${link.url}" target="_blank">${link.text}</a>`).join(' / ');
}
/**
* Function to generate HTML table from JSON data.
* @param {Object} tableData - JSON object containing headers and rows.
* @returns {string} - HTML string for the table.
*/
function generateHtmlTable(tableData) {
const { headers, rows } = tableData;
let html = '<table>\n<thead>\n<tr>';
// Generate table headers
headers.forEach(header => {
html += `<th>${header}</th>`;
});
html += '</tr>\n</thead>\n<tbody>\n';
// Generate table rows
rows.forEach(row => {
html += '<tr>';
headers.forEach(header => {
if (header === "Workshop") {
html += `<td>${row[header]}</td>`;
} else {
html += `<td>${convertLinksToHtml(row[header])}</td>`;
}
});
html += '</tr>\n';
});
html += '</tbody>\n</table>';
return html;
}
// Insert tables into the DOM
document.getElementById('table1').innerHTML = generateHtmlTable(jsonTable1);
document.getElementById('table2').innerHTML = generateHtmlTable(jsonTable2);
</script>
</body>
</html>