mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-13 19:22:47 +02:00
Replace hard reload with refresh
This commit is contained in:
@@ -15,6 +15,7 @@ type Props = {
|
||||
actionType: string,
|
||||
pendingPlugins?: PendingPlugins,
|
||||
installedPlugins?: PluginCollection,
|
||||
refresh: () => void,
|
||||
|
||||
// context props
|
||||
t: (key: string, params?: Object) => string
|
||||
@@ -57,7 +58,7 @@ class MultiPluginAction extends React.Component<Props, State> {
|
||||
|
||||
renderModal = () => {
|
||||
const { showModal } = this.state;
|
||||
const { pendingPlugins, installedPlugins, actionType } = this.props;
|
||||
const { pendingPlugins, installedPlugins, actionType, refresh } = this.props;
|
||||
if (showModal) {
|
||||
return (
|
||||
<MultiPluginActionModal
|
||||
@@ -72,6 +73,7 @@ class MultiPluginAction extends React.Component<Props, State> {
|
||||
: installedPlugins
|
||||
}
|
||||
onClose={this.toggleModal}
|
||||
refresh={refresh}
|
||||
actionType={actionType}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -19,6 +19,7 @@ type Props = {
|
||||
actionType: string,
|
||||
pendingPlugins?: PendingPlugins,
|
||||
installedPlugins?: PluginCollection,
|
||||
refresh: () => void,
|
||||
|
||||
// context props
|
||||
t: string => string
|
||||
@@ -99,7 +100,7 @@ class MultiPluginActionModal extends React.Component<Props, State> {
|
||||
|
||||
apiClient
|
||||
.post(pendingPlugins._links.cancel.href)
|
||||
.then(() => this.reload())
|
||||
.then(() => this.refresh())
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
success: false,
|
||||
@@ -117,18 +118,19 @@ class MultiPluginActionModal extends React.Component<Props, State> {
|
||||
|
||||
apiClient
|
||||
.post(installedPlugins._links.update.href)
|
||||
.then(() => this.reload());
|
||||
.then(() => this.refresh());
|
||||
};
|
||||
|
||||
reload = () => {
|
||||
window.location.reload(true);
|
||||
refresh = () => {
|
||||
this.props.refresh();
|
||||
this.props.onClose();
|
||||
};
|
||||
|
||||
renderModalContent = () => {
|
||||
const { actionType } = this.props;
|
||||
|
||||
if (actionType === MultiPluginActionType.UPDATE_ALL) {
|
||||
return <>{this.renderUpdatable()}</>;
|
||||
return this.renderUpdatable();
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -124,6 +124,7 @@ class PluginsOverview extends React.Component<Props> {
|
||||
<MultiPluginAction
|
||||
key={MultiPluginActionType.EXECUTE_PENDING}
|
||||
pendingPlugins={pendingPlugins}
|
||||
refresh={this.fetchPlugins}
|
||||
actionType={MultiPluginActionType.EXECUTE_PENDING}
|
||||
/>
|
||||
);
|
||||
@@ -138,6 +139,7 @@ class PluginsOverview extends React.Component<Props> {
|
||||
<MultiPluginAction
|
||||
key={MultiPluginActionType.CANCEL_PENDING}
|
||||
pendingPlugins={pendingPlugins}
|
||||
refresh={this.fetchPlugins}
|
||||
actionType={MultiPluginActionType.CANCEL_PENDING}
|
||||
/>
|
||||
);
|
||||
@@ -148,6 +150,7 @@ class PluginsOverview extends React.Component<Props> {
|
||||
<MultiPluginAction
|
||||
key={MultiPluginActionType.UPDATE_ALL}
|
||||
installedPlugins={collection}
|
||||
refresh={this.fetchPlugins}
|
||||
actionType={MultiPluginActionType.UPDATE_ALL}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user