added more information to modal body

This commit is contained in:
Florian Scholdei
2019-08-20 17:19:57 +02:00
parent 02c295207c
commit f72f740f17
4 changed files with 125 additions and 27 deletions

View File

@@ -31,12 +31,14 @@
}, },
"noPlugins": "Keine Plugins gefunden.", "noPlugins": "Keine Plugins gefunden.",
"modal": { "modal": {
"title": "Plugin installieren", "title": "{{name}} Plugin installieren",
"dependency": "Abhängigkeit:",
"dependency_plural": "Abhängigkeiten:",
"restart": "Neustarten um Plugin zu aktivieren", "restart": "Neustarten um Plugin zu aktivieren",
"install": "Installieren", "install": "Installieren",
"abort": "Abbrechen" "abort": "Abbrechen",
"author": "Autor",
"version": "Version",
"dependencyNotification": "Mit diesem Plugin werden folgende Abhängigkeiten mit installieren wenn sie noch nicht vorhanden sind.",
"dependencies": "Abhängigkeiten"
} }
}, },
"repositoryRole": { "repositoryRole": {

View File

@@ -6,7 +6,7 @@
"settingsNavLink": "Settings", "settingsNavLink": "Settings",
"generalNavLink": "General" "generalNavLink": "General"
}, },
"info": { "info": {
"currentAppVersion": "Current Application Version", "currentAppVersion": "Current Application Version",
"communityTitle": "Community Support", "communityTitle": "Community Support",
"communityIconAlt": "Community Support Icon", "communityIconAlt": "Community Support Icon",
@@ -31,12 +31,14 @@
}, },
"noPlugins": "No plugins found.", "noPlugins": "No plugins found.",
"modal": { "modal": {
"title": "Install Plugin", "title": "Install {{name}} Plugin",
"dependency": "Dependency:",
"dependency_plural": "Dependencies:",
"restart": "Restart to activate", "restart": "Restart to activate",
"install": "Install", "install": "Install",
"abort": "Abort" "abort": "Abort",
"author": "Author",
"version": "Version",
"dependencyNotification": "With this plugin, the following dependencies are installed if they are not available yet.",
"dependencies": "Dependencies"
} }
}, },
"repositoryRole": { "repositoryRole": {
@@ -61,7 +63,7 @@
"permissions": "Permissions", "permissions": "Permissions",
"submit": "Save" "submit": "Save"
}, },
"delete" : { "delete": {
"button": "Löschen", "button": "Löschen",
"subtitle": "Berechtigungsrolle löschen", "subtitle": "Berechtigungsrolle löschen",
"confirmAlert": { "confirmAlert": {

View File

@@ -19,6 +19,7 @@ type State = {
const styles = { const styles = {
link: { link: {
cursor: "pointer",
pointerEvents: "all" pointerEvents: "all"
} }
}; };

View File

@@ -1,6 +1,8 @@
//@flow //@flow
import React from "react"; import React from "react";
import { compose } from "redux";
import { translate } from "react-i18next"; import { translate } from "react-i18next";
import injectSheet from "react-jss";
import type { Plugin } from "@scm-manager/ui-types"; import type { Plugin } from "@scm-manager/ui-types";
import { import {
Button, Button,
@@ -9,6 +11,7 @@ import {
Modal, Modal,
SubmitButton SubmitButton
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import classNames from "classnames";
type Props = { type Props = {
plugin: Plugin, plugin: Plugin,
@@ -16,23 +19,58 @@ type Props = {
onClose: () => void, onClose: () => void,
// context props // context props
classes: any,
t: string => string t: string => string
}; };
const styles = {
titleVersion: {
marginLeft: "0.75rem"
},
userLabelAlignment: {
textAlign: "left",
marginRight: 0,
minWidth: "5.5em"
},
userFieldFlex: {
flexGrow: 4
},
listSpacing: {
marginTop: "0 !important"
}
};
class PluginModal extends React.Component<Props> { class PluginModal extends React.Component<Props> {
renderDependencies() { renderDependencies() {
const { plugin, t } = this.props; const { plugin, classes, t } = this.props;
let dependencies = null; let dependencies = null;
if (plugin.dependencies && plugin.dependencies.length > 0) { if (plugin.dependencies && plugin.dependencies.length > 0) {
dependencies = ( dependencies = (
<> <>
{t("plugins.modal.dependency", {count: plugin.dependencies.length})} <strong>{t("plugin.modal.dependencyNotification")}</strong>
<ul> <div className="field is-horizontal">
{plugin.dependencies.map((dependency, index) => { <div
return <li key={index}>{dependency}</li>; className={classNames(
})} classes.userLabelAlignment,
</ul> "field-label is-inline-flex"
)}
>
{t("plugins.modal.dependencies")}:
</div>
<div
className={classNames(
classes.userFieldFlex,
"field-body is-inline-flex"
)}
>
<ul className={classes.listSpacing}>
{plugin.dependencies.map((dependency, index) => {
return <li key={index}>{dependency}</li>;
})}
</ul>
</div>
</div>
</> </>
); );
} }
@@ -40,17 +78,67 @@ class PluginModal extends React.Component<Props> {
} }
render() { render() {
const { onSubmit, onClose, t } = this.props; const { plugin, onSubmit, onClose, classes, t } = this.props;
const body = ( const body = (
<> <>
{this.renderDependencies()} <div className="media">
<Checkbox <div className="media-content">
checked={false} <p>{plugin.description && plugin.description}</p>
label={t("plugins.modal.restart")} </div>
onChange={null} </div>
disabled={null} <div className="media">
/> <div className="media-content">
<div className="field is-horizontal">
<div
className={classNames(
classes.userLabelAlignment,
"field-label is-inline-flex"
)}
>
{t("plugins.modal.author")}:
</div>
<div
className={classNames(
classes.userFieldFlex,
"field-body is-inline-flex"
)}
>
{plugin.author}
</div>
</div>
<div className="field is-horizontal">
<div
className={classNames(
classes.userLabelAlignment,
"field-label is-inline-flex"
)}
>
{t("plugins.modal.version")}:
</div>
<div
className={classNames(
classes.userFieldFlex,
"field-body is-inline-flex"
)}
>
{plugin.version}
</div>
</div>
{this.renderDependencies()}
</div>
</div>
<div className="media">
<div className="media-content">
<Checkbox
checked={false}
label={t("plugins.modal.restart")}
onChange={null}
disabled={null}
/>
</div>
</div>
</> </>
); );
@@ -65,7 +153,9 @@ class PluginModal extends React.Component<Props> {
return ( return (
<Modal <Modal
title={t("plugins.modal.title")} title={t("plugins.modal.title", {
name: plugin.displayName ? plugin.displayName : ""
})}
closeFunction={() => onClose()} closeFunction={() => onClose()}
body={body} body={body}
footer={footer} footer={footer}
@@ -75,4 +165,7 @@ class PluginModal extends React.Component<Props> {
} }
} }
export default translate("admin")(PluginModal); export default compose(
injectSheet(styles),
translate("admin")
)(PluginModal);