diff --git a/plugins/examples/change-logo/src/index.tsx b/plugins/examples/change-logo/src/index.tsx
index 28ba6544a3d..02912b7d204 100644
--- a/plugins/examples/change-logo/src/index.tsx
+++ b/plugins/examples/change-logo/src/index.tsx
@@ -3,11 +3,15 @@
// import { registerAppLogo } from '@kinvolk/headlamp-plugin/lib';
// registerAppLogo(() =>
My Logo
);
-import { AppLogoProps, registerAppLogo } from '@kinvolk/headlamp-plugin/lib';
+import {
+ AppLogoProps,
+ registerAppLogo,
+ registerPluginSettings,
+} from '@kinvolk/headlamp-plugin/lib';
import { SvgIcon } from '@mui/material';
import LogoWithTextLight from './icon-large-light.svg';
import LogoLight from './icon-small-light.svg';
-
+import Settings, { store } from './settings';
/**
* A simple logo using two different SVG files.
* One for the small logo (used in mobile view), and a larger one used in desktop view.
@@ -18,7 +22,12 @@ import LogoLight from './icon-small-light.svg';
function SimpleLogo(props: AppLogoProps) {
const { logoType, className } = props;
- return (
+ const useConf = store.useConfig();
+ const config = useConf();
+
+ return config?.url ? (
+
+ ) : (
{
+ const newValue = event.target.value;
+ setValue(newValue);
+
+ if (timer) {
+ clearTimeout(timer);
+ }
+
+ const newTimer = setTimeout(() => onSave(newValue), delay);
+ setTimer(newTimer);
+ };
+
+ useEffect(() => {
+ // Cleanup on unmount
+ return () => {
+ if (timer) {
+ clearTimeout(timer);
+ }
+ };
+ }, [timer]);
+
+ return (
+
+ );
+}
+
+interface pluginConfig {
+ url: string;
+}
+
+export const store = new ConfigStore('change-logo');
+
+/**
+ * Settings component for managing plugin configuration details.
+ * It allows users to update specific configuration properties, such as the logo URL,
+ * and automatically saves these updates to a persistent store.
+ *
+ * @returns {JSX.Element} The rendered settings component with configuration options.
+ */
+export default function Settings() {
+ // Retrieve initial configuration from the store
+ const config = store.get();
+ // State to manage the current configuration within the component
+ const [currentConfig, setCurrentConfig] = useState(config);
+
+ /**
+ * Handles saving the updated configuration value to the store.
+ * It updates the specified configuration property and refreshes the local component state
+ * to reflect the latest configuration.
+ *
+ * @param {string} value - The new value for the configuration property to be updated.
+ */
+ function handleSave(value) {
+ const updatedConfig = { url: value };
+ // Save the updated configuration to the store
+ store.set(updatedConfig);
+ // Update the component state to reflect the new configuration
+ setCurrentConfig(store.get());
+ }
+
+ // Define rows for the settings table, including the AutoSaveInput component for the logo URL
+ const settingsRows = [
+ {
+ name: 'Logo URL',
+ value: (
+
+ ),
+ },
+ ];
+
+ // Render the settings component
+ return (
+
+
+
+ );
+}