implemented avatar and information extension point for svn, hg and git

This commit is contained in:
Sebastian Sdorra
2018-08-24 11:03:35 +02:00
parent c342e1d57c
commit 8fa1308169
22 changed files with 15316 additions and 534 deletions

View File

@@ -0,0 +1,15 @@
//@flow
import React from 'react';
type Props = {
};
class HgAvatar extends React.Component<Props> {
render() {
return <img src="/images/hg-logo.png" alt="Mercurial Logo" />;
}
}
export default HgAvatar;

View File

@@ -0,0 +1,60 @@
//@flow
import React from 'react';
// TODO flow types ???
type Props = {
repository: Object
}
class ProtocolInformation extends React.Component<Props> {
render() {
const { repository } = this.props;
if (!repository._links.httpProtocol) {
return null;
}
return (
<div>
<h4>Clone the repository</h4>
<pre>
<code>hg clone {repository._links.httpProtocol.href}</code>
</pre>
<h4>Create a new repository</h4>
<pre>
<code>
hg init {repository.name}
<br />
echo "[paths]" > .hg/hgrc
<br />
echo "default = {repository._links.httpProtocol.href}" > .hg/hgrc
<br />
echo "# {repository.name}" > README.md
<br />
hg add README.md
<br />
hg commit -m "added readme"
<br />
<br />
hg push
<br />
</code>
</pre>
<h4>Push an existing repository</h4>
<pre>
<code>
# add the repository url as default to your .hg/hgrc e.g:
<br />
default = {repository._links.httpProtocol.href}
<br />
# push to remote repository
<br />
hg push
</code>
</pre>
</div>
);
}
}
export default ProtocolInformation;

View File

@@ -0,0 +1,10 @@
import { binder } from "@scm-manager/ui-extensions";
import ProtocolInformation from './ProtocolInformation';
import HgAvatar from './HgAvatar';
const hgPredicate = (props: Object) => {
return props.repository && props.repository.type === "hg";
};
binder.bind("repos.repository-details.information", ProtocolInformation, hgPredicate);
binder.bind("repos.repository-avatar", HgAvatar, hgPredicate);

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB