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

@@ -21,7 +21,7 @@
<module>scm-svn-plugin</module>
<module>scm-legacy-plugin</module>
</modules>
<dependencies>
<dependency>
@@ -30,16 +30,16 @@
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>sonia.scm</groupId>
<artifactId>scm-core</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- annotation processors -->
<dependency>
<groupId>sonia.scm</groupId>
<artifactId>scm-annotation-processor</artifactId>
@@ -60,7 +60,7 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- test scope -->
<dependency>
@@ -107,9 +107,9 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>sonia.scm.maven</groupId>
<artifactId>smp-maven-plugin</artifactId>
@@ -135,7 +135,40 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.sdorra</groupId>
<artifactId>buildfrontend-maven-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<node>
<version>8.11.3</version>
</node>
<pkgManager>
<type>YARN</type>
<version>1.7.0</version>
</pkgManager>
<failOnMissingPackageJson>false</failOnMissingPackageJson>
<script>build</script>
</configuration>
<executions>
<execution>
<id>install</id>
<phase>process-resources</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
<execution>
<id>build</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@@ -2,12 +2,12 @@
"name": "@scm-manager/scm-git-plugin",
"main": "src/main/js/index.js",
"scripts": {
"build": "ui-bundler build"
"build": "ui-bundler plugin"
},
"dependencies": {
"@scm-manager/ui-extensions": "^0.0.3"
"@scm-manager/ui-extensions": "^0.0.5"
},
"devDependencies": {
"@scm-manager/ui-bundler": "^0.0.2"
"@scm-manager/ui-bundler": "^0.0.3"
}
}

View File

@@ -61,38 +61,6 @@
</executions>
</plugin>
<plugin>
<groupId>com.github.sdorra</groupId>
<artifactId>buildfrontend-maven-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<node>
<version>8.11.3</version>
</node>
<pkgManager>
<type>YARN</type>
<version>1.7.0</version>
</pkgManager>
<script>build</script>
</configuration>
<executions>
<execution>
<id>install</id>
<phase>process-resources</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
<execution>
<id>build</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@@ -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;

View 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;

View File

@@ -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;

View File

@@ -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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"name": "@scm-manager/scm-hg-plugin",
"main": "src/main/js/index.js",
"scripts": {
"build": "ui-bundler plugin"
},
"dependencies": {
"@scm-manager/ui-extensions": "^0.0.5"
},
"devDependencies": {
"@scm-manager/ui-bundler": "^0.0.3"
}
}

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"name": "@scm-manager/scm-svn-plugin",
"main": "src/main/js/index.js",
"scripts": {
"build": "ui-bundler plugin"
},
"dependencies": {
"@scm-manager/ui-extensions": "^0.0.5"
},
"devDependencies": {
"@scm-manager/ui-bundler": "^0.0.3"
}
}

View File

@@ -0,0 +1,28 @@
//@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>Checkout the repository</h4>
<pre>
<code>svn checkout {repository._links.httpProtocol.href}</code>
</pre>
</div>
);
}
}
export default ProtocolInformation;

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -39,6 +39,8 @@
-->
<script src="vendor.bundle.js"></script>
<script src="scm-ui.bundle.js"></script>
<!--script src="scm-git-plugin.bundle.js"></script-->
<script src="scm-git-plugin.bundle.js"></script>
<script src="scm-hg-plugin.bundle.js"></script>
<script src="scm-svn-plugin.bundle.js"></script>
</body>
</html>