Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat: UX hardening for the new organization/proxy/snapshot surfaces

Juan Denise2438db9d1b0
diff --git a/backend/app/api/apps.py b/backend/app/api/apps.py
index c1e9e59f..7d17b73a 100644
--- a/backend/app/api/apps.py
+++ b/backend/app/api/apps.py
@@ -414,6 +414,93 @@ def set_app_workspace(app_id):
return jsonify({'message': 'Workspace updated', 'app': app.to_dict()}), 200
+@apps_bp.route('/move-to-project', methods=['POST'])
+@jwt_required()
+def move_apps_to_project():
+ """Bulk-assign apps to a project/environment (or unassign them).
+
+ Body: ``{app_ids: [...], project_id, environment_id}``.
+
+ Mirrors the per-create ``_resolve_project_env`` validation, but PER APP so a
+ mixed-workspace selection is handled safely:
+
+ - The project must belong to the app's own workspace.
+ - The environment must belong to that project.
+
+ Invalid pairings are silently dropped to None (the app is unassigned rather
+ than mis-assigned) — never an error. ``project_id: null`` unassigns. Only
+ apps the caller can edit are touched; the rest are skipped. Returns the
+ updated rows.
+ """
+ from app.models.project import Project
+ from app.models.environment import Environment
+
+ user = User.query.get(get_jwt_identity())
+ data = request.get_json() or {}
+
+ raw_ids = data.get('app_ids')
+ if not isinstance(raw_ids, list) or not raw_ids:
+ return jsonify({'error': 'app_ids must be a non-empty list'}), 400
+
+ def _as_int(v):
+ if v in (None, '', 'null'):
+ return None
+ try:
+ return int(v)
+ except (TypeError, ValueError):
+ return None
+
+ app_ids = [i for i in (_as_int(x) for x in raw_ids) if i is not None]
+ req_project_id = _as_int(data.get('project_id'))
+ req_environment_id = _as_int(data.get('environment_id'))
+
+ updated = []
+ skipped = []
+ for app_id in app_ids:
+ app = Application.query.get(app_id)
+ if not app:
+ skipped.append(app_id)
+ continue
+ if not _can_edit_app(user, app):
+ skipped.append(app_id)
+ continue
+
+ if req_project_id is None:
+ # Explicit unassign.
+ app.project_id = None
+ app.environment_id = None
+ updated.append(app)
+ continue
+
+ # Validate the project belongs to THIS app's workspace.
+ project = Project.query.get(req_project_id)
+ if project is None or project.workspace_id != app.workspace_id:
+ # Invalid for this app → drop the assignment (unassign), never error.
+ app.project_id = None
+ app.environment_id = None
+ updated.append(app)
+ continue
+
+ # Validate the environment belongs to the resolved project.
+ environment_id = req_environment_id
+ if environment_id is not None:
+ env = Environment.query.get(environment_id)
+ if env is None or env.project_id != project.id:
+ environment_id = None
+
+ app.project_id = project.id
+ app.environment_id = environment_id
+ updated.append(app)
+
+ db.session.commit()
+
+ return jsonify({
+ 'message': f'Updated {len(updated)} application(s)',
+ 'apps': [a.to_dict() for a in updated],
+ 'skipped': skipped,
+ }), 200
+
+
def _resolve_project_env(data, workspace_id):
"""Validate optional project_id/environment_id from a create payload against
the app's workspace. Returns (project_id, environment_id) with invalid values
diff --git a/backend/app/models/application.py b/backend/app/models/application.py
index eb0519cc..f4250004 100644
--- a/backend/app/models/application.py
+++ b/backend/app/models/application.py
@@ -86,6 +86,11 @@ class Application(db.Model):
domains = db.relationship('Domain', backref='application', lazy='subquery', cascade='all, delete-orphan')
linked_app = db.relationship('Application', remote_side=[id], backref='linked_from', foreign_keys=[linked_app_id])
server = db.relationship('Server', backref=db.backref('applications', lazy='dynamic'))
+ # Lightweight, read-only relationships to resolve the project/environment
+ # names in to_dict() (the FK columns above are the source of truth). No
+ # backref/cascade — these only exist so an app row can show where it lives.
+ project = db.relationship('Project', foreign_keys=[project_id], viewonly=True)
+ environment = db.relationship('Environment', foreign_keys=[environment_id], viewonly=True)
def to_dict(self, include_linked=False):
import json
@@ -125,6 +130,11 @@ class Application(db.Model):
'workspace_id': self.workspace_id,
'project_id': self.project_id,
'environment_id': self.environment_id,
+ # Derived display names for the project/environment this app lives in
+ # (null when unassigned). Resolved via the viewonly relationships above
+ # and guarded for None so unassigned apps keep working.
+ 'project_name': self.project.name if self.project else None,
+ 'environment_name': self.environment.name if self.environment else None,
'server_name': self.server.name if self.server else 'Local server',
'domains': [d.to_dict() for d in self.domains]
}
diff --git a/backend/app/services/configuration_service.py b/backend/app/services/configuration_service.py
index 109147a2..c2a5afd0 100644
--- a/backend/app/services/configuration_service.py
+++ b/backend/app/services/configuration_service.py
@@ -170,7 +170,15 @@ class ConfigurationService:
@classmethod
def summarize_diff(cls, diff):
- """Short human label for a diff, e.g. "3 env vars changed; image updated"."""
+ """Plain-language summary of a diff, e.g.
+
+ "3 environment variables and the image tag (1.2.1 → 1.1.9) changed"
+
+ Used both as a short snapshot row label and as the human-readable
+ sentence shown above the technical diff. Always <=255 chars. Returns
+ ``'no config changes'`` when nothing changed (kept verbatim — callers
+ and tests rely on it).
+ """
parts = []
env = diff.get('env', {})
env_count = (
@@ -178,24 +186,48 @@ class ConfigurationService:
+ len(env.get('changed', []))
)
if env_count:
- parts.append(f"{env_count} env var{'s' if env_count != 1 else ''} changed")
+ parts.append(
+ f"{env_count} environment variable{'s' if env_count != 1 else ''}"
+ )
dom = diff.get('domains', {})
dom_count = len(dom.get('added', [])) + len(dom.get('removed', []))
if dom_count:
- parts.append(f"{dom_count} domain{'s' if dom_count != 1 else ''} changed")
+ parts.append(f"{dom_count} domain{'s' if dom_count != 1 else ''}")
vol = diff.get('volumes', {})
vol_count = len(vol.get('added', [])) + len(vol.get('removed', []))
if vol_count:
- parts.append(f"{vol_count} volume{'s' if vol_count != 1 else ''} changed")
+ parts.append(f"{vol_count} volume{'s' if vol_count != 1 else ''}")
+
+ image = diff.get('image', {})
+ if image.get('changed'):
+ old_tag = image.get('old')
+ new_tag = image.get('new')
+ if old_tag or new_tag:
+ parts.append(
+ f"the image tag ({old_tag or '—'} → {new_tag or '—'})"
+ )
+ else:
+ parts.append('the image tag')
- if diff.get('image', {}).get('changed'):
- parts.append('image updated')
if diff.get('build_method', {}).get('changed'):
- parts.append('build method changed')
+ parts.append('the build method')
+
+ if not parts:
+ return 'no config changes'
+
+ # Join into a natural sentence: "A, B and C changed".
+ if len(parts) == 1:
+ subject = parts[0]
+ else:
+ subject = f"{', '.join(parts[:-1])} and {parts[-1]}"
- return '; '.join(parts) if parts else 'no config changes'
+ sentence = f"{subject} changed"
+ # Capitalize the leading character without disturbing the rest
+ # (e.g. a leading number stays a number).
+ sentence = sentence[0].upper() + sentence[1:]
+ return sentence[:255]
# ------------------------------------------------------------------ #
# DB-backed resolution #
diff --git a/backend/app/services/proxy_stack_service.py b/backend/app/services/proxy_stack_service.py
index 788b4faf..2b4b8b80 100644
--- a/backend/app/services/proxy_stack_service.py
+++ b/backend/app/services/proxy_stack_service.py
@@ -523,6 +523,9 @@ class ProxyStackService:
app_count, mismatch_count = ProxyStackService._ingress_counts(
proxy_type, apps_by_server.get(server.id, [])
)
+ recommendation = ProxyStackService._recommendation(
+ proxy_type, app_count, mismatch_count
+ )
if stack is not None:
overview.append({
'server_id': server.id,
@@ -536,6 +539,7 @@ class ProxyStackService:
'networks_count': len(stack.networks_list()),
'app_count': app_count,
'mismatch_count': mismatch_count,
+ 'recommendation': recommendation,
})
else:
# No managed stack → host nginx is in charge. 'host' is a
@@ -550,6 +554,7 @@ class ProxyStackService:
'networks_count': 0,
'app_count': app_count,
'mismatch_count': mismatch_count,
+ 'recommendation': recommendation,
})
return overview
@@ -584,6 +589,36 @@ class ProxyStackService:
mismatches += 1
return len(apps), mismatches
+ @staticmethod
+ def _recommendation(proxy_type, app_count, mismatch_count):
+ """Turn a server's proxy posture into an actionable per-row hint.
+
+ Pure & deterministic (computed from the counts already in scope), so the
+ fleet table can tell the operator what to DO, not just what IS.
+
+ - any mismatch -> warn (align the apps or switch the proxy)
+ - stack proxy, no apps -> info (running but unused)
+ - host nginx, no apps -> info (nothing on this server yet)
+ - otherwise -> ok (apps aligned with the proxy)
+ """
+ proxy_type = (proxy_type or 'nginx').lower()
+ is_stack = proxy_type in ('traefik', 'caddy')
+
+ if mismatch_count > 0:
+ plural = 'app' if mismatch_count == 1 else 'apps'
+ return {
+ 'level': 'warn',
+ 'text': (
+ f"{mismatch_count} {plural} expect a different ingress plane — "
+ "align them or switch this server's proxy"
+ ),
+ }
+ if is_stack and app_count == 0:
+ return {'level': 'info', 'text': 'Proxy stack running with no apps yet'}
+ if not is_stack and app_count == 0:
+ return {'level': 'info', 'text': 'No apps on this server'}
+ return {'level': 'ok', 'text': 'Apps aligned with proxy'}
+
@staticmethod
def ingress_audit(server_id):
"""Per-server ingress reconciliation: which apps disagree with the
diff --git a/backend/tests/test_config_snapshots.py b/backend/tests/test_config_snapshots.py
index 0f075819..738f5198 100644
--- a/backend/tests/test_config_snapshots.py
+++ b/backend/tests/test_config_snapshots.py
@@ -155,6 +155,49 @@ def test_no_change_diff_is_empty():
assert ConfigurationService.summarize_diff(diff) == 'no config changes'
+def test_summarize_diff_is_a_human_sentence_with_image_tag():
+ old = ConfigurationService.build_config(
+ env=[
+ {'key': 'A', 'value': '1', 'is_secret': False},
+ {'key': 'B', 'value': '1', 'is_secret': False},
+ ],
+ image_tag='app:1.2.1',
+ )
+ new = ConfigurationService.build_config(
+ env=[
+ {'key': 'A', 'value': '2', 'is_secret': False},
+ {'key': 'B', 'value': '2', 'is_secret': False},
+ {'key': 'C', 'value': '3', 'is_secret': False},
+ ],
+ image_tag='app:1.1.9',
+ )
+ diff = ConfigurationService.diff_configs(old, new)
+ summary = ConfigurationService.summarize_diff(diff)
+
+ # Reads as a sentence, names the image tag transition, and is bounded.
+ assert summary == (
+ '3 environment variables and the image tag '
+ '(app:1.2.1 → app:1.1.9) changed'
+ )
+ assert len(summary) <= 255
+ # Backward-compatible: still mentions env vars and the image.
+ assert 'environment variable' in summary
+ assert 'image tag' in summary
+
+
+def test_summarize_diff_single_env_var_is_singular():
+ old = ConfigurationService.build_config(
+ env=[{'key': 'A', 'value': '1', 'is_secret': False}]
+ )
+ new = ConfigurationService.build_config(
+ env=[{'key': 'A', 'value': '2', 'is_secret': False}]
+ )
+ summary = ConfigurationService.summarize_diff(
+ ConfigurationService.diff_configs(old, new)
+ )
+ assert summary == '1 environment variable changed'
+
+
# --------------------------------------------------------------------------- #
# DB-backed: snapshot lifecycle #
# --------------------------------------------------------------------------- #
diff --git a/backend/tests/test_fleet_proxy.py b/backend/tests/test_fleet_proxy.py
index ae9d7678..7e5fbe0a 100644
--- a/backend/tests/test_fleet_proxy.py
+++ b/backend/tests/test_fleet_proxy.py
@@ -44,13 +44,18 @@ def test_fleet_overview_one_row_per_server(app):
assert ids == {sid_a, sid_b, sid_c}
# Each row carries the expected flat shape (incl. ingress reconciliation
- # counts so the dashboard can flag apps that disagree with the proxy).
+ # counts so the dashboard can flag apps that disagree with the proxy, and
+ # a per-row actionable recommendation).
row = overview[0]
assert set(row.keys()) == {
'server_id', 'server_name', 'proxy_type', 'status',
'last_regenerated_at', 'networks_count',
- 'app_count', 'mismatch_count',
+ 'app_count', 'mismatch_count', 'recommendation',
}
+ # The recommendation is a {level, text} hint. With no apps on a host-nginx
+ # server it's an informational "no apps" note, not a warning.
+ assert set(row['recommendation'].keys()) == {'level', 'text'}
+ assert row['recommendation']['level'] == 'info'
def test_fleet_overview_host_default_for_unconfigured(app):
@@ -90,6 +95,46 @@ def test_fleet_overview_reflects_configured_stack(app):
assert by_id[sid_default]['status'] == 'host'
+def _make_app(server_id, app_type='docker', ingress_plane=None, name='a'):
+ from app import db
+ from app.models.application import Application
+ a = Application(
+ name=name, app_type=app_type, status='running',
+ server_id=server_id, user_id=1, ingress_plane=ingress_plane,
+ )
+ db.session.add(a)
+ db.session.commit()
+ return a
+
+
+def test_fleet_overview_recommendation_levels(app):
+ with app.app_context():
+ sid_warn = _make_server('warn-srv', 'agent-fp-warn')
+ sid_idle_stack = _make_server('idle-stack', 'agent-fp-idle')
+ sid_host_empty = _make_server('host-empty', 'agent-fp-empty')
+
+ # warn: a stack server with an app tagged for the host (nginx) plane.
+ PS.switch(sid_warn, 'traefik')
+ _make_app(sid_warn, 'php', name='php-on-traefik') # nginx plane -> mismatch
+
+ # info: a stack server running with no apps yet.
+ PS.switch(sid_idle_stack, 'caddy')
+
+ rows = {r['server_id']: r for r in PS.fleet_overview()}
+
+ warn = rows[sid_warn]['recommendation']
+ assert warn['level'] == 'warn'
+ assert 'ingress plane' in warn['text']
+
+ idle = rows[sid_idle_stack]['recommendation']
+ assert idle['level'] == 'info'
+ assert 'no apps' in idle['text'].lower()
+
+ # info: host nginx server with no apps.
+ host = rows[sid_host_empty]['recommendation']
+ assert host['level'] == 'info'
+
+
# ---------------------------------------------------------------------------
# Endpoint: GET /api/v1/servers/proxy/overview
# ---------------------------------------------------------------------------
diff --git a/frontend/src/components/deployments/ConfigDiffModal.jsx b/frontend/src/components/deployments/ConfigDiffModal.jsx
index a0c82bba..1f520c14 100644
--- a/frontend/src/components/deployments/ConfigDiffModal.jsx
+++ b/frontend/src/components/deployments/ConfigDiffModal.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
-import { RotateCcw, X } from 'lucide-react';
+import { RotateCcw, X, Info } from 'lucide-react';
import api from '../../services/api';
import { Button } from '@/components/ui/button';
import { useToast } from '../../contexts/ToastContext';
@@ -133,11 +133,19 @@ const ConfigDiffModal = ({ appId, snapId, against = 'previous', onClose, onResto
{!loading && !error && diff && (
<>
{meta && (
- <p className="config-diff__summary">
- {meta.hasChanges
- ? meta.summary
- : 'No configuration changes vs the compared snapshot.'}
- </p>
+ <div className="config-diff__summary-banner" role="status">
+ <Info size={16} className="config-diff__summary-icon" />
+ <div className="config-diff__summary-text">
+ <span className="config-diff__summary-label">
+ In plain language
+ </span>
+ <p className="config-diff__summary">
+ {meta.hasChanges && meta.summary
+ ? meta.summary
+ : 'No configuration changes vs the compared snapshot.'}
+ </p>
+ </div>
+ </div>
)}
<DiffList
@@ -176,7 +184,9 @@ const ConfigDiffModal = ({ appId, snapId, against = 'previous', onClose, onResto
{confirmRestore ? (
<>
<span className="config-diff__confirm-text">
- Restore this configuration and redeploy?
+ {meta && meta.hasChanges && meta.summary
+ ? `Restore this configuration and redeploy? ${meta.summary}.`
+ : 'Restore this configuration and redeploy?'}
</span>
<Button
variant="outline"
diff --git a/frontend/src/components/server/OnboardingWizard.jsx b/frontend/src/components/server/OnboardingWizard.jsx
index 5bc1ace4..9032c79f 100644
--- a/frontend/src/components/server/OnboardingWizard.jsx
+++ b/frontend/src/components/server/OnboardingWizard.jsx
@@ -3,7 +3,7 @@ import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { Button } from '@/components/ui/button';
import { Pill } from '../ds';
-import { CheckCircle2, Loader2, Circle, XCircle, RotateCw, Clock } from 'lucide-react';
+import { CheckCircle2, Loader2, Circle, XCircle, RotateCw, Clock, ChevronDown } from 'lucide-react';
// The canonical ordered lifecycle steps. The backend returns the same list in
// `status.states`, but we keep a labeled copy so the wizard renders before the
@@ -81,6 +81,9 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {
const [retrying, setRetrying] = useState(false);
// `now` ticks once a second so the elapsed timer stays live while polling.
const [now, setNow] = useState(() => Date.now());
+ // The activity log collapses into a "Step history" summary; users opt in to
+ // the full trail. `null` means "follow the default" (auto by entry count).
+ const [historyOpen, setHistoryOpen] = useState(null);
const lastStateRef = useRef(initialState || null);
const logTrailRef = useRef(null);
@@ -168,6 +171,57 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {
if (el) el.scrollTop = el.scrollHeight;
}, [progress.length]);
+ // "Step X of N" + a coarse progress fraction derived from the current
+ // state's position in the ordered step list. `ready` counts as complete;
+ // a failed run shows whatever step it reached. Step numbers are 1-based.
+ const totalSteps = STEPS.length;
+ const stepNumber = useMemo(() => {
+ if (ready) return totalSteps;
+ const idx = STEPS.findIndex((s) => s.id === state);
+ if (idx === -1) return 1; // pre-first-poll / unknown → step 1
+ return idx + 1;
+ }, [state, ready, totalSteps]);
+ // Completed steps drive both the bar and the ETA. When ready, all are done;
+ // otherwise the in-flight step isn't yet complete, so it's (stepNumber - 1).
+ const completedSteps = ready ? totalSteps : Math.max(stepNumber - 1, 0);
+ const progressPct = Math.round((completedSteps / totalSteps) * 100);
+
+ // Rough ETA: average wall-clock duration of the completed steps × the steps
+ // still remaining. Only shown when we can estimate with confidence — i.e. at
+ // least one step has completed and the run is still in flight. We measure
+ // per-step span from the first log of each ordered state.
+ const eta = useMemo(() => {
+ if (ready || failed || status?.is_terminal) return null;
+ if (completedSteps < 1) return null;
+ // Earliest timestamp seen for each step state, in step order.
+ const firstTsByStep = STEPS.map((s) => {
+ const rows = logsByState[s.id] || [];
+ if (rows.length === 0) return null;
+ const ts = new Date(rows[0].created_at).getTime();
+ return Number.isNaN(ts) ? null : ts;
+ });
+ // Durations of completed steps = gap between consecutive step starts.
+ const durations = [];
+ for (let i = 0; i < completedSteps; i += 1) {
+ const start = firstTsByStep[i];
+ const next = firstTsByStep[i + 1] ?? (i + 1 === completedSteps ? now : null);
+ if (start != null && next != null && next > start) {
+ durations.push(next - start);
+ }
+ }
+ if (durations.length === 0) return null;
+ const avg = durations.reduce((a, b) => a + b, 0) / durations.length;
+ const remaining = totalSteps - completedSteps;
+ if (remaining <= 0) return null;
+ const ms = avg * remaining;
+ const minutes = Math.max(1, Math.round(ms / 60000));
+ return `~${minutes} min remaining`;
+ }, [ready, failed, status, completedSteps, logsByState, now, totalSteps]);
+
+ // Collapse the history once it's long enough to be a summary; let the user
+ // override either way once they've clicked.
+ const trailExpanded = historyOpen ?? progress.length <= 4;
+
const headerPillKind = failed ? 'red' : ready ? 'green' : 'amber';
const headerLabel = failed ? 'Failed' : ready ? 'Ready' : 'In progress';
@@ -197,6 +251,30 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {
)}
</div>
+ <div className="onboarding-wizard__progress">
+ <div className="onboarding-wizard__progress-head">
+ <span className="onboarding-wizard__progress-step">
+ {ready ? 'Complete' : `Step ${stepNumber} of ${totalSteps}`}
+ </span>
+ {eta && (
+ <span className="onboarding-wizard__progress-eta">{eta}</span>
+ )}
+ </div>
+ <div
+ className="onboarding-wizard__progress-track"
+ role="progressbar"
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-valuenow={progressPct}
+ aria-label="Onboarding progress"
+ >
+ <span
+ className={`onboarding-wizard__progress-fill${failed ? ' onboarding-wizard__progress-fill--failed' : ''}`}
+ style={{ width: `${progressPct}%` }}
+ />
+ </div>
+ </div>
+
{failureLog && (
<div className="onboarding-wizard__error">
<XCircle size={16} />
@@ -239,26 +317,41 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {
{progress.length > 0 && (
<div className="onboarding-wizard__trail">
- <div className="onboarding-wizard__trail-head">Activity log</div>
- <ul
- ref={logTrailRef}
- className="onboarding-wizard__trail-list"
- aria-live="polite"
+ <button
+ type="button"
+ className="onboarding-wizard__trail-head"
+ aria-expanded={trailExpanded}
+ onClick={() => setHistoryOpen(!trailExpanded)}
>
- {progress.map((log) => (
- <li
- key={log.id}
- className={`onboarding-wizard__trail-row onboarding-wizard__trail-row--${log.status}`}
- >
- <span className="onboarding-wizard__trail-time">
- {formatLogTime(log.created_at)}
- </span>
- <span className="onboarding-wizard__trail-msg">
- {log.message || log.status}
- </span>
- </li>
- ))}
- </ul>
+ <ChevronDown
+ size={14}
+ className={`onboarding-wizard__trail-chevron${trailExpanded ? ' onboarding-wizard__trail-chevron--open' : ''}`}
+ aria-hidden="true"
+ />
+ <span>Step history</span>
+ <span className="onboarding-wizard__trail-count">{progress.length}</span>
+ </button>
+ {trailExpanded && (
+ <ul
+ ref={logTrailRef}
+ className="onboarding-wizard__trail-list"
+ aria-live="polite"
+ >
+ {progress.map((log) => (
+ <li
+ key={log.id}
+ className={`onboarding-wizard__trail-row onboarding-wizard__trail-row--${log.status}`}
+ >
+ <span className="onboarding-wizard__trail-time">
+ {formatLogTime(log.created_at)}
+ </span>
+ <span className="onboarding-wizard__trail-msg">
+ {log.message || log.status}
+ </span>
+ </li>
+ ))}
+ </ul>
+ )}
</div>
)}
diff --git a/frontend/src/components/shared/EnvironmentVariablesPanel.jsx b/frontend/src/components/shared/EnvironmentVariablesPanel.jsx
index 93847339..dc7b00fd 100644
--- a/frontend/src/components/shared/EnvironmentVariablesPanel.jsx
+++ b/frontend/src/components/shared/EnvironmentVariablesPanel.jsx
@@ -10,30 +10,94 @@ import { useToast } from '../../contexts/ToastContext';
* truth); this surface is the read-side facade meant to be embedded on a
* resource's detail page.
*
+ * Provenance: when the hierarchical resolver is available, each variable shows
+ * which scope it won at (workspace < project < environment < direct attachment).
+ * For applications we also cross-check the app's LOCAL env vars: shared groups
+ * are a facade and are NOT injected into the running container, so when the same
+ * key exists locally the local value is what actually applies — we flag that.
+ *
* Props:
* resourceType one of SharedResourceService.RESOURCE_TYPES
* resourceId the resource's id (number or string)
*/
+
+// Ordered lowest → highest precedence. Used for the legend and the badge label.
+const SCOPE_ORDER = ['workspace', 'project', 'environment', 'direct', 'resource'];
+const SCOPE_LABELS = {
+ workspace: 'Workspace',
+ project: 'Project',
+ environment: 'Environment',
+ direct: 'Direct',
+ resource: 'Direct',
+};
+
const EnvironmentVariablesPanel = ({ resourceType, resourceId }) => {
const toast = useToast();
const [variables, setVariables] = useState([]);
const [groups, setGroups] = useState([]);
+ // Set of LOCAL env-var keys (applications only). When a resolved shared
+ // variable shares a key with this set, the local value wins at runtime.
+ const [localKeys, setLocalKeys] = useState(null);
+ const [hierarchical, setHierarchical] = useState(false);
const [loading, setLoading] = useState(true);
+
const [filter, setFilter] = useState('');
const load = useCallback(async () => {
if (!resourceType || resourceId == null) return;
+ setLoading(true);
+
+ // 1) Resolve shared variables. Prefer the hierarchical endpoint (carries
+ // a `source_scope` provenance marker); fall back to the flat resolver
+ // if it is unavailable so the panel never crashes.
+ let resolved = [];
+ let attachedGroups = [];
+ let isHierarchical = false;
try {
- setLoading(true);
- const data = await api.getResolvedVariables(resourceType, resourceId);
- setVariables(data.variables || []);
- setGroups(data.groups || []);
- } catch (err) {
- toast.error('Failed to load shared variables');
- console.error('Failed to load resolved variables:', err);
- } finally {
- setLoading(false);
+ const data = await api.getResolvedVariablesHierarchical(resourceType, resourceId);
+ resolved = data.variables || [];
+ isHierarchical = true;
+ } catch {
+ try {
+ const data = await api.getResolvedVariables(resourceType, resourceId);
+ resolved = data.variables || [];
+ attachedGroups = data.groups || [];
+ } catch (err) {
+ toast.error('Failed to load shared variables');
+ console.error('Failed to load resolved variables:', err);
+ }
+ }
+
+ // The hierarchical endpoint doesn't return the attached-group list; only
+ // fetch it when we don't already have it (keeps the count accurate).
+ if (isHierarchical) {
+ try {
+ const flat = await api.getResolvedVariables(resourceType, resourceId);
+ attachedGroups = flat.groups || [];
+ } catch {
+ attachedGroups = [];
+ }
}
+
+ // 2) For applications, fetch LOCAL env-var keys so we can flag conflicts.
+ // Masked — keys only, no values. Graceful on failure.
+ let keys = null;
+ if (resourceType === 'application') {
+ try {
+ const envData = await api.getEnvVars(resourceId, true);
+ const rows = envData.env_vars || [];
+ keys = new Set(rows.map((r) => r.key));
+ } catch (err) {
+ console.error('Failed to load local env vars:', err);
+ keys = null;
+ }
+ }
+
+ setVariables(resolved);
+ setGroups(attachedGroups);
+ setLocalKeys(keys);
+ setHierarchical(isHierarchical);
+ setLoading(false);
}, [resourceType, resourceId, toast]);
useEffect(() => { load(); }, [load]);
@@ -46,6 +110,8 @@ const EnvironmentVariablesPanel = ({ resourceType, resourceId }) => {
return <div className="shared-vars-panel shared-vars-panel--loading">Loading shared variables…</div>;
}
+ const showProvenance = hierarchical && variables.some((v) => v.source_scope);
+
return (
<div className="shared-vars-panel">
<div className="shared-vars-panel__header">
@@ -57,10 +123,35 @@ const EnvironmentVariablesPanel = ({ resourceType, resourceId }) => {
<p className="shared-vars-panel__hint">
Effective variables merged from every shared group attached to this
- resource. Later-attached groups override earlier ones on key
+ resource. More specific scopes override broader ones on key
collisions. Secret values are masked.
</p>
+ {showProvenance && (
+ <div className="shared-vars-legend" aria-label="Precedence order">
+ <span className="shared-vars-legend__label">Precedence</span>
+ {['workspace', 'project', 'environment', 'direct'].map((scope, i, arr) => (
+ <span key={scope} className="shared-vars-legend__item">
+ <span className={`scope-badge scope-badge--${scope}`}>
+ {SCOPE_LABELS[scope]}
+ </span>
+ {i < arr.length - 1 && (
+ <span className="shared-vars-legend__lt" aria-hidden="true">&lt;</span>
+ )}
+ </span>
+ ))}
+ <span className="shared-vars-legend__note">(rightmost wins)</span>
+ </div>
+ )}
+
+ {resourceType === 'application' && localKeys && (
+ <p className="shared-vars-panel__hint shared-vars-panel__hint--note">
+ Shared groups are a facade — they are not yet injected into the
+ running container. Where a key also exists in this app&apos;s own
+ Environment tab, the local value is what the container uses.
+ </p>
+ )}
+
{variables.length > 5 && (
<div className="shared-vars-panel__filter">
<input
@@ -84,17 +175,43 @@ const EnvironmentVariablesPanel = ({ resourceType, resourceId }) => {
<tr>
<th>Key</th>
<th>Value</th>
- <th>Source group</th>
+ <th>Source</th>
</tr>
</thead>
<tbody>
- {filtered.map((v) => (
- <tr key={v.key} className={v.is_secret ? 'is-secret' : ''}>
- <td className="shared-vars-table__key">{v.key}</td>
- <td className="shared-vars-table__value">{v.value}</td>
- <td className="shared-vars-table__group">{v.group_name}</td>
- </tr>
- ))}
+ {filtered.map((v) => {
+ const scope = v.source_scope;
+ const conflict = !!(localKeys && localKeys.has(v.key));
+ return (
+ <tr
+ key={v.key}
+ className={`${v.is_secret ? 'is-secret' : ''} ${conflict ? 'has-conflict' : ''}`.trim()}
+ >
+ <td className="shared-vars-table__key">
+ {v.key}
+ {conflict && (
+ <span
+ className="conflict-badge"
+ title="This key is also set on the app's Environment tab. The local value is what the container uses; the shared value is overridden."
+ >
+ Set locally — local value applies
+ </span>
+ )}
+ </td>
+ <td className="shared-vars-table__value">{v.value}</td>
+ <td className="shared-vars-table__group">
+ {scope && SCOPE_ORDER.includes(scope) && (
+ <span className={`scope-badge scope-badge--${scope}`}>
+ {SCOPE_LABELS[scope]}
+ </span>
+ )}
+ <span className="shared-vars-table__group-name">
+ {v.group_name || '—'}
+ </span>
+ </td>
+ </tr>
+ );
+ })}
</tbody>
</table>
)}
diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.js
index d3f5f284..2f61034a 100644
--- a/frontend/src/components/sidebarItems.js
+++ b/frontend/src/components/sidebarItems.js
@@ -33,11 +33,37 @@ export const SIDEBAR_ITEMS = [
icon: '<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>'
},
{
- id: 'workspaces',
- label: 'Workspaces',
- route: '/workspaces',
- category: 'infrastructure',
- icon: '<path d="M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z"/>'
+ // "Organization" groups the cross-cutting features that structure work
+ // across a team/account — Projects, Shared Variables, and Workspaces —
+ // so they don't each clutter the top level. Renders as a collapsible
+ // group (Sidebar.renderNavItem handles item.subItems). matchPrefixes
+ // keeps the group lit on any of its sub-routes.
+ id: 'organization',
+ label: 'Organization',
+ route: '/projects',
+ matchPrefixes: ['/projects', '/shared-variables', '/workspaces'],
+ category: 'overview',
+ icon: '<path d="M3 21h18"/><path d="M5 21V7l8-4v18"/><path d="M19 21V11l-6-4"/><path d="M9 9v.01"/><path d="M9 12v.01"/><path d="M9 15v.01"/><path d="M9 18v.01"/>',
+ subItems: [
+ {
+ id: 'projects',
+ label: 'Projects',
+ route: '/projects',
+ icon: '<path d="M3 7a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.7.9H19a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>'
+ },
+ {
+ id: 'shared-variables',
+ label: 'Shared Variables',
+ route: '/shared-variables',
+ icon: '<path d="M4 7h16M4 12h16M4 17h10"/><circle cx="18" cy="17" r="2"/>'
+ },
+ {
+ id: 'workspaces',
+ label: 'Workspaces',
+ route: '/workspaces',
+ icon: '<path d="M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z"/>'
+ }
+ ]
},
{
// Redesign: Servers uses the top-bar layout (REDESIGN_MAP §6 decision 3).
@@ -78,16 +104,6 @@ export const SIDEBAR_ITEMS = [
category: 'infrastructure',
icon: '<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>'
},
- {
- // Projects group apps/services under projects + environments
- // (production/staging/development) within a workspace.
- id: 'projects',
- label: 'Projects',
- route: '/projects',
- matchPrefixes: ['/projects'],
- category: 'infrastructure',
- icon: '<path d="M3 7a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.7.9H19a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>'
- },
{
// Redesign: WordPress uses the top-bar layout (REDESIGN_MAP §6 dec. 3).
// Pipeline now lives in the page's top bar (PageTopbar WORDPRESS_TABS),
@@ -196,13 +212,6 @@ export const SIDEBAR_ITEMS = [
category: 'system',
icon: '<path d="M22 12h-4l-3 9L9 3l-3 9H2"/>'
},
- {
- id: 'shared-variables',
- label: 'Shared Variables',
- route: '/shared-variables',
- category: 'system',
- icon: '<path d="M4 7h16M4 12h16M4 17h10"/><circle cx="18" cy="17" r="2"/>'
- },
{
id: 'jobs',
label: 'Jobs',
diff --git a/frontend/src/components/status/ContainerStatusPill.jsx b/frontend/src/components/status/ContainerStatusPill.jsx
index b482d849..9bdc83ec 100644
--- a/frontend/src/components/status/ContainerStatusPill.jsx
+++ b/frontend/src/components/status/ContainerStatusPill.jsx
@@ -34,9 +34,30 @@ export default function ContainerStatusPill({ status, fallbackLabel = 'Unknown'
// Native title for accessibility / keyboard; the custom tooltip is visual.
const titleText = tooltipLines.join('\n');
+ // Surface a degraded sub-state without requiring a hover: when an app has
+ // more than one container and some are unhealthy (or there are reasons),
+ // show a small always-visible amber badge. Prefer the issue count when we
+ // have reasons, else the "healthy/total" ratio.
+ const showBadge = total > 1 && (healthy < total || reasons.length > 0);
+ const badgeLabel = reasons.length > 0
+ ? `${reasons.length} ${reasons.length === 1 ? 'issue' : 'issues'}`
+ : `${healthy}/${total}`;
+
return (
<span className="sk-cstatus" title={titleText}>
<Pill kind={meta.kind}>{meta.label}</Pill>
+ {showBadge && (
+ <span
+ className="sk-cstatus__badge"
+ aria-label={
+ reasons.length > 0
+ ? `${reasons.length} container ${reasons.length === 1 ? 'issue' : 'issues'}`
+ : `${healthy} of ${total} containers healthy`
+ }
+ >
+ {badgeLabel}
+ </span>
+ )}
<span className="sk-cstatus__tip" role="tooltip">
<span className="sk-cstatus__tip-summary">{summary}</span>
{reasons.map((r, i) => (
diff --git a/frontend/src/pages/FleetProxy.jsx b/frontend/src/pages/FleetProxy.jsx
index 72e9d06c..b55bae76 100644
--- a/frontend/src/pages/FleetProxy.jsx
+++ b/frontend/src/pages/FleetProxy.jsx
@@ -41,6 +41,14 @@ const STATUS_LABEL = {
unknown: 'Unknown',
};
+// Recommendation level → Pill kind. 'ok' reads green (aligned), 'info' is a
+// neutral note, 'warn' is amber so the operator can spot what needs action.
+const RECOMMENDATION_KIND = {
+ ok: 'green',
+ info: 'gray',
+ warn: 'amber',
+};
+
function formatTimestamp(value) {
if (!value) return 'Never';
const date = new Date(value);
@@ -118,6 +126,7 @@ const FleetProxy = () => {
{ key: 'type', header: 'Proxy type' },
{ key: 'status', header: 'Status' },
{ key: 'apps', header: 'Apps' },
+ { key: 'recommendation', header: 'Recommendation' },
{ key: 'lastRegenerated', header: 'Last regenerated' },
{ key: 'networks', header: 'Networks' },
{ key: 'actions', header: '', className: 'fleet-proxy__col-actions' },
@@ -211,6 +220,20 @@ const FleetProxy = () => {
)}
</div>
</td>
+ <td>
+ {row.recommendation ? (
+ <Pill
+ kind={RECOMMENDATION_KIND[row.recommendation.level] || 'gray'}
+ dot={false}
+ className="fleet-proxy__recommendation"
+ title={row.recommendation.text}
+ >
+ {row.recommendation.text}
+ </Pill>
+ ) : (
+ <span className="fleet-proxy__muted">—</span>
+ )}
+ </td>
<td className="fleet-proxy__muted">
{formatTimestamp(row.last_regenerated_at)}
</td>
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 4526f845..881f4175 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -1,17 +1,37 @@
import React, { useState, useEffect, useMemo } from 'react';
import { useNavigate, Link } from 'react-router-dom';
-import { Layers, Plus, Square, Play, RotateCw, GitBranch, Github, FolderOpen, FileArchive, Search } from 'lucide-react';
+import { Layers, Plus, Square, Play, RotateCw, GitBranch, Github, FolderOpen, FileArchive, Search, FolderKanban } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/serviceTypes';
import EmptyState from '../components/EmptyState';
-import { Pill, SegControl, ServiceTile } from '@/components/ds';
+import { Pill, SegControl, ServiceTile, EnvTag } from '@/components/ds';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
+import { Label } from '@/components/ui/label';
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@/components/ui/select';
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+ DialogFooter,
+} from '@/components/ui/dialog';
const STATUS_PILL = { running: 'green', stopped: 'gray', deploying: 'amber', building: 'amber', failed: 'red' };
+// Sentinels for the move-to-project Select (Radix forbids empty-string values).
+const UNASSIGN = '__unassign__';
+const NO_ENV = '__no_env__';
+
const Services = () => {
const navigate = useNavigate();
const toast = useToast();
@@ -22,6 +42,7 @@ const Services = () => {
const [actionLoading, setActionLoading] = useState(null);
const [selectedIds, setSelectedIds] = useState(new Set());
const [bulkLoading, setBulkLoading] = useState(false);
+ const [showMoveDialog, setShowMoveDialog] = useState(false);
useEffect(() => {
loadApps();
@@ -148,6 +169,10 @@ const Services = () => {
<div className="wp-list__bulkbar">
<span className="wp-list__bulkcount">{selectedIds.size} selected</span>
<div className="wp-list__bulkactions">
+ <Button variant="outline" size="sm" onClick={() => setShowMoveDialog(true)} disabled={bulkLoading}>
+ <FolderKanban size={14} />
+ Move to project
+ </Button>
<Button variant="outline" size="sm" onClick={() => handleBulkAction('restart')} disabled={bulkLoading}>
Restart All
</Button>
@@ -185,6 +210,7 @@ const Services = () => {
/>
</th>
<th>Service</th>
+ <th>Project</th>
<th>Source</th>
<th>Domain</th>
<th>Status</th>
@@ -240,6 +266,21 @@ const Services = () => {
</span>
</div>
</td>
+ <td>
+ {app.project_name ? (
+ <span className="services-page__project">
+ <span className="services-page__project-name" title={app.project_name}>
+ <FolderKanban size={12} aria-hidden="true" />
+ {app.project_name}
+ </span>
+ {app.environment_name && (
+ <EnvTag env={app.environment_name}>{app.environment_name}</EnvTag>
+ )}
+ </span>
+ ) : (
+ <span className="services-page__unassigned">Unassigned</span>
+ )}
+ </td>
<td>
{app.deploy_repo_url ? (
<span className="services-page__src-badge" title={app.deploy_repo_url}>
@@ -310,10 +351,146 @@ const Services = () => {
)}
</div>
)}
+
+ <MoveToProjectDialog
+ open={showMoveDialog}
+ onOpenChange={setShowMoveDialog}
+ count={selectedIds.size}
+ onMove={async (projectId, environmentId) => {
+ setBulkLoading(true);
+ try {
+ await api.moveAppsToProject([...selectedIds], projectId, environmentId);
+ toast.success(
+ projectId === null
+ ? `Unassigned ${selectedIds.size} service(s)`
+ : `Moved ${selectedIds.size} service(s)`
+ );
+ setShowMoveDialog(false);
+ setSelectedIds(new Set());
+ await loadApps();
+ } catch (err) {
+ toast.error(err.message || 'Failed to move services');
+ } finally {
+ setBulkLoading(false);
+ }
+ }}
+ />
</div>
);
};
+// Bulk "Move to project" modal: pick a project, then one of its environments
+// (or leave unassigned). Loads the project list lazily on open; fetches the
+// chosen project's environments on selection.
+const MoveToProjectDialog = ({ open, onOpenChange, count, onMove }) => {
+ const toast = useToast();
+ const [projects, setProjects] = useState([]);
+ const [environments, setEnvironments] = useState([]);
+ const [projectValue, setProjectValue] = useState(UNASSIGN);
+ const [envValue, setEnvValue] = useState(NO_ENV);
+ const [loadingProjects, setLoadingProjects] = useState(false);
+ const [loadingEnvs, setLoadingEnvs] = useState(false);
+ const [submitting, setSubmitting] = useState(false);
+
+ useEffect(() => {
+ if (!open) return;
+ // Reset selection each time the dialog opens.
+ setProjectValue(UNASSIGN);
+ setEnvValue(NO_ENV);
+ setEnvironments([]);
+ setLoadingProjects(true);
+ api.getProjects()
+ .then((data) => setProjects(Array.isArray(data?.projects) ? data.projects : []))
+ .catch(() => toast.error('Failed to load projects'))
+ .finally(() => setLoadingProjects(false));
+ }, [open, toast]);
+
+ async function handleProjectChange(value) {
+ setProjectValue(value);
+ setEnvValue(NO_ENV);
+ setEnvironments([]);
+ if (value === UNASSIGN) return;
+ setLoadingEnvs(true);
+ try {
+ const data = await api.getProject(value);
+ const envs = Array.isArray(data?.project?.environments) ? data.project.environments : [];
+ setEnvironments(envs);
+ } catch {
+ toast.error('Failed to load environments');
+ } finally {
+ setLoadingEnvs(false);
+ }
+ }
+
+ async function handleSubmit() {
+ const projectId = projectValue === UNASSIGN ? null : Number(projectValue);
+ const environmentId = envValue === NO_ENV ? null : Number(envValue);
+ setSubmitting(true);
+ try {
+ await onMove(projectId, environmentId);
+ } finally {
+ setSubmitting(false);
+ }
+ }
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Move to project</DialogTitle>
+ <DialogDescription>
+ Assign {count} selected service{count === 1 ? '' : 's'} to a project and
+ environment, or leave them unassigned.
+ </DialogDescription>
+ </DialogHeader>
+
+ <div className="services-move">
+ <div className="services-move__field">
+ <Label htmlFor="move-project">Project</Label>
+ <Select value={projectValue} onValueChange={handleProjectChange} disabled={loadingProjects}>
+ <SelectTrigger id="move-project">
+ <SelectValue placeholder={loadingProjects ? 'Loading…' : 'Select a project'} />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={UNASSIGN}>Unassigned</SelectItem>
+ {projects.map((p) => (
+ <SelectItem key={p.id} value={String(p.id)}>{p.name}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+
+ {projectValue !== UNASSIGN && (
+ <div className="services-move__field">
+ <Label htmlFor="move-env">Environment</Label>
+ <Select value={envValue} onValueChange={setEnvValue} disabled={loadingEnvs}>
+ <SelectTrigger id="move-env">
+ <SelectValue placeholder={loadingEnvs ? 'Loading…' : 'No specific environment'} />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={NO_ENV}>No specific environment</SelectItem>
+ {environments.map((e) => (
+ <SelectItem key={e.id} value={String(e.id)}>{e.name}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ )}
+ </div>
+
+ <DialogFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button type="button" onClick={handleSubmit} disabled={submitting || loadingProjects}>
+ {submitting ? 'Moving…' : (projectValue === UNASSIGN ? 'Unassign' : 'Move')}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+};
+
function extractRepoName(url) {
if (!url) return '';
try {
diff --git a/frontend/src/services/api/projects.js b/frontend/src/services/api/projects.js
index 8c23663a..17149710 100644
--- a/frontend/src/services/api/projects.js
+++ b/frontend/src/services/api/projects.js
@@ -62,3 +62,20 @@ export async function reorderEnvironments(projectId, orderedIds) {
body: { project_id: projectId, ordered_ids: orderedIds },
});
}
+
+// --- Apps <-> Project assignment ---
+
+// Bulk-assign applications to a project (and optionally an environment), or
+// unassign them by passing projectId = null. The backend validates the
+// project/environment against each app's workspace and silently drops invalid
+// pairings, so a mixed selection is safe. Returns { apps, skipped }.
+export async function moveAppsToProject(appIds, projectId, environmentId) {
+ return this.request('/apps/move-to-project', {
+ method: 'POST',
+ body: {
+ app_ids: appIds,
+ project_id: projectId ?? null,
+ environment_id: environmentId ?? null,
+ },
+ });
+}
diff --git a/frontend/src/services/api/sharedResources.js b/frontend/src/services/api/sharedResources.js
index 9e4aad54..a448039a 100644
--- a/frontend/src/services/api/sharedResources.js
+++ b/frontend/src/services/api/sharedResources.js
@@ -124,3 +124,17 @@ export async function getResolvedVariables(resourceType, resourceId) {
});
return this.request(`/shared/resolved?${params.toString()}`);
}
+
+// Hierarchical resolution — each entry carries a `source_scope` provenance
+// marker (workspace|project|environment|direct|resource). `context` may carry
+// workspace_id/project_id/environment_id to contribute inherited scope layers.
+export async function getResolvedVariablesHierarchical(resourceType, resourceId, context = {}) {
+ const params = new URLSearchParams({
+ resource_type: resourceType,
+ resource_id: String(resourceId),
+ });
+ ['workspace_id', 'project_id', 'environment_id'].forEach((k) => {
+ if (context[k] != null && context[k] !== '') params.set(k, String(context[k]));
+ });
+ return this.request(`/shared/resolved/hierarchical?${params.toString()}`);
+}
diff --git a/frontend/src/styles/components/_container-status.scss b/frontend/src/styles/components/_container-status.scss
index ed80af55..fffe910c 100644
--- a/frontend/src/styles/components/_container-status.scss
+++ b/frontend/src/styles/components/_container-status.scss
@@ -6,6 +6,25 @@
position: relative;
display: inline-flex;
align-items: center;
+ gap: $space-1;
+
+ // Always-visible secondary badge surfacing a degraded sub-state (e.g.
+ // "2 issues" or "2/3") so multi-container problems are readable without
+ // hovering for the tooltip. Subtle, amber-toned.
+ &__badge {
+ display: inline-flex;
+ align-items: center;
+ padding: 1px $space-1;
+ border-radius: $radius-sm;
+ background: $warning-bg;
+ border: 1px solid $warning-border;
+ color: $warning;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+ line-height: 1.3;
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+ }
&__tip {
position: absolute;
diff --git a/frontend/src/styles/components/_deployments.scss b/frontend/src/styles/components/_deployments.scss
index 78f4b173..9a457fa8 100644
--- a/frontend/src/styles/components/_deployments.scss
+++ b/frontend/src/styles/components/_deployments.scss
@@ -164,13 +164,43 @@
color: $text-secondary;
}
+ // Plain-language summary, shown prominently above the technical diff so a
+ // less-technical user knows what they're looking at / rolling back.
+ &__summary-banner {
+ display: flex;
+ align-items: flex-start;
+ gap: $space-2;
+ padding: $space-3;
+ background: $info-bg;
+ border: 1px solid $info-border;
+ border-radius: $radius-md;
+ }
+
+ &__summary-icon {
+ flex-shrink: 0;
+ margin-top: 1px;
+ color: $info;
+ }
+
+ &__summary-text {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ }
+
+ &__summary-label {
+ font-size: 0.6875rem;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ color: $text-tertiary;
+ }
+
&__summary {
margin: 0;
- padding: $space-2 $space-3;
- background: $bg-elevated;
- border-radius: $radius-md;
- color: $text-secondary;
- font-size: 0.875rem;
+ color: $text-primary;
+ font-size: 0.9375rem;
+ line-height: 1.4;
}
&__section {
diff --git a/frontend/src/styles/components/_onboarding-wizard.scss b/frontend/src/styles/components/_onboarding-wizard.scss
index ba0e39ba..b91eb43e 100644
--- a/frontend/src/styles/components/_onboarding-wizard.scss
+++ b/frontend/src/styles/components/_onboarding-wizard.scss
@@ -49,6 +49,52 @@
}
}
+ // "Step X of N" indicator + coarse progress bar derived from the current
+ // lifecycle position.
+ &__progress {
+ margin-bottom: $space-4;
+ }
+
+ &__progress-head {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: $space-3;
+ margin-bottom: $space-2;
+ }
+
+ &__progress-step {
+ font-size: $font-size-xs;
+ font-weight: $font-weight-medium;
+ color: $text-secondary;
+ font-variant-numeric: tabular-nums;
+ }
+
+ &__progress-eta {
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ font-variant-numeric: tabular-nums;
+ }
+
+ &__progress-track {
+ height: 6px;
+ border-radius: $radius-full;
+ background: $bg-elevated;
+ overflow: hidden;
+ }
+
+ &__progress-fill {
+ display: block;
+ height: 100%;
+ border-radius: $radius-full;
+ background: $accent-primary;
+ transition: width 0.3s ease;
+
+ &--failed {
+ background: $danger;
+ }
+ }
+
&__error {
display: flex;
align-items: flex-start;
@@ -184,14 +230,47 @@
overflow: hidden;
}
+ // Step-history toggle: a full-width button that expands/collapses the
+ // detailed activity trail below it.
&__trail-head {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ width: 100%;
padding: $space-2 $space-3;
+ background: none;
+ border: none;
+ border-bottom: 1px solid $border-color;
font-size: $font-size-xs;
font-weight: $font-weight-semibold;
text-transform: uppercase;
letter-spacing: 0.04em;
color: $text-tertiary;
- border-bottom: 1px solid $border-color;
+ cursor: pointer;
+ text-align: left;
+
+ &:hover {
+ color: $text-secondary;
+ }
+ }
+
+ &__trail-chevron {
+ flex-shrink: 0;
+ transition: transform 0.15s ease;
+
+ &--open {
+ transform: rotate(180deg);
+ }
+ }
+
+ &__trail-count {
+ margin-left: auto;
+ padding: 0 $space-2;
+ border-radius: $radius-full;
+ background: $bg-card;
+ color: $text-tertiary;
+ font-variant-numeric: tabular-nums;
+ letter-spacing: 0;
}
&__trail-list {
diff --git a/frontend/src/styles/components/_shared-resources.scss b/frontend/src/styles/components/_shared-resources.scss
index 99fe1714..4a974ba7 100644
--- a/frontend/src/styles/components/_shared-resources.scss
+++ b/frontend/src/styles/components/_shared-resources.scss
@@ -126,6 +126,106 @@
border-radius: $radius-md;
font-size: $font-size-sm;
}
+
+ &__hint--note {
+ color: $text-secondary;
+ border-left: 2px solid $warning-border;
+ background: $warning-bg;
+ padding: $space-2 $space-3;
+ border-radius: $radius-sm;
+ }
+}
+
+// ---------- Provenance / precedence ----------
+// A compact legend (workspace < project < environment < direct) plus a small
+// per-variable scope badge so users can see where each value comes from.
+
+.shared-vars-legend {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: $space-2;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+
+ &__label {
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ font-weight: 600;
+ }
+
+ &__item {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-2;
+ }
+
+ &__lt {
+ color: $text-tertiary;
+ font-family: $font-mono;
+ }
+
+ &__note {
+ color: $text-tertiary;
+ }
+}
+
+// Scope badge — one per provenance source. Colors map to the design-system
+// status tokens so they read consistently across themes.
+.scope-badge {
+ display: inline-flex;
+ align-items: center;
+ padding: 1px $space-2;
+ border-radius: $radius-sm;
+ font-size: $font-size-xs;
+ font-weight: 600;
+ line-height: 1.5;
+ border: 1px solid transparent;
+ text-transform: capitalize;
+
+ &--workspace {
+ color: $text-secondary;
+ background: $bg-hover;
+ border-color: $border-subtle;
+ }
+
+ &--project {
+ color: $info;
+ background: $info-bg;
+ border-color: $info-border;
+ }
+
+ &--environment {
+ color: $success;
+ background: $success-bg;
+ border-color: $success-border;
+ }
+
+ &--direct,
+ &--resource {
+ color: $accent-primary;
+ background: rgba($accent-primary-raw, 0.12);
+ border-color: rgba($accent-primary-raw, 0.22);
+ }
+}
+
+// Conflict badge — the resolved shared variable shares a key with the app's own
+// local env var, so the local value is what the container actually uses.
+.conflict-badge {
+ display: inline-flex;
+ align-items: center;
+ margin-left: $space-2;
+ padding: 1px $space-2;
+ border-radius: $radius-sm;
+ font-family: $font-main;
+ font-size: $font-size-xs;
+ font-weight: 600;
+ line-height: 1.5;
+ color: $warning;
+ background: $warning-bg;
+ border: 1px solid $warning-border;
+ white-space: nowrap;
+ cursor: help;
}
// Shared variables table (used in the resolved panel and the group detail)
@@ -165,12 +265,29 @@
&__group {
color: $text-tertiary;
+ white-space: nowrap;
+
+ .scope-badge {
+ margin-right: $space-2;
+ }
+ }
+
+ &__group-name {
+ color: $text-tertiary;
}
tr.is-secret &__key {
border-left: 2px solid $warning;
padding-left: $space-2;
}
+
+ // Row whose shared value is overridden by a local env var — dim the value
+ // since it is not the effective one for the container.
+ tr.has-conflict &__value {
+ color: $text-tertiary;
+ text-decoration: line-through;
+ text-decoration-color: $warning-border;
+ }
}
// ---------- Shared variable groups manager ----------
diff --git a/frontend/src/styles/pages/_fleet-proxy.scss b/frontend/src/styles/pages/_fleet-proxy.scss
index ed2e7847..ff7b9ffa 100644
--- a/frontend/src/styles/pages/_fleet-proxy.scss
+++ b/frontend/src/styles/pages/_fleet-proxy.scss
@@ -147,6 +147,15 @@
font-size: $font-size-sm;
}
+ // Per-row actionable recommendation pill. The text can be a full sentence,
+ // so allow it to wrap and clamp its width rather than stretch the row.
+ &__recommendation {
+ max-width: 32ch;
+ white-space: normal;
+ text-align: left;
+ line-height: 1.3;
+ }
+
&__col-actions {
text-align: right;
white-space: nowrap;
diff --git a/frontend/src/styles/pages/_services.scss b/frontend/src/styles/pages/_services.scss
index fdaaa8f5..123704d9 100644
--- a/frontend/src/styles/pages/_services.scss
+++ b/frontend/src/styles/pages/_services.scss
@@ -37,6 +37,39 @@
}
}
+ // Project / environment badge in the list row. Shows which project (and
+ // optional environment) an app lives in; a subtle "Unassigned" chip otherwise.
+ &__project {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-2;
+ flex-wrap: wrap;
+ }
+
+ &__project-name {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ max-width: 160px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-size: $font-size-sm;
+ color: $text-primary;
+
+ svg { flex-shrink: 0; color: $text-secondary; }
+ }
+
+ &__unassigned {
+ display: inline-flex;
+ align-items: center;
+ padding: 2px 8px;
+ border: 1px dashed $border-subtle;
+ border-radius: 999px;
+ font-size: 11.5px;
+ color: $text-secondary;
+ }
+
// Row-level action buttons (start / stop / restart).
&__actions {
display: flex;
@@ -45,6 +78,20 @@
}
}
+// "Move to project" bulk-action dialog body.
+.services-move {
+ display: flex;
+ flex-direction: column;
+ gap: $space-4;
+ padding: $space-2 0;
+
+ &__field {
+ display: flex;
+ flex-direction: column;
+ gap: $space-2;
+ }
+}
+
@keyframes pulse-dot {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }