mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Change names to better ones and add more documentation
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
5a878ccffb
commit
62a7ab2b5a
@ -24,7 +24,7 @@ import { fireEvent, render } from "@testing-library/react";
|
|||||||
import "@testing-library/jest-dom/extend-expect";
|
import "@testing-library/jest-dom/extend-expect";
|
||||||
|
|
||||||
import { DockTabs } from "../dock-tabs";
|
import { DockTabs } from "../dock-tabs";
|
||||||
import { dockStore, DockTabDescriptor, TabKind } from "../dock.store";
|
import { dockStore, DockTab, TabKind } from "../dock.store";
|
||||||
import { noop } from "../../../utils";
|
import { noop } from "../../../utils";
|
||||||
|
|
||||||
jest.mock("electron", () => ({
|
jest.mock("electron", () => ({
|
||||||
@ -33,7 +33,7 @@ jest.mock("electron", () => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const initialTabs: DockTabDescriptor[] = [
|
const initialTabs: DockTab[] = [
|
||||||
{ id: "terminal", kind: TabKind.TERMINAL, title: "Terminal", pinned: false, },
|
{ id: "terminal", kind: TabKind.TERMINAL, title: "Terminal", pinned: false, },
|
||||||
{ id: "create", kind: TabKind.CREATE_RESOURCE, title: "Create resource", pinned: false, },
|
{ id: "create", kind: TabKind.CREATE_RESOURCE, title: "Create resource", pinned: false, },
|
||||||
{ id: "edit", kind: TabKind.EDIT_RESOURCE, title: "Edit resource", pinned: false, },
|
{ id: "edit", kind: TabKind.EDIT_RESOURCE, title: "Edit resource", pinned: false, },
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import filehound from "filehound";
|
|||||||
import { watch } from "chokidar";
|
import { watch } from "chokidar";
|
||||||
import { autoBind } from "../../utils";
|
import { autoBind } from "../../utils";
|
||||||
import { DockTabStore } from "./dock-tab.store";
|
import { DockTabStore } from "./dock-tab.store";
|
||||||
import { dockStore, SpecializedCreateDockTabDescriptor, TabKind } from "./dock.store";
|
import { dockStore, DockTabCreateSpecific, TabKind } from "./dock.store";
|
||||||
|
|
||||||
export class CreateResourceStore extends DockTabStore<string> {
|
export class CreateResourceStore extends DockTabStore<string> {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -81,7 +81,7 @@ export class CreateResourceStore extends DockTabStore<string> {
|
|||||||
|
|
||||||
export const createResourceStore = new CreateResourceStore();
|
export const createResourceStore = new CreateResourceStore();
|
||||||
|
|
||||||
export function createResourceTab(tabParams: SpecializedCreateDockTabDescriptor = {}) {
|
export function createResourceTab(tabParams: DockTabCreateSpecific = {}) {
|
||||||
return dockStore.createTab({
|
return dockStore.createTab({
|
||||||
title: "Create resource",
|
title: "Create resource",
|
||||||
...tabParams,
|
...tabParams,
|
||||||
|
|||||||
@ -30,7 +30,7 @@ import { observable, makeObservable } from "mobx";
|
|||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import { createResourceStore } from "./create-resource.store";
|
import { createResourceStore } from "./create-resource.store";
|
||||||
import type { DockTabDescriptor } from "./dock.store";
|
import type { DockTab } from "./dock.store";
|
||||||
import { EditorPanel } from "./editor-panel";
|
import { EditorPanel } from "./editor-panel";
|
||||||
import { InfoPanel } from "./info-panel";
|
import { InfoPanel } from "./info-panel";
|
||||||
import { resourceApplierApi } from "../../api/endpoints/resource-applier.api";
|
import { resourceApplierApi } from "../../api/endpoints/resource-applier.api";
|
||||||
@ -39,7 +39,7 @@ import { Notifications } from "../notifications";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
tab: DockTabDescriptor;
|
tab: DockTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
@ -24,13 +24,13 @@ import "./dock-tab.scss";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { boundMethod, cssNames, prevDefault, isMiddleClick } from "../../utils";
|
import { boundMethod, cssNames, prevDefault, isMiddleClick } from "../../utils";
|
||||||
import { dockStore, DockTabDescriptor } from "./dock.store";
|
import { dockStore, DockTab as DockTabModel } from "./dock.store";
|
||||||
import { Tab, TabProps } from "../tabs";
|
import { Tab, TabProps } from "../tabs";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Menu, MenuItem } from "../menu";
|
import { Menu, MenuItem } from "../menu";
|
||||||
import { observable, makeObservable } from "mobx";
|
import { observable, makeObservable } from "mobx";
|
||||||
|
|
||||||
export interface DockTabProps extends TabProps<DockTabDescriptor> {
|
export interface DockTabProps extends TabProps<DockTabModel> {
|
||||||
moreActions?: React.ReactNode;
|
moreActions?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,19 +24,19 @@ import React, { Fragment } from "react";
|
|||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Tabs } from "../tabs/tabs";
|
import { Tabs } from "../tabs/tabs";
|
||||||
import { DockTab } from "./dock-tab";
|
import { DockTab } from "./dock-tab";
|
||||||
import type { DockTabDescriptor } from "./dock.store";
|
import type { DockTab as DockTabModel } from "./dock.store";
|
||||||
import { TabKind } from "./dock.store";
|
import { TabKind } from "./dock.store";
|
||||||
import { TerminalTab } from "./terminal-tab";
|
import { TerminalTab } from "./terminal-tab";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tabs: DockTabDescriptor[]
|
tabs: DockTabModel[]
|
||||||
autoFocus: boolean
|
autoFocus: boolean
|
||||||
selectedTab: DockTabDescriptor
|
selectedTab: DockTabModel
|
||||||
onChangeTab: (tab: DockTabDescriptor) => void
|
onChangeTab: (tab: DockTabModel) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) => {
|
export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) => {
|
||||||
const renderTab = (tab?: DockTabDescriptor) => {
|
const renderTab = (tab?: DockTabModel) => {
|
||||||
if (!tab) {
|
if (!tab) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,24 +35,55 @@ export enum TabKind {
|
|||||||
POD_LOGS = "pod-logs",
|
POD_LOGS = "pod-logs",
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DockTabDescriptor {
|
/**
|
||||||
id: TabId;
|
* This is the storage model for dock tabs.
|
||||||
kind: TabKind;
|
*
|
||||||
title: string;
|
* All fields are required.
|
||||||
pinned: boolean; // not closable
|
*/
|
||||||
|
export type DockTab = Required<DockTabCreate>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These are the arguments for creating a new Tab on the dock
|
||||||
|
*/
|
||||||
|
export interface DockTabCreate {
|
||||||
|
/**
|
||||||
|
* The ID of the tab for reference purposes.
|
||||||
|
*/
|
||||||
|
id?: TabId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DockTabData may contain extra data
|
* What kind of dock tab it is
|
||||||
|
*/
|
||||||
|
kind: TabKind;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tab's title, defaults to `kind`
|
||||||
|
*/
|
||||||
|
title?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true then the dock entry will take up the whole view and will not be
|
||||||
|
* closable.
|
||||||
|
*/
|
||||||
|
pinned?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extra fields are supported.
|
||||||
*/
|
*/
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CreateDockTabDescriptor = Partial<Omit<DockTabDescriptor, "kind">> & Pick<DockTabDescriptor, "kind">;
|
/**
|
||||||
export type SpecializedCreateDockTabDescriptor = Omit<CreateDockTabDescriptor, "kind">;
|
* This type is for function which specifically create a single type of dock tab.
|
||||||
|
*
|
||||||
|
* That way users should get a type error if they try and specify a `kind`
|
||||||
|
* themselves.
|
||||||
|
*/
|
||||||
|
export type DockTabCreateSpecific = Omit<DockTabCreate, "kind">;
|
||||||
|
|
||||||
export interface DockStorageState {
|
export interface DockStorageState {
|
||||||
height: number;
|
height: number;
|
||||||
tabs: DockTabDescriptor[];
|
tabs: DockTab[];
|
||||||
selectedTabId?: TabId;
|
selectedTabId?: TabId;
|
||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
}
|
}
|
||||||
@ -96,11 +127,11 @@ export class DockStore implements DockStorageState {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get tabs(): DockTabDescriptor[] {
|
get tabs(): DockTab[] {
|
||||||
return this.storage.get().tabs;
|
return this.storage.get().tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
set tabs(tabs: DockTabDescriptor[]) {
|
set tabs(tabs: DockTab[]) {
|
||||||
this.storage.merge({ tabs });
|
this.storage.merge({ tabs });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +230,7 @@ export class DockStore implements DockStorageState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
createTab(rawTabDesc: CreateDockTabDescriptor, addNumber = true): DockTabDescriptor {
|
createTab(rawTabDesc: DockTabCreate, addNumber = true): DockTab {
|
||||||
const {
|
const {
|
||||||
id = uuid.v4(),
|
id = uuid.v4(),
|
||||||
kind,
|
kind,
|
||||||
@ -216,7 +247,7 @@ export class DockStore implements DockStorageState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tab: DockTabDescriptor = {
|
const tab: DockTab = {
|
||||||
...restOfTabFields,
|
...restOfTabFields,
|
||||||
id,
|
id,
|
||||||
kind,
|
kind,
|
||||||
@ -258,7 +289,7 @@ export class DockStore implements DockStorageState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeTabs(tabs: DockTabDescriptor[]) {
|
closeTabs(tabs: DockTab[]) {
|
||||||
tabs.forEach(tab => this.closeTab(tab.id));
|
tabs.forEach(tab => this.closeTab(tab.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import { ResizeDirection, ResizingAnchor } from "../resizing-anchor";
|
|||||||
import { CreateResource } from "./create-resource";
|
import { CreateResource } from "./create-resource";
|
||||||
import { createResourceTab } from "./create-resource.store";
|
import { createResourceTab } from "./create-resource.store";
|
||||||
import { DockTabs } from "./dock-tabs";
|
import { DockTabs } from "./dock-tabs";
|
||||||
import { dockStore, DockTabDescriptor, TabKind } from "./dock.store";
|
import { dockStore, DockTab, TabKind } from "./dock.store";
|
||||||
import { EditResource } from "./edit-resource";
|
import { EditResource } from "./edit-resource";
|
||||||
import { InstallChart } from "./install-chart";
|
import { InstallChart } from "./install-chart";
|
||||||
import { Logs } from "./logs";
|
import { Logs } from "./logs";
|
||||||
@ -62,14 +62,14 @@ export class Dock extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onChangeTab = (tab: DockTabDescriptor) => {
|
onChangeTab = (tab: DockTab) => {
|
||||||
const { open, selectTab } = dockStore;
|
const { open, selectTab } = dockStore;
|
||||||
|
|
||||||
open();
|
open();
|
||||||
selectTab(tab.id);
|
selectTab(tab.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderTab(tab: DockTabDescriptor) {
|
renderTab(tab: DockTab) {
|
||||||
switch (tab.kind) {
|
switch (tab.kind) {
|
||||||
case TabKind.CREATE_RESOURCE:
|
case TabKind.CREATE_RESOURCE:
|
||||||
return <CreateResource tab={tab} />;
|
return <CreateResource tab={tab} />;
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
import { autoBind, noop } from "../../utils";
|
import { autoBind, noop } from "../../utils";
|
||||||
import { DockTabStore } from "./dock-tab.store";
|
import { DockTabStore } from "./dock-tab.store";
|
||||||
import { autorun, IReactionDisposer } from "mobx";
|
import { autorun, IReactionDisposer } from "mobx";
|
||||||
import { dockStore, DockTabDescriptor, SpecializedCreateDockTabDescriptor, TabId, TabKind } from "./dock.store";
|
import { dockStore, DockTab, DockTabCreateSpecific, TabId, TabKind } from "./dock.store";
|
||||||
import type { KubeObject } from "../../api/kube-object";
|
import type { KubeObject } from "../../api/kube-object";
|
||||||
import { apiManager } from "../../api/api-manager";
|
import { apiManager } from "../../api/api-manager";
|
||||||
import type { KubeObjectStore } from "../../kube-object.store";
|
import type { KubeObjectStore } from "../../kube-object.store";
|
||||||
@ -96,7 +96,7 @@ export class EditResourceStore extends DockTabStore<EditingResource> {
|
|||||||
return this.getData(tabId)?.resource;
|
return this.getData(tabId)?.resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTabByResource(object: KubeObject): DockTabDescriptor {
|
getTabByResource(object: KubeObject): DockTab {
|
||||||
const [tabId] = Array.from(this.data).find(([, { resource }]) => {
|
const [tabId] = Array.from(this.data).find(([, { resource }]) => {
|
||||||
return object.selfLink === resource;
|
return object.selfLink === resource;
|
||||||
}) || [];
|
}) || [];
|
||||||
@ -115,7 +115,7 @@ export class EditResourceStore extends DockTabStore<EditingResource> {
|
|||||||
|
|
||||||
export const editResourceStore = new EditResourceStore();
|
export const editResourceStore = new EditResourceStore();
|
||||||
|
|
||||||
export function editResourceTab(object: KubeObject, tabParams: SpecializedCreateDockTabDescriptor = {}) {
|
export function editResourceTab(object: KubeObject, tabParams: DockTabCreateSpecific = {}) {
|
||||||
// use existing tab if already opened
|
// use existing tab if already opened
|
||||||
let tab = editResourceStore.getTabByResource(object);
|
let tab = editResourceStore.getTabByResource(object);
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import React from "react";
|
|||||||
import { action, computed, makeObservable, observable } from "mobx";
|
import { action, computed, makeObservable, observable } from "mobx";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import jsYaml from "js-yaml";
|
import jsYaml from "js-yaml";
|
||||||
import type { DockTabDescriptor } from "./dock.store";
|
import type { DockTab } from "./dock.store";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import { editResourceStore } from "./edit-resource.store";
|
import { editResourceStore } from "./edit-resource.store";
|
||||||
import { InfoPanel } from "./info-panel";
|
import { InfoPanel } from "./info-panel";
|
||||||
@ -36,7 +36,7 @@ import type { KubeObject } from "../../api/kube-object";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
tab: DockTabDescriptor;
|
tab: DockTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { action, autorun, makeObservable } from "mobx";
|
import { action, autorun, makeObservable } from "mobx";
|
||||||
import { dockStore, SpecializedCreateDockTabDescriptor, TabId, TabKind } from "./dock.store";
|
import { dockStore, DockTabCreateSpecific, TabId, TabKind } from "./dock.store";
|
||||||
import { DockTabStore } from "./dock-tab.store";
|
import { DockTabStore } from "./dock-tab.store";
|
||||||
import { getChartDetails, getChartValues, HelmChart } from "../../api/endpoints/helm-charts.api";
|
import { getChartDetails, getChartValues, HelmChart } from "../../api/endpoints/helm-charts.api";
|
||||||
import type { IReleaseUpdateDetails } from "../../api/endpoints/helm-releases.api";
|
import type { IReleaseUpdateDetails } from "../../api/endpoints/helm-releases.api";
|
||||||
@ -98,7 +98,7 @@ export class InstallChartStore extends DockTabStore<IChartInstallData> {
|
|||||||
|
|
||||||
export const installChartStore = new InstallChartStore();
|
export const installChartStore = new InstallChartStore();
|
||||||
|
|
||||||
export function createInstallChartTab(chart: HelmChart, tabParams: SpecializedCreateDockTabDescriptor = {}) {
|
export function createInstallChartTab(chart: HelmChart, tabParams: DockTabCreateSpecific = {}) {
|
||||||
const { name, repo, version } = chart;
|
const { name, repo, version } = chart;
|
||||||
const tab = dockStore.createTab({
|
const tab = dockStore.createTab({
|
||||||
title: `Helm Install: ${repo}/${name}`,
|
title: `Helm Install: ${repo}/${name}`,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import "./install-chart.scss";
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { observable, makeObservable } from "mobx";
|
import { observable, makeObservable } from "mobx";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { dockStore, DockTabDescriptor } from "./dock.store";
|
import { dockStore, DockTab } from "./dock.store";
|
||||||
import { InfoPanel } from "./info-panel";
|
import { InfoPanel } from "./info-panel";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { NamespaceSelect } from "../+namespaces/namespace-select";
|
import { NamespaceSelect } from "../+namespaces/namespace-select";
|
||||||
@ -42,7 +42,7 @@ import { navigate } from "../../navigation";
|
|||||||
import { releaseURL } from "../../../common/routes";
|
import { releaseURL } from "../../../common/routes";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tab: DockTabDescriptor;
|
tab: DockTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import { podsStore } from "../+workloads-pods/pods.store";
|
|||||||
import { IPodContainer, Pod } from "../../api/endpoints";
|
import { IPodContainer, Pod } from "../../api/endpoints";
|
||||||
import type { WorkloadKubeObject } from "../../api/workload-kube-object";
|
import type { WorkloadKubeObject } from "../../api/workload-kube-object";
|
||||||
import { DockTabStore } from "./dock-tab.store";
|
import { DockTabStore } from "./dock-tab.store";
|
||||||
import { dockStore, SpecializedCreateDockTabDescriptor, TabKind } from "./dock.store";
|
import { dockStore, DockTabCreateSpecific, TabKind } from "./dock.store";
|
||||||
|
|
||||||
export interface LogTabData {
|
export interface LogTabData {
|
||||||
pods: Pod[];
|
pods: Pod[];
|
||||||
@ -90,7 +90,7 @@ export class LogTabStore extends DockTabStore<LogTabData> {
|
|||||||
dockStore.renameTab(tabId, `Pod ${selectedPod.metadata.name}`);
|
dockStore.renameTab(tabId, `Pod ${selectedPod.metadata.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private createDockTab(tabParams: SpecializedCreateDockTabDescriptor) {
|
private createDockTab(tabParams: DockTabCreateSpecific) {
|
||||||
dockStore.createTab({
|
dockStore.createTab({
|
||||||
...tabParams,
|
...tabParams,
|
||||||
kind: TabKind.POD_LOGS,
|
kind: TabKind.POD_LOGS,
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import { disposeOnUnmount, observer } from "mobx-react";
|
|||||||
|
|
||||||
import { searchStore } from "../../../common/search-store";
|
import { searchStore } from "../../../common/search-store";
|
||||||
import { boundMethod } from "../../utils";
|
import { boundMethod } from "../../utils";
|
||||||
import type { DockTabDescriptor } from "./dock.store";
|
import type { DockTab } from "./dock.store";
|
||||||
import { InfoPanel } from "./info-panel";
|
import { InfoPanel } from "./info-panel";
|
||||||
import { LogResourceSelector } from "./log-resource-selector";
|
import { LogResourceSelector } from "./log-resource-selector";
|
||||||
import { LogList } from "./log-list";
|
import { LogList } from "./log-list";
|
||||||
@ -36,7 +36,7 @@ import { LogTabData, logTabStore } from "./log-tab.store";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string
|
className?: string
|
||||||
tab: DockTabDescriptor
|
tab: DockTab
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
@ -25,14 +25,14 @@ import React from "react";
|
|||||||
import { reaction } from "mobx";
|
import { reaction } from "mobx";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import type { DockTabDescriptor } from "./dock.store";
|
import type { DockTab } from "./dock.store";
|
||||||
import type { Terminal } from "./terminal";
|
import type { Terminal } from "./terminal";
|
||||||
import { terminalStore } from "./terminal.store";
|
import { terminalStore } from "./terminal.store";
|
||||||
import { ThemeStore } from "../../theme.store";
|
import { ThemeStore } from "../../theme.store";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
tab: DockTabDescriptor;
|
tab: DockTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
@ -23,14 +23,14 @@ import { autorun, observable } from "mobx";
|
|||||||
import { autoBind } from "../../utils";
|
import { autoBind } from "../../utils";
|
||||||
import { Terminal } from "./terminal";
|
import { Terminal } from "./terminal";
|
||||||
import { TerminalApi } from "../../api/terminal-api";
|
import { TerminalApi } from "../../api/terminal-api";
|
||||||
import { dockStore, DockTabDescriptor, SpecializedCreateDockTabDescriptor, TabId, TabKind } from "./dock.store";
|
import { dockStore, DockTab, DockTabCreateSpecific, TabId, TabKind } from "./dock.store";
|
||||||
import { WebSocketApiState } from "../../api/websocket-api";
|
import { WebSocketApiState } from "../../api/websocket-api";
|
||||||
|
|
||||||
export interface ITerminalTab extends DockTabDescriptor {
|
export interface ITerminalTab extends DockTab {
|
||||||
node?: string; // activate node shell mode
|
node?: string; // activate node shell mode
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTerminalTab(tabParams: SpecializedCreateDockTabDescriptor = {}) {
|
export function createTerminalTab(tabParams: DockTabCreateSpecific = {}) {
|
||||||
return dockStore.createTab({
|
return dockStore.createTab({
|
||||||
title: `Terminal`,
|
title: `Terminal`,
|
||||||
...tabParams,
|
...tabParams,
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { action, autorun, computed, IReactionDisposer, reaction, makeObservable } from "mobx";
|
import { action, autorun, computed, IReactionDisposer, reaction, makeObservable } from "mobx";
|
||||||
import { dockStore, DockTabDescriptor, SpecializedCreateDockTabDescriptor, TabId, TabKind } from "./dock.store";
|
import { dockStore, DockTab, DockTabCreateSpecific, TabId, TabKind } from "./dock.store";
|
||||||
import { DockTabStore } from "./dock-tab.store";
|
import { DockTabStore } from "./dock-tab.store";
|
||||||
import { getReleaseValues, HelmRelease } from "../../api/endpoints/helm-releases.api";
|
import { getReleaseValues, HelmRelease } from "../../api/endpoints/helm-releases.api";
|
||||||
import { releaseStore } from "../+apps-releases/release.store";
|
import { releaseStore } from "../+apps-releases/release.store";
|
||||||
@ -120,14 +120,14 @@ export class UpgradeChartStore extends DockTabStore<IChartUpgradeData> {
|
|||||||
this.values.setData(tabId, values);
|
this.values.setData(tabId, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTabByRelease(releaseName: string): DockTabDescriptor {
|
getTabByRelease(releaseName: string): DockTab {
|
||||||
return dockStore.getTabById(this.releaseNameReverseLookup.get(releaseName));
|
return dockStore.getTabById(this.releaseNameReverseLookup.get(releaseName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const upgradeChartStore = new UpgradeChartStore();
|
export const upgradeChartStore = new UpgradeChartStore();
|
||||||
|
|
||||||
export function createUpgradeChartTab(release: HelmRelease, tabParams: SpecializedCreateDockTabDescriptor = {}) {
|
export function createUpgradeChartTab(release: HelmRelease, tabParams: DockTabCreateSpecific = {}) {
|
||||||
let tab = upgradeChartStore.getTabByRelease(release.getName());
|
let tab = upgradeChartStore.getTabByRelease(release.getName());
|
||||||
|
|
||||||
if (tab) {
|
if (tab) {
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import React from "react";
|
|||||||
import { observable, reaction, makeObservable } from "mobx";
|
import { observable, reaction, makeObservable } from "mobx";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import type { DockTabDescriptor } from "./dock.store";
|
import type { DockTab } from "./dock.store";
|
||||||
import { InfoPanel } from "./info-panel";
|
import { InfoPanel } from "./info-panel";
|
||||||
import { upgradeChartStore } from "./upgrade-chart.store";
|
import { upgradeChartStore } from "./upgrade-chart.store";
|
||||||
import { Spinner } from "../spinner";
|
import { Spinner } from "../spinner";
|
||||||
@ -38,7 +38,7 @@ import { Select, SelectOption } from "../select";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
tab: DockTabDescriptor;
|
tab: DockTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user