Skip to content

Commit

Permalink
Run prettier on whole code base. (#1818)
Browse files Browse the repository at this point in the history
Co-authored-by: Andres Martinez Gotor <andresmgot@vmware.com>
  • Loading branch information
absoludity and Andres Martinez Gotor committed Jun 24, 2020
1 parent 8d8fd4d commit 083c863
Show file tree
Hide file tree
Showing 32 changed files with 197 additions and 105 deletions.
5 changes: 2 additions & 3 deletions dashboard/src/actions/repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import {
IAppRepositoryKey,
ISecret,
IStoreState,
NotFoundError
NotFoundError,
} from "../shared/types";
import { errorChart } from "./charts";


export const addRepo = createAction("ADD_REPO");
export const addedRepo = createAction("ADDED_REPO", resolve => {
return (added: IAppRepository) => resolve(added);
Expand Down Expand Up @@ -114,7 +113,7 @@ export const deleteRepo = (
): ThunkAction<Promise<boolean>, IStoreState, null, AppReposAction> => {
return async (dispatch, getState) => {
const {
clusters: {
clusters: {
clusters: {
default: { currentNamespace },
},
Expand Down
1 change: 0 additions & 1 deletion dashboard/src/components/AppList/AppListItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as url from "../../shared/url";
import InfoCard from "../InfoCard";
import AppListItem from "./AppListItem";


it("renders an app item", () => {
const wrapper = shallow(
<AppListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Redirect } from "react-router";
import * as url from "../../../shared/url";
import UpgradeButton from "./UpgradeButton";


it("renders a redirect when clicking upgrade", () => {
const push = jest.fn();
const wrapper = shallow(
Expand Down
2 changes: 0 additions & 2 deletions dashboard/src/components/AppView/ChartInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import * as url from "../../shared/url";
import Card, { CardContent, CardFooter, CardGrid, CardIcon } from "../Card";
import "./ChartInfo.css";



interface IChartInfoProps {
app: IRelease;
}
Expand Down
15 changes: 12 additions & 3 deletions dashboard/src/components/Catalog/Catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { MessageAlert } from "../ErrorAlert";
import LoadingWrapper from "../LoadingWrapper";
import PageHeader from "../PageHeader";
import SearchFilter from "../SearchFilter";
import CatalogItem, { ICatalogItemProps, IChartCatalogItem, IOperatorCatalogItem } from "./CatalogItem";
import CatalogItem, {
ICatalogItemProps,
IChartCatalogItem,
IOperatorCatalogItem,
} from "./CatalogItem";

interface ICatalogProps {
charts: IChartState;
Expand Down Expand Up @@ -104,8 +108,13 @@ class Catalog extends React.Component<ICatalogProps, ICatalogState> {
const filteredCSVs = this.shouldRenderOperators() ? this.filteredCSVs(csvs) : [];
const catalogItems = this.getCatalogItems(filteredCharts, filteredCSVs);
const items = catalogItems.map(c => {
const keyComponent = c.type === "operator" ? (c.item as IOperatorCatalogItem).csv : (c.item as IChartCatalogItem).repo.name;
return <CatalogItem type={c.type} key={`${c.type}/${keyComponent}/${c.item.name}`} item={c.item} />
const keyComponent =
c.type === "operator"
? (c.item as IOperatorCatalogItem).csv
: (c.item as IChartCatalogItem).repo.name;
return (
<CatalogItem type={c.type} key={`${c.type}/${keyComponent}/${c.item.name}`} item={c.item} />
);
});
return (
<section className="Catalog">
Expand Down
9 changes: 3 additions & 6 deletions dashboard/src/components/Catalog/CatalogItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function trimDescription(desc: string): string {
const CatalogItem: React.SFC<ICatalogItemProps> = props => {
if (props.type === "operator") {
const item = props.item as IOperatorCatalogItem;
return OperatorCatalogItem(item);
return OperatorCatalogItem(item);
} else {
const item = props.item as IChartCatalogItem;
return ChartCatalogItem(item);
Expand Down Expand Up @@ -81,14 +81,11 @@ const ChartCatalogItem: React.SFC<IChartCatalogItem> = props => {
const { icon, name, repo, version, description, namespace, id } = props;
const iconSrc = icon || placeholder;
const tag1 = (
<Link
className="ListItem__content__info_tag_link"
to={url.app.repo(repo.name, namespace)}
>
<Link className="ListItem__content__info_tag_link" to={url.app.repo(repo.name, namespace)}>
{repo.name}
</Link>
);
const link = url.app.charts.get(name, repo || {} as IRepo, namespace);
const link = url.app.charts.get(name, repo || ({} as IRepo), namespace);
const subIcon = helmIcon;

const descriptionC = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { IChartVersion } from "../../shared/types";
import * as url from "../../shared/url";
import ChartDeployButton from "./ChartDeployButton";


const testChartVersion: IChartVersion = {
attributes: {
version: "1.2.3",
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/components/ChartView/ChartHeader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as url from "../../shared/url";
import ChartIcon from "../ChartIcon";
import ChartHeader from "./ChartHeader";


const testProps: any = {
description: "A Test Chart",
id: "testrepo/test",
Expand All @@ -24,7 +23,10 @@ it("renders a header for the chart", () => {
expect(wrapper.text()).toContain("A Test Chart");
const repoLink = wrapper.find(Link);
expect(repoLink.exists()).toBe(true);
expect(repoLink.props()).toMatchObject({ to: url.app.repo("testrepo", "kubeapps"), children: "testrepo" });
expect(repoLink.props()).toMatchObject({
to: url.app.repo("testrepo", "kubeapps"),
children: "testrepo",
});
expect(wrapper.find(ChartIcon).exists()).toBe(true);
expect(wrapper).toMatchSnapshot();
});
Expand Down
32 changes: 27 additions & 5 deletions dashboard/src/components/ChartView/ChartVersionsList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,31 @@ const extendedVersions: IChartVersion[] = [
] as IChartVersion[];

it("renders the list of versions", () => {
const wrapper = shallow(<ChartVersionsList versions={testVersions} selected={testVersions[1]} targetNamespace="targetNamespace" />);
const wrapper = shallow(
<ChartVersionsList
versions={testVersions}
selected={testVersions[1]}
targetNamespace="targetNamespace"
/>,
);
const items = wrapper.find("li");
expect(items).toHaveLength(4);
const link = items.at(1).find(Link);
expect(link.prop("className")).toBe("type-bold type-color-action");
// The link include the namespace
expect(link.prop("to")).toBe(url.app.charts.version("test", "1.2.2", testChart.data.repo, "targetNamespace"));
expect(link.prop("to")).toBe(
url.app.charts.version("test", "1.2.2", testChart.data.repo, "targetNamespace"),
);
});

it("does not render a the Show All link when there are 5 or less versions", () => {
const wrapper = shallow(<ChartVersionsList versions={testVersions} selected={testVersions[1]} targetNamespace="targetNamespace" />);
const wrapper = shallow(
<ChartVersionsList
versions={testVersions}
selected={testVersions[1]}
targetNamespace="targetNamespace"
/>,
);
expect(wrapper.find("a").exists()).toBe(false);
wrapper.setProps({
versions: [
Expand All @@ -98,7 +112,11 @@ it("does not render a the Show All link when there are 5 or less versions", () =

it("renders a the Show All link when there are more than 5 versions", () => {
const wrapper = shallow(
<ChartVersionsList versions={extendedVersions} selected={extendedVersions[1]} targetNamespace="targetNamespace" />,
<ChartVersionsList
versions={extendedVersions}
selected={extendedVersions[1]}
targetNamespace="targetNamespace"
/>,
);
const showAllLink = wrapper.find("a");
expect(showAllLink.exists()).toBe(true);
Expand All @@ -109,7 +127,11 @@ it("renders a the Show All link when there are more than 5 versions", () => {

it("shows all the versions when the Show All link is clicked", () => {
const wrapper = shallow(
<ChartVersionsList versions={extendedVersions} selected={extendedVersions[1]} targetNamespace="targetNamespace" />,
<ChartVersionsList
versions={extendedVersions}
selected={extendedVersions[1]}
targetNamespace="targetNamespace"
/>,
);
expect(wrapper.find("li")).toHaveLength(5);
wrapper.find("a").simulate("click");
Expand Down
10 changes: 9 additions & 1 deletion dashboard/src/components/ChartView/ChartVersionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ class ChartVersionsList extends React.Component<IChartVersionsListProps, IChartV
: "";
return (
<li key={v.id}>
<Link className={selectedClass} to={url.app.charts.version(chartData.name, v.attributes.version, chartData.repo, this.props.targetNamespace)}>
<Link
className={selectedClass}
to={url.app.charts.version(
chartData.name,
v.attributes.version,
chartData.repo,
this.props.targetNamespace,
)}
>
{v.attributes.version} - {this.formatDate(v.attributes.created)}
</Link>
</li>
Expand Down
6 changes: 5 additions & 1 deletion dashboard/src/components/ChartView/ChartView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ class ChartView extends React.Component<IChartViewProps> {
<aside className="ChartViewSidebar bg-light margin-v-big padding-h-normal padding-b-normal">
<div className="ChartViewSidebar__section">
<h2>Chart Versions</h2>
<ChartVersionsList selected={version} versions={versions} targetNamespace={namespace} />
<ChartVersionsList
selected={version}
versions={versions}
targetNamespace={namespace}
/>
</div>
{version.attributes.app_version && (
<div className="ChartViewSidebar__section">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as url from "../../../shared/url";
import ConfirmDialog from "../../ConfirmDialog";
import { AppRepoAddButton } from "./AppRepoButton";


interface IAppRepoListItemProps {
errors: {
create?: Error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import * as url from "../../shared/url";
import DeploymentFormBody from "../DeploymentFormBody/DeploymentFormBody";
import { PermissionsErrorAlert, UnexpectedErrorAlert } from "../ErrorAlert";
import DeploymentForm, { IDeploymentFormProps} from "./DeploymentForm";
import DeploymentForm, { IDeploymentFormProps } from "./DeploymentForm";

const releaseName = "my-release";
const defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import LoadingWrapper from "../LoadingWrapper";
import BasicDeploymentForm from "./BasicDeploymentForm/BasicDeploymentForm";
import DeploymentFormBody, {
IDeploymentFormBodyProps,
IDeploymentFormBodyState
IDeploymentFormBodyState,
} from "./DeploymentFormBody";
import Differential from "./Differential";


const defaultProps = {
deploymentEvent: "install",
chartNamespace: "chart-namespace",
Expand Down Expand Up @@ -127,7 +126,9 @@ it("changes the URL for the new version", () => {
},
});
wrapper.find("select").simulate("change", { currentTarget: { value: "2.0.0" } });
expect(push).toHaveBeenCalledWith(url.app.apps.new(chartVersion, defaultProps.namespace, "2.0.0"));
expect(push).toHaveBeenCalledWith(
url.app.apps.new(chartVersion, defaultProps.namespace, "2.0.0"),
);
});

describe("when there are changes in the selected version", () => {
Expand Down
1 change: 0 additions & 1 deletion dashboard/src/components/Header/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { IClusterState } from "../../reducers/cluster";
import { app } from "../../shared/url";
import Header from "./Header";


const defaultProps = {
authenticated: true,
fetchNamespaces: jest.fn(),
Expand Down
12 changes: 9 additions & 3 deletions dashboard/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
</button>
<ul className="header__nav__menu" role="menubar">
<li>
<HeaderLink to={app.apps.list(cluster.currentNamespace)} exact={true}>Applications</HeaderLink>
<HeaderLink to={app.apps.list(cluster.currentNamespace)} exact={true}>
Applications
</HeaderLink>
</li>
<li>
<HeaderLink to={app.catalog(cluster.currentNamespace)}>Catalog</HeaderLink>
</li>
<li>
<HeaderLink to={app.servicesInstances(cluster.currentNamespace)}>Service Instances (alpha)</HeaderLink>
<HeaderLink to={app.servicesInstances(cluster.currentNamespace)}>
Service Instances (alpha)
</HeaderLink>
</li>
</ul>
</nav>
Expand Down Expand Up @@ -131,7 +135,9 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
</li>
{this.props.featureFlags.operators && (
<li role="none">
<NavLink to={`/ns/${cluster.currentNamespace}/operators`}>Operators</NavLink>
<NavLink to={`/ns/${cluster.currentNamespace}/operators`}>
Operators
</NavLink>
</li>
)}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import AppList from "../../components/AppList";
import { IStoreState } from "../../shared/types";

function mapStateToProps(
{ apps, clusters: { currentCluster, clusters}, operators, config }: IStoreState,
{ apps, clusters: { currentCluster, clusters }, operators, config }: IStoreState,
{ location }: RouteComponentProps<{}>,
) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ interface IErrorBoundaryProps {
children: React.ReactChildren | React.ReactNode | string;
}

function mapStateToProps({ clusters: { currentCluster, clusters } }: IStoreState, { children }: IErrorBoundaryProps) {
function mapStateToProps(
{ clusters: { currentCluster, clusters } }: IStoreState,
{ children }: IErrorBoundaryProps,
) {
const cluster = clusters[currentCluster];
return {
error: cluster.error && cluster.error.error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface IRouteProps {
}

function mapStateToProps(
{ operators, clusters: { currentCluster, clusters} }: IStoreState,
{ operators, clusters: { currentCluster, clusters } }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface IRouteProps {
}

function mapStateToProps(
{ operators, clusters: { currentCluster, clusters} }: IStoreState,
{ operators, clusters: { currentCluster, clusters } }: IStoreState,
{ match: { params } }: IRouteProps,
) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import thunk from "redux-thunk";
import RepoListContainer from ".";
import { definedNamespaces } from "../../shared/Namespace";


const mockStore = configureMockStore([thunk]);
const currentNamespace = "current-namespace";
const kubeappsNamespace = "kubeapps-namespace";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import AppRepoList from "../../components/Config/AppRepoList";
import { definedNamespaces } from "../../shared/Namespace";
import { IAppRepositoryKey, IStoreState } from "../../shared/types";


function mapStateToProps({ config, clusters: { currentCluster, clusters }, repos }: IStoreState) {
const repoNamespace = clusters[currentCluster].currentNamespace;
let displayReposPerNamespaceMsg = false;
Expand Down

0 comments on commit 083c863

Please sign in to comment.