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
@@ -49,13 +49,13 @@ export class DeploymentDetails extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { object: deployment } = this.props;
|
||||
if (!deployment) return null
|
||||
const { status, spec } = deployment
|
||||
const nodeSelector = deployment.getNodeSelectors()
|
||||
if (!deployment) return null;
|
||||
const { status, spec } = deployment;
|
||||
const nodeSelector = deployment.getNodeSelectors();
|
||||
const selectors = deployment.getSelectors();
|
||||
const childPods = deploymentStore.getChildPods(deployment)
|
||||
const replicaSets = replicaSetStore.getReplicaSetsByOwner(deployment)
|
||||
const metrics = deploymentStore.metrics
|
||||
const childPods = deploymentStore.getChildPods(deployment);
|
||||
const replicaSets = replicaSetStore.getReplicaSetsByOwner(deployment);
|
||||
const metrics = deploymentStore.metrics;
|
||||
return (
|
||||
<div className="DeploymentDetails">
|
||||
{podsStore.isLoaded && (
|
||||
@@ -94,7 +94,7 @@ export class DeploymentDetails extends React.Component<Props> {
|
||||
<DrawerItem name={<Trans>Conditions</Trans>} className="conditions" labelsOnly>
|
||||
{
|
||||
deployment.getConditions().map(condition => {
|
||||
const { type, message, lastTransitionTime, status } = condition
|
||||
const { type, message, lastTransitionTime, status } = condition;
|
||||
return (
|
||||
<Badge
|
||||
key={type}
|
||||
@@ -117,7 +117,7 @@ export class DeploymentDetails extends React.Component<Props> {
|
||||
<ReplicaSets replicaSets={replicaSets}/>
|
||||
<PodDetailsList pods={childPods} owner={deployment}/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props: any) => <DeploymentDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Deployment",
|
||||
apiVersions: ["apps/v1"],
|
||||
@@ -135,4 +135,4 @@ kubeObjectDetailRegistry.add({
|
||||
components: {
|
||||
Details: (props: any) => <KubeEventDetails {...props} />
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { render, waitFor, fireEvent } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom/extend-expect'
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
|
||||
import { DeploymentScaleDialog } from "./deployment-scale-dialog";
|
||||
jest.mock("../../api/endpoints");
|
||||
@@ -91,7 +91,7 @@ const dummyDeployment = {
|
||||
toPlainObject: jest.fn(),
|
||||
update: jest.fn(),
|
||||
delete: jest.fn(),
|
||||
}
|
||||
};
|
||||
|
||||
describe('<DeploymentScaleDialog />', () => {
|
||||
|
||||
@@ -103,7 +103,7 @@ describe('<DeploymentScaleDialog />', () => {
|
||||
it('inits with a dummy deployment with mocked current/desired scale', async () => {
|
||||
// mock deploymentApi.getReplicas() which will be called
|
||||
// when <DeploymentScaleDialog /> rendered.
|
||||
const initReplicas = 3
|
||||
const initReplicas = 3;
|
||||
deploymentApi.getReplicas = jest.fn().mockImplementationOnce(async () => initReplicas);
|
||||
const { getByTestId } = render(<DeploymentScaleDialog />);
|
||||
DeploymentScaleDialog.open(dummyDeployment);
|
||||
@@ -113,7 +113,7 @@ describe('<DeploymentScaleDialog />', () => {
|
||||
const [currentScale, desiredScale] = await Promise.all([
|
||||
getByTestId('current-scale'),
|
||||
getByTestId('desired-scale'),
|
||||
])
|
||||
]);
|
||||
expect(currentScale).toHaveTextContent(`${initReplicas}`);
|
||||
expect(desiredScale).toHaveTextContent(`${initReplicas}`);
|
||||
});
|
||||
@@ -121,7 +121,7 @@ describe('<DeploymentScaleDialog />', () => {
|
||||
});
|
||||
|
||||
it('changes the desired scale when clicking the icon buttons +/-', async () => {
|
||||
const initReplicas = 1
|
||||
const initReplicas = 1;
|
||||
deploymentApi.getReplicas = jest.fn().mockImplementationOnce(async () => initReplicas);
|
||||
const { getByTestId } = render(<DeploymentScaleDialog />);
|
||||
DeploymentScaleDialog.open(dummyDeployment);
|
||||
@@ -130,7 +130,7 @@ describe('<DeploymentScaleDialog />', () => {
|
||||
expect(desiredScale).toHaveTextContent(`${initReplicas}`);
|
||||
});
|
||||
const up = await getByTestId('desired-replicas-up');
|
||||
const down = await getByTestId('desired-replicas-down')
|
||||
const down = await getByTestId('desired-replicas-down');
|
||||
fireEvent.click(up);
|
||||
expect(await getByTestId('desired-scale')).toHaveTextContent(`${initReplicas + 1}`);
|
||||
fireEvent.click(down);
|
||||
|
||||
@@ -84,11 +84,11 @@ export class DeploymentScaleDialog extends Component<Props> {
|
||||
}
|
||||
|
||||
desiredReplicasUp = () => {
|
||||
this.desiredReplicas < this.scaleMax && this.desiredReplicas++
|
||||
this.desiredReplicas < this.scaleMax && this.desiredReplicas++;
|
||||
}
|
||||
|
||||
desiredReplicasDown = () => {
|
||||
this.desiredReplicas > 1 && this.desiredReplicas--
|
||||
this.desiredReplicas > 1 && this.desiredReplicas--;
|
||||
};
|
||||
|
||||
renderContents() {
|
||||
@@ -126,7 +126,7 @@ export class DeploymentScaleDialog extends Component<Props> {
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -22,26 +22,26 @@ export class DeploymentStore extends KubeObjectStore<Deployment> {
|
||||
}
|
||||
|
||||
getStatuses(deployments?: Deployment[]) {
|
||||
const status = { failed: 0, pending: 0, running: 0 }
|
||||
const status = { failed: 0, pending: 0, running: 0 };
|
||||
deployments.forEach(deployment => {
|
||||
const pods = this.getChildPods(deployment);
|
||||
if (pods.some(pod => pod.getStatus() === PodStatus.FAILED)) {
|
||||
status.failed++
|
||||
status.failed++;
|
||||
}
|
||||
else if (pods.some(pod => pod.getStatus() === PodStatus.PENDING)) {
|
||||
status.pending++
|
||||
status.pending++;
|
||||
}
|
||||
else {
|
||||
status.running++
|
||||
status.running++;
|
||||
}
|
||||
})
|
||||
return status
|
||||
});
|
||||
return status;
|
||||
}
|
||||
|
||||
getChildPods(deployment: Deployment) {
|
||||
return podsStore
|
||||
.getByLabel(deployment.getTemplateLabels())
|
||||
.filter(pod => pod.getNs() === deployment.getNs())
|
||||
.filter(pod => pod.getNs() === deployment.getNs());
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./deployments.scss"
|
||||
import "./deployments.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
@@ -39,17 +39,17 @@ interface Props extends RouteComponentProps<IDeploymentsRouteParams> {
|
||||
@observer
|
||||
export class Deployments extends React.Component<Props> {
|
||||
renderPods(deployment: Deployment) {
|
||||
const { replicas, availableReplicas } = deployment.status
|
||||
return `${availableReplicas || 0}/${replicas || 0}`
|
||||
const { replicas, availableReplicas } = deployment.status;
|
||||
return `${availableReplicas || 0}/${replicas || 0}`;
|
||||
}
|
||||
|
||||
renderConditions(deployment: Deployment) {
|
||||
const conditions = orderBy(deployment.getConditions(true), "type", "asc")
|
||||
const conditions = orderBy(deployment.getConditions(true), "type", "asc");
|
||||
return conditions.map(({ type, message }) => (
|
||||
<span key={type} className={cssNames("condition", kebabCase(type))} title={message}>
|
||||
{type}
|
||||
</span>
|
||||
))
|
||||
));
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -88,10 +88,10 @@ export class Deployments extends React.Component<Props> {
|
||||
this.renderConditions(deployment),
|
||||
]}
|
||||
renderItemMenu={(item: Deployment) => {
|
||||
return <DeploymentMenu object={item}/>
|
||||
return <DeploymentMenu object={item}/>;
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export function DeploymentMenu(props: KubeObjectMenuProps<Deployment>) {
|
||||
await deploymentApi.restart({
|
||||
namespace: object.getNs(),
|
||||
name: object.getName(),
|
||||
})
|
||||
});
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ export function DeploymentMenu(props: KubeObjectMenuProps<Deployment>) {
|
||||
<span className="title"><Trans>Restart</Trans></span>
|
||||
</MenuItem>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
kubeObjectMenuRegistry.add({
|
||||
@@ -135,4 +135,4 @@ kubeObjectMenuRegistry.add({
|
||||
components: {
|
||||
MenuItem: DeploymentMenu
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./deployments"
|
||||
export * from "./deployment-details"
|
||||
export * from "./deployments";
|
||||
export * from "./deployment-details";
|
||||
Reference in new issue
Block a user