mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
Merge with 2.0.0-m3
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import type { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void,
|
||||
refresh: () => void,
|
||||
pendingPlugins: PendingPlugins,
|
||||
|
||||
// context props
|
||||
t: string => string
|
||||
};
|
||||
|
||||
class CancelPendingActionModal extends React.Component<Props> {
|
||||
render() {
|
||||
const { onClose, pendingPlugins, t } = this.props;
|
||||
|
||||
return (
|
||||
<PluginActionModal
|
||||
description={t("plugins.modal.cancelPending")}
|
||||
label={t("plugins.cancelPending")}
|
||||
onClose={onClose}
|
||||
pendingPlugins={pendingPlugins}
|
||||
execute={this.cancelPending}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
cancelPending = () => {
|
||||
const { pendingPlugins, refresh, onClose } = this.props;
|
||||
return apiClient
|
||||
.post(pendingPlugins._links.cancel.href)
|
||||
.then(refresh)
|
||||
.then(onClose);
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("admin")(CancelPendingActionModal);
|
||||
@@ -0,0 +1,45 @@
|
||||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import type { PendingPlugins } from "@scm-manager/ui-types";
|
||||
import waitForRestart from "./waitForRestart";
|
||||
import { apiClient, Notification } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void,
|
||||
pendingPlugins: PendingPlugins,
|
||||
|
||||
// context props
|
||||
t: string => string
|
||||
};
|
||||
|
||||
class ExecutePendingActionModal extends React.Component<Props> {
|
||||
render() {
|
||||
const { onClose, pendingPlugins, t } = this.props;
|
||||
|
||||
return (
|
||||
<PluginActionModal
|
||||
description={t("plugins.modal.executePending")}
|
||||
label={t("plugins.modal.executeAndRestart")}
|
||||
onClose={onClose}
|
||||
pendingPlugins={pendingPlugins}
|
||||
execute={this.executeAndRestart}
|
||||
>
|
||||
<Notification type="warning">
|
||||
{t("plugins.modal.restartNotification")}
|
||||
</Notification>
|
||||
</PluginActionModal>
|
||||
);
|
||||
}
|
||||
|
||||
executeAndRestart = () => {
|
||||
const { pendingPlugins } = this.props;
|
||||
return apiClient
|
||||
.post(pendingPlugins._links.execute.href)
|
||||
.then(waitForRestart);
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("admin")(ExecutePendingActionModal);
|
||||
@@ -114,6 +114,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
success: false,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import PluginActionModal from "./PluginActionModal";
|
||||
import type { PluginCollection } from "@scm-manager/ui-types";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
onClose: () => void,
|
||||
refresh: () => void,
|
||||
installedPlugins: PluginCollection,
|
||||
|
||||
// context props
|
||||
t: string => string
|
||||
};
|
||||
|
||||
class UpdateAllActionModal extends React.Component<Props> {
|
||||
render() {
|
||||
const { onClose, installedPlugins, t } = this.props;
|
||||
|
||||
return (
|
||||
<PluginActionModal
|
||||
description={t("plugins.modal.updateAll")}
|
||||
label={t("plugins.updateAll")}
|
||||
onClose={onClose}
|
||||
installedPlugins={installedPlugins}
|
||||
execute={this.updateAll}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
updateAll = () => {
|
||||
const { installedPlugins, refresh, onClose } = this.props;
|
||||
return apiClient
|
||||
.post(installedPlugins._links.update.href)
|
||||
.then(refresh)
|
||||
.then(onClose);
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("admin")(UpdateAllActionModal);
|
||||
Reference in New Issue
Block a user