mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
implemented avatar and information extension point for svn, hg and git
This commit is contained in:
15
scm-plugins/scm-hg-plugin/src/main/js/HgAvatar.js
Normal file
15
scm-plugins/scm-hg-plugin/src/main/js/HgAvatar.js
Normal 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;
|
||||
60
scm-plugins/scm-hg-plugin/src/main/js/ProtocolInformation.js
Normal file
60
scm-plugins/scm-hg-plugin/src/main/js/ProtocolInformation.js
Normal 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;
|
||||
10
scm-plugins/scm-hg-plugin/src/main/js/index.js
Normal file
10
scm-plugins/scm-hg-plugin/src/main/js/index.js
Normal 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);
|
||||
BIN
scm-plugins/scm-hg-plugin/src/main/webapp/images/hg-logo.png
Normal file
BIN
scm-plugins/scm-hg-plugin/src/main/webapp/images/hg-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
Reference in New Issue
Block a user