fixing circular dependencies, part 1

This commit is contained in:
Roman committed 2020-06-22 14:56:54 +03:00
1 parent 5d6826771a
commit 29197dcfb9
11 files changed
+37 -19

No files matched your search

-4
View File
@@ -23,7 +23,3 @@ export function getStaticUrl(filePath: string) {
export function getStaticPath(filePath: string) {
return path.resolve(staticDir, filePath);
}
export function getOutPath(filePath: string) {
return path.resolve(outDir, filePath);
}
+3 -3
View File
@@ -9,7 +9,7 @@ import { kubeconfigRoute } from "./routes/kubeconfig"
import { metricsRoute } from "./routes/metrics"
import { watchRoute } from "./routes/watch"
import { portForwardRoute } from "./routes/port-forward"
import { getOutPath } from "../common/register-static";
import { outDir, reactAppName } from "../common/vars";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Call = require('@hapi/call');
@@ -86,11 +86,11 @@ export class Router {
}
protected handleStaticFile(filePath: string, response: http.ServerResponse) {
const asset = getOutPath(filePath);
const asset = path.resolve(outDir, filePath);
readFile(asset, (err, data) => {
if (err) {
// default to index.html so that react routes work when page is refreshed
this.handleStaticFile("app_react.html", response)
this.handleStaticFile(`${reactAppName}.html`, response)
} else {
const type = mimeTypes[path.extname(asset).slice(1)] || "text/plain";
response.setHeader("Content-Type", type);
+4 -3
View File
@@ -1,9 +1,10 @@
import React from "react";
import type { KubeObjectStore } from "../kube-object.store";
import type { KubeObjectDetailsProps, KubeObjectListLayoutProps, KubeObjectMenuProps } from "../components/kube-object";
import type React from "react";
import { observable } from "mobx";
import { autobind } from "../utils/autobind";
import { KubeApi } from "./kube-api";
import { KubeObjectStore } from "../kube-object.store";
import { KubeObjectDetailsProps, KubeObjectListLayoutProps, KubeObjectMenuProps } from "../components/kube-object";
export interface ApiComponents {
List?: React.ComponentType<KubeObjectListLayoutProps>;
+3 -4
View File
@@ -2,9 +2,9 @@
import { computed, observable, reaction } from "mobx";
import { stringify } from "querystring"
import { autobind, EventEmitter, interval } from "../utils";
import { autobind, EventEmitter } from "../utils";
import { KubeJsonApiData } from "./kube-json-api";
import { KubeObjectStore } from "../kube-object.store";
import type { KubeObjectStore } from "../kube-object.store";
import { KubeApi } from "./kube-api";
import { configStore } from "../config.store";
import { apiManager } from "./api-manager";
@@ -105,8 +105,7 @@ export class KubeWatchApi {
const data = JSON.parse(evt.data);
if ((data as IKubeWatchEvent).object) {
this.onData.emit(data);
}
else {
} else {
this.onRouteEvent(data);
}
}
@@ -1,6 +1,6 @@
import type { InputProps } from "./input";
import { ReactNode } from "react";
import { t } from "@lingui/macro";
import { InputProps } from "./input";
import { _i18n } from '../../i18n';
export interface Validator {
@@ -7,7 +7,7 @@ import { disposeOnUnmount, observer } from "mobx-react";
import { t } from "@lingui/macro";
import { Icon } from "../icon";
import { cssNames } from "../../utils";
import { Input, InputProps } from "../input";
import { Input, InputProps } from "./input";
import { getSearch, setSearch } from "../../navigation";
import { _i18n } from '../../i18n';
+1 -1
View File
@@ -1,3 +1,4 @@
import type { TabRoute } from "./main-layout";
import "./sidebar.scss";
import React from "react";
@@ -19,7 +20,6 @@ import { Config, configRoute, configURL } from "../+config";
import { eventRoute, eventsURL } from "../+events";
import { Apps, appsRoute, appsURL } from "../+apps";
import { namespaceStore } from "../+namespaces/namespace.store";
import { TabRoute } from "./main-layout";
import { Workloads } from "../+workloads";
import { UserManagement } from "../+user-management";
import { Storage } from "../+storage";
+1 -1
View File
@@ -1,8 +1,8 @@
import "./table-cell.scss";
import type { SortBy, SortParams } from "./table";
import React, { ReactNode } from "react";
import { autobind, cssNames } from "../../utils";
import { SortBy, SortParams } from "./table";
import { Icon } from "../icon";
import { Checkbox } from "../checkbox";