mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 03:25:56 +01:00
merge
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -386,7 +386,7 @@
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.2.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -817,6 +817,10 @@
|
||||
<!-- *UserPassword JS files are excluded because extraction of common code would not make the code more readable -->
|
||||
<sonar.cpd.exclusions>**/*StoreFactory.java,**/*UserPassword.js</sonar.cpd.exclusions>
|
||||
|
||||
<node.version>8.11.4</node.version>
|
||||
<sonar.nodejs.executable>./scm-ui/target/frontend/buildfrontend-node/node-v${node.version}-linux-x64/bin/node</sonar.nodejs.executable>
|
||||
|
||||
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
import React from "react";
|
||||
|
||||
type Props = {
|
||||
icon?: string,
|
||||
label: string,
|
||||
action: () => void
|
||||
};
|
||||
|
||||
class NavAction extends React.Component<Props> {
|
||||
render() {
|
||||
const { label, action } = this.props;
|
||||
const { label, icon, action } = this.props;
|
||||
|
||||
let showIcon = null;
|
||||
if (icon) {
|
||||
showIcon = (<><i className={icon}></i>{" "}</>);
|
||||
}
|
||||
|
||||
return (
|
||||
<li>
|
||||
<a onClick={action}>{label}</a>
|
||||
<a onClick={action}>{showIcon}{label}</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {Link, Route} from "react-router-dom";
|
||||
|
||||
type Props = {
|
||||
to: string,
|
||||
icon?: string,
|
||||
label: string,
|
||||
activeOnlyWhenExact?: boolean,
|
||||
activeWhenMatch?: (route: any) => boolean
|
||||
@@ -23,10 +24,17 @@ class NavLink extends React.Component<Props> {
|
||||
}
|
||||
|
||||
renderLink = (route: any) => {
|
||||
const { to, label } = this.props;
|
||||
const { to, icon, label } = this.props;
|
||||
|
||||
let showIcon = null;
|
||||
if (icon) {
|
||||
showIcon = (<><i className={icon}></i>{" "}</>);
|
||||
}
|
||||
|
||||
return (
|
||||
<li>
|
||||
<Link className={this.isActive(route) ? "is-active" : ""} to={to}>
|
||||
{showIcon}
|
||||
{label}
|
||||
</Link>
|
||||
</li>
|
||||
@@ -35,6 +43,7 @@ class NavLink extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { to, activeOnlyWhenExact } = this.props;
|
||||
|
||||
return (
|
||||
<Route path={to} exact={activeOnlyWhenExact} children={this.renderLink} />
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from "@scm-manager/ui-components";
|
||||
import ChangeUserPassword from "./ChangeUserPassword";
|
||||
import ProfileInfo from "./ProfileInfo";
|
||||
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
me: Me,
|
||||
@@ -79,6 +79,7 @@ class Profile extends React.Component<Props, State> {
|
||||
<Section label={t("profile.navigationLabel")}>
|
||||
<NavLink
|
||||
to={`${url}`}
|
||||
icon="fas fa-info-circle"
|
||||
label={t("profile.informationNavLink")}
|
||||
/>
|
||||
<SubNavigation
|
||||
|
||||
@@ -21,7 +21,7 @@ class GeneralGroupNavLink extends React.Component<Props> {
|
||||
if (!this.isEditable()) {
|
||||
return null;
|
||||
}
|
||||
return <NavLink to={editUrl} label={t("singleGroup.menu.generalNavLink")} />;
|
||||
return <NavLink to={editUrl} icon="fas fa-cog" label={t("singleGroup.menu.generalNavLink")} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class ChangePermissionNavLink extends React.Component<Props> {
|
||||
if (!this.hasPermissionToSetPermission()) {
|
||||
return null;
|
||||
}
|
||||
return <NavLink label={t("singleGroup.menu.setPermissionsNavLink")} to={permissionsUrl} />;
|
||||
return <NavLink to={permissionsUrl} label={t("singleGroup.menu.setPermissionsNavLink")} />;
|
||||
}
|
||||
|
||||
hasPermissionToSetPermission = () => {
|
||||
|
||||
@@ -68,11 +68,13 @@ class AddGroup extends React.Component<Props, State> {
|
||||
});
|
||||
});
|
||||
};
|
||||
groupCreated = () => {
|
||||
this.props.history.push("/groups");
|
||||
groupCreated = (group: Group) => {
|
||||
this.props.history.push("/group/" + group.name);
|
||||
};
|
||||
createGroup = (group: Group) => {
|
||||
this.props.createGroup(this.props.createLink, group, this.groupCreated);
|
||||
this.props.createGroup(this.props.createLink, group, () =>
|
||||
this.groupCreated(group)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import { translate } from "react-i18next";
|
||||
import GeneralGroup from "./GeneralGroup";
|
||||
import { getGroupsLink } from "../../modules/indexResource";
|
||||
import SetPermissions from "../../permissions/components/SetPermissions";
|
||||
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
name: string,
|
||||
@@ -105,7 +105,9 @@ class SingleGroup extends React.Component<Props> {
|
||||
path={`${url}/settings/permissions`}
|
||||
exact
|
||||
component={() => (
|
||||
<SetPermissions selectedPermissionsLink={group._links.permissions} />
|
||||
<SetPermissions
|
||||
selectedPermissionsLink={group._links.permissions}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<ExtensionPoint
|
||||
@@ -119,6 +121,7 @@ class SingleGroup extends React.Component<Props> {
|
||||
<Section label={t("singleGroup.menu.navigationLabel")}>
|
||||
<NavLink
|
||||
to={`${url}`}
|
||||
icon="fas fa-info-circle"
|
||||
label={t("singleGroup.menu.informationNavLink")}
|
||||
/>
|
||||
<ExtensionPoint
|
||||
@@ -138,7 +141,11 @@ class SingleGroup extends React.Component<Props> {
|
||||
group={group}
|
||||
permissionsUrl={`${url}/settings/permissions`}
|
||||
/>
|
||||
<ExtensionPoint name="group.subnavigation" props={extensionProps} renderAll={true} />
|
||||
<ExtensionPoint
|
||||
name="group.subnavigation"
|
||||
props={extensionProps}
|
||||
renderAll={true}
|
||||
/>
|
||||
</SubNavigation>
|
||||
</Section>
|
||||
</Navigation>
|
||||
|
||||
@@ -21,7 +21,7 @@ class GeneralRepoNavLink extends React.Component<Props> {
|
||||
if (!this.isEditable()) {
|
||||
return null;
|
||||
}
|
||||
return <NavLink to={editUrl} label={t("repositoryRoot.menu.generalNavLink")} />;
|
||||
return <NavLink to={editUrl} icon="fas fa-cog" label={t("repositoryRoot.menu.generalNavLink")} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class PermissionsNavLink extends React.Component<Props> {
|
||||
}
|
||||
const { permissionUrl, t } = this.props;
|
||||
return (
|
||||
<NavLink to={permissionUrl} label={t("repositoryRoot.menu.permissionsNavLink")} />
|
||||
<NavLink to={permissionUrl} icon="fas fa-lock" label={t("repositoryRoot.menu.permissionsNavLink")} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,11 @@ type Props = {
|
||||
|
||||
// dispatch functions
|
||||
fetchRepositoryTypesIfNeeded: () => void,
|
||||
createRepo: (link: string, Repository, callback: () => void) => void,
|
||||
createRepo: (
|
||||
link: string,
|
||||
Repository,
|
||||
callback: (repo: Repository) => void
|
||||
) => void,
|
||||
resetForm: () => void,
|
||||
|
||||
// context props
|
||||
@@ -43,9 +47,10 @@ class Create extends React.Component<Props> {
|
||||
this.props.fetchRepositoryTypesIfNeeded();
|
||||
}
|
||||
|
||||
repoCreated = () => {
|
||||
repoCreated = (repo: Repository) => {
|
||||
const { history } = this.props;
|
||||
history.push("/repos");
|
||||
|
||||
history.push("/repo/" + repo.namespace + "/" + repo.name);
|
||||
};
|
||||
|
||||
render() {
|
||||
@@ -70,7 +75,9 @@ class Create extends React.Component<Props> {
|
||||
repositoryTypes={repositoryTypes}
|
||||
loading={createLoading}
|
||||
submitForm={repo => {
|
||||
createRepo(repoLink, repo, this.repoCreated);
|
||||
createRepo(repoLink, repo, (repo: Repository) =>
|
||||
this.repoCreated(repo)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Page>
|
||||
|
||||
@@ -174,12 +174,14 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
<Section label={t("repositoryRoot.menu.navigationLabel")}>
|
||||
<NavLink
|
||||
to={url}
|
||||
icon="fas fa-info-circle"
|
||||
label={t("repositoryRoot.menu.informationNavLink")}
|
||||
/>
|
||||
<RepositoryNavLink
|
||||
repository={repository}
|
||||
linkName="changesets"
|
||||
to={`${url}/changesets/`}
|
||||
icon="fas fa-code-branch"
|
||||
label={t("repositoryRoot.menu.historyNavLink")}
|
||||
activeWhenMatch={this.matches}
|
||||
activeOnlyWhenExact={false}
|
||||
@@ -188,6 +190,7 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
repository={repository}
|
||||
linkName="sources"
|
||||
to={`${url}/sources`}
|
||||
icon="fas fa-code"
|
||||
label={t("repositoryRoot.menu.sourcesNavLink")}
|
||||
activeOnlyWhenExact={false}
|
||||
/>
|
||||
|
||||
@@ -164,16 +164,21 @@ export function fetchRepoFailure(
|
||||
export function createRepo(
|
||||
link: string,
|
||||
repository: Repository,
|
||||
callback?: () => void
|
||||
callback?: (repo: Repository) => void
|
||||
) {
|
||||
return function(dispatch: any) {
|
||||
dispatch(createRepoPending());
|
||||
return apiClient
|
||||
.post(link, repository, CONTENT_TYPE)
|
||||
.then(() => {
|
||||
.then(response => {
|
||||
const location = response.headers.get("Location");
|
||||
dispatch(createRepoSuccess());
|
||||
return apiClient.get(location);
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
if (callback) {
|
||||
callback();
|
||||
callback(response);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
@@ -415,9 +415,14 @@ describe("repos fetch", () => {
|
||||
|
||||
it("should successfully create repo slarti/fjords", () => {
|
||||
fetchMock.postOnce(REPOS_URL, {
|
||||
status: 201
|
||||
status: 201,
|
||||
headers: {
|
||||
location: "repositories/slarti/fjords"
|
||||
}
|
||||
});
|
||||
|
||||
fetchMock.getOnce(REPOS_URL + "/slarti/fjords", slartiFjords);
|
||||
|
||||
const expectedActions = [
|
||||
{
|
||||
type: CREATE_REPO_PENDING
|
||||
@@ -435,12 +440,19 @@ describe("repos fetch", () => {
|
||||
|
||||
it("should successfully create repo slarti/fjords and call the callback", () => {
|
||||
fetchMock.postOnce(REPOS_URL, {
|
||||
status: 201
|
||||
status: 201,
|
||||
headers: {
|
||||
location: "repositories/slarti/fjords"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fetchMock.getOnce(REPOS_URL + "/slarti/fjords", slartiFjords);
|
||||
|
||||
let callMe = "not yet";
|
||||
|
||||
const callback = () => {
|
||||
const callback = (r: any) => {
|
||||
expect(r).toEqual(slartiFjords);
|
||||
callMe = "yeah";
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class GeneralUserNavLink extends React.Component<Props> {
|
||||
if (!this.isEditable()) {
|
||||
return null;
|
||||
}
|
||||
return <NavLink to={editUrl} label={t("singleUser.menu.generalNavLink")} />;
|
||||
return <NavLink to={editUrl} icon="fas fa-cog" label={t("singleUser.menu.generalNavLink")} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class ChangePasswordNavLink extends React.Component<Props> {
|
||||
if (!this.hasPermissionToSetPassword()) {
|
||||
return null;
|
||||
}
|
||||
return <NavLink label={t("singleUser.menu.setPasswordNavLink")} to={passwordUrl} />;
|
||||
return <NavLink to={passwordUrl} label={t("singleUser.menu.setPasswordNavLink")} />;
|
||||
}
|
||||
|
||||
hasPermissionToSetPassword = () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ class ChangePermissionNavLink extends React.Component<Props> {
|
||||
if (!this.hasPermissionToSetPermission()) {
|
||||
return null;
|
||||
}
|
||||
return <NavLink label={t("singleUser.menu.setPermissionsNavLink")} to={permissionsUrl} />;
|
||||
return <NavLink to={permissionsUrl} label={t("singleUser.menu.setPermissionsNavLink")} />;
|
||||
}
|
||||
|
||||
hasPermissionToSetPermission = () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "../modules/users";
|
||||
import { Page } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import {getUsersLink} from "../../modules/indexResource";
|
||||
import { getUsersLink } from "../../modules/indexResource";
|
||||
|
||||
type Props = {
|
||||
loading?: boolean,
|
||||
@@ -33,13 +33,15 @@ class AddUser extends React.Component<Props> {
|
||||
this.props.resetForm();
|
||||
}
|
||||
|
||||
userCreated = () => {
|
||||
userCreated = (user: User) => {
|
||||
const { history } = this.props;
|
||||
history.push("/users");
|
||||
history.push("/user/" + user.name);
|
||||
};
|
||||
|
||||
createUser = (user: User) => {
|
||||
this.props.addUser(this.props.usersLink, user, this.userCreated);
|
||||
this.props.addUser(this.props.usersLink, user, () =>
|
||||
this.userCreated(user)
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -111,6 +111,7 @@ class SingleUser extends React.Component<Props> {
|
||||
<Section label={t("singleUser.menu.navigationLabel")}>
|
||||
<NavLink
|
||||
to={`${url}`}
|
||||
icon="fas fa-info-circle"
|
||||
label={t("singleUser.menu.informationNavLink")}
|
||||
/>
|
||||
<SubNavigation
|
||||
|
||||
Reference in New Issue
Block a user