mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Enforce semicolons in eslint
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
0f3f5611ba
commit
1477bb8274
531 files changed
+3979
-3975
No files matched your search
@@ -1 +1 @@
|
||||
export * from "./not-found"
|
||||
export * from "./not-found";
|
||||
@@ -3,6 +3,6 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const addClusterRoute: RouteProps = {
|
||||
path: "/add-cluster"
|
||||
}
|
||||
};
|
||||
|
||||
export const addClusterURL = buildURL(addClusterRoute.path)
|
||||
export const addClusterURL = buildURL(addClusterRoute.path);
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./add-cluster.scss"
|
||||
import "./add-cluster.scss";
|
||||
import os from "os";
|
||||
import React, { Fragment } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -16,7 +16,7 @@ import { WizardLayout } from "../layout/wizard-layout";
|
||||
import { kubeConfigDefaultPath, loadConfig, splitConfig, validateConfig, validateKubeConfig } from "../../../common/kube-helpers";
|
||||
import { ClusterModel, ClusterStore, clusterStore } from "../../../common/cluster-store";
|
||||
import { workspaceStore } from "../../../common/workspace-store";
|
||||
import { v4 as uuid } from "uuid"
|
||||
import { v4 as uuid } from "uuid";
|
||||
import { navigate } from "../../navigation";
|
||||
import { userStore } from "../../../common/user-store";
|
||||
import { clusterViewURL } from "../cluster-manager/cluster-view.route";
|
||||
@@ -84,7 +84,7 @@ export class AddCluster extends React.Component {
|
||||
break;
|
||||
case KubeConfigSourceTab.TEXT:
|
||||
try {
|
||||
this.error = ""
|
||||
this.error = "";
|
||||
const contexts = this.getContexts(loadConfig(this.customConfig || "{}"));
|
||||
this.kubeContexts.replace(contexts);
|
||||
} catch (err) {
|
||||
@@ -94,7 +94,7 @@ export class AddCluster extends React.Component {
|
||||
}
|
||||
|
||||
if (this.kubeContexts.size === 1) {
|
||||
this.selectedContexts.push(this.kubeContexts.keys().next().value)
|
||||
this.selectedContexts.push(this.kubeContexts.keys().next().value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ export class AddCluster extends React.Component {
|
||||
const contexts = new Map();
|
||||
splitConfig(config).forEach(config => {
|
||||
contexts.set(config.currentContext, config);
|
||||
})
|
||||
return contexts
|
||||
});
|
||||
return contexts;
|
||||
}
|
||||
|
||||
selectKubeConfigDialog = async () => {
|
||||
@@ -124,11 +124,11 @@ export class AddCluster extends React.Component {
|
||||
let newClusters: ClusterModel[] = [];
|
||||
try {
|
||||
if (!this.selectedContexts.length) {
|
||||
this.error = <Trans>Please select at least one cluster context</Trans>
|
||||
this.error = <Trans>Please select at least one cluster context</Trans>;
|
||||
return;
|
||||
}
|
||||
this.error = ""
|
||||
this.isWaiting = true
|
||||
this.error = "";
|
||||
this.isWaiting = true;
|
||||
|
||||
newClusters = this.selectedContexts.filter(context => {
|
||||
try {
|
||||
@@ -136,7 +136,7 @@ export class AddCluster extends React.Component {
|
||||
validateKubeConfig(kubeConfig);
|
||||
return true;
|
||||
} catch (err) {
|
||||
this.error = String(err.message)
|
||||
this.error = String(err.message);
|
||||
if (err instanceof ExecValidationNotFoundError ) {
|
||||
Notifications.error(<Trans>Error while adding cluster(s): {this.error}</Trans>);
|
||||
return false;
|
||||
@@ -159,8 +159,8 @@ export class AddCluster extends React.Component {
|
||||
clusterName: kubeConfig.currentContext,
|
||||
httpsProxy: this.proxyServer || undefined,
|
||||
},
|
||||
}
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
runInAction(() => {
|
||||
clusterStore.addClusters(...newClusters);
|
||||
@@ -175,7 +175,7 @@ export class AddCluster extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
this.refreshContexts();
|
||||
} catch (err) {
|
||||
this.error = String(err);
|
||||
@@ -218,7 +218,7 @@ export class AddCluster extends React.Component {
|
||||
Lens app might not have all login shell env variables set automatically.
|
||||
</p>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderKubeConfigSource() {
|
||||
@@ -281,7 +281,7 @@ export class AddCluster extends React.Component {
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderContextSelector() {
|
||||
@@ -302,7 +302,7 @@ export class AddCluster extends React.Component {
|
||||
noOptionsMessage={() => _i18n._(t`No contexts available or they have been added already`)}
|
||||
onChange={({ value: ctx }: SelectOption<string>) => {
|
||||
if (this.selectedContexts.includes(ctx)) {
|
||||
this.selectedContexts.remove(ctx)
|
||||
this.selectedContexts.remove(ctx);
|
||||
} else {
|
||||
this.selectedContexts.push(ctx);
|
||||
}
|
||||
@@ -315,7 +315,7 @@ export class AddCluster extends React.Component {
|
||||
</small>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
onKubeConfigInputBlur = (evt: React.FocusEvent<HTMLInputElement>) => {
|
||||
@@ -345,11 +345,11 @@ export class AddCluster extends React.Component {
|
||||
{isNew && <Icon small material="fiber_new" />}
|
||||
{isSelected && <Icon small material="check" className="box right" />}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
const addDisabled = this.selectedContexts.length === 0
|
||||
const addDisabled = this.selectedContexts.length === 0;
|
||||
|
||||
return (
|
||||
<WizardLayout
|
||||
@@ -361,12 +361,12 @@ export class AddCluster extends React.Component {
|
||||
onDragLeave: event => this.dropAreaActive = false,
|
||||
onDragOver: event => {
|
||||
event.preventDefault(); // enable onDrop()-callback
|
||||
event.dataTransfer.dropEffect = "move"
|
||||
event.dataTransfer.dropEffect = "move";
|
||||
},
|
||||
onDrop: event => {
|
||||
this.sourceTab = KubeConfigSourceTab.FILE;
|
||||
this.dropAreaActive = false
|
||||
this.setKubeConfig(event.dataTransfer.files[0].path)
|
||||
this.dropAreaActive = false;
|
||||
this.setKubeConfig(event.dataTransfer.files[0].path);
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -407,6 +407,6 @@ export class AddCluster extends React.Component {
|
||||
/>
|
||||
</div>
|
||||
</WizardLayout>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./add-cluster"
|
||||
export * from "./add-cluster.route"
|
||||
export * from "./add-cluster";
|
||||
export * from "./add-cluster.route";
|
||||
@@ -35,16 +35,16 @@ export class HelmChartDetails extends Component<Props> {
|
||||
}
|
||||
|
||||
chartUpdater = autorun(() => {
|
||||
this.selectedChart = null
|
||||
const { chart: { name, repo, version } } = this.props
|
||||
this.selectedChart = null;
|
||||
const { chart: { name, repo, version } } = this.props;
|
||||
helmChartsApi.get(repo, name, version).then(result => {
|
||||
this.readme = result.readme
|
||||
this.chartVersions = result.versions
|
||||
this.selectedChart = result.versions[0]
|
||||
this.readme = result.readme;
|
||||
this.chartVersions = result.versions;
|
||||
this.selectedChart = result.versions[0];
|
||||
},
|
||||
error => {
|
||||
this.error = error;
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@autobind()
|
||||
@@ -55,7 +55,7 @@ export class HelmChartDetails extends Component<Props> {
|
||||
try {
|
||||
this.chartPromise?.cancel();
|
||||
const { chart: { name, repo } } = this.props;
|
||||
const { readme } = await (this.chartPromise = helmChartsApi.get(repo, name, version))
|
||||
const { readme } = await (this.chartPromise = helmChartsApi.get(repo, name, version));
|
||||
this.readme = readme;
|
||||
} catch (error) {
|
||||
this.error = error;
|
||||
@@ -65,7 +65,7 @@ export class HelmChartDetails extends Component<Props> {
|
||||
@autobind()
|
||||
install() {
|
||||
createInstallChartTab(this.selectedChart);
|
||||
this.props.hideDetails()
|
||||
this.props.hideDetails();
|
||||
}
|
||||
|
||||
renderIntroduction() {
|
||||
@@ -112,14 +112,14 @@ export class HelmChartDetails extends Component<Props> {
|
||||
|
||||
renderReadme() {
|
||||
if (this.readme === null) {
|
||||
return <Spinner center />
|
||||
return <Spinner center />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="chart-description">
|
||||
<MarkdownViewer markdown={this.readme} />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderContent() {
|
||||
@@ -132,7 +132,7 @@ export class HelmChartDetails extends Component<Props> {
|
||||
<div className="box grow">
|
||||
<p className="error">{this.error}</p>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import semver from "semver"
|
||||
import semver from "semver";
|
||||
import { observable } from "mobx";
|
||||
import { autobind } from "../../utils";
|
||||
import { HelmChart, helmChartsApi } from "../../api/endpoints/helm-charts.api";
|
||||
import { ItemStore } from "../../item.store";
|
||||
import flatten from "lodash/flatten"
|
||||
import flatten from "lodash/flatten";
|
||||
|
||||
export interface IChartVersion {
|
||||
repo: string;
|
||||
@@ -24,7 +24,7 @@ export class HelmChartStore extends ItemStore<HelmChart> {
|
||||
|
||||
protected sortVersions = (versions: IChartVersion[]) => {
|
||||
return versions.sort((first, second) => {
|
||||
return semver.compare(second.version, first.version)
|
||||
return semver.compare(second.version, first.version);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -38,8 +38,8 @@ export class HelmChartStore extends ItemStore<HelmChart> {
|
||||
return versions.map(chart => ({
|
||||
repo: repo,
|
||||
version: chart.getVersion()
|
||||
}))
|
||||
})
|
||||
}));
|
||||
});
|
||||
};
|
||||
if (!this.isLoaded) {
|
||||
await this.loadAll();
|
||||
|
||||
@@ -4,11 +4,11 @@ import { appsRoute } from "../+apps/apps.route";
|
||||
|
||||
export const helmChartsRoute: RouteProps = {
|
||||
path: appsRoute.path + "/charts/:repo?/:chartName?"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IHelmChartsRouteParams {
|
||||
chartName?: string;
|
||||
repo?: string;
|
||||
}
|
||||
|
||||
export const helmChartsURL = buildURL<IHelmChartsRouteParams>(helmChartsRoute.path)
|
||||
export const helmChartsURL = buildURL<IHelmChartsRouteParams>(helmChartsRoute.path);
|
||||
@@ -28,13 +28,13 @@ export class HelmCharts extends Component<Props> {
|
||||
}
|
||||
|
||||
get selectedChart() {
|
||||
const { match: { params: { chartName, repo } } } = this.props
|
||||
const { match: { params: { chartName, repo } } } = this.props;
|
||||
return helmChartStore.getByName(chartName, repo);
|
||||
}
|
||||
|
||||
showDetails = (chart: HelmChart) => {
|
||||
if (!chart) {
|
||||
navigation.merge(helmChartsURL())
|
||||
navigation.merge(helmChartsURL());
|
||||
}
|
||||
else {
|
||||
navigation.merge(helmChartsURL({
|
||||
@@ -42,7 +42,7 @@ export class HelmCharts extends Component<Props> {
|
||||
chartName: chart.getName(),
|
||||
repo: chart.getRepository(),
|
||||
}
|
||||
}))
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ export class ReleaseDetails extends Component<Props> {
|
||||
updateValues = async () => {
|
||||
const { release } = this.props;
|
||||
const name = release.getName();
|
||||
const namespace = release.getNs()
|
||||
const namespace = release.getNs();
|
||||
const data = {
|
||||
chart: release.getChart(),
|
||||
repo: await release.getRepo(),
|
||||
@@ -121,7 +121,7 @@ export class ReleaseDetails extends Component<Props> {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderNotes() {
|
||||
@@ -222,13 +222,13 @@ export class ReleaseDetails extends Component<Props> {
|
||||
<DrawerTitle title={_i18n._(t`Resources`)}/>
|
||||
{this.renderResources()}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { release, hideDetails } = this.props
|
||||
const title = release ? <Trans>Release: {release.getName()}</Trans> : ""
|
||||
const toolbar = <HelmReleaseMenu release={release} toolbar hideDetails={hideDetails}/>
|
||||
const { release, hideDetails } = this.props;
|
||||
const title = release ? <Trans>Release: {release.getName()}</Trans> : "";
|
||||
const toolbar = <HelmReleaseMenu release={release} toolbar hideDetails={hideDetails}/>;
|
||||
return (
|
||||
<Drawer
|
||||
className={cssNames("ReleaseDetails", themeStore.activeTheme.type)}
|
||||
@@ -240,6 +240,6 @@ export class ReleaseDetails extends Component<Props> {
|
||||
>
|
||||
{this.renderContent()}
|
||||
</Drawer>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ export class HelmReleaseMenu extends React.Component<Props> {
|
||||
</MenuItem>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { HelmRelease, helmReleasesApi, IReleaseRevision } from "../../api/endpoi
|
||||
import { releaseStore } from "./release.store";
|
||||
import { Select, SelectOption } from "../select";
|
||||
import { Notifications } from "../notifications";
|
||||
import orderBy from "lodash/orderBy"
|
||||
import orderBy from "lodash/orderBy";
|
||||
|
||||
interface Props extends DialogProps {
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
|
||||
renderContent() {
|
||||
const { revision, revisions } = this;
|
||||
if (!revision) {
|
||||
return <p><Trans>No revisions to rollback.</Trans></p>
|
||||
return <p><Trans>No revisions to rollback.</Trans></p>;
|
||||
}
|
||||
return (
|
||||
<div className="flex gaps align-center">
|
||||
@@ -78,13 +78,13 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
|
||||
onChange={({ value }: SelectOption<IReleaseRevision>) => this.revision = value}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { ...dialogProps } = this.props;
|
||||
const releaseName = this.release ? this.release.getName() : "";
|
||||
const header = <h5><Trans>Rollback <b>{releaseName}</b></Trans></h5>
|
||||
const header = <h5><Trans>Rollback <b>{releaseName}</b></Trans></h5>;
|
||||
return (
|
||||
<Dialog
|
||||
{...dialogProps}
|
||||
@@ -104,6 +104,6 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
|
||||
</WizardStep>
|
||||
</Wizard>
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { appsRoute } from "../+apps/apps.route";
|
||||
|
||||
export const releaseRoute: RouteProps = {
|
||||
path: appsRoute.path + "/releases/:namespace?/:name?"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IReleaseRouteParams {
|
||||
name?: string;
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
|
||||
this.loadAll();
|
||||
}
|
||||
this.releaseSecrets = [...secrets];
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
unwatch() {
|
||||
@@ -48,7 +48,7 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
|
||||
const labels = {
|
||||
owner: "helm",
|
||||
name: release.getName()
|
||||
}
|
||||
};
|
||||
return secretsStore.getByLabel(labels)
|
||||
.filter(secret => secret.getNs() == release.getNs())[0];
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
|
||||
this.isLoading = true;
|
||||
let items;
|
||||
try {
|
||||
const { isAdmin, allowedNamespaces } = getHostedCluster()
|
||||
const { isAdmin, allowedNamespaces } = getHostedCluster();
|
||||
items = await this.loadItems(!isAdmin ? allowedNamespaces : null);
|
||||
} finally {
|
||||
if (items) {
|
||||
|
||||
@@ -48,7 +48,7 @@ export class HelmReleases extends Component<Props> {
|
||||
|
||||
showDetails = (item: HelmRelease) => {
|
||||
if (!item) {
|
||||
navigation.merge(releaseURL())
|
||||
navigation.merge(releaseURL());
|
||||
}
|
||||
else {
|
||||
navigation.merge(releaseURL({
|
||||
@@ -56,7 +56,7 @@ export class HelmReleases extends Component<Props> {
|
||||
name: item.getName(),
|
||||
namespace: item.getNs()
|
||||
}
|
||||
}))
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export class HelmReleases extends Component<Props> {
|
||||
<Trans>Note: StatefulSet Volumes won't be deleted automatically</Trans>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -122,7 +122,7 @@ export class HelmReleases extends Component<Props> {
|
||||
release.appVersion,
|
||||
{ title: release.getStatus(), className: kebabCase(release.getStatus()) },
|
||||
release.getUpdated(),
|
||||
]
|
||||
];
|
||||
}}
|
||||
renderItemMenu={(release: HelmRelease) => {
|
||||
return (
|
||||
@@ -130,7 +130,7 @@ export class HelmReleases extends Component<Props> {
|
||||
release={release}
|
||||
removeConfirmationMessage={this.renderRemoveDialogMessage([release])}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}}
|
||||
customizeRemoveDialog={(selectedItems: HelmRelease[]) => ({
|
||||
message: this.renderRemoveDialogMessage(selectedItems)
|
||||
|
||||
@@ -23,12 +23,12 @@ export class Apps extends React.Component {
|
||||
url: releaseURL({ query }),
|
||||
routePath: releaseRoute.path.toString(),
|
||||
},
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<TabLayout className="Apps" tabs={Apps.tabRoutes}/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,6 @@ export interface IClusterSettingsRouteParams extends IClusterViewRouteParams {
|
||||
|
||||
export const clusterSettingsRoute: RouteProps = {
|
||||
path: `/cluster/:clusterId/settings`,
|
||||
}
|
||||
};
|
||||
|
||||
export const clusterSettingsURL = buildURL<IClusterSettingsRouteParams>(clusterSettingsRoute.path)
|
||||
export const clusterSettingsURL = buildURL<IClusterSettingsRouteParams>(clusterSettingsRoute.path);
|
||||
@@ -14,7 +14,7 @@ import { IClusterSettingsRouteParams } from "./cluster-settings.route";
|
||||
import { clusterStore } from "../../../common/cluster-store";
|
||||
import { PageLayout } from "../layout/page-layout";
|
||||
import { requestMain } from "../../../common/ipc";
|
||||
import { clusterActivateHandler, clusterRefreshHandler } from "../../../common/cluster-ipc"
|
||||
import { clusterActivateHandler, clusterRefreshHandler } from "../../../common/cluster-ipc";
|
||||
|
||||
interface Props extends RouteComponentProps<IClusterSettingsRouteParams> {
|
||||
}
|
||||
@@ -22,7 +22,7 @@ interface Props extends RouteComponentProps<IClusterSettingsRouteParams> {
|
||||
@observer
|
||||
export class ClusterSettings extends React.Component<Props> {
|
||||
get clusterId() {
|
||||
return this.props.match.params.clusterId
|
||||
return this.props.match.params.clusterId;
|
||||
}
|
||||
|
||||
get cluster(): Cluster {
|
||||
@@ -37,18 +37,18 @@ export class ClusterSettings extends React.Component<Props> {
|
||||
reaction(() => this.clusterId, clusterId => clusterStore.setActive(clusterId), {
|
||||
fireImmediately: true,
|
||||
})
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
refreshCluster = async () => {
|
||||
if (this.cluster) {
|
||||
await requestMain(clusterActivateHandler, this.cluster.id)
|
||||
await requestMain(clusterRefreshHandler, this.cluster.id)
|
||||
await requestMain(clusterActivateHandler, this.cluster.id);
|
||||
await requestMain(clusterRefreshHandler, this.cluster.id);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const cluster = this.cluster
|
||||
const cluster = this.cluster;
|
||||
if (!cluster) return null;
|
||||
const header = (
|
||||
<>
|
||||
|
||||
@@ -35,14 +35,14 @@ export class ClusterIconSetting extends React.Component<Props> {
|
||||
cluster.preferences.icon = undefined;
|
||||
}
|
||||
} catch (e) {
|
||||
this.errorText = e.toString()
|
||||
this.status = GeneralInputStatus.ERROR
|
||||
this.errorText = e.toString();
|
||||
this.status = GeneralInputStatus.ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
getClearButton() {
|
||||
if (this.props.cluster.preferences.icon) {
|
||||
return <Button tooltip="Revert back to default icon" accent onClick={() => this.onIconPick([])}>Clear</Button>
|
||||
return <Button tooltip="Revert back to default icon" accent onClick={() => this.onIconPick([])}>Clear</Button>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
|
||||
service: parsed[1],
|
||||
port: parseInt(parsed[2]),
|
||||
prefix: apiPrefix
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
onSaveProvider = () => {
|
||||
|
||||
@@ -19,21 +19,21 @@ export class InstallFeature extends React.Component<Props> {
|
||||
@observable message = "";
|
||||
|
||||
componentDidMount() {
|
||||
const feature = this.props.feature
|
||||
const cluster = this.props.cluster
|
||||
const feature = this.props.feature;
|
||||
const cluster = this.props.cluster;
|
||||
const statusUpdate = interval(20, () => {
|
||||
feature.updateStatus(cluster)
|
||||
})
|
||||
statusUpdate.start(true)
|
||||
feature.updateStatus(cluster);
|
||||
});
|
||||
statusUpdate.start(true);
|
||||
|
||||
disposeOnUnmount(this, () => {
|
||||
statusUpdate.stop()
|
||||
})
|
||||
statusUpdate.stop();
|
||||
});
|
||||
|
||||
disposeOnUnmount(this,
|
||||
reaction(() => feature.status.installed, () => {
|
||||
this.loading = false;
|
||||
this.message = ""
|
||||
this.message = "";
|
||||
}, { equals: comparer.structural })
|
||||
);
|
||||
}
|
||||
@@ -60,8 +60,8 @@ export class InstallFeature extends React.Component<Props> {
|
||||
accent
|
||||
disabled={disabled}
|
||||
onClick={this.runAction(async () => {
|
||||
this.message = "Uninstalling feature ..."
|
||||
feature.uninstall(cluster)
|
||||
this.message = "Uninstalling feature ...";
|
||||
feature.uninstall(cluster);
|
||||
})}
|
||||
>
|
||||
Uninstall
|
||||
@@ -72,8 +72,8 @@ export class InstallFeature extends React.Component<Props> {
|
||||
primary
|
||||
disabled={disabled}
|
||||
onClick={this.runAction(async () =>{
|
||||
this.message = "Installing feature ..."
|
||||
feature.install(cluster)
|
||||
this.message = "Installing feature ...";
|
||||
feature.install(cluster);
|
||||
})}
|
||||
>
|
||||
Install
|
||||
|
||||
@@ -23,7 +23,7 @@ export class RemoveClusterButton extends React.Component<Props> {
|
||||
ok: async () => {
|
||||
await clusterStore.removeById(cluster.id);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -22,7 +22,7 @@ export class Features extends React.Component<Props> {
|
||||
<p><f.components.Description /></p>
|
||||
</>
|
||||
</InstallFeature>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./cluster-settings.route"
|
||||
export * from "./cluster-settings"
|
||||
export * from "./cluster-settings.route";
|
||||
export * from "./cluster-settings";
|
||||
@@ -14,7 +14,7 @@ export class Status extends React.Component<Props> {
|
||||
@autobind()
|
||||
openKubeconfig() {
|
||||
const { cluster } = this.props;
|
||||
shell.showItemInFolder(cluster.kubeConfigPath)
|
||||
shell.showItemInFolder(cluster.kubeConfigPath);
|
||||
}
|
||||
|
||||
renderStatusRows() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./cluster-issues.scss"
|
||||
import "./cluster-issues.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -43,7 +43,7 @@ export class ClusterIssues extends React.Component<Props> {
|
||||
|
||||
// Node bad conditions
|
||||
nodesStore.items.forEach(node => {
|
||||
const { kind, selfLink, getId, getName } = node
|
||||
const { kind, selfLink, getId, getName } = node;
|
||||
node.getWarningConditions().forEach(({ message }) => {
|
||||
warnings.push({
|
||||
kind,
|
||||
@@ -51,8 +51,8 @@ export class ClusterIssues extends React.Component<Props> {
|
||||
getName,
|
||||
selfLink,
|
||||
message,
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Warning events for Workloads
|
||||
@@ -67,7 +67,7 @@ export class ClusterIssues extends React.Component<Props> {
|
||||
kind,
|
||||
selfLink: lookupApiLink(involvedObject, error),
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ export const ClusterMetrics = observer(() => {
|
||||
return <Spinner center/>;
|
||||
}
|
||||
if (!memoryCapacity || !cpuCapacity) {
|
||||
return <ClusterNoMetrics className="empty"/>
|
||||
return <ClusterNoMetrics className="empty"/>;
|
||||
}
|
||||
return (
|
||||
<BarChart
|
||||
|
||||
@@ -24,7 +24,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
<p><Trans>Specified limits are higher than node capacity!</Trans></p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const renderCharts = () => {
|
||||
const data = getMetricLastPoints(clusterStore.metrics);
|
||||
@@ -168,7 +168,7 @@ export const ClusterPieCharts = observer(() => {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const renderContent = () => {
|
||||
const { masterNodes, workerNodes } = nodesStore;
|
||||
@@ -194,11 +194,11 @@ export const ClusterPieCharts = observer(() => {
|
||||
return <ClusterNoMetrics className="empty"/>;
|
||||
}
|
||||
return renderCharts();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="ClusterPieCharts flex">
|
||||
{renderContent()}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
});
|
||||
@@ -3,6 +3,6 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const clusterRoute: RouteProps = {
|
||||
path: "/cluster"
|
||||
}
|
||||
};
|
||||
|
||||
export const clusterURL = buildURL(clusterRoute.path)
|
||||
export const clusterURL = buildURL(clusterRoute.path);
|
||||
@@ -35,7 +35,7 @@ export class ClusterStore extends KubeObjectStore<Cluster> {
|
||||
Object.assign(this, storage.get());
|
||||
reaction(() => {
|
||||
const { metricType, metricNodeRole } = this;
|
||||
return { metricType, metricNodeRole }
|
||||
return { metricType, metricNodeRole };
|
||||
},
|
||||
settings => storage.set(settings)
|
||||
);
|
||||
@@ -85,9 +85,9 @@ export class ClusterStore extends KubeObjectStore<Cluster> {
|
||||
getMetricsValues(source: Partial<IClusterMetrics>): [number, string][] {
|
||||
switch (this.metricType) {
|
||||
case MetricType.CPU:
|
||||
return normalizeMetrics(source.cpuUsage).data.result[0].values
|
||||
return normalizeMetrics(source.cpuUsage).data.result[0].values;
|
||||
case MetricType.MEMORY:
|
||||
return normalizeMetrics(source.memoryUsage).data.result[0].values
|
||||
return normalizeMetrics(source.memoryUsage).data.result[0].values;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./cluster.scss"
|
||||
import "./cluster.scss";
|
||||
|
||||
import React from "react";
|
||||
import { computed, reaction } from "mobx";
|
||||
@@ -21,19 +21,19 @@ export class Cluster extends React.Component {
|
||||
private dependentStores = [nodesStore, podsStore];
|
||||
|
||||
private watchers = [
|
||||
interval(60, () => { getHostedCluster().available && clusterStore.getMetrics()}),
|
||||
interval(20, () => { getHostedCluster().available && eventStore.loadAll()})
|
||||
interval(60, () => { getHostedCluster().available && clusterStore.getMetrics();}),
|
||||
interval(20, () => { getHostedCluster().available && eventStore.loadAll();})
|
||||
];
|
||||
|
||||
@computed get isLoaded() {
|
||||
return nodesStore.isLoaded && podsStore.isLoaded
|
||||
return nodesStore.isLoaded && podsStore.isLoaded;
|
||||
}
|
||||
|
||||
// todo: refactor
|
||||
async componentDidMount() {
|
||||
const { dependentStores } = this;
|
||||
if (!isAllowedResource("nodes")) {
|
||||
dependentStores.splice(dependentStores.indexOf(nodesStore), 1)
|
||||
dependentStores.splice(dependentStores.indexOf(nodesStore), 1);
|
||||
}
|
||||
this.watchers.forEach(watcher => watcher.start(true));
|
||||
|
||||
@@ -49,7 +49,7 @@ export class Cluster extends React.Component {
|
||||
() => clusterStore.metricNodeRole,
|
||||
() => this.watchers.forEach(watcher => watcher.restart())
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -67,6 +67,6 @@ export class Cluster extends React.Component {
|
||||
)}
|
||||
</div>
|
||||
</TabLayout>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./cluster.route"
|
||||
export * from "./cluster.route";
|
||||
|
||||
@@ -51,7 +51,7 @@ export class HpaDetails extends React.Component<Props> {
|
||||
</Trans>
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Table>
|
||||
@@ -68,7 +68,7 @@ export class HpaDetails extends React.Component<Props> {
|
||||
<TableCell className="name">{name}</TableCell>
|
||||
<TableCell className="metrics">{values}</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
</Table>
|
||||
@@ -113,7 +113,7 @@ export class HpaDetails extends React.Component<Props> {
|
||||
tooltip={tooltip}
|
||||
className={cssNames({ [type.toLowerCase()]: isReady })}
|
||||
/>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</DrawerItem>
|
||||
|
||||
@@ -132,7 +132,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <HpaDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "HorizontalPodAutoscaler",
|
||||
@@ -141,4 +141,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -3,9 +3,9 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const hpaRoute: RouteProps = {
|
||||
path: "/hpa"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IHpaRouteParams {
|
||||
}
|
||||
|
||||
export const hpaURL = buildURL<IHpaRouteParams>(hpaRoute.path)
|
||||
export const hpaURL = buildURL<IHpaRouteParams>(hpaRoute.path);
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./hpa.scss"
|
||||
import "./hpa.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -78,7 +78,7 @@ export class HorizontalPodAutoscalers extends React.Component<Props> {
|
||||
tooltip={tooltip}
|
||||
className={cssNames(type.toLowerCase())}
|
||||
/>
|
||||
)
|
||||
);
|
||||
})
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./hpa"
|
||||
export * from "./hpa-details"
|
||||
export * from "./hpa.route"
|
||||
export * from "./hpa";
|
||||
export * from "./hpa-details";
|
||||
export * from "./hpa.route";
|
||||
@@ -31,7 +31,7 @@ export class ConfigMapDetails extends React.Component<Props> {
|
||||
this.data.replace(configMap.data); // refresh
|
||||
}
|
||||
})
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
save = async () => {
|
||||
@@ -75,7 +75,7 @@ export class ConfigMapDetails extends React.Component<Props> {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
<Button
|
||||
@@ -98,7 +98,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <ConfigMapDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ConfigMap",
|
||||
@@ -107,6 +107,6 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const configMapsRoute: RouteProps = {
|
||||
path: "/configmaps"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IConfigMapsRouteParams {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./config-maps.scss"
|
||||
import "./config-maps.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./config-maps.route"
|
||||
export * from "./config-maps"
|
||||
export * from "./config-map-details"
|
||||
export * from "./config-maps.route";
|
||||
export * from "./config-maps";
|
||||
export * from "./config-map-details";
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./pod-disruption-budgets.route"
|
||||
export * from "./pod-disruption-budgets"
|
||||
export * from "./pod-disruption-budgets-details"
|
||||
export * from "./pod-disruption-budgets.route";
|
||||
export * from "./pod-disruption-budgets";
|
||||
export * from "./pod-disruption-budgets-details";
|
||||
+4
-4
@@ -18,8 +18,8 @@ export class PodDisruptionBudgetDetails extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { object: pdb } = this.props;
|
||||
if (!pdb) return null
|
||||
const { status, spec } = pdb
|
||||
if (!pdb) return null;
|
||||
const { status, spec } = pdb;
|
||||
const selectors = pdb.getSelectors();
|
||||
return (
|
||||
<div className="PdbDetails">
|
||||
@@ -50,7 +50,7 @@ export class PodDisruptionBudgetDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,4 +60,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <PodDisruptionBudgetDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
+2
-2
@@ -3,9 +3,9 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const pdbRoute: RouteProps = {
|
||||
path: "/poddisruptionbudgets"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IPodDisruptionBudgetsRouteParams {
|
||||
}
|
||||
|
||||
export const pdbURL = buildURL<IPodDisruptionBudgetsRouteParams>(pdbRoute.path)
|
||||
export const pdbURL = buildURL<IPodDisruptionBudgetsRouteParams>(pdbRoute.path);
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./pod-disruption-budgets.scss"
|
||||
import "./pod-disruption-budgets.scss";
|
||||
|
||||
import * as React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -65,7 +65,7 @@ export class PodDisruptionBudgets extends React.Component<Props> {
|
||||
pdb.getCurrentHealthy(),
|
||||
pdb.getDesiredHealthy(),
|
||||
pdb.getAge(),
|
||||
]
|
||||
];
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -193,12 +193,12 @@ export class AddQuotaDialog extends React.Component<Props> {
|
||||
<div className="value">{value}</div>
|
||||
<Icon material="clear" onClick={() => this.quotas[quota] = ""} />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</WizardStep>
|
||||
</Wizard>
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./resource-quotas.route"
|
||||
export * from "./resource-quotas"
|
||||
export * from "./resource-quota-details"
|
||||
export * from "./resource-quotas.route";
|
||||
export * from "./resource-quotas";
|
||||
export * from "./resource-quota-details";
|
||||
@@ -20,24 +20,24 @@ const onlyNumbers = /$[0-9]*^/g;
|
||||
|
||||
function transformUnit(name: string, value: string): number {
|
||||
if (name.includes("memory") || name.includes("storage")) {
|
||||
return unitsToBytes(value)
|
||||
return unitsToBytes(value);
|
||||
}
|
||||
|
||||
if (name.includes("cpu")) {
|
||||
return cpuUnitsToNumber(value)
|
||||
return cpuUnitsToNumber(value);
|
||||
}
|
||||
|
||||
return metricUnitsToNumber(value);
|
||||
}
|
||||
|
||||
function renderQuotas(quota: ResourceQuota): JSX.Element[] {
|
||||
const { hard = {}, used = {} } = quota.status
|
||||
const { hard = {}, used = {} } = quota.status;
|
||||
|
||||
return Object.entries(hard)
|
||||
.filter(([name]) => used[name])
|
||||
.map(([name, value]) => {
|
||||
const current = transformUnit(name, used[name])
|
||||
const max = transformUnit(name, value)
|
||||
const current = transformUnit(name, used[name]);
|
||||
const max = transformUnit(name, value);
|
||||
const usage = max === 0 ? 100 : Math.ceil(current / max * 100); // special case 0 max as always 100% usage
|
||||
|
||||
return (
|
||||
@@ -52,8 +52,8 @@ function renderQuotas(quota: ResourceQuota): JSX.Element[] {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@observer
|
||||
@@ -104,4 +104,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <ReplicaSetDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -3,7 +3,7 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const resourceQuotaRoute: RouteProps = {
|
||||
path: "/resourcequotas"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IResourceQuotaRouteParams {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./add-secret-dialog.scss"
|
||||
import "./add-secret-dialog.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observable } from "mobx";
|
||||
@@ -85,7 +85,7 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
data[key] = processValue ? processValue(value) : value;
|
||||
}
|
||||
return data;
|
||||
}, {})
|
||||
}, {});
|
||||
}
|
||||
|
||||
createSecret = async () => {
|
||||
@@ -100,7 +100,7 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
annotations: this.getDataFromFields(annotations),
|
||||
labels: this.getDataFromFields(labels),
|
||||
} as IKubeObjectMetadata
|
||||
}
|
||||
};
|
||||
try {
|
||||
const newSecret = await secretsApi.create({ namespace, name }, secret);
|
||||
showDetails(newSecret.selfLink);
|
||||
@@ -163,11 +163,11 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
onClick={() => this.removeField(field, index)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -216,6 +216,6 @@ export class AddSecretDialog extends React.Component<Props> {
|
||||
</WizardStep>
|
||||
</Wizard>
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./secrets.route"
|
||||
export * from "./secrets"
|
||||
export * from "./secret-details"
|
||||
export * from "./secrets.route";
|
||||
export * from "./secrets";
|
||||
export * from "./secret-details";
|
||||
|
||||
@@ -36,7 +36,7 @@ export class SecretDetails extends React.Component<Props> {
|
||||
this.revealSecret = {};
|
||||
}
|
||||
})
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
saveSecret = async () => {
|
||||
@@ -97,7 +97,7 @@ export class SecretDetails extends React.Component<Props> {
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
<Button
|
||||
@@ -119,4 +119,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <SecretDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -3,7 +3,7 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const secretsRoute: RouteProps = {
|
||||
path: "/secrets"
|
||||
}
|
||||
};
|
||||
|
||||
export interface ISecretsRouteParams {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./secrets.scss"
|
||||
import "./secrets.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
|
||||
@@ -5,8 +5,8 @@ import { configMapsURL } from "../+config-maps/config-maps.route";
|
||||
|
||||
export const configRoute: RouteProps = {
|
||||
get path() {
|
||||
return Config.tabRoutes.map(({ routePath }) => routePath).flat()
|
||||
return Config.tabRoutes.map(({ routePath }) => routePath).flat();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const configURL = (params?: IURLParams) => configMapsURL(params);
|
||||
@@ -8,20 +8,20 @@ import { namespaceStore } from "../+namespaces/namespace.store";
|
||||
import { resourceQuotaRoute, ResourceQuotas, resourceQuotaURL } from "../+config-resource-quotas";
|
||||
import { pdbRoute, pdbURL, PodDisruptionBudgets } from "../+config-pod-disruption-budgets";
|
||||
import { HorizontalPodAutoscalers, hpaRoute, hpaURL } from "../+config-autoscalers";
|
||||
import { isAllowedResource } from "../../../common/rbac"
|
||||
import { isAllowedResource } from "../../../common/rbac";
|
||||
|
||||
@observer
|
||||
export class Config extends React.Component {
|
||||
static get tabRoutes(): TabLayoutRoute[] {
|
||||
const query = namespaceStore.getContextParams()
|
||||
const routes: TabLayoutRoute[] = []
|
||||
const query = namespaceStore.getContextParams();
|
||||
const routes: TabLayoutRoute[] = [];
|
||||
if (isAllowedResource("configmaps")) {
|
||||
routes.push({
|
||||
title: <Trans>ConfigMaps</Trans>,
|
||||
component: ConfigMaps,
|
||||
url: configMapsURL({ query }),
|
||||
routePath: configMapsRoute.path.toString(),
|
||||
})
|
||||
});
|
||||
}
|
||||
if (isAllowedResource("secrets")) {
|
||||
routes.push({
|
||||
@@ -29,7 +29,7 @@ export class Config extends React.Component {
|
||||
component: Secrets,
|
||||
url: secretsURL({ query }),
|
||||
routePath: secretsRoute.path.toString(),
|
||||
})
|
||||
});
|
||||
}
|
||||
if (isAllowedResource("resourcequotas")) {
|
||||
routes.push({
|
||||
@@ -37,7 +37,7 @@ export class Config extends React.Component {
|
||||
component: ResourceQuotas,
|
||||
url: resourceQuotaURL({ query }),
|
||||
routePath: resourceQuotaRoute.path.toString(),
|
||||
})
|
||||
});
|
||||
}
|
||||
if (isAllowedResource("horizontalpodautoscalers")) {
|
||||
routes.push({
|
||||
@@ -45,7 +45,7 @@ export class Config extends React.Component {
|
||||
component: HorizontalPodAutoscalers,
|
||||
url: hpaURL({ query }),
|
||||
routePath: hpaRoute.path.toString(),
|
||||
})
|
||||
});
|
||||
}
|
||||
if (isAllowedResource("poddisruptionbudgets")) {
|
||||
routes.push({
|
||||
@@ -53,7 +53,7 @@ export class Config extends React.Component {
|
||||
component: PodDisruptionBudgets,
|
||||
url: pdbURL({ query }),
|
||||
routePath: pdbRoute.path.toString(),
|
||||
})
|
||||
});
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
@@ -61,6 +61,6 @@ export class Config extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<TabLayout className="Config" tabs={Config.tabRoutes}/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./config.route"
|
||||
export * from "./config"
|
||||
export * from "./config.route";
|
||||
export * from "./config";
|
||||
@@ -60,7 +60,7 @@ export class CRDDetails extends React.Component<Props> {
|
||||
<DrawerItem name={<Trans>Conditions</Trans>} className="conditions" labelsOnly>
|
||||
{
|
||||
crd.getConditions().map(condition => {
|
||||
const { type, message, lastTransitionTime, status } = condition
|
||||
const { type, message, lastTransitionTime, status } = condition;
|
||||
return (
|
||||
<Badge
|
||||
key={type}
|
||||
@@ -112,7 +112,7 @@ export class CRDDetails extends React.Component<Props> {
|
||||
<Badge label={jsonPath}/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
</Table>
|
||||
@@ -130,7 +130,7 @@ export class CRDDetails extends React.Component<Props> {
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,4 +140,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <CRDDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./crd-list.scss"
|
||||
import "./crd-list.scss";
|
||||
|
||||
import React from "react";
|
||||
import { Trans } from "@lingui/macro";
|
||||
@@ -24,7 +24,7 @@ enum sortBy {
|
||||
@observer
|
||||
export class CrdList extends React.Component {
|
||||
@computed get groups() {
|
||||
return navigation.searchParams.getAsArray("groups")
|
||||
return navigation.searchParams.getAsArray("groups");
|
||||
}
|
||||
|
||||
onGroupChange(group: string) {
|
||||
@@ -32,7 +32,7 @@ export class CrdList extends React.Component {
|
||||
const index = groups.findIndex(item => item == group);
|
||||
if (index !== -1) groups.splice(index, 1);
|
||||
else groups.push(group);
|
||||
setQueryParams({ groups })
|
||||
setQueryParams({ groups });
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -52,14 +52,14 @@ export class CrdList extends React.Component {
|
||||
searchFilters={Object.values(sortingCallbacks)}
|
||||
filterItems={[
|
||||
(items: CustomResourceDefinition[]) => {
|
||||
return selectedGroups.length ? items.filter(item => selectedGroups.includes(item.getGroup())) : items
|
||||
return selectedGroups.length ? items.filter(item => selectedGroups.includes(item.getGroup())) : items;
|
||||
}
|
||||
]}
|
||||
renderHeaderTitle={<Trans>Custom Resources</Trans>}
|
||||
customizeHeader={() => {
|
||||
let placeholder = <Trans>All groups</Trans>;
|
||||
if (selectedGroups.length == 1) placeholder = <><Trans>Group</Trans>: {selectedGroups[0]}</>
|
||||
if (selectedGroups.length >= 2) placeholder = <><Trans>Groups</Trans>: {selectedGroups.join(", ")}</>
|
||||
if (selectedGroups.length == 1) placeholder = <><Trans>Group</Trans>: {selectedGroups[0]}</>;
|
||||
if (selectedGroups.length >= 2) placeholder = <><Trans>Groups</Trans>: {selectedGroups.join(", ")}</>;
|
||||
return {
|
||||
// todo: move to global filters
|
||||
filters: (
|
||||
@@ -77,11 +77,11 @@ export class CrdList extends React.Component {
|
||||
<span>{group}</span>
|
||||
{isSelected && <Icon small material="check" className="box right"/>}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
};
|
||||
}}
|
||||
renderTableHeader={[
|
||||
{ title: <Trans>Resource</Trans>, className: "kind", sortBy: sortBy.kind },
|
||||
@@ -99,10 +99,10 @@ export class CrdList extends React.Component {
|
||||
crd.getVersion(),
|
||||
crd.getScope(),
|
||||
crd.getAge(),
|
||||
]
|
||||
];
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ interface Props extends KubeObjectDetailsProps<CustomResourceDefinition> {
|
||||
|
||||
function convertSpecValue(value: any): any {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(convertSpecValue)
|
||||
return value.map(convertSpecValue);
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
@@ -31,10 +31,10 @@ function convertSpecValue(value: any): any {
|
||||
className="box grow"
|
||||
value={JSON.stringify(value, null, 2)}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return value
|
||||
return value;
|
||||
}
|
||||
|
||||
@observer
|
||||
@@ -48,13 +48,13 @@ export class CrdResourceDetails extends React.Component<Props> {
|
||||
<DrawerItem key={name} name={name} renderBoolean>
|
||||
{convertSpecValue(jsonPath.value(crd, jp.slice(1)))}
|
||||
</DrawerItem>
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
renderStatus(crd: CustomResourceDefinition, columns: AdditionalPrinterColumnsV1[]) {
|
||||
const showStatus = !columns.find(column => column.name == "Status") && crd.status?.conditions;
|
||||
if (!showStatus) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
const conditions = crd.status.conditions
|
||||
@@ -66,13 +66,13 @@ export class CrdResourceDetails extends React.Component<Props> {
|
||||
className={cssNames({ disabled: status === "False" }, kind.toLowerCase())}
|
||||
tooltip={message}
|
||||
/>
|
||||
))
|
||||
));
|
||||
|
||||
return (
|
||||
<DrawerItem name={<Trans>Status</Trans>} className="status" labelsOnly>
|
||||
{conditions}
|
||||
</DrawerItem>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -90,6 +90,6 @@ export class CrdResourceDetails extends React.Component<Props> {
|
||||
{this.renderAdditionalColumns(object, extraColumns)}
|
||||
{this.renderStatus(object, extraColumns)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ export class CrdResources extends React.Component<Props> {
|
||||
store.loadAll();
|
||||
}
|
||||
})
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
@computed get crd() {
|
||||
@@ -41,7 +41,7 @@ export class CrdResources extends React.Component<Props> {
|
||||
}
|
||||
|
||||
@computed get store() {
|
||||
if (!this.crd) return null
|
||||
if (!this.crd) return null;
|
||||
return apiManager.getStore(this.crd.getResourceApiBase());
|
||||
}
|
||||
|
||||
@@ -54,10 +54,10 @@ export class CrdResources extends React.Component<Props> {
|
||||
[sortBy.name]: (item: KubeObject) => item.getName(),
|
||||
[sortBy.namespace]: (item: KubeObject) => item.getNs(),
|
||||
[sortBy.age]: (item: KubeObject) => item.metadata.creationTimestamp,
|
||||
}
|
||||
};
|
||||
extraColumns.forEach(column => {
|
||||
sortingCallbacks[column.name] = (item: KubeObject) => jsonPath.value(item, column.jsonPath.slice(1))
|
||||
})
|
||||
sortingCallbacks[column.name] = (item: KubeObject) => jsonPath.value(item, column.jsonPath.slice(1));
|
||||
});
|
||||
|
||||
return (
|
||||
<KubeObjectListLayout
|
||||
@@ -78,7 +78,7 @@ export class CrdResources extends React.Component<Props> {
|
||||
title: name,
|
||||
className: name.toLowerCase(),
|
||||
sortBy: name
|
||||
}
|
||||
};
|
||||
}),
|
||||
{ title: <Trans>Age</Trans>, className: "age", sortBy: sortBy.age },
|
||||
]}
|
||||
@@ -92,6 +92,6 @@ export class CrdResources extends React.Component<Props> {
|
||||
crdInstance.getAge(),
|
||||
]}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const crdRoute: RouteProps = {
|
||||
path: "/crd"
|
||||
}
|
||||
};
|
||||
|
||||
export const crdDefinitionsRoute: RouteProps = {
|
||||
path: crdRoute.path + "/definitions"
|
||||
}
|
||||
};
|
||||
|
||||
export const crdResourcesRoute: RouteProps = {
|
||||
path: crdRoute.path + "/:group/:name"
|
||||
}
|
||||
};
|
||||
|
||||
export interface ICRDListQuery {
|
||||
groups?: string;
|
||||
|
||||
@@ -26,14 +26,14 @@ export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
||||
super();
|
||||
|
||||
// auto-init stores for crd-s
|
||||
reaction(() => this.items.toJS(), items => items.forEach(initStore))
|
||||
reaction(() => this.items.toJS(), items => items.forEach(initStore));
|
||||
}
|
||||
|
||||
protected sortItems(items: CustomResourceDefinition[]) {
|
||||
return super.sortItems(items, [
|
||||
crd => crd.getGroup(),
|
||||
crd => crd.getName(),
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
@computed get groups() {
|
||||
@@ -43,7 +43,7 @@ export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
||||
if (!groups[group]) groups[group] = [];
|
||||
groups[group].push(crd);
|
||||
return groups;
|
||||
}, groups)
|
||||
}, groups);
|
||||
}
|
||||
|
||||
getByGroup(group: string, pluralName: string) {
|
||||
@@ -53,12 +53,12 @@ export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
||||
}
|
||||
|
||||
getByObject(obj: KubeObject) {
|
||||
if (!obj) return null
|
||||
if (!obj) return null;
|
||||
const { kind, apiVersion } = obj;
|
||||
|
||||
return this.items.find(crd => (
|
||||
kind === crd.getResourceKind() && apiVersion === `${crd.getGroup()}/${crd.getVersion()}`
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export class CustomResources extends React.Component {
|
||||
url: crdURL(),
|
||||
routePath: crdRoute.path.toString(),
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -70,7 +70,7 @@ export class EventDetails extends React.Component<Props> {
|
||||
</TableRow>
|
||||
</Table>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,4 +80,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <EventDetails {...props}/>
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -20,7 +20,7 @@ export class EventStore extends KubeObjectStore<KubeEvent> {
|
||||
protected sortItems(items: KubeEvent[]) {
|
||||
return super.sortItems(items, [
|
||||
event => event.metadata.creationTimestamp
|
||||
], "desc")
|
||||
], "desc");
|
||||
}
|
||||
|
||||
getEventsByObject(obj: KubeObject): KubeEvent[] {
|
||||
|
||||
@@ -3,6 +3,6 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const eventRoute: RouteProps = {
|
||||
path: "/events"
|
||||
}
|
||||
};
|
||||
|
||||
export const eventsURL = buildURL(eventRoute.path);
|
||||
@@ -106,14 +106,14 @@ export class Events extends React.Component<Props> {
|
||||
event.getSource(),
|
||||
event.count,
|
||||
event.getAge(),
|
||||
]
|
||||
];
|
||||
}}
|
||||
virtual={!compact}
|
||||
filterItems={[
|
||||
items => compact ? items.slice(0, compactLimit) : items,
|
||||
]}
|
||||
/>
|
||||
)
|
||||
);
|
||||
if (compact) {
|
||||
return events;
|
||||
}
|
||||
@@ -121,6 +121,6 @@ export class Events extends React.Component<Props> {
|
||||
<TabLayout>
|
||||
{events}
|
||||
</TabLayout>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export class KubeEventDetails extends React.Component<KubeEventDetailsProps> {
|
||||
<DrawerTitle className="flex gaps align-center">
|
||||
<span><Trans>Events</Trans></span>
|
||||
</DrawerTitle>
|
||||
)
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
@@ -35,7 +35,7 @@ export class KubeEventDetails extends React.Component<KubeEventDetailsProps> {
|
||||
</DrawerTitle>
|
||||
<div className="KubeEventDetails">
|
||||
{events.map(evt => {
|
||||
const { message, count, lastTimestamp, involvedObject } = evt
|
||||
const { message, count, lastTimestamp, involvedObject } = evt;
|
||||
return (
|
||||
<div className="event" key={evt.getId()}>
|
||||
<div className={cssNames("title", { warning: evt.isWarning() })}>
|
||||
@@ -54,10 +54,10 @@ export class KubeEventDetails extends React.Component<KubeEventDetailsProps> {
|
||||
{lastTimestamp}
|
||||
</DrawerItem>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,6 @@ export class KubeEventIcon extends React.Component<Props> {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,6 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const extensionsRoute: RouteProps = {
|
||||
path: "/extensions"
|
||||
}
|
||||
};
|
||||
|
||||
export const extensionsURL = buildURL(extensionsRoute.path)
|
||||
export const extensionsURL = buildURL(extensionsRoute.path);
|
||||
@@ -24,8 +24,8 @@ export class Extensions extends React.Component {
|
||||
return [
|
||||
name.toLowerCase().includes(searchText),
|
||||
description.toLowerCase().includes(searchText),
|
||||
].some(v => v)
|
||||
})
|
||||
].some(v => v);
|
||||
});
|
||||
}
|
||||
|
||||
get extensionsPath() {
|
||||
@@ -55,7 +55,7 @@ export class Extensions extends React.Component {
|
||||
Check out documentation to <a href="https://docs.k8slens.dev/" target="_blank">learn more</a>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
renderExtensions() {
|
||||
@@ -66,7 +66,7 @@ export class Extensions extends React.Component {
|
||||
{search && <Trans>No search results found</Trans>}
|
||||
{!search && <p><Trans>There are no extensions in</Trans> <code>{extensionsPath}</code></p>}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
return extensions.map(ext => {
|
||||
const { manifestPath: extId, isEnabled, manifest } = ext;
|
||||
@@ -88,8 +88,8 @@ export class Extensions extends React.Component {
|
||||
<Button accent onClick={() => ext.isEnabled = false}>Disable</Button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./extensions.route"
|
||||
export * from "./extensions"
|
||||
export * from "./extensions.route";
|
||||
export * from "./extensions";
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./landing-page.route"
|
||||
export * from "./landing-page"
|
||||
export * from "./landing-page.route";
|
||||
export * from "./landing-page";
|
||||
@@ -3,6 +3,6 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const landingRoute: RouteProps = {
|
||||
path: "/landing"
|
||||
}
|
||||
};
|
||||
|
||||
export const landingURL = buildURL(landingRoute.path)
|
||||
export const landingURL = buildURL(landingRoute.path);
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./landing-page.scss"
|
||||
import "./landing-page.scss";
|
||||
import React from "react";
|
||||
import { observable } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -37,6 +37,6 @@ export class LandingPage extends React.Component {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./add-namespace-dialog.scss"
|
||||
import "./add-namespace-dialog.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observable } from "mobx";
|
||||
@@ -74,6 +74,6 @@ export class AddNamespaceDialog extends React.Component<Props> {
|
||||
</WizardStep>
|
||||
</Wizard>
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from "./namespaces.route"
|
||||
export * from "./namespaces"
|
||||
export * from "./namespace-details"
|
||||
export * from "./add-namespace-dialog"
|
||||
export * from "./namespaces.route";
|
||||
export * from "./namespaces";
|
||||
export * from "./namespace-details";
|
||||
export * from "./add-namespace-dialog";
|
||||
@@ -62,4 +62,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <NamespaceDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./namespace-select.scss"
|
||||
import "./namespace-select.scss";
|
||||
|
||||
import React from "react";
|
||||
import { computed } from "mobx";
|
||||
@@ -83,8 +83,8 @@ export class NamespaceSelectFilter extends React.Component {
|
||||
render() {
|
||||
const { contextNs, hasContext, toggleContext } = namespaceStore;
|
||||
let placeholder = <Trans>All namespaces</Trans>;
|
||||
if (contextNs.length == 1) placeholder = <Trans>Namespace: {contextNs[0]}</Trans>
|
||||
if (contextNs.length >= 2) placeholder = <Trans>Namespaces: {contextNs.join(", ")}</Trans>
|
||||
if (contextNs.length == 1) placeholder = <Trans>Namespace: {contextNs[0]}</Trans>;
|
||||
if (contextNs.length >= 2) placeholder = <Trans>Namespaces: {contextNs.join(", ")}</Trans>;
|
||||
return (
|
||||
<NamespaceSelect
|
||||
placeholder={placeholder}
|
||||
@@ -101,9 +101,9 @@ export class NamespaceSelectFilter extends React.Component {
|
||||
<span>{namespace}</span>
|
||||
{isSelected && <Icon small material="check" className="box right" />}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,20 +36,20 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
getContextParams(): Partial<IQueryParams> {
|
||||
return {
|
||||
namespaces: this.contextNs
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected updateUrl(namespaces: string[]) {
|
||||
setQueryParams({ namespaces }, { replace: true })
|
||||
setQueryParams({ namespaces }, { replace: true });
|
||||
}
|
||||
|
||||
protected async loadItems(namespaces?: string[]) {
|
||||
if (!isAllowedResource("namespaces")) {
|
||||
if (namespaces) return namespaces.map(this.getDummyNamespace);
|
||||
return []
|
||||
return [];
|
||||
}
|
||||
if (namespaces) {
|
||||
return Promise.all(namespaces.map(name => this.api.get({ name })))
|
||||
return Promise.all(namespaces.map(name => this.api.get({ name })));
|
||||
} else {
|
||||
return super.loadItems();
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
resourceVersion: "",
|
||||
selfLink: `/api/v1/namespaces/${name}`
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
setContext(namespaces: string[]) {
|
||||
|
||||
@@ -3,9 +3,9 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const namespacesRoute: RouteProps = {
|
||||
path: "/namespaces"
|
||||
}
|
||||
};
|
||||
|
||||
export interface INamespacesRouteParams {
|
||||
}
|
||||
|
||||
export const namespacesURL = buildURL<INamespacesRouteParams>(namespacesRoute.path)
|
||||
export const namespacesURL = buildURL<INamespacesRouteParams>(namespacesRoute.path);
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./namespaces.scss"
|
||||
import "./namespaces.scss";
|
||||
|
||||
import React from "react";
|
||||
import { Trans } from "@lingui/macro";
|
||||
@@ -64,6 +64,6 @@ export class Namespaces extends React.Component<Props> {
|
||||
/>
|
||||
<AddNamespaceDialog/>
|
||||
</TabLayout>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./endpoint-details.scss"
|
||||
import "./endpoint-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -28,7 +28,7 @@ export class EndpointDetails extends React.Component<Props> {
|
||||
endpoint.getEndpointSubsets().map((subset) => {
|
||||
return(
|
||||
<EndpointSubsetList subset={subset} endpoint={endpoint}/>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
@@ -42,7 +42,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <EndpointDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Endpoints",
|
||||
apiVersions: ["v1"],
|
||||
@@ -50,4 +50,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./endpoint-subset-list.scss"
|
||||
import "./endpoint-subset-list.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -23,14 +23,14 @@ export class EndpointSubsetList extends React.Component<Props> {
|
||||
getAddressTableRow(ip: string) {
|
||||
const { subset } = this.props;
|
||||
const address = subset.getAddresses().find(address => address.getId() == ip);
|
||||
return this.renderAddressTableRow(address)
|
||||
return this.renderAddressTableRow(address);
|
||||
}
|
||||
|
||||
@autobind()
|
||||
getNotReadyAddressTableRow(ip: string) {
|
||||
const { subset} = this.props;
|
||||
const address = subset.getNotReadyAddresses().find(address => address.getId() == ip);
|
||||
return this.renderAddressTableRow(address)
|
||||
return this.renderAddressTableRow(address);
|
||||
}
|
||||
|
||||
@autobind()
|
||||
@@ -56,7 +56,7 @@ export class EndpointSubsetList extends React.Component<Props> {
|
||||
}
|
||||
</Table>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@autobind()
|
||||
|
||||
@@ -3,9 +3,9 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const endpointRoute: RouteProps = {
|
||||
path: "/endpoints"
|
||||
}
|
||||
};
|
||||
|
||||
export interface EndpointRouteParams {
|
||||
}
|
||||
|
||||
export const endpointURL = buildURL<EndpointRouteParams>(endpointRoute.path)
|
||||
export const endpointURL = buildURL<EndpointRouteParams>(endpointRoute.path);
|
||||
@@ -1,10 +1,10 @@
|
||||
import "./endpoints.scss"
|
||||
import "./endpoints.scss";
|
||||
|
||||
import React from "react"
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { RouteComponentProps } from "react-router-dom"
|
||||
import { EndpointRouteParams } from "./endpoints.route"
|
||||
import { Endpoint } from "../../api/endpoints/endpoint.api"
|
||||
import { RouteComponentProps } from "react-router-dom";
|
||||
import { EndpointRouteParams } from "./endpoints.route";
|
||||
import { Endpoint } from "../../api/endpoints/endpoint.api";
|
||||
import { endpointStore } from "./endpoints.store";
|
||||
import { KubeObjectListLayout } from "../kube-object";
|
||||
import { Trans } from "@lingui/macro";
|
||||
@@ -55,6 +55,6 @@ export class Endpoints extends React.Component<Props> {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./endpoints.route"
|
||||
export * from "./endpoints"
|
||||
export * from "./endpoint-details"
|
||||
export * from "./endpoints.route";
|
||||
export * from "./endpoints";
|
||||
export * from "./endpoint-details";
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./ingresses.route"
|
||||
export * from "./ingresses"
|
||||
export * from "./ingress-details"
|
||||
export * from "./ingresses.route";
|
||||
export * from "./ingresses";
|
||||
export * from "./ingress-details";
|
||||
@@ -94,4 +94,4 @@ export const IngressCharts = observer(() => {
|
||||
data={{ datasets: datasets[tabId] }}
|
||||
/>
|
||||
);
|
||||
})
|
||||
});
|
||||
@@ -30,8 +30,8 @@ export class IngressDetails extends React.Component<Props> {
|
||||
}
|
||||
|
||||
renderPaths(ingress: Ingress) {
|
||||
const { spec: { rules } } = ingress
|
||||
if (!rules || !rules.length) return null
|
||||
const { spec: { rules } } = ingress;
|
||||
if (!rules || !rules.length) return null;
|
||||
return rules.map((rule, index) => {
|
||||
return (
|
||||
<div className="rules" key={index}>
|
||||
@@ -48,7 +48,7 @@ export class IngressDetails extends React.Component<Props> {
|
||||
</TableHead>
|
||||
{
|
||||
rule.http.paths.map((path, index) => {
|
||||
const backend = `${path.backend.serviceName}:${path.backend.servicePort}`
|
||||
const backend = `${path.backend.serviceName}:${path.backend.servicePort}`;
|
||||
return (
|
||||
<TableRow key={index}>
|
||||
<TableCell className="path">{path.path || ""}</TableCell>
|
||||
@@ -56,18 +56,18 @@ export class IngressDetails extends React.Component<Props> {
|
||||
<p key={backend}>{backend}</p>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
</Table>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
renderIngressPoints(ingressPoints: ILoadBalancerIngress[]) {
|
||||
if (!ingressPoints || ingressPoints.length === 0) return null
|
||||
if (!ingressPoints || ingressPoints.length === 0) return null;
|
||||
return (
|
||||
<div>
|
||||
<Table className="ingress-points">
|
||||
@@ -81,11 +81,11 @@ export class IngressDetails extends React.Component<Props> {
|
||||
<TableCell className="name">{hostname ? hostname : "-"}</TableCell>
|
||||
<TableCell className="ingresspoints">{ip ? ip : "-"}</TableCell>
|
||||
</TableRow>
|
||||
)})
|
||||
);})
|
||||
})
|
||||
</Table>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -94,7 +94,7 @@ export class IngressDetails extends React.Component<Props> {
|
||||
return null;
|
||||
}
|
||||
const { spec, status } = ingress;
|
||||
const ingressPoints = status?.loadBalancer?.ingress
|
||||
const ingressPoints = status?.loadBalancer?.ingress;
|
||||
const { metrics } = ingressStore;
|
||||
const metricTabs = [
|
||||
<Trans>Network</Trans>,
|
||||
@@ -128,7 +128,7 @@ export class IngressDetails extends React.Component<Props> {
|
||||
<DrawerTitle title={<Trans>Load-Balancer Ingress Points</Trans>}/>
|
||||
{this.renderIngressPoints(ingressPoints)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <IngressDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Ingress",
|
||||
apiVersions: ["extensions/v1beta1"],
|
||||
@@ -146,4 +146,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -3,9 +3,9 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const ingressRoute: RouteProps = {
|
||||
path: "/ingresses"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IngressRouteParams {
|
||||
}
|
||||
|
||||
export const ingressURL = buildURL<IngressRouteParams>(ingressRoute.path)
|
||||
export const ingressURL = buildURL<IngressRouteParams>(ingressRoute.path);
|
||||
@@ -1,10 +1,10 @@
|
||||
import "./ingresses.scss"
|
||||
import "./ingresses.scss";
|
||||
|
||||
import React from "react"
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { RouteComponentProps } from "react-router-dom"
|
||||
import { IngressRouteParams } from "./ingresses.route"
|
||||
import { Ingress } from "../../api/endpoints/ingress.api"
|
||||
import { RouteComponentProps } from "react-router-dom";
|
||||
import { IngressRouteParams } from "./ingresses.route";
|
||||
import { Ingress } from "../../api/endpoints/ingress.api";
|
||||
import { ingressStore } from "./ingress.store";
|
||||
import { KubeObjectListLayout } from "../kube-object";
|
||||
import { Trans } from "@lingui/macro";
|
||||
@@ -58,6 +58,6 @@ export class Ingresses extends React.Component<Props> {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./network-policies.route"
|
||||
export * from "./network-policies"
|
||||
export * from "./network-policy-details"
|
||||
export * from "./network-policies.route";
|
||||
export * from "./network-policies";
|
||||
export * from "./network-policy-details";
|
||||
@@ -3,7 +3,7 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const networkPoliciesRoute: RouteProps = {
|
||||
path: "/network-policies"
|
||||
}
|
||||
};
|
||||
|
||||
export interface INetworkPoliciesRouteParams {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./network-policies.scss"
|
||||
import "./network-policies.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -49,6 +49,6 @@ export class NetworkPolicies extends React.Component<Props> {
|
||||
item.getAge(),
|
||||
]}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./network-policy-details.scss"
|
||||
import "./network-policy-details.scss";
|
||||
|
||||
import get from "lodash/get";
|
||||
import React, { Fragment } from "react";
|
||||
@@ -27,10 +27,10 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
<SubTitle title={<Trans>From</Trans>}/>
|
||||
{from.map(item =>
|
||||
Object.keys(item).map(key => {
|
||||
const data = get(item, key)
|
||||
const data = get(item, key);
|
||||
if (key === "ipBlock") {
|
||||
const { cidr, except } = data as IPolicyIpBlock;
|
||||
if (!cidr) return
|
||||
if (!cidr) return;
|
||||
return (
|
||||
<DrawerItem name={key} key={key}>
|
||||
cidr: {cidr}, {" "}
|
||||
@@ -38,9 +38,9 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
`except: ${except.join(", ")}`
|
||||
}
|
||||
</DrawerItem>
|
||||
)
|
||||
);
|
||||
}
|
||||
const selector: IPolicySelector = data
|
||||
const selector: IPolicySelector = data;
|
||||
if (selector.matchLabels) {
|
||||
return (
|
||||
<DrawerItem name={key} key={key}>
|
||||
@@ -51,7 +51,7 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
.join(", ")
|
||||
}
|
||||
</DrawerItem>
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (<DrawerItem name={key} key={key}>(empty)</DrawerItem>);
|
||||
@@ -69,10 +69,10 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
<>
|
||||
<SubTitle title={<Trans>To</Trans>}/>
|
||||
{to.map(item => {
|
||||
const { ipBlock } = item
|
||||
if (!ipBlock) return
|
||||
const { cidr, except } = ipBlock
|
||||
if (!cidr) return
|
||||
const { ipBlock } = item;
|
||||
if (!ipBlock) return;
|
||||
const { cidr, except } = ipBlock;
|
||||
if (!cidr) return;
|
||||
return (
|
||||
<DrawerItem name="ipBlock" key={cidr}>
|
||||
cidr: {cidr}, {" "}
|
||||
@@ -80,7 +80,7 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
`except: ${except.join(", ")}`
|
||||
}
|
||||
</DrawerItem>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
@@ -116,7 +116,7 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
{this.renderIngressFrom(ingress)}
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
@@ -133,7 +133,7 @@ export class NetworkPolicyDetails extends React.Component<Props> {
|
||||
</DrawerItem>
|
||||
{this.renderEgressTo(egress)}
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
@@ -148,7 +148,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <NetworkPolicyDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "NetworkPolicy",
|
||||
@@ -157,4 +157,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from "./services.route"
|
||||
export * from "./services"
|
||||
export * from "./service-details"
|
||||
export * from "./services.route";
|
||||
export * from "./services";
|
||||
export * from "./service-details";
|
||||
@@ -15,12 +15,12 @@ interface Props {
|
||||
@observer
|
||||
export class ServiceDetailsEndpoint extends React.Component<Props> {
|
||||
render() {
|
||||
const { endpoint } = this.props
|
||||
const { endpoint } = this.props;
|
||||
if (!endpoint && !endpointStore.isLoaded) return (
|
||||
<div className="PodDetailsList flex justify-center"><Spinner/></div>
|
||||
);
|
||||
if (!endpoint) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div className="EndpointList flex column">
|
||||
@@ -44,6 +44,6 @@ export class ServiceDetailsEndpoint extends React.Component<Props> {
|
||||
</TableRow>
|
||||
</Table>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./service-details.scss"
|
||||
import "./service-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -24,14 +24,14 @@ export class ServiceDetails extends React.Component<Props> {
|
||||
if (!endpointStore.isLoaded) {
|
||||
endpointStore.loadAll();
|
||||
}
|
||||
endpointApi.watch()
|
||||
endpointApi.watch();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { object: service } = this.props;
|
||||
if (!service) return;
|
||||
const { spec } = service;
|
||||
const endpoint = endpointStore.getByName(service.getName(), service.getNs())
|
||||
const endpoint = endpointStore.getByName(service.getName(), service.getNs());
|
||||
return (
|
||||
<div className="ServicesDetails">
|
||||
<KubeObjectMeta object={service}/>
|
||||
@@ -89,7 +89,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <ServiceDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Service",
|
||||
@@ -98,4 +98,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,15 +1,15 @@
|
||||
import "./service-port-component.scss"
|
||||
import "./service-port-component.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { t } from "@lingui/macro";
|
||||
import { Service, ServicePort } from "../../api/endpoints";
|
||||
import { _i18n } from "../../i18n";
|
||||
import { apiBase } from "../../api"
|
||||
import { apiBase } from "../../api";
|
||||
import { observable } from "mobx";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Notifications } from "../notifications";
|
||||
import { Spinner } from "../spinner"
|
||||
import { Spinner } from "../spinner";
|
||||
|
||||
interface Props {
|
||||
service: Service;
|
||||
@@ -24,7 +24,7 @@ export class ServicePortComponent extends React.Component<Props> {
|
||||
const { service, port } = this.props;
|
||||
this.waiting = true;
|
||||
try {
|
||||
await apiBase.post(`/pods/${service.getNs()}/service/${service.getName()}/port-forward/${port.port}`, {})
|
||||
await apiBase.post(`/pods/${service.getNs()}/service/${service.getName()}/port-forward/${port.port}`, {});
|
||||
} catch(error) {
|
||||
Notifications.error(error);
|
||||
} finally {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
export const servicesRoute: RouteProps = {
|
||||
path: "/services"
|
||||
}
|
||||
};
|
||||
|
||||
export interface IServicesRouteParams {
|
||||
}
|
||||
|
||||
Loaded 100 of 531 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user