Skip to content

Commit 0c1b910

Browse files
committed
Improve demo application
1 parent 321d28c commit 0c1b910

File tree

4 files changed

+89
-16
lines changed

4 files changed

+89
-16
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ node_modules/
33
npm-debug.log
44
.build*
55
.idea
6-
index.html
76
dist/
7+
test/coverage/lcov-report/index.html

docs/client-demo.html

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,55 +33,65 @@
3333
<style>
3434
/* Custom scrollbar for the console output */
3535
#console-log-text::-webkit-scrollbar {
36-
width: 8px;
36+
width: 10px;
3737
}
3838
#console-log-text::-webkit-scrollbar-track {
39-
background: #1f2937;
39+
background: #111827;
40+
border-left: 1px solid #374151;
4041
}
4142
#console-log-text::-webkit-scrollbar-thumb {
4243
background: #4b5563;
43-
border-radius: 4px;
44+
border-radius: 5px;
45+
border: 2px solid #111827;
4446
}
4547
#console-log-text::-webkit-scrollbar-thumb:hover {
4648
background: #6b7280;
4749
}
4850

49-
/* Flex layout to make the console fill remaining height */
51+
/* Flex layout setup */
5052
body {
5153
display: flex;
5254
flex-direction: column;
5355
height: 100vh;
5456
margin: 0;
55-
overflow: hidden; /* Prevent body scrolling, let console scroll */
57+
overflow: hidden;
5658
}
5759

5860
.main-container {
5961
flex: 1;
6062
display: flex;
6163
flex-direction: column;
6264
padding-bottom: 2rem;
65+
min-height: 0; /* Crucial for flex child to allow inner scrolling */
6366
}
6467

6568
.terminal-container {
6669
flex: 1;
6770
display: flex;
6871
flex-direction: column;
69-
min-height: 0; /* Important for flex child scrolling */
72+
min-height: 0; /* Crucial for flex child to allow inner scrolling */
7073
}
7174

7275
#console-log-text {
7376
flex: 1;
74-
overflow-y: auto;
77+
overflow-y: auto; /* Enables vertical scrolling */
78+
word-wrap: break-word;
79+
}
80+
81+
/* Prevent layout shift during auto-scroll */
82+
.log-entry {
83+
margin-bottom: 0.5rem;
84+
white-space: pre-wrap;
85+
word-break: break-all;
7586
}
7687
</style>
7788
</head>
7889
<body class="bg-gray-50 font-sans text-gray-800">
7990

80-
<!-- I've forced the max width of the whole container to exactly 1024px and centered it -->
8191
<div class="main-container w-[1024px] max-w-[1024px] mx-auto pt-8 px-4">
8292

8393
<!-- Header Section -->
84-
<div class="text-center mb-6">
94+
<div class="text-center mb-6 shrink-0">
8595
<h1 class="text-4xl font-extrabold text-gray-900 tracking-tight mb-2">
8696
<span class="block text-brand">Labs64</span>
8797
<a href="https://netlicensing.io/" target="_blank" class="hover:text-brand-hover transition-colors">
@@ -111,9 +121,9 @@ <h1 class="text-4xl font-extrabold text-gray-900 tracking-tight mb-2">
111121
</div>
112122

113123
<!-- Terminal Output Section -->
114-
<div class="terminal-container bg-gray-900 rounded-lg shadow-xl overflow-hidden border border-gray-700 w-full">
124+
<div class="terminal-container bg-gray-900 rounded-lg shadow-xl overflow-hidden border border-gray-700 w-full relative">
115125
<!-- Mac-style window header -->
116-
<div class="bg-gray-800 px-4 py-2 border-b border-gray-700 flex items-center shrink-0">
126+
<div class="bg-gray-800 px-4 py-2 border-b border-gray-700 flex items-center shrink-0 z-10">
117127
<div class="flex space-x-2">
118128
<div class="w-3 h-3 rounded-full bg-red-500"></div>
119129
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
@@ -122,7 +132,7 @@ <h1 class="text-4xl font-extrabold text-gray-900 tracking-tight mb-2">
122132
<div class="mx-auto text-gray-400 text-xs font-mono">demo-output.log</div>
123133
</div>
124134

125-
<!-- Output container now takes up remaining screen height -->
135+
<!-- Output container now takes up remaining screen height AND allows scrolling -->
126136
<div class="p-4 font-mono text-sm w-full" id="console-log-text">
127137
<div class="text-gray-500 mb-2">Ready. Click 'Execute Demo' to start the NetLicensing API simulation...</div>
128138
</div>
@@ -156,7 +166,7 @@ <h1 class="text-4xl font-extrabold text-gray-900 tracking-tight mb-2">
156166
function appendLog(args, colorClass, prefixChar = '>') {
157167
const msg = formatArgs(args);
158168
const div = document.createElement('div');
159-
div.className = `mb-2 whitespace-pre-wrap break-all ${colorClass}`;
169+
div.className = `log-entry ${colorClass}`;
160170

161171
const prefix = document.createElement('span');
162172
prefix.className = 'text-[#E14817] mr-2 select-none font-bold';
@@ -166,7 +176,12 @@ <h1 class="text-4xl font-extrabold text-gray-900 tracking-tight mb-2">
166176
div.appendChild(document.createTextNode(msg));
167177

168178
logger.appendChild(div);
169-
logger.scrollTop = logger.scrollHeight;
179+
180+
// Ensure the scroll goes all the way to the newly added item
181+
// Use requestAnimationFrame to ensure the DOM has updated before calculating height
182+
requestAnimationFrame(() => {
183+
logger.scrollTop = logger.scrollHeight;
184+
});
170185
}
171186

172187
console.log = function() {

docs/client-demo.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const NetLicensingDemo = async () => {
2+
try {
23
const {
34
Context,
45
LicenseType,
@@ -301,8 +302,21 @@ const NetLicensingDemo = async () => {
301302
// region ********* CleanUp
302303

303304
console.log('All done.');
304-
await ProductService.delete(context, productNumber, true);
305+
await ProductService.delete(context, productNumber, true);
305306
// endregion
307+
308+
} catch (error) {
309+
console.error('❌ NetLicensing API Error:');
310+
311+
// Check if it's an Axios/API response error
312+
if (error.response && error.response.data) {
313+
console.error('Status Code:', error.response.status);
314+
console.error(JSON.stringify(error.response.data, null, 2));
315+
} else {
316+
// Standard JS/Network error
317+
console.error(error.message || error);
318+
}
319+
}
306320
};
307321

308322
function numberWithPrefix(prefix, number) {

docs/index.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="refresh" content="0; url=client-demo.html">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Redirecting to Labs64 NetLicensing Client Demo</title>
8+
<script>
9+
// Fallback JavaScript redirect in case meta refresh is disabled
10+
window.location.href = "client-demo.html";
11+
</script>
12+
<style>
13+
body {
14+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
15+
background-color: #f9fafb;
16+
color: #374151;
17+
display: flex;
18+
justify-content: center;
19+
align-items: center;
20+
height: 100vh;
21+
margin: 0;
22+
text-align: center;
23+
}
24+
.container {
25+
max-width: 500px;
26+
padding: 2rem;
27+
}
28+
a {
29+
color: #E14817; /* Labs64 Brand Color */
30+
text-decoration: none;
31+
font-weight: 600;
32+
}
33+
a:hover {
34+
text-decoration: underline;
35+
}
36+
</style>
37+
</head>
38+
<body>
39+
<div class="container">
40+
<h2>Redirecting to Demo...</h2>
41+
<p>If you are not redirected automatically, please <a href="client-demo.html">click here</a>.</p>
42+
</div>
43+
</body>
44+
</html>

0 commit comments

Comments
 (0)