Skip to content

Commit 9bd4d77

Browse files
committed
Allow to copy the token easily
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 2f10b38 commit 9bd4d77

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

core/http/views/explorer.html

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,27 @@
131131
.warning-box i {
132132
margin-right: 10px;
133133
}
134+
.token-box {
135+
background-color: #4a5568;
136+
padding: 10px;
137+
border-radius: 4px;
138+
margin-top: 10px;
139+
position: relative;
140+
cursor: pointer;
141+
}
142+
.token-box:hover {
143+
background-color: #5a6b7e;
144+
}
145+
.token-text {
146+
overflow-wrap: break-word;
147+
font-family: monospace;
148+
}
149+
.copy-icon {
150+
position: absolute;
151+
top: 10px;
152+
right: 10px;
153+
color: #e2e8f0;
154+
}
134155
</style>
135156

136157
<body class="bg-gray-900 text-gray-200">
@@ -143,10 +164,13 @@ <h1 class="text-5xl font-bold text-gray-100">Network Clusters Explorer</h1>
143164
</header>
144165

145166
<div class="container mx-auto px-4 flex-grow">
146-
<!-- Warning Box -->
147-
<div class="warning-box bg-yellow-500 mb-20 pt-5 pb-5 pr-5 pl-5 text-lg">
167+
<!-- Warning Box -->
168+
<div class="warning-box bg-yellow-100 text-gray-800 mb-20 pt-5 pb-5 pr-5 pl-5 text-lg">
148169
<i class="fa-solid fa-triangle-exclamation"></i>
149-
This application is provided without any warranty. Use it at your own risk. We are not responsible for any potential harm or misuse. Be aware that malicious actors might attempt to compromise your systems. Although the community will address bugs, this is experimental software and may be insecure to deploy on your hardware unless you take all necessary precautions.
170+
The explorer is a global, community-driven tool to share network tokens and view available clusters in the globe.
171+
Anyone can use the tokens to offload computation and use the clusters available or share resources.
172+
This is provided without any warranty. Use it at your own risk. We are not responsible for any potential harm or misuse. Sharing tokens globally allows anyone from the internet to use your instances.
173+
Although the community will address bugs, this is experimental software and may be insecure to deploy on your hardware unless you take all necessary precautions.
150174
</div>
151175
<div class="flow-root">
152176
<!-- Toggle button for showing/hiding the form -->
@@ -198,13 +222,21 @@ <h2 class="text-3xl font-bold mb-4"><i class="fa-solid fa-plus"></i> Add New Net
198222
<template x-for="network in networks" :key="network.name">
199223
<div class="network-card">
200224
<div class="network-title" x-text="network.name"></div>
201-
<div class="network-token" x-text="'Token: ' + network.token"></div>
202-
<p x-text="network.description"></p>
225+
<div class="token-box" @click="copyToken(network.token)">
226+
<i class="fa-solid fa-copy copy-icon"></i>
227+
Token (click to copy): <br>
228+
<span class="token-text" x-text="network.token"></span>
229+
</div>
230+
231+
<div class="cluster">
232+
<p class="text-lg">Description</p>
233+
<p x-text="network.description"></p>
234+
</div>
203235

204236
<template x-for="cluster in network.Clusters" :key="cluster.NetworkID + cluster.Type">
205237
<div class="cluster">
206238
<div class="cluster-title" x-text="'Cluster Type: ' + cluster.Type"></div>
207-
<p x-text="'Network ID: ' + (cluster.NetworkID || 'N/A')"></p>
239+
<p x-show="cluster.NetworkID" x-text="'Network ID: ' + (cluster.NetworkID || 'N/A')"></p>
208240
<p x-text="'Number of Workers: ' + cluster.Workers.length"></p>
209241
</div>
210242
</template>
@@ -281,7 +313,16 @@ <h2 class="text-3xl font-bold mb-4"><i class="fa-solid fa-plus"></i> Add New Net
281313
}
282314
});
283315
},
284-
316+
copyToken(token) {
317+
navigator.clipboard.writeText(token)
318+
.then(() => {
319+
console.log('Token copied to clipboard:', token);
320+
alert('Token copied to clipboard!');
321+
})
322+
.catch(err => {
323+
console.error('Failed to copy token:', err);
324+
});
325+
},
285326
init() {
286327
console.log('Initializing Alpine component...');
287328
this.fetchNetworks();

0 commit comments

Comments
 (0)