enhance NamespaceStrategy API / improve frontend validation and use namespace extension point in RenameRepository component

This commit is contained in:
Eduard Heimbuch
2020-06-29 10:41:31 +02:00
parent 7fa256bedb
commit f8640d300e
17 changed files with 178 additions and 56 deletions

View File

@@ -25,17 +25,19 @@ import React from "react";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import RepositoryForm from "../components/form";
import { Repository } from "@scm-manager/ui-types";
import { Repository, Links } from "@scm-manager/ui-types";
import { getModifyRepoFailure, isModifyRepoPending, modifyRepo, modifyRepoReset } from "../modules/repos";
import { History } from "history";
import { ErrorNotification } from "@scm-manager/ui-components";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { compose } from "redux";
import DangerZone from "./DangerZone";
import { getLinks } from "../../modules/indexResource";
type Props = {
loading: boolean;
error: Error;
indexLinks: Links;
modifyRepo: (p1: Repository, p2: () => void) => void;
modifyRepoReset: (p: Repository) => void;
@@ -69,7 +71,7 @@ class EditRepo extends React.Component<Props> {
};
render() {
const { loading, error, repository } = this.props;
const { loading, error, repository, indexLinks } = this.props;
const url = this.matchedUrl();
@@ -89,7 +91,7 @@ class EditRepo extends React.Component<Props> {
}}
/>
<ExtensionPoint name="repo-config.route" props={extensionProps} renderAll={true} />
<DangerZone repository={repository} />
<DangerZone repository={repository} indexLinks={indexLinks} />
</>
);
}
@@ -99,9 +101,12 @@ const mapStateToProps = (state: any, ownProps: Props) => {
const { namespace, name } = ownProps.repository;
const loading = isModifyRepoPending(state, namespace, name);
const error = getModifyRepoFailure(state, namespace, name);
const indexLinks = getLinks(state);
return {
loading,
error
error,
indexLinks
};
};