mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-07 01:08:50 +02:00
Merged in feature/openElementAfterCreation (pull request #155)
Feature/openElementAfterCreation
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>
|
||||
|
||||
@@ -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,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>
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user