feat: improve UX with drawer detail view and proper settings placement
Major UX improvements: - Changed detail view from full page to drawer (slides from right) - Moved plugin settings from sidebar to Settings → Plugins (proper pattern) - Fixed React error #310 by adding defensive String() wrappers - Fixed syncMessage getter to always return string - Added safety checks for encryptedData access - Added error handling for useGet failures The drawer approach keeps the list visible while viewing details, matching Headlamp's design patterns. Settings are now properly located in the global Settings → Plugins section instead of cluttering the plugin's sidebar navigation. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
|
||||
import {
|
||||
registerDetailsViewSection,
|
||||
registerPluginSettings,
|
||||
registerRoute,
|
||||
registerSidebarEntry,
|
||||
} from '@kinvolk/headlamp-plugin/lib';
|
||||
import React from 'react';
|
||||
import { ApiErrorBoundary, GenericErrorBoundary } from './components/ErrorBoundary';
|
||||
import { SealedSecretDetail } from './components/SealedSecretDetail';
|
||||
import { SealedSecretList } from './components/SealedSecretList';
|
||||
import { SealingKeysView } from './components/SealingKeysView';
|
||||
import { SecretDetailsSection } from './components/SecretDetailsSection';
|
||||
@@ -56,21 +56,13 @@ registerSidebarEntry({
|
||||
url: '/sealedsecrets/keys',
|
||||
});
|
||||
|
||||
// "Settings" child entry
|
||||
registerSidebarEntry({
|
||||
parent: 'sealed-secrets',
|
||||
name: 'sealed-secrets-settings',
|
||||
label: 'Settings',
|
||||
url: '/sealedsecrets/settings',
|
||||
});
|
||||
|
||||
/**
|
||||
* Register routes
|
||||
*/
|
||||
|
||||
// List view
|
||||
// List view with optional detail drawer
|
||||
registerRoute({
|
||||
path: '/sealedsecrets',
|
||||
path: '/sealedsecrets/:namespace?/:name?',
|
||||
sidebar: 'sealed-secrets-list',
|
||||
component: () => (
|
||||
<ApiErrorBoundary>
|
||||
@@ -78,18 +70,6 @@ registerRoute({
|
||||
</ApiErrorBoundary>
|
||||
),
|
||||
exact: true,
|
||||
});
|
||||
|
||||
// Detail view
|
||||
registerRoute({
|
||||
path: '/sealedsecrets/:namespace/:name',
|
||||
sidebar: 'sealed-secrets-list',
|
||||
component: () => (
|
||||
<ApiErrorBoundary>
|
||||
<SealedSecretDetail />
|
||||
</ApiErrorBoundary>
|
||||
),
|
||||
exact: true,
|
||||
name: 'sealedsecret',
|
||||
});
|
||||
|
||||
@@ -105,18 +85,6 @@ registerRoute({
|
||||
exact: true,
|
||||
});
|
||||
|
||||
// Settings page
|
||||
registerRoute({
|
||||
path: '/sealedsecrets/settings',
|
||||
sidebar: 'sealed-secrets-settings',
|
||||
component: () => (
|
||||
<GenericErrorBoundary>
|
||||
<SettingsPage />
|
||||
</GenericErrorBoundary>
|
||||
),
|
||||
exact: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Register integration with Secret detail view
|
||||
*
|
||||
@@ -132,3 +100,18 @@ registerDetailsViewSection(({ resource }) => {
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
/**
|
||||
* Register plugin settings
|
||||
*
|
||||
* Settings will appear in Settings → Plugins → Sealed Secrets
|
||||
*/
|
||||
registerPluginSettings(
|
||||
'headlamp-sealed-secrets',
|
||||
() => (
|
||||
<GenericErrorBoundary>
|
||||
<SettingsPage />
|
||||
</GenericErrorBoundary>
|
||||
),
|
||||
true // Display save button
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user