mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Upgrade versions of @ogre-tools/* to 15.3.0
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
7dc0ce7192
commit
ba8f7f916d
22404
package-lock.json
generated
22404
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -33,9 +33,9 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@k8slens/react-application": "^1.0.0-alpha.0",
|
"@k8slens/react-application": "^1.0.0-alpha.0",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"@ogre-tools/injectable-react": "^15.1.2",
|
"@ogre-tools/injectable-react": "^15.1.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "^17"
|
"react": "^17"
|
||||||
|
|||||||
@ -23,11 +23,13 @@
|
|||||||
"prepare:test": "npm run build"
|
"prepare:test": "npm run build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
|
||||||
"@swc/cli": "^0.1.61",
|
"@swc/cli": "^0.1.61",
|
||||||
"@swc/core": "^1.3.44",
|
"@swc/core": "^1.3.44",
|
||||||
"@types/node": "^16.18.11",
|
"@types/node": "^16.18.11",
|
||||||
"@types/semver": "^7.3.13",
|
"@types/semver": "^7.3.13",
|
||||||
"rimraf": "^4.4.1"
|
"rimraf": "^4.4.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@ogre-tools/injectable": "^15.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,11 +117,6 @@
|
|||||||
"@k8slens/react-application": "^1.0.0-alpha.1",
|
"@k8slens/react-application": "^1.0.0-alpha.1",
|
||||||
"@kubernetes/client-node": "^0.18.1",
|
"@kubernetes/client-node": "^0.18.1",
|
||||||
"@material-ui/styles": "^4.11.5",
|
"@material-ui/styles": "^4.11.5",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
|
||||||
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
|
||||||
"@ogre-tools/injectable-react": "^15.1.2",
|
|
||||||
"@sentry/electron": "^3.0.8",
|
"@sentry/electron": "^3.0.8",
|
||||||
"@sentry/integrations": "^6.19.3",
|
"@sentry/integrations": "^6.19.3",
|
||||||
"@side/jest-runtime": "^1.1.0",
|
"@side/jest-runtime": "^1.1.0",
|
||||||
@ -326,6 +321,11 @@
|
|||||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||||
"@k8slens/test-utils": "^1.0.0-alpha.1",
|
"@k8slens/test-utils": "^1.0.0-alpha.1",
|
||||||
"@k8slens/utilities": "^1.0.0-alpha.1",
|
"@k8slens/utilities": "^1.0.0-alpha.1",
|
||||||
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
|
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
||||||
|
"@ogre-tools/injectable-react": "^15.3.0",
|
||||||
"@types/byline": "^4.2.33",
|
"@types/byline": "^4.2.33",
|
||||||
"@types/chart.js": "^2.9.36",
|
"@types/chart.js": "^2.9.36",
|
||||||
"@types/color": "^3.0.3",
|
"@types/color": "^3.0.3",
|
||||||
|
|||||||
@ -72,7 +72,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
di.override(spawnInjectable, () => spawnMock);
|
di.override(spawnInjectable, () => spawnMock);
|
||||||
di.override(randomUUIDInjectable, () => () => "deadbeef");
|
di.override(randomUUIDInjectable, () => () => "dead-foo-bar-foo-beef");
|
||||||
|
|
||||||
di.override(processEnvInjectable, () => ({
|
di.override(processEnvInjectable, () => ({
|
||||||
SOME_ENV_VAR: "some-env-value",
|
SOME_ENV_VAR: "some-env-value",
|
||||||
@ -110,7 +110,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should send the command via stdin", () => {
|
it("should send the command via stdin", () => {
|
||||||
expect(stdinValue).toBe(`'/some/process/exec/path' -p '"deadbeef" + JSON.stringify(process.env) + "deadbeef"'`);
|
expect(stdinValue).toBe(`'/some/process/exec/path' -p '"deadfoobarfoobeef" + JSON.stringify(process.env) + "deadfoobarfoobeef"'`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should close stdin", () => {
|
it("should close stdin", () => {
|
||||||
@ -167,7 +167,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
...expectedEnv,
|
...expectedEnv,
|
||||||
};
|
};
|
||||||
|
|
||||||
shellStdout.emit("data", Buffer.from(`some-other-datadeadbeef${JSON.stringify(fakeInnerEnv)}deadbeefsome-third-other-data`));
|
shellStdout.emit("data", Buffer.from(`some-other-datadeadfoobarfoobeef${JSON.stringify(fakeInnerEnv)}deadfoobarfoobeefsome-third-other-data`));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when process successfully exits", () => {
|
describe("when process successfully exits", () => {
|
||||||
@ -216,7 +216,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should send the command via stdin", () => {
|
it("should send the command via stdin", () => {
|
||||||
expect(stdinValue).toBe(` '/some/process/exec/path' -p '"deadbeef" + JSON.stringify(process.env) + "deadbeef"'`);
|
expect(stdinValue).toBe(` '/some/process/exec/path' -p '"deadfoobarfoobeef" + JSON.stringify(process.env) + "deadfoobarfoobeef"'`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should close stdin", () => {
|
it("should close stdin", () => {
|
||||||
@ -273,7 +273,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
...expectedEnv,
|
...expectedEnv,
|
||||||
};
|
};
|
||||||
|
|
||||||
shellStdout.emit("data", Buffer.from(`some-other-datadeadbeef${JSON.stringify(fakeInnerEnv)}deadbeefsome-third-other-data`));
|
shellStdout.emit("data", Buffer.from(`some-other-datadeadfoobarfoobeef${JSON.stringify(fakeInnerEnv)}deadfoobarfoobeefsome-third-other-data`));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when process successfully exits", () => {
|
describe("when process successfully exits", () => {
|
||||||
@ -312,7 +312,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
[
|
[
|
||||||
"-l",
|
"-l",
|
||||||
"-c",
|
"-c",
|
||||||
`'/some/process/exec/path' -p '"deadbeef" + JSON.stringify(process.env) + "deadbeef"'`,
|
`'/some/process/exec/path' -p '"deadfoobarfoobeef" + JSON.stringify(process.env) + "deadfoobarfoobeef"'`,
|
||||||
],
|
],
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
env: expectedEnv,
|
env: expectedEnv,
|
||||||
@ -378,7 +378,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
...expectedEnv,
|
...expectedEnv,
|
||||||
};
|
};
|
||||||
|
|
||||||
shellStdout.emit("data", Buffer.from(`some-other-datadeadbeef${JSON.stringify(fakeInnerEnv)}deadbeefsome-third-other-data`));
|
shellStdout.emit("data", Buffer.from(`some-other-datadeadfoobarfoobeef${JSON.stringify(fakeInnerEnv)}deadfoobarfoobeefsome-third-other-data`));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when process successfully exits", () => {
|
describe("when process successfully exits", () => {
|
||||||
@ -425,7 +425,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should send the command via stdin", () => {
|
it("should send the command via stdin", () => {
|
||||||
expect(stdinValue).toBe(`Command '/some/process/exec/path' -p '\\"deadbeef\\" + JSON.stringify(process.env) + \\"deadbeef\\"'`);
|
expect(stdinValue).toBe(`Command '/some/process/exec/path' -p '\\"deadfoobarfoobeef\\" + JSON.stringify(process.env) + \\"deadfoobarfoobeef\\"'`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should close stdin", () => {
|
it("should close stdin", () => {
|
||||||
@ -482,7 +482,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
|||||||
...expectedEnv,
|
...expectedEnv,
|
||||||
};
|
};
|
||||||
|
|
||||||
shellStdout.emit("data", Buffer.from(`some-other-datadeadbeef${JSON.stringify(fakeInnerEnv)}deadbeefsome-third-other-data`));
|
shellStdout.emit("data", Buffer.from(`some-other-datadeadfoobarfoobeef${JSON.stringify(fakeInnerEnv)}deadfoobarfoobeefsome-third-other-data`));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when process successfully exits", () => {
|
describe("when process successfully exits", () => {
|
||||||
|
|||||||
@ -2,105 +2,100 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { DiContainerForInjection } from "@ogre-tools/injectable";
|
import { injectionDecoratorToken, getInjectable } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
import {
|
|
||||||
getInjectable,
|
|
||||||
instantiationDecoratorToken,
|
|
||||||
lifecycleEnum,
|
|
||||||
} from "@ogre-tools/injectable";
|
|
||||||
|
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import { isFunction } from "lodash/fp";
|
|
||||||
import emitTelemetryInjectable from "./emit-telemetry.injectable";
|
import emitTelemetryInjectable from "./emit-telemetry.injectable";
|
||||||
|
|
||||||
import type { WhiteListItem } from "./telemetry-white-list-for-functions.injectable";
|
import type { WhiteListItem } from "./telemetry-white-list-for-functions.injectable";
|
||||||
import telemetryWhiteListForFunctionsInjectable from "./telemetry-white-list-for-functions.injectable";
|
import telemetryWhiteListForFunctionsInjectable from "./telemetry-white-list-for-functions.injectable";
|
||||||
import logErrorInjectable from "../../../common/log-error.injectable";
|
import logErrorInjectable from "../../../common/log-error.injectable";
|
||||||
|
import { isFunction, isString } from "@k8slens/utilities";
|
||||||
|
|
||||||
const telemetryDecoratorInjectable = getInjectable({
|
const telemetryDecoratorInjectable = getInjectable({
|
||||||
id: "telemetry-decorator",
|
id: "telemetry-decorator",
|
||||||
|
|
||||||
instantiate: (diForDecorator) => ({
|
instantiate: (diForDecorator) => ({
|
||||||
decorate:
|
decorate: (instantiateToBeDecorated) =>
|
||||||
(instantiateToBeDecorated: any) =>
|
(di, instantiationParameter) => {
|
||||||
(di: DiContainerForInjection, instantiationParameter: any) => {
|
const instance = instantiateToBeDecorated(di, instantiationParameter);
|
||||||
const instance = instantiateToBeDecorated(di, instantiationParameter);
|
|
||||||
|
|
||||||
if (isFunction(instance)) {
|
if (isFunction(instance)) {
|
||||||
return (...args: any[]) => {
|
return (...args: unknown[]) => {
|
||||||
const currentContext = di.context.at(-1);
|
const currentContext = di.context.at(-1);
|
||||||
|
|
||||||
assert(currentContext);
|
assert(currentContext);
|
||||||
|
|
||||||
const emitTelemetry = diForDecorator.inject(
|
const emitTelemetry = diForDecorator.inject(emitTelemetryInjectable);
|
||||||
emitTelemetryInjectable,
|
const logError = diForDecorator.inject(logErrorInjectable);
|
||||||
);
|
const whiteList = diForDecorator.inject(telemetryWhiteListForFunctionsInjectable);
|
||||||
|
|
||||||
const logError = diForDecorator.inject(logErrorInjectable);
|
const { isWhiteListed, getParams } = findWhiteListEntry(whiteList, currentContext.injectable.id);
|
||||||
|
|
||||||
const whiteList = diForDecorator.inject(
|
if (isWhiteListed) {
|
||||||
telemetryWhiteListForFunctionsInjectable,
|
let params;
|
||||||
);
|
|
||||||
|
|
||||||
const whiteListMap = getWhiteListMap(whiteList);
|
try {
|
||||||
|
params = getParams(...args);
|
||||||
const whiteListed = whiteListMap.get(currentContext.injectable.id);
|
} catch (e) {
|
||||||
|
params = {
|
||||||
if (whiteListed) {
|
error:
|
||||||
let params;
|
|
||||||
|
|
||||||
try {
|
|
||||||
params = whiteListed.getParams(...args);
|
|
||||||
} catch (e) {
|
|
||||||
params = {
|
|
||||||
error:
|
|
||||||
"Tried to produce params for telemetry, but getParams() threw an error",
|
"Tried to produce params for telemetry, but getParams() threw an error",
|
||||||
};
|
};
|
||||||
|
|
||||||
logError(
|
logError(
|
||||||
`Tried to produce params for telemetry of "${currentContext.injectable.id}", but getParams() threw an error`,
|
`Tried to produce params for telemetry of "${currentContext.injectable.id}", but getParams() threw an error`,
|
||||||
e,
|
e,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
emitTelemetry({
|
|
||||||
action: currentContext.injectable.id,
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance(...args);
|
emitTelemetry({
|
||||||
};
|
action: currentContext.injectable.id,
|
||||||
}
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return instance;
|
return instance(...args);
|
||||||
},
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
decorable: false,
|
decorable: false,
|
||||||
// Todo: this is required because of imperfect typing in injectable.
|
injectionToken: injectionDecoratorToken,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
injectionToken: instantiationDecoratorToken,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const getWhiteListMap = (whiteList: WhiteListItem[]) =>
|
type WhiteListEntry = {
|
||||||
new Map(
|
isWhiteListed: true;
|
||||||
whiteList.map((item) =>
|
getParams: (...args: unknown[]) => Record<string, any> | undefined;
|
||||||
typeof item === "string"
|
} | {
|
||||||
? [
|
isWhiteListed: false;
|
||||||
item,
|
getParams?: undefined;
|
||||||
{
|
};
|
||||||
getParams: () => undefined,
|
|
||||||
},
|
|
||||||
]
|
const findWhiteListEntry = (whiteList: WhiteListItem[], id: string): WhiteListEntry => {
|
||||||
: [
|
for (const entry of whiteList) {
|
||||||
item.id,
|
if (isString(entry)) {
|
||||||
{
|
if (entry === id) {
|
||||||
getParams: item.getParams,
|
return {
|
||||||
},
|
isWhiteListed: true,
|
||||||
],
|
getParams: () => undefined,
|
||||||
),
|
};
|
||||||
);
|
}
|
||||||
|
} else {
|
||||||
|
if (entry.id === id) {
|
||||||
|
return {
|
||||||
|
isWhiteListed: true,
|
||||||
|
getParams: entry.getParams,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
isWhiteListed: false,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default telemetryDecoratorInjectable;
|
export default telemetryDecoratorInjectable;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class NonInjectedSidebarItem extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
get id(): string {
|
get id(): string {
|
||||||
return this.registration.id;
|
return this.item.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get expanded(): boolean {
|
@computed get expanded(): boolean {
|
||||||
@ -52,8 +52,8 @@ class NonInjectedSidebarItem extends React.Component<
|
|||||||
return this.props.item.isActive.get();
|
return this.props.item.isActive.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
get registration() {
|
get item() {
|
||||||
return this.props.item.registration;
|
return this.props.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleExpand = () => {
|
toggleExpand = () => {
|
||||||
@ -71,7 +71,7 @@ class NonInjectedSidebarItem extends React.Component<
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className={cssNames(styles.subMenu, { [styles.active]: this.isActive })}>
|
<ul className={cssNames(styles.subMenu, { [styles.active]: this.isActive })}>
|
||||||
{this.props.item.children.map(item => <SidebarItem key={item.registration.id} item={item} />)}
|
{this.props.item.children.map(item => <SidebarItem key={item.id} item={item} />)}
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ class NonInjectedSidebarItem extends React.Component<
|
|||||||
className={styles.SidebarItem}
|
className={styles.SidebarItem}
|
||||||
data-testid={`sidebar-item-${this.id}`}
|
data-testid={`sidebar-item-${this.id}`}
|
||||||
data-is-active-test={this.isActive}
|
data-is-active-test={this.isActive}
|
||||||
data-parent-id-test={this.registration.parentId}
|
data-parent-id-test={this.item.parentId}
|
||||||
>
|
>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={""}
|
to={""}
|
||||||
@ -95,13 +95,13 @@ class NonInjectedSidebarItem extends React.Component<
|
|||||||
if (this.isExpandable) {
|
if (this.isExpandable) {
|
||||||
this.toggleExpand();
|
this.toggleExpand();
|
||||||
} else {
|
} else {
|
||||||
this.registration.onClick();
|
this.item.onClick();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
data-testid={`sidebar-item-link-for-${this.id}`}
|
data-testid={`sidebar-item-link-for-${this.id}`}
|
||||||
>
|
>
|
||||||
{this.registration.getIcon?.()}
|
{this.item.getIcon?.()}
|
||||||
<span>{this.registration.title}</span>
|
<span>{this.item.title}</span>
|
||||||
{this.isExpandable && (
|
{this.isExpandable && (
|
||||||
<Icon
|
<Icon
|
||||||
className={styles.expandIcon}
|
className={styles.expandIcon}
|
||||||
|
|||||||
@ -5,18 +5,9 @@
|
|||||||
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
|
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import { pipeline } from "@ogre-tools/fp";
|
|
||||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||||
import {
|
import { byOrderNumber } from "../../../common/utils/composable-responsibilities/orderable/orderable";
|
||||||
filter,
|
import type { SetRequired } from "type-fest";
|
||||||
flatMap,
|
|
||||||
identity,
|
|
||||||
invokeMap,
|
|
||||||
isEmpty,
|
|
||||||
map,
|
|
||||||
orderBy,
|
|
||||||
some,
|
|
||||||
} from "lodash/fp";
|
|
||||||
|
|
||||||
export interface SidebarItemRegistration {
|
export interface SidebarItemRegistration {
|
||||||
id: string;
|
id: string;
|
||||||
@ -33,10 +24,8 @@ export const sidebarItemsInjectionToken = getInjectionToken<
|
|||||||
IComputedValue<SidebarItemRegistration[]>
|
IComputedValue<SidebarItemRegistration[]>
|
||||||
>({ id: "sidebar-items-injection-token" });
|
>({ id: "sidebar-items-injection-token" });
|
||||||
|
|
||||||
export interface HierarchicalSidebarItem {
|
export interface HierarchicalSidebarItem extends SetRequired<SidebarItemRegistration, "isActive" | "isVisible"> {
|
||||||
registration: SidebarItemRegistration;
|
|
||||||
children: HierarchicalSidebarItem[];
|
children: HierarchicalSidebarItem[];
|
||||||
isActive: IComputedValue<boolean>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const sidebarItemsInjectable = getInjectable({
|
const sidebarItemsInjectable = getInjectable({
|
||||||
@ -44,54 +33,42 @@ const sidebarItemsInjectable = getInjectable({
|
|||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const computedInjectMany = di.inject(computedInjectManyInjectable);
|
const computedInjectMany = di.inject(computedInjectManyInjectable);
|
||||||
|
|
||||||
const sidebarItemRegistrations = computedInjectMany(sidebarItemsInjectionToken);
|
const sidebarItemRegistrations = computedInjectMany(sidebarItemsInjectionToken);
|
||||||
|
|
||||||
return computed((): HierarchicalSidebarItem[] => {
|
return computed((): HierarchicalSidebarItem[] => {
|
||||||
const registrations = pipeline(
|
const registrations = sidebarItemRegistrations
|
||||||
sidebarItemRegistrations.get(),
|
.get()
|
||||||
flatMap(dereference),
|
.flatMap(reg => reg.get());
|
||||||
);
|
|
||||||
|
|
||||||
const getSidebarItemsHierarchy = (registrations: SidebarItemRegistration[]) => {
|
const getSidebarItemsHierarchy = (registrations: SidebarItemRegistration[]) => {
|
||||||
const _getSidebarItemsHierarchy = (parentId: string | null): HierarchicalSidebarItem[] =>
|
const impl = (parentId: string | null): HierarchicalSidebarItem[] => (
|
||||||
pipeline(
|
registrations
|
||||||
registrations,
|
.filter((item) => item.parentId === parentId)
|
||||||
|
.map(({
|
||||||
filter((item) => item.parentId === parentId),
|
isActive = computed(() => false),
|
||||||
|
isVisible = computed(() => true),
|
||||||
map((registration) => {
|
...registration
|
||||||
const children = _getSidebarItemsHierarchy(registration.id);
|
}) => {
|
||||||
|
const children = impl(registration.id);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
registration,
|
...registration,
|
||||||
children,
|
children,
|
||||||
|
isVisible,
|
||||||
isActive: computed(() => {
|
isActive: computed(() => {
|
||||||
if (isEmpty(children)) {
|
if (children.length === 0) {
|
||||||
return registration.isActive ? registration.isActive.get() : false;
|
return isActive.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return pipeline(
|
return children.some(child => child.isActive.get());
|
||||||
children,
|
|
||||||
invokeMap("isActive.get"),
|
|
||||||
some(identity),
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
|
.filter(({ isVisible }) => isVisible.get())
|
||||||
|
.sort(byOrderNumber)
|
||||||
|
);
|
||||||
|
|
||||||
filter(item => item.registration.isVisible?.get() ?? true),
|
return impl(null);
|
||||||
|
|
||||||
(items) =>
|
|
||||||
orderBy(
|
|
||||||
["registration.orderNumber"],
|
|
||||||
["asc"],
|
|
||||||
items,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return _getSidebarItemsHierarchy(null);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return getSidebarItemsHierarchy(registrations);
|
return getSidebarItemsHierarchy(registrations);
|
||||||
@ -99,7 +76,4 @@ const sidebarItemsInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const dereference = (items: IComputedValue<SidebarItemRegistration[]>) =>
|
|
||||||
items.get();
|
|
||||||
|
|
||||||
export default sidebarItemsInjectable;
|
export default sidebarItemsInjectable;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const NonInjectedSidebar = observer(({
|
|||||||
.map(hierarchicalSidebarItem => (
|
.map(hierarchicalSidebarItem => (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
item={hierarchicalSidebarItem}
|
item={hierarchicalSidebarItem}
|
||||||
key={hierarchicalSidebarItem.registration.id}
|
key={hierarchicalSidebarItem.id}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,21 +34,17 @@ export const TabLayout = observer(
|
|||||||
|
|
||||||
{hasTabs && (
|
{hasTabs && (
|
||||||
<Tabs center>
|
<Tabs center>
|
||||||
{tabs.map(({ registration, isActive }) => {
|
{tabs.map(({ onClick, id, title, isActive }) => (
|
||||||
const active = isActive.get();
|
<Tab
|
||||||
|
onClick={onClick}
|
||||||
return (
|
key={id}
|
||||||
<Tab
|
label={title}
|
||||||
onClick={registration.onClick}
|
active={isActive.get()}
|
||||||
key={registration.id}
|
data-is-active-test={isActive.get()}
|
||||||
label={registration.title}
|
data-testid={`tab-link-for-${id}`}
|
||||||
active={active}
|
value={undefined}
|
||||||
data-is-active-test={active}
|
/>
|
||||||
data-testid={`tab-link-for-${registration.id}`}
|
))}
|
||||||
value={undefined}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,7 @@ function VirtualListInner<T extends { getId(): string } | string>({
|
|||||||
? renderList(fixedHeight)
|
? renderList(fixedHeight)
|
||||||
: (
|
: (
|
||||||
<AutoSizer disableWidth>
|
<AutoSizer disableWidth>
|
||||||
{({ height }) => renderList(height)}
|
{({ height = 0 }) => renderList(height)}
|
||||||
</AutoSizer>
|
</AutoSizer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,49 +1,53 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`get-multi-export-config given maximal package.json, when creating configuration works 1`] = `
|
exports[`get-multi-export-config given maximal package.json, when creating configuration works 1`] = `
|
||||||
Array [
|
[
|
||||||
Object {
|
{
|
||||||
"entry": Object {
|
"entry": {
|
||||||
"index": "./index.ts",
|
"index": "./index.ts",
|
||||||
},
|
},
|
||||||
"externalsPresets": Object {
|
"externals": [
|
||||||
|
[Function],
|
||||||
|
[Function],
|
||||||
|
],
|
||||||
|
"externalsPresets": {
|
||||||
"node": true,
|
"node": true,
|
||||||
},
|
},
|
||||||
"mode": "production",
|
"mode": "production",
|
||||||
"module": Object {
|
"module": {
|
||||||
"rules": Array [
|
"rules": [
|
||||||
Object {
|
{
|
||||||
"loader": "ts-loader",
|
"loader": "ts-loader",
|
||||||
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
|
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"name": "./index.ts",
|
"name": "./index.ts",
|
||||||
"node": Object {
|
"node": {
|
||||||
"__dirname": true,
|
"__dirname": true,
|
||||||
"__filename": true,
|
"__filename": true,
|
||||||
},
|
},
|
||||||
"output": Object {
|
"output": {
|
||||||
"filename": [Function],
|
"filename": [Function],
|
||||||
"libraryTarget": "commonjs2",
|
"libraryTarget": "commonjs2",
|
||||||
"path": "/some-working-directory/dist",
|
"path": "/some-working-directory/dist",
|
||||||
},
|
},
|
||||||
"performance": Object {
|
"performance": {
|
||||||
"hints": "error",
|
"hints": "error",
|
||||||
"maxEntrypointSize": 100000,
|
"maxEntrypointSize": 100000,
|
||||||
},
|
},
|
||||||
"plugins": Array [
|
"plugins": [
|
||||||
MakePeerDependenciesExternalPlugin {},
|
MakePeerDependenciesExternalPlugin {},
|
||||||
ProtectFromImportingNonDependencies {},
|
ProtectFromImportingNonDependencies {},
|
||||||
ForkTsCheckerWebpackPlugin {
|
ForkTsCheckerWebpackPlugin {
|
||||||
"options": Object {
|
"options": {
|
||||||
"typescript": Object {
|
"typescript": {
|
||||||
"configOverwrite": Object {
|
"configOverwrite": {
|
||||||
"compilerOptions": Object {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "/some-working-directory/dist",
|
"declarationDir": "/some-working-directory/dist",
|
||||||
},
|
},
|
||||||
"include": Array [
|
"include": [
|
||||||
"./index.ts",
|
"./index.ts",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -52,8 +56,8 @@ Array [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"resolve": Object {
|
"resolve": {
|
||||||
"extensions": Array [
|
"extensions": [
|
||||||
".ts",
|
".ts",
|
||||||
".tsx",
|
".tsx",
|
||||||
".js",
|
".js",
|
||||||
@ -61,48 +65,52 @@ Array [
|
|||||||
},
|
},
|
||||||
"target": "node",
|
"target": "node",
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"entry": Object {
|
"entry": {
|
||||||
"index": "./some-entrypoint/index.ts",
|
"index": "./some-entrypoint/index.ts",
|
||||||
},
|
},
|
||||||
"externalsPresets": Object {
|
"externals": [
|
||||||
|
[Function],
|
||||||
|
[Function],
|
||||||
|
],
|
||||||
|
"externalsPresets": {
|
||||||
"node": true,
|
"node": true,
|
||||||
},
|
},
|
||||||
"mode": "production",
|
"mode": "production",
|
||||||
"module": Object {
|
"module": {
|
||||||
"rules": Array [
|
"rules": [
|
||||||
Object {
|
{
|
||||||
"loader": "ts-loader",
|
"loader": "ts-loader",
|
||||||
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
|
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"name": "./some-entrypoint/index.ts",
|
"name": "./some-entrypoint/index.ts",
|
||||||
"node": Object {
|
"node": {
|
||||||
"__dirname": true,
|
"__dirname": true,
|
||||||
"__filename": true,
|
"__filename": true,
|
||||||
},
|
},
|
||||||
"output": Object {
|
"output": {
|
||||||
"filename": [Function],
|
"filename": [Function],
|
||||||
"libraryTarget": "commonjs2",
|
"libraryTarget": "commonjs2",
|
||||||
"path": "/some-working-directory/dist/some-entrypoint",
|
"path": "/some-working-directory/dist/some-entrypoint",
|
||||||
},
|
},
|
||||||
"performance": Object {
|
"performance": {
|
||||||
"hints": "error",
|
"hints": "error",
|
||||||
"maxEntrypointSize": 100000,
|
"maxEntrypointSize": 100000,
|
||||||
},
|
},
|
||||||
"plugins": Array [
|
"plugins": [
|
||||||
MakePeerDependenciesExternalPlugin {},
|
MakePeerDependenciesExternalPlugin {},
|
||||||
ProtectFromImportingNonDependencies {},
|
ProtectFromImportingNonDependencies {},
|
||||||
ForkTsCheckerWebpackPlugin {
|
ForkTsCheckerWebpackPlugin {
|
||||||
"options": Object {
|
"options": {
|
||||||
"typescript": Object {
|
"typescript": {
|
||||||
"configOverwrite": Object {
|
"configOverwrite": {
|
||||||
"compilerOptions": Object {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "/some-working-directory/dist/some-entrypoint",
|
"declarationDir": "/some-working-directory/dist/some-entrypoint",
|
||||||
},
|
},
|
||||||
"include": Array [
|
"include": [
|
||||||
"./some-entrypoint/index.ts",
|
"./some-entrypoint/index.ts",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -111,8 +119,8 @@ Array [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"resolve": Object {
|
"resolve": {
|
||||||
"extensions": Array [
|
"extensions": [
|
||||||
".ts",
|
".ts",
|
||||||
".tsx",
|
".tsx",
|
||||||
".js",
|
".js",
|
||||||
@ -120,30 +128,34 @@ Array [
|
|||||||
},
|
},
|
||||||
"target": "node",
|
"target": "node",
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"entry": Object {
|
"entry": {
|
||||||
"index": "./some-other-entrypoint/index.ts",
|
"index": "./some-other-entrypoint/index.ts",
|
||||||
},
|
},
|
||||||
"externalsPresets": Object {
|
"externals": [
|
||||||
|
[Function],
|
||||||
|
[Function],
|
||||||
|
],
|
||||||
|
"externalsPresets": {
|
||||||
"node": true,
|
"node": true,
|
||||||
},
|
},
|
||||||
"mode": "production",
|
"mode": "production",
|
||||||
"module": Object {
|
"module": {
|
||||||
"rules": Array [
|
"rules": [
|
||||||
Object {
|
{
|
||||||
"loader": "ts-loader",
|
"loader": "ts-loader",
|
||||||
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
|
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"test": /\\\\\\.s\\?css\\$/,
|
"test": /\\\\\\.s\\?css\\$/,
|
||||||
"use": Array [
|
"use": [
|
||||||
Object {
|
{
|
||||||
"some": "miniCssExtractPluginLoader",
|
"some": "miniCssExtractPluginLoader",
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"loader": "css-loader",
|
"loader": "css-loader",
|
||||||
"options": Object {
|
"options": {
|
||||||
"modules": Object {
|
"modules": {
|
||||||
"auto": /\\\\\\.module\\\\\\./i,
|
"auto": /\\\\\\.module\\\\\\./i,
|
||||||
"localIdentName": "[name]__[local]--[hash:base64:5]",
|
"localIdentName": "[name]__[local]--[hash:base64:5]",
|
||||||
"mode": "local",
|
"mode": "local",
|
||||||
@ -151,7 +163,7 @@ Array [
|
|||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"loader": "postcss-loader",
|
"loader": "postcss-loader",
|
||||||
"options": Object {
|
"options": Object {
|
||||||
"postcssOptions": Object {
|
"postcssOptions": Object {
|
||||||
@ -162,9 +174,9 @@ Array [
|
|||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Object {
|
{
|
||||||
"loader": "sass-loader",
|
"loader": "sass-loader",
|
||||||
"options": Object {
|
"options": {
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -185,31 +197,31 @@ Array [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
"name": "./some-other-entrypoint/index.ts",
|
"name": "./some-other-entrypoint/index.ts",
|
||||||
"node": Object {
|
"node": {
|
||||||
"__dirname": true,
|
"__dirname": true,
|
||||||
"__filename": true,
|
"__filename": true,
|
||||||
},
|
},
|
||||||
"output": Object {
|
"output": {
|
||||||
"filename": [Function],
|
"filename": [Function],
|
||||||
"libraryTarget": "commonjs2",
|
"libraryTarget": "commonjs2",
|
||||||
"path": "/some-working-directory/dist/some-other-entrypoint",
|
"path": "/some-working-directory/dist/some-other-entrypoint",
|
||||||
},
|
},
|
||||||
"performance": Object {
|
"performance": {
|
||||||
"hints": "error",
|
"hints": "error",
|
||||||
"maxEntrypointSize": 100000,
|
"maxEntrypointSize": 100000,
|
||||||
},
|
},
|
||||||
"plugins": Array [
|
"plugins": [
|
||||||
MakePeerDependenciesExternalPlugin {},
|
MakePeerDependenciesExternalPlugin {},
|
||||||
ProtectFromImportingNonDependencies {},
|
ProtectFromImportingNonDependencies {},
|
||||||
ForkTsCheckerWebpackPlugin {
|
ForkTsCheckerWebpackPlugin {
|
||||||
"options": Object {
|
"options": {
|
||||||
"typescript": Object {
|
"typescript": {
|
||||||
"configOverwrite": Object {
|
"configOverwrite": {
|
||||||
"compilerOptions": Object {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "/some-working-directory/dist/some-other-entrypoint",
|
"declarationDir": "/some-working-directory/dist/some-other-entrypoint",
|
||||||
},
|
},
|
||||||
"include": Array [
|
"include": [
|
||||||
"./some-other-entrypoint/index.ts",
|
"./some-other-entrypoint/index.ts",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -219,22 +231,22 @@ Array [
|
|||||||
},
|
},
|
||||||
MiniCssExtractPlugin {
|
MiniCssExtractPlugin {
|
||||||
"_sortedModulesCache": WeakMap {},
|
"_sortedModulesCache": WeakMap {},
|
||||||
"options": Object {
|
"options": {
|
||||||
"chunkFilename": "[name].css",
|
"chunkFilename": "[name].css",
|
||||||
"experimentalUseImportModule": undefined,
|
"experimentalUseImportModule": undefined,
|
||||||
"filename": "[name].css",
|
"filename": "[name].css",
|
||||||
"ignoreOrder": false,
|
"ignoreOrder": false,
|
||||||
"runtime": true,
|
"runtime": true,
|
||||||
},
|
},
|
||||||
"runtimeOptions": Object {
|
"runtimeOptions": {
|
||||||
"attributes": undefined,
|
"attributes": undefined,
|
||||||
"insert": undefined,
|
"insert": undefined,
|
||||||
"linkType": "text/css",
|
"linkType": "text/css",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"resolve": Object {
|
"resolve": {
|
||||||
"extensions": Array [
|
"extensions": [
|
||||||
".ts",
|
".ts",
|
||||||
".tsx",
|
".tsx",
|
||||||
".js",
|
".js",
|
||||||
|
|||||||
@ -201,11 +201,11 @@
|
|||||||
"@k8slens/run-many": "^1.0.0-alpha.2",
|
"@k8slens/run-many": "^1.0.0-alpha.2",
|
||||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.2",
|
"@k8slens/startable-stoppable": "^1.0.0-alpha.2",
|
||||||
"@k8slens/utilities": "^1.0.0-alpha.2",
|
"@k8slens/utilities": "^1.0.0-alpha.2",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
||||||
"@ogre-tools/injectable-react": "^15.1.2",
|
"@ogre-tools/injectable-react": "^15.3.0",
|
||||||
"mobx": "^6.8.0",
|
"mobx": "^6.8.0",
|
||||||
"rimraf": "^4.4.1"
|
"rimraf": "^4.4.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -33,9 +33,9 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@k8slens/run-many": "^1.0.0-alpha.1",
|
"@k8slens/run-many": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"lodash": "^4.17.15"
|
"lodash": "^4.17.15"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -34,8 +34,8 @@
|
|||||||
"@k8slens/application": "^6.5.0-alpha.0",
|
"@k8slens/application": "^6.5.0-alpha.0",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@k8slens/run-many": "^1.0.0-alpha.1",
|
"@k8slens/run-many": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"electron": "^22.3.3",
|
"electron": "^22.3.3",
|
||||||
"lodash": "^4.17.21"
|
"lodash": "^4.17.21"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,44 +1,39 @@
|
|||||||
import { DiContainer, getInjectable, instantiationDecoratorToken, lifecycleEnum } from "@ogre-tools/injectable";
|
import {
|
||||||
|
getInjectable,
|
||||||
|
instantiationDecoratorToken,
|
||||||
|
createInstantiationTargetDecorator,
|
||||||
|
} from "@ogre-tools/injectable";
|
||||||
import { startApplicationInjectionToken } from "@k8slens/application";
|
import { startApplicationInjectionToken } from "@k8slens/application";
|
||||||
import whenAppIsReadyInjectable from "./when-app-is-ready.injectable";
|
import whenAppIsReadyInjectable from "./when-app-is-ready.injectable";
|
||||||
import { beforeAnythingInjectionToken, beforeElectronIsReadyInjectionToken } from "./time-slots";
|
import { beforeAnythingInjectionToken, beforeElectronIsReadyInjectionToken } from "./time-slots";
|
||||||
import { runManySyncFor } from "@k8slens/run-many";
|
import { runManySyncFor } from "@k8slens/run-many";
|
||||||
import { curry } from "lodash";
|
|
||||||
|
|
||||||
type ToBeDecorated = (di: DiContainer, ...args: unknown[]) => (...args: unknown[]) => unknown;
|
|
||||||
|
|
||||||
const decorator = (toBeDecorated: unknown, di: DiContainer, ...args: unknown[]) => {
|
|
||||||
const whenAppIsReady = di.inject(whenAppIsReadyInjectable);
|
|
||||||
const runManySync = runManySyncFor(di);
|
|
||||||
const beforeAnything = runManySync(beforeAnythingInjectionToken);
|
|
||||||
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
|
|
||||||
const startApplication = (toBeDecorated as ToBeDecorated)(di, ...args);
|
|
||||||
|
|
||||||
return (...startApplicationArgs: unknown[]) => {
|
|
||||||
beforeAnything();
|
|
||||||
beforeElectronIsReady();
|
|
||||||
|
|
||||||
return (async () => {
|
|
||||||
await whenAppIsReady();
|
|
||||||
|
|
||||||
return startApplication(...startApplicationArgs);
|
|
||||||
})();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const startElectronApplicationInjectable = getInjectable({
|
const startElectronApplicationInjectable = getInjectable({
|
||||||
id: "start-electron-application",
|
id: "start-electron-application",
|
||||||
|
instantiate: () =>
|
||||||
|
createInstantiationTargetDecorator({
|
||||||
|
target: startApplicationInjectionToken,
|
||||||
|
decorate: (targetInstantiate) => (di) => {
|
||||||
|
const whenAppIsReady = di.inject(whenAppIsReadyInjectable);
|
||||||
|
const runManySync = runManySyncFor(di);
|
||||||
|
const beforeAnything = runManySync(beforeAnythingInjectionToken);
|
||||||
|
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
|
||||||
|
const startApplication = targetInstantiate(di);
|
||||||
|
|
||||||
instantiate: () => ({
|
return () => {
|
||||||
decorate: curry(decorator),
|
beforeAnything();
|
||||||
target: startApplicationInjectionToken,
|
beforeElectronIsReady();
|
||||||
}),
|
|
||||||
|
|
||||||
|
return (async () => {
|
||||||
|
await whenAppIsReady();
|
||||||
|
|
||||||
|
return startApplication();
|
||||||
|
})();
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}),
|
||||||
decorable: false,
|
decorable: false,
|
||||||
|
|
||||||
injectionToken: instantiationDecoratorToken,
|
injectionToken: instantiationDecoratorToken,
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default startElectronApplicationInjectable;
|
export default startElectronApplicationInjectable;
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
"lint:fix": "lens-lint --fix"
|
"lint:fix": "lens-lint --fix"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ogre-tools/injectable": "^15.1.2"
|
"@ogre-tools/injectable": "^15.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/eslint-config": "^6.5.0-alpha.2"
|
"@k8slens/eslint-config": "^6.5.0-alpha.2"
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
"lint:fix": "lens-lint --fix"
|
"lint:fix": "lens-lint --fix"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ogre-tools/injectable": "^15.1.2"
|
"@ogre-tools/injectable": "^15.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/eslint-config": "^6.5.0-alpha.2"
|
"@k8slens/eslint-config": "^6.5.0-alpha.2"
|
||||||
|
|||||||
@ -109,7 +109,9 @@ describe("register-feature", () => {
|
|||||||
instantiate: (di) => di.inject(someInjectable),
|
instantiate: (di) => di.inject(someInjectable),
|
||||||
});
|
});
|
||||||
|
|
||||||
const di = createContainer("some-container");
|
const di = createContainer("some-container", {
|
||||||
|
detectCycles: false,
|
||||||
|
});
|
||||||
|
|
||||||
const someFeature = getFeature({
|
const someFeature = getFeature({
|
||||||
id: "some-feature-1",
|
id: "some-feature-1",
|
||||||
@ -132,9 +134,9 @@ describe("register-feature", () => {
|
|||||||
expect(() => {
|
expect(() => {
|
||||||
di.inject(someInjectable);
|
di.inject(someInjectable);
|
||||||
}).toThrow(
|
}).toThrow(
|
||||||
// 'Cycle of injectables encountered: "some-container" -> "some-feature-1:some-injectable-1"
|
|
||||||
// -> "some-feature-2:some-injectable-2" -> "some-feature-1:some-injectable-1"'
|
|
||||||
"Maximum call stack size exceeded",
|
"Maximum call stack size exceeded",
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
// 'Cycle of injectables encountered: "some-feature-1:some-injectable-1" -> "some-feature-2:some-injectable-2" -> "some-feature-1:some-injectable-1"',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -34,9 +34,9 @@
|
|||||||
"@k8slens/application": "^6.5.0-alpha.0",
|
"@k8slens/application": "^6.5.0-alpha.0",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.7.0"
|
"mobx": "^6.7.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -34,10 +34,10 @@
|
|||||||
"@k8slens/application": "^6.5.0-alpha.0",
|
"@k8slens/application": "^6.5.0-alpha.0",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.8.0"
|
"mobx": "^6.8.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -34,8 +34,8 @@
|
|||||||
"@k8slens/application": "^6.5.0-alpha.0",
|
"@k8slens/application": "^6.5.0-alpha.0",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.1.2",
|
||||||
"electron": "^22.3.3",
|
"electron": "^22.3.3",
|
||||||
"lodash": "^4.17.21"
|
"lodash": "^4.17.21"
|
||||||
|
|||||||
@ -36,8 +36,8 @@
|
|||||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||||
"@k8slens/run-many": "^1.0.0-alpha.1",
|
"@k8slens/run-many": "^1.0.0-alpha.1",
|
||||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"electron": "^22.3.3",
|
"electron": "^22.3.3",
|
||||||
"lodash": "^4.17.21"
|
"lodash": "^4.17.21"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -32,15 +32,15 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@async-fn/jest": "^1.6.4",
|
"@async-fn/jest": "^1.6.4",
|
||||||
|
"@k8slens/feature-core": "^6.5.0-alpha.2",
|
||||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"lodash": "^4.17.21"
|
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"mobx": "^6.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/eslint-config": "^6.5.0-alpha.2",
|
"@k8slens/eslint-config": "^6.5.0-alpha.2"
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.2",
|
|
||||||
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
|
||||||
"mobx": "^6.7.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,11 +33,11 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/application": "^6.5.0-alpha.2",
|
"@k8slens/application": "^6.5.0-alpha.2",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
"@ogre-tools/injectable-extension-for-mobx": "^15.1.2",
|
"@ogre-tools/injectable-extension-for-mobx": "^15.3.0",
|
||||||
"@ogre-tools/injectable-react": "^15.1.2",
|
"@ogre-tools/injectable-react": "^15.3.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"mobx": "^6.8.0",
|
"mobx": "^6.8.0",
|
||||||
"mobx-react": "^7.6.0",
|
"mobx-react": "^7.6.0",
|
||||||
|
|||||||
@ -27,8 +27,8 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/test-utils": "^1.0.0-alpha.1",
|
"@k8slens/test-utils": "^1.0.0-alpha.1",
|
||||||
"@k8slens/utilities": "^1.0.0-alpha.1",
|
"@k8slens/utilities": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/fp": "^15.1.2",
|
"@ogre-tools/fp": "^15.3.0",
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"type-fest": "^2.19.0",
|
"type-fest": "^2.19.0",
|
||||||
"typed-emitter": "^1.4.0",
|
"typed-emitter": "^1.4.0",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
|
|||||||
@ -24,12 +24,13 @@
|
|||||||
"build": "webpack"
|
"build": "webpack"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ogre-tools/injectable": "^15.1.2",
|
"@ogre-tools/injectable": "^15.3.0",
|
||||||
"@ogre-tools/injectable-react": "^15.1.2",
|
"@ogre-tools/injectable-react": "^15.3.0",
|
||||||
"@testing-library/react": "^12.1.5",
|
"@testing-library/react": "^12.1.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.8.0",
|
"mobx": "^6.8.0",
|
||||||
"react": "^17.0.2"
|
"react": "^17.0.2",
|
||||||
|
"react-dom": "^17.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/lodash": "^4.14.191"
|
"@types/lodash": "^4.14.191"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user