mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
remove oddity of KubeObjectStore.getById(undefined) being allowed
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
3252dfc7f1
commit
a0f22d642d
@ -157,7 +157,7 @@ export abstract class KubeObjectStore<
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getById(id: string | undefined): K | undefined {
|
getById(id: string): K | undefined {
|
||||||
return this.items.find(item => item.getId() === id);
|
return this.items.find(item => item.getId() === id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -109,8 +109,8 @@ export const logTabStore = asLegacyGlobalObjectForExtensionApiWithModifications(
|
|||||||
createPodTab: asLegacyGlobalFunctionForExtensionApi(createPodLogsTabInjectable),
|
createPodTab: asLegacyGlobalFunctionForExtensionApi(createPodLogsTabInjectable),
|
||||||
createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(createWorkloadLogsTabInjectable),
|
createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(createWorkloadLogsTabInjectable),
|
||||||
renameTab: (tabId: string): void => {
|
renameTab: (tabId: string): void => {
|
||||||
const tabData = logTabStore.getData(tabId);
|
const { selectedPodId } = logTabStore.getData(tabId) ?? {};
|
||||||
const pod = podStore.getById(tabData?.selectedPodId);
|
const pod = selectedPodId && podStore.getById(selectedPodId);
|
||||||
|
|
||||||
if (pod) {
|
if (pod) {
|
||||||
renameTab(tabId, `Pod ${pod.getName()}`);
|
renameTab(tabId, `Pod ${pod.getName()}`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user