mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com> Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
25 lines
821 B
TypeScript
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);
|
|
}
|