mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Adding LogTabStore Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Adding Pod selector in logs tab Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Refresh containers on pod change Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Adding <LogResourceSelector /> tests Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Adding LogTabStore tests Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Clearn getPodsByOwnerId method Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Extracting dummy pods into mock file Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Eliminating containers and initContainers from store Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Refreshing tab pods if pod amount is changed in store Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * A bit of cleaning up, fixing tests Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Fix lint newline errors Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Return getPodsByOwner() method Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Rename log tab when pod changes Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import React, { Fragment } from "react";
|
|
|
|
import { Icon } from "../icon";
|
|
import { Tabs } from "../tabs/tabs";
|
|
import { isCreateResourceTab } from "./create-resource.store";
|
|
import { DockTab } from "./dock-tab";
|
|
import { IDockTab } from "./dock.store";
|
|
import { isEditResourceTab } from "./edit-resource.store";
|
|
import { isInstallChartTab } from "./install-chart.store";
|
|
import { isLogsTab } from "./log-tab.store";
|
|
import { TerminalTab } from "./terminal-tab";
|
|
import { isTerminalTab } from "./terminal.store";
|
|
import { isUpgradeChartTab } from "./upgrade-chart.store";
|
|
|
|
interface Props {
|
|
tabs: IDockTab[]
|
|
autoFocus: boolean
|
|
selectedTab: IDockTab
|
|
onChangeTab: (tab: IDockTab) => void
|
|
}
|
|
|
|
export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) => {
|
|
const renderTab = (tab: IDockTab) => {
|
|
if (isTerminalTab(tab)) {
|
|
return <TerminalTab value={tab} />;
|
|
}
|
|
|
|
if (isCreateResourceTab(tab) || isEditResourceTab(tab)) {
|
|
return <DockTab value={tab} icon="edit" />;
|
|
}
|
|
|
|
if (isInstallChartTab(tab) || isUpgradeChartTab(tab)) {
|
|
return <DockTab value={tab} icon={<Icon svg="install" />} />;
|
|
}
|
|
|
|
if (isLogsTab(tab)) {
|
|
return <DockTab value={tab} icon="subject" />;
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Tabs
|
|
className="DockTabs"
|
|
autoFocus={autoFocus}
|
|
value={selectedTab}
|
|
onChange={onChangeTab}
|
|
>
|
|
{tabs.map(tab => <Fragment key={tab.id}>{renderTab(tab)}</Fragment>)}
|
|
</Tabs>
|
|
);
|
|
};
|