mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 11:35:57 +01:00
Add ConfigurationAdapterBase and extension points for trash bin
Adds the new abstract class ConfigurationAdapterBase to simplify the creation of global configuration views. In addition there is some cleanup, interfaces and extension points for the repository trash bin plugin. Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com> Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com> Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com> Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
@@ -29,6 +29,7 @@ import RenameRepository from "./RenameRepository";
|
||||
import DeleteRepo from "./DeleteRepo";
|
||||
import ArchiveRepo from "./ArchiveRepo";
|
||||
import UnarchiveRepo from "./UnarchiveRepo";
|
||||
import { ExtensionPoint, extensionPoints, useBinder } from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
@@ -36,12 +37,18 @@ type Props = {
|
||||
|
||||
const RepositoryDangerZone: FC<Props> = ({ repository }) => {
|
||||
const [t] = useTranslation("repos");
|
||||
const binder = useBinder();
|
||||
|
||||
const dangerZone = [];
|
||||
if (repository?._links?.rename || repository?._links?.renameWithNamespace) {
|
||||
dangerZone.push(<RenameRepository repository={repository} />);
|
||||
}
|
||||
if (repository?._links?.delete) {
|
||||
|
||||
if (binder.hasExtension<extensionPoints.RepositoryDeleteButton>("repository.deleteButton", { repository })) {
|
||||
dangerZone.push(
|
||||
<ExtensionPoint<extensionPoints.RepositoryDeleteButton> name="repository.deleteButton" props={{ repository }} />
|
||||
);
|
||||
} else if (repository?._links?.delete) {
|
||||
dangerZone.push(<DeleteRepo repository={repository} />);
|
||||
}
|
||||
if (repository?._links?.archive) {
|
||||
|
||||
Reference in New Issue
Block a user