pluginsOverview goes api data

This commit is contained in:
Florian Scholdei
2019-07-03 16:42:36 +02:00
parent a03a666afe
commit df501b162d
5 changed files with 65 additions and 23 deletions

View File

@@ -1,8 +1,7 @@
//@flow
import type { PagedCollection, Links } from "./hal";
import type { Collection, Links } from "./hal";
export type Plugin = {
namespace: string,
name: string,
type: string,
description?: string,
@@ -11,7 +10,7 @@ export type Plugin = {
_links: Links
};
export type PluginCollection = PagedCollection & {
export type PluginCollection = Collection & {
_embedded: {
plugins: Plugin[] | string[]
}

View File

@@ -18,7 +18,8 @@
"pluginsNavLink": "Plugins",
"installedNavLink": "Installiert",
"availableNavLink": "Verfügbar"
}
},
"noPlugins": "Keine Plugins gefunden."
},
"repositoryRole": {
"navLink": "Berechtigungsrollen",

View File

@@ -18,7 +18,8 @@
"pluginsNavLink": "Plugins",
"installedNavLink": "Installed",
"availableNavLink": "Available"
}
},
"noPlugins": "No plugins found."
},
"repositoryRole": {
"navLink": "Permission Roles",

View File

@@ -1,20 +1,40 @@
// @flow
import React from "react";
import {connect} from "react-redux";
import { translate } from "react-i18next";
import type { PluginCollection } from "@scm-manager/ui-types";
import { Loading, Title, Subtitle, LinkPaginator, Notification } from "@scm-manager/ui-components";
import {
fetchPluginsByLink,
getFetchPluginsFailure,
getPluginCollection,
isFetchPluginsPending
} from "../modules/plugins";
import PluginsList from "../components/PluginsList";
import { getUiPluginsLink } from "../../../modules/indexResource";
type Props = {
loading: boolean,
error: Error,
collection: PluginCollection,
page: number,
baseUrl: string,
installed: boolean,
pluginsLink: string,
// context objects
t: string => string
t: string => string,
// dispatched functions
fetchPluginsByLink: (link: string) => void
};
class PluginsOverview extends React.Component<Props> {
componentDidMount() {
const { fetchPluginsByLink, pluginsLink } = this.props;
fetchPluginsByLink(pluginsLink);
}
render() {
const { loading, installed, t } = this.props;
@@ -54,4 +74,25 @@ class PluginsOverview extends React.Component<Props> {
}
}
export default translate("admin")(PluginsOverview);
const mapStateToProps = (state) => {
const collection = getPluginCollection(state);
const loading = isFetchPluginsPending(state);
const error = getFetchPluginsFailure(state);
const pluginsLink = getUiPluginsLink(state);
return {
collection,
loading,
error,
pluginsLink
};
};
const mapDispatchToProps = dispatch => {
return {
fetchPluginsByLink: (link: string) => {
dispatch(fetchPluginsByLink(link));
}
};
};
export default connect(mapStateToProps, mapDispatchToProps)(translate("admin")(PluginsOverview));

View File

@@ -34,16 +34,16 @@
</dependency>
<!-- fix javadoc -->
<dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<!-- scm -->
<dependency>
<groupId>sonia.scm</groupId>
<artifactId>scm-core</artifactId>
@@ -63,7 +63,7 @@
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-guice</artifactId>
@@ -204,13 +204,13 @@
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
@@ -237,13 +237,13 @@
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId>
@@ -312,7 +312,7 @@
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
@@ -386,16 +386,16 @@
<version>2.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<!-- global excludes -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@@ -419,7 +419,7 @@
<build>
<plugins>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
@@ -459,7 +459,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>sonia.scm.maven</groupId>
<artifactId>smp-maven-plugin</artifactId>
@@ -947,6 +947,6 @@
</profile>
</profiles>
</project>