mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
Restore the identity header on detail pages
Folding the entity's name, status and tabs into the top bar left the page without a header: the name was a small bar title and its facts sat behind an info tip. Server and service detail go back to the earlier anatomy, built once in components/detail/DetailPage: a breadcrumb top bar, an identity block (tile, name, status, key facts) and the tab strip under it with Settings at the far end.
This commit is contained in:
1 parent
26d3fab766
commit
84de7c29e5
8 files changed
+377
-195
No files matched your search
@@ -1,28 +0,0 @@
|
||||
import InfoTip from '@/components/InfoTip';
|
||||
import { StatusDot } from '@/components/ds';
|
||||
|
||||
// The top-bar meta every entity detail page shares (services, servers):
|
||||
// [status dot] [(i) with the facts the header used to spell out] [star].
|
||||
// Anything page-specific (an "open" link) rides along as children.
|
||||
//
|
||||
// status: { kind, label } kind = Pill vocabulary
|
||||
// rows: [{ label, value }] falsy values are skipped
|
||||
export default function DetailHeaderMeta({ status, infoTitle, rows, favorite, children }) {
|
||||
return (
|
||||
<>
|
||||
<StatusDot kind={status.kind} label={status.label} />
|
||||
<InfoTip size="md" title={infoTitle}>
|
||||
<dl className="sk-detail-info">
|
||||
{rows.filter((row) => row.value).map((row) => (
|
||||
<div className="sk-detail-info__row" key={row.label}>
|
||||
<dt>{row.label}</dt>
|
||||
<dd>{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</InfoTip>
|
||||
{favorite}
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import PageLayout from '@/layouts/PageLayout';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
// One anatomy for entity detail pages (services, servers):
|
||||
//
|
||||
// top bar Parent / Name [star] [actions]
|
||||
// identity [tile] Name [status] [badges]
|
||||
// meta line · meta line
|
||||
// tabs [Overview] [Logs] … [Settings]
|
||||
// content
|
||||
//
|
||||
// Feature pages own their data, actions and tab bodies; this module owns the
|
||||
// frame so the two pages cannot drift apart again.
|
||||
export function DetailPage({ className, topbarClassName, icon, parentTo, parentLabel, name, favorite, actions, children }) {
|
||||
return (
|
||||
<PageLayout
|
||||
className={cn('sk-detail-page', className)}
|
||||
topbarClassName={topbarClassName}
|
||||
contentClassName="sk-detail-body"
|
||||
icon={icon}
|
||||
title={(
|
||||
<span className="sk-detail-crumbs">
|
||||
<Link to={parentTo}>{parentLabel}</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
<span aria-current="page">{name}</span>
|
||||
</span>
|
||||
)}
|
||||
meta={favorite}
|
||||
actions={actions}
|
||||
>
|
||||
{children}
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
// The entity's name, state and key facts, directly under the top bar.
|
||||
export function DetailIdentity({ avatar, name, badges, meta, description }) {
|
||||
return (
|
||||
<header className="sk-detail-identity">
|
||||
{avatar}
|
||||
<div className="sk-detail-identity__body">
|
||||
<div className="sk-detail-identity__title">
|
||||
<h2>{name}</h2>
|
||||
{badges}
|
||||
</div>
|
||||
{meta && <div className="sk-detail-identity__meta">{meta}</div>}
|
||||
{description && <p className="sk-detail-identity__description">{description}</p>}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
// Separator between facts on the identity meta line.
|
||||
export function DetailMetaSep() {
|
||||
return <span className="sk-detail-identity__sep" aria-hidden="true">·</span>;
|
||||
}
|
||||
|
||||
// The tab strip under the identity. `items`: [{ id, label, icon, badge }].
|
||||
// Settings always sits at the far end of the strip.
|
||||
export function DetailTabs({ items, value, onValueChange, ariaLabel, children }) {
|
||||
return (
|
||||
<Tabs className="sk-detail-tabs" value={value} onValueChange={onValueChange}>
|
||||
<TabsList aria-label={ariaLabel}>
|
||||
{items.map(({ id, label, icon: Icon, badge }) => (
|
||||
<TabsTrigger key={id} value={id} className={id === 'settings' ? 'sk-detail-tabs__end' : undefined}>
|
||||
{Icon && <Icon size={14} aria-hidden="true" />}
|
||||
{label}
|
||||
{badge ? <span className="tab-badge">{badge}</span> : null}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
<div className="sk-detail-tabs__content">{children}</div>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import FavoriteStar from '@/components/FavoriteStar';
|
||||
import CopyButton from '@/components/CopyButton';
|
||||
import DetailHeaderMeta from '@/components/detail/DetailHeaderMeta';
|
||||
import { serverStatusKind } from './serverDetailData';
|
||||
|
||||
// Header meta: [status dot] [(i) with endpoint + ID] [star]. Everything the
|
||||
// header used to spell out lives behind the (i).
|
||||
export default function ServerHeaderMeta({ server }) {
|
||||
const { t } = useTranslation();
|
||||
const status = server.status || 'pending';
|
||||
const endpoint = server.hostname || server.ip_address || t('app.serverDetail.noEndpointConfigured', 'No endpoint configured');
|
||||
return (
|
||||
<DetailHeaderMeta
|
||||
status={{ kind: serverStatusKind(status), label: status.charAt(0).toUpperCase() + status.slice(1) }}
|
||||
infoTitle={t('app.serverDetail.details', 'Server details')}
|
||||
rows={[
|
||||
{ label: t('common.labels.status', 'Status'), value: status },
|
||||
{ label: t('app.serverDetail.endpoint', 'Endpoint'), value: endpoint },
|
||||
{
|
||||
label: t('app.serverDetail.serverId', 'ID'),
|
||||
value: (
|
||||
<span className="sk-detail-info__id">
|
||||
<code>{server.id}</code>
|
||||
<CopyButton value={String(server.id)} label={t('app.serverDetail.copyId', 'Copy ID')} />
|
||||
</span>
|
||||
),
|
||||
},
|
||||
]}
|
||||
favorite={<FavoriteStar type="server" id={server.id} path={`/servers/${server.id}`} label={server.name} />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -5530,18 +5530,18 @@
|
||||
"sshKeys": "SSH keys"
|
||||
},
|
||||
"serverDetail": {
|
||||
"agentVersion": "agent {{version}}",
|
||||
"alerts": "Alerts",
|
||||
"areYouSureYouWantTo": "Remove this server? This can't be undone.",
|
||||
"backToServers": "Back to servers",
|
||||
"copyId": "Copy ID",
|
||||
"copyServerId": "Copy server ID",
|
||||
"cron": "Cron",
|
||||
"details": "Server details",
|
||||
"endpoint": "Endpoint",
|
||||
"errorLoadingServer": "Couldn't load the server.",
|
||||
"failedToAcknowledgeAlert": "Couldn't acknowledge the alert.",
|
||||
"failedToPingServer": "Couldn't ping the server.",
|
||||
"failedToRemoveServer": "Couldn't remove the server.",
|
||||
"failedToResolveAlert": "Couldn't resolve the alert.",
|
||||
"lastSeen": "last seen",
|
||||
"limitedMode": "Limited mode",
|
||||
"loadingServerDetails": "Loading server details",
|
||||
"metrics": "Metrics",
|
||||
@@ -5555,7 +5555,6 @@
|
||||
"restorePoints": "Restore points",
|
||||
"sections": "Server sections",
|
||||
"serverDidNotRespond": "Server did not respond",
|
||||
"serverId": "ID",
|
||||
"serverNotFound": "Server not found",
|
||||
"serverRemovedSuccessfully": "Server removed",
|
||||
"serverRespondedInMs": "Server responded in {{latency}}ms",
|
||||
@@ -5964,7 +5963,6 @@
|
||||
"deployLatestCommit": "Deploy latest commit",
|
||||
"deploying": "Deploying…",
|
||||
"deploymentStarted": "Deployment started",
|
||||
"details": "Service details",
|
||||
"dockerCompose": "Docker Compose",
|
||||
"failedToDeleteService": "Couldn't delete the service.",
|
||||
"failedToDeployLatestCommit": "Couldn't deploy the latest commit.",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { isPlaceholderServerName } from '../components/serverdetail/serverDetailData';
|
||||
import ServerHeaderMeta from '../components/serverdetail/ServerHeaderMeta';
|
||||
import { isPlaceholderServerName, serverStatusKind } from '../components/serverdetail/serverDetailData';
|
||||
import { DetailPage, DetailIdentity, DetailMetaSep, DetailTabs } from '@/components/detail/DetailPage';
|
||||
import FavoriteStar from '@/components/FavoriteStar';
|
||||
import { Pill, ServiceTile } from '@/components/ds';
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useParams, Link, useNavigate } from 'react-router-dom';
|
||||
import api from '../services/api';
|
||||
@@ -7,10 +9,8 @@ import { useToast } from '../contexts/useToast.js';
|
||||
import { useConfirm } from '../hooks/useConfirm';
|
||||
import { useRecordVisit } from '@/hooks/useRecordVisit';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tabs, TabsContent } from '@/components/ui/tabs';
|
||||
import { Tip } from '@/components/ui/tooltip';
|
||||
import { Server, ArrowLeft } from 'lucide-react';
|
||||
import PageLayout from '../layouts/PageLayout';
|
||||
import { TabsContent } from '@/components/ui/tabs';
|
||||
import { Server, LayoutGrid, History, Container, Globe, Clock, Network, Package, Boxes, ScanSearch, Activity, Bell, Shield, Settings } from 'lucide-react';
|
||||
import PackagesTab from '../components/serverdetail/PackagesTab';
|
||||
import ServicesTab from '../components/serverdetail/ServicesTab';
|
||||
import ServerOverviewTab from '../components/serverdetail/ServerOverviewTab';
|
||||
@@ -22,6 +22,8 @@ import ServerMetricsTab from '../components/serverdetail/ServerMetricsTab';
|
||||
import SurveyTab from '../components/serverdetail/SurveyTab';
|
||||
import ServerSettingsTab, { TokenModal } from '../components/serverdetail/ServerSettingsTab';
|
||||
import {
|
||||
CopyChip,
|
||||
FolderTinyIcon,
|
||||
RefreshIcon,
|
||||
} from '../components/serverdetail/serverDetailShared';
|
||||
import ProxyStackPanel from '../components/proxy/ProxyStackPanel';
|
||||
@@ -32,6 +34,10 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useAuth } from '../contexts/useAuth.js';
|
||||
import ServerRestorePointsTab from '../components/serverdetail/ServerRestorePointsTab';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { formatDateTime } from '@/utils/intl';
|
||||
|
||||
// Edge of the identity tile next to the entity name, in px.
|
||||
const IDENTITY_TILE_SIZE = 52;
|
||||
|
||||
// Live host metrics cadence while the server is online.
|
||||
const METRICS_POLL_MS = 10000;
|
||||
@@ -254,57 +260,86 @@ const ServerDetail = () => {
|
||||
// hiding the tab matches the rest of the panel's "don't expose what
|
||||
// the host can't do" behaviour.
|
||||
const tabs = [
|
||||
{ id: 'overview', label: t('common.labels.overview', 'Overview') },
|
||||
...(isDeveloper ? [{ id: 'restore-points', label: t('app.serverDetail.restorePoints', 'Restore points') }] : []),
|
||||
{ id: 'docker', label: t('common.labels.docker', 'Docker') },
|
||||
{ id: 'proxy', label: t('app.serverDetail.proxy', 'Proxy') },
|
||||
...(server.capabilities?.cron ? [{ id: 'cron', label: t('app.serverDetail.cron', 'Cron') }] : []),
|
||||
...(server.capabilities?.cloudflared ? [{ id: 'cloudflared', label: t('app.serverDetail.tunnels', 'Tunnels') }] : []),
|
||||
...(server.capabilities?.packages ? [{ id: 'packages', label: t('app.serverDetail.packages', 'Packages') }] : []),
|
||||
...(server.capabilities?.systemd ? [{ id: 'services', label: t('common.labels.services', 'Services') }] : []),
|
||||
...(server.capabilities?.survey ? [{ id: 'survey', label: t('app.serverDetail.survey', 'Survey') }] : []),
|
||||
{ id: 'metrics', label: t('app.serverDetail.metrics', 'Metrics') },
|
||||
{ id: 'overview', icon: LayoutGrid, label: t('common.labels.overview', 'Overview') },
|
||||
...(isDeveloper ? [{ id: 'restore-points', icon: History, label: t('app.serverDetail.restorePoints', 'Restore points') }] : []),
|
||||
{ id: 'docker', icon: Container, label: t('common.labels.docker', 'Docker') },
|
||||
{ id: 'proxy', icon: Globe, label: t('app.serverDetail.proxy', 'Proxy') },
|
||||
...(server.capabilities?.cron ? [{ id: 'cron', icon: Clock, label: t('app.serverDetail.cron', 'Cron') }] : []),
|
||||
...(server.capabilities?.cloudflared ? [{ id: 'cloudflared', icon: Network, label: t('app.serverDetail.tunnels', 'Tunnels') }] : []),
|
||||
...(server.capabilities?.packages ? [{ id: 'packages', icon: Package, label: t('app.serverDetail.packages', 'Packages') }] : []),
|
||||
...(server.capabilities?.systemd ? [{ id: 'services', icon: Boxes, label: t('common.labels.services', 'Services') }] : []),
|
||||
...(server.capabilities?.survey ? [{ id: 'survey', icon: ScanSearch, label: t('app.serverDetail.survey', 'Survey') }] : []),
|
||||
{ id: 'metrics', icon: Activity, label: t('app.serverDetail.metrics', 'Metrics') },
|
||||
...(totalAlertCount > 0
|
||||
? [{ id: 'alerts', label: t('app.serverDetail.alerts', 'Alerts'), badge: totalAlertCount }]
|
||||
: [{ id: 'alerts', label: t('app.serverDetail.alerts', 'Alerts') }]),
|
||||
...(server.capabilities?.wireguard ? [{ id: 'remote-access', label: t('app.serverDetail.remoteAccess', 'Remote access') }] : []),
|
||||
{ id: 'settings', label: t('common.labels.settings', 'Settings') }
|
||||
? [{ id: 'alerts', icon: Bell, label: t('app.serverDetail.alerts', 'Alerts'), badge: totalAlertCount }]
|
||||
: [{ id: 'alerts', icon: Bell, label: t('app.serverDetail.alerts', 'Alerts') }]),
|
||||
...(server.capabilities?.wireguard ? [{ id: 'remote-access', icon: Shield, label: t('app.serverDetail.remoteAccess', 'Remote access') }] : []),
|
||||
{ id: 'settings', icon: Settings, label: t('common.labels.settings', 'Settings') }
|
||||
];
|
||||
|
||||
const displayName = isPlaceholderServerName(server.name) ? t('app.serverDetail.pendingPairing', 'Pending pairing') : server.name;
|
||||
|
||||
return (
|
||||
<PageLayout
|
||||
className="sk-detail-page server-detail-page"
|
||||
contentClassName="sk-detail-body"
|
||||
<DetailPage
|
||||
className="server-detail-page"
|
||||
icon={<Server size={18} />}
|
||||
title={isPlaceholderServerName(server.name) ? t('app.serverDetail.pendingPairing', 'Pending pairing') : server.name}
|
||||
navLabel={t('app.serverDetail.sections', 'Server sections')}
|
||||
meta={<ServerHeaderMeta server={server} />}
|
||||
tabs={tabs.map((item) => ({
|
||||
id: item.id,
|
||||
label: item.badge ? <>{item.label}<span className="tab-badge">{item.badge}</span></> : item.label,
|
||||
active: item.id === activeTab,
|
||||
onSelect: () => navigate(item.id === 'overview' ? `/servers/${id}` : `/servers/${id}/${item.id}`, { replace: true }),
|
||||
}))}
|
||||
parentTo="/servers"
|
||||
parentLabel={t('common.labels.servers', 'Servers')}
|
||||
name={displayName}
|
||||
favorite={<FavoriteStar type="server" id={server.id} path={`/servers/${server.id}`} label={server.name} />}
|
||||
actions={(
|
||||
<>
|
||||
<Tip content={t('app.serverDetail.backToServers', 'Back to servers')}>
|
||||
<Button asChild variant="ghost" size="icon" aria-label={t('app.serverDetail.backToServers', 'Back to servers')}>
|
||||
<Link to="/servers"><ArrowLeft size={16} /></Link>
|
||||
</Button>
|
||||
</Tip>
|
||||
<Tip content={t('app.serverDetail.ping', 'Ping')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('app.serverDetail.ping', 'Ping')} onClick={handlePingServer}>
|
||||
<RefreshIcon />
|
||||
</Button>
|
||||
</Tip>
|
||||
</>
|
||||
<Button variant="outline" size="sm" onClick={handlePingServer}>
|
||||
<RefreshIcon /> {t('app.serverDetail.ping', 'Ping')}
|
||||
</Button>
|
||||
)}
|
||||
>
|
||||
{server.description && (
|
||||
<p className="server-detail-header__description">{server.description}</p>
|
||||
)}
|
||||
<DetailIdentity
|
||||
avatar={<ServiceTile name={displayName} size={IDENTITY_TILE_SIZE} />}
|
||||
name={displayName}
|
||||
badges={(
|
||||
<>
|
||||
<Pill kind={serverStatusKind(server.status)}>{server.status || 'pending'}</Pill>
|
||||
<CopyChip label="id" value={server.id} title={t('app.serverDetail.copyServerId', 'Copy server ID')} mono />
|
||||
</>
|
||||
)}
|
||||
meta={(
|
||||
<>
|
||||
<span>{server.hostname || server.ip_address || t('app.serverDetail.noEndpointConfigured', 'No endpoint configured')}</span>
|
||||
{server.group_name && (
|
||||
<>
|
||||
<DetailMetaSep />
|
||||
<span><FolderTinyIcon /> {server.group_name}</span>
|
||||
</>
|
||||
)}
|
||||
{server.os_type && (
|
||||
<>
|
||||
<DetailMetaSep />
|
||||
<span>{server.os_type}</span>
|
||||
</>
|
||||
)}
|
||||
{server.agent_version && (
|
||||
<>
|
||||
<DetailMetaSep />
|
||||
<span>{t('app.serverDetail.agentVersion', 'agent {{version}}', { version: server.agent_version })}</span>
|
||||
</>
|
||||
)}
|
||||
{server.last_seen && (
|
||||
<>
|
||||
<DetailMetaSep />
|
||||
<span>{t('app.serverDetail.lastSeen', 'last seen')} {formatDateTime(server.last_seen)}</span>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
description={server.description}
|
||||
/>
|
||||
|
||||
<Tabs value={activeTab}>
|
||||
<DetailTabs
|
||||
items={tabs}
|
||||
value={activeTab}
|
||||
ariaLabel={t('app.serverDetail.sections', 'Server sections')}
|
||||
onValueChange={(value) => navigate(value === 'overview' ? `/servers/${id}` : `/servers/${id}/${value}`, { replace: true })}
|
||||
>
|
||||
<div className="server-detail-content">
|
||||
<TabsContent value="overview">
|
||||
<ServerOverviewTab
|
||||
@@ -373,7 +408,7 @@ const ServerDetail = () => {
|
||||
/>
|
||||
</TabsContent>
|
||||
</div>
|
||||
</Tabs>
|
||||
</DetailTabs>
|
||||
|
||||
{showTokenModal && server && (
|
||||
<TokenModal
|
||||
@@ -382,7 +417,7 @@ const ServerDetail = () => {
|
||||
onGenerated={handleTokenGenerated}
|
||||
/>
|
||||
)}
|
||||
</PageLayout>
|
||||
</DetailPage>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -23,12 +23,11 @@ import OverviewTab from '../components/service-detail/OverviewTab';
|
||||
import PreviewList from '../components/previews/PreviewList';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import PluginSlot from '../components/PluginSlot';
|
||||
import { Layers, FileArchive, RotateCcw, ExternalLink } from 'lucide-react';
|
||||
import { Layers, FileArchive, RotateCcw, LayoutDashboard, History, ScrollText, Variable, Terminal, Activity, Package, Server, SquareTerminal, Settings, Eye, ExternalLink } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { statusKind } from '@/components/ds';
|
||||
import PageLayout from '../layouts/PageLayout';
|
||||
import { Pill, ServiceTile, statusKind } from '@/components/ds';
|
||||
import FavoriteStar from '@/components/FavoriteStar';
|
||||
import DetailHeaderMeta from '@/components/detail/DetailHeaderMeta';
|
||||
import { DetailPage, DetailIdentity, DetailMetaSep, DetailTabs } from '@/components/detail/DetailPage';
|
||||
import { useRecordVisit } from '@/hooks/useRecordVisit';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
@@ -60,6 +59,24 @@ const RETIRED_TAB_REDIRECTS = {
|
||||
deploy: 'settings/git',
|
||||
};
|
||||
|
||||
// Per-tab glyph for the detail tab strip.
|
||||
const TAB_ICONS = {
|
||||
overview: LayoutDashboard,
|
||||
events: History,
|
||||
logs: ScrollText,
|
||||
environment: Variable,
|
||||
shell: Terminal,
|
||||
metrics: Activity,
|
||||
packages: Package,
|
||||
gunicorn: Server,
|
||||
commands: SquareTerminal,
|
||||
previews: Eye,
|
||||
settings: Settings,
|
||||
};
|
||||
|
||||
// Edge of the identity tile next to the entity name, in px.
|
||||
const IDENTITY_TILE_SIZE = 52;
|
||||
|
||||
const ServiceDetail = () => {
|
||||
const { t } = useTranslation();
|
||||
const { id, tab: rawTab } = useParams();
|
||||
@@ -266,51 +283,14 @@ const ServiceDetail = () => {
|
||||
const openUrl = primaryDomain ? null : servicePortUrl(service);
|
||||
|
||||
return (
|
||||
<PageLayout
|
||||
className="sk-detail-page svc-detail"
|
||||
contentClassName="sk-detail-body"
|
||||
<DetailPage
|
||||
className="svc-detail"
|
||||
topbarClassName="svc-detail-topbar"
|
||||
icon={<Layers size={18} />}
|
||||
title={service.name}
|
||||
navLabel={t('app.serviceDetail.sections', 'Service sections')}
|
||||
meta={(
|
||||
<DetailHeaderMeta
|
||||
status={{ kind: statusKind(service.statusInfo.dotClass), label: service.statusInfo.label }}
|
||||
infoTitle={t('app.serviceDetail.details', 'Service details')}
|
||||
rows={[
|
||||
{ label: t('common.labels.status', 'Status'), value: service.statusInfo.label },
|
||||
{ label: t('common.labels.type', 'Type'), value: service.typeInfo.label },
|
||||
{ label: t('common.labels.port', 'Port'), value: service.port },
|
||||
{ label: t('common.labels.created', 'Created'), value: formatDate(service.created_at) },
|
||||
{
|
||||
label: t('common.labels.domain', 'Domain'),
|
||||
value: primaryDomain && (
|
||||
<a href={`https://${primaryDomain}`} target="_blank" rel="noopener noreferrer">{primaryDomain}</a>
|
||||
),
|
||||
},
|
||||
]}
|
||||
favorite={<FavoriteStar type="service" id={service.id} path={`/services/${service.id}`} label={service.name} />}
|
||||
>
|
||||
{openUrl && (
|
||||
<a
|
||||
href={openUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="svc-detail__open"
|
||||
title={t('app.serviceDetail.open', 'Open {{openUrl}}', { openUrl: openUrl })}
|
||||
aria-label={t('app.serviceDetail.openInANewTab', 'Open {{name}} in a new tab', { name: service.name })}
|
||||
>
|
||||
<ExternalLink size={15} />
|
||||
</a>
|
||||
)}
|
||||
</DetailHeaderMeta>
|
||||
)}
|
||||
tabs={availableTabs.map(tab => ({
|
||||
id: tab,
|
||||
label: TAB_LABELS[tab] || tab,
|
||||
active: activeTab === tab,
|
||||
onSelect: () => setActiveTab(tab),
|
||||
}))}
|
||||
parentTo="/services"
|
||||
parentLabel={t('common.labels.services', 'Services')}
|
||||
name={service.name}
|
||||
favorite={<FavoriteStar type="service" id={service.id} path={`/services/${service.id}`} label={service.name} />}
|
||||
actions={(
|
||||
<>
|
||||
{/* Deploy dropdown */}
|
||||
@@ -423,6 +403,51 @@ const ServiceDetail = () => {
|
||||
)}
|
||||
>
|
||||
|
||||
<DetailIdentity
|
||||
avatar={<ServiceTile name={service.name} size={IDENTITY_TILE_SIZE} />}
|
||||
name={service.name}
|
||||
badges={(
|
||||
<>
|
||||
{openUrl && (
|
||||
<a
|
||||
href={openUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="svc-detail__open"
|
||||
title={t('app.serviceDetail.open', 'Open {{openUrl}}', { openUrl: openUrl })}
|
||||
aria-label={t('app.serviceDetail.openInANewTab', 'Open {{name}} in a new tab', { name: service.name })}
|
||||
>
|
||||
<ExternalLink size={15} />
|
||||
</a>
|
||||
)}
|
||||
<Pill kind={statusKind(service.statusInfo.dotClass)}>{service.statusInfo.label}</Pill>
|
||||
<span
|
||||
className="svc-detail__type-badge"
|
||||
style={{ backgroundColor: service.typeInfo.bgColor, color: service.typeInfo.color, borderColor: service.typeInfo.borderColor }}
|
||||
>
|
||||
{service.typeInfo.label}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
meta={(
|
||||
<>
|
||||
{service.port && (
|
||||
<>
|
||||
<span>{t('common.labels.port', 'Port')} {service.port}</span>
|
||||
<DetailMetaSep />
|
||||
</>
|
||||
)}
|
||||
<span>{t('common.labels.created', 'Created')} {formatDate(service.created_at)}</span>
|
||||
{primaryDomain && (
|
||||
<>
|
||||
<DetailMetaSep />
|
||||
<a href={`https://${primaryDomain}`} target="_blank" rel="noopener noreferrer">{primaryDomain}</a>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* Repo Connection Pill */}
|
||||
<div className="svc-detail__repo-bar">
|
||||
{isUpload ? (
|
||||
@@ -519,7 +544,12 @@ const ServiceDetail = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Tab Content */}
|
||||
<DetailTabs
|
||||
items={availableTabs.map((tab) => ({ id: tab, label: TAB_LABELS[tab] || tab, icon: TAB_ICONS[tab] }))}
|
||||
value={activeTab}
|
||||
onValueChange={setActiveTab}
|
||||
ariaLabel={t('app.serviceDetail.sections', 'Service sections')}
|
||||
>
|
||||
<div className="app-detail-content">
|
||||
{activeTab === 'overview' && <OverviewTab app={service} deployConfig={deployConfig} />}
|
||||
{activeTab === 'events' && <EventsTab appId={service.id} />}
|
||||
@@ -541,10 +571,11 @@ const ServiceDetail = () => {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</DetailTabs>
|
||||
|
||||
{/* Extension slot: widgets contributed to the service detail page */}
|
||||
<PluginSlot name="service.detail.tab" context={{ serviceId: service.id }} />
|
||||
</PageLayout>
|
||||
</DetailPage>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,39 +1,153 @@
|
||||
// ============================================
|
||||
// ENTITY DETAIL PAGE
|
||||
// What the service and server detail pages share, so the two read as one
|
||||
// layout: the top-bar meta, the body rhythm and the settings shell. Feature
|
||||
// stylesheets (_service-detail, _servers) own only what is inside the tabs.
|
||||
// components/detail/DetailHeaderMeta.jsx [dot] [(i)] [star]
|
||||
// components/detail/DetailSettings.jsx grouped nav + content column
|
||||
// The frame the service and server detail pages share, so the two read as
|
||||
// one layout (components/detail/DetailPage.jsx, DetailSettings.jsx):
|
||||
//
|
||||
// top bar Parent / Name [star] [actions]
|
||||
// identity [tile] Name [status] [badges] + meta line
|
||||
// tabs [Overview] [Logs] ... [Settings]
|
||||
// content
|
||||
//
|
||||
// Feature stylesheets (_service-detail, _servers) own only what is inside
|
||||
// the tabs.
|
||||
// ============================================
|
||||
|
||||
// Header: dot / (i) / star share one centered row beside the title.
|
||||
// Top bar: breadcrumb in the title slot, the star beside it.
|
||||
.sk-detail-page .sk-topbar {
|
||||
&__titles { align-items: center; }
|
||||
&__meta { display: inline-flex; align-items: center; gap: $space-2; }
|
||||
|
||||
.fav-star {
|
||||
width: 24px; // geometry: matches the InfoTip md footprint
|
||||
height: 24px; // geometry: matches the InfoTip md footprint
|
||||
width: 24px; // geometry: icon-button footprint
|
||||
height: 24px; // geometry: icon-button footprint
|
||||
svg { width: 14px; height: 14px; } // geometry: inline icon
|
||||
opacity: 0.6;
|
||||
&:hover, &.is-on { opacity: 1; }
|
||||
}
|
||||
}
|
||||
|
||||
// Facts behind the header (i): label / value pairs.
|
||||
.sk-detail-info {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: $space-1 $space-3;
|
||||
margin: 0;
|
||||
.sk-detail-crumbs {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: $space-2;
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
&__row { display: contents; }
|
||||
a {
|
||||
color: var(--text-dim);
|
||||
font-weight: $font-weight-medium;
|
||||
text-decoration: none;
|
||||
&:hover { color: var(--text); }
|
||||
}
|
||||
|
||||
dt { color: var(--text-faint); }
|
||||
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
||||
> [aria-hidden] { color: var(--text-ghost); }
|
||||
}
|
||||
|
||||
&__id { display: flex; align-items: center; gap: $space-1; code { font-family: $font-mono; } }
|
||||
// Identity: tile + name + status, a meta line and an optional description.
|
||||
.sk-detail-identity {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: $space-4;
|
||||
|
||||
> :first-child { flex-shrink: 0; }
|
||||
|
||||
&__body { min-inline-size: 0; flex: 1; }
|
||||
|
||||
&__title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: $space-3;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
font-size: $text-lg;
|
||||
font-weight: $font-weight-semibold;
|
||||
letter-spacing: -0.02em;
|
||||
color: var(--text);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: $space-2;
|
||||
margin-block-start: $space-1;
|
||||
font-size: $text-xs;
|
||||
color: var(--text-dim);
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
> span { display: inline-flex; align-items: center; gap: $space-1; }
|
||||
a { color: var(--accent-bright); text-decoration: none; &:hover { text-decoration: underline; } }
|
||||
}
|
||||
|
||||
&__sep { color: var(--text-ghost); }
|
||||
|
||||
&__description {
|
||||
margin-block: $space-2 0;
|
||||
font-size: $text-sm;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.copy-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: $space-2;
|
||||
padding: $space-1 $space-2;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: $radius-control;
|
||||
background: var(--surface);
|
||||
color: var(--text-dim);
|
||||
font-size: $text-xs;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover { border-color: var(--border-strong); color: var(--text); }
|
||||
}
|
||||
|
||||
.copy-chip__value {
|
||||
max-inline-size: 22ch;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
// Tab strip under the identity: one quiet bar, Settings pinned to the end.
|
||||
.sk-detail-page .sk-detail-tabs {
|
||||
min-inline-size: 0;
|
||||
|
||||
> .tabs {
|
||||
gap: $space-1;
|
||||
margin: 0;
|
||||
padding: $space-1;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: $radius-card;
|
||||
}
|
||||
|
||||
> .tabs .tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: $space-2;
|
||||
padding: $space-2 $space-3;
|
||||
border: 0;
|
||||
border-radius: $radius-control;
|
||||
font-size: $text-sm;
|
||||
font-weight: $font-weight-medium;
|
||||
color: var(--text-dim);
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover { color: var(--text); }
|
||||
&[data-state='active'] { background: var(--surface-hover); color: var(--text); }
|
||||
}
|
||||
|
||||
> .tabs .sk-detail-tabs__end { margin-inline-start: auto; order: 2; }
|
||||
> .tabs .tabs-overflow-trigger { order: 1; }
|
||||
|
||||
&__content { padding-block-start: $space-5; }
|
||||
.tab-content-pane { margin: 0; padding: 0; }
|
||||
}
|
||||
|
||||
// Body below the top bar: one column, one gap between its blocks.
|
||||
|
||||
@@ -2368,18 +2368,6 @@
|
||||
gap: $space-3;
|
||||
}
|
||||
|
||||
// Phones: the server's actions are two icon buttons, so the title block and
|
||||
// actions stay on ONE row (title truncates), tabs below. The shared header
|
||||
// rules (dot / (i) / star) live in components/_detail-page.scss.
|
||||
.server-detail-page .sk-topbar {
|
||||
@media (max-width: 768px) {
|
||||
&__titles { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; }
|
||||
&__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
|
||||
&__spacer { display: none; }
|
||||
&__actions { order: 0; width: auto; margin-left: auto; justify-content: flex-end; overflow: visible; flex-wrap: nowrap; }
|
||||
}
|
||||
}
|
||||
|
||||
// Permission-level picker in the Add Server drawer
|
||||
.level-picker {
|
||||
display: grid;
|
||||
|
||||
Reference in new issue
Block a user