mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
codify extension points docs (#1947)
This pull request converts the current incomplete textual documentation of the available frontend extension points to in-code definitions that act both as documentation and as type helpers for improving overall code quality. All extension points available in the SCM-Manager core are now available, but no plugin was updated and only those parts of the core codebase had the new types added that did not require runtime changes. The only exception to this is the breadcrumbs, which was a simple change that is fully backwards-compatible.
This commit is contained in:
committed by
GitHub
parent
5006e9b821
commit
4d203ff36f
@@ -25,7 +25,7 @@
|
||||
import React, { FC } from "react";
|
||||
import { CUSTOM_NAMESPACE_STRATEGY } from "@scm-manager/ui-types";
|
||||
import { Autocomplete } from "@scm-manager/ui-components";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNamespaceSuggestions } from "@scm-manager/ui-api";
|
||||
|
||||
@@ -77,7 +77,13 @@ const NamespaceInput: FC<Props> = ({
|
||||
);
|
||||
}
|
||||
|
||||
return <ExtensionPoint name="repos.create.namespace" props={props} renderAll={false} />;
|
||||
return (
|
||||
<ExtensionPoint<extensionPoints.ReposCreateNamespace>
|
||||
name="repos.create.namespace"
|
||||
props={props}
|
||||
renderAll={false}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default NamespaceInput;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
import React from "react";
|
||||
import { Repository } from "@scm-manager/ui-types";
|
||||
import RepositoryDetailTable from "./RepositoryDetailTable";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
@@ -38,7 +38,7 @@ class RepositoryDetails extends React.Component<Props> {
|
||||
<RepositoryDetailTable repository={repository} />
|
||||
<hr />
|
||||
<div className="content">
|
||||
<ExtensionPoint
|
||||
<ExtensionPoint<extensionPoints.RepositoryDetailsInformation>
|
||||
name="repos.repository-details.information"
|
||||
renderAll={true}
|
||||
props={{
|
||||
|
||||
@@ -25,7 +25,7 @@ import React, { FC, useState } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
||||
import { Changeset, ParentChangeset, Repository } from "@scm-manager/ui-types";
|
||||
import {
|
||||
AvatarImage,
|
||||
@@ -146,7 +146,7 @@ const ChangesetDetails: FC<Props> = ({ changeset, repository, fileControlFactory
|
||||
<>
|
||||
<div className={classNames("content", "m-0")}>
|
||||
<SubSubtitle>
|
||||
<ExtensionPoint
|
||||
<ExtensionPoint<extensionPoints.ChangesetDescription>
|
||||
name="changeset.description"
|
||||
props={{
|
||||
changeset,
|
||||
@@ -206,7 +206,7 @@ const ChangesetDetails: FC<Props> = ({ changeset, repository, fileControlFactory
|
||||
{description.message.split("\n").map((item, key) => {
|
||||
return (
|
||||
<span key={key}>
|
||||
<ExtensionPoint
|
||||
<ExtensionPoint<extensionPoints.ChangesetDescription>
|
||||
name="changeset.description"
|
||||
props={{
|
||||
changeset,
|
||||
|
||||
@@ -25,8 +25,8 @@ import React, { FC } from "react";
|
||||
import { Changeset, Person } from "@scm-manager/ui-types";
|
||||
import styled from "styled-components";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useBinder } from "@scm-manager/ui-extensions";
|
||||
import { ContributorAvatar, CommaSeparatedList } from "@scm-manager/ui-components";
|
||||
import { extensionPoints, useBinder } from "@scm-manager/ui-extensions";
|
||||
import { CommaSeparatedList, ContributorAvatar } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
changeset: Changeset;
|
||||
@@ -39,7 +39,7 @@ const SizedTd = styled.td`
|
||||
const Contributor: FC<{ person: Person }> = ({ person }) => {
|
||||
const [t] = useTranslation("repos");
|
||||
const binder = useBinder();
|
||||
const avatarFactory = binder.getExtension("avatar.factory");
|
||||
const avatarFactory = binder.getExtension<extensionPoints.AvatarFactory>("avatar.factory");
|
||||
let prefix = null;
|
||||
if (avatarFactory) {
|
||||
const avatar = avatarFactory(person);
|
||||
|
||||
@@ -27,7 +27,7 @@ import { NamespaceCollection, Repository } from "@scm-manager/ui-types";
|
||||
|
||||
import groupByNamespace from "./groupByNamespace";
|
||||
import RepositoryGroupEntry from "./RepositoryGroupEntry";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { ExtensionPoint, extensionPoints } from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
repositories: Repository[];
|
||||
@@ -44,7 +44,7 @@ class RepositoryList extends React.Component<Props> {
|
||||
const groups = groupByNamespace(repositories, namespaces);
|
||||
return (
|
||||
<div className="content">
|
||||
<ExtensionPoint
|
||||
<ExtensionPoint<extensionPoints.RepositoryOverviewTop>
|
||||
name="repository.overview.top"
|
||||
renderAll={true}
|
||||
props={{
|
||||
|
||||
Reference in New Issue
Block a user