mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
fixed review notes
This commit is contained in:
@@ -9,8 +9,6 @@ import classNames from "classnames";
|
||||
|
||||
import icon from "../../../images/blib.jpg";
|
||||
|
||||
// TODO we need a variable or something central for the hover
|
||||
|
||||
const styles = {
|
||||
outer: {
|
||||
position: "relative"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { translate } from "react-i18next";
|
||||
import { Page } from "../../components/layout";
|
||||
import RepositoryForm from "../components/form";
|
||||
import type { Repository } from "../types/Repositories";
|
||||
import {
|
||||
@@ -12,11 +11,12 @@ import {
|
||||
} from "../modules/repos";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import type { History } from "history";
|
||||
import ErrorNotification from "../../components/ErrorNotification";
|
||||
|
||||
type Props = {
|
||||
repository: Repository,
|
||||
modifyRepo: (Repository, () => void) => void,
|
||||
modifyLoading: boolean,
|
||||
loading: boolean,
|
||||
error: Error,
|
||||
|
||||
// context props
|
||||
@@ -25,43 +25,34 @@ type Props = {
|
||||
};
|
||||
|
||||
class Edit extends React.Component<Props> {
|
||||
componentDidMount() {}
|
||||
|
||||
repoModified = () => {
|
||||
const { history, repository } = this.props;
|
||||
history.push(`/repo/${repository.namespace}/${repository.name}`);
|
||||
};
|
||||
|
||||
render() {
|
||||
const { t, modifyLoading, error } = this.props;
|
||||
const { loading, error } = this.props;
|
||||
return (
|
||||
<Page
|
||||
title={t("edit.title")}
|
||||
subtitle={t("edit.subtitle")}
|
||||
error={error}
|
||||
showContentOnError={true}
|
||||
>
|
||||
<div>
|
||||
<ErrorNotification error={error} />
|
||||
<RepositoryForm
|
||||
repository={this.props.repository}
|
||||
loading={modifyLoading}
|
||||
loading={loading}
|
||||
submitForm={repo => {
|
||||
this.props.modifyRepo(repo, this.repoModified);
|
||||
}}
|
||||
/>
|
||||
</Page>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const { namespace, name } = ownProps.repository;
|
||||
|
||||
const modifyLoading = isModifyRepoPending(state, namespace, name);
|
||||
|
||||
const loading = isModifyRepoPending(state, namespace, name);
|
||||
const error = getModifyRepoFailure(state, namespace, name);
|
||||
|
||||
return {
|
||||
modifyLoading,
|
||||
loading,
|
||||
error
|
||||
};
|
||||
};
|
||||
|
||||
@@ -100,8 +100,11 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
</div>
|
||||
<div className="column">
|
||||
<Navigation>
|
||||
<Section label={t("repository-root.actions-label")}>
|
||||
<Section label={t("repository-root.navigation-label")}>
|
||||
<NavLink to={url} label={t("repository-root.information")} />
|
||||
<EditNavLink repository={repository} editUrl={`${url}/edit`} />
|
||||
</Section>
|
||||
<Section label={t("repository-root.actions-label")}>
|
||||
<DeleteNavAction repository={repository} delete={this.delete} />
|
||||
<NavLink to="/repos" label={t("repository-root.back-label")} />
|
||||
</Section>
|
||||
|
||||
@@ -38,7 +38,10 @@ function fetchRepositoryTypes(dispatch: any) {
|
||||
dispatch(fetchRepositoryTypesSuccess(repositoryTypes));
|
||||
})
|
||||
.catch(err => {
|
||||
dispatch(fetchRepositoryTypesFailure(err));
|
||||
const error = new Error(
|
||||
`failed to fetch repository types: ${err.message}`
|
||||
);
|
||||
dispatch(fetchRepositoryTypesFailure(error));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user