9da27f4186
Adds full plugin starter template including: - package.json with @kinvolk/headlamp-plugin devDependency and standard scripts - tsconfig.json extending headlamp plugin config - vitest.config.mts + vitest.setup.ts (jsdom, NODE_ENV=test, localStorage shim) - src/index.tsx: registers sidebar entry and route for ResourceListPage - src/components/ResourceListPage.tsx: placeholder CRD list view with TODO guide - src/components/ResourceListPage.test.tsx: example tests using vi.mock pattern - .github/workflows/ci.yaml: delegates to shared plugin-ci.yaml - .github/workflows/release.yaml: delegates to shared plugin-release.yaml - artifacthub-pkg.yml + artifacthub-repo.yml: ArtifactHub metadata with TODO markers - renovate.json: Mend Renovate config for weekly dependency updates - README.md: complete getting-started guide - CONTRIBUTING.md: local dev, code style, testing, PR process - LICENSE: Apache-2.0 Co-Authored-By: Paperclip <noreply@paperclip.ing>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
/**
|
|
* ResourceListPage — placeholder resource list view.
|
|
*
|
|
* TODO: Replace this component with a real CRD list view. Typical approaches:
|
|
*
|
|
* 1. Use K8s.ResourceClasses to build a typed resource class for your CRD:
|
|
* ```ts
|
|
* const MyResource = K8s.makeKubeObject<MyResourceSpec>('MyResource');
|
|
* MyResource.apiEndpoint = K8s.ApiProxy.apiFactory('your.group.io', 'v1', 'yourresources');
|
|
* ```
|
|
*
|
|
* 2. Then use the ResourceListView or SectionBox + a data-fetching hook to list instances.
|
|
*
|
|
* 3. Remove the placeholder NameValueTable below and replace with your real UI.
|
|
*
|
|
* See https://headlamp.dev/docs/latest/development/plugins/functionality/ for the full SDK guide.
|
|
*/
|
|
|
|
import {
|
|
NameValueTable,
|
|
SectionBox,
|
|
SectionHeader,
|
|
} from '@kinvolk/headlamp-plugin/lib/CommonComponents';
|
|
import React from 'react';
|
|
|
|
// TODO: Replace this with your CRD list using K8s.ResourceClasses or K8s.makeKubeObject
|
|
export default function ResourceListPage() {
|
|
const placeholderRows = [
|
|
{ name: 'Resource Group', value: 'your.group.io/v1' },
|
|
{ name: 'Kind', value: 'YourCustomResource' },
|
|
{ name: 'Namespace', value: 'default (or cluster-scoped)' },
|
|
{ name: 'Description', value: 'Replace this view with your real CRD list' },
|
|
];
|
|
|
|
return (
|
|
<SectionBox title={<SectionHeader title="My Plugin" />}>
|
|
<NameValueTable rows={placeholderRows} />
|
|
</SectionBox>
|
|
);
|
|
}
|