agent-zero/webui/components/settings/tunnel/tunnel-section.html
Alessandro a1c12e9247 Refine settings and remote access UX
Restyle Settings and standard modals around a streamlined left-rail layout, clearer section hierarchy, advanced settings disclosures, and stronger update states.

Add persistent update visibility with quieter once-daily update notifications, plus Remote Link and Space Agent actions in the canvas rail. Refresh the tunnel experience as a normal Remote Link modal with clearer copy, QR/mobile affordances, and safer state handling.
2026-04-27 02:48:23 +02:00

512 lines
16 KiB
HTML

<html>
<head>
<title>Remote Link</title>
<script type="module">
import { store } from "/components/settings/tunnel/tunnel-store.js";
</script>
</head>
<body>
<div x-data>
<template x-if="$store.tunnelStore">
<div
id="tunnel-settings-section"
class="remote-link-surface"
x-init="$store.tunnelStore.init()"
x-destroy="$store.tunnelStore.cleanup()"
>
<header class="remote-link-hero">
<div class="remote-link-hero-icon" aria-hidden="true">
<span class="material-symbols-outlined">share</span>
</div>
<div>
<div class="section-title">Remote Link</div>
<div class="section-description">
Create a temporary HTTPS link for this Agent Zero instance, then open it from another browser or scan it from your phone.
</div>
</div>
</header>
<div class="remote-link-safety-note">
<span class="material-symbols-outlined" aria-hidden="true">lock</span>
<span>Use sign-in before sharing a remote link. The URL can reach your instance while the link is active.</span>
</div>
<div class="field remote-link-provider-field">
<div class="field-label">
<div class="field-title">Link provider</div>
<div class="field-description">
Cloudflare is the quickest path for a shareable URL. Microsoft Dev Tunnels may ask you to sign in.
</div>
</div>
<div class="field-control">
<select
id="tunnel-provider"
x-model="$store.tunnelStore.provider"
:disabled="$store.tunnelStore.isLoading"
>
<option value="cloudflared">Cloudflare</option>
<option value="microsoft">Microsoft Dev Tunnels</option>
<option value="serveo">Serveo</option>
</select>
</div>
</div>
<div class="remote-link-loading" x-show="$store.tunnelStore.isLoading" style="display: none;">
<span class="material-symbols-outlined spin" aria-hidden="true">progress_activity</span>
<span x-text="$store.tunnelStore.loadingText || 'Preparing remote link...'"></span>
</div>
<div class="microsoft-login-box" x-show="$store.tunnelStore.microsoftLoginCode" x-transition style="display: none;">
<div class="microsoft-login-header">
<span class="material-symbols-outlined" aria-hidden="true">key</span>
<div>
<div class="microsoft-login-title">Microsoft sign-in</div>
<div class="microsoft-login-copy">Approve the tunnel request, then Agent Zero will finish creating the link.</div>
</div>
</div>
<a class="microsoft-login-link" :href="$store.tunnelStore.microsoftLoginUrl" target="_blank" rel="noopener noreferrer">
<span class="material-symbols-outlined" aria-hidden="true">open_in_new</span>
<span x-text="$store.tunnelStore.microsoftLoginUrl"></span>
</a>
<div class="microsoft-login-code-row">
<div class="microsoft-login-code" x-text="$store.tunnelStore.microsoftLoginCode"></div>
<button
type="button"
class="btn btn-field btn-copy-code"
@click="$store.tunnelStore.copyLoginCode()"
:class="$store.tunnelStore.codeCopied ? 'copied' : ''"
>
<span class="material-symbols-outlined" aria-hidden="true" x-text="$store.tunnelStore.codeCopied ? 'check' : 'content_copy'"></span>
<span x-text="$store.tunnelStore.codeCopied ? 'Copied' : 'Copy code'"></span>
</button>
</div>
</div>
<div x-show="!$store.tunnelStore.isLoading">
<div class="remote-link-live" x-show="$store.tunnelStore.linkGenerated" style="display: none;">
<div class="remote-link-url-row">
<input
type="text"
class="remote-link-input"
:value="$store.tunnelStore.tunnelLink"
readonly
aria-label="Remote link URL"
>
<button
type="button"
class="remote-link-action copy-link-button"
@click="$store.tunnelStore.copyToClipboard()"
:class="{
'copy-success': $store.tunnelStore.copyState === 'success',
'copy-error': $store.tunnelStore.copyState === 'error'
}"
>
<span class="material-symbols-outlined" aria-hidden="true" x-text="$store.tunnelStore.copyLinkIcon"></span>
<span x-text="$store.tunnelStore.copyLinkLabel"></span>
</button>
<button
type="button"
class="remote-link-action refresh-link-button"
@click="$store.tunnelStore.refreshLink()"
:disabled="$store.tunnelStore.isLoading"
>
<span class="material-symbols-outlined" aria-hidden="true">refresh</span>
<span>New link</span>
</button>
</div>
<div class="remote-link-share-layout">
<div class="remote-link-qr-panel">
<div class="tunnel-qr-code" id="qrcode-tunnel"></div>
<div>
<div class="remote-link-qr-title">Open on mobile</div>
<div class="remote-link-qr-copy">Scan the code with your phone to connect without retyping the URL.</div>
</div>
</div>
<div class="remote-link-status-panel">
<span class="material-symbols-outlined" aria-hidden="true">verified</span>
<div>
<div class="remote-link-status-title">Link is active</div>
<div class="remote-link-status-copy">
It stays available until you stop it or the container restarts.
</div>
</div>
</div>
</div>
<div class="remote-link-footer-actions">
<button
type="button"
class="btn btn-cancel"
@click="$store.tunnelStore.stopTunnel()"
:disabled="$store.tunnelStore.isLoading"
>
<span class="material-symbols-outlined" aria-hidden="true">stop_circle</span>
<span>Stop link</span>
</button>
</div>
</div>
<div class="remote-link-empty" x-show="!$store.tunnelStore.linkGenerated">
<span class="material-symbols-outlined" aria-hidden="true">link</span>
<strong>No remote link yet</strong>
<span>Create one when you want to reach Agent Zero from another device or share access temporarily.</span>
<button
type="button"
class="btn btn-ok remote-link-primary"
@click="$store.tunnelStore.generateLink()"
:disabled="$store.tunnelStore.isLoading"
>
<span class="material-symbols-outlined" aria-hidden="true">share</span>
<span>Create remote link</span>
</button>
</div>
</div>
</div>
</template>
</div>
<style>
.modal-inner.remote-link-modal {
width: min(92vw, 760px);
max-height: min(88vh, 820px);
}
.modal-inner.remote-link-modal .modal-scroll {
padding: 0;
}
.modal-inner.remote-link-modal .modal-bd {
padding: 22px 24px 26px;
}
.remote-link-surface {
width: 100%;
margin: 0 auto;
}
.remote-link-hero {
display: grid;
grid-template-columns: auto minmax(0, 1fr);
gap: 14px;
align-items: start;
margin-bottom: 16px;
}
.remote-link-hero-icon {
display: grid;
place-items: center;
width: 42px;
height: 42px;
border-radius: 8px;
background: color-mix(in srgb, var(--color-primary) 16%, transparent);
color: color-mix(in srgb, var(--color-primary) 82%, var(--color-text));
}
.remote-link-hero-icon .material-symbols-outlined {
font-size: 24px;
}
.remote-link-safety-note,
.remote-link-loading,
.remote-link-status-panel,
.remote-link-qr-panel {
display: flex;
align-items: center;
gap: 10px;
border: 1px solid color-mix(in srgb, var(--color-border) 68%, transparent);
border-radius: 8px;
background: color-mix(in srgb, var(--color-panel) 58%, transparent);
}
.remote-link-safety-note {
margin: 10px 0 14px;
padding: 10px 12px;
color: var(--color-text);
font-size: 0.86rem;
line-height: 1.35;
}
.remote-link-safety-note .material-symbols-outlined {
color: #f2bf4b;
font-size: 20px;
}
.remote-link-provider-field {
margin-bottom: 12px;
}
.remote-link-loading {
justify-content: center;
min-height: 46px;
margin: 16px 0;
padding: 10px 12px;
color: var(--color-text);
opacity: 0.86;
}
.remote-link-url-row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto auto;
gap: 8px;
align-items: center;
margin: 16px 0 12px;
}
.remote-link-input {
min-height: 38px;
font-family: "Roboto Mono", monospace;
font-size: 0.82rem;
}
.remote-link-action,
.remote-link-primary,
.btn-copy-code,
.remote-link-footer-actions .btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
white-space: nowrap;
}
.remote-link-action {
min-height: 38px;
padding: 0 11px;
border: 1px solid color-mix(in srgb, var(--color-border) 76%, transparent);
border-radius: 7px;
background: color-mix(in srgb, var(--color-background) 72%, transparent);
color: var(--color-text);
cursor: pointer;
font: inherit;
font-size: 0.82rem;
font-weight: 700;
}
.remote-link-action:hover:not(:disabled) {
border-color: color-mix(in srgb, var(--color-primary) 34%, var(--color-border));
background: color-mix(in srgb, var(--color-background-hover) 74%, transparent);
}
.remote-link-action:disabled {
cursor: not-allowed;
opacity: 0.52;
}
.remote-link-share-layout {
display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.8fr);
gap: 10px;
margin-top: 10px;
}
.remote-link-qr-panel,
.remote-link-status-panel {
padding: 12px;
align-items: center;
}
.remote-link-status-panel {
align-items: flex-start;
}
.remote-link-status-panel > .material-symbols-outlined {
color: #63c98b;
font-size: 22px;
}
.tunnel-qr-code {
display: grid;
place-items: center;
width: 116px;
min-width: 116px;
height: 116px;
padding: 8px;
border-radius: 8px;
background: #fff;
}
.tunnel-qr-code canvas,
.tunnel-qr-code img {
max-width: 100%;
max-height: 100%;
border-radius: 4px;
}
.remote-link-qr-title,
.remote-link-status-title,
.microsoft-login-title {
color: color-mix(in srgb, var(--color-text) 88%, var(--color-primary));
font-weight: 800;
}
.remote-link-qr-copy,
.remote-link-status-copy,
.microsoft-login-copy {
margin-top: 4px;
color: var(--color-text);
font-size: 0.84rem;
line-height: 1.35;
opacity: 0.76;
}
.remote-link-footer-actions {
display: flex;
justify-content: flex-end;
margin-top: 14px;
}
.remote-link-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 190px;
margin-top: 14px;
padding: 22px;
border: 1px dashed color-mix(in srgb, var(--color-border) 78%, transparent);
border-radius: 8px;
text-align: center;
color: var(--color-text);
}
.remote-link-empty > .material-symbols-outlined {
color: var(--color-primary);
font-size: 30px;
}
.remote-link-empty strong {
font-size: 1rem;
}
.remote-link-empty > span:not(.material-symbols-outlined) {
max-width: 46ch;
opacity: 0.74;
line-height: 1.35;
}
.remote-link-primary {
margin-top: 6px;
}
.copy-success {
border-color: color-mix(in srgb, #63c98b 58%, var(--color-border)) !important;
color: #63c98b !important;
background: color-mix(in srgb, #63c98b 12%, transparent) !important;
}
.copy-error {
border-color: color-mix(in srgb, #ff6b7a 56%, var(--color-border)) !important;
color: #ff6b7a !important;
background: color-mix(in srgb, #ff6b7a 12%, transparent) !important;
}
.microsoft-login-box {
margin: 14px 0;
padding: 14px;
border: 1px solid color-mix(in srgb, #4da3ff 36%, var(--color-border));
border-radius: 8px;
background:
linear-gradient(120deg, color-mix(in srgb, #4da3ff 12%, transparent), transparent 62%),
color-mix(in srgb, var(--color-panel) 68%, transparent);
}
.microsoft-login-header {
display: flex;
align-items: flex-start;
gap: 10px;
margin-bottom: 12px;
}
.microsoft-login-header .material-symbols-outlined {
color: #4da3ff;
font-size: 22px;
}
.microsoft-login-link {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
margin-bottom: 12px;
padding: 9px 10px;
border: 1px solid color-mix(in srgb, #4da3ff 34%, var(--color-border));
border-radius: 7px;
color: color-mix(in srgb, #4da3ff 82%, var(--color-text));
background: color-mix(in srgb, #4da3ff 8%, transparent);
text-decoration: none;
word-break: break-all;
}
.microsoft-login-code-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
}
.microsoft-login-code {
min-height: 38px;
padding: 7px 12px;
border: 1px dashed color-mix(in srgb, #4da3ff 44%, var(--color-border));
border-radius: 7px;
font-family: "Roboto Mono", monospace;
font-size: 1.1rem;
font-weight: 800;
color: var(--color-text);
background: color-mix(in srgb, var(--color-background) 56%, transparent);
user-select: all;
}
.spin {
animation: remote-link-spin 0.8s linear infinite;
}
@keyframes remote-link-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@media (max-width: 720px) {
.modal-inner.remote-link-modal .modal-bd {
padding: 16px;
}
.remote-link-url-row,
.remote-link-share-layout {
grid-template-columns: 1fr;
}
.remote-link-action {
width: 100%;
}
.remote-link-qr-panel {
align-items: center;
}
}
@media (max-width: 520px) {
.remote-link-hero {
grid-template-columns: 1fr;
}
.remote-link-hero-icon {
width: 38px;
height: 38px;
}
.remote-link-qr-panel {
flex-direction: column;
text-align: center;
}
.remote-link-footer-actions .btn {
width: 100%;
}
}
</style>
</body>
</html>