mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
Fold table controls into the view selector
Every list page placed its filter, tools menu, search and create button differently: four homes for the filter and "⋮", three button styles and five orders in the top bar. The view selector's menu now holds filters and fields, copy link, export, refresh and reset on every table (chrome.pickerProps), and the top bar is always secondary buttons, create, then search (ListActions / useListTopbar). PageLayout pages can publish into their own bar, which puts Docker on the same shell as Servers. Docker's KPI strip is gone, along with the four list fetches it made only to count rows.
This commit is contained in:
1 parent
623a9622ba
commit
36f8285bf3
55 files changed
+622
-1062
No files matched your search
@@ -19,7 +19,7 @@ debt. Regenerate with `python scripts/generate-migration-inventory.py`.
|
||||
| Hand-shaped {'error': ...} bodies in app/api | typed errors + the global handler | 849 | 850 | migrate when touched; new endpoints raise |
|
||||
| Raw subprocess calls outside the runners | app/utils/system.py runners | 23 | 23 | migrate when touched |
|
||||
| Controller-boundary violations (routes doing service work) | service layer extraction | 453 | 453 | migrate when touched (first-wave ratchet) |
|
||||
| raw api.* calls in pages/ | E1: useServerQuery/useServerMutation | 371 | 371 | migrate when touched |
|
||||
| raw api.* calls in pages/ | E1: useServerQuery/useServerMutation | 363 | 371 | migrate when touched |
|
||||
| per-page toast.error extractions in pages/ | E1: query-layer error presentation | 185 | 206 | migrate when touched |
|
||||
| hand-rolled form-group blocks | F2: FormField/useForm | 206 | 206 | migrate when touched |
|
||||
| unencoded ?k=${v} query interpolations in services/api | C4: buildQuery/encoding template | 0 | 0 | INVARIANT at 0 |
|
||||
|
||||
@@ -15,8 +15,7 @@ import Modal from './Modal';
|
||||
import EmptyState from './EmptyState';
|
||||
import { DataTable, DataTableFooter, ListToolbar, SearchField } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -552,9 +551,9 @@ const EnvironmentVariables = ({ appId }) => {
|
||||
useTopbarChrome). No count on it — the footer reports
|
||||
that, under the rows it is counting. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadEnvVars }}
|
||||
label="variables"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -562,11 +561,6 @@ const EnvironmentVariables = ({ appId }) => {
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.environmentVariables.searchKeysOrDescriptions', 'Search keys or descriptions…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadEnvVars} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -6,8 +6,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { DataTable, DataTableFooter, SearchField } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -298,9 +297,9 @@ export function ProcessTable({
|
||||
{/* One row of chrome: the view name is the heading, and search, the
|
||||
host's own controls, the filter button and the "⋮" ride it. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh }}
|
||||
label="processes"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -309,11 +308,6 @@ export function ProcessTable({
|
||||
placeholder={t('app.processTable.filterPidNameCommand', 'Filter PID, name, command…')}
|
||||
/>
|
||||
{actions}
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={onRefresh} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -6,8 +6,7 @@ import { useConfirm } from '../../hooks/useConfirm';
|
||||
import { formatBytes } from '@/utils/formatBytes';
|
||||
import { DataTable, DataTableFooter, SearchField } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -222,10 +221,9 @@ export default function BackupsTab() {
|
||||
return (
|
||||
<div className="dbx-backups">
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="backups"
|
||||
onCreate={chrome.createView}
|
||||
actions={<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />}
|
||||
/>
|
||||
<EmptyState
|
||||
icon={Archive}
|
||||
@@ -242,9 +240,9 @@ export default function BackupsTab() {
|
||||
bar, so it stays inline rather than being hoisted; refresh is in
|
||||
the "⋮" with the other table-wide actions. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="backups"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -252,11 +250,6 @@ export default function BackupsTab() {
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.backupsTab.filterDatabaseOrFile', 'Filter database or file…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -7,8 +7,7 @@ import { usePolling } from '../../hooks/usePolling';
|
||||
import EmptyState from '../EmptyState';
|
||||
import { DataTable, DataTableFooter, SearchField } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -320,9 +319,9 @@ export default function ProcessListPanel({ conn, engine, active, isAdmin }) {
|
||||
is in the "⋮". No process count here — the footer reports it,
|
||||
under the rows it is counting. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: () => load() }}
|
||||
label="sessions"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<label className="dbp-auto">
|
||||
@@ -338,11 +337,6 @@ export default function ProcessListPanel({ conn, engine, active, isAdmin }) {
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.processListPanel.filterSessions', 'Filter sessions…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={() => load()} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -4,8 +4,7 @@ import { runQuery, getStructure, buildBrowseQuery } from './dbAdapter';
|
||||
import ResultsGrid from './ResultsGrid';
|
||||
import { DataTable, DataTableFooter, SearchField } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -337,9 +336,9 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
|
||||
inside the explorer's own tab bar, so it stays inline
|
||||
rather than being hoisted. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: () => loadStructure(true) }}
|
||||
label="columns"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -347,14 +346,6 @@ export default function TableDataTab({ conn, tabId, table, rowsEstimate, active,
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.tableDataTab.filterColumnOrType', 'Filter column or type…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu
|
||||
{...chrome.toolsProps}
|
||||
onRefresh={() => loadStructure(true)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -5,10 +5,9 @@ import { useConfirm } from '../../hooks/useConfirm';
|
||||
import EmptyState from '../EmptyState';
|
||||
import { ErrorState } from '../ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { DataTable, DataTableFooter, SearchField } from '@/components/ds';
|
||||
import { DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -17,11 +16,10 @@ import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@
|
||||
import { Package, Play, Square, RotateCw, FileText, Download } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
useServer,
|
||||
unwrapRemoteData,
|
||||
normalizeListResponse,
|
||||
useServer, unwrapRemoteData, normalizeListResponse,
|
||||
} from './dockerHelpers';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
// `docker compose ls --format json` capitalises its keys; the label-scanning
|
||||
// fallback in docker_service builds the same shape by hand. Read through one
|
||||
@@ -99,6 +97,12 @@ const ComposeTab = ({ onStatsChange }) => {
|
||||
const [logsProject, setLogsProject] = useState(null);
|
||||
const [actionLoading, setActionLoading] = useState({});
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
// The Docker page's top bar: this tab's search, after the page-wide
|
||||
// buttons. Filters and the table tools are in the view selector's menu.
|
||||
useListTopbar(() => ({
|
||||
search: { value: searchTerm, onSearch: setSearchTerm, placeholder: t('app.composeTab.searchProjects', 'Search compose projects…') },
|
||||
}), [searchTerm]);
|
||||
const { sorts, setSorts } = useTableSort({
|
||||
defaultSorts: [{ key: 'name', direction: 'asc' }],
|
||||
storageKey: 'serverkit-table-docker-compose-sort',
|
||||
@@ -384,25 +388,9 @@ const ComposeTab = ({ onStatsChange }) => {
|
||||
return (
|
||||
<div className="dx-tab-pane dx-list-pane">
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadProjects }}
|
||||
label="projects"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
placeholder={t('app.composeTab.filterProjectOrConfigPath', 'Filter compose project or config path…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
{/* Refresh is not repeated as its own icon: it rides the
|
||||
"⋮" with the other table-wide actions. */}
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadProjects} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -9,10 +9,9 @@ import EmptyState from '../EmptyState';
|
||||
import { ErrorState } from '../ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { SheetPanel } from '@/components/ui/sheet';
|
||||
import { Drawer, DataTable, DataTableFooter, Pill, SearchField } from '@/components/ds';
|
||||
import { Drawer, DataTable, DataTableFooter, Pill } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer, GridBulkBar,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer, GridBulkBar,
|
||||
} from '@/components/ds/grid';
|
||||
import { formatRelativeTime } from '@/utils/time';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
@@ -24,31 +23,18 @@ import EnvEditor from '@/components/EnvEditor';
|
||||
import { CopyButton } from '@/components/CopyButton';
|
||||
import { envToObject } from '@/utils/dotenv';
|
||||
import {
|
||||
Box, X, Trash2, Play, Square, RotateCw,
|
||||
Terminal as TerminalLucide, FileText, Activity, Clock3, Plus,
|
||||
Database, Gauge, Package, Server as ServerIcon, Lock,
|
||||
Box, X, Trash2, Play, Square, SquareCheck, RotateCw, Terminal as TerminalLucide, FileText, Activity, Clock3, Plus, Database, Gauge, Package, Server as ServerIcon, Lock,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
useServer,
|
||||
unwrapRemoteData,
|
||||
formatPorts,
|
||||
normalizeListResponse,
|
||||
shortId,
|
||||
getContainerId,
|
||||
getContainerName,
|
||||
getContainerImage,
|
||||
getContainerStatus,
|
||||
isContainerRunning,
|
||||
isProtectedContainer,
|
||||
getContainerStatusLabel,
|
||||
containerHue,
|
||||
getContainerProjectName,
|
||||
useServer, unwrapRemoteData, formatPorts, normalizeListResponse, shortId, getContainerId, getContainerName, getContainerImage, getContainerStatus, isContainerRunning, isProtectedContainer, getContainerStatusLabel, containerHue, getContainerProjectName,
|
||||
} from './dockerHelpers';
|
||||
import { ContainerResourceBars } from './dockerShared';
|
||||
import { downloadBlob } from '@/utils/downloadBlob';
|
||||
import { usePolling } from '@/hooks/usePolling';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
// Container stats cadence.
|
||||
const STATS_REFRESH_MS = 10000;
|
||||
@@ -63,13 +49,15 @@ export const RunContainerButton = () => {
|
||||
const { isRemote } = useServer();
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
<PagePrimaryButton
|
||||
id="docker-run-container"
|
||||
icon={Play}
|
||||
label={t('app.containersTab.runContainer2', 'Run container')}
|
||||
shortLabel={t('app.containersTab.run', 'Run')}
|
||||
onClick={() => setShowModal(true)}
|
||||
disabled={isRemote}
|
||||
title={isRemote ? t('app.containersTab.runningNewContainersIsOnlyAvailable', 'Running new containers is only available on the panel server right now') : t('app.containersTab.runContainer', 'Run container')}
|
||||
>
|
||||
<span>+</span> {t('app.containersTab.runContainer2', 'Run container')}
|
||||
</Button>
|
||||
disabledReason={isRemote ? t('app.containersTab.runningNewContainersIsOnlyAvailable', 'Running new containers is only available on the panel server right now') : undefined}
|
||||
/>
|
||||
{showModal && <RunContainerModal onClose={() => setShowModal(false)} onCreated={() => window.location.reload()} />}
|
||||
</>
|
||||
);
|
||||
@@ -203,6 +191,13 @@ const ContainersTab = ({ onStatsChange }) => {
|
||||
const [logsContainer, setLogsContainer] = useState(null);
|
||||
const [execContainer, setExecContainer] = useState(null);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
// The Docker page's top bar: this tab's create button and search, after the page-wide
|
||||
// buttons. Filters and the table tools are in the view selector's menu.
|
||||
useListTopbar(() => ({
|
||||
primary: <RunContainerButton />,
|
||||
search: { value: searchTerm, onSearch: setSearchTerm, placeholder: t('app.containersTab.searchContainers', 'Search containers…') },
|
||||
}), [searchTerm]);
|
||||
// Native DataTable header sorting (the old <select> + direction button is
|
||||
// gone). Default keeps the previous behavior: running containers first.
|
||||
const { sorts, setSorts } = useTableSort({
|
||||
@@ -780,39 +775,18 @@ const ContainersTab = ({ onStatsChange }) => {
|
||||
|
||||
return (
|
||||
<div className="dx-tab-pane dx-containers-pane">
|
||||
{/* One row of chrome. The view name is this pane's heading and
|
||||
everything that acts on the table — the fetch scope, the search,
|
||||
the filter, the "⋮" — rides the same line. This pane is inside
|
||||
the Docker page's tab group, whose top bar belongs to that page,
|
||||
so the chrome stays here rather than being hoisted (see
|
||||
useTopbarChrome). Refresh is not repeated as an icon: it is in
|
||||
the "⋮" with the other table-wide actions. */}
|
||||
{/* The view name is this pane's heading. Its menu holds the fetch
|
||||
scope (Include stopped), filters and the table tools; search
|
||||
and Run ride the Docker page's top bar. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadContainers }}
|
||||
label="containers"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<label className="dx-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={showAll}
|
||||
onChange={(e) => setShowAll(e.target.checked)}
|
||||
/>
|
||||
<span>{t('app.containersTab.includeStopped', 'Include stopped')}</span>
|
||||
</label>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
placeholder={t('app.containersTab.filterNameImageOrId', 'Filter name, image, or ID…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadContainers} />
|
||||
</>
|
||||
)}
|
||||
extra={[{
|
||||
icon: showAll ? SquareCheck : Square,
|
||||
label: t('app.containersTab.includeStopped', 'Include stopped'),
|
||||
onSelect: () => setShowAll((value) => !value),
|
||||
}]}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -5,39 +5,38 @@ import { useConfirm } from '../../hooks/useConfirm';
|
||||
import EmptyState from '../EmptyState';
|
||||
import { ErrorState } from '../ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { DataTable, DataTableFooter, SearchField } from '@/components/ds';
|
||||
import { DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Layers, Trash2 } from 'lucide-react';
|
||||
import { Download, Layers, Trash2 } from 'lucide-react';
|
||||
import { formatBytes } from '@/utils/formatBytes';
|
||||
import { formatRelativeTime } from '@/utils/time';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
useServer,
|
||||
normalizeListResponse,
|
||||
imageId,
|
||||
imageRef,
|
||||
imageSizeBytes,
|
||||
imageSizeMb,
|
||||
imageCreatedMs,
|
||||
useServer, normalizeListResponse, imageId, imageRef, imageSizeBytes, imageSizeMb, imageCreatedMs,
|
||||
} from './dockerHelpers';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { formatDateTime } from '@/utils/intl';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
export const PullImageButton = () => {
|
||||
const { t } = useTranslation();
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => setShowModal(true)}>
|
||||
<span>+</span> {t('app.imagesTab.pullImage', 'Pull image')}
|
||||
</Button>
|
||||
<PagePrimaryButton
|
||||
id="docker-pull-image"
|
||||
icon={Download}
|
||||
label={t('app.imagesTab.pullImage', 'Pull image')}
|
||||
shortLabel={t('app.imagesTab.pull', 'Pull')}
|
||||
onClick={() => setShowModal(true)}
|
||||
/>
|
||||
{showModal && <PullImageModal onClose={() => setShowModal(false)} onPulled={() => window.location.reload()} />}
|
||||
</>
|
||||
);
|
||||
@@ -113,6 +112,13 @@ const ImagesTab = ({ onStatsChange }) => {
|
||||
const [images, setImages] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
// The Docker page's top bar: this tab's create button and search, after the page-wide
|
||||
// buttons. Filters and the table tools are in the view selector's menu.
|
||||
useListTopbar(() => ({
|
||||
primary: <PullImageButton />,
|
||||
search: { value: searchTerm, onSearch: setSearchTerm, placeholder: t('app.imagesTab.searchImages', 'Search images…') },
|
||||
}), [searchTerm]);
|
||||
const { sorts, setSorts } = useTableSort({
|
||||
defaultSorts: [{ key: 'repository', direction: 'asc' }],
|
||||
storageKey: 'serverkit-table-docker-images-sort',
|
||||
@@ -322,23 +328,9 @@ const ImagesTab = ({ onStatsChange }) => {
|
||||
return (
|
||||
<div className="dx-tab-pane dx-list-pane">
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadImages }}
|
||||
label="images"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
placeholder={t('app.imagesTab.filterRepositoryTagOrId', 'Filter repository, tag, or ID…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadImages} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -5,10 +5,9 @@ import { useConfirm } from '../../hooks/useConfirm';
|
||||
import EmptyState from '../EmptyState';
|
||||
import { ErrorState } from '../ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { DataTable, DataTableFooter, Pill, SearchField, SegControl } from '@/components/ds';
|
||||
import { DataTable, DataTableFooter, Pill, SegControl } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -17,11 +16,11 @@ import { Input } from '@/components/ui/input';
|
||||
import { Network as NetworkIcon, Trash2, Lock } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
useServer,
|
||||
normalizeListResponse,
|
||||
shortId,
|
||||
useServer, normalizeListResponse, shortId,
|
||||
} from './dockerHelpers';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
export const CreateNetworkButton = () => {
|
||||
const { t } = useTranslation();
|
||||
@@ -29,13 +28,14 @@ export const CreateNetworkButton = () => {
|
||||
const { isRemote } = useServer();
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
<PagePrimaryButton
|
||||
id="docker-create-network"
|
||||
label={t('app.networksTab.createNetwork', 'Create network')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setShowModal(true)}
|
||||
disabled={isRemote}
|
||||
title={isRemote ? t('app.networksTab.creatingNetworksIsOnlyAvailableOn', 'Creating networks is only available on the panel server right now') : t('app.networksTab.createNetwork', 'Create network')}
|
||||
>
|
||||
<span>+</span> {t('app.networksTab.createNetwork2', 'Create network')}
|
||||
</Button>
|
||||
disabledReason={isRemote ? t('app.networksTab.creatingNetworksIsOnlyAvailableOn', 'Creating networks is only available on the panel server right now') : undefined}
|
||||
/>
|
||||
{showModal && <CreateNetworkModal onClose={() => setShowModal(false)} onCreated={() => window.location.reload()} />}
|
||||
</>
|
||||
);
|
||||
@@ -106,6 +106,13 @@ const NetworksTab = ({ onStatsChange }) => {
|
||||
const [networks, setNetworks] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
// The Docker page's top bar: this tab's create button and search, after the page-wide
|
||||
// buttons. Filters and the table tools are in the view selector's menu.
|
||||
useListTopbar(() => ({
|
||||
primary: <CreateNetworkButton />,
|
||||
search: { value: searchTerm, onSearch: setSearchTerm, placeholder: t('app.networksTab.searchNetworks', 'Search networks…') },
|
||||
}), [searchTerm]);
|
||||
const { sorts, setSorts } = useTableSort({
|
||||
defaultSorts: [{ key: 'name', direction: 'asc' }],
|
||||
storageKey: 'serverkit-table-docker-networks-sort',
|
||||
@@ -306,23 +313,9 @@ const NetworksTab = ({ onStatsChange }) => {
|
||||
return (
|
||||
<div className="dx-tab-pane dx-list-pane">
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadNetworks }}
|
||||
label="networks"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
placeholder={t('app.networksTab.filterNameOrId', 'Filter name or ID…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadNetworks} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -5,10 +5,9 @@ import { useConfirm } from '../../hooks/useConfirm';
|
||||
import EmptyState from '../EmptyState';
|
||||
import { ErrorState } from '../ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { DataTable, DataTableFooter, Pill, SearchField } from '@/components/ds';
|
||||
import { DataTable, DataTableFooter, Pill } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -17,10 +16,11 @@ import { Input } from '@/components/ui/input';
|
||||
import { HardDrive, Trash2 } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
useServer,
|
||||
normalizeListResponse,
|
||||
useServer, normalizeListResponse,
|
||||
} from './dockerHelpers';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
export const CreateVolumeButton = () => {
|
||||
const { t } = useTranslation();
|
||||
@@ -28,13 +28,14 @@ export const CreateVolumeButton = () => {
|
||||
const { isRemote } = useServer();
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
<PagePrimaryButton
|
||||
id="docker-create-volume"
|
||||
label={t('app.volumesTab.createVolume', 'Create volume')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setShowModal(true)}
|
||||
disabled={isRemote}
|
||||
title={isRemote ? t('app.volumesTab.creatingVolumesIsOnlyAvailableOn', 'Creating volumes is only available on the panel server right now') : t('app.volumesTab.createVolume', 'Create volume')}
|
||||
>
|
||||
<span>+</span> {t('app.volumesTab.createVolume2', 'Create volume')}
|
||||
</Button>
|
||||
disabledReason={isRemote ? t('app.volumesTab.creatingVolumesIsOnlyAvailableOn', 'Creating volumes is only available on the panel server right now') : undefined}
|
||||
/>
|
||||
{showModal && <CreateVolumeModal onClose={() => setShowModal(false)} onCreated={() => window.location.reload()} />}
|
||||
</>
|
||||
);
|
||||
@@ -110,6 +111,13 @@ const VolumesTab = ({ onStatsChange }) => {
|
||||
const [volumes, setVolumes] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
// The Docker page's top bar: this tab's create button and search, after the page-wide
|
||||
// buttons. Filters and the table tools are in the view selector's menu.
|
||||
useListTopbar(() => ({
|
||||
primary: <CreateVolumeButton />,
|
||||
search: { value: searchTerm, onSearch: setSearchTerm, placeholder: t('app.volumesTab.searchVolumes', 'Search volumes…') },
|
||||
}), [searchTerm]);
|
||||
const { sorts, setSorts } = useTableSort({
|
||||
defaultSorts: [{ key: 'name', direction: 'asc' }],
|
||||
storageKey: 'serverkit-table-docker-volumes-sort',
|
||||
@@ -302,23 +310,9 @@ const VolumesTab = ({ onStatsChange }) => {
|
||||
return (
|
||||
<div className="dx-tab-pane dx-list-pane">
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadVolumes }}
|
||||
label="volumes"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
value={searchTerm}
|
||||
onSearch={setSearchTerm}
|
||||
placeholder={t('app.volumesTab.filterNameOrMountpoint', 'Filter name or mountpoint…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadVolumes} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { SearchField } from './SearchField';
|
||||
|
||||
// The top-bar controls of a list page, in the one order every page uses:
|
||||
//
|
||||
// [secondary …] [primary] [search]
|
||||
//
|
||||
// secondary buttons that reload or import (Sync, Import) — outline, small
|
||||
// primary the page's create button, a <PagePrimaryButton>
|
||||
// search { value, onSearch, placeholder } for the page's search box
|
||||
//
|
||||
// Nothing else belongs in the bar. Filters, fields, export and page extras
|
||||
// live in the view selector's menu (GridViewPicker `filters` / `tools` /
|
||||
// `extra`), so the create button and the search box sit in the same place on
|
||||
// every page. Publish it with useListTopbar; a page that owns its own bar
|
||||
// (PageLayout) passes <ListActions … /> as `actions`.
|
||||
export function ListActions({ secondary, primary, search }) {
|
||||
return (
|
||||
<>
|
||||
{secondary}
|
||||
{primary}
|
||||
{search && <SearchField {...search} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ListActions;
|
||||
@@ -14,9 +14,9 @@ import { cn } from '@/lib/utils';
|
||||
// {/* optional extras between filters and the right group (e.g. a select) */}
|
||||
// </ListToolbar>
|
||||
//
|
||||
// Placement rule (see AGENTS.md "Page anatomy"): a table gets ONE row of chrome
|
||||
// — the GridViewPicker line — carrying search, the filter button and the "⋮",
|
||||
// either inline or hoisted into the shared topbar (useTopbarChrome). This
|
||||
// Placement rule (scripts/check-list-chrome.mjs): a table gets ONE row of
|
||||
// chrome — the GridViewPicker line. Filters, fields and the table tools are
|
||||
// entries in that selector's menu; search rides the page's top bar. This
|
||||
// toolbar is for what is left: a quick-filter segment, a scope select, a
|
||||
// checkbox. A page with none of those renders no toolbar at all.
|
||||
//
|
||||
|
||||
@@ -16,20 +16,18 @@ import { GridToolsPanel } from './GridToolsMenu';
|
||||
// /api/v1/views by useTableViews. A modified view shows an asterisk plus an
|
||||
// inline Save / Reset strip, so tweaking a built-in never silently destroys it.
|
||||
//
|
||||
// `actions` is the table's own chrome — search, the filter button and the "⋮".
|
||||
// They belong on the SAME line as the view name, and this is the ONLY row of
|
||||
// chrome a table gets. A page that owns a top bar hoists that same node up
|
||||
// there instead (see useTopbarChrome) and passes nothing here; an inner or sub
|
||||
// table, which has no top bar of its own, passes it and keeps it inline.
|
||||
//
|
||||
// A page can instead fold the table's controls INTO this menu, so the page has
|
||||
// one place for "what am I looking at and what can I do with it" and its top
|
||||
// bar keeps only the actions that create or reload things:
|
||||
// The table's controls are folded INTO this menu, so a page has one place for
|
||||
// "what am I looking at and what can I do with it" and its top bar keeps only
|
||||
// the actions that create or reload things, plus search. Spread
|
||||
// `chrome.pickerProps` (useTableChrome) to get all of it:
|
||||
//
|
||||
// filters { count, hidden, onOpen } opens the filters and fields drawer
|
||||
// tools the GridToolsMenu props copy link, export, reset…
|
||||
// extra [{ icon, label, onSelect }] page-specific entries (Manage groups)
|
||||
//
|
||||
// `actions` is what is left for the view row itself: an inner table's own
|
||||
// search box or a scope toggle. Never a filter icon or a "⋮".
|
||||
//
|
||||
// There is deliberately no row count. It was rendered twice on every page that
|
||||
// also had a toolbar underneath — once next to the view name, once on the right
|
||||
// of the second bar — and the footer already says how many rows there are,
|
||||
|
||||
@@ -21,7 +21,7 @@ const NO_FILTERS = { match: 'all', rules: [] };
|
||||
* applyPage: (p) => { setFilter(p.filter); setSearch(p.search); },
|
||||
* });
|
||||
*
|
||||
* <GridViewPicker views={chrome.views} … />
|
||||
* <GridViewPicker {...chrome.pickerProps} />
|
||||
* <GridChips {...chrome.chipProps} />
|
||||
* <DataTable {…chrome.tableProps} columns={chrome.columns} … />
|
||||
* <GridFilterDrawer {...chrome.drawerProps} />
|
||||
@@ -165,6 +165,26 @@ export function useTableChrome({
|
||||
[rows, filters, orderedColumns],
|
||||
);
|
||||
|
||||
const openDrawer = useCallback(() => setDrawerOpen(true), []);
|
||||
|
||||
// Optional fields the table is not showing: what "Filters and fields" in
|
||||
// the view selector offers to bring back.
|
||||
const hiddenFieldCount = useMemo(
|
||||
() => orderedColumns.filter((c) => c.header && hiddenKeys.includes(c.key)).length,
|
||||
[orderedColumns, hiddenKeys],
|
||||
);
|
||||
|
||||
const toolsProps = {
|
||||
cfg,
|
||||
columns: orderedColumns,
|
||||
rows,
|
||||
viewName: views.activeView?.name || noun,
|
||||
noun,
|
||||
onReset: api.resetToView,
|
||||
onCopyLink: copyLink,
|
||||
showDensity: false,
|
||||
};
|
||||
|
||||
return {
|
||||
cfg,
|
||||
api,
|
||||
@@ -206,15 +226,19 @@ export function useTableChrome({
|
||||
showRowDetail: false,
|
||||
showDensity: false,
|
||||
},
|
||||
toolsProps: {
|
||||
cfg,
|
||||
columns: orderedColumns,
|
||||
rows,
|
||||
viewName: views.activeView?.name || noun,
|
||||
noun,
|
||||
onReset: api.resetToView,
|
||||
onCopyLink: copyLink,
|
||||
showDensity: false,
|
||||
toolsProps,
|
||||
// The view selector with the table's controls folded into its menu:
|
||||
// <GridViewPicker {...chrome.pickerProps} />
|
||||
// A list table has no filter icon and no "⋮" of its own; see
|
||||
// scripts/check-list-chrome.mjs. Extend `tools` for a table that can
|
||||
// refresh or export a selection:
|
||||
// tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
pickerProps: {
|
||||
views,
|
||||
label: noun,
|
||||
onCreate: createView,
|
||||
filters: { count: filters.rules.length, hidden: hiddenFieldCount, onOpen: openDrawer },
|
||||
tools: toolsProps,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ export { CatalogCard, CatalogGrid } from './CatalogCard';
|
||||
export { SortChipBar } from './SortChipBar';
|
||||
export { DataTableFooter } from './DataTableFooter';
|
||||
export { ListToolbar } from './ListToolbar';
|
||||
export { ListActions } from './ListActions';
|
||||
|
||||
// DEPRECATED toolbar menus — ZERO render sites left in the app.
|
||||
//
|
||||
|
||||
@@ -3,15 +3,13 @@ import { Search, Rows3, LayoutGrid } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { SegControl, DataTableFooter, ListToolbar } from '@/components/ds';
|
||||
import {
|
||||
GridViewPicker, GridChips, GridFilterButton, GridToolsMenu, GridFilterDrawer, GridBulkBar,
|
||||
useTableChrome,
|
||||
GridViewPicker, GridChips, GridFilterButton, GridToolsMenu, GridFilterDrawer, GridBulkBar, useTableChrome,
|
||||
} from '@/components/ds/grid';
|
||||
import EmptyState from '../EmptyState';
|
||||
import ErrorState from '../ErrorState';
|
||||
import DataTable from '@/components/ds/DataTable';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import { useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button as SharedButton } from '@/components/ui/button';
|
||||
|
||||
@@ -113,13 +111,12 @@ export default function ResourceListPage({
|
||||
error = null,
|
||||
errorTitle,
|
||||
onRetry,
|
||||
// Where the table's chrome (filter · "⋮") goes. `true` publishes it into the
|
||||
// enclosing tab group's top bar, on the same line as the page's actions and
|
||||
// search — the shape every top-level list page has. Set it false for a
|
||||
// table nested inside a page that owns that bar already (a tab's inner
|
||||
// table), and the chrome renders in the view row instead. Outside a tab
|
||||
// group it falls back to the view row on its own.
|
||||
chromeInTopbar = true,
|
||||
// DEPRECATED, ignored. It used to pick between the top bar and the view row
|
||||
// for the filter button and the "⋮". Both now live in the view selector's
|
||||
// menu, wherever the table is. Accepted because this component is SDK
|
||||
// surface; remove on the next SDK major.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
chromeInTopbar,
|
||||
// Opt-in card view: pass a renderer and the chrome grows a list/cards
|
||||
// switch. Pages that omit it are table-only exactly as before.
|
||||
//
|
||||
@@ -247,27 +244,27 @@ export default function ResourceListPage({
|
||||
});
|
||||
|
||||
const orderedColumns = chrome.columns;
|
||||
const tableViews = chrome.views;
|
||||
|
||||
// The table's own chrome, built once and rendered in exactly ONE place:
|
||||
// hoisted into the tab group's top bar next to the page's actions, or — for
|
||||
// an inner table, or a page reused outside a tab group — in the view row.
|
||||
// It used to be a second toolbar under the view row on every page, which
|
||||
// for most of them was an otherwise empty bar holding two icons.
|
||||
const chromeNode = (
|
||||
// The table's controls. With a view selector (every core page) the filter
|
||||
// drawer and the tools are entries in its menu, so the page has no filter
|
||||
// icon and no "⋮". A table with no saved views has no selector to hold
|
||||
// them, and keeps the two icons on a bar of its own.
|
||||
const hasPicker = !!viewPageKey && view === 'list';
|
||||
const toolsProps = {
|
||||
...chrome.toolsProps,
|
||||
selectedRows: selectable && selectedIds
|
||||
? items.filter((i) => selectedIds.has(i[keyField]))
|
||||
: [],
|
||||
};
|
||||
const inlineChrome = (
|
||||
<>
|
||||
{view === 'list' && (
|
||||
{view === 'list' && !hasPicker && (
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu
|
||||
{...chrome.toolsProps}
|
||||
selectedRows={selectable && selectedIds
|
||||
? items.filter((i) => selectedIds.has(i[keyField]))
|
||||
: []}
|
||||
/>
|
||||
<GridToolsMenu {...toolsProps} />
|
||||
</>
|
||||
)}
|
||||
{renderCard && (
|
||||
@@ -290,23 +287,11 @@ export default function ResourceListPage({
|
||||
</>
|
||||
);
|
||||
|
||||
// Nothing to host while the page is empty or still loading — the chrome
|
||||
// acts on a table that isn't there.
|
||||
// A refetch over existing rows keeps the chrome (and the search box's focus).
|
||||
const hasTable = resolvedTotal > 0;
|
||||
const { hosted: chromeHoisted, portal: chromePortal } = useTopbarChrome(
|
||||
chromeNode,
|
||||
{ enabled: chromeInTopbar && hasTable },
|
||||
);
|
||||
|
||||
// Where the chrome lands when the top bar didn't take it: the view row if
|
||||
// there is one, otherwise a bar of its own.
|
||||
const hasPicker = !!viewPageKey && view === 'list';
|
||||
const inlineChrome = chromeHoisted ? null : chromeNode;
|
||||
const hasInlineChrome = !hasPicker || !!renderCard;
|
||||
|
||||
// The quick-filter segment and any page extras still need a bar of their
|
||||
// own; pages that have neither get no second row at all.
|
||||
const hasToolbar = !!filters || !!toolbarExtra || (onSearchChange && !searchInTopbar);
|
||||
const hasToolbar = !!filters || !!toolbarExtra || (onSearchChange && !searchInTopbar) || hasInlineChrome;
|
||||
|
||||
// Paged AFTER the column rules, not before. Slicing `items` meant a page
|
||||
// size of 25 took 25 unfiltered rows and THEN filtered them, so "show 25"
|
||||
@@ -328,7 +313,6 @@ export default function ResourceListPage({
|
||||
// card grid when the page opted into one.
|
||||
return (
|
||||
<div className={cn('sk-tabgroup__inner', className)}>
|
||||
{chromePortal}
|
||||
<EmptyState
|
||||
loading
|
||||
loadingVariant={renderCard && view === 'cards' ? 'cards' : 'table'}
|
||||
@@ -340,7 +324,6 @@ export default function ResourceListPage({
|
||||
|
||||
return (
|
||||
<div className={cn('sk-tabgroup__inner', className)}>
|
||||
{chromePortal}
|
||||
{header}
|
||||
{error && resolvedTotal > 0 && (
|
||||
<ErrorState compact error={errorObj} onRetry={onRetry} />
|
||||
@@ -362,19 +345,15 @@ export default function ResourceListPage({
|
||||
) : (
|
||||
<div className="wp-list">
|
||||
{/* The saved view names what you are looking at, so it is the
|
||||
page's heading rather than another toolbar button. Sort,
|
||||
Group and Columns are gone from the toolbar entirely —
|
||||
they live in each column's own "⋮" now, next to the
|
||||
page's heading rather than another toolbar button, and
|
||||
its menu holds the table's controls: filters and
|
||||
fields, copy link, export, reset. Sort, Group and
|
||||
Columns live in each column's own "⋮", next to the
|
||||
column they act on. */}
|
||||
{hasPicker && (
|
||||
<GridViewPicker
|
||||
views={tableViews}
|
||||
label={noun}
|
||||
onCreate={chrome.createView}
|
||||
actions={inlineChrome}
|
||||
/>
|
||||
<GridViewPicker {...chrome.pickerProps} tools={toolsProps} />
|
||||
)}
|
||||
{(hasToolbar || (inlineChrome && !hasPicker)) && (
|
||||
{hasToolbar && (
|
||||
<ListToolbar
|
||||
filters={filters && (
|
||||
<SegControl
|
||||
@@ -383,7 +362,7 @@ export default function ResourceListPage({
|
||||
options={filters}
|
||||
/>
|
||||
)}
|
||||
tools={hasPicker ? undefined : inlineChrome}
|
||||
tools={hasInlineChrome ? inlineChrome : undefined}
|
||||
>
|
||||
{onSearchChange && !searchInTopbar && (
|
||||
<div className="wp-list__search">
|
||||
|
||||
@@ -14,8 +14,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { DataTable, DataTableFooter, ListToolbar, Pill, SegControl } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer, applyFilters,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer, applyFilters,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -552,18 +551,9 @@ const FirewallTab = () => {
|
||||
"Firewall Rules" <h3> would title the same table
|
||||
twice, and the segment above already says Rules. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadData }}
|
||||
label="rules"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
{/* The toolbar survives only because Add Rule needs a
|
||||
home: this tab is nested, so there is no top bar
|
||||
|
||||
@@ -10,8 +10,7 @@ import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer, applyFilters,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer, applyFilters,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -264,20 +263,11 @@ const IPListsTab = () => {
|
||||
is inside that name, since the pair sits side by side and
|
||||
used to be told apart by this line alone. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadLists }}
|
||||
label={listType === 'allowlist'
|
||||
? t('app.iPListsTab.allowlistEntries', 'Allowlist entries')
|
||||
: t('app.iPListsTab.blocklistEntries', 'Blocklist entries')}
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadLists} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
<div className="sec-tableactions">
|
||||
<Button variant="default" size="sm" onClick={() => setShowAddModal(listType)}>
|
||||
|
||||
@@ -6,8 +6,7 @@ import EmptyState from '@/components/EmptyState';
|
||||
import ErrorState from '@/components/ErrorState';
|
||||
import { DataTable, DataTableFooter, ListToolbar } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer, applyFilters,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer, applyFilters,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -380,18 +379,9 @@ const IntegrityTab = () => {
|
||||
{isOpen && (
|
||||
<>
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="changes"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
<GridChips {...chrome.chipProps} />
|
||||
</>
|
||||
|
||||
@@ -12,8 +12,7 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { DataTable, DataTableFooter, ListToolbar } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer, applyFilters,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer, applyFilters,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -212,18 +211,9 @@ const SSHKeysTab = () => {
|
||||
because it acts on the file, not on what you are looking at.
|
||||
Refresh is gone from it — it is in the "⋮". */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadKeys }}
|
||||
label="keys"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadKeys} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
<ListToolbar>
|
||||
<Button variant="default" size="sm" onClick={() => setShowAddModal(true)}>
|
||||
|
||||
@@ -7,8 +7,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { DataTable, DataTableFooter, Pill } from '../ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -21,8 +20,7 @@ import DomainField from '@/components/DomainField';
|
||||
import { rooms } from '@/constants/events';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
OfflineIcon,
|
||||
TrashIcon,
|
||||
OfflineIcon, TrashIcon,
|
||||
} from './serverDetailShared';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { formatDateTime } from '@/utils/intl';
|
||||
@@ -463,18 +461,9 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
|
||||
the filter button and "⋮" ride it rather than a
|
||||
second bar that would hold nothing else. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadTunnels }}
|
||||
label="tunnels"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadTunnels} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -8,8 +8,7 @@ import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { DataTable, DataTableFooter, Pill } from '../ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -20,17 +19,10 @@ import Modal from '@/components/Modal';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import {
|
||||
OfflineIcon,
|
||||
StopIcon,
|
||||
PlayIcon,
|
||||
TrashIcon,
|
||||
OfflineIcon, StopIcon, PlayIcon, TrashIcon,
|
||||
} from './serverDetailShared';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
|
||||
@@ -353,18 +345,9 @@ const CronTab = ({ serverId, serverStatus }) => {
|
||||
filter button and "⋮" ride it rather than a second bar
|
||||
that would hold nothing else. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadJobs }}
|
||||
label="jobs"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadJobs} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -5,8 +5,7 @@ import { useConfirm } from '@/hooks/useConfirm';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Pill, Drawer, DataTable, DataTableFooter, ListToolbar, SearchField, serviceStatusKind } from '../ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -417,9 +416,9 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {
|
||||
keeps only what belongs to systemd rather than to the table —
|
||||
and not Refresh, which is "Refresh data" in the "⋮". */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadUnits }}
|
||||
label="units"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -427,11 +426,6 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.servicesTab.filterByUnitName', 'Filter by unit name…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadUnits} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -3,8 +3,7 @@ import { History } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DataTable, DataTableFooter, Drawer, Pill, SearchField, statusKind, envActionKind } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -332,9 +331,9 @@ const EventsTab = ({ appId }) => {
|
||||
than being hoisted (see useTopbarChrome). Refresh is not
|
||||
repeated as a button — it is in the "⋮". */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: refresh }}
|
||||
label="events"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -342,11 +341,6 @@ const EventsTab = ({ appId }) => {
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.eventsTab.searchActivity', 'Search activity…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={refresh} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -5,8 +5,7 @@ import useSettingFocus from '../../hooks/useSettingFocus';
|
||||
import ApiKeyModal from './ApiKeyModal';
|
||||
import WebhookSubscriptionModal from './WebhookSubscriptionModal';
|
||||
import {
|
||||
Key, Plus, Trash2, RotateCcw, Activity, AlertCircle,
|
||||
Check, Send, ChevronDown, ChevronUp, Zap, BarChart3, RefreshCw
|
||||
Key, Plus, Trash2, RotateCcw, Activity, AlertCircle, Check, Send, ChevronDown, ChevronUp, Zap, BarChart3, RefreshCw,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -15,8 +14,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Pill } from '@/components/ds/Pill';
|
||||
import { DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -314,19 +312,14 @@ const ApiKeysSection = () => {
|
||||
return (
|
||||
<div {...register('api-keys', 'settings-card')}>
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadKeys }}
|
||||
label="keys"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<Button variant="default" size="sm" onClick={() => setShowModal(true)}>
|
||||
<Plus size={14} /> {t('app.apiSettingsTab.createKey', 'New key')}
|
||||
</Button>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadKeys} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -5,8 +5,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { DataTable } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -298,9 +297,9 @@ const InvitationsTab = () => {
|
||||
{/* The view name replaces the old "Invitations" h4: it names the
|
||||
section AND says which slice of it you are looking at. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadInvitations }}
|
||||
label="invitations"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
{/* Same shape as the users table above it — the two sit
|
||||
@@ -315,11 +314,6 @@ const InvitationsTab = () => {
|
||||
</svg>
|
||||
{t('app.invitationsTab.inviteUser', 'Invite user')}
|
||||
</Button>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadInvitations} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -4,8 +4,7 @@ import { Database, Loader, CheckCircle, ArrowUpCircle, ShieldCheck } from 'lucid
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { DataTable } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -314,18 +313,9 @@ const MigrationHistoryTab = () => {
|
||||
banner as well as the table, so the picker sits with
|
||||
the table it actually belongs to. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="migrations"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -8,8 +8,7 @@ import EmptyState from '@/components/EmptyState';
|
||||
import ErrorState from '@/components/ErrorState';
|
||||
import { Pill, DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -253,18 +252,9 @@ export default function RecycleBinTab() {
|
||||
<>
|
||||
{loadError && <ErrorState compact error={loadError} onRetry={load} />}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="items"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -10,8 +10,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { DataTable } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -426,9 +425,9 @@ const UsersTab = () => {
|
||||
what the tab strip already said, and stacking it above the
|
||||
picker would have been two titles for one table. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadUsers }}
|
||||
label="users"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
{/* Add User rides the chrome line rather than a bar of
|
||||
@@ -442,11 +441,6 @@ const UsersTab = () => {
|
||||
</svg>
|
||||
{t('app.usersTab.addUser', 'New user')}
|
||||
</Button>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadUsers} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -2,8 +2,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { Box, Globe, Plus } from 'lucide-react';
|
||||
import { ServiceTile, Pill, DataTable, DataTableFooter, serviceStatusKind } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -128,18 +127,8 @@ const WorkspaceApplicationsTab = ({ kind, wsId, rows, appsOut, onMoveApp, onShar
|
||||
{/* Inline chrome, not hoisted: this is a tab inside a detail page
|
||||
that already owns the top bar, so hoisting would hijack it. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
label={kind}
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Plus } from 'lucide-react';
|
||||
import { ServiceTile, Pill, DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -120,18 +119,8 @@ const WorkspaceMembersTab = ({ members, allUsers, onAddMember, onRemoveMember, l
|
||||
{/* Inline chrome, not hoisted: this is a tab inside a detail page
|
||||
that already owns the top bar, so hoisting would hijack it. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
label="members"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -2,8 +2,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { Server, Plus } from 'lucide-react';
|
||||
import { ServiceTile, Pill, DataTable, DataTableFooter } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -125,18 +124,8 @@ const WorkspaceServersTab = ({ wsId, srvIn, srvOut, onMoveServer, loadError, onR
|
||||
{/* Inline chrome, not hoisted: this is a tab inside a detail page
|
||||
that already owns the top bar, so hoisting would hijack it. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
label="servers"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
import { useEffect } from 'react';
|
||||
import { createContext, createElement, useContext, useEffect } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useOutletContext } from 'react-router-dom';
|
||||
import { ListActions } from '@/components/ds/ListActions';
|
||||
|
||||
// The top bar a page's sections publish into when the page owns its own bar
|
||||
// (PageLayout) instead of sharing a tab group's. PageLayout provides it, so a
|
||||
// tab component inside a standalone page — a Docker tab, say — publishes its
|
||||
// create button and search exactly the way a tab-group page does.
|
||||
export const PageTopbarContext = createContext(null);
|
||||
|
||||
// The nearest bar wins: a PageLayout around the caller, else the tab group.
|
||||
function useTopbarHost() {
|
||||
const page = useContext(PageTopbarContext);
|
||||
const group = useOutletContext();
|
||||
return page || group;
|
||||
}
|
||||
|
||||
// Publish a page's top-bar actions into the enclosing TabGroupLayout header.
|
||||
// Pages in a tab group render no PageTopbar of their own, so the shared layout
|
||||
@@ -14,7 +28,7 @@ import { useOutletContext } from 'react-router-dom';
|
||||
// [loading, isAdmin]); the node/thunk itself is intentionally not a dependency.
|
||||
// No-op when rendered outside a tab group (e.g. a page reused as a plain route).
|
||||
export function useTopbarActions(actions, deps = []) {
|
||||
const ctx = useOutletContext();
|
||||
const ctx = useTopbarHost();
|
||||
const setTopbarActions = ctx?.setTopbarActions;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -32,8 +46,28 @@ export function useTopbarActions(actions, deps = []) {
|
||||
}, [setTopbarActions]);
|
||||
}
|
||||
|
||||
// The SECOND top-bar slot: a table's own chrome — search, the filter button and
|
||||
// the "⋮". It is separate from useTopbarActions because the two are published
|
||||
// A list page's top bar, in the one fixed order: secondary buttons, the create
|
||||
// button, then search (see ds/ListActions). Pass a thunk returning
|
||||
// `{ secondary, primary, search }` — same reason as above — and the reactive
|
||||
// values it reads as `deps`:
|
||||
//
|
||||
// useListTopbar(() => ({
|
||||
// secondary: <Button variant="outline" size="sm" onClick={load}>Sync</Button>,
|
||||
// primary: <PagePrimaryButton id="servers-add" label="Add server" onClick={open} />,
|
||||
// search: { value: q, onSearch: setQ, placeholder: 'Search servers…' },
|
||||
// }), [q]);
|
||||
export function useListTopbar(spec, deps = []) {
|
||||
useTopbarActions(
|
||||
() => createElement(ListActions, typeof spec === 'function' ? spec() : spec),
|
||||
deps,
|
||||
);
|
||||
}
|
||||
|
||||
// The SECOND top-bar slot, for a workspace's own controls (the file manager's
|
||||
// view switch). List tables do NOT use it: their filter and tools live in the
|
||||
// view selector's menu (GridViewPicker `filters` / `tools`), and
|
||||
// scripts/check-list-chrome.mjs fails a table that hoists them here.
|
||||
// It is separate from useTopbarActions because the two are published
|
||||
// by different owners at different times. A page's actions ("Add domain") are
|
||||
// the page's; the chrome belongs to whichever table is on it, which may be a
|
||||
// shared wrapper like ResourceListPage that has no business overwriting what
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { PageTopbar } from '@/components/ds';
|
||||
import { PageTopbarContext } from '@/hooks/useTopbarActions';
|
||||
|
||||
// Shell for a STANDALONE page — one that owns its whole route rather than
|
||||
// living inside a PageTopbar tab group. It is the exact same frame
|
||||
@@ -17,6 +19,11 @@ import { PageTopbar } from '@/components/ds';
|
||||
// sidebar's surface and a bottom border precisely because it is meant to be
|
||||
// chrome pinned to the frame, not the first row of the page body.
|
||||
//
|
||||
// Sections inside the page can publish into its bar with useListTopbar /
|
||||
// useTopbarActions, the same way a tab-group page does: what they publish
|
||||
// renders after `actions`, so a page-wide button (Prune) stays put while the
|
||||
// create button and search follow the active section.
|
||||
//
|
||||
// `fill` hands the body the whole region to manage its own scrolling (log
|
||||
// consoles, file trees, terminals); the default centers and pads it.
|
||||
export default function PageLayout({
|
||||
@@ -32,7 +39,12 @@ export default function PageLayout({
|
||||
contentClassName,
|
||||
children,
|
||||
}) {
|
||||
const [published, setPublished] = useState(null);
|
||||
const host = useMemo(() => ({ setTopbarActions: setPublished }), []);
|
||||
const barActions = actions || published ? <>{actions}{published}</> : null;
|
||||
|
||||
return (
|
||||
<PageTopbarContext.Provider value={host}>
|
||||
<div className={cn('page-container page-container--full-bleed sk-pageshell', className)}>
|
||||
<PageTopbar
|
||||
className={topbarClassName}
|
||||
@@ -41,7 +53,7 @@ export default function PageLayout({
|
||||
meta={meta}
|
||||
tabs={tabs}
|
||||
navLabel={navLabel}
|
||||
actions={actions}
|
||||
actions={barActions}
|
||||
/>
|
||||
<div className="sk-pageshell__content">
|
||||
{fill ? (
|
||||
@@ -51,5 +63,6 @@ export default function PageLayout({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</PageTopbarContext.Provider>
|
||||
);
|
||||
}
|
||||
@@ -20,8 +20,7 @@ import {
|
||||
Pill, SearchField, SegControl, DataTable, DataTableFooter,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import BackupStorageNotice from '../components/backups/BackupStorageNotice';
|
||||
import BackupsOverview from '../components/backups/BackupsOverview';
|
||||
@@ -31,7 +30,7 @@ import { useBackupSchedules } from '../hooks/useBackupSchedules';
|
||||
import StorageDestinations from '../components/backups/StorageDestinations';
|
||||
import { useManagedProfile } from '../contexts/useManagedProfile';
|
||||
import ManagedCard from '../components/ManagedCard';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -730,20 +729,10 @@ const Backups = () => {
|
||||
// The chrome acts on the snapshot table, so it is only published while that
|
||||
// section is on screen — the other tabs are forms and a KPI band, with
|
||||
// nothing to filter, sort or export.
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
|
||||
</>, { enabled: activeTab === 'snapshots' },
|
||||
);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="sk-tabgroup__inner backups-page">
|
||||
{topbarChrome}
|
||||
<EmptyState loading loadingVariant="table" size="lg" title={t('app.backups.loadingBackupData', 'Loading backup data…')} />
|
||||
</div>
|
||||
);
|
||||
@@ -751,7 +740,6 @@ const Backups = () => {
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner backups-page">
|
||||
{topbarChrome}
|
||||
{error && (
|
||||
<div className="alert alert-danger">
|
||||
{error}
|
||||
@@ -785,11 +773,10 @@ const Backups = () => {
|
||||
and the row count belongs to the footer, under the rows
|
||||
it is counting. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadData }}
|
||||
label="snapshots"
|
||||
onCreate={chrome.createView}
|
||||
|
||||
actions={chromeActions}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -13,11 +14,10 @@ import {
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import {
|
||||
Pill, SearchField, DataTable, Drawer, DataTableFooter,
|
||||
Pill, DataTable, Drawer, DataTableFooter, ListActions,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -432,19 +432,26 @@ const CronJobs = () => {
|
||||
icon={<Clock size={18} />}
|
||||
title={t('app.cronJobs.cronJobs', 'Cron jobs')}
|
||||
actions={(
|
||||
<>
|
||||
<Button variant="outline" size="sm" onClick={loadData}>
|
||||
<RefreshCw size={15} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
<Button size="sm" onClick={openCreateDrawer}>
|
||||
<Plus size={15} /> {t('app.cronJobs.newCronJob', 'New cron job')}
|
||||
</Button>
|
||||
<SearchField
|
||||
value={search}
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.cronJobs.searchJobsOrCommands', 'Search jobs or commands…')}
|
||||
/>
|
||||
</>
|
||||
<ListActions
|
||||
secondary={(
|
||||
<Button variant="outline" size="sm" onClick={loadData}>
|
||||
<RefreshCw size={15} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
)}
|
||||
primary={(
|
||||
<PagePrimaryButton
|
||||
id="cron-new"
|
||||
label={t('app.cronJobs.newCronJob', 'New cron job')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={openCreateDrawer}
|
||||
/>
|
||||
)}
|
||||
search={{
|
||||
value: search,
|
||||
onSearch: setSearch,
|
||||
placeholder: t('app.cronJobs.searchJobsOrCommands', 'Search jobs or commands…'),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
{error && (
|
||||
@@ -480,9 +487,9 @@ const CronJobs = () => {
|
||||
{/* No KPI strip: every number it carried is already on the
|
||||
segment you'd click to act on it (mirrors /domains). */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadData }}
|
||||
label="jobs"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
{/* The daemon's health rides with the chrome
|
||||
@@ -490,11 +497,6 @@ const CronJobs = () => {
|
||||
reason a "next run" may never happen, so it
|
||||
belongs beside the table it invalidates. */}
|
||||
{serviceNote && <span className="cron-servicenote">{serviceNote}</span>}
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { Send, Inbox } from 'lucide-react';
|
||||
import { Send, Inbox, ListFilter } from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import {
|
||||
FilterDrawer, FilterButton, DataTable, DataTableFooter,
|
||||
FilterDrawer, DataTable, DataTableFooter,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -252,16 +251,6 @@ export default function DeliveryLog() {
|
||||
icon={<Send size={18} />}
|
||||
title={t('app.deliveryLog.notificationDeliveryLog', 'Notification delivery log')}
|
||||
meta="Outbound deliveries across all channels"
|
||||
actions={(
|
||||
// Labelled "Server filters" to keep it apart from the toolbar's
|
||||
// filter icon: this one re-queries the whole table, that one
|
||||
// narrows the rows already on screen.
|
||||
<FilterButton
|
||||
label={t('app.deliveryLog.serverFilters', 'Server filters')}
|
||||
count={serverFilterCount}
|
||||
onClick={() => setFiltersOpen(true)}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<div className="sk-dlog">
|
||||
<EmailProviders />
|
||||
@@ -270,9 +259,16 @@ export default function DeliveryLog() {
|
||||
three built-in views, and the row count belongs to the
|
||||
footer, under the rows it is counting. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="deliveries"
|
||||
onCreate={chrome.createView}
|
||||
// "Server filters" re-queries the whole table; "Filters and
|
||||
// fields" above it narrows the rows already on screen.
|
||||
extra={[{
|
||||
icon: ListFilter,
|
||||
label: `${t('app.deliveryLog.serverFilters', 'Server filters')}${serverFilterCount > 0 ? ` (${serverFilterCount})` : ''}`,
|
||||
onSelect: () => setFiltersOpen(true),
|
||||
}]}
|
||||
actions={(
|
||||
<>
|
||||
{/* The chips only ever show CLIENT rules, so the
|
||||
@@ -285,11 +281,6 @@ export default function DeliveryLog() {
|
||||
<i>·</i>
|
||||
{channel === 'all' ? t('app.deliveryLog.allChannelsLower', 'all channels') : channel}
|
||||
</span>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -6,12 +6,11 @@ import Modal from '../components/Modal';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DataTable, DataTableFooter, Pill, SearchField, SegControl, statusKind } from '@/components/ds';
|
||||
import { DataTable, DataTableFooter, Pill, SegControl, statusKind } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import RequiresDocker from '../components/RequiresDocker';
|
||||
@@ -26,12 +25,7 @@ const DEPLOY_POLL_MS = 3000;
|
||||
// fetched, so this is the reach of a filter until the user asks for more.
|
||||
const PAGE = 100;
|
||||
import {
|
||||
KIND_CHIP,
|
||||
stepTicks,
|
||||
sourceRef,
|
||||
formatDuration,
|
||||
relativeTime,
|
||||
activityGroup,
|
||||
KIND_CHIP, stepTicks, sourceRef, formatDuration, relativeTime, activityGroup,
|
||||
} from '../utils/deployActivity';
|
||||
|
||||
// Built-in saved views. These replace the segmented All/Running/Succeeded/Failed
|
||||
@@ -320,56 +314,43 @@ const Deployments = () => {
|
||||
setGroupBy,
|
||||
});
|
||||
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<>
|
||||
<SearchField
|
||||
value={search}
|
||||
onSearch={setSearch}
|
||||
placeholder={t('app.deployments.searchDeploys', 'Search deploys…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadJobs} />
|
||||
</>,
|
||||
);
|
||||
|
||||
useTopbarActions(() =>
|
||||
<>
|
||||
{/* No "New service" button here: unlike the design mock, this tab
|
||||
group already carries a New Service tab, and a second entry
|
||||
point crowded the strip into overflow. No Refresh button
|
||||
either — the chrome's "⋮" owns "Refresh data" on every page. */}
|
||||
{simInfo?.enabled && (
|
||||
<Button variant="outline" size="sm" onClick={() => setSimOpen(true)}>
|
||||
<FlaskConical size={16} />
|
||||
{t('app.deployments.testDeployment', 'Test deployment')}
|
||||
// No create button: this tab group already carries a New service tab.
|
||||
// Refresh is in the view selector's menu with the other table tools.
|
||||
useListTopbar(() => ({
|
||||
secondary: (
|
||||
<>
|
||||
{simInfo?.enabled && (
|
||||
<Button variant="outline" size="sm" onClick={() => setSimOpen(true)}>
|
||||
<FlaskConical size={16} />
|
||||
{t('app.deployments.testDeployment', 'Test deployment')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
aria-pressed={autoRefresh}
|
||||
onClick={() => setAutoRefresh((v) => !v)}
|
||||
title={t('app.deployments.autoRefreshEvery3s', 'Auto-refresh every 3s')}
|
||||
>
|
||||
<RefreshCw size={16} className={autoRefresh ? 'spin' : ''} />
|
||||
{autoRefresh ? t('app.deployments.live', 'Live') : t('app.deployments.paused', 'Paused')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant={autoRefresh ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
onClick={() => setAutoRefresh((v) => !v)}
|
||||
title={t('app.deployments.autoRefreshEvery3s', 'Auto-refresh every 3s')}
|
||||
>
|
||||
<RefreshCw size={16} className={autoRefresh ? 'spin' : ''} />
|
||||
{autoRefresh ? t('app.deployments.live', 'Live') : t('app.deployments.paused', 'Paused')}
|
||||
</Button>
|
||||
</>,
|
||||
[autoRefresh, simInfo?.enabled]
|
||||
);
|
||||
</>
|
||||
),
|
||||
search: {
|
||||
value: search,
|
||||
onSearch: setSearch,
|
||||
placeholder: t('app.deployments.searchDeploys', 'Search deploys…'),
|
||||
},
|
||||
}), [autoRefresh, simInfo?.enabled, search]);
|
||||
|
||||
return (
|
||||
<RequiresDocker what="Deployments">
|
||||
<div className="sk-tabgroup__inner deployments-page">
|
||||
{topbarChrome}
|
||||
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadJobs }}
|
||||
label="deploys"
|
||||
onCreate={chrome.createView}
|
||||
actions={chromeActions}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
+18
-111
@@ -3,7 +3,6 @@ import useTabParam from '../hooks/useTabParam';
|
||||
import api from '../services/api';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { MetricCard, KpiBand } from '@/components/ds';
|
||||
import ServerPicker from '../components/ServerPicker';
|
||||
import PageLayout from '@/layouts/PageLayout';
|
||||
import { Box, Boxes, ChevronDown, Download, Power, RefreshCw, UserCheck, Layers, HardDrive, Network as NetworkIcon, Package } from 'lucide-react';
|
||||
@@ -11,13 +10,12 @@ import {
|
||||
ServerContext,
|
||||
VALID_TABS,
|
||||
LOCAL_DOCKER_TARGET,
|
||||
normalizeListResponse,
|
||||
} from '../components/docker/dockerHelpers';
|
||||
import ContainersTab, { RunContainerButton } from '../components/docker/ContainersTab';
|
||||
import ContainersTab from '../components/docker/ContainersTab';
|
||||
import ComposeTab from '../components/docker/ComposeTab';
|
||||
import ImagesTab, { PullImageButton } from '../components/docker/ImagesTab';
|
||||
import NetworksTab, { CreateNetworkButton } from '../components/docker/NetworksTab';
|
||||
import VolumesTab, { CreateVolumeButton } from '../components/docker/VolumesTab';
|
||||
import ImagesTab from '../components/docker/ImagesTab';
|
||||
import NetworksTab from '../components/docker/NetworksTab';
|
||||
import VolumesTab from '../components/docker/VolumesTab';
|
||||
import PruneButton from '../components/docker/PruneButton';
|
||||
import RequiresDocker from '../components/RequiresDocker';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -30,13 +28,6 @@ const Docker = () => {
|
||||
const [retrying, setRetrying] = useState(false);
|
||||
const [selectedServer, setSelectedServer] = useState(LOCAL_DOCKER_TARGET);
|
||||
const [availableServers, setAvailableServers] = useState([LOCAL_DOCKER_TARGET]);
|
||||
const [stats, setStats] = useState({
|
||||
containers: { total: 0, running: 0, stopped: 0 },
|
||||
images: { total: 0, size: '0 B' },
|
||||
volumes: { total: 0 },
|
||||
networks: { total: 0 }
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
checkDockerStatus();
|
||||
}, [selectedServer]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
@@ -73,7 +64,7 @@ const Docker = () => {
|
||||
const status = await api.getDockerStatus();
|
||||
setDockerStatus(status);
|
||||
if (status.installed) {
|
||||
loadStats();
|
||||
setLoading(false);
|
||||
} else {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -82,7 +73,7 @@ const Docker = () => {
|
||||
const serverData = await api.getServer(selectedServer.id);
|
||||
if (serverData.status === 'online' || serverData.server?.status === 'online') {
|
||||
setDockerStatus({ installed: true, running: true });
|
||||
loadStats();
|
||||
setLoading(false);
|
||||
} else {
|
||||
setDockerStatus({ installed: false, error: 'Server agent is offline' });
|
||||
setLoading(false);
|
||||
@@ -100,78 +91,6 @@ const Docker = () => {
|
||||
setRetrying(false);
|
||||
}
|
||||
|
||||
async function loadStats() {
|
||||
try {
|
||||
let containersData, imagesData, volumesData, networksData;
|
||||
|
||||
if (selectedServer.id === 'local') {
|
||||
[containersData, imagesData, volumesData, networksData] = await Promise.all([
|
||||
api.getContainers(true),
|
||||
api.getImages(),
|
||||
api.getVolumes(),
|
||||
api.getNetworks()
|
||||
]);
|
||||
} else {
|
||||
[containersData, imagesData, volumesData, networksData] = await Promise.all([
|
||||
api.getRemoteContainers(selectedServer.id, true),
|
||||
api.getRemoteImages(selectedServer.id),
|
||||
api.getRemoteVolumes(selectedServer.id),
|
||||
api.getRemoteNetworks(selectedServer.id)
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
const containers = selectedServer.id === 'local'
|
||||
? containersData.containers || []
|
||||
: normalizeListResponse(containersData, 'containers');
|
||||
const images = selectedServer.id === 'local'
|
||||
? imagesData.images || []
|
||||
: normalizeListResponse(imagesData, 'images');
|
||||
const volumes = selectedServer.id === 'local'
|
||||
? volumesData.volumes || []
|
||||
: normalizeListResponse(volumesData, 'volumes');
|
||||
const networks = selectedServer.id === 'local'
|
||||
? networksData.networks || []
|
||||
: normalizeListResponse(networksData, 'networks');
|
||||
|
||||
const running = containers.filter(c => c.state === 'running').length;
|
||||
|
||||
setStats({
|
||||
containers: {
|
||||
total: containers.length,
|
||||
running,
|
||||
stopped: containers.length - running
|
||||
},
|
||||
images: {
|
||||
total: images.length,
|
||||
size: formatTotalImageSize(images)
|
||||
},
|
||||
volumes: { total: volumes.length },
|
||||
networks: { total: networks.length }
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Failed to load stats:', err);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
function formatTotalImageSize(images) {
|
||||
const sizes = images.map(img => {
|
||||
const size = img.size || '0 B';
|
||||
const match = size.match(/^([\d.]+)\s*(B|KB|MB|GB|TB)?$/i);
|
||||
if (!match) return 0;
|
||||
const [, num, unit = 'B'] = match;
|
||||
const multipliers = { B: 1, KB: 1024, MB: 1024**2, GB: 1024**3, TB: 1024**4 };
|
||||
return parseFloat(num) * (multipliers[unit.toUpperCase()] || 1);
|
||||
});
|
||||
const total = sizes.reduce((a, b) => a + b, 0);
|
||||
if (total >= 1024**3) return `${(total / 1024**3).toFixed(1)} GB`;
|
||||
if (total >= 1024**2) return `${(total / 1024**2).toFixed(1)} MB`;
|
||||
if (total >= 1024) return `${(total / 1024).toFixed(1)} KB`;
|
||||
return `${total} B`;
|
||||
}
|
||||
|
||||
const tabs = [
|
||||
{ id: 'containers', label: t('app.docker.containers', 'Containers'), icon: Box },
|
||||
{ id: 'compose', label: t('app.docker.compose', 'Compose'), icon: Package },
|
||||
@@ -182,7 +101,7 @@ const Docker = () => {
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<PageLayout className="docker-page" icon={<Box size={18} />} title={t('common.labels.docker', 'Docker')} tabs={tabs}>
|
||||
<PageLayout className="docker-page" navLabel={t('common.labels.docker', 'Docker')} tabs={tabs}>
|
||||
<EmptyState loading loadingVariant="table" title={t('app.docker.checkingDockerStatus', 'Checking Docker status…')} />
|
||||
</PageLayout>
|
||||
);
|
||||
@@ -249,8 +168,9 @@ const Docker = () => {
|
||||
className="docker-page"
|
||||
contentClassName="dx-page"
|
||||
fill
|
||||
icon={<Box size={18} />}
|
||||
title={t('common.labels.docker', 'Docker')}
|
||||
// No title: like every tab group, the tab strip is the heading and
|
||||
// the sidebar already names the section.
|
||||
navLabel={t('common.labels.docker', 'Docker')}
|
||||
tabs={tabs}
|
||||
actions={(
|
||||
<>
|
||||
@@ -266,31 +186,18 @@ const Docker = () => {
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<PruneButton onPruned={loadStats} />
|
||||
{activeTab === 'containers' && <RunContainerButton />}
|
||||
{activeTab === 'images' && <PullImageButton />}
|
||||
{activeTab === 'networks' && <CreateNetworkButton />}
|
||||
{activeTab === 'volumes' && <CreateVolumeButton />}
|
||||
{/* Page-wide. Each tab publishes its own create button and
|
||||
search after these (useListTopbar). */}
|
||||
<PruneButton />
|
||||
</>
|
||||
)}
|
||||
>
|
||||
<KpiBand>
|
||||
<MetricCard tone="accent" icon={<Box size={16} />} value={stats.containers.total} label={t('app.docker.containers', 'Containers')}>
|
||||
<div className="sk-kpi__sub"><span>{stats.containers.running} running</span></div>
|
||||
</MetricCard>
|
||||
<MetricCard tone="cyan" icon={<Layers size={16} />} value={stats.images.total} label={t('app.docker.images', 'Images')}>
|
||||
<div className="sk-kpi__sub"><span>{stats.images.size}</span></div>
|
||||
</MetricCard>
|
||||
<MetricCard tone="violet" icon={<HardDrive size={16} />} value={stats.volumes.total} label={t('app.docker.volumes', 'Volumes')} />
|
||||
<MetricCard tone="green" icon={<NetworkIcon size={16} />} value={stats.networks.total} label={t('app.docker.networks', 'Networks')} />
|
||||
</KpiBand>
|
||||
|
||||
<div className="dx-panel">
|
||||
{activeTab === 'containers' && <ContainersTab onStatsChange={loadStats} />}
|
||||
{activeTab === 'compose' && <ComposeTab onStatsChange={loadStats} />}
|
||||
{activeTab === 'images' && <ImagesTab onStatsChange={loadStats} />}
|
||||
{activeTab === 'networks' && <NetworksTab onStatsChange={loadStats} />}
|
||||
{activeTab === 'volumes' && <VolumesTab onStatsChange={loadStats} />}
|
||||
{activeTab === 'containers' && <ContainersTab />}
|
||||
{activeTab === 'compose' && <ComposeTab />}
|
||||
{activeTab === 'images' && <ImagesTab />}
|
||||
{activeTab === 'networks' && <NetworksTab />}
|
||||
{activeTab === 'volumes' && <VolumesTab />}
|
||||
</div>
|
||||
</PageLayout>
|
||||
</ServerContext.Provider>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { useState, useEffect, useCallback, useMemo, useId } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import {
|
||||
Globe, Plus, ShieldCheck, RefreshCw, Trash2, ExternalLink,
|
||||
AlertTriangle, Lock, Search, ChevronRight,
|
||||
Globe, Plus, ShieldCheck, RefreshCw, Trash2, ExternalLink, AlertTriangle, Lock, Search, ChevronRight,
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -23,13 +22,11 @@ import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { SearchField, Pill, Drawer } from '@/components/ds';
|
||||
import { Pill, Drawer } from '@/components/ds';
|
||||
import {
|
||||
DataGrid, GridViewPicker, GridChips, GridBulkBar, GridFooter,
|
||||
GridToolsMenu, GridFilterDrawer, GridFilterButton,
|
||||
useGridConfig, useGridRows, exportRows,
|
||||
DataGrid, GridViewPicker, GridChips, GridBulkBar, GridFooter, GridFilterDrawer, useGridConfig, useGridRows, exportRows,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
import { useConfirm } from '@/hooks/useConfirm';
|
||||
import useFocusParam from '@/hooks/useFocusParam';
|
||||
import RegistrarPortfolio from '../components/domains/RegistrarPortfolio';
|
||||
@@ -631,38 +628,38 @@ const Domains = () => {
|
||||
};
|
||||
|
||||
// ── top bar ──────────────────────────────────────────────
|
||||
// Fixed shape on every page: page actions, then search, then the filter
|
||||
// icon, then the overflow "⋮". The search box must not move when a page
|
||||
// adds or removes an action, so it sits AFTER the actions and before the
|
||||
// two fixed-width icon buttons.
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
// The table's tools, shown in the view selector's menu.
|
||||
const toolsProps = {
|
||||
cfg,
|
||||
columns,
|
||||
rows: view.filtered,
|
||||
selectedRows: pickedRows,
|
||||
viewName: grid.views.activeView?.name || 'domains',
|
||||
noun: 'domains',
|
||||
onRefresh: loadData,
|
||||
onReset: grid.resetToView,
|
||||
onCopyLink: grid.copyLink,
|
||||
onDensity: grid.setDensity,
|
||||
onExported: (n, fields, format) => toast.success(t('app.domains.rowsFields', '{{n}} rows · {{fields}} fields · {{value}}', { n: n, fields: fields, value: format.toUpperCase() })),
|
||||
};
|
||||
const hiddenFieldCount = columns.filter((column) => column.header && !cfg.cols.includes(column.key)).length;
|
||||
|
||||
useListTopbar(() => ({
|
||||
secondary: (
|
||||
<Button variant="outline" size="sm" onClick={loadData}>
|
||||
<RefreshCw size={15} /> {t('app.domains.checkDns', 'Check DNS')}
|
||||
</Button>
|
||||
),
|
||||
primary: (
|
||||
<PagePrimaryButton
|
||||
id="domains-add"
|
||||
label={t('app.domains.addDomain', 'Add domain')}
|
||||
shortLabel={t('common.actions.add', 'Add')}
|
||||
onClick={() => setShowAddModal(true)}
|
||||
/>
|
||||
<Button variant="outline" size="sm" onClick={loadData}>
|
||||
<RefreshCw size={15} /> {t('app.domains.checkDns', 'Check DNS')}
|
||||
</Button>
|
||||
<SearchField value={search} onSearch={setSearch} placeholder={t('app.domains.searchDomains', 'Search domains…')} />
|
||||
<GridFilterButton count={cfg.filters.rules.length} onClick={() => setFilterOpen(true)} />
|
||||
<GridToolsMenu
|
||||
cfg={cfg}
|
||||
columns={columns}
|
||||
rows={view.filtered}
|
||||
selectedRows={pickedRows}
|
||||
viewName={grid.views.activeView?.name || 'domains'}
|
||||
noun="domains"
|
||||
onRefresh={loadData}
|
||||
onReset={grid.resetToView}
|
||||
onCopyLink={grid.copyLink}
|
||||
onDensity={grid.setDensity}
|
||||
onExported={(n, fields, format) => toast.success(t('app.domains.rowsFields', '{{n}} rows · {{fields}} fields · {{value}}', { n: n, fields: fields, value: format.toUpperCase() }))}
|
||||
/>
|
||||
</>
|
||||
), [search, cfg, columns, view.filtered, pickedRows, grid.views.activeView]);
|
||||
),
|
||||
search: { value: search, onSearch: setSearch, placeholder: t('app.domains.searchDomains', 'Search domains…') },
|
||||
}), [search]);
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner domains-page">
|
||||
@@ -703,6 +700,12 @@ const Domains = () => {
|
||||
views={grid.views}
|
||||
label="domains"
|
||||
onCreate={createView}
|
||||
filters={{
|
||||
count: cfg.filters.rules.length,
|
||||
hidden: hiddenFieldCount,
|
||||
onOpen: () => setFilterOpen(true),
|
||||
}}
|
||||
tools={toolsProps}
|
||||
/>
|
||||
|
||||
<GridChips
|
||||
|
||||
@@ -10,10 +10,9 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { AlertOctagon, CheckCheck, RefreshCw, Trash2, Undo2 } from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import {
|
||||
DataTable, DataTableFooter, Drawer, ListToolbar, Pill, SearchField, SegControl,
|
||||
DataTable, DataTableFooter, Drawer, ListToolbar, Pill, SegControl,
|
||||
} from '@/components/ds';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { useConfirm } from '@/hooks/useConfirm';
|
||||
import { useAuth } from '../contexts/useAuth.js';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -22,6 +21,7 @@ import { timeAgo } from '../utils/time';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { formatDateTime } from '@/utils/intl';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
|
||||
@@ -131,17 +131,14 @@ export default function Errors() {
|
||||
|
||||
// Search + Refresh live in the group's shared top bar, the way every other
|
||||
// list page in the panel does it.
|
||||
useTopbarActions(() => {
|
||||
if (!isAdmin) return null;
|
||||
return (
|
||||
<>
|
||||
<SearchField value={q} onSearch={onSearch} placeholder={t('app.errors.searchMessagesOrTypes', 'Search messages or types…')} />
|
||||
<Button variant="outline" size="sm" onClick={refresh} disabled={loading}>
|
||||
<RefreshCw size={14} className={loading ? 'spin' : ''} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}, [isAdmin, q, loading, load, loadStats]);
|
||||
useListTopbar(() => (isAdmin ? {
|
||||
secondary: (
|
||||
<Button variant="outline" size="sm" onClick={refresh} disabled={loading}>
|
||||
<RefreshCw size={14} className={loading ? 'spin' : ''} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
),
|
||||
search: { value: q, onSearch, placeholder: t('app.errors.searchMessagesOrTypes', 'Search messages or types…') },
|
||||
} : {}), [isAdmin, q, loading, load, loadStats]);
|
||||
|
||||
// The list rows already carry the full record (traceback, context); the
|
||||
// detail call only refreshes count/resolved while the drawer is open.
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import { useCallback, useState, useEffect, useId } from 'react';
|
||||
import {
|
||||
FolderUp, UserPlus, Network, Activity, Server, Users as UsersIcon,
|
||||
Cable, KeyRound, Ban, Check, Trash2, RefreshCw, X,
|
||||
FolderUp, UserPlus, Network, Activity, Server, Users as UsersIcon, Cable, KeyRound, Ban, Check, Trash2, RefreshCw, X,
|
||||
} from 'lucide-react';
|
||||
import useTabParam from '../hooks/useTabParam';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { api } from '../services/api';
|
||||
import { DataTable, DataTableFooter, MetricCard, KpiBand, Pill, ListToolbar, SegControl } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -667,18 +665,9 @@ function FTPServer() {
|
||||
on what you are looking at; Refresh is in
|
||||
the "⋮". */}
|
||||
<GridViewPicker
|
||||
views={userChrome.views}
|
||||
{...userChrome.pickerProps}
|
||||
tools={{ ...userChrome.toolsProps, onRefresh: loadUsers }}
|
||||
label="users"
|
||||
onCreate={userChrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={userChrome.filterCount}
|
||||
onClick={() => userChrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...userChrome.toolsProps} onRefresh={loadUsers} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
<ListToolbar>
|
||||
<Button onClick={() => setShowUserModal(true)}>
|
||||
@@ -726,18 +715,9 @@ function FTPServer() {
|
||||
reachable even with nothing connected —
|
||||
the empty state is the table's now. */}
|
||||
<GridViewPicker
|
||||
views={connChrome.views}
|
||||
{...connChrome.pickerProps}
|
||||
tools={{ ...connChrome.toolsProps, onRefresh: loadConnections }}
|
||||
label="connections"
|
||||
onCreate={connChrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={connChrome.filterCount}
|
||||
onClick={() => connChrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...connChrome.toolsProps} onRefresh={loadConnections} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
<GridChips {...connChrome.chipProps} />
|
||||
|
||||
@@ -3,14 +3,12 @@ import { Link } from 'react-router-dom';
|
||||
import { AlertTriangle, Network, RefreshCw, Server as ServerIcon } from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DataTable, Pill, serviceStatusKind, statusLabel as dsStatusLabel } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import InfoTip from '../components/InfoTip';
|
||||
@@ -19,6 +17,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { t } from '../i18n/t';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { formatDateTime } from '@/utils/intl';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
// Fleet-wide reverse-proxy dashboard (Phase 4 of C6). Aggregates every
|
||||
// server's managed-proxy posture into one table: which proxy each server runs
|
||||
@@ -338,12 +337,14 @@ const FleetProxy = () => {
|
||||
}, [load]);
|
||||
|
||||
// Publish a Refresh button into the shared Servers tab-group top bar.
|
||||
useTopbarActions(() => (
|
||||
<Button size="sm" onClick={load} disabled={loading}>
|
||||
<RefreshCw size={16} className={loading ? 'animate-spin' : ''} />
|
||||
{t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
), [loading]);
|
||||
useListTopbar(() => ({
|
||||
secondary: (
|
||||
<Button variant="outline" size="sm" onClick={load} disabled={loading}>
|
||||
<RefreshCw size={16} className={loading ? 'animate-spin' : ''} />
|
||||
{t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
),
|
||||
}), [loading]);
|
||||
|
||||
// No KPI band and no page title: every tile it held was a re-count of a
|
||||
// column already on the table below, and the tab strip names the page.
|
||||
@@ -368,19 +369,9 @@ const FleetProxy = () => {
|
||||
|
||||
// Filter + "⋮" ride in the shared Servers top bar. The toolbar they used to
|
||||
// sit in held nothing else but a re-count of the table underneath it.
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner fleet-proxy">
|
||||
{topbarChrome}
|
||||
{error ? (
|
||||
<div className="fleet-proxy__error">
|
||||
<p>{error}</p>
|
||||
@@ -389,11 +380,10 @@ const FleetProxy = () => {
|
||||
) : (
|
||||
<>
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="servers"
|
||||
onCreate={chrome.createView}
|
||||
|
||||
actions={chromeActions}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -19,14 +19,13 @@ import EmptyState from '../components/EmptyState';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import { DataTable, DataTableFooter, Drawer, Pill, SearchField } from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { describeAlert, formatReading, metricLabel } from '../components/monitoring/alertCopy';
|
||||
import { impactTone, INCIDENT_STATES } from '../components/monitoring/monitorShared';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -478,17 +477,6 @@ export default function Incidents() {
|
||||
applyPage: applyViewPageState,
|
||||
});
|
||||
|
||||
const tableChrome = (
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
);
|
||||
const { hosted, portal: topbarChrome } = useTopbarChrome(tableChrome);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="sk-tabgroup__inner incidents-page">
|
||||
@@ -503,12 +491,10 @@ export default function Incidents() {
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner incidents-page">
|
||||
{topbarChrome}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="incidents"
|
||||
onCreate={chrome.createView}
|
||||
actions={hosted ? null : tableChrome}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
+19
-31
@@ -15,17 +15,15 @@ import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { ListChecks, RefreshCw, RotateCcw, XCircle, Play, Clock } from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import {
|
||||
Pill, DataTable, DataTableFooter, SegControl,
|
||||
SearchField, FilterDrawer, FilterButton, countActiveFilters,
|
||||
statusKind,
|
||||
Pill, DataTable, DataTableFooter, SegControl, FilterDrawer, countActiveFilters, statusKind,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
|
||||
useTableChrome, GridViewPicker, GridChips,
|
||||
} from '@/components/ds/grid';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import { useAuth } from '../contexts/useAuth.js';
|
||||
@@ -272,22 +270,18 @@ export default function Jobs() {
|
||||
// Activity tab; the Scheduled tab just gets Refresh. The view picker is NOT
|
||||
// here any more — it is the Activity table's own heading, because it
|
||||
// describes that table and nothing else on the page.
|
||||
useTopbarActions(() => {
|
||||
if (!isAdmin) return null;
|
||||
return (
|
||||
<>
|
||||
{!scheduledView && (
|
||||
<>
|
||||
<SearchField value={q} onSearch={onSearch} placeholder={t('app.jobs.searchByKindOrOwner', 'Search by kind or owner…')} />
|
||||
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
|
||||
</>
|
||||
)}
|
||||
<Button variant="outline" size="sm" onClick={load}>
|
||||
<RefreshCw size={14} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}, [isAdmin, scheduledView, q, activeFilterCount, load]);
|
||||
useListTopbar(() => (isAdmin ? {
|
||||
secondary: (
|
||||
<Button variant="outline" size="sm" onClick={load}>
|
||||
<RefreshCw size={14} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
),
|
||||
search: scheduledView ? null : {
|
||||
value: q,
|
||||
onSearch,
|
||||
placeholder: t('app.jobs.searchByKindOrOwner', 'Search by kind or owner…'),
|
||||
},
|
||||
} : {}), [isAdmin, scheduledView, q, load]);
|
||||
|
||||
const onRetry = async (id) => {
|
||||
try { await api.retryJob(id); toast.success(t('app.jobs.jobReQueued', 'Job re-queued')); load(); }
|
||||
@@ -396,10 +390,6 @@ export default function Jobs() {
|
||||
// SERVER query drawer, which sees rows this client never loaded, and a
|
||||
// second one would open a weaker drawer over the loaded page only. Gated on
|
||||
// the Activity tab because the chrome describes that table, not Scheduled.
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />, { enabled: isAdmin && !scheduledView },
|
||||
);
|
||||
|
||||
if (!isAdmin) {
|
||||
return (
|
||||
<div className="sk-tabgroup__inner jobs-page">
|
||||
@@ -456,7 +446,6 @@ export default function Jobs() {
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner jobs-page">
|
||||
{topbarChrome}
|
||||
<div className="sk-jobs">
|
||||
<div className="sk-jobs__viewswitch">
|
||||
<SegControl
|
||||
@@ -499,12 +488,11 @@ export default function Jobs() {
|
||||
now. The rest was whole-table arithmetic that only
|
||||
ever restated what the view picker offers. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="jobs"
|
||||
onCreate={chrome.createView}
|
||||
|
||||
actions={chromeActions}
|
||||
/>
|
||||
filters={{ count: activeFilterCount, hidden: 0, onOpen: () => setFiltersOpen(true) }}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
|
||||
@@ -286,16 +286,6 @@ const Marketplace = () => {
|
||||
// reconciles the input in place (focus is preserved between keystrokes).
|
||||
useTopbarActions(() =>
|
||||
<>
|
||||
{showSearch && (
|
||||
<SearchField
|
||||
value={installedView ? installedSearch : search}
|
||||
onSearch={installedView ? setInstalledSearch : setSearch}
|
||||
placeholder={t('app.marketplace.searchExtensions', 'Search extensions…')}
|
||||
/>
|
||||
)}
|
||||
{!installedView && !updatesView && (
|
||||
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@@ -306,6 +296,16 @@ const Marketplace = () => {
|
||||
<UploadCloud aria-hidden="true" />
|
||||
{t('app.marketplace.installShort', 'Install')}
|
||||
</Button>
|
||||
{showSearch && (
|
||||
<SearchField
|
||||
value={installedView ? installedSearch : search}
|
||||
onSearch={installedView ? setInstalledSearch : setSearch}
|
||||
placeholder={t('app.marketplace.searchExtensions', 'Search extensions…')}
|
||||
/>
|
||||
)}
|
||||
{!installedView && !updatesView && (
|
||||
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
|
||||
)}
|
||||
</>,
|
||||
[installedView, updatesView, search, installedSearch, activeFilterCount],
|
||||
);
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||
import {
|
||||
Activity, ArrowLeft, BarChart3, CheckCircle2, Clock, ExternalLink, Lock,
|
||||
Pause, Play, RefreshCw, Rows3, ShieldAlert, SlidersHorizontal, Trash2, Zap,
|
||||
Activity, ArrowLeft, BarChart3, CheckCircle2, Clock, ExternalLink, Lock, Pause, Play, RefreshCw, Rows3, ShieldAlert, SlidersHorizontal, Trash2, Zap,
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -21,12 +20,10 @@ import ErrorState from '../components/ErrorState';
|
||||
import UptimeBars from '../components/monitoring/UptimeBars';
|
||||
import { monitorStateOf } from '../components/monitoring/monitorShared';
|
||||
import {
|
||||
AreaChart, DataTable, DataTableFooter, KpiBand, MetricCard,
|
||||
Pill, SegControl,
|
||||
AreaChart, DataTable, DataTableFooter, KpiBand, MetricCard, Pill, SegControl,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import PageLayout from '../layouts/PageLayout';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -603,9 +600,9 @@ export default function MonitorDetail() {
|
||||
{section === 'checks' && (
|
||||
<>
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="checks"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
{frozen && newSinceFreeze > 0 && (
|
||||
@@ -614,11 +611,6 @@ export default function MonitorDetail() {
|
||||
<Button variant="outline" size="sm" onClick={() => setFrozen(frozen ? null : checks)}>
|
||||
{frozen ? <><Play size={14} /> {t('app.monitorDetail.resume', 'Resume')}</> : <><Pause size={14} /> {t('app.monitorDetail.hold', 'Hold')}</>}
|
||||
</Button>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -20,11 +20,10 @@ import EmptyState from '../components/EmptyState';
|
||||
import InfoTip from '@/components/InfoTip';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import {
|
||||
DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer,
|
||||
Pill, SearchField, Sparkline, countActiveFilters,
|
||||
DataTable, DataTableFooter, Drawer, FilterDrawer, Pill, Sparkline, countActiveFilters,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
|
||||
useTableChrome, GridViewPicker, GridChips,
|
||||
} from '@/components/ds/grid';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PagePrimaryButton from '@/components/PagePrimaryButton';
|
||||
@@ -35,7 +34,7 @@ import { Switch } from '@/components/ui/switch';
|
||||
import {
|
||||
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import useFocusParam from '@/hooks/useFocusParam';
|
||||
@@ -268,21 +267,26 @@ export default function Monitors() {
|
||||
// Quick-create deep link: /monitoring/monitors?focus=create:monitor opens the form.
|
||||
useFocusParam('create', openCreate);
|
||||
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
<SearchField value={q} onSearch={(value) => setQ(value.trim())} placeholder={t('app.monitors.searchMonitorsOrTargets', 'Search monitors or targets…')} />
|
||||
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
|
||||
useListTopbar(() => ({
|
||||
secondary: (
|
||||
<Button variant="outline" size="sm" onClick={load}>
|
||||
<RefreshCw size={14} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
),
|
||||
primary: (
|
||||
<PagePrimaryButton
|
||||
id="monitors-new"
|
||||
label={t('app.monitors.addMonitor', 'New monitor')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={openCreate}
|
||||
/>
|
||||
</>
|
||||
), [q, activeFilterCount, load]);
|
||||
),
|
||||
search: {
|
||||
value: q,
|
||||
onSearch: (value) => setQ(value.trim()),
|
||||
placeholder: t('app.monitors.searchMonitorsOrTargets', 'Search monitors or targets…'),
|
||||
},
|
||||
}), [q, load]);
|
||||
|
||||
const onSave = async (e) => {
|
||||
e.preventDefault();
|
||||
@@ -495,16 +499,11 @@ export default function Monitors() {
|
||||
// page has exactly ONE filter button and it is the top bar's, which opens
|
||||
// the SERVER query drawer. Column rules come from each column's own header
|
||||
// menu and show up in the chips.
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />,
|
||||
);
|
||||
|
||||
const hasFilters = Boolean(q || filters.status || filters.type);
|
||||
const isHttpish = ['http', 'keyword'].includes(form.check_type);
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner monitors-page">
|
||||
{topbarChrome}
|
||||
{/* No KPI band: Operational / Degraded / Down are each a saved view
|
||||
you can act from, so the band was three numbers you had to
|
||||
re-filter by hand. The fleet's 30-day mean went with the view
|
||||
@@ -512,11 +511,10 @@ export default function Monitors() {
|
||||
and now with nowhere to sit — so /monitors/stats is not fetched
|
||||
any more either. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: load }}
|
||||
label="monitors"
|
||||
onCreate={chrome.createView}
|
||||
|
||||
actions={chromeActions}
|
||||
filters={{ count: activeFilterCount, hidden: 0, onOpen: () => setFiltersOpen(true) }}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
ArrowLeft,
|
||||
Inbox,
|
||||
Send,
|
||||
Trash2,
|
||||
RefreshCw,
|
||||
Lock,
|
||||
X,
|
||||
ArrowLeft, Inbox, Send, Trash2, RefreshCw, Lock, X,
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -25,12 +19,10 @@ import {
|
||||
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import {
|
||||
DataTable, DataTableFooter, MetricCard, KpiBand, Pill, SortChipBar,
|
||||
statusKind, statusLabel,
|
||||
DataTable, DataTableFooter, MetricCard, KpiBand, Pill, SortChipBar, statusKind, statusLabel,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -410,21 +402,9 @@ const QueueDetail = () => {
|
||||
in the detail header above — a view here is about the
|
||||
messages, and is shared by every queue. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: () => { loadMeta(); loadMessages(statusFilter); } }}
|
||||
label="messages"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu
|
||||
{...chrome.toolsProps}
|
||||
onRefresh={() => { loadMeta(); loadMessages(statusFilter); }}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
{/* The status select stays on its own line: it is a SERVER
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import { useState, useEffect, useCallback, useMemo, useId } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Layers,
|
||||
Inbox,
|
||||
Send,
|
||||
Trash2,
|
||||
RefreshCw,
|
||||
Plus,
|
||||
Activity,
|
||||
Folder,
|
||||
Server,
|
||||
AlertCircle,
|
||||
Layers, Inbox, Send, Trash2, RefreshCw, Plus, Activity, Folder, Server, AlertCircle,
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -31,12 +22,10 @@ import {
|
||||
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import {
|
||||
DataTable, DataTableFooter, MetricCard, Pill, SearchField, SortChipBar,
|
||||
statusKind, statusLabel,
|
||||
DataTable, DataTableFooter, MetricCard, Pill, SearchField, SortChipBar, statusKind, statusLabel, ListActions,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -476,24 +465,30 @@ const QueueOperations = () => {
|
||||
title={t('app.queueOperations.queueBus', 'Queue bus')}
|
||||
meta={`${activeGroupLabel} · ${activeStatusLabel} · ${filteredQueues.length} visible`}
|
||||
actions={(
|
||||
<>
|
||||
<Tip content={t('app.queueOperations.group', 'Group')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('app.queueOperations.group', 'Group')} onClick={() => setShowGroupModal(true)}>
|
||||
<Folder size={16} />
|
||||
</Button>
|
||||
</Tip>
|
||||
<PagePrimaryButton
|
||||
id="queue-new"
|
||||
iconOnly
|
||||
label={t('app.queueOperations.newQueue', 'New queue')}
|
||||
onClick={() => setShowQueueModal(true)}
|
||||
/>
|
||||
<Tip content={t('common.actions.refresh', 'Refresh')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('common.actions.refresh', 'Refresh')} onClick={() => { loadData(); loadQueues(selectedGroup); }}>
|
||||
<RefreshCw size={16} />
|
||||
</Button>
|
||||
</Tip>
|
||||
</>
|
||||
<ListActions
|
||||
secondary={(
|
||||
<>
|
||||
<Tip content={t('app.queueOperations.group', 'Group')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('app.queueOperations.group', 'Group')} onClick={() => setShowGroupModal(true)}>
|
||||
<Folder size={16} />
|
||||
</Button>
|
||||
</Tip>
|
||||
<Tip content={t('common.actions.refresh', 'Refresh')}>
|
||||
<Button variant="ghost" size="icon" aria-label={t('common.actions.refresh', 'Refresh')} onClick={() => { loadData(); loadQueues(selectedGroup); }}>
|
||||
<RefreshCw size={16} />
|
||||
</Button>
|
||||
</Tip>
|
||||
</>
|
||||
)}
|
||||
primary={(
|
||||
<PagePrimaryButton
|
||||
id="queue-new"
|
||||
label={t('app.queueOperations.newQueue', 'New queue')}
|
||||
shortLabel={t('common.actions.new', 'New')}
|
||||
onClick={() => setShowQueueModal(true)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<div className={`queue-ops-workspace${groups.length === 0 ? ' queue-ops-workspace--no-groups' : ''}`}>
|
||||
@@ -580,9 +575,9 @@ const QueueOperations = () => {
|
||||
{/* The view name is the page's heading for the list, and
|
||||
the table's own chrome sits on that same line. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: () => { loadData(); loadQueues(selectedGroup); } }}
|
||||
label="queues"
|
||||
onCreate={chrome.createView}
|
||||
actions={(
|
||||
<>
|
||||
<SearchField
|
||||
@@ -590,14 +585,6 @@ const QueueOperations = () => {
|
||||
onSearch={setSearchTerm}
|
||||
placeholder={t('app.queueOperations.searchQueues', 'Search queues…')}
|
||||
/>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu
|
||||
{...chrome.toolsProps}
|
||||
onRefresh={() => { loadData(); loadQueues(selectedGroup); }}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useCallback, useMemo, useId } from 'react';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useTopbarActions } from '@/hooks/useTopbarActions';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
import api from '../services/api';
|
||||
@@ -25,8 +25,7 @@ import { Tabs, TabsContent } from '@/components/ui/tabs';
|
||||
import { DataTable, Pill, SegControl, CatalogCard, CatalogGrid } from '@/components/ds';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { formatDateTime } from '@/utils/intl';
|
||||
@@ -553,22 +552,6 @@ const ServerTemplates = () => {
|
||||
setGroupBy,
|
||||
});
|
||||
|
||||
// Filter + "⋮" ride the group's top bar, so the view row is the view name
|
||||
// alone. Gated on the tab that owns the table: the Library is a card
|
||||
// catalogue these do not act on, and the drawer the filter button opens is
|
||||
// rendered inside the Templates tab, so hoisting it unconditionally would
|
||||
// leave a button whose panel does not exist.
|
||||
const gridIsOnScreen = activeTab === 'templates' && templates.length > 0;
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<>
|
||||
<GridFilterButton
|
||||
count={chrome.filterCount}
|
||||
onClick={() => chrome.setDrawerOpen(true)}
|
||||
/>
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
|
||||
</>, { enabled: gridIsOnScreen },
|
||||
);
|
||||
|
||||
if (loading) return <PageLoader />;
|
||||
|
||||
return (
|
||||
@@ -584,7 +567,6 @@ const ServerTemplates = () => {
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
{topbarChrome}
|
||||
<Tabs value={activeTab || 'library'} onValueChange={setActiveTab}>
|
||||
<TabsContent value="templates">
|
||||
{loadErrors.templates && templates.length > 0 && (
|
||||
@@ -610,11 +592,10 @@ const ServerTemplates = () => {
|
||||
) : (
|
||||
<>
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: loadData }}
|
||||
label="templates"
|
||||
onCreate={chrome.createView}
|
||||
|
||||
actions={chromeActions}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -24,16 +24,15 @@ import {
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import {
|
||||
DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer,
|
||||
Pill, SearchField, countActiveFilters,
|
||||
DataTable, DataTableFooter, Drawer, FilterDrawer, Pill, countActiveFilters,
|
||||
} from '@/components/ds';
|
||||
import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
|
||||
useTableChrome, GridViewPicker, GridChips,
|
||||
} from '@/components/ds/grid';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
import { useConfirm } from '@/hooks/useConfirm';
|
||||
import { useTableSort } from '@/hooks/useTableSort';
|
||||
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
|
||||
@@ -237,25 +236,30 @@ export default function Telemetry() {
|
||||
|
||||
// Search + advanced filters + Refresh live in the group's shared top bar,
|
||||
// the way every other list page in the panel does it.
|
||||
useTopbarActions(() => (
|
||||
<>
|
||||
<SearchField value={q} onSearch={(value) => setQ(value.trim())} placeholder={t('app.telemetry.searchMessages', 'Search messages…')} />
|
||||
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
|
||||
{isAdmin && (
|
||||
<Button variant="outline" size="sm" onClick={emitTestEvent}>
|
||||
<Activity size={14} /> {t('app.telemetry.testEvent', 'Test event')}
|
||||
useListTopbar(() => ({
|
||||
secondary: (
|
||||
<>
|
||||
{isAdmin && (
|
||||
<Button variant="outline" size="sm" onClick={emitTestEvent}>
|
||||
<Activity size={14} /> {t('app.telemetry.testEvent', 'Test event')}
|
||||
</Button>
|
||||
)}
|
||||
{isAdmin && (
|
||||
<Button variant="outline" size="sm" onClick={cleanupOldEvents}>
|
||||
<Trash2 size={14} /> {t('app.telemetry.cleanup', 'Cleanup')}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="outline" size="sm" onClick={() => fetchEvents(1, true)} disabled={loading}>
|
||||
<RefreshCw size={14} className={loading ? 'spin' : ''} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
)}
|
||||
{isAdmin && (
|
||||
<Button variant="outline" size="sm" onClick={cleanupOldEvents}>
|
||||
<Trash2 size={14} /> {t('app.telemetry.cleanup', 'Cleanup')}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="outline" size="sm" onClick={() => fetchEvents(1, true)} disabled={loading}>
|
||||
<RefreshCw size={14} className={loading ? 'spin' : ''} /> {t('common.actions.refresh', 'Refresh')}
|
||||
</Button>
|
||||
</>
|
||||
), [q, activeFilterCount, isAdmin, loading, fetchEvents]);
|
||||
</>
|
||||
),
|
||||
search: {
|
||||
value: q,
|
||||
onSearch: (value) => setQ(value.trim()),
|
||||
placeholder: t('app.telemetry.searchMessages', 'Search messages…'),
|
||||
},
|
||||
}), [q, isAdmin, loading, fetchEvents]);
|
||||
|
||||
const filterGroups = useMemo(() => ([
|
||||
{
|
||||
@@ -379,23 +383,17 @@ export default function Telemetry() {
|
||||
// view row as just the view name. It is NOT joined by a grid filter button:
|
||||
// this page's one filter button is the top bar's, which opens the SERVER
|
||||
// query drawer (eight keys, applied to the query rather than the loaded 50).
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={() => fetchEvents(1, true)} />,
|
||||
);
|
||||
|
||||
const hasFilters = Boolean(q || activeFilterCount);
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner telemetry-page">
|
||||
{topbarChrome}
|
||||
{/* Outside the empty check below on purpose: a view that returns
|
||||
no events must still be swappable for another one. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: () => fetchEvents(1, true) }}
|
||||
label="events"
|
||||
onCreate={chrome.createView}
|
||||
|
||||
actions={chromeActions}
|
||||
filters={{ count: activeFilterCount, hidden: 0, onOpen: () => setFiltersOpen(true) }}
|
||||
/>
|
||||
|
||||
<GridChips {...chrome.chipProps} />
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import { useCallback, useState, useEffect, useMemo, useRef, useId } from 'react';
|
||||
import { useCallback, useState, useEffect, useMemo, useRef, useId } from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import {
|
||||
Search, BookOpen, Container, Globe, BarChart3,
|
||||
Database, Shield, Cloud, MessageSquare, Video, Music, Image, Home,
|
||||
Code, Server, GitBranch, Workflow, HardDrive, Lock, Users, FileText,
|
||||
Layers, LayoutTemplate, Check, Cpu,
|
||||
Newspaper, TrendingUp, Rocket, Box, Download, ChevronRight,
|
||||
CheckCircle2, AlertTriangle, XCircle, HelpCircle
|
||||
Search, BookOpen, Container, Globe, BarChart3, Database, Shield, Cloud, MessageSquare, Video, Music, Image, Home, Code, Server, GitBranch, Workflow, HardDrive, Lock, Users, FileText, Layers, LayoutTemplate, Check, Cpu, Newspaper, TrendingUp, Rocket, Box, Download, ChevronRight, CheckCircle2, AlertTriangle, XCircle, HelpCircle,
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
@@ -16,16 +11,14 @@ import {
|
||||
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import {
|
||||
SearchField, FilterDrawer, countActiveFilters, Drawer,
|
||||
DataTableFooter, CatalogCard, CatalogGrid,
|
||||
FilterDrawer, countActiveFilters, Drawer, DataTableFooter, CatalogCard, CatalogGrid,
|
||||
} from '@/components/ds';
|
||||
import { useTableChrome, GridViewPicker, GridToolsMenu, GridFilterButton } from '@/components/ds/grid';
|
||||
import { useTableChrome, GridViewPicker } from '@/components/ds/grid';
|
||||
import ServerPicker from '@/components/ServerPicker';
|
||||
import PortField from '@/components/PortField';
|
||||
import { FormField } from '@/components/FormField';
|
||||
import useFieldErrors from '@/hooks/useFieldErrors';
|
||||
import { LOCAL_SERVER_ID } from '@/utils/serverTarget';
|
||||
import { useTopbarChrome } from '@/hooks/useTopbarActions';
|
||||
import { applyTableSorts, useTableSort } from '@/hooks/useTableSort';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
@@ -33,6 +26,7 @@ import { useManagedProfile } from '../contexts/useManagedProfile';
|
||||
import ManagedCard from '../components/ManagedCard';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toastError } from '@/utils/errorMessage';
|
||||
import { useListTopbar } from '@/hooks/useTopbarActions';
|
||||
|
||||
// Featured templates (curated list)
|
||||
const FEATURED_TEMPLATES = [
|
||||
@@ -506,23 +500,18 @@ const Templates = () => {
|
||||
[chrome.shownRows, sorts, chrome.columns],
|
||||
);
|
||||
|
||||
// Search, the filter button and the "⋮" ride the tab group's top bar, so the
|
||||
// view row below is the view name alone.
|
||||
const { portal: topbarChrome, actions: chromeActions } = useTopbarChrome(
|
||||
<>
|
||||
<SearchField
|
||||
value={searchQuery}
|
||||
onSearch={setSearchQueryFilter}
|
||||
placeholder={t('app.templates.searchTemplates', 'Search templates…')}
|
||||
/>
|
||||
<GridFilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
|
||||
<GridToolsMenu {...chrome.toolsProps} onRefresh={() => Promise.all([loadCategories(), loadTemplates()])} />
|
||||
</>,
|
||||
);
|
||||
// Search rides the tab group's top bar; filters and the table tools are in
|
||||
// the view selector's menu.
|
||||
useListTopbar(() => ({
|
||||
search: {
|
||||
value: searchQuery,
|
||||
onSearch: setSearchQueryFilter,
|
||||
placeholder: t('app.templates.searchTemplates', 'Search templates…'),
|
||||
},
|
||||
}), [searchQuery]);
|
||||
|
||||
return (
|
||||
<div className="sk-tabgroup__inner templates-page">
|
||||
{topbarChrome}
|
||||
{/* The catalog is not the only way in: a repo or an archive skips
|
||||
templates entirely, so both routes lead the page rather than
|
||||
hiding behind the New Service tab. */}
|
||||
@@ -549,10 +538,10 @@ const Templates = () => {
|
||||
at, and its actions ride the top bar. The count that used to sit
|
||||
here is under the cards now, next to what it is counting. */}
|
||||
<GridViewPicker
|
||||
views={chrome.views}
|
||||
{...chrome.pickerProps}
|
||||
tools={{ ...chrome.toolsProps, onRefresh: () => Promise.all([loadCategories(), loadTemplates()]) }}
|
||||
label="templates"
|
||||
onCreate={chrome.createView}
|
||||
actions={chromeActions}
|
||||
filters={{ count: activeFilterCount, hidden: 0, onOpen: () => setFiltersOpen(true) }}
|
||||
/>
|
||||
|
||||
{deployManaged && (
|
||||
|
||||
@@ -400,10 +400,6 @@
|
||||
}
|
||||
|
||||
// Full-width manager shell
|
||||
.dx-page > .sk-kpiband-wrap {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dx-panel {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@@ -435,10 +431,11 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// No margin of its own: the view row above already carries the same
|
||||
// 16px every other list page has between the view name and the table.
|
||||
.dx-resource-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
margin-top: $space-3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,10 +914,6 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dx-containers-pane {
|
||||
gap: $space-2;
|
||||
}
|
||||
|
||||
.dx-manager-layout {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 0;
|
||||
|
||||
Reference in new issue
Block a user