mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
implemented avatar and information extension point for svn, hg and git
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
//@flow
|
||||
import React from 'react';
|
||||
|
||||
// TODO flow types ???
|
||||
type Props = {
|
||||
repository: Object
|
||||
}
|
||||
|
||||
class CloneInformation extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { repository } = this.repository;
|
||||
if (repository.type !== "git") {
|
||||
return null;
|
||||
}
|
||||
if (!repository._links.httpProtocol) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<h2>Git</h2>
|
||||
<pre><code>
|
||||
git clone { repository._links.httpProtocol }
|
||||
</code></pre>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default CloneInformation;
|
||||
15
scm-plugins/scm-git-plugin/src/main/js/GitAvatar.js
Normal file
15
scm-plugins/scm-git-plugin/src/main/js/GitAvatar.js
Normal file
@@ -0,0 +1,15 @@
|
||||
//@flow
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
};
|
||||
|
||||
class GitAvatar extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
return <img src="/images/git-logo.png" alt="Git Logo" />;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default GitAvatar;
|
||||
@@ -0,0 +1,54 @@
|
||||
//@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>git clone {repository._links.httpProtocol.href}</code>
|
||||
</pre>
|
||||
<h4>Create a new repository</h4>
|
||||
<pre>
|
||||
<code>
|
||||
git init {repository.name}
|
||||
<br />
|
||||
echo "# {repository.name}" > README.md
|
||||
<br />
|
||||
git add README.md
|
||||
<br />
|
||||
git commit -m "added readme"
|
||||
<br />
|
||||
git remote add origin {repository._links.httpProtocol.href}
|
||||
<br />
|
||||
git push -u origin master
|
||||
<br />
|
||||
</code>
|
||||
</pre>
|
||||
<h4>Push an existing repository</h4>
|
||||
<pre>
|
||||
<code>
|
||||
git remote add origin {repository._links.httpProtocol.href}
|
||||
<br />
|
||||
git push -u origin master
|
||||
<br />
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ProtocolInformation;
|
||||
@@ -1,4 +1,10 @@
|
||||
import { binder } from "@scm-manager/ui-extensions";
|
||||
import CloneInformation from './CloneInformation';
|
||||
import ProtocolInformation from './ProtocolInformation';
|
||||
import GitAvatar from './GitAvatar';
|
||||
|
||||
binder.bind("repos.repository-details.informations", CloneInformation);
|
||||
const gitPredicate = (props: Object) => {
|
||||
return props.repository && props.repository.type === "git";
|
||||
};
|
||||
|
||||
binder.bind("repos.repository-details.information", ProtocolInformation, gitPredicate);
|
||||
binder.bind("repos.repository-avatar", GitAvatar, gitPredicate);
|
||||
|
||||
BIN
scm-plugins/scm-git-plugin/src/main/webapp/images/git-logo.png
Normal file
BIN
scm-plugins/scm-git-plugin/src/main/webapp/images/git-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Reference in New Issue
Block a user