mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 22:15:45 +01:00
fix a ton of typescript errors
This commit is contained in:
@@ -15,7 +15,7 @@ class DropDown extends React.Component<Props> {
|
||||
const { options, optionValues, preselectedOption, className, disabled } = this.props;
|
||||
|
||||
if (preselectedOption && !options.includes(preselectedOption)) {
|
||||
options.unshift(preselectedOption)
|
||||
options.unshift(preselectedOption);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -147,7 +147,4 @@ const mapStateToProps = (state: any) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default compose(
|
||||
connect(mapStateToProps),
|
||||
withTranslation("admin")
|
||||
)(Admin);
|
||||
export default compose(connect(mapStateToProps), withTranslation("admin"))(Admin);
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
getNamespaceStrategies,
|
||||
isFetchNamespaceStrategiesPending
|
||||
} from "../modules/namespaceStrategies";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
loading: boolean;
|
||||
@@ -137,7 +138,7 @@ class GlobalConfig extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchConfig: (link: string) => {
|
||||
dispatch(fetchConfig(link));
|
||||
@@ -154,7 +155,7 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const loading =
|
||||
isFetchConfigPending(state) || isModifyConfigPending(state) || isFetchNamespaceStrategiesPending(state);
|
||||
const error =
|
||||
@@ -175,7 +176,4 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("config")(GlobalConfig));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withTranslation("config"))(GlobalConfig);
|
||||
|
||||
@@ -31,6 +31,7 @@ import PluginBottomActions from "../components/PluginBottomActions";
|
||||
import ExecutePendingActionModal from "../components/ExecutePendingActionModal";
|
||||
import CancelPendingActionModal from "../components/CancelPendingActionModal";
|
||||
import UpdateAllActionModal from "../components/UpdateAllActionModal";
|
||||
import {Plugin} from "@scm-manager/ui-types/src";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
loading: boolean;
|
||||
@@ -68,7 +69,7 @@ class PluginsOverview extends React.Component<Props, State> {
|
||||
this.fetchPlugins();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
componentDidUpdate(prevProps: Props) {
|
||||
const { installed } = this.props;
|
||||
if (prevProps.installed !== installed) {
|
||||
this.fetchPlugins();
|
||||
@@ -90,7 +91,7 @@ class PluginsOverview extends React.Component<Props, State> {
|
||||
}
|
||||
};
|
||||
|
||||
renderHeader = (actions: React.Node) => {
|
||||
renderHeader = (actions: React.ReactNode) => {
|
||||
const { installed, t } = this.props;
|
||||
return (
|
||||
<div className="columns">
|
||||
@@ -103,7 +104,7 @@ class PluginsOverview extends React.Component<Props, State> {
|
||||
);
|
||||
};
|
||||
|
||||
renderFooter = (actions: React.Node) => {
|
||||
renderFooter = (actions: React.ReactNode) => {
|
||||
if (actions) {
|
||||
return <PluginBottomActions>{actions}</PluginBottomActions>;
|
||||
}
|
||||
@@ -173,7 +174,7 @@ class PluginsOverview extends React.Component<Props, State> {
|
||||
|
||||
computeUpdateAllSize = () => {
|
||||
const { collection, t } = this.props;
|
||||
const outdatedPlugins = collection._embedded.plugins.filter(p => p._links.update).length;
|
||||
const outdatedPlugins = collection._embedded.plugins.filter((p: Plugin) => p._links.update).length;
|
||||
return t("plugins.outdatedPlugins", {
|
||||
count: outdatedPlugins
|
||||
});
|
||||
@@ -256,7 +257,7 @@ class PluginsOverview extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const collection = getPluginCollection(state);
|
||||
const loading = isFetchPluginsPending(state);
|
||||
const error = getFetchPluginsFailure(state);
|
||||
@@ -276,7 +277,7 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchPluginsByLink: (link: string) => {
|
||||
dispatch(fetchPluginsByLink(link));
|
||||
@@ -287,10 +288,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default compose(
|
||||
withTranslation("admin"),
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)
|
||||
)(PluginsOverview);
|
||||
export default compose(withTranslation("admin"), connect(mapStateToProps, mapDispatchToProps))(PluginsOverview);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { RepositoryRole } from "@scm-manager/ui-types";
|
||||
@@ -38,13 +39,13 @@ class CreateRepositoryRole extends React.Component<Props> {
|
||||
<>
|
||||
<Title title={t("repositoryRole.title")} />
|
||||
<Subtitle subtitle={t("repositoryRole.createSubtitle")} />
|
||||
<RepositoryRoleForm submitForm={role => this.createRepositoryRole(role)} />
|
||||
<RepositoryRoleForm submitForm={(role: RepositoryRole) => this.createRepositoryRole(role)} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const loading = isFetchVerbsPending(state);
|
||||
const error = getFetchVerbsFailure(state) || getCreateRoleFailure(state);
|
||||
const verbsLink = getRepositoryVerbsLink(state);
|
||||
@@ -58,7 +59,7 @@ const mapStateToProps = (state) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
addRole: (link: string, role: RepositoryRole, callback?: () => void) => {
|
||||
dispatch(createRole(link, role, callback));
|
||||
@@ -66,7 +67,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("admin")(CreateRepositoryRole));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withTranslation("admin"))(CreateRepositoryRole);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
@@ -72,7 +73,7 @@ class DeleteRepositoryRole extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const loading = isDeleteRolePending(state, ownProps.role.name);
|
||||
const error = getDeleteRoleFailure(state, ownProps.role.name);
|
||||
return {
|
||||
@@ -81,7 +82,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
deleteRole: (role: RepositoryRole, callback?: () => void) => {
|
||||
dispatch(deleteRole(role, callback));
|
||||
@@ -89,7 +90,8 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(withTranslation("admin")(DeleteRepositoryRole)));
|
||||
export default compose(
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withRouter,
|
||||
withTranslation("admin")
|
||||
)(DeleteRepositoryRole);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ErrorNotification, Subtitle, Loading } from "@scm-manager/ui-components
|
||||
import { RepositoryRole } from "@scm-manager/ui-types";
|
||||
import { History } from "history";
|
||||
import DeleteRepositoryRole from "./DeleteRepositoryRole";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
disabled: boolean;
|
||||
@@ -43,14 +44,17 @@ class EditRepositoryRole extends React.Component<Props> {
|
||||
return (
|
||||
<>
|
||||
<Subtitle subtitle={t("repositoryRole.editSubtitle")} />
|
||||
<RepositoryRoleForm role={this.props.role} submitForm={role => this.updateRepositoryRole(role)} />
|
||||
<RepositoryRoleForm
|
||||
role={this.props.role}
|
||||
submitForm={(role: RepositoryRole) => this.updateRepositoryRole(role)}
|
||||
/>
|
||||
<DeleteRepositoryRole role={this.props.role} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const loading = isModifyRolePending(state, ownProps.role.name);
|
||||
const error = getModifyRoleFailure(state, ownProps.role.name);
|
||||
|
||||
@@ -60,7 +64,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
updateRole: (role: RepositoryRole, callback?: () => void) => {
|
||||
dispatch(modifyRole(role, callback));
|
||||
@@ -68,7 +72,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("admin")(EditRepositoryRole));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withTranslation("admin"))(EditRepositoryRole);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { InputField, Level, SubmitButton } from "@scm-manager/ui-components";
|
||||
import { getRepositoryRolesLink, getRepositoryVerbsLink } from "../../../modules/indexResource";
|
||||
import { fetchAvailableVerbs, getFetchVerbsFailure, getVerbsFromState, isFetchVerbsPending } from "../modules/roles";
|
||||
import PermissionsWrapper from "../../../permissions/components/PermissionsWrapper";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
role?: RepositoryRole;
|
||||
@@ -120,7 +121,7 @@ class RepositoryRoleForm extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const loading = isFetchVerbsPending(state);
|
||||
const error = getFetchVerbsFailure(state);
|
||||
const verbsLink = getRepositoryVerbsLink(state);
|
||||
@@ -136,7 +137,7 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchAvailableVerbs: (link: string) => {
|
||||
dispatch(fetchAvailableVerbs(link));
|
||||
@@ -144,7 +145,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("admin")(RepositoryRoleForm));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withTranslation("admin"))(RepositoryRoleForm);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { withRouter, RouteComponentProps } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { RepositoryRole, PagedCollection } from "@scm-manager/ui-types";
|
||||
@@ -16,7 +16,8 @@ import {
|
||||
import PermissionRoleTable from "../components/PermissionRoleTable";
|
||||
import { getRepositoryRolesLink } from "../../../modules/indexResource";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
type Props = RouteComponentProps &
|
||||
WithTranslation & {
|
||||
baseUrl: string;
|
||||
roles: RepositoryRole[];
|
||||
loading: boolean;
|
||||
@@ -89,7 +90,7 @@ class RepositoryRoles extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { match } = ownProps;
|
||||
const roles = getRolesFromState(state);
|
||||
const loading = isFetchRolesPending(state);
|
||||
@@ -110,7 +111,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchRolesByPage: (link: string, page: number) => {
|
||||
dispatch(fetchRolesByPage(link, page));
|
||||
@@ -118,9 +119,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("admin")(RepositoryRoles))
|
||||
);
|
||||
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation("admin")(RepositoryRoles)));
|
||||
|
||||
@@ -10,6 +10,7 @@ import { getRepositoryRolesLink } from "../../../modules/indexResource";
|
||||
import { fetchRoleByName, getFetchRoleFailure, getRoleByName, isFetchRolePending } from "../modules/roles";
|
||||
import PermissionRoleDetail from "../components/PermissionRoleDetails";
|
||||
import EditRepositoryRole from "./EditRepositoryRole";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
roleName: string;
|
||||
@@ -78,7 +79,7 @@ class SingleRepositoryRole extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const roleName = ownProps.match.params.role;
|
||||
const role = getRoleByName(state, roleName);
|
||||
const loading = isFetchRolePending(state, roleName);
|
||||
@@ -93,7 +94,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchRoleByName: (link: string, name: string) => {
|
||||
dispatch(fetchRoleByName(link, name));
|
||||
@@ -101,9 +102,8 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("admin")(SingleRepositoryRole))
|
||||
);
|
||||
export default compose(
|
||||
withRouter,
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withTranslation("admin")
|
||||
)(SingleRepositoryRole);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { Component } from "react";
|
||||
import Main from "./Main";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { fetchMe, getFetchMeFailure, getMe, isAuthenticated, isFetchMePending } from "../modules/auth";
|
||||
@@ -61,7 +62,7 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const authenticated = isAuthenticated(state);
|
||||
const me = getMe(state);
|
||||
const loading = isFetchMePending(state) || isFetchIndexResourcesPending(state);
|
||||
@@ -78,9 +79,4 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("commons")(App))
|
||||
);
|
||||
export default compose(withRouter, connect(mapStateToProps, mapDispatchToProps), withTranslation("commons"))(App);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { Component } from "react";
|
||||
import App from "./App";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { Loading, ErrorBoundary } from "@scm-manager/ui-components";
|
||||
@@ -74,7 +75,7 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const loading = isFetchIndexResourcesPending(state);
|
||||
const error = getFetchIndexResourcesFailure(state);
|
||||
const indexResources = getLinks(state);
|
||||
@@ -85,9 +86,4 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("commons")(Index))
|
||||
);
|
||||
export default compose(withRouter, connect(mapStateToProps, mapDispatchToProps), withTranslation("commons"))(Index);
|
||||
|
||||
@@ -62,7 +62,7 @@ class Login extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const authenticated = isAuthenticated(state);
|
||||
const loading = isLoginPending(state);
|
||||
const error = getLoginFailure(state);
|
||||
@@ -77,16 +77,10 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
login: (loginLink: string, username: string, password: string) => dispatch(login(loginLink, username, password))
|
||||
};
|
||||
};
|
||||
|
||||
export default compose(
|
||||
withRouter,
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)
|
||||
)(Login);
|
||||
export default compose(withRouter, connect(mapStateToProps, mapDispatchToProps))(Login);
|
||||
|
||||
@@ -35,7 +35,7 @@ class Logout extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const authenticated = isAuthenticated(state);
|
||||
const loading = isLogoutPending(state);
|
||||
const redirecting = isRedirecting(state);
|
||||
@@ -50,13 +50,10 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
logout: (link: string) => dispatch(logout(link))
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("commons")(Logout));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("commons")(Logout));
|
||||
|
||||
@@ -78,14 +78,10 @@ class Profile extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
return {
|
||||
me: getMe(state)
|
||||
};
|
||||
};
|
||||
|
||||
export default compose(
|
||||
withTranslation("commons"),
|
||||
connect(mapStateToProps),
|
||||
withRouter
|
||||
)(Profile);
|
||||
export default compose(withTranslation("commons"), connect(mapStateToProps), withRouter)(Profile);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { Group } from "@scm-manager/ui-types";
|
||||
import { Group, DisplayedUser } from "@scm-manager/ui-types";
|
||||
import { Page } from "@scm-manager/ui-components";
|
||||
import { getGroupsLink, getUserAutoCompleteLink } from "../../modules/indexResource";
|
||||
import { createGroup, isCreateGroupPending, getCreateGroupFailure, createGroupReset } from "../modules/groups";
|
||||
@@ -45,7 +46,7 @@ class CreateGroup extends React.Component<Props> {
|
||||
.get(url + inputValue)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
return json.map(element => {
|
||||
return json.map((element: DisplayedUser) => {
|
||||
return {
|
||||
value: element,
|
||||
label: `${element.displayName} (${element.id})`
|
||||
@@ -61,7 +62,7 @@ class CreateGroup extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
createGroup: (link: string, group: Group, callback?: () => void) => dispatch(createGroup(link, group, callback)),
|
||||
resetForm: () => {
|
||||
@@ -70,7 +71,7 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const loading = isCreateGroupPending(state);
|
||||
const error = getCreateGroupFailure(state);
|
||||
const createLink = getGroupsLink(state);
|
||||
@@ -83,7 +84,4 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("groups")(CreateGroup));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withTranslation("groups"))(CreateGroup);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
@@ -72,7 +73,7 @@ export class DeleteGroup extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const loading = isDeleteGroupPending(state, ownProps.group.name);
|
||||
const error = getDeleteGroupFailure(state, ownProps.group.name);
|
||||
return {
|
||||
@@ -81,7 +82,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
deleteGroup: (group: Group, callback?: () => void) => {
|
||||
dispatch(deleteGroup(group, callback));
|
||||
@@ -89,7 +90,8 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(withTranslation("groups")(DeleteGroup)));
|
||||
export default compose(
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withRouter,
|
||||
withTranslation("groups")
|
||||
)(DeleteGroup);
|
||||
|
||||
@@ -4,11 +4,12 @@ import GroupForm from "../components/GroupForm";
|
||||
import { modifyGroup, getModifyGroupFailure, isModifyGroupPending, modifyGroupReset } from "../modules/groups";
|
||||
import { History } from "history";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { Group } from "@scm-manager/ui-types";
|
||||
import { Group, DisplayedUser } from "@scm-manager/ui-types";
|
||||
import { ErrorNotification } from "@scm-manager/ui-components";
|
||||
import { getUserAutoCompleteLink } from "../../modules/indexResource";
|
||||
import DeleteGroup from "./DeleteGroup";
|
||||
import { apiClient } from "@scm-manager/ui-components/src";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = {
|
||||
group: Group;
|
||||
@@ -41,7 +42,7 @@ class EditGroup extends React.Component<Props> {
|
||||
.get(url + inputValue)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
return json.map(element => {
|
||||
return json.map((element: DisplayedUser) => {
|
||||
return {
|
||||
value: element,
|
||||
label: `${element.displayName} (${element.id})`
|
||||
@@ -69,7 +70,7 @@ class EditGroup extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const loading = isModifyGroupPending(state, ownProps.group.name);
|
||||
const error = getModifyGroupFailure(state, ownProps.group.name);
|
||||
const autocompleteLink = getUserAutoCompleteLink(state);
|
||||
@@ -80,7 +81,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
modifyGroup: (group: Group, callback?: () => void) => {
|
||||
dispatch(modifyGroup(group, callback));
|
||||
@@ -91,7 +92,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(EditGroup));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withRouter)(EditGroup);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { RouteComponentProps } from "react-router-dom";
|
||||
import { History } from "history";
|
||||
import { Group, PagedCollection } from "@scm-manager/ui-types";
|
||||
import {
|
||||
@@ -23,7 +24,8 @@ import {
|
||||
} from "../modules/groups";
|
||||
import { GroupTable } from "./../components/table";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
type Props = RouteComponentProps &
|
||||
WithTranslation & {
|
||||
groups: Group[];
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
@@ -100,7 +102,7 @@ class Groups extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { match } = ownProps;
|
||||
const groups = getGroupsFromState(state);
|
||||
const loading = isFetchGroupsPending(state);
|
||||
@@ -121,7 +123,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchGroupsByPage: (link: string, page: number, filter?: string) => {
|
||||
dispatch(fetchGroupsByPage(link, page, filter));
|
||||
@@ -129,7 +131,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("groups")(Groups));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("groups")(Groups));
|
||||
|
||||
@@ -94,7 +94,7 @@ class SingleGroup extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const name = ownProps.match.params.name;
|
||||
const group = getGroupByName(state, name);
|
||||
const loading = isFetchGroupPending(state, name);
|
||||
@@ -110,7 +110,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchGroupByName: (link: string, name: string) => {
|
||||
dispatch(fetchGroupByName(link, name));
|
||||
@@ -118,7 +118,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("groups")(SingleGroup));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("groups")(SingleGroup));
|
||||
|
||||
@@ -151,7 +151,7 @@ class SetPermissions extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const availablePermissionLink = getLink(state, "permissions");
|
||||
return {
|
||||
availablePermissionLink
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import BranchView from "../components/BranchView";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
|
||||
import { Repository, Branch } from "@scm-manager/ui-types";
|
||||
import { fetchBranch, getBranch, getFetchBranchFailure, isFetchBranchPending } from "../modules/branches";
|
||||
@@ -28,7 +29,6 @@ type Props = {
|
||||
class BranchRoot extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
const { fetchBranch, repository, branchName } = this.props;
|
||||
|
||||
fetchBranch(repository, branchName);
|
||||
}
|
||||
|
||||
@@ -96,9 +96,4 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(BranchRoot)
|
||||
);
|
||||
export default compose(withRouter, connect(mapStateToProps, mapDispatchToProps))(BranchRoot);
|
||||
|
||||
@@ -75,7 +75,7 @@ class BranchesOverview extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { repository } = ownProps;
|
||||
const loading = isFetchBranchesPending(state, repository);
|
||||
const error = getFetchBranchesFailure(state, repository);
|
||||
@@ -91,7 +91,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchBranches: (repository: Repository) => {
|
||||
dispatch(fetchBranches(repository));
|
||||
@@ -102,8 +102,5 @@ const mapDispatchToProps = dispatch => {
|
||||
export default compose(
|
||||
withTranslation("repos"),
|
||||
withRouter,
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)
|
||||
connect(mapStateToProps, mapDispatchToProps)
|
||||
)(BranchesOverview);
|
||||
|
||||
@@ -20,7 +20,7 @@ const CodeViewSwitcher: FC<Props> = ({ url }) => {
|
||||
const createDestinationUrl = (destination: string) => {
|
||||
let splittedUrl = url.split("/");
|
||||
splittedUrl[5] = destination;
|
||||
return splittedUrl.join("/")
|
||||
return splittedUrl.join("/");
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -8,8 +8,8 @@ import * as validator from "./repositoryValidation";
|
||||
type Props = WithTranslation & {
|
||||
submitForm: (p: Repository) => void;
|
||||
repository?: Repository;
|
||||
repositoryTypes: RepositoryType[];
|
||||
namespaceStrategy: string;
|
||||
repositoryTypes?: RepositoryType[];
|
||||
namespaceStrategy?: string;
|
||||
loading?: boolean;
|
||||
};
|
||||
|
||||
@@ -127,7 +127,8 @@ class RepositoryForm extends React.Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
createSelectOptions(repositoryTypes: RepositoryType[]) {
|
||||
createSelectOptions(repositoryTypes?: RepositoryType[]) {
|
||||
if (repositoryTypes) {
|
||||
return repositoryTypes.map(repositoryType => {
|
||||
return {
|
||||
label: repositoryType.displayName,
|
||||
@@ -135,6 +136,8 @@ class RepositoryForm extends React.Component<Props, State> {
|
||||
};
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
renderNamespaceField = () => {
|
||||
const { namespaceStrategy, t } = this.props;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Changeset, Repository } from "@scm-manager/ui-types";
|
||||
@@ -42,7 +43,7 @@ class ChangesetView extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps: Props) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const repository = ownProps.repository;
|
||||
const id = ownProps.match.params.id;
|
||||
const changeset = getChangeset(state, repository, id);
|
||||
@@ -55,7 +56,7 @@ const mapStateToProps = (state, ownProps: Props) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchChangesetIfNeeded: (repository: Repository, id: string) => {
|
||||
dispatch(fetchChangesetIfNeeded(repository, id));
|
||||
@@ -63,9 +64,8 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("repos")(ChangesetView))
|
||||
);
|
||||
export default compose(
|
||||
withRouter,
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
withTranslation("repos")
|
||||
)(ChangesetView);
|
||||
|
||||
@@ -76,7 +76,7 @@ class Create extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const repositoryTypes = getRepositoryTypes(state);
|
||||
const namespaceStrategies = getNamespaceStrategies(state);
|
||||
const pageLoading = isFetchRepositoryTypesPending(state) || isFetchNamespaceStrategiesPending(state);
|
||||
@@ -94,7 +94,7 @@ const mapStateToProps = state => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchRepositoryTypesIfNeeded: () => {
|
||||
dispatch(fetchRepositoryTypesIfNeeded());
|
||||
@@ -111,7 +111,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("repos")(Create));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("repos")(Create));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
@@ -72,7 +73,7 @@ class DeleteRepo extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { namespace, name } = ownProps.repository;
|
||||
const loading = isDeleteRepoPending(state, namespace, name);
|
||||
const error = getDeleteRepoFailure(state, namespace, name);
|
||||
@@ -82,7 +83,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
deleteRepo: (repo: Repository, callback: () => void) => {
|
||||
dispatch(deleteRepo(repo, callback));
|
||||
@@ -90,7 +91,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(withTranslation("repos")(DeleteRepo)));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withRouter, withTranslation("repos"))(DeleteRepo);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { modifyRepo, isModifyRepoPending, getModifyRepoFailure, modifyRepoReset
|
||||
import { History } from "history";
|
||||
import { ErrorNotification } from "@scm-manager/ui-components";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = {
|
||||
loading: boolean;
|
||||
@@ -71,7 +72,7 @@ class EditRepo extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { namespace, name } = ownProps.repository;
|
||||
const loading = isModifyRepoPending(state, namespace, name);
|
||||
const error = getModifyRepoFailure(state, namespace, name);
|
||||
@@ -81,7 +82,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
modifyRepo: (repo: Repository, callback: () => void) => {
|
||||
dispatch(modifyRepo(repo, callback));
|
||||
@@ -92,7 +93,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(EditRepo));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withRouter)(EditRepo);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { withRouter, RouteComponentProps } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { RepositoryCollection } from "@scm-manager/ui-types";
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
} from "../modules/repos";
|
||||
import RepositoryList from "../components/list";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
type Props = WithTranslation & RouteComponentProps & {
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
showCreateButton: boolean;
|
||||
@@ -103,7 +103,7 @@ class Overview extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { match } = ownProps;
|
||||
const collection = getRepositoryCollection(state);
|
||||
const loading = isFetchReposPending(state);
|
||||
@@ -121,14 +121,11 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchReposByPage: (link: string, page: number, filter?: string) => {
|
||||
dispatch(fetchReposByPage(link, page, filter));
|
||||
}
|
||||
};
|
||||
};
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("repos")(withRouter(Overview)));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("repos")(withRouter(Overview)));
|
||||
|
||||
@@ -175,7 +175,7 @@ class Permissions extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const namespace = ownProps.namespace;
|
||||
const repoName = ownProps.repoName;
|
||||
const error =
|
||||
@@ -216,7 +216,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchPermissions: (link: string, namespace: string, repoName: string) => {
|
||||
dispatch(fetchPermissions(link, namespace, repoName));
|
||||
@@ -245,7 +245,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("repos")(Permissions));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("repos")(Permissions));
|
||||
|
||||
@@ -208,7 +208,7 @@ class SinglePermission extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const permission = ownProps.permission;
|
||||
const loading = isModifyPermissionPending(state, ownProps.namespace, ownProps.repoName, permission);
|
||||
const deleteLoading = isDeletePermissionPending(state, ownProps.namespace, ownProps.repoName, permission);
|
||||
@@ -219,7 +219,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
modifyPermission: (permission: Permission, namespace: string, repoName: string) => {
|
||||
dispatch(modifyPermission(permission, namespace, repoName));
|
||||
@@ -229,7 +229,4 @@ const mapDispatchToProps = dispatch => {
|
||||
}
|
||||
};
|
||||
};
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("repos")(SinglePermission));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("repos")(SinglePermission));
|
||||
|
||||
@@ -174,10 +174,4 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default compose(
|
||||
withRouter,
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)
|
||||
)(withTranslation("repos")(FileTree));
|
||||
export default compose(withRouter, connect(mapStateToProps, mapDispatchToProps))(withTranslation("repos")(FileTree));
|
||||
|
||||
@@ -88,14 +88,16 @@ class FileTreeLeaf extends React.Component<Props> {
|
||||
render() {
|
||||
const { file } = this.props;
|
||||
|
||||
const renderFileSize = (file: File) => <FileSize bytes={file.length} />;
|
||||
const renderFileSize = (file: File) => <FileSize bytes={file?.length ? file.length : 0} />;
|
||||
const renderCommitDate = (file: File) => <DateFromNow date={file.commitDate} />;
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td>{this.createFileIcon(file)}</td>
|
||||
<MinWidthTd className="is-word-break">{this.createFileName(file)}</MinWidthTd>
|
||||
<NoWrapTd className="is-hidden-mobile">{file.directory ? "" : this.contentIfPresent(file, "length", renderFileSize)}</NoWrapTd>
|
||||
<NoWrapTd className="is-hidden-mobile">
|
||||
{file.directory ? "" : this.contentIfPresent(file, "length", renderFileSize)}
|
||||
</NoWrapTd>
|
||||
<td className="is-hidden-mobile">{this.contentIfPresent(file, "commitDate", renderCommitDate)}</td>
|
||||
<MinWidthTd className={classNames("is-word-break", "is-hidden-touch")}>
|
||||
{this.contentIfPresent(file, "description", file => file.description)}
|
||||
|
||||
@@ -85,9 +85,4 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("repos")(SourceExtensions))
|
||||
);
|
||||
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(withTranslation("repos")(SourceExtensions)));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
@@ -46,7 +47,7 @@ class CreateUser extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
addUser: (link: string, user: User, callback?: () => void) => {
|
||||
dispatch(createUser(link, user, callback));
|
||||
@@ -57,7 +58,7 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any) => {
|
||||
const loading = isCreateUserPending(state);
|
||||
const error = getCreateUserFailure(state);
|
||||
const usersLink = getUsersLink(state);
|
||||
@@ -68,7 +69,4 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("users")(CreateUser));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withTranslation("users"))(CreateUser);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { compose } from "redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
@@ -72,7 +73,7 @@ class DeleteUser extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const loading = isDeleteUserPending(state, ownProps.user.name);
|
||||
const error = getDeleteUserFailure(state, ownProps.user.name);
|
||||
return {
|
||||
@@ -81,7 +82,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
deleteUser: (user: User, callback?: () => void) => {
|
||||
dispatch(deleteUser(user, callback));
|
||||
@@ -89,7 +90,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(withTranslation("users")(DeleteUser)));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withRouter, withTranslation("users"))(DeleteUser);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { User } from "@scm-manager/ui-types";
|
||||
import { modifyUser, isModifyUserPending, getModifyUserFailure, modifyUserReset } from "../modules/users";
|
||||
import { History } from "history";
|
||||
import { ErrorNotification } from "@scm-manager/ui-components";
|
||||
import { compose } from "redux";
|
||||
|
||||
type Props = {
|
||||
loading: boolean;
|
||||
@@ -47,7 +48,7 @@ class EditUser extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const loading = isModifyUserPending(state, ownProps.user.name);
|
||||
const error = getModifyUserFailure(state, ownProps.user.name);
|
||||
return {
|
||||
@@ -56,7 +57,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
modifyUser: (user: User, callback?: () => void) => {
|
||||
dispatch(modifyUser(user, callback));
|
||||
@@ -67,7 +68,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(EditUser));
|
||||
export default compose(connect(mapStateToProps, mapDispatchToProps), withRouter)(EditUser);
|
||||
|
||||
@@ -95,7 +95,7 @@ class SingleUser extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const name = ownProps.match.params.name;
|
||||
const user = getUserByName(state, name);
|
||||
const loading = isFetchUserPending(state, name);
|
||||
@@ -110,7 +110,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchUserByName: (link: string, name: string) => {
|
||||
dispatch(fetchUserByName(link, name));
|
||||
@@ -118,7 +118,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("users")(SingleUser));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("users")(SingleUser));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { RouteComponentProps } from "react-router-dom";
|
||||
import { History } from "history";
|
||||
import { User, PagedCollection } from "@scm-manager/ui-types";
|
||||
import {
|
||||
@@ -23,7 +24,8 @@ import {
|
||||
} from "../modules/users";
|
||||
import { UserTable } from "./../components/table";
|
||||
|
||||
type Props = WithTranslation & {
|
||||
type Props = RouteComponentProps &
|
||||
WithTranslation & {
|
||||
users: User[];
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
@@ -100,7 +102,7 @@ class Users extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { match } = ownProps;
|
||||
const users = getUsersFromState(state);
|
||||
const loading = isFetchUsersPending(state);
|
||||
@@ -121,7 +123,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchUsersByPage: (link: string, page: number, filter?: string) => {
|
||||
dispatch(fetchUsersByPage(link, page, filter));
|
||||
@@ -129,7 +131,4 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation("users")(Users));
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("users")(Users));
|
||||
|
||||
Reference in New Issue
Block a user