mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix typo to waitUntilDefined
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
d18b84743d
commit
f71f9e9f8f
@ -6,7 +6,7 @@ import type { IComputedValue } from "mobx";
|
|||||||
import { runInAction, when } from "mobx";
|
import { runInAction, when } from "mobx";
|
||||||
import type { Disposer } from "./disposer";
|
import type { Disposer } from "./disposer";
|
||||||
|
|
||||||
export async function waitUntilDefinied<T>(getter: (() => T | null | undefined) | IComputedValue<T | null | undefined>, opts?: { timeout?: number }): Promise<T> {
|
export async function waitUntilDefined<T>(getter: (() => T | null | undefined) | IComputedValue<T | null | undefined>, opts?: { timeout?: number }): Promise<T> {
|
||||||
return new Promise<T>((resolve, reject) => {
|
return new Promise<T>((resolve, reject) => {
|
||||||
let res: T | null | undefined;
|
let res: T | null | undefined;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import { getRelease } from "../../../../common/k8s-api/endpoints/helm-releases.api";
|
import { getRelease } from "../../../../common/k8s-api/endpoints/helm-releases.api";
|
||||||
import { asyncComputed } from "@ogre-tools/injectable-react";
|
import { asyncComputed } from "@ogre-tools/injectable-react";
|
||||||
import releaseInjectable from "./release.injectable";
|
import releaseInjectable from "./release.injectable";
|
||||||
import { waitUntilDefinied } from "../../../utils";
|
import { waitUntilDefined } from "../../../utils";
|
||||||
|
|
||||||
const releaseDetailsInjectable = getInjectable({
|
const releaseDetailsInjectable = getInjectable({
|
||||||
id: "release-details",
|
id: "release-details",
|
||||||
@ -15,7 +15,7 @@ const releaseDetailsInjectable = getInjectable({
|
|||||||
const releaseComputed = di.inject(releaseInjectable);
|
const releaseComputed = di.inject(releaseInjectable);
|
||||||
|
|
||||||
return asyncComputed(async () => {
|
return asyncComputed(async () => {
|
||||||
const release = await waitUntilDefinied(releaseComputed);
|
const release = await waitUntilDefined(releaseComputed);
|
||||||
|
|
||||||
return getRelease(release.name, release.namespace);
|
return getRelease(release.name, release.namespace);
|
||||||
});},
|
});},
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import type { DockTabStoreDependencies } from "../dock-tab-store/dock-tab.store"
|
|||||||
import { DockTabStore } from "../dock-tab-store/dock-tab.store";
|
import { DockTabStore } from "../dock-tab-store/dock-tab.store";
|
||||||
import { getChartDetails, getChartValues } from "../../../../common/k8s-api/endpoints/helm-charts.api";
|
import { getChartDetails, getChartValues } from "../../../../common/k8s-api/endpoints/helm-charts.api";
|
||||||
import type { HelmReleaseUpdateDetails } from "../../../../common/k8s-api/endpoints/helm-releases.api";
|
import type { HelmReleaseUpdateDetails } from "../../../../common/k8s-api/endpoints/helm-releases.api";
|
||||||
import { waitUntilDefinied } from "../../../../common/utils/wait";
|
import { waitUntilDefined } from "../../../../common/utils/wait";
|
||||||
|
|
||||||
export interface IChartInstallData {
|
export interface IChartInstallData {
|
||||||
name: string;
|
name: string;
|
||||||
@ -44,7 +44,7 @@ export class InstallChartTabStore extends DockTabStore<IChartInstallData> {
|
|||||||
@action
|
@action
|
||||||
async loadData(tabId: string) {
|
async loadData(tabId: string) {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
const data = await waitUntilDefinied(() => this.getData(tabId));
|
const data = await waitUntilDefined(() => this.getData(tabId));
|
||||||
|
|
||||||
if (!this.getData(tabId)?.values) {
|
if (!this.getData(tabId)?.values) {
|
||||||
promises.push(this.loadValues(tabId));
|
promises.push(this.loadValues(tabId));
|
||||||
@ -68,7 +68,7 @@ export class InstallChartTabStore extends DockTabStore<IChartInstallData> {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
async loadValues(tabId: TabId, attempt = 0): Promise<void> {
|
async loadValues(tabId: TabId, attempt = 0): Promise<void> {
|
||||||
const data = await waitUntilDefinied(() => this.getData(tabId));
|
const data = await waitUntilDefined(() => this.getData(tabId));
|
||||||
const { repo, name, version } = data;
|
const { repo, name, version } = data;
|
||||||
const values = await getChartValues(repo, name, version);
|
const values = await getChartValues(repo, name, version);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import { observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
import type { PodLogsQuery, Pod } from "../../../../common/k8s-api/endpoints";
|
import type { PodLogsQuery, Pod } from "../../../../common/k8s-api/endpoints";
|
||||||
import { waitUntilDefinied } from "../../../../common/utils/wait";
|
import { waitUntilDefined } from "../../../../common/utils/wait";
|
||||||
import type { IntervalFn } from "../../../utils";
|
import type { IntervalFn } from "../../../utils";
|
||||||
import { getOrInsertWith, interval } from "../../../utils";
|
import { getOrInsertWith, interval } from "../../../utils";
|
||||||
import type { TabId } from "../dock/store";
|
import type { TabId } from "../dock/store";
|
||||||
@ -117,7 +117,7 @@ export class LogStore {
|
|||||||
selectedContainer,
|
selectedContainer,
|
||||||
showPrevious,
|
showPrevious,
|
||||||
},
|
},
|
||||||
} = await waitUntilDefinied(() => {
|
} = await waitUntilDefined(() => {
|
||||||
const pod = computedPod.get();
|
const pod = computedPod.get();
|
||||||
const tabData = logTabData.get();
|
const tabData = logTabData.get();
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { when } from "mobx";
|
import { when } from "mobx";
|
||||||
import { waitUntilDefinied } from "../../../../common/utils/wait";
|
import { waitUntilDefined } from "../../../../common/utils/wait";
|
||||||
import type { TerminalApi } from "../../../api/terminal-api";
|
import type { TerminalApi } from "../../../api/terminal-api";
|
||||||
import { TerminalChannels } from "../../../api/terminal-api";
|
import { TerminalChannels } from "../../../api/terminal-api";
|
||||||
import { noop } from "../../../utils";
|
import { noop } from "../../../utils";
|
||||||
@ -46,7 +46,7 @@ const sendCommand = ({ selectTab, createTerminalTab, getTerminalApi }: Dependenc
|
|||||||
tabId = createTerminalTab().id;
|
tabId = createTerminalTab().id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const terminalApi = await waitUntilDefinied(() => (
|
const terminalApi = await waitUntilDefined(() => (
|
||||||
tabId
|
tabId
|
||||||
? getTerminalApi(tabId)
|
? getTerminalApi(tabId)
|
||||||
: undefined
|
: undefined
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user