mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 10:41:06 +01:00
change plugin overview action buttons
This commit is contained in:
@@ -29,9 +29,11 @@
|
|||||||
"installedNavLink": "Installiert",
|
"installedNavLink": "Installiert",
|
||||||
"availableNavLink": "Verfügbar"
|
"availableNavLink": "Verfügbar"
|
||||||
},
|
},
|
||||||
"executePending": "Ausstehende Änderungen ausführen",
|
"executePending": "Änderungen ausführen",
|
||||||
|
"outdatedPlugins": "{{count}} veraltetes Plugin",
|
||||||
|
"outdatedPlugins_plural": "{{count}} veraltete Plugins",
|
||||||
"updateAll": "Alle Plugins aktualisieren",
|
"updateAll": "Alle Plugins aktualisieren",
|
||||||
"cancelPending": "Ausstehende Änderungen abbrechen",
|
"cancelPending": "Änderungen abbrechen",
|
||||||
"noPlugins": "Keine Plugins gefunden.",
|
"noPlugins": "Keine Plugins gefunden.",
|
||||||
"modal": {
|
"modal": {
|
||||||
"title": {
|
"title": {
|
||||||
@@ -50,7 +52,7 @@
|
|||||||
"updateAndRestart": "Aktualisieren und Neustarten",
|
"updateAndRestart": "Aktualisieren und Neustarten",
|
||||||
"uninstallAndRestart": "Deinstallieren and Neustarten",
|
"uninstallAndRestart": "Deinstallieren and Neustarten",
|
||||||
"executeAndRestart": "Ausführen und Neustarten",
|
"executeAndRestart": "Ausführen und Neustarten",
|
||||||
"updateAllAndRestart": "Alle aktualisieren und Neustarten",
|
"updateAll": "Alle Plugins aktualisieren",
|
||||||
"abort": "Abbrechen",
|
"abort": "Abbrechen",
|
||||||
"author": "Autor",
|
"author": "Autor",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
|
|||||||
@@ -29,9 +29,11 @@
|
|||||||
"installedNavLink": "Installed",
|
"installedNavLink": "Installed",
|
||||||
"availableNavLink": "Available"
|
"availableNavLink": "Available"
|
||||||
},
|
},
|
||||||
"executePending": "Execute pending changes",
|
"executePending": "Execute changes",
|
||||||
"updateAll": "Update all",
|
"outdatedPlugins": "{{count}} outdated plugin",
|
||||||
"cancelPending": "Cancel pending changes",
|
"outdatedPlugins_plural": "{{count}} outdated plugins",
|
||||||
|
"updateAll": "Update all plugins",
|
||||||
|
"cancelPending": "Cancel changes",
|
||||||
"noPlugins": "No plugins found.",
|
"noPlugins": "No plugins found.",
|
||||||
"modal": {
|
"modal": {
|
||||||
"title": {
|
"title": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Button } from "@scm-manager/ui-components";
|
import { Button } from "@scm-manager/ui-components";
|
||||||
import type {PendingPlugins, PluginCollection} from "@scm-manager/ui-types";
|
import type { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import MultiPluginActionModal from "./MultiPluginActionModal";
|
import MultiPluginActionModal from "./MultiPluginActionModal";
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ type Props = {
|
|||||||
installedPlugins?: PluginCollection,
|
installedPlugins?: PluginCollection,
|
||||||
|
|
||||||
// context props
|
// context props
|
||||||
t: string => string
|
t: (key: string, params?: Object) => string
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@@ -39,19 +39,25 @@ class MultiPluginAction extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderLabel = () => {
|
renderLabel = () => {
|
||||||
const {t, actionType} = this.props;
|
const { t, actionType, installedPlugins } = this.props;
|
||||||
|
const outdatedPlugins =
|
||||||
|
actionType === MultiPluginActionType.UPDATE_ALL &&
|
||||||
|
installedPlugins._embedded.plugins.filter(p => p._links.update).length;
|
||||||
|
|
||||||
if (actionType === MultiPluginActionType.EXECUTE_PENDING) {
|
if (actionType === MultiPluginActionType.EXECUTE_PENDING) {
|
||||||
return t("plugins.executePending");
|
return t("plugins.executePending");
|
||||||
} else if (actionType === MultiPluginActionType.CANCEL_PENDING) {
|
} else if (actionType === MultiPluginActionType.CANCEL_PENDING) {
|
||||||
return t("plugins.cancelPending");
|
return t("plugins.cancelPending");
|
||||||
} else {
|
} else {
|
||||||
return t("plugins.updateAll");
|
return t("plugins.outdatedPlugins", {
|
||||||
|
count: outdatedPlugins
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
renderModal = () => {
|
renderModal = () => {
|
||||||
const { showModal } = this.state;
|
const { showModal } = this.state;
|
||||||
const {pendingPlugins, installedPlugins, actionType} = this.props;
|
const { pendingPlugins, installedPlugins, actionType } = this.props;
|
||||||
if (showModal) {
|
if (showModal) {
|
||||||
return (
|
return (
|
||||||
<MultiPluginActionModal
|
<MultiPluginActionModal
|
||||||
@@ -73,12 +79,26 @@ class MultiPluginAction extends React.Component<Props, State> {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
renderIcon = () => {
|
||||||
|
const { actionType } = this.props;
|
||||||
|
|
||||||
|
if (actionType === MultiPluginActionType.EXECUTE_PENDING) {
|
||||||
|
return "arrow-circle-right";
|
||||||
|
} else if (actionType === MultiPluginActionType.CANCEL_PENDING) {
|
||||||
|
return "times";
|
||||||
|
} else {
|
||||||
|
return "sync-alt";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{this.renderModal()}
|
{this.renderModal()}
|
||||||
<Button
|
<Button
|
||||||
color="primary"
|
color="primary"
|
||||||
|
reducedMobile={true}
|
||||||
|
icon={this.renderIcon()}
|
||||||
label={this.renderLabel()}
|
label={this.renderLabel()}
|
||||||
action={this.toggleModal}
|
action={this.toggleModal}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -113,34 +113,47 @@ class PluginsOverview extends React.Component<Props> {
|
|||||||
|
|
||||||
createActions = () => {
|
createActions = () => {
|
||||||
const { pendingPlugins, collection } = this.props;
|
const { pendingPlugins, collection } = this.props;
|
||||||
return (
|
const buttons = [];
|
||||||
<ButtonGroup>
|
|
||||||
{pendingPlugins &&
|
if (
|
||||||
|
pendingPlugins &&
|
||||||
pendingPlugins._links &&
|
pendingPlugins._links &&
|
||||||
pendingPlugins._links.execute && (
|
pendingPlugins._links.execute
|
||||||
|
) {
|
||||||
|
buttons.push(
|
||||||
<MultiPluginAction
|
<MultiPluginAction
|
||||||
pendingPlugins={pendingPlugins}
|
pendingPlugins={pendingPlugins}
|
||||||
actionType={MultiPluginActionType.EXECUTE_PENDING}
|
actionType={MultiPluginActionType.EXECUTE_PENDING}
|
||||||
/>
|
/>
|
||||||
)}
|
);
|
||||||
{pendingPlugins &&
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
pendingPlugins &&
|
||||||
pendingPlugins._links &&
|
pendingPlugins._links &&
|
||||||
pendingPlugins._links.cancel && (
|
pendingPlugins._links.cancel
|
||||||
|
) {
|
||||||
|
buttons.push(
|
||||||
<MultiPluginAction
|
<MultiPluginAction
|
||||||
pendingPlugins={pendingPlugins}
|
pendingPlugins={pendingPlugins}
|
||||||
actionType={MultiPluginActionType.CANCEL_PENDING}
|
actionType={MultiPluginActionType.CANCEL_PENDING}
|
||||||
/>
|
/>
|
||||||
)}
|
);
|
||||||
{collection &&
|
}
|
||||||
collection._links &&
|
|
||||||
collection._links.update && (
|
if (collection && collection._links && collection._links.update) {
|
||||||
|
buttons.push(
|
||||||
<MultiPluginAction
|
<MultiPluginAction
|
||||||
installedPlugins={collection}
|
installedPlugins={collection}
|
||||||
actionType={MultiPluginActionType.UPDATE_ALL}
|
actionType={MultiPluginActionType.UPDATE_ALL}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</ButtonGroup>
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buttons.length > 0) {
|
||||||
|
return <ButtonGroup>{buttons}</ButtonGroup>;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class InstalledPluginResource {
|
|||||||
@ResponseCode(code = 500, condition = "internal server error")
|
@ResponseCode(code = 500, condition = "internal server error")
|
||||||
})
|
})
|
||||||
@TypeHint(CollectionDto.class)
|
@TypeHint(CollectionDto.class)
|
||||||
public Response updateAll(@QueryParam("restart") boolean restartAfterInstallation) {
|
public Response updateAll() {
|
||||||
pluginManager.updateAll();
|
pluginManager.updateAll();
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user