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

View File

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

View File

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

View File

@@ -1,20 +1,40 @@
// @flow // @flow
import React from "react"; import React from "react";
import {connect} from "react-redux";
import { translate } from "react-i18next"; 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 { Loading, Title, Subtitle, LinkPaginator, Notification } from "@scm-manager/ui-components";
import {
fetchPluginsByLink,
getFetchPluginsFailure,
getPluginCollection,
isFetchPluginsPending
} from "../modules/plugins";
import PluginsList from "../components/PluginsList"; import PluginsList from "../components/PluginsList";
import { getUiPluginsLink } from "../../../modules/indexResource";
type Props = { type Props = {
loading: boolean, loading: boolean,
error: Error, error: Error,
collection: PluginCollection,
page: number,
baseUrl: string, baseUrl: string,
installed: boolean, installed: boolean,
pluginsLink: string,
// context objects // context objects
t: string => string t: string => string,
// dispatched functions
fetchPluginsByLink: (link: string) => void
}; };
class PluginsOverview extends React.Component<Props> { class PluginsOverview extends React.Component<Props> {
componentDidMount() {
const { fetchPluginsByLink, pluginsLink } = this.props;
fetchPluginsByLink(pluginsLink);
}
render() { render() {
const { loading, installed, t } = this.props; 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> </dependency>
<!-- fix javadoc --> <!-- fix javadoc -->
<dependency> <dependency>
<groupId>javax.transaction</groupId> <groupId>javax.transaction</groupId>
<artifactId>jta</artifactId> <artifactId>jta</artifactId>
<version>1.1</version> <version>1.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- scm --> <!-- scm -->
<dependency> <dependency>
<groupId>sonia.scm</groupId> <groupId>sonia.scm</groupId>
<artifactId>scm-core</artifactId> <artifactId>scm-core</artifactId>
@@ -63,7 +63,7 @@
<artifactId>shiro-web</artifactId> <artifactId>shiro-web</artifactId>
<version>${shiro.version}</version> <version>${shiro.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-guice</artifactId> <artifactId>shiro-guice</artifactId>
@@ -204,13 +204,13 @@
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId> <artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version> <version>${slf4j.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId> <artifactId>log4j-over-slf4j</artifactId>
@@ -237,13 +237,13 @@
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.9</version> <version>1.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>${guava.version}</version> <version>${guava.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.cronutils</groupId> <groupId>com.cronutils</groupId>
<artifactId>cron-utils</artifactId> <artifactId>cron-utils</artifactId>
@@ -312,7 +312,7 @@
<version>${selenium.version}</version> <version>${selenium.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId> <artifactId>htmlunit-driver</artifactId>
@@ -386,16 +386,16 @@
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- global excludes --> <!-- global excludes -->
<dependency> <dependency>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
<version>1.1.3</version> <version>1.1.3</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
@@ -419,7 +419,7 @@
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>com.mycila.maven-license-plugin</groupId> <groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId> <artifactId>maven-license-plugin</artifactId>
@@ -459,7 +459,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>sonia.scm.maven</groupId> <groupId>sonia.scm.maven</groupId>
<artifactId>smp-maven-plugin</artifactId> <artifactId>smp-maven-plugin</artifactId>
@@ -947,6 +947,6 @@
</profile> </profile>
</profiles> </profiles>
</project> </project>