-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
338 lines (301 loc) · 12.5 KB
/
index.html
File metadata and controls
338 lines (301 loc) · 12.5 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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Component List</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.github-strip {
position:relative;
overflow: hidden;
white-space: nowrap;
background-color: #000;
color: #fff;
padding: 10px;
width: 100%;
}
.github-strip a {
color: yellow;
font-weight: bold;
}
.github-strip span {
display: inline-block;
animation: marquee 40s linear infinite;
}
@keyframes marquee {
0% {
transform: translateX(100vw);
}
100% {
transform: translateX(-100%);
}
}
.header {
display: flex;
justify-content: center;
align-items: center;
padding: 50px;
background-color: #f8f9fa;
border-bottom: 1px solid #ddd;
}
.header-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}
.header-content h1, .header-content p {
margin: 0;
}
.description {
text-align: center;
margin: 50px 0;
width: 40%; /* Make the div 90% of the width of its parent */
margin: 0 auto;
}
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
justify-items: center;
max-width: 1500px; /* Adjust this value as needed */
margin: 0 auto 50px; /* Adds 50px of space below the grid */
padding: 20px; /* Adds some space around the grid */
border: 1px solid #ddd; /* Adds a grey border around the grid */
border-radius: 10px; /* Adds rounded corners to the grid */
background-color: #ddd; /* Sets the background color of the grid to grey */
}
.card {
position: relative;
border: 1px solid #ddd;
border-radius: 10px; /* Adds rounded corners to the cards */
padding: 20px;
width: 100%;
box-sizing: border-box;
background-color: #fff; /* Sets the background color of the cards to white */
}
.badge {
display: inline-block;
padding: 5px 10px;
margin: 5px;
color: #fff;
border-radius: 5px;
}
.license {
background-color: #007bff;
}
.version {
background-color: #28a745;
}
.tag {
background-color: #ffc107;
}
.badge.type {
background-color: #6f42c1;
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 60%; /* Make the modal thinner */
border-radius: 10px; /* Round the corners */
}
#modal-code {
background-color: #000;
color: #fff;
padding: 10px;
border-radius: 5px;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
.view-yaml {
display: block;
width: 150px; /* Make the button smaller */
height: 40px; /* Make the button smaller */
margin: 20px auto;
background-color: #333; /* Make the color dark grey */
color: #fff;
border: none;
border-radius: 20px; /* Adjust to match the new button size */
font-size: 14px; /* Make the text smaller */
cursor: pointer;
transition: background-color 0.3s ease;
}
.view-yaml:hover {
background-color: #111; /* Make the hover color darker */
}
.repo-link {
display: block;
margin: 10px 0;
color: #007bff;
text-decoration: none;
}
.repo-link:hover {
text-decoration: underline;
}
.copy-logo {
position: absolute;
top: 10px;
right: 10px;
cursor: pointer;
background-color: #fff;
border-radius: 10%;
padding: 5px;
}
.copy-logo svg {
fill: #000;
}
.copy-logo:hover {
background-color: #999;
}
#copy-tooltip {
position: fixed; /* Fixed positioning */
top: 30%;
left: 50%;
transform: translate(-50%, -50%); /* Center the tooltip */
color: #ffffff; /* White text */
background-color: #000000; /* Black background */
border-color:#f8f9fa;
padding: 10px; /* Increase padding to make the tooltip bigger */
border-radius: 5px; /* Rounded corners */
text-align: center; /* Center the text */
display: none; /* Initially hidden */
z-index: 1000; /* High z-index to bring the tooltip to the front */
font-size: 3em; /* Increase font size to make the tooltip bigger */
}
</style>
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/themes/prism-okaidia.min.css" rel="stylesheet" />
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/components/prism-yaml.min.js"></script>
<div class="github-strip">
<span><a href="https://github.com/odtp-org/odtp-zoo-db">
Welcome to the ODTP Zoo Prototype</a> | This is a collection of Open Digital Twins Platform (ODTP) compatible components.
If you want to learn more about the project, visit: <a href="https://odtp-org.github.io/odtp-manuals/">https://odtp-org.github.io/odtp-manuals/</a> |
Submit your compatible component here: <a href="https://github.com/odtp-org/odtp-zoo-db">https://github.com/odtp-org/odtp-zoo-db</a></span>
</div>
<div class="header">
<div class="header-content">
<h1>ODTP Official Zoo</h1>
<p>This is a zoo prototype for ODTP compatible components.</p>
</div>
</div>
<div class="description">
<p>Add this zoo to your ODTP instance with:</p>
<pre style="background-color: #000000; color: #ffffff; padding: 10px;"><code>https://github.com/odtp-org/odtp-zoo-db/blob/components/index.json</code></pre>
</div>
<div id="components-list" class="grid"></div>
<script>
// Fetch the JSON data from the local file
fetch('index.json')
.then(response => response.json())
.then(data => {
const componentsList = document.getElementById('components-list');
const modal = document.getElementById('modal');
const closeModal = document.getElementById('close-modal');
const modalCode = document.getElementById('modal-code');
closeModal.onclick = () => {
modal.style.display = 'none';
};
window.onclick = event => {
if (event.target == modal) {
modal.style.display = 'none';
}
};
// Define the copyToClipboard function in the global scope
window.copyToClipboard = function(name, version, repository) {
const text = `odtp new odtp-component-entry --name ${name} --component-version ${version} --repository ${repository}`;
navigator.clipboard.writeText(text).then(() => {
console.log('Copied to clipboard');
// Show the tooltip
const tooltip = document.getElementById('copy-tooltip');
tooltip.style.display = 'block';
// Hide the tooltip after 1 second
setTimeout(() => {
tooltip.style.display = 'none';
}, 1000);
}).catch(err => {
console.error('Error copying to clipboard', err);
});
};
// Loop through each component in the JSON data
data.components.forEach(component => {
const div = document.createElement('div');
div.className = 'card';
div.innerHTML = `
<div class="copy-logo" onclick="copyToClipboard('${component['component-name']}', '${component['component-version']}', '${component['component-repository']}')">
<svg fill="#000000" width="20px" height="20px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M3,18 L3.11662113,17.9932723 C3.57570299,17.9399506 3.93995063,17.575703 3.99327227,17.1166211 L4,17 L4,4 L17,4 L17.1166211,3.99327227 C17.6139598,3.93550716 18,3.51283584 18,3 C18,2.48716416 17.6139598,2.06449284 17.1166211,2.00672773 L17,2 L3,2 L2.88337887,2.00672773 C2.42429701,2.06004937 2.06004937,2.42429701 2.00672773,2.88337887 L2,3 L2,17 L2.00672773,17.1166211 C2.06004937,17.575703 2.42429701,17.9399506 2.88337887,17.9932723 L3,18 Z M21,22 L21.1166211,21.9932723 C21.575703,21.9399506 21.9399506,21.575703 21.9932723,21.1166211 L22,21 L22,7 L21.9932723,6.88337887 C21.9443941,6.46255383 21.6342517,6.12141588 21.2292908,6.02641071 L21.1166211,6.00672773 L21,6 L7,6 L6.88337887,6.00672773 C6.42429701,6.06004937 6.06004937,6.42429701 6.00672773,6.88337887 L6,7 L6,21 L6.00672773,21.1166211 C6.0556059,21.5374462 6.36574828,21.8785841 6.77070917,21.9735893 L6.88337887,21.9932723 L7,22 L21,22 Z M8,20 L8,8 L20,8 L20,20 L8,20 Z"/>
</svg>
</div>
<div id="copy-tooltip" style="display: none;">odtp command copied</div>
<h2><a href="${component['component-repository']}" class="repo-link">${component['component-name']}</a></h2>
<div class="badges">
<span class="badge license">${component['component-license']}</span>
<span class="badge version">${component['component-version']}</span>
<span class="badge type">${component['component-type']}</span>
</div>
<p>${component['component-description']}</p>
<h3>Tags</h3>
<div class="tags">
${component.tags.map(tag => `<span class="badge tag">${tag}</span>`).join('')}
</div>
<button class="view-yaml">View YAML</button>
`;
componentsList.appendChild(div);
div.querySelector('.view-yaml').onclick = () => {
fetch(`components/${component['odpt.yaml']}`)
.then(response => response.text())
.then(yaml => {
modalCode.innerHTML = Prism.highlight(yaml, Prism.languages.yaml, 'yaml');
modal.style.display = 'block';
})
.catch(error => console.error('Error loading the YAML file:', error));
};
});
})
.catch(error => console.error('Error loading the JSON file:', error));
</script>
<!-- Add this just before the closing body tag -->
</body>
<footer style="background-color: #333; color: #fff; padding: 20px; text-align: center;">
<p>Open Digital Twin Platform | SDSC | CSFM</p>
<!-- <p><a href="#" style="color: #fff; text-decoration: none;">Terms of Service</a> | <a href="#" style="color: #fff; text-decoration: none;">Privacy Policy</a></p> -->
</footer>
<!-- Add this just before the closing body tag -->
<div id="modal" class="modal">
<div class="modal-content">
<span id="close-modal" class="close">×</span>
<pre id="modal-code"></pre>
</div>
</div>
</html>