mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
apply eslint and prettier rules
This commit is contained in:
@@ -3,21 +3,9 @@ import Main from "./Main";
|
||||
import { connect } from "react-redux";
|
||||
import { translate } from "react-i18next";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import {
|
||||
fetchMe,
|
||||
getFetchMeFailure,
|
||||
getMe,
|
||||
isAuthenticated,
|
||||
isFetchMePending
|
||||
} from "../modules/auth";
|
||||
import { fetchMe, getFetchMeFailure, getMe, isAuthenticated, isFetchMePending } from "../modules/auth";
|
||||
|
||||
import {
|
||||
ErrorPage,
|
||||
Footer,
|
||||
Header,
|
||||
Loading,
|
||||
PrimaryNavigation
|
||||
} from "@scm-manager/ui-components";
|
||||
import { ErrorPage, Footer, Header, Loading, PrimaryNavigation } from "@scm-manager/ui-components";
|
||||
import { Links, Me } from "@scm-manager/ui-types";
|
||||
import {
|
||||
getFetchIndexResourcesFailure,
|
||||
@@ -57,13 +45,7 @@ class App extends Component<Props> {
|
||||
if (loading) {
|
||||
content = <Loading />;
|
||||
} else if (error) {
|
||||
content = (
|
||||
<ErrorPage
|
||||
title={t("app.error.title")}
|
||||
subtitle={t("app.error.subtitle")}
|
||||
error={error}
|
||||
/>
|
||||
);
|
||||
content = <ErrorPage title={t("app.error.title")} subtitle={t("app.error.subtitle")} error={error} />;
|
||||
} else {
|
||||
content = <Main authenticated={authenticated} links={links} />;
|
||||
}
|
||||
@@ -86,10 +68,8 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
const mapStateToProps = state => {
|
||||
const authenticated = isAuthenticated(state);
|
||||
const me = getMe(state);
|
||||
const loading =
|
||||
isFetchMePending(state) || isFetchIndexResourcesPending(state);
|
||||
const error =
|
||||
getFetchMeFailure(state) || getFetchIndexResourcesFailure(state);
|
||||
const loading = isFetchMePending(state) || isFetchIndexResourcesPending(state);
|
||||
const error = getFetchMeFailure(state) || getFetchIndexResourcesFailure(state);
|
||||
const links = getLinks(state);
|
||||
const meLink = getMeLink(state);
|
||||
return {
|
||||
|
||||
@@ -96,11 +96,7 @@ class ChangeUserPassword extends React.Component<Props, State> {
|
||||
|
||||
if (passwordChanged) {
|
||||
message = (
|
||||
<Notification
|
||||
type={"success"}
|
||||
children={t("password.changedSuccessfully")}
|
||||
onClose={() => this.onClose()}
|
||||
/>
|
||||
<Notification type={"success"} children={t("password.changedSuccessfully")} onClose={() => this.onClose()} />
|
||||
);
|
||||
} else if (error) {
|
||||
message = <ErrorNotification error={error} />;
|
||||
@@ -131,11 +127,7 @@ class ChangeUserPassword extends React.Component<Props, State> {
|
||||
/>
|
||||
<div className="columns">
|
||||
<div className="column">
|
||||
<SubmitButton
|
||||
disabled={!this.isValid()}
|
||||
loading={loading}
|
||||
label={t("password.submit")}
|
||||
/>
|
||||
<SubmitButton disabled={!this.isValid()} loading={loading} label={t("password.submit")} />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -62,10 +62,7 @@ class Index extends Component<Props, State> {
|
||||
return (
|
||||
<ErrorBoundary fallback={IndexErrorPage}>
|
||||
<ScrollToTop>
|
||||
<PluginLoader
|
||||
loaded={pluginsLoaded}
|
||||
callback={this.pluginLoaderCallback}
|
||||
>
|
||||
<PluginLoader loaded={pluginsLoaded} callback={this.pluginLoaderCallback}>
|
||||
<App />
|
||||
</PluginLoader>
|
||||
</ScrollToTop>
|
||||
|
||||
@@ -10,13 +10,7 @@ type Props = {
|
||||
class IndexErrorPage extends React.Component<Props> {
|
||||
render() {
|
||||
const { error, t } = this.props;
|
||||
return (
|
||||
<ErrorPage
|
||||
title={t("app.error.title")}
|
||||
subtitle={t("app.error.subtitle")}
|
||||
error={error}
|
||||
/>
|
||||
);
|
||||
return <ErrorPage title={t("app.error.title")} subtitle={t("app.error.subtitle")} error={error} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,7 @@ import { Redirect, withRouter } from "react-router-dom";
|
||||
import { compose } from "redux";
|
||||
import { translate } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
getLoginFailure,
|
||||
isAuthenticated,
|
||||
isLoginPending,
|
||||
login
|
||||
} from "../modules/auth";
|
||||
import { getLoginFailure, isAuthenticated, isLoginPending, login } from "../modules/auth";
|
||||
import { getLoginInfoLink, getLoginLink } from "../modules/indexResource";
|
||||
import LoginInfo from "../components/LoginInfo";
|
||||
|
||||
@@ -86,8 +81,7 @@ const mapStateToProps = state => {
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
login: (loginLink: string, username: string, password: string) =>
|
||||
dispatch(login(loginLink, username, password))
|
||||
login: (loginLink: string, username: string, password: string) => dispatch(login(loginLink, username, password))
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -3,13 +3,7 @@ import { connect } from "react-redux";
|
||||
import { translate } from "react-i18next";
|
||||
import { Redirect } from "react-router-dom";
|
||||
|
||||
import {
|
||||
logout,
|
||||
isAuthenticated,
|
||||
isLogoutPending,
|
||||
getLogoutFailure,
|
||||
isRedirecting
|
||||
} from "../modules/auth";
|
||||
import { logout, isAuthenticated, isLogoutPending, getLogoutFailure, isRedirecting } from "../modules/auth";
|
||||
import { Loading, ErrorPage } from "@scm-manager/ui-components";
|
||||
import { getLogoutLink } from "../modules/indexResource";
|
||||
|
||||
@@ -35,13 +29,7 @@ class Logout extends React.Component<Props> {
|
||||
render() {
|
||||
const { authenticated, redirecting, loading, error, t } = this.props;
|
||||
if (error) {
|
||||
return (
|
||||
<ErrorPage
|
||||
title={t("logout.error.title")}
|
||||
subtitle={t("logout.error.subtitle")}
|
||||
error={error}
|
||||
/>
|
||||
);
|
||||
return <ErrorPage title={t("logout.error.title")} subtitle={t("logout.error.subtitle")} error={error} />;
|
||||
} else if (loading || authenticated || redirecting) {
|
||||
return <Loading />;
|
||||
} else {
|
||||
|
||||
@@ -44,85 +44,22 @@ class Main extends React.Component<Props> {
|
||||
<Route exact path="/login" component={Login} />
|
||||
<Route path="/logout" component={Logout} />
|
||||
<Redirect exact strict from="/repos" to="/repos/" />
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/repos/"
|
||||
component={Overview}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/repos/create"
|
||||
component={Create}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/repos/:page"
|
||||
component={Overview}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
path="/repo/:namespace/:name"
|
||||
component={RepositoryRoot}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute exact path="/repos/" component={Overview} authenticated={authenticated} />
|
||||
<ProtectedRoute exact path="/repos/create" component={Create} authenticated={authenticated} />
|
||||
<ProtectedRoute exact path="/repos/:page" component={Overview} authenticated={authenticated} />
|
||||
<ProtectedRoute path="/repo/:namespace/:name" component={RepositoryRoot} authenticated={authenticated} />
|
||||
<Redirect exact strict from="/users" to="/users/" />
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/users/"
|
||||
component={Users}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
authenticated={authenticated}
|
||||
path="/users/create"
|
||||
component={CreateUser}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/users/:page"
|
||||
component={Users}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
authenticated={authenticated}
|
||||
path="/user/:name"
|
||||
component={SingleUser}
|
||||
/>
|
||||
<ProtectedRoute exact path="/users/" component={Users} authenticated={authenticated} />
|
||||
<ProtectedRoute authenticated={authenticated} path="/users/create" component={CreateUser} />
|
||||
<ProtectedRoute exact path="/users/:page" component={Users} authenticated={authenticated} />
|
||||
<ProtectedRoute authenticated={authenticated} path="/user/:name" component={SingleUser} />
|
||||
<Redirect exact strict from="/groups" to="/groups/" />
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/groups/"
|
||||
component={Groups}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
authenticated={authenticated}
|
||||
path="/group/:name"
|
||||
component={SingleGroup}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
authenticated={authenticated}
|
||||
path="/groups/create"
|
||||
component={CreateGroup}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
exact
|
||||
path="/groups/:page"
|
||||
component={Groups}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
path="/admin"
|
||||
component={Admin}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute
|
||||
path="/me"
|
||||
component={Profile}
|
||||
authenticated={authenticated}
|
||||
/>
|
||||
<ProtectedRoute exact path="/groups/" component={Groups} authenticated={authenticated} />
|
||||
<ProtectedRoute authenticated={authenticated} path="/group/:name" component={SingleGroup} />
|
||||
<ProtectedRoute authenticated={authenticated} path="/groups/create" component={CreateGroup} />
|
||||
<ProtectedRoute exact path="/groups/:page" component={Groups} authenticated={authenticated} />
|
||||
<ProtectedRoute path="/admin" component={Admin} authenticated={authenticated} />
|
||||
<ProtectedRoute path="/me" component={Profile} authenticated={authenticated} />
|
||||
<ExtensionPoint
|
||||
name="main.route"
|
||||
renderAll={true}
|
||||
|
||||
@@ -56,7 +56,7 @@ class PluginLoader extends React.Component<Props, State> {
|
||||
|
||||
const promises = [];
|
||||
const sortedPlugins = plugins.sort(comparePluginsByName);
|
||||
for (let plugin of sortedPlugins) {
|
||||
for (const plugin of sortedPlugins) {
|
||||
promises.push(this.loadPlugin(plugin));
|
||||
}
|
||||
return promises.reduce((chain, current) => {
|
||||
@@ -72,7 +72,7 @@ class PluginLoader extends React.Component<Props, State> {
|
||||
});
|
||||
|
||||
const promises = [];
|
||||
for (let bundle of plugin.bundles) {
|
||||
for (const bundle of plugin.bundles) {
|
||||
promises.push(loadBundle(bundle));
|
||||
}
|
||||
return Promise.all(promises);
|
||||
|
||||
@@ -6,14 +6,7 @@ import { compose } from "redux";
|
||||
import { connect } from "react-redux";
|
||||
import { translate } from "react-i18next";
|
||||
import { Me } from "@scm-manager/ui-types";
|
||||
import {
|
||||
ErrorPage,
|
||||
Page,
|
||||
Navigation,
|
||||
SubNavigation,
|
||||
Section,
|
||||
NavLink
|
||||
} from "@scm-manager/ui-components";
|
||||
import { ErrorPage, Page, Navigation, SubNavigation, Section, NavLink } from "@scm-manager/ui-components";
|
||||
import ChangeUserPassword from "./ChangeUserPassword";
|
||||
import ProfileInfo from "./ProfileInfo";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
@@ -67,37 +60,16 @@ class Profile extends React.Component<Props, State> {
|
||||
<div className="columns">
|
||||
<div className="column is-three-quarters">
|
||||
<Route path={url} exact render={() => <ProfileInfo me={me} />} />
|
||||
<Route
|
||||
path={`${url}/settings/password`}
|
||||
render={() => <ChangeUserPassword me={me} />}
|
||||
/>
|
||||
<ExtensionPoint
|
||||
name="profile.route"
|
||||
props={extensionProps}
|
||||
renderAll={true}
|
||||
/>
|
||||
<Route path={`${url}/settings/password`} render={() => <ChangeUserPassword me={me} />} />
|
||||
<ExtensionPoint name="profile.route" props={extensionProps} renderAll={true} />
|
||||
</div>
|
||||
<div className="column">
|
||||
<Navigation>
|
||||
<Section label={t("profile.navigationLabel")}>
|
||||
<NavLink
|
||||
to={`${url}`}
|
||||
icon="fas fa-info-circle"
|
||||
label={t("profile.informationNavLink")}
|
||||
/>
|
||||
<SubNavigation
|
||||
to={`${url}/settings/password`}
|
||||
label={t("profile.settingsNavLink")}
|
||||
>
|
||||
<NavLink
|
||||
to={`${url}/settings/password`}
|
||||
label={t("profile.changePasswordNavLink")}
|
||||
/>
|
||||
<ExtensionPoint
|
||||
name="profile.setting"
|
||||
props={extensionProps}
|
||||
renderAll={true}
|
||||
/>
|
||||
<NavLink to={`${url}`} icon="fas fa-info-circle" label={t("profile.informationNavLink")} />
|
||||
<SubNavigation to={`${url}/settings/password`} label={t("profile.settingsNavLink")}>
|
||||
<NavLink to={`${url}/settings/password`} label={t("profile.changePasswordNavLink")} />
|
||||
<ExtensionPoint name="profile.setting" props={extensionProps} renderAll={true} />
|
||||
</SubNavigation>
|
||||
</Section>
|
||||
</Navigation>
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { Me } from "@scm-manager/ui-types";
|
||||
import {
|
||||
MailLink,
|
||||
AvatarWrapper,
|
||||
AvatarImage
|
||||
} from "@scm-manager/ui-components";
|
||||
import { MailLink, AvatarWrapper, AvatarImage } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
me: Me;
|
||||
|
||||
Reference in New Issue
Block a user