Skip to content

Commit a7fbadd

Browse files
feat: Update UI styling and templates for enhanced user experience
1 parent 7aabba8 commit a7fbadd

File tree

3 files changed

+71
-20
lines changed

3 files changed

+71
-20
lines changed

registry/static/style.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,23 @@ input:checked + .slider:before {
388388
font-size: 0.9em;
389389
}
390390

391+
/* Read-only status styling */
392+
.read-only-status {
393+
display: flex;
394+
align-items: center;
395+
margin-top: 10px;
396+
padding: 8px 12px;
397+
background-color: rgba(160, 168, 180, 0.1);
398+
border-radius: 4px;
399+
border-left: 3px solid #a0a8b4;
400+
}
401+
402+
.read-only-status .status-text {
403+
font-size: 0.9em;
404+
color: #a0a8b4;
405+
font-weight: 500;
406+
}
407+
391408
/* --- Login Page Styles --- */
392409
.login-body {
393410
background-color: #1a222c; /* Slightly darker than main background */

registry/templates/edit_server.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
<body>
7777
<div class="edit-form-container">
7878
<h1>Edit Server: {{ server.server_name }}</h1>
79+
{% if user_context and not user_context.can_modify_servers %}
80+
<div style="background-color: #fff3cd; border: 1px solid #ffeaa7; padding: 10px; border-radius: 4px; margin-bottom: 15px;">
81+
<strong>⚠️ Warning:</strong> You do not have sufficient permissions to edit servers.
82+
</div>
83+
{% endif %}
7984
<form action="/edit{{ server.path }}" method="post">
8085
<div class="form-group">
8186
<label for="path">Path (Read-only)</label>

registry/templates/index.html

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,10 +2129,31 @@
21292129
</div>
21302130
<div class="header-right">
21312131
{% if username %}
2132-
<button id="register-server-button" class="secondary-button" style="margin-right: 10px; padding: 8px 16px; font-weight: 600; border-radius: 8px;">Register Server</button>
2132+
{% if user_context.can_modify_servers %}
2133+
<button id="register-server-button" class="secondary-button" style="margin-right: 10px; padding: 8px 16px; font-weight: 600; border-radius: 8px;">Register Server</button>
2134+
{% endif %}
21332135
{% endif %}
21342136
<button id="theme-toggle" class="theme-toggle-button" title="Toggle Theme">🌙</button>
2135-
<span class="user-display">User: {{ username }}</span>
2137+
<div class="user-display" style="display: flex; flex-direction: column; align-items: flex-end; margin-right: 15px;">
2138+
<span style="font-weight: bold;">{{ username }}</span>
2139+
<span style="font-size: 0.8em; opacity: 0.8;">
2140+
{% if user_context.is_admin %}
2141+
🔑 Admin Access
2142+
{% elif user_context.can_modify_servers %}
2143+
⚙️ Modify Access
2144+
{% else %}
2145+
👁️ Read-only Access
2146+
{% endif %}
2147+
{% if user_context.auth_method == 'oauth2' %}
2148+
({{ user_context.provider | title }})
2149+
{% endif %}
2150+
</span>
2151+
{% if not user_context.is_admin %}
2152+
<span style="font-size: 0.7em; opacity: 0.7;" title="Servers you have access to: {{ user_context.accessible_servers | join(', ') }}">
2153+
Access: {{ user_context.accessible_servers | length }} server(s)
2154+
</span>
2155+
{% endif %}
2156+
</div>
21362157
<form action="/logout" method="post" style="display: inline;">
21372158
<button type="submit" class="logout-button">Logout</button>
21382159
</form>
@@ -2271,24 +2292,32 @@ <h2>{{ service.display_name }}</h2>
22712292
</div>
22722293

22732294
<div class="controls-row">
2274-
<a href="/edit{{ service.path }}" class="edit-button">Modify</a>
2275-
{# Add ID to form if needed, but action URL is sufficient #}
2276-
<form action="/toggle{{ service.path }}" method="post" class="toggle-form">
2277-
<label class="switch">
2278-
{# Change onchange to use data attributes instead #}
2279-
<input type="checkbox" name="enabled" value="on"
2280-
id="{{ 'toggle-check-' + safe_path }}"
2281-
{% if service.is_enabled %}checked{% endif %}
2282-
data-path="{{ service.path }}"
2283-
class="toggle-checkbox">
2284-
<span class="slider round"></span>
2285-
</label>
2286-
{# Add ID to label span #}
2287-
<span id="{{ 'toggle-label-' + safe_path }}" class="toggle-label">
2288-
{{ 'Enabled' if service.is_enabled else 'Disabled' }}
2289-
</span>
2290-
</form>
2291-
2295+
{% if user_context.can_modify_servers %}
2296+
<a href="/edit{{ service.path }}" class="edit-button">Modify</a>
2297+
{# Add ID to form if needed, but action URL is sufficient #}
2298+
<form action="/toggle{{ service.path }}" method="post" class="toggle-form">
2299+
<label class="switch">
2300+
{# Change onchange to use data attributes instead #}
2301+
<input type="checkbox" name="enabled" value="on"
2302+
id="{{ 'toggle-check-' + safe_path }}"
2303+
{% if service.is_enabled %}checked{% endif %}
2304+
data-path="{{ service.path }}"
2305+
class="toggle-checkbox">
2306+
<span class="slider round"></span>
2307+
</label>
2308+
{# Add ID to label span #}
2309+
<span id="{{ 'toggle-label-' + safe_path }}" class="toggle-label">
2310+
{{ 'Enabled' if service.is_enabled else 'Disabled' }}
2311+
</span>
2312+
</form>
2313+
{% else %}
2314+
{# Read-only users: just show status without any controls #}
2315+
<div class="read-only-status">
2316+
<span class="status-text" title="Read-only access - you cannot modify this server">
2317+
📖 {{ 'Enabled' if service.is_enabled else 'Disabled' }} (Read-only)
2318+
</span>
2319+
</div>
2320+
{% endif %}
22922321
</div>
22932322
</div>
22942323
<div class="card-footer">

0 commit comments

Comments
 (0)