mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Release 6.1.13 Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix kubeconfig-sync sometimes producing multiple identical entities (#5855) Signed-off-by: Sebastian Malton <sebastian@malton.name> * Require milestones on PRs before merging (#6431) * Require milestones on PRs before merging Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix AppImage windows not showing the application icon (#6444) Signed-off-by: Damien Degois <damien@degois.info> Signed-off-by: Damien Degois <damien@degois.info> * Fix links in Readme (#6441) Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name> * Update all links within application (#6442) - URLs removed the /latest/ and /main/ pathname prefixes Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name> * Bump lens-k8s-proxy to v0.3.0 (#6461) Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix syncing shell env on TCSH and CSH (#6453) * Fix syncing shell env on TCSH and CSH Signed-off-by: Sebastian Malton <sebastian@malton.name> * Refactor computeUnixShellEnvironment to be clearer Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix manually set prometheus service address to work after re-connect (#6435) * Fix manually set prometheus service address to work after re-connect Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> * Fix manually set prometheus service address to work after re-connect Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> * Setup prometheus also on contenxt handler constructor Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> * Temp fix Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Damien Degois <damien@degois.info> Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com> Co-authored-by: Damien Degois <damien@degois.info> Co-authored-by: Lauri Nevala <lauri.nevala@gmail.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { pipeline } from "@ogre-tools/fp";
|
|
import type {
|
|
DiContainerForInjection,
|
|
InjectionToken,
|
|
} from "@ogre-tools/injectable";
|
|
import { filter, forEach, map, tap } from "lodash/fp";
|
|
import { throwWithIncorrectHierarchyFor } from "./throw-with-incorrect-hierarchy-for";
|
|
|
|
export interface Runnable<TParameter = void> {
|
|
id: string;
|
|
run: Run<TParameter>;
|
|
runAfter?: Runnable<TParameter>;
|
|
}
|
|
|
|
type Run<Param> = (parameter: Param) => Promise<void> | void;
|
|
|
|
export type RunMany = <Param>(
|
|
injectionToken: InjectionToken<Runnable<Param>, void>
|
|
) => Run<Param>;
|
|
|
|
export function runManyFor(di: DiContainerForInjection): RunMany {
|
|
return (injectionToken) => async (parameter) => {
|
|
const allRunnables = di.injectMany(injectionToken);
|
|
|
|
const throwWithIncorrectHierarchy = throwWithIncorrectHierarchyFor((injectionToken as any).id, allRunnables);
|
|
|
|
const recursedRun = async (
|
|
runAfterRunnable: Runnable<any> | undefined = undefined,
|
|
) =>
|
|
await pipeline(
|
|
allRunnables,
|
|
|
|
tap(runnables => forEach(throwWithIncorrectHierarchy, runnables)),
|
|
|
|
filter((runnable) => runnable.runAfter === runAfterRunnable),
|
|
|
|
map(async (runnable) => {
|
|
await runnable.run(parameter);
|
|
|
|
await recursedRun(runnable);
|
|
}),
|
|
|
|
(promises) => Promise.all(promises),
|
|
);
|
|
|
|
await recursedRun();
|
|
};
|
|
}
|