Pulse/frontend-modern/src/api/dockerHostMetadata.ts
rcourtman bd1f4682be refactor(ui): standardize URL editing with shared UrlEditPopover component
- Create reusable UrlEditPopover component with fixed positioning
- Add createUrlEditState hook for managing editing state
- Update DockerHostSummaryTable to use new popover
- Update DockerUnifiedTable (containers & services) to use new popover
- Update GuestRow (Proxmox VMs/containers) to use new popover
- Update HostsOverview (Proxmox hosts) to use new popover
- Add Docker host metadata API for custom URLs
- Consistent styling with save, delete, cancel buttons and keyboard shortcuts
2025-12-18 22:22:55 +00:00

40 lines
1.3 KiB
TypeScript

// Docker Host Metadata API - for managing custom URLs on Docker hosts
import { apiFetchJSON } from '@/utils/apiClient';
export interface DockerHostMetadata {
customDisplayName?: string;
customUrl?: string;
notes?: string[];
}
export class DockerHostMetadataAPI {
private static baseUrl = '/api/docker/hosts/metadata';
// Get metadata for a specific Docker host
static async getMetadata(hostId: string): Promise<DockerHostMetadata> {
return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(hostId)}`);
}
// Get all Docker host metadata
static async getAllMetadata(): Promise<Record<string, DockerHostMetadata>> {
return apiFetchJSON(this.baseUrl);
}
// Update metadata for a Docker host
static async updateMetadata(
hostId: string,
metadata: Partial<DockerHostMetadata>,
): Promise<DockerHostMetadata> {
return apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(hostId)}`, {
method: 'PUT',
body: JSON.stringify(metadata),
});
}
// Delete metadata for a Docker host
static async deleteMetadata(hostId: string): Promise<void> {
await apiFetchJSON(`${this.baseUrl}/${encodeURIComponent(hostId)}`, {
method: 'DELETE',
});
}
}