@marinoscar/vault-web 0.0.0-bootstrap → 0.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/agent/headless/agentActivity.d.ts +53 -0
- package/dist/agent/headless/agentActivity.js +58 -0
- package/dist/agent/headless/index.d.ts +2 -0
- package/dist/agent/headless/index.js +3 -0
- package/dist/agent/headless/useAgentActivity.d.ts +9 -0
- package/dist/agent/headless/useAgentActivity.js +30 -0
- package/dist/agent/ui/components/AgentActivityTable.d.ts +25 -0
- package/dist/agent/ui/components/AgentActivityTable.js +114 -0
- package/dist/agent/ui/index.d.ts +3 -0
- package/dist/agent/ui/index.js +4 -0
- package/dist/agent/ui/pages/AgentAccessSettingsPage.d.ts +7 -0
- package/dist/agent/ui/pages/AgentAccessSettingsPage.js +70 -0
- package/dist/agent/ui/pages/AgentActivityPage.d.ts +6 -0
- package/dist/agent/ui/pages/AgentActivityPage.js +61 -0
- package/dist/backups/headless/backupContents.d.ts +69 -0
- package/dist/backups/headless/backupContents.js +133 -0
- package/dist/backups/headless/backupPassword.d.ts +34 -0
- package/dist/backups/headless/backupPassword.js +80 -0
- package/dist/backups/headless/backupSchedule.d.ts +56 -0
- package/dist/backups/headless/backupSchedule.js +189 -0
- package/dist/backups/headless/index.d.ts +4 -0
- package/dist/backups/headless/index.js +5 -0
- package/dist/backups/headless/useBackupRunHistory.d.ts +36 -0
- package/dist/backups/headless/useBackupRunHistory.js +83 -0
- package/dist/backups/ui/components/AdminBackupDownloadDialog.d.ts +20 -0
- package/dist/backups/ui/components/AdminBackupDownloadDialog.js +65 -0
- package/dist/backups/ui/components/BackupContentsGroup.d.ts +17 -0
- package/dist/backups/ui/components/BackupContentsGroup.js +21 -0
- package/dist/backups/ui/components/BackupPasswordFields.d.ts +18 -0
- package/dist/backups/ui/components/BackupPasswordFields.js +40 -0
- package/dist/backups/ui/components/BackupRunsTable.d.ts +44 -0
- package/dist/backups/ui/components/BackupRunsTable.js +61 -0
- package/dist/backups/ui/components/DataBackup.d.ts +14 -0
- package/dist/backups/ui/components/DataBackup.js +169 -0
- package/dist/backups/ui/components/ScheduledBackups.d.ts +13 -0
- package/dist/backups/ui/components/ScheduledBackups.js +304 -0
- package/dist/backups/ui/index.d.ts +8 -0
- package/dist/backups/ui/index.js +9 -0
- package/dist/backups/ui/pages/BackupSettingsPage.d.ts +8 -0
- package/dist/backups/ui/pages/BackupSettingsPage.js +19 -0
- package/dist/backups/ui/pages/MyBackupsPage.d.ts +8 -0
- package/dist/backups/ui/pages/MyBackupsPage.js +19 -0
- package/dist/brand/BrandLockup.d.ts +14 -0
- package/dist/brand/BrandLockup.js +13 -0
- package/dist/brand/assets/vault-mark.png +0 -0
- package/dist/brand/contrast.d.ts +8 -0
- package/dist/brand/contrast.js +21 -0
- package/dist/brand/index.d.ts +7 -0
- package/dist/brand/index.js +8 -0
- package/dist/brand/mark.d.ts +6 -0
- package/dist/brand/mark.js +7 -0
- package/dist/brand/theme.d.ts +25 -0
- package/dist/brand/theme.js +84 -0
- package/dist/brand/tokens.d.ts +52 -0
- package/dist/brand/tokens.js +54 -0
- package/dist/cards/headless/cardExpiry.d.ts +57 -0
- package/dist/cards/headless/cardExpiry.js +138 -0
- package/dist/cards/headless/cardFormat.d.ts +60 -0
- package/dist/cards/headless/cardFormat.js +135 -0
- package/dist/cards/headless/cardImage.d.ts +293 -0
- package/dist/cards/headless/cardImage.js +518 -0
- package/dist/cards/headless/index.d.ts +6 -0
- package/dist/cards/headless/index.js +7 -0
- package/dist/cards/headless/useCardImport.d.ts +137 -0
- package/dist/cards/headless/useCardImport.js +391 -0
- package/dist/cards/headless/useCardRenewal.d.ts +102 -0
- package/dist/cards/headless/useCardRenewal.js +305 -0
- package/dist/cards/headless/useCards.d.ts +80 -0
- package/dist/cards/headless/useCards.js +114 -0
- package/dist/cards/ui/components/AiEgressNotice.d.ts +13 -0
- package/dist/cards/ui/components/AiEgressNotice.js +18 -0
- package/dist/cards/ui/components/CardCaptureStep.d.ts +59 -0
- package/dist/cards/ui/components/CardCaptureStep.js +96 -0
- package/dist/cards/ui/components/CardCropAdjuster.d.ts +43 -0
- package/dist/cards/ui/components/CardCropAdjuster.js +215 -0
- package/dist/cards/ui/components/CardCropReview.d.ts +51 -0
- package/dist/cards/ui/components/CardCropReview.js +88 -0
- package/dist/cards/ui/components/CardExpiryBadge.d.ts +8 -0
- package/dist/cards/ui/components/CardExpiryBadge.js +43 -0
- package/dist/cards/ui/components/CardFieldDiff.d.ts +37 -0
- package/dist/cards/ui/components/CardFieldDiff.js +66 -0
- package/dist/cards/ui/components/CardFlowStepper.d.ts +24 -0
- package/dist/cards/ui/components/CardFlowStepper.js +23 -0
- package/dist/cards/ui/components/CardReviewForm.d.ts +44 -0
- package/dist/cards/ui/components/CardReviewForm.js +102 -0
- package/dist/cards/ui/components/CardScanModelSection.d.ts +23 -0
- package/dist/cards/ui/components/CardScanModelSection.js +81 -0
- package/dist/cards/ui/components/CardTile.d.ts +40 -0
- package/dist/cards/ui/components/CardTile.js +94 -0
- package/dist/cards/ui/index.d.ts +15 -0
- package/dist/cards/ui/index.js +16 -0
- package/dist/cards/ui/pages/AiSettingsPage.d.ts +12 -0
- package/dist/cards/ui/pages/AiSettingsPage.js +24 -0
- package/dist/cards/ui/pages/CardsPage.d.ts +26 -0
- package/dist/cards/ui/pages/CardsPage.js +160 -0
- package/dist/cards/ui/pages/ImportCardPage.d.ts +24 -0
- package/dist/cards/ui/pages/ImportCardPage.js +343 -0
- package/dist/cards/ui/pages/RenewCardPage.d.ts +35 -0
- package/dist/cards/ui/pages/RenewCardPage.js +350 -0
- package/dist/core/headless/api.d.ts +272 -0
- package/dist/core/headless/api.js +425 -0
- package/dist/core/headless/cardScanAvailability.d.ts +20 -0
- package/dist/core/headless/cardScanAvailability.js +27 -0
- package/dist/core/headless/clipboard.d.ts +60 -0
- package/dist/core/headless/clipboard.js +101 -0
- package/dist/core/headless/http.d.ts +41 -0
- package/dist/core/headless/http.js +50 -0
- package/dist/core/headless/index.d.ts +12 -0
- package/dist/core/headless/index.js +13 -0
- package/dist/core/headless/relativeTime.d.ts +7 -0
- package/dist/core/headless/relativeTime.js +28 -0
- package/dist/core/headless/saveBlob.d.ts +6 -0
- package/dist/core/headless/saveBlob.js +21 -0
- package/dist/core/headless/types.d.ts +441 -0
- package/dist/core/headless/types.js +49 -0
- package/dist/core/headless/useAiStatus.d.ts +41 -0
- package/dist/core/headless/useAiStatus.js +42 -0
- package/dist/core/headless/useCopyToClipboard.d.ts +20 -0
- package/dist/core/headless/useCopyToClipboard.js +52 -0
- package/dist/core/headless/useDashboardResource.d.ts +22 -0
- package/dist/core/headless/useDashboardResource.js +52 -0
- package/dist/core/headless/useSystemSettings.d.ts +17 -0
- package/dist/core/headless/useSystemSettings.js +106 -0
- package/dist/core/headless/useUserSettings.d.ts +13 -0
- package/dist/core/headless/useUserSettings.js +103 -0
- package/dist/core/ui/ErrorBoundary.d.ts +15 -0
- package/dist/core/ui/ErrorBoundary.js +27 -0
- package/dist/core/ui/LoadingSpinner.d.ts +6 -0
- package/dist/core/ui/LoadingSpinner.js +14 -0
- package/dist/core/ui/SettingsPageFrame.d.ts +19 -0
- package/dist/core/ui/SettingsPageFrame.js +12 -0
- package/dist/core/ui/StorageSettingsLink.d.ts +19 -0
- package/dist/core/ui/StorageSettingsLink.js +26 -0
- package/dist/core/ui/index.d.ts +4 -0
- package/dist/core/ui/index.js +5 -0
- package/dist/home/headless/homeLinks.d.ts +24 -0
- package/dist/home/headless/homeLinks.js +24 -0
- package/dist/home/headless/index.d.ts +1 -0
- package/dist/home/headless/index.js +2 -0
- package/dist/home/ui/components/BackupStatusPanel.d.ts +28 -0
- package/dist/home/ui/components/BackupStatusPanel.js +99 -0
- package/dist/home/ui/components/DashboardPanel.d.ts +33 -0
- package/dist/home/ui/components/DashboardPanel.js +21 -0
- package/dist/home/ui/components/ExpiringCardsPanel.d.ts +31 -0
- package/dist/home/ui/components/ExpiringCardsPanel.js +35 -0
- package/dist/home/ui/components/FirstRunPanel.d.ts +7 -0
- package/dist/home/ui/components/FirstRunPanel.js +21 -0
- package/dist/home/ui/components/QuickActions.d.ts +14 -0
- package/dist/home/ui/components/QuickActions.js +40 -0
- package/dist/home/ui/components/RecentSecretsPanel.d.ts +19 -0
- package/dist/home/ui/components/RecentSecretsPanel.js +20 -0
- package/dist/home/ui/components/StatsRow.d.ts +19 -0
- package/dist/home/ui/components/StatsRow.js +46 -0
- package/dist/home/ui/components/WelcomeHeader.d.ts +11 -0
- package/dist/home/ui/components/WelcomeHeader.js +15 -0
- package/dist/home/ui/index.d.ts +9 -0
- package/dist/home/ui/index.js +10 -0
- package/dist/home/ui/pages/HomePage.d.ts +14 -0
- package/dist/home/ui/pages/HomePage.js +121 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/media/headless/index.d.ts +2 -0
- package/dist/media/headless/index.js +3 -0
- package/dist/media/headless/useMediaFiles.d.ts +20 -0
- package/dist/media/headless/useMediaFiles.js +82 -0
- package/dist/media/headless/useMediaFolders.d.ts +22 -0
- package/dist/media/headless/useMediaFolders.js +81 -0
- package/dist/media/ui/components/FolderList.d.ts +19 -0
- package/dist/media/ui/components/FolderList.js +36 -0
- package/dist/media/ui/components/MediaList.d.ts +20 -0
- package/dist/media/ui/components/MediaList.js +55 -0
- package/dist/media/ui/components/MediaPlayer.d.ts +7 -0
- package/dist/media/ui/components/MediaPlayer.js +361 -0
- package/dist/media/ui/index.d.ts +10 -0
- package/dist/media/ui/index.js +11 -0
- package/dist/media/ui/pages/CreateFolderPage.d.ts +1 -0
- package/dist/media/ui/pages/CreateFolderPage.js +39 -0
- package/dist/media/ui/pages/EditFolderPage.d.ts +1 -0
- package/dist/media/ui/pages/EditFolderPage.js +59 -0
- package/dist/media/ui/pages/MediaFolderPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaFolderPage.js +68 -0
- package/dist/media/ui/pages/MediaFoldersPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaFoldersPage.js +58 -0
- package/dist/media/ui/pages/MediaPlayerPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaPlayerPage.js +76 -0
- package/dist/media/ui/pages/MediaUploadPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaUploadPage.js +88 -0
- package/dist/media/ui/pages/RenameMediaFilePage.d.ts +1 -0
- package/dist/media/ui/pages/RenameMediaFilePage.js +63 -0
- package/dist/navigation/destinations.d.ts +50 -0
- package/dist/navigation/destinations.js +109 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +4 -0
- package/dist/secrets/headless/fieldOptionsValidation.d.ts +45 -0
- package/dist/secrets/headless/fieldOptionsValidation.js +79 -0
- package/dist/secrets/headless/index.d.ts +6 -0
- package/dist/secrets/headless/index.js +7 -0
- package/dist/secrets/headless/secretFields.d.ts +86 -0
- package/dist/secrets/headless/secretFields.js +190 -0
- package/dist/secrets/headless/useSecretDetail.d.ts +33 -0
- package/dist/secrets/headless/useSecretDetail.js +87 -0
- package/dist/secrets/headless/useSecretTypes.d.ts +16 -0
- package/dist/secrets/headless/useSecretTypes.js +62 -0
- package/dist/secrets/headless/useSecrets.d.ts +24 -0
- package/dist/secrets/headless/useSecrets.js +59 -0
- package/dist/secrets/headless/useTotpCode.d.ts +24 -0
- package/dist/secrets/headless/useTotpCode.js +116 -0
- package/dist/secrets/ui/components/CardImages.d.ts +31 -0
- package/dist/secrets/ui/components/CardImages.js +208 -0
- package/dist/secrets/ui/components/DynamicSecretFields.d.ts +10 -0
- package/dist/secrets/ui/components/DynamicSecretFields.js +90 -0
- package/dist/secrets/ui/components/FieldDefinitionBuilder.d.ts +13 -0
- package/dist/secrets/ui/components/FieldDefinitionBuilder.js +114 -0
- package/dist/secrets/ui/components/FieldOptionsEditor.d.ts +15 -0
- package/dist/secrets/ui/components/FieldOptionsEditor.js +45 -0
- package/dist/secrets/ui/components/SecretAttachments.d.ts +15 -0
- package/dist/secrets/ui/components/SecretAttachments.js +106 -0
- package/dist/secrets/ui/components/SecretForm.d.ts +34 -0
- package/dist/secrets/ui/components/SecretForm.js +83 -0
- package/dist/secrets/ui/components/SecretFormDialog.d.ts +15 -0
- package/dist/secrets/ui/components/SecretFormDialog.js +95 -0
- package/dist/secrets/ui/components/SecretTypeFormDialog.d.ts +15 -0
- package/dist/secrets/ui/components/SecretTypeFormDialog.js +92 -0
- package/dist/secrets/ui/components/SecretTypeIcon.d.ts +8 -0
- package/dist/secrets/ui/components/SecretTypeIcon.js +16 -0
- package/dist/secrets/ui/components/SecretTypesList.d.ts +10 -0
- package/dist/secrets/ui/components/SecretTypesList.js +13 -0
- package/dist/secrets/ui/components/SecretValueField.d.ts +20 -0
- package/dist/secrets/ui/components/SecretValueField.js +52 -0
- package/dist/secrets/ui/components/SecretVersionDrawer.d.ts +22 -0
- package/dist/secrets/ui/components/SecretVersionDrawer.js +131 -0
- package/dist/secrets/ui/components/SecretsTable.d.ts +49 -0
- package/dist/secrets/ui/components/SecretsTable.js +174 -0
- package/dist/secrets/ui/components/TotpCodeCard.d.ts +8 -0
- package/dist/secrets/ui/components/TotpCodeCard.js +34 -0
- package/dist/secrets/ui/index.d.ts +20 -0
- package/dist/secrets/ui/index.js +21 -0
- package/dist/secrets/ui/pages/CreateSecretPage.d.ts +2 -0
- package/dist/secrets/ui/pages/CreateSecretPage.js +25 -0
- package/dist/secrets/ui/pages/CreateSecretTypePage.d.ts +1 -0
- package/dist/secrets/ui/pages/CreateSecretTypePage.js +62 -0
- package/dist/secrets/ui/pages/EditSecretPage.d.ts +5 -0
- package/dist/secrets/ui/pages/EditSecretPage.js +55 -0
- package/dist/secrets/ui/pages/EditSecretTypePage.d.ts +1 -0
- package/dist/secrets/ui/pages/EditSecretTypePage.js +88 -0
- package/dist/secrets/ui/pages/SecretDetailPage.d.ts +7 -0
- package/dist/secrets/ui/pages/SecretDetailPage.js +182 -0
- package/dist/secrets/ui/pages/SecretTypesPage.d.ts +1 -0
- package/dist/secrets/ui/pages/SecretTypesPage.js +23 -0
- package/dist/secrets/ui/pages/SecretsPage.d.ts +6 -0
- package/dist/secrets/ui/pages/SecretsPage.js +179 -0
- package/dist/settings/ui/components/FeatureFlagsList.d.ts +7 -0
- package/dist/settings/ui/components/FeatureFlagsList.js +46 -0
- package/dist/settings/ui/components/ImageUpload.d.ts +6 -0
- package/dist/settings/ui/components/ImageUpload.js +61 -0
- package/dist/settings/ui/components/ProfileSettings.d.ts +11 -0
- package/dist/settings/ui/components/ProfileSettings.js +55 -0
- package/dist/settings/ui/components/ThemeSettings.d.ts +7 -0
- package/dist/settings/ui/components/ThemeSettings.js +24 -0
- package/dist/settings/ui/components/UISettings.d.ts +9 -0
- package/dist/settings/ui/components/UISettings.js +25 -0
- package/dist/settings/ui/components/UserProfileCard.d.ts +1 -0
- package/dist/settings/ui/components/UserProfileCard.js +39 -0
- package/dist/settings/ui/components/UserSettingsSection.d.ts +23 -0
- package/dist/settings/ui/components/UserSettingsSection.js +29 -0
- package/dist/settings/ui/index.d.ts +10 -0
- package/dist/settings/ui/index.js +11 -0
- package/dist/settings/ui/pages/AppearanceSettingsPage.d.ts +6 -0
- package/dist/settings/ui/pages/AppearanceSettingsPage.js +11 -0
- package/dist/settings/ui/pages/GeneralSettingsPage.d.ts +9 -0
- package/dist/settings/ui/pages/GeneralSettingsPage.js +41 -0
- package/dist/settings/ui/pages/ProfileSettingsPage.d.ts +6 -0
- package/dist/settings/ui/pages/ProfileSettingsPage.js +11 -0
- package/package.json +146 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DataTableRendererMode, DataTableSortState } from '@marinoscar/platform-web/datatable/headless';
|
|
2
|
+
import type { SecretAgentAccess, SecretListItem, SecretType } from '../../../core/headless/types.js';
|
|
3
|
+
/** The `sortBy` values `GET /api/secrets` accepts, which are also column ids. */
|
|
4
|
+
export type SecretSortField = 'name' | 'updatedAt' | 'createdAt';
|
|
5
|
+
export declare const SECRETS_TABLE_ID = "secrets";
|
|
6
|
+
export declare const SECRETS_PAGE_SIZES: number[];
|
|
7
|
+
export interface SecretsTableProps {
|
|
8
|
+
rows: SecretListItem[];
|
|
9
|
+
total: number;
|
|
10
|
+
/** 0-based, as the platform table counts. */
|
|
11
|
+
page: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
error: string | null;
|
|
15
|
+
sort: DataTableSortState | null;
|
|
16
|
+
onSortChange: (next: DataTableSortState | null) => void;
|
|
17
|
+
onPaginationChange: (next: {
|
|
18
|
+
page: number;
|
|
19
|
+
pageSize: number;
|
|
20
|
+
}) => void;
|
|
21
|
+
search: string;
|
|
22
|
+
onSearchChange: (value: string) => void;
|
|
23
|
+
typeId: string;
|
|
24
|
+
onTypeChange: (typeId: string) => void;
|
|
25
|
+
/** The Agent access filter: `''` is any. */
|
|
26
|
+
agentAccess?: SecretAgentAccess | '';
|
|
27
|
+
onAgentAccessChange?: (value: SecretAgentAccess | '') => void;
|
|
28
|
+
types: SecretType[];
|
|
29
|
+
onClearFilters: () => void;
|
|
30
|
+
/** Shown when the user may create (`secrets:write`). */
|
|
31
|
+
onCreate?: () => void;
|
|
32
|
+
onOpen: (row: SecretListItem) => void;
|
|
33
|
+
/** Shown when the user may edit (`secrets:write`). */
|
|
34
|
+
onEdit?: (row: SecretListItem) => void;
|
|
35
|
+
/** Card-type rows only; shown when the user may edit. */
|
|
36
|
+
onRenewCard?: (row: SecretListItem) => void;
|
|
37
|
+
/** Shown when the user may delete (`secrets:delete`); confirmed by the table first. */
|
|
38
|
+
onDelete?: (row: SecretListItem) => void;
|
|
39
|
+
/** Forces a layout; `auto` (the default) measures the table's container. */
|
|
40
|
+
renderer?: DataTableRendererMode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The Secrets list on the platform `DataTable` (E10.4, issue #95): a grid on
|
|
44
|
+
* desktop and tablet, a card list on a phone (the table measures its own
|
|
45
|
+
* container, so this component reads no breakpoint). Server-driven: sort,
|
|
46
|
+
* page and filters are the page's, the table only reports changes. No secret
|
|
47
|
+
* value is ever in a row (list responses are not decrypted).
|
|
48
|
+
*/
|
|
49
|
+
export declare function SecretsTable(props: SecretsTableProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
4
|
+
import { Avatar, Box, Button, Chip, Link, MenuItem, TextField, Tooltip, Typography } from '@mui/material';
|
|
5
|
+
import { Add as AddIcon, DeleteOutlined as DeleteIcon, EditOutlined as EditIcon, OpenInNew as OpenIcon, Autorenew as RenewIcon, KeyOutlined as EmptyIcon, SearchOff as NoMatchIcon, SmartToyOutlined as AgentIcon, } from '@mui/icons-material';
|
|
6
|
+
import { DataTable, QuickSearchField } from '@marinoscar/platform-web/datatable/ui';
|
|
7
|
+
import { SecretTypeIcon } from './SecretTypeIcon.js';
|
|
8
|
+
import { formatRelativeTime, isCardType } from '../../headless/secretFields.js';
|
|
9
|
+
export const SECRETS_TABLE_ID = 'secrets';
|
|
10
|
+
export const SECRETS_PAGE_SIZES = [10, 20, 50, 100];
|
|
11
|
+
function TypeAvatar({ row, size = 32 }) {
|
|
12
|
+
return (_jsx(Avatar, { variant: "rounded", "aria-hidden": true, sx: { width: size, height: size, flexShrink: 0, bgcolor: 'action.selected', color: 'primary.main' }, children: _jsx(SecretTypeIcon, { icon: row.type.icon, fontSize: "small" }) }));
|
|
13
|
+
}
|
|
14
|
+
function NameLink({ row }) {
|
|
15
|
+
return (_jsx(Link, { component: RouterLink, to: `/secrets/${row.id}`, underline: "hover", sx: { fontWeight: 600, color: 'text.primary', overflowWrap: 'anywhere' }, children: row.name }));
|
|
16
|
+
}
|
|
17
|
+
function TypeChip({ row }) {
|
|
18
|
+
return (_jsx(Chip, { icon: _jsx(SecretTypeIcon, { icon: row.type.icon, fontSize: "small" }), label: row.type.name, size: "small", variant: "outlined" }));
|
|
19
|
+
}
|
|
20
|
+
function AgentsChip({ row }) {
|
|
21
|
+
if (row.agentAccess !== 'fill')
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsx(Tooltip, { title: "Agents may use this login", children: _jsx(Chip, { icon: _jsx(AgentIcon, { fontSize: "small" }), label: "Agents", size: "small", color: "primary", variant: "outlined" }) }));
|
|
24
|
+
}
|
|
25
|
+
function UpdatedLabel({ iso }) {
|
|
26
|
+
return (_jsx(Tooltip, { title: new Date(iso).toLocaleString(), children: _jsx("span", { children: formatRelativeTime(iso) }) }));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The table's layout reaches the page through the Toolbar slot (the platform
|
|
30
|
+
* measures the container; this app reads no breakpoint). A slot is a
|
|
31
|
+
* component, so the setter travels by context to keep its identity stable.
|
|
32
|
+
*/
|
|
33
|
+
const LayoutReport = createContext(null);
|
|
34
|
+
function LayoutProbe({ layout }) {
|
|
35
|
+
const report = useContext(LayoutReport);
|
|
36
|
+
useEffect(() => report?.(layout), [report, layout]);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const SLOTS = { Toolbar: LayoutProbe };
|
|
40
|
+
/** Grid columns (desktop and tablet): one fact per column. */
|
|
41
|
+
const GRID_COLUMNS = [
|
|
42
|
+
{
|
|
43
|
+
id: 'name',
|
|
44
|
+
label: 'Name',
|
|
45
|
+
priority: 'primary',
|
|
46
|
+
sortable: true,
|
|
47
|
+
hideable: false,
|
|
48
|
+
flex: 1.4,
|
|
49
|
+
minWidth: 220,
|
|
50
|
+
value: (row) => row.name,
|
|
51
|
+
render: (row) => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1.5, minWidth: 0, height: '100%' }, children: [_jsx(TypeAvatar, { row: row, size: 28 }), _jsx(Box, { sx: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: _jsx(NameLink, { row: row }) })] })),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'description',
|
|
55
|
+
label: 'Description',
|
|
56
|
+
priority: 'secondary',
|
|
57
|
+
flex: 1.6,
|
|
58
|
+
minWidth: 160,
|
|
59
|
+
truncate: true,
|
|
60
|
+
value: (row) => row.description ?? '',
|
|
61
|
+
render: (row) => row.description ? (_jsx(Typography, { variant: "body2", component: "span", sx: { color: 'text.secondary' }, children: row.description })) : (_jsx(Typography, { variant: "body2", component: "span", sx: { color: 'text.disabled' }, "aria-label": "No description", children: "\u2014" })),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'type',
|
|
65
|
+
label: 'Type',
|
|
66
|
+
priority: 'secondary',
|
|
67
|
+
width: 160,
|
|
68
|
+
value: (row) => row.type.name,
|
|
69
|
+
render: (row) => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 0.5, minWidth: 0 }, children: [_jsx(TypeChip, { row: row }), _jsx(AgentsChip, { row: row })] })),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'currentVersion',
|
|
73
|
+
label: 'Version',
|
|
74
|
+
priority: 'detail',
|
|
75
|
+
width: 96,
|
|
76
|
+
value: (row) => `v${row.currentVersion}`,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'updatedAt',
|
|
80
|
+
label: 'Updated',
|
|
81
|
+
priority: 'secondary',
|
|
82
|
+
sortable: true,
|
|
83
|
+
width: 130,
|
|
84
|
+
value: (row) => formatRelativeTime(row.updatedAt),
|
|
85
|
+
render: (row) => _jsx(UpdatedLabel, { iso: row.updatedAt }),
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Card columns (phone): the headline carries everything, so a card is a
|
|
90
|
+
* compact block (name, description, then type, age and version on one line)
|
|
91
|
+
* instead of a stack of label/value pairs. Same ids, so sort and the stored
|
|
92
|
+
* layout carry across a resize.
|
|
93
|
+
*/
|
|
94
|
+
const CARD_COLUMNS = [
|
|
95
|
+
{
|
|
96
|
+
id: 'name',
|
|
97
|
+
label: 'Name',
|
|
98
|
+
priority: 'primary',
|
|
99
|
+
sortable: true,
|
|
100
|
+
hideable: false,
|
|
101
|
+
value: (row) => row.name,
|
|
102
|
+
render: (row) => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'flex-start', gap: 1.5, minWidth: 0 }, children: [_jsx(TypeAvatar, { row: row, size: 36 }), _jsxs(Box, { sx: { minWidth: 0 }, children: [_jsx(NameLink, { row: row }), row.description && (_jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', fontWeight: 400, overflowWrap: 'anywhere' }, children: row.description }))] })] })),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'updatedAt',
|
|
106
|
+
label: 'Updated',
|
|
107
|
+
priority: 'primary',
|
|
108
|
+
sortable: true,
|
|
109
|
+
value: (row) => formatRelativeTime(row.updatedAt),
|
|
110
|
+
render: (row) => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: 1, pl: 6, pt: 0.5 }, children: [_jsx(TypeChip, { row: row }), _jsx(AgentsChip, { row: row }), _jsxs("span", { children: ["Updated ", _jsx(UpdatedLabel, { iso: row.updatedAt }), " \u00B7 v", row.currentVersion] })] })),
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
/**
|
|
114
|
+
* The Secrets list on the platform `DataTable` (E10.4, issue #95): a grid on
|
|
115
|
+
* desktop and tablet, a card list on a phone (the table measures its own
|
|
116
|
+
* container, so this component reads no breakpoint). Server-driven: sort,
|
|
117
|
+
* page and filters are the page's, the table only reports changes. No secret
|
|
118
|
+
* value is ever in a row (list responses are not decrypted).
|
|
119
|
+
*/
|
|
120
|
+
export function SecretsTable(props) {
|
|
121
|
+
const { rows, total, page, pageSize, loading, error, sort, onSortChange, onPaginationChange, search, onSearchChange, typeId, onTypeChange, agentAccess = '', onAgentAccessChange, types, onClearFilters, onCreate, onOpen, onEdit, onRenewCard, onDelete, renderer, } = props;
|
|
122
|
+
const [layout, setLayout] = useState(renderer && renderer !== 'auto' ? renderer : 'desktop');
|
|
123
|
+
const columns = layout === 'mobile' ? CARD_COLUMNS : GRID_COLUMNS;
|
|
124
|
+
const rowActions = useMemo(() => {
|
|
125
|
+
const actions = [
|
|
126
|
+
{ id: 'open', label: 'Open', icon: _jsx(OpenIcon, { fontSize: "small" }), onClick: onOpen },
|
|
127
|
+
];
|
|
128
|
+
if (onEdit) {
|
|
129
|
+
actions.push({ id: 'edit', label: 'Edit', icon: _jsx(EditIcon, { fontSize: "small" }), onClick: onEdit });
|
|
130
|
+
}
|
|
131
|
+
if (onRenewCard) {
|
|
132
|
+
actions.push({
|
|
133
|
+
id: 'renew',
|
|
134
|
+
label: 'Renew card',
|
|
135
|
+
icon: _jsx(RenewIcon, { fontSize: "small" }),
|
|
136
|
+
onClick: onRenewCard,
|
|
137
|
+
disabled: (row) => !isCardType(row.type),
|
|
138
|
+
disabledReason: (row) => (isCardType(row.type) ? undefined : 'Only card secrets can be renewed'),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (onDelete) {
|
|
142
|
+
actions.push({
|
|
143
|
+
id: 'delete',
|
|
144
|
+
label: 'Delete',
|
|
145
|
+
icon: _jsx(DeleteIcon, { fontSize: "small" }),
|
|
146
|
+
destructive: true,
|
|
147
|
+
onClick: onDelete,
|
|
148
|
+
confirm: {
|
|
149
|
+
title: 'Delete secret?',
|
|
150
|
+
description: (row) => `"${row.name}" and all of its versions will be permanently deleted. This cannot be undone.`,
|
|
151
|
+
confirmLabel: 'Delete',
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return actions;
|
|
156
|
+
}, [onOpen, onEdit, onRenewCard, onDelete]);
|
|
157
|
+
const hasQuery = search !== '' || typeId !== '' || agentAccess !== '';
|
|
158
|
+
const emptyState = hasQuery ? (_jsxs(Box, { sx: { py: 4, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1 }, children: [_jsx(NoMatchIcon, { sx: { fontSize: 40, color: 'text.secondary' } }), _jsx(Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: "No secrets match your filters" }), _jsx(Typography, { variant: "body2", sx: { color: 'text.secondary' }, children: "Try another name or type." }), _jsx(Button, { onClick: onClearFilters, sx: { mt: 1 }, children: "Clear filters" })] })) : (_jsxs(Box, { sx: { py: 4, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1 }, children: [_jsx(Avatar, { sx: { width: 56, height: 56, bgcolor: 'action.selected', color: 'primary.main' }, children: _jsx(EmptyIcon, {}) }), _jsx(Typography, { variant: "subtitle1", sx: { fontWeight: 600, mt: 1 }, children: "No secrets yet" }), _jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', maxWidth: 360 }, children: "Store logins, API keys, cards and notes. Every value is encrypted and versioned." }), onCreate && (_jsx(Button, { variant: "contained", startIcon: _jsx(AddIcon, {}), onClick: onCreate, sx: { mt: 1 }, children: "Create your first secret" }))] }));
|
|
159
|
+
return (_jsxs(Box, { sx: { minWidth: 0 }, children: [_jsxs(Box, { role: "search", "aria-label": "Filter secrets", sx: { display: 'flex', flexWrap: 'wrap', gap: 1.5, mb: 2, minWidth: 0 }, children: [_jsx(Box, { sx: { flex: '3 1 260px', minWidth: 0 }, children: _jsx(QuickSearchField, { config: {
|
|
160
|
+
value: search,
|
|
161
|
+
onChange: onSearchChange,
|
|
162
|
+
placeholder: 'Search by name',
|
|
163
|
+
ariaLabel: 'Search secrets',
|
|
164
|
+
}, columns: columns, fullWidth: true }) }), _jsxs(TextField, { select: true, size: "small", label: "Type", value: typeId, onChange: (e) => onTypeChange(e.target.value), sx: { flex: '1 1 180px', minWidth: 0, '& .MuiInputBase-root': { minHeight: 44 } }, slotProps: { select: { displayEmpty: true }, inputLabel: { shrink: true } }, children: [_jsx(MenuItem, { value: "", children: "All types" }), types.map((type) => (_jsx(MenuItem, { value: type.id, children: _jsxs(Box, { sx: { display: 'inline-flex', alignItems: 'center', gap: 1 }, children: [_jsx(SecretTypeIcon, { icon: type.icon, fontSize: "small" }), type.name] }) }, type.id)))] }), onAgentAccessChange && (_jsxs(TextField, { select: true, size: "small", label: "Agent access", value: agentAccess, onChange: (e) => onAgentAccessChange(e.target.value), sx: { flex: '1 1 180px', minWidth: 0, '& .MuiInputBase-root': { minHeight: 44 } }, slotProps: { select: { displayEmpty: true }, inputLabel: { shrink: true } }, children: [_jsx(MenuItem, { value: "", children: "Any" }), _jsx(MenuItem, { value: "fill", children: "Allowed for agents" }), _jsx(MenuItem, { value: "none", children: "Not allowed" })] }))] }), _jsx(LayoutReport.Provider, { value: setLayout, children: _jsx(DataTable, { tableId: SECRETS_TABLE_ID, ariaLabel: "Secrets", columns: columns, rows: rows, rowId: (row) => row.id, loading: loading, error: error, emptyState: emptyState, sort: { sort, onSortChange }, pagination: {
|
|
165
|
+
page,
|
|
166
|
+
pageSize,
|
|
167
|
+
total,
|
|
168
|
+
onPaginationChange,
|
|
169
|
+
pageSizeOptions: SECRETS_PAGE_SIZES,
|
|
170
|
+
}, rowActions: rowActions, disableExport: true, renderer: renderer,
|
|
171
|
+
// The grid has five narrow columns: it fits whole from 840px, so the
|
|
172
|
+
// tablet fold (Version behind a row expander) starts below that.
|
|
173
|
+
tabletBreakpoint: 840, slots: SLOTS }) })] }));
|
|
174
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The authenticator code of a login: nothing is requested until "Show code",
|
|
3
|
+
* then the code, its countdown and a copy button, refreshed on expiry while
|
|
4
|
+
* visible. The seed is never displayed here.
|
|
5
|
+
*/
|
|
6
|
+
export declare function TotpCodeCard({ secretId }: {
|
|
7
|
+
secretId: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Alert, Box, Button, CircularProgress, IconButton, Paper, Tooltip, Typography } from '@mui/material';
|
|
4
|
+
import { Check as CheckIcon, ContentCopy as CopyIcon, ErrorOutlineOutlined as ErrorIcon, VisibilityOff as HideIcon, } from '@mui/icons-material';
|
|
5
|
+
import { visuallyHidden } from '@mui/utils';
|
|
6
|
+
import { useCopyToClipboard } from '../../../core/headless/useCopyToClipboard.js';
|
|
7
|
+
import { SECRET_CLIPBOARD_CLEAR_MS } from '../../headless/secretFields.js';
|
|
8
|
+
import { groupTotpCode, useTotpCode } from '../../headless/useTotpCode.js';
|
|
9
|
+
const RING = 36;
|
|
10
|
+
const STROKE = 4;
|
|
11
|
+
const RADIUS = (RING - STROKE) / 2;
|
|
12
|
+
const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
|
|
13
|
+
/** A countdown ring; decorative (the seconds are announced as text beside it). */
|
|
14
|
+
function CountdownRing({ fraction, seconds }) {
|
|
15
|
+
return (_jsxs(Box, { sx: { position: 'relative', width: RING, height: RING, flexShrink: 0 }, "aria-hidden": true, children: [_jsxs("svg", { width: RING, height: RING, style: { transform: 'rotate(-90deg)' }, children: [_jsx("circle", { cx: RING / 2, cy: RING / 2, r: RADIUS, fill: "none", strokeWidth: STROKE, stroke: "currentColor", opacity: 0.15 }), _jsx("circle", { cx: RING / 2, cy: RING / 2, r: RADIUS, fill: "none", strokeWidth: STROKE, stroke: "currentColor", strokeLinecap: "round", strokeDasharray: CIRCUMFERENCE, strokeDashoffset: CIRCUMFERENCE * (1 - fraction) })] }), _jsx(Typography, { variant: "caption", sx: { position: 'absolute', inset: 0, display: 'grid', placeItems: 'center', fontWeight: 600 }, children: seconds })] }));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The authenticator code of a login: nothing is requested until "Show code",
|
|
19
|
+
* then the code, its countdown and a copy button, refreshed on expiry while
|
|
20
|
+
* visible. The seed is never displayed here.
|
|
21
|
+
*/
|
|
22
|
+
export function TotpCodeCard({ secretId }) {
|
|
23
|
+
const { status, code, period, remainingMs, error, show, hide } = useTotpCode(secretId);
|
|
24
|
+
const { copy, copied, failed } = useCopyToClipboard({ clearAfterMs: SECRET_CLIPBOARD_CLEAR_MS });
|
|
25
|
+
const [announce, setAnnounce] = useState('');
|
|
26
|
+
const seconds = Math.ceil(remainingMs / 1000);
|
|
27
|
+
const fraction = Math.min(1, remainingMs / (period * 1000));
|
|
28
|
+
// Announce only when a fresh code appears, not on every tick.
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setAnnounce(code ? 'New authenticator code available' : '');
|
|
31
|
+
}, [code]);
|
|
32
|
+
const title = copied ? 'Copied' : failed ? 'Copy failed' : 'Copy code';
|
|
33
|
+
return (_jsxs(Paper, { variant: "outlined", sx: { borderRadius: 2, px: 2, py: 1.5, mt: 2, minWidth: 0 }, children: [_jsx(Typography, { variant: "caption", component: "div", sx: { color: 'text.secondary' }, children: "Authenticator code" }), status === 'idle' && (_jsx(Box, { sx: { mt: 0.5 }, children: _jsx(Button, { size: "small", variant: "outlined", onClick: show, children: "Show code" }) })), status === 'loading' && !code && (_jsx(Box, { sx: { py: 1 }, children: _jsx(CircularProgress, { size: 20, "aria-label": "Getting code" }) })), status === 'error' && (_jsx(Box, { sx: { mt: 0.5 }, children: _jsx(Alert, { severity: "error", variant: "outlined", action: _jsx(Button, { color: "inherit", size: "small", onClick: show, children: "Retry" }), children: error }) })), code && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1.5, mt: 0.5, flexWrap: 'wrap' }, children: [_jsx(Typography, { component: "div", "aria-label": "Authenticator code", sx: { fontFamily: 'monospace', fontSize: '1.6rem', fontWeight: 700, letterSpacing: 2 }, children: groupTotpCode(code) }), _jsx(CountdownRing, { fraction: fraction, seconds: seconds }), _jsxs(Box, { sx: { display: 'flex', ml: 'auto' }, children: [_jsx(Tooltip, { title: title, children: _jsx(IconButton, { size: "small", "aria-label": "Copy code", onClick: () => void copy(code), children: copied ? (_jsx(CheckIcon, { fontSize: "small", color: "success" })) : failed ? (_jsx(ErrorIcon, { fontSize: "small", color: "error" })) : (_jsx(CopyIcon, { fontSize: "small" })) }) }), _jsx(Tooltip, { title: "Hide code", children: _jsx(IconButton, { size: "small", "aria-label": "Hide code", onClick: hide, children: _jsx(HideIcon, { fontSize: "small" }) }) })] })] })), code && (_jsxs(Typography, { variant: "caption", sx: { color: 'text.secondary' }, children: ["Expires in ", seconds, "s"] })), _jsx(Box, { component: "span", role: "status", "aria-live": "polite", sx: visuallyHidden, children: failed ? 'Copy failed. Clipboard is unavailable.' : announce })] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './components/CardImages.js';
|
|
2
|
+
export * from './components/DynamicSecretFields.js';
|
|
3
|
+
export * from './components/FieldDefinitionBuilder.js';
|
|
4
|
+
export * from './components/FieldOptionsEditor.js';
|
|
5
|
+
export * from './components/SecretAttachments.js';
|
|
6
|
+
export * from './components/SecretForm.js';
|
|
7
|
+
export * from './components/SecretFormDialog.js';
|
|
8
|
+
export * from './components/SecretTypeFormDialog.js';
|
|
9
|
+
export * from './components/SecretTypeIcon.js';
|
|
10
|
+
export * from './components/SecretTypesList.js';
|
|
11
|
+
export * from './components/SecretValueField.js';
|
|
12
|
+
export * from './components/SecretVersionDrawer.js';
|
|
13
|
+
export * from './components/SecretsTable.js';
|
|
14
|
+
export { default as CreateSecretPage } from './pages/CreateSecretPage.js';
|
|
15
|
+
export { default as CreateSecretTypePage } from './pages/CreateSecretTypePage.js';
|
|
16
|
+
export { default as EditSecretPage } from './pages/EditSecretPage.js';
|
|
17
|
+
export { default as EditSecretTypePage } from './pages/EditSecretTypePage.js';
|
|
18
|
+
export { default as SecretDetailPage } from './pages/SecretDetailPage.js';
|
|
19
|
+
export { default as SecretTypesPage } from './pages/SecretTypesPage.js';
|
|
20
|
+
export { default as SecretsPage } from './pages/SecretsPage.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Secrets and secret types: the components and the pages the host routes to.
|
|
2
|
+
export * from './components/CardImages.js';
|
|
3
|
+
export * from './components/DynamicSecretFields.js';
|
|
4
|
+
export * from './components/FieldDefinitionBuilder.js';
|
|
5
|
+
export * from './components/FieldOptionsEditor.js';
|
|
6
|
+
export * from './components/SecretAttachments.js';
|
|
7
|
+
export * from './components/SecretForm.js';
|
|
8
|
+
export * from './components/SecretFormDialog.js';
|
|
9
|
+
export * from './components/SecretTypeFormDialog.js';
|
|
10
|
+
export * from './components/SecretTypeIcon.js';
|
|
11
|
+
export * from './components/SecretTypesList.js';
|
|
12
|
+
export * from './components/SecretValueField.js';
|
|
13
|
+
export * from './components/SecretVersionDrawer.js';
|
|
14
|
+
export * from './components/SecretsTable.js';
|
|
15
|
+
export { default as CreateSecretPage } from './pages/CreateSecretPage.js';
|
|
16
|
+
export { default as CreateSecretTypePage } from './pages/CreateSecretTypePage.js';
|
|
17
|
+
export { default as EditSecretPage } from './pages/EditSecretPage.js';
|
|
18
|
+
export { default as EditSecretTypePage } from './pages/EditSecretTypePage.js';
|
|
19
|
+
export { default as SecretDetailPage } from './pages/SecretDetailPage.js';
|
|
20
|
+
export { default as SecretTypesPage } from './pages/SecretTypesPage.js';
|
|
21
|
+
export { default as SecretsPage } from './pages/SecretsPage.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { Link as RouterLink, useNavigate } from 'react-router-dom';
|
|
4
|
+
import { Box, Button, CircularProgress, Typography } from '@mui/material';
|
|
5
|
+
import { ArrowBack as BackIcon } from '@mui/icons-material';
|
|
6
|
+
import { SecretForm } from '../components/SecretForm.js';
|
|
7
|
+
import { useSecretTypes } from '../../headless/useSecretTypes.js';
|
|
8
|
+
import { createSecret } from '../../../core/headless/api.js';
|
|
9
|
+
/** New secret (E10.4, issue #95): `POST /api/secrets` with the type's fields. */
|
|
10
|
+
export default function CreateSecretPage() {
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const { types, isLoading, fetchTypes } = useSecretTypes();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
fetchTypes();
|
|
15
|
+
}, [fetchTypes]);
|
|
16
|
+
return (_jsxs(Box, { sx: { maxWidth: 760, mx: 'auto', minWidth: 0 }, children: [_jsx(Button, { component: RouterLink, to: "/secrets", startIcon: _jsx(BackIcon, {}), size: "small", sx: { mb: 1.5, ml: -1, color: 'text.secondary' }, children: "Secrets" }), _jsx(Typography, { variant: "h5", component: "h1", sx: { fontWeight: 700, mb: 2 }, children: "New secret" }), isLoading && types.length === 0 ? (_jsx(Box, { sx: { display: 'flex', justifyContent: 'center', py: 6 }, children: _jsx(CircularProgress, { "aria-label": "Loading secret types" }) })) : (_jsx(SecretForm, { mode: "create", types: types, submitLabel: "Create secret", submittingLabel: "Creating\u2026", onCancel: () => navigate('/secrets'), onSubmit: async (values) => {
|
|
17
|
+
const result = await createSecret({
|
|
18
|
+
name: values.name,
|
|
19
|
+
description: values.description || undefined,
|
|
20
|
+
typeId: values.typeId,
|
|
21
|
+
data: values.data,
|
|
22
|
+
});
|
|
23
|
+
navigate(`/secrets/${result.id}`);
|
|
24
|
+
} }))] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CreateSecretTypePage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
|
+
import { Container, Typography, Breadcrumbs, Link, Paper, TextField, Button, Box, Alert, MenuItem, ListItemIcon, ListItemText, FormControlLabel, Switch, Divider, } from '@mui/material';
|
|
5
|
+
import { FieldDefinitionBuilder } from '../components/FieldDefinitionBuilder.js';
|
|
6
|
+
import { SecretTypeIcon, availableIcons } from '../components/SecretTypeIcon.js';
|
|
7
|
+
import { createSecretType } from '../../../core/headless/api.js';
|
|
8
|
+
const DEFAULT_FIELDS = [
|
|
9
|
+
{ name: 'value', label: 'Value', type: 'string', required: true, sensitive: true },
|
|
10
|
+
];
|
|
11
|
+
export default function CreateSecretTypePage() {
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const [name, setName] = useState('');
|
|
14
|
+
const [description, setDescription] = useState('');
|
|
15
|
+
const [icon, setIcon] = useState('');
|
|
16
|
+
const [allowAttachments, setAllowAttachments] = useState(false);
|
|
17
|
+
const [fields, setFields] = useState(DEFAULT_FIELDS);
|
|
18
|
+
const [formError, setFormError] = useState(null);
|
|
19
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
20
|
+
const handleSubmit = async (e) => {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
setFormError(null);
|
|
23
|
+
if (!name.trim()) {
|
|
24
|
+
setFormError('Name is required');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (fields.length === 0) {
|
|
28
|
+
setFormError('At least one field is required');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const invalidField = fields.find((f) => !f.label.trim() || !f.name.trim());
|
|
32
|
+
if (invalidField) {
|
|
33
|
+
setFormError('All fields must have a label');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const names = fields.map((f) => f.name);
|
|
37
|
+
if (names.length !== new Set(names).size) {
|
|
38
|
+
setFormError('Field names must be unique');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setIsSubmitting(true);
|
|
42
|
+
try {
|
|
43
|
+
await createSecretType({
|
|
44
|
+
name: name.trim(),
|
|
45
|
+
description: description.trim() || undefined,
|
|
46
|
+
icon: icon || undefined,
|
|
47
|
+
fields,
|
|
48
|
+
allowAttachments,
|
|
49
|
+
});
|
|
50
|
+
navigate('/settings/secret-types');
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
setFormError(err instanceof Error ? err.message : 'Failed to create secret type');
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
setIsSubmitting(false);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return (_jsxs(Container, { maxWidth: "md", sx: { py: 3 }, children: [_jsxs(Breadcrumbs, { sx: { mb: 2 }, children: [_jsx(Link, { color: "inherit", href: "/settings", onClick: (e) => { e.preventDefault(); navigate('/settings'); }, children: "Settings" }), _jsx(Link, { color: "inherit", href: "/settings/secret-types", onClick: (e) => { e.preventDefault(); navigate('/settings/secret-types'); }, children: "Secret types" }), _jsx(Typography, { sx: {
|
|
60
|
+
color: "text.primary"
|
|
61
|
+
}, children: "New Type" })] }), _jsx(Typography, { variant: "h4", gutterBottom: true, children: "New Secret Type" }), _jsx(Paper, { sx: { p: 3 }, children: _jsx("form", { onSubmit: handleSubmit, children: _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [formError && _jsx(Alert, { severity: "error", children: formError }), _jsx(TextField, { label: "Name", fullWidth: true, required: true, value: name, onChange: (e) => setName(e.target.value), disabled: isSubmitting, autoFocus: true }), _jsx(TextField, { label: "Description", fullWidth: true, multiline: true, minRows: 2, value: description, onChange: (e) => setDescription(e.target.value), disabled: isSubmitting }), _jsxs(TextField, { select: true, label: "Icon", fullWidth: true, value: icon, onChange: (e) => setIcon(e.target.value), disabled: isSubmitting, children: [_jsx(MenuItem, { value: "", children: _jsx("em", { children: "None" }) }), availableIcons.map((iconName) => (_jsxs(MenuItem, { value: iconName, children: [_jsx(ListItemIcon, { sx: { minWidth: 36 }, children: _jsx(SecretTypeIcon, { icon: iconName, fontSize: "small" }) }), _jsx(ListItemText, { primary: iconName })] }, iconName)))] }), _jsx(FormControlLabel, { control: _jsx(Switch, { checked: allowAttachments, onChange: (e) => setAllowAttachments(e.target.checked), disabled: isSubmitting }), label: "Allow Attachments" }), _jsx(Divider, {}), _jsx(FieldDefinitionBuilder, { fields: fields, onChange: setFields }), _jsxs(Box, { sx: { display: 'flex', justifyContent: 'flex-end', gap: 1, mt: 1 }, children: [_jsx(Button, { onClick: () => navigate('/settings/secret-types'), disabled: isSubmitting, children: "Cancel" }), _jsx(Button, { type: "submit", variant: "contained", disabled: isSubmitting, children: isSubmitting ? 'Creating...' : 'Create Type' })] })] }) }) })] }));
|
|
62
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Link as RouterLink, useNavigate, useParams } from 'react-router-dom';
|
|
4
|
+
import { Alert, Box, Button, Chip, CircularProgress, Typography } from '@mui/material';
|
|
5
|
+
import { ArrowBack as BackIcon } from '@mui/icons-material';
|
|
6
|
+
import { SecretForm } from '../components/SecretForm.js';
|
|
7
|
+
import { SecretTypeIcon } from '../components/SecretTypeIcon.js';
|
|
8
|
+
import { getSecret, updateSecret } from '../../../core/headless/api.js';
|
|
9
|
+
/**
|
|
10
|
+
* Edit a secret (E10.4, issue #95): `PUT /api/secrets/:id`. The API mints a
|
|
11
|
+
* new version only when the field values changed; the type never changes.
|
|
12
|
+
*/
|
|
13
|
+
export default function EditSecretPage() {
|
|
14
|
+
const { id } = useParams();
|
|
15
|
+
const navigate = useNavigate();
|
|
16
|
+
const [secret, setSecret] = useState(null);
|
|
17
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
18
|
+
const [loadError, setLoadError] = useState(null);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!id)
|
|
21
|
+
return;
|
|
22
|
+
let current = true;
|
|
23
|
+
setIsLoading(true);
|
|
24
|
+
getSecret(id)
|
|
25
|
+
.then((result) => current && setSecret(result))
|
|
26
|
+
.catch((err) => {
|
|
27
|
+
if (current)
|
|
28
|
+
setLoadError(err instanceof Error ? err.message : 'Failed to load secret');
|
|
29
|
+
})
|
|
30
|
+
.finally(() => current && setIsLoading(false));
|
|
31
|
+
return () => {
|
|
32
|
+
current = false;
|
|
33
|
+
};
|
|
34
|
+
}, [id]);
|
|
35
|
+
if (isLoading) {
|
|
36
|
+
return (_jsx(Box, { sx: { display: 'flex', justifyContent: 'center', py: 6 }, children: _jsx(CircularProgress, { "aria-label": "Loading secret" }) }));
|
|
37
|
+
}
|
|
38
|
+
if (!secret || !id) {
|
|
39
|
+
return (_jsx(Box, { sx: { maxWidth: 760, mx: 'auto' }, children: _jsx(Alert, { severity: "error", children: loadError || 'Secret not found' }) }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs(Box, { sx: { maxWidth: 760, mx: 'auto', minWidth: 0 }, children: [_jsx(Button, { component: RouterLink, to: `/secrets/${id}`, startIcon: _jsx(BackIcon, {}), size: "small", sx: { mb: 1.5, ml: -1, color: 'text.secondary', maxWidth: '100%' }, children: _jsx(Box, { component: "span", sx: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: secret.name }) }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: 1.5, mb: 2 }, children: [_jsx(Typography, { variant: "h5", component: "h1", sx: { fontWeight: 700 }, children: "Edit secret" }), secret.type && (_jsx(Chip, { icon: _jsx(SecretTypeIcon, { icon: secret.type.icon, fontSize: "small" }), label: secret.type.name, size: "small", variant: "outlined" }))] }), _jsx(SecretForm, { mode: "edit", types: secret.type ? [secret.type] : [], initial: {
|
|
42
|
+
name: secret.name,
|
|
43
|
+
description: secret.description ?? '',
|
|
44
|
+
typeId: secret.type?.id ?? '',
|
|
45
|
+
data: secret.values ?? {},
|
|
46
|
+
}, submitLabel: "Save changes", submittingLabel: "Saving\u2026", onCancel: () => navigate(`/secrets/${id}`), onSubmit: async (values) => {
|
|
47
|
+
await updateSecret(id, {
|
|
48
|
+
name: values.name,
|
|
49
|
+
// An emptied description clears it (the API accepts null).
|
|
50
|
+
description: values.description === '' ? null : values.description,
|
|
51
|
+
data: values.data,
|
|
52
|
+
});
|
|
53
|
+
navigate(`/secrets/${id}`);
|
|
54
|
+
} })] }));
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function EditSecretTypePage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { useParams, useNavigate } from 'react-router-dom';
|
|
4
|
+
import { Container, Typography, Breadcrumbs, Link, Paper, TextField, Button, Box, Alert, MenuItem, ListItemIcon, ListItemText, FormControlLabel, Switch, Divider, CircularProgress, } from '@mui/material';
|
|
5
|
+
import { FieldDefinitionBuilder } from '../components/FieldDefinitionBuilder.js';
|
|
6
|
+
import { SecretTypeIcon, availableIcons } from '../components/SecretTypeIcon.js';
|
|
7
|
+
import { getSecretType, updateSecretType } from '../../../core/headless/api.js';
|
|
8
|
+
export default function EditSecretTypePage() {
|
|
9
|
+
const { id } = useParams();
|
|
10
|
+
const navigate = useNavigate();
|
|
11
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
12
|
+
const [typeName, setTypeName] = useState('');
|
|
13
|
+
const [name, setName] = useState('');
|
|
14
|
+
const [description, setDescription] = useState('');
|
|
15
|
+
const [icon, setIcon] = useState('');
|
|
16
|
+
const [allowAttachments, setAllowAttachments] = useState(false);
|
|
17
|
+
const [fields, setFields] = useState([]);
|
|
18
|
+
const [formError, setFormError] = useState(null);
|
|
19
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!id)
|
|
22
|
+
return;
|
|
23
|
+
setIsLoading(true);
|
|
24
|
+
getSecretType(id)
|
|
25
|
+
.then((result) => {
|
|
26
|
+
setTypeName(result.name);
|
|
27
|
+
setName(result.name);
|
|
28
|
+
setDescription(result.description ?? '');
|
|
29
|
+
setIcon(result.icon ?? '');
|
|
30
|
+
setAllowAttachments(result.allowAttachments);
|
|
31
|
+
setFields(result.fields.length > 0 ? result.fields : []);
|
|
32
|
+
})
|
|
33
|
+
.catch((err) => {
|
|
34
|
+
setFormError(err instanceof Error ? err.message : 'Failed to load secret type');
|
|
35
|
+
})
|
|
36
|
+
.finally(() => setIsLoading(false));
|
|
37
|
+
}, [id]);
|
|
38
|
+
const handleSubmit = async (e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
if (!id)
|
|
41
|
+
return;
|
|
42
|
+
setFormError(null);
|
|
43
|
+
if (!name.trim()) {
|
|
44
|
+
setFormError('Name is required');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (fields.length === 0) {
|
|
48
|
+
setFormError('At least one field is required');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const invalidField = fields.find((f) => !f.label.trim() || !f.name.trim());
|
|
52
|
+
if (invalidField) {
|
|
53
|
+
setFormError('All fields must have a label');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const names = fields.map((f) => f.name);
|
|
57
|
+
if (names.length !== new Set(names).size) {
|
|
58
|
+
setFormError('Field names must be unique');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setIsSubmitting(true);
|
|
62
|
+
try {
|
|
63
|
+
await updateSecretType(id, {
|
|
64
|
+
name: name.trim(),
|
|
65
|
+
description: description.trim() || undefined,
|
|
66
|
+
icon: icon || undefined,
|
|
67
|
+
fields,
|
|
68
|
+
allowAttachments,
|
|
69
|
+
});
|
|
70
|
+
navigate('/settings/secret-types');
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
setFormError(err instanceof Error ? err.message : 'Failed to update secret type');
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
setIsSubmitting(false);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
if (isLoading) {
|
|
80
|
+
return (_jsx(Container, { maxWidth: "md", sx: { py: 3, display: 'flex', justifyContent: 'center' }, children: _jsx(CircularProgress, {}) }));
|
|
81
|
+
}
|
|
82
|
+
if (!typeName && formError) {
|
|
83
|
+
return (_jsx(Container, { maxWidth: "md", sx: { py: 3 }, children: _jsx(Alert, { severity: "error", children: formError }) }));
|
|
84
|
+
}
|
|
85
|
+
return (_jsxs(Container, { maxWidth: "md", sx: { py: 3 }, children: [_jsxs(Breadcrumbs, { sx: { mb: 2 }, children: [_jsx(Link, { color: "inherit", href: "/settings", onClick: (e) => { e.preventDefault(); navigate('/settings'); }, children: "Settings" }), _jsx(Link, { color: "inherit", href: "/settings/secret-types", onClick: (e) => { e.preventDefault(); navigate('/settings/secret-types'); }, children: "Secret types" }), _jsxs(Typography, { sx: {
|
|
86
|
+
color: "text.primary"
|
|
87
|
+
}, children: ["Edit ", typeName] })] }), _jsx(Typography, { variant: "h4", gutterBottom: true, children: "Edit Secret Type" }), _jsx(Paper, { sx: { p: 3 }, children: _jsx("form", { onSubmit: handleSubmit, children: _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [formError && _jsx(Alert, { severity: "error", children: formError }), _jsx(TextField, { label: "Name", fullWidth: true, required: true, value: name, onChange: (e) => setName(e.target.value), disabled: isSubmitting, autoFocus: true }), _jsx(TextField, { label: "Description", fullWidth: true, multiline: true, minRows: 2, value: description, onChange: (e) => setDescription(e.target.value), disabled: isSubmitting }), _jsxs(TextField, { select: true, label: "Icon", fullWidth: true, value: icon, onChange: (e) => setIcon(e.target.value), disabled: isSubmitting, children: [_jsx(MenuItem, { value: "", children: _jsx("em", { children: "None" }) }), availableIcons.map((iconName) => (_jsxs(MenuItem, { value: iconName, children: [_jsx(ListItemIcon, { sx: { minWidth: 36 }, children: _jsx(SecretTypeIcon, { icon: iconName, fontSize: "small" }) }), _jsx(ListItemText, { primary: iconName })] }, iconName)))] }), _jsx(FormControlLabel, { control: _jsx(Switch, { checked: allowAttachments, onChange: (e) => setAllowAttachments(e.target.checked), disabled: isSubmitting }), label: "Allow Attachments" }), _jsx(Divider, {}), _jsx(FieldDefinitionBuilder, { fields: fields, onChange: setFields }), _jsxs(Box, { sx: { display: 'flex', justifyContent: 'flex-end', gap: 1, mt: 1 }, children: [_jsx(Button, { onClick: () => navigate('/settings/secret-types'), disabled: isSubmitting, children: "Cancel" }), _jsx(Button, { type: "submit", variant: "contained", disabled: isSubmitting, children: isSubmitting ? 'Saving...' : 'Save Changes' })] })] }) }) })] }));
|
|
88
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A secret (E10.4, issue #95): header with the type, name and last update;
|
|
3
|
+
* masked fields with reveal and copy; an Attachments tab; version history and
|
|
4
|
+
* rollback in a drawer; Edit and Delete. Card-type secrets also link to the
|
|
5
|
+
* Cards renewal flow.
|
|
6
|
+
*/
|
|
7
|
+
export default function SecretDetailPage(): import("react").JSX.Element;
|