mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
|
|
// @flow
|
||
|
|
|
||
|
|
import React from "react";
|
||
|
|
import MultiPluginActionModal from "./MultiPluginActionModal";
|
||
|
|
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 <MultiPluginActionModal
|
||
|
|
description={t("plugins.modal.updateAll")} label={t("plugins.updateAll")}
|
||
|
|
onClose={onClose} installedPlugins={installedPlugins} execute={this.updateAll}>
|
||
|
|
</MultiPluginActionModal>;
|
||
|
|
}
|
||
|
|
|
||
|
|
updateAll = () => {
|
||
|
|
const { installedPlugins, refresh, onClose } = this.props;
|
||
|
|
return apiClient
|
||
|
|
.post(installedPlugins._links.update.href)
|
||
|
|
.then(refresh)
|
||
|
|
.then(onClose);
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
export default translate("admin")(UpdateAllActionModal);
|