mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove usages of "bind" utility method for simplicity
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
44a060ff42
commit
3a2633c28d
@ -6,7 +6,6 @@ import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import type { EnsureOptions, WriteOptions } from "fs-extra";
|
||||
import path from "path";
|
||||
import type { JsonValue } from "type-fest";
|
||||
import { bind } from "../utils";
|
||||
import fsInjectable from "./fs.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
@ -14,7 +13,7 @@ interface Dependencies {
|
||||
ensureDir: (dir: string, options?: EnsureOptions | number) => Promise<void>;
|
||||
}
|
||||
|
||||
async function writeJsonFile({ writeJson, ensureDir }: Dependencies, filePath: string, content: JsonValue, options?: WriteOptions | BufferEncoding) {
|
||||
const writeJsonFile = ({ writeJson, ensureDir }: Dependencies) => async (filePath: string, content: JsonValue, options?: WriteOptions | BufferEncoding) => {
|
||||
await ensureDir(path.dirname(filePath), { mode: 0o755 });
|
||||
|
||||
const resolvedOptions = typeof options === "string"
|
||||
@ -28,17 +27,18 @@ async function writeJsonFile({ writeJson, ensureDir }: Dependencies, filePath: s
|
||||
spaces: 2,
|
||||
...resolvedOptions,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const writeJsonFileInjectable = getInjectable({
|
||||
instantiate: (di) => {
|
||||
const { writeJson, ensureDir } = di.inject(fsInjectable);
|
||||
|
||||
return bind(writeJsonFile, null, {
|
||||
return writeJsonFile({
|
||||
writeJson,
|
||||
ensureDir,
|
||||
});
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { orderBy } from "lodash";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { CatalogCategory, CatalogEntity } from "../../../common/catalog";
|
||||
import { bind } from "../../utils";
|
||||
import type { ItemListLayoutProps } from "../item-object-list";
|
||||
import type { RegisteredAdditionalCategoryColumn } from "./custom-category-columns";
|
||||
import categoryColumnsInjectable from "./custom-category-columns.injectable";
|
||||
@ -50,7 +49,7 @@ function getBrowseAllColumns(): RegisteredAdditionalCategoryColumn[] {
|
||||
];
|
||||
}
|
||||
|
||||
function getCategoryColumns({ extensionColumns }: Dependencies, { activeCategory }: GetCategoryColumnsParams): CategoryColumns {
|
||||
const getCategoryColumns = ({ extensionColumns }: Dependencies) => ({ activeCategory }: GetCategoryColumnsParams): CategoryColumns => {
|
||||
const allRegistrations = orderBy(
|
||||
activeCategory
|
||||
? getSpecificCategoryColumns(activeCategory, extensionColumns)
|
||||
@ -83,12 +82,13 @@ function getCategoryColumns({ extensionColumns }: Dependencies, { activeCategory
|
||||
renderTableContents: entity => tableRowRenderers.map(fn => fn(entity)),
|
||||
searchFilters,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const getCategoryColumnsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(getCategoryColumns, null, {
|
||||
instantiate: (di) => getCategoryColumns({
|
||||
extensionColumns: di.inject(categoryColumnsInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -7,14 +7,13 @@ import { requestOpenFilePickingDialog } from "../../ipc";
|
||||
import { supportedExtensionFormats } from "./supported-extension-formats";
|
||||
import attemptInstallsInjectable from "./attempt-installs/attempt-installs.injectable";
|
||||
import directoryForDownloadsInjectable from "../../../common/app-paths/directory-for-downloads/directory-for-downloads.injectable";
|
||||
import { bind } from "../../utils";
|
||||
|
||||
interface Dependencies {
|
||||
attemptInstalls: (filePaths: string[]) => Promise<void>
|
||||
directoryForDownloads: string
|
||||
}
|
||||
|
||||
async function installFromSelectFileDialog({ attemptInstalls, directoryForDownloads }: Dependencies) {
|
||||
const installFromSelectFileDialog = ({ attemptInstalls, directoryForDownloads }: Dependencies) => async () => {
|
||||
const { canceled, filePaths } = await requestOpenFilePickingDialog({
|
||||
defaultPath: directoryForDownloads,
|
||||
properties: ["openFile", "multiSelections"],
|
||||
@ -26,13 +25,14 @@ async function installFromSelectFileDialog({ attemptInstalls, directoryForDownlo
|
||||
if (!canceled) {
|
||||
await attemptInstalls(filePaths);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const installFromSelectFileDialogInjectable = getInjectable({
|
||||
instantiate: (di) => bind(installFromSelectFileDialog, null, {
|
||||
instantiate: (di) => installFromSelectFileDialog({
|
||||
attemptInstalls: di.inject(attemptInstallsInjectable),
|
||||
directoryForDownloads: di.inject(directoryForDownloadsInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,23 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { CreateResourceTabStore } from "./store";
|
||||
import createResourceTabStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
createResourceTabStore: CreateResourceTabStore;
|
||||
}
|
||||
|
||||
function clearCreateResourceTabData({ createResourceTabStore }: Dependencies, tabId: TabId): void {
|
||||
createResourceTabStore.clearData(tabId);
|
||||
}
|
||||
|
||||
const clearCreateResourceTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(clearCreateResourceTabData, null, {
|
||||
createResourceTabStore: di.inject(createResourceTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const createResourceTabStore = di.inject(createResourceTabStoreInjectable);
|
||||
|
||||
return (tabId: TabId): void => {
|
||||
createResourceTabStore.clearData(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,26 +3,20 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import dockStoreInjectable from "../dock/store.injectable";
|
||||
import { DockStore, DockTabCreateSpecific, TabKind } from "../dock/store";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore
|
||||
}
|
||||
|
||||
function createResourceTab({ dockStore }: Dependencies, tabParams: DockTabCreateSpecific = {}) {
|
||||
return dockStore.createTab({
|
||||
title: "Create resource",
|
||||
...tabParams,
|
||||
kind: TabKind.CREATE_RESOURCE,
|
||||
});
|
||||
}
|
||||
import { DockTabCreateSpecific, TabKind } from "../dock/store";
|
||||
|
||||
const createResourceTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createResourceTab, null, {
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const dockStore = di.inject(dockStoreInjectable);
|
||||
|
||||
return (tabParams: DockTabCreateSpecific = {}) =>
|
||||
dockStore.createTab({
|
||||
title: "Create resource",
|
||||
...tabParams,
|
||||
kind: TabKind.CREATE_RESOURCE,
|
||||
});
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
@ -3,22 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { DockStore, TabId } from "./store";
|
||||
import type { TabId } from "./store";
|
||||
import dockStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore;
|
||||
}
|
||||
|
||||
function closeDockTab({ dockStore }: Dependencies, tabId: TabId): void {
|
||||
dockStore.closeTab(tabId);
|
||||
}
|
||||
|
||||
const closeDockTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(closeDockTab, null, {
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const dockStore = di.inject(dockStoreInjectable);
|
||||
|
||||
return (tabId: TabId): void => {
|
||||
dockStore.closeTab(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,17 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import dockStoreInjectable from "./store.injectable";
|
||||
import type { DockStore, DockTab, DockTabCreate } from "./store";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore;
|
||||
}
|
||||
|
||||
function createDockTab({ dockStore }: Dependencies, rawTabDesc: DockTabCreate, addNumber?: boolean): DockTab {
|
||||
return dockStore.createTab(rawTabDesc, addNumber);
|
||||
}
|
||||
import type { DockTab, DockTabCreate } from "./store";
|
||||
|
||||
const createDockTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createDockTab, null, {
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const dockStore = di.inject(dockStoreInjectable);
|
||||
|
||||
return (rawTabDesc: DockTabCreate, addNumber?: boolean): DockTab =>
|
||||
dockStore.createTab(rawTabDesc, addNumber);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import dockStoreInjectable from "./store.injectable";
|
||||
import type { DockStore, TabId } from "./store";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore;
|
||||
}
|
||||
|
||||
function renameTab({ dockStore }: Dependencies, tabId: TabId, title: string): void {
|
||||
dockStore.renameTab(tabId, title);
|
||||
}
|
||||
import type { TabId } from "./store";
|
||||
|
||||
const renameTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(renameTab, null, {
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
|
||||
instantiate: (di) => {
|
||||
const dockStore = di.inject(dockStoreInjectable);
|
||||
|
||||
return (tabId: TabId, title: string): void => {
|
||||
dockStore.renameTab(tabId, title);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { DockStore, TabId } from "./store";
|
||||
import type { TabId } from "./store";
|
||||
import dockStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore;
|
||||
}
|
||||
|
||||
function selectDockTab({ dockStore }: Dependencies, tabId: TabId): void {
|
||||
dockStore.selectTab(tabId);
|
||||
}
|
||||
|
||||
const selectDockTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(selectDockTab, null, {
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const dockStore = di.inject(dockStoreInjectable);
|
||||
|
||||
return (tabId: TabId): void => {
|
||||
dockStore.selectTab(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,23 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { EditResourceTabStore } from "./store";
|
||||
import editResourceTabStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
editResourceTabStore: EditResourceTabStore;
|
||||
}
|
||||
|
||||
function clearEditResourceTabData({ editResourceTabStore }: Dependencies, tabId: TabId) {
|
||||
editResourceTabStore.clearData(tabId);
|
||||
}
|
||||
|
||||
const clearEditResourceTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(clearEditResourceTabData, null, {
|
||||
editResourceTabStore: di.inject(editResourceTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const editResourceTabStore = di.inject(editResourceTabStoreInjectable);
|
||||
|
||||
return (tabId: TabId) => {
|
||||
editResourceTabStore.clearData(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ import dockStoreInjectable from "../dock/store.injectable";
|
||||
import type { KubeObject } from "../../../../common/k8s-api/kube-object";
|
||||
import { DockStore, DockTabCreateSpecific, TabId, TabKind } from "../dock/store";
|
||||
import type { EditResourceTabStore } from "./store";
|
||||
import { bind } from "../../../utils";
|
||||
import { runInAction } from "mobx";
|
||||
|
||||
interface Dependencies {
|
||||
@ -16,7 +15,7 @@ interface Dependencies {
|
||||
editResourceStore: EditResourceTabStore;
|
||||
}
|
||||
|
||||
function createEditResourceTab({ dockStore, editResourceStore }: Dependencies, object: KubeObject, tabParams: DockTabCreateSpecific = {}): TabId {
|
||||
const createEditResourceTab = ({ dockStore, editResourceStore }: Dependencies) => (object: KubeObject, tabParams: DockTabCreateSpecific = {}): TabId => {
|
||||
// use existing tab if already opened
|
||||
const tabId = editResourceStore.getTabIdByResource(object);
|
||||
|
||||
@ -43,10 +42,10 @@ function createEditResourceTab({ dockStore, editResourceStore }: Dependencies, o
|
||||
|
||||
return tab.id;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const createEditResourceTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createEditResourceTab, null, {
|
||||
instantiate: (di) => createEditResourceTab({
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
editResourceStore: di.inject(editResourceTabStoreInjectable),
|
||||
}),
|
||||
|
||||
@ -3,23 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { InstallChartTabStore } from "./store";
|
||||
import installChartTabStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
installChartTabStore: InstallChartTabStore;
|
||||
}
|
||||
|
||||
function clearInstallChartTabData({ installChartTabStore }: Dependencies, tabId: TabId) {
|
||||
installChartTabStore.clearData(tabId);
|
||||
}
|
||||
|
||||
const clearInstallChartTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(clearInstallChartTabData, null, {
|
||||
installChartTabStore: di.inject(installChartTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const installChartTabStore = di.inject(installChartTabStoreInjectable);
|
||||
|
||||
return (tabId: TabId) => {
|
||||
installChartTabStore.clearData(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -5,9 +5,13 @@
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import installChartTabStoreInjectable from "./store.injectable";
|
||||
import type { HelmChart } from "../../../../common/k8s-api/endpoints/helm-charts.api";
|
||||
import { DockTab, DockTabCreate, DockTabCreateSpecific, TabKind } from "../dock/store";
|
||||
import {
|
||||
DockTab,
|
||||
DockTabCreate,
|
||||
DockTabCreateSpecific,
|
||||
TabKind,
|
||||
} from "../dock/store";
|
||||
import type { InstallChartTabStore } from "./store";
|
||||
import { bind } from "../../../utils";
|
||||
import createDockTabInjectable from "../dock/create-dock-tab.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
@ -15,7 +19,7 @@ interface Dependencies {
|
||||
installChartStore: InstallChartTabStore;
|
||||
}
|
||||
|
||||
function createInstallChartTab({ createDockTab, installChartStore }: Dependencies, chart: HelmChart, tabParams: DockTabCreateSpecific = {}) {
|
||||
const createInstallChartTab = ({ createDockTab, installChartStore }: Dependencies) => (chart: HelmChart, tabParams: DockTabCreateSpecific = {}) => {
|
||||
const { name, repo, version } = chart;
|
||||
|
||||
const tab = createDockTab(
|
||||
@ -37,10 +41,10 @@ function createInstallChartTab({ createDockTab, installChartStore }: Dependencie
|
||||
});
|
||||
|
||||
return tab;
|
||||
}
|
||||
};
|
||||
|
||||
const createInstallChartTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createInstallChartTab, null, {
|
||||
instantiate: (di) => createInstallChartTab({
|
||||
installChartStore: di.inject(installChartTabStoreInjectable),
|
||||
createDockTab: di.inject(createDockTabInjectable),
|
||||
}),
|
||||
|
||||
@ -3,23 +3,16 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function areLogsPresent({ logStore }: Dependencies, tabId: TabId) {
|
||||
return logStore.areLogsPresent(tabId);
|
||||
}
|
||||
|
||||
const areLogsPresentInjectable = getInjectable({
|
||||
instantiate: (di) => bind(areLogsPresent, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (tabId: TabId) => logStore.areLogsPresent(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,23 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { LogTabStore } from "./tab-store";
|
||||
import logTabStoreInjectable from "./tab-store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logTabStore: LogTabStore;
|
||||
}
|
||||
|
||||
function clearLogTabData({ logTabStore }: Dependencies, tabId: TabId): void {
|
||||
logTabStore.clearData(tabId);
|
||||
}
|
||||
|
||||
const clearLogTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(clearLogTabData, null, {
|
||||
logTabStore: di.inject(logTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logTabStore = di.inject(logTabStoreInjectable);
|
||||
|
||||
return (tabId: TabId): void => {
|
||||
logTabStore.clearData(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import { DockTabCreate, DockTab, TabKind, TabId } from "../dock/store";
|
||||
import type { LogTabData } from "./tab-store";
|
||||
import * as uuid from "uuid";
|
||||
@ -18,7 +17,7 @@ interface Dependencies {
|
||||
setLogTabData: (tabId: string, data: LogTabData) => void;
|
||||
}
|
||||
|
||||
function createLogsTab({ createDockTab, setLogTabData }: Dependencies, title: string, data: CreateLogsTabData): TabId {
|
||||
const createLogsTab = ({ createDockTab, setLogTabData }: Dependencies) => (title: string, data: CreateLogsTabData): TabId => {
|
||||
const id = `log-tab-${uuid.v4()}`;
|
||||
|
||||
runInAction(() => {
|
||||
@ -35,13 +34,14 @@ function createLogsTab({ createDockTab, setLogTabData }: Dependencies, title: st
|
||||
});
|
||||
|
||||
return id;
|
||||
}
|
||||
};
|
||||
|
||||
const createLogsTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createLogsTab, null, {
|
||||
instantiate: (di) => createLogsTab({
|
||||
createDockTab: di.inject(createDockTabInjectable),
|
||||
setLogTabData: di.inject(setLogTabDataInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,33 +3,28 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import type { Pod, IPodContainer } from "../../../../common/k8s-api/endpoints";
|
||||
import { bind } from "../../../utils";
|
||||
import type { IPodContainer, Pod } from "../../../../common/k8s-api/endpoints";
|
||||
import type { TabId } from "../dock/store";
|
||||
import createLogsTabInjectable, { CreateLogsTabData } from "./create-logs-tab.injectable";
|
||||
import createLogsTabInjectable from "./create-logs-tab.injectable";
|
||||
|
||||
export interface PodLogsTabData {
|
||||
selectedPod: Pod;
|
||||
selectedContainer: IPodContainer;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
createLogsTab: (title: string, data: CreateLogsTabData) => TabId;
|
||||
}
|
||||
|
||||
function createPodLogsTab({ createLogsTab }: Dependencies, { selectedPod, selectedContainer }: PodLogsTabData): TabId {
|
||||
return createLogsTab(`Pod ${selectedPod.getName()}`, {
|
||||
owner: selectedPod.getOwnerRefs()[0],
|
||||
namespace: selectedPod.getNs(),
|
||||
selectedContainer: selectedContainer.name,
|
||||
selectedPodId: selectedPod.getId(),
|
||||
});
|
||||
}
|
||||
|
||||
const createPodLogsTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createPodLogsTab, null, {
|
||||
createLogsTab: di.inject(createLogsTabInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
let createLogsTab = di.inject(createLogsTabInjectable);
|
||||
|
||||
return ({ selectedPod, selectedContainer }: PodLogsTabData): TabId =>
|
||||
createLogsTab(`Pod ${selectedPod.getName()}`, {
|
||||
owner: selectedPod.getOwnerRefs()[0],
|
||||
namespace: selectedPod.getNs(),
|
||||
selectedContainer: selectedContainer.name,
|
||||
selectedPodId: selectedPod.getId(),
|
||||
});
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { podsStore } from "../../+workloads-pods/pods.store";
|
||||
import type { WorkloadKubeObject } from "../../../../common/k8s-api/workload-kube-object";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import createLogsTabInjectable, { CreateLogsTabData } from "./create-logs-tab.injectable";
|
||||
|
||||
@ -17,7 +16,7 @@ interface Dependencies {
|
||||
createLogsTab: (title: string, data: CreateLogsTabData) => TabId;
|
||||
}
|
||||
|
||||
function createWorkloadLogsTab({ createLogsTab }: Dependencies, { workload }: WorkloadLogsTabData): TabId | undefined {
|
||||
const createWorkloadLogsTab = ({ createLogsTab }: Dependencies) => ({ workload }: WorkloadLogsTabData): TabId | undefined => {
|
||||
const pods = podsStore.getPodsByOwnerId(workload.getId());
|
||||
|
||||
if (pods.length === 0) {
|
||||
@ -36,12 +35,13 @@ function createWorkloadLogsTab({ createLogsTab }: Dependencies, { workload }: Wo
|
||||
uid: workload.getId(),
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const createWorkloadLogsTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createWorkloadLogsTab, null, {
|
||||
instantiate: (di) => createWorkloadLogsTab({
|
||||
createLogsTab: di.inject(createLogsTabInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,16 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogTabData, LogTabStore } from "./tab-store";
|
||||
import type { LogTabData } from "./tab-store";
|
||||
import logTabStoreInjectable from "./tab-store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logTabStore: LogTabStore;
|
||||
}
|
||||
|
||||
function getLogTabData({ logTabStore }: Dependencies, tabId: string): LogTabData {
|
||||
return logTabStore.getData(tabId);
|
||||
}
|
||||
|
||||
const getLogTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(getLogTabData, null, {
|
||||
logTabStore: di.inject(logTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logTabStore = di.inject(logTabStoreInjectable);
|
||||
|
||||
return (tabId: string): LogTabData => logTabStore.getData(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,16 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function getLogsWithoutTimestamps({ logStore }: Dependencies, tabId: string): string[] {
|
||||
return logStore.getLogsWithoutTimestamps(tabId);
|
||||
}
|
||||
|
||||
const getLogsWithoutTimestampsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(getLogsWithoutTimestamps, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (tabId: string): string[] =>
|
||||
logStore.getLogsWithoutTimestamps(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,15 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function getLogs({ logStore }: Dependencies, tabId: string): string[] {
|
||||
return logStore.getLogs(tabId);
|
||||
}
|
||||
|
||||
const getLogsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(getLogs, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (tabId: string): string[] => logStore.getLogs(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,16 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function getTimestampSplitLogs({ logStore }: Dependencies, tabId: string): [string, string][] {
|
||||
return logStore.getTimestampSplitLogs(tabId);
|
||||
}
|
||||
|
||||
const getTimestampSplitLogsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(getTimestampSplitLogs, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (tabId: string): [string, string][] =>
|
||||
logStore.getTimestampSplitLogs(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,23 +3,16 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { LogTabStore } from "./tab-store";
|
||||
import logTabStoreInjectable from "./tab-store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logTabStore: LogTabStore;
|
||||
}
|
||||
|
||||
function isLogsTabDataValid({ logTabStore }: Dependencies, tabId: TabId) {
|
||||
return logTabStore.isDataValid(tabId);
|
||||
}
|
||||
|
||||
const isLogsTabDataValidInjectable = getInjectable({
|
||||
instantiate: (di) => bind(isLogsTabDataValid, null, {
|
||||
logTabStore: di.inject(logTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logTabStore = di.inject(logTabStoreInjectable);
|
||||
|
||||
return (tabId: TabId) => logTabStore.isDataValid(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -5,23 +5,20 @@
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { Pod } from "../../../../common/k8s-api/endpoints";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
import type { LogTabData } from "./tab-store";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function loadLogs({ logStore }: Dependencies, tabId: string, pod: IComputedValue<Pod | undefined>, logTabData: IComputedValue<LogTabData>): Promise<void> {
|
||||
return logStore.load(tabId, pod, logTabData);
|
||||
}
|
||||
|
||||
const loadLogsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(loadLogs, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (
|
||||
tabId: string,
|
||||
pod: IComputedValue<Pod | undefined>,
|
||||
logTabData: IComputedValue<LogTabData>,
|
||||
): Promise<void> => logStore.load(tabId, pod, logTabData);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -5,23 +5,20 @@
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { Pod } from "../../../../common/k8s-api/endpoints";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
import type { LogTabData } from "./tab-store";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function reloadLogs({ logStore }: Dependencies, tabId: string, pod: IComputedValue<Pod | undefined>, logTabData: IComputedValue<LogTabData>): Promise<void> {
|
||||
return logStore.reload(tabId, pod, logTabData);
|
||||
}
|
||||
|
||||
const reloadLogsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(reloadLogs, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (
|
||||
tabId: string,
|
||||
pod: IComputedValue<Pod | undefined>,
|
||||
logTabData: IComputedValue<LogTabData>,
|
||||
): Promise<void> => logStore.reload(tabId, pod, logTabData);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,16 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogTabData, LogTabStore } from "./tab-store";
|
||||
import type { LogTabData } from "./tab-store";
|
||||
import logTabStoreInjectable from "./tab-store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logTabStore: LogTabStore;
|
||||
}
|
||||
|
||||
function setLogTabData({ logTabStore }: Dependencies, tabId: string, data: LogTabData): void {
|
||||
return logTabStore.setData(tabId, data);
|
||||
}
|
||||
|
||||
const setLogTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(setLogTabData, null, {
|
||||
logTabStore: di.inject(logTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logTabStore = di.inject(logTabStoreInjectable);
|
||||
|
||||
return (tabId: string, data: LogTabData): void => logTabStore.setData(tabId, data);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,22 +3,15 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { LogStore } from "./store";
|
||||
import logStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
logStore: LogStore;
|
||||
}
|
||||
|
||||
function stopLoadingLogs({ logStore }: Dependencies, tabId: string): void {
|
||||
return logStore.stopLoadingLogs(tabId);
|
||||
}
|
||||
|
||||
const stopLoadingLogsInjectable = getInjectable({
|
||||
instantiate: (di) => bind(stopLoadingLogs, null, {
|
||||
logStore: di.inject(logStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const logStore = di.inject(logStoreInjectable);
|
||||
|
||||
return (tabId: string): void => logStore.stopLoadingLogs(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,23 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { TerminalStore } from "./store";
|
||||
import terminalStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
terminalStore: TerminalStore;
|
||||
}
|
||||
|
||||
function clearTerminalTabData({ terminalStore }: Dependencies, tabId: TabId): void {
|
||||
terminalStore.destroy(tabId);
|
||||
}
|
||||
|
||||
const clearTerminalTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(clearTerminalTabData, null, {
|
||||
terminalStore: di.inject(terminalStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const terminalStore = di.inject(terminalStoreInjectable);
|
||||
|
||||
return (tabId: TabId): void => {
|
||||
terminalStore.destroy(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -4,25 +4,19 @@
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import dockStoreInjectable from "../dock/store.injectable";
|
||||
import { DockStore, DockTabCreateSpecific, TabKind } from "../dock/store";
|
||||
import { bind } from "../../../utils";
|
||||
|
||||
interface Dependencies {
|
||||
dockStore: DockStore;
|
||||
}
|
||||
|
||||
export function createTerminalTab({ dockStore }: Dependencies, tabParams: DockTabCreateSpecific = {}) {
|
||||
return dockStore.createTab({
|
||||
title: `Terminal`,
|
||||
...tabParams,
|
||||
kind: TabKind.TERMINAL,
|
||||
});
|
||||
}
|
||||
import { DockTabCreateSpecific, TabKind } from "../dock/store";
|
||||
|
||||
const createTerminalTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createTerminalTab, null, {
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const dockStore = di.inject(dockStoreInjectable);
|
||||
|
||||
return (tabParams: DockTabCreateSpecific = {}) =>
|
||||
dockStore.createTab({
|
||||
title: `Terminal`,
|
||||
...tabParams,
|
||||
kind: TabKind.TERMINAL,
|
||||
});
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
@ -4,23 +4,16 @@
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import type { TerminalApi } from "../../../api/terminal-api";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { TerminalStore } from "./store";
|
||||
import terminalStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
terminalStore: TerminalStore;
|
||||
}
|
||||
|
||||
function getTerminalApi({ terminalStore }: Dependencies, tabId: TabId): TerminalApi {
|
||||
return terminalStore.getTerminalApi(tabId);
|
||||
}
|
||||
|
||||
const getTerminalApiInjectable = getInjectable({
|
||||
instantiate: (di) => bind(getTerminalApi, null, {
|
||||
terminalStore: di.inject(terminalStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const terminalStore = di.inject(terminalStoreInjectable);
|
||||
|
||||
return (tabId: TabId): TerminalApi => terminalStore.getTerminalApi(tabId);
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { when } from "mobx";
|
||||
import { TerminalApi, TerminalChannels } from "../../../api/terminal-api";
|
||||
import { bind, noop } from "../../../utils";
|
||||
import { noop } from "../../../utils";
|
||||
import { Notifications } from "../../notifications";
|
||||
import selectDockTabInjectable from "../dock/select-dock-tab.injectable";
|
||||
import type { DockTab, TabId } from "../dock/store";
|
||||
@ -35,7 +35,7 @@ export interface SendCommandOptions {
|
||||
tabId?: TabId;
|
||||
}
|
||||
|
||||
async function sendCommand({ selectTab, createTerminalTab, getTerminalApi }: Dependencies, command: string, options: SendCommandOptions = {}): Promise<void> {
|
||||
const sendCommand = ({ selectTab, createTerminalTab, getTerminalApi }: Dependencies) => async (command: string, options: SendCommandOptions = {}): Promise<void> => {
|
||||
let { tabId } = options;
|
||||
|
||||
if (tabId) {
|
||||
@ -76,14 +76,15 @@ async function sendCommand({ selectTab, createTerminalTab, getTerminalApi }: Dep
|
||||
{ tabId, command },
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const sendCommandInjectable = getInjectable({
|
||||
instantiate: (di) => bind(sendCommand, null, {
|
||||
instantiate: (di) => sendCommand({
|
||||
createTerminalTab: di.inject(createTerminalTabInjectable),
|
||||
selectTab: di.inject(selectDockTabInjectable),
|
||||
getTerminalApi: di.inject(getTerminalApiInjectable),
|
||||
}),
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
|
||||
@ -3,25 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||
import { bind } from "../../../utils";
|
||||
import type { TabId } from "../dock/store";
|
||||
import type { UpgradeChartTabStore } from "./store";
|
||||
import upgradeChartTabStoreInjectable from "./store.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
upgradeChartTabStore: UpgradeChartTabStore;
|
||||
}
|
||||
|
||||
function clearUpgradeChartTabData({ upgradeChartTabStore }: Dependencies, tabId: TabId) {
|
||||
upgradeChartTabStore.clearData(tabId);
|
||||
}
|
||||
|
||||
const clearUpgradeChartTabDataInjectable = getInjectable({
|
||||
instantiate: (di) => bind(clearUpgradeChartTabData, null, {
|
||||
upgradeChartTabStore: di.inject(upgradeChartTabStoreInjectable),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
const upgradeChartTabStore = di.inject(upgradeChartTabStoreInjectable);
|
||||
|
||||
return (tabId: TabId) => {
|
||||
upgradeChartTabStore.clearData(tabId);
|
||||
};
|
||||
},
|
||||
|
||||
lifecycle: lifecycleEnum.singleton,
|
||||
});
|
||||
|
||||
export default clearUpgradeChartTabDataInjectable;
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ import dockStoreInjectable from "../dock/store.injectable";
|
||||
import type { HelmRelease } from "../../../../common/k8s-api/endpoints/helm-releases.api";
|
||||
import { DockStore, DockTabCreateSpecific, TabId, TabKind } from "../dock/store";
|
||||
import type { UpgradeChartTabStore } from "./store";
|
||||
import { bind } from "../../../utils";
|
||||
import { runInAction } from "mobx";
|
||||
|
||||
interface Dependencies {
|
||||
@ -16,7 +15,7 @@ interface Dependencies {
|
||||
dockStore: DockStore
|
||||
}
|
||||
|
||||
function createUpgradeChartTab({ upgradeChartStore, dockStore }: Dependencies, release: HelmRelease, tabParams: DockTabCreateSpecific = {}): TabId {
|
||||
const createUpgradeChartTab = ({ upgradeChartStore, dockStore }: Dependencies) => (release: HelmRelease, tabParams: DockTabCreateSpecific = {}): TabId => {
|
||||
const tabId = upgradeChartStore.getTabIdByRelease(release.getName());
|
||||
|
||||
if (tabId) {
|
||||
@ -43,10 +42,10 @@ function createUpgradeChartTab({ upgradeChartStore, dockStore }: Dependencies, r
|
||||
|
||||
return tab.id;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const createUpgradeChartTabInjectable = getInjectable({
|
||||
instantiate: (di) => bind(createUpgradeChartTab, null, {
|
||||
instantiate: (di) => createUpgradeChartTab({
|
||||
upgradeChartStore: di.inject(upgradeChartTabStoreInjectable),
|
||||
dockStore: di.inject(dockStoreInjectable),
|
||||
}),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user