diff --git a/plugins/examples/pod-counter/src/Message.tsx b/plugins/examples/pod-counter/src/Message.tsx
index 9034b6267b..631db04b31 100644
--- a/plugins/examples/pod-counter/src/Message.tsx
+++ b/plugins/examples/pod-counter/src/Message.tsx
@@ -1,3 +1,4 @@
+import { ConfigStore } from '@kinvolk/headlamp-plugin/lib';
import { Typography } from '@mui/material';
import { makeStyles } from '@mui/styles';
@@ -25,9 +26,13 @@ export interface MessageProps {
*/
export default function Message({ msg, error }: MessageProps) {
const classes = useStyle();
+ const config = new ConfigStore<{ errorMessage?: string }>('@kinvolk/headlamp-pod-counter');
+ const useConf = config.useConfig();
+ const conf = useConf();
+
return (
- {!error ? `# Pods: ${msg}` : 'Uh, pods!?'}
+ {!error ? `# Pods: ${msg}` : conf?.errorMessage ? conf?.errorMessage : 'Uh, pods!?'}
);
}
diff --git a/plugins/examples/pod-counter/src/index.tsx b/plugins/examples/pod-counter/src/index.tsx
index 8f1e146ac2..27977d1577 100644
--- a/plugins/examples/pod-counter/src/index.tsx
+++ b/plugins/examples/pod-counter/src/index.tsx
@@ -2,8 +2,13 @@ import {
AppBarActionsProcessorArgs,
DefaultAppBarAction,
K8s,
+ PluginSettingsDetailProps,
registerAppBarAction,
+ registerPluginSettings,
} from '@kinvolk/headlamp-plugin/lib';
+import { NameValueTable } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
+import Box from '@mui/material/Box';
+import TextField from '@mui/material/TextField';
import Message from './Message';
function PodCounter() {
@@ -30,3 +35,33 @@ registerAppBarAction(function reorderNotifications({ actions }: AppBarActionsPro
return newActions;
});
+
+const Settings: React.FC = props => {
+ const { data, onDataChange } = props;
+
+ const handleChange = (event: React.ChangeEvent) => {
+ onDataChange({ errorMessage: event.target.value });
+ };
+
+ const settingsRows = [
+ {
+ name: 'Custom Error message',
+ value: (
+
+ ),
+ },
+ ];
+ return (
+
+
+
+ );
+};
+
+registerPluginSettings('@kinvolk/headlamp-pod-counter', Settings, false);