mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 10:16:16 +01:00
pluginsOverview goes api data
This commit is contained in:
@@ -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[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user