Replace hard reload with refresh

This commit is contained in:
Rene Pfeuffer
2019-10-01 10:27:06 +02:00
parent 92af956c5e
commit e6d32a1468
3 changed files with 13 additions and 6 deletions

View File

@@ -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}
/>
);

View File

@@ -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 (
<>

View File

@@ -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}
/>
);