1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+preferences/get-extension-preference-items.ts
Alex Andreev 0784085bf4
Show extension preferences in separate page (#5284)
Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
2022-06-21 11:11:31 -04:00

25 lines
821 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
import type { RegisteredAppPreference } from "./app-preferences/app-preference-registration";
export function getExtensionPreferenceItems(extension?: LensRendererExtension, tabId?: string): RegisteredAppPreference[] {
if (!extension) {
return [];
}
const preferences = extension.appPreferences.map(preference => ({
id: preference.id || preference.title,
...preference,
}));
if (tabId) {
return preferences.filter(preference => preference.showInPreferencesTab == tabId);
}
return preferences.filter(preference => !preference.showInPreferencesTab);
}