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