Merge "Use a utility function for reloading the window"
This commit is contained in:
		@@ -55,6 +55,7 @@ import {
 | 
				
			|||||||
} from '../../../utils/attention-set-util';
 | 
					} from '../../../utils/attention-set-util';
 | 
				
			||||||
import {CustomKeyboardEvent} from '../../../types/events';
 | 
					import {CustomKeyboardEvent} from '../../../types/events';
 | 
				
			||||||
import {fireEvent} from '../../../utils/event-util';
 | 
					import {fireEvent} from '../../../utils/event-util';
 | 
				
			||||||
 | 
					import {windowLocationReload} from '../../../utils/dom-util';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const NUMBER_FIXED_COLUMNS = 3;
 | 
					const NUMBER_FIXED_COLUMNS = 3;
 | 
				
			||||||
const CLOSED_STATUS = ['MERGED', 'ABANDONED'];
 | 
					const CLOSED_STATUS = ['MERGED', 'ABANDONED'];
 | 
				
			||||||
@@ -478,7 +479,7 @@ export class GrChangeList extends ChangeTableMixin(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _reloadWindow() {
 | 
					  _reloadWindow() {
 | 
				
			||||||
    window.location.reload();
 | 
					    windowLocationReload();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _toggleChangeStar(e: CustomKeyboardEvent) {
 | 
					  _toggleChangeStar(e: CustomKeyboardEvent) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,7 +55,10 @@ import {
 | 
				
			|||||||
} from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin';
 | 
					} from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin';
 | 
				
			||||||
import {GrEditConstants} from '../../edit/gr-edit-constants';
 | 
					import {GrEditConstants} from '../../edit/gr-edit-constants';
 | 
				
			||||||
import {pluralize} from '../../../utils/string-util';
 | 
					import {pluralize} from '../../../utils/string-util';
 | 
				
			||||||
import {getComputedStyleValue} from '../../../utils/dom-util';
 | 
					import {
 | 
				
			||||||
 | 
					  getComputedStyleValue,
 | 
				
			||||||
 | 
					  windowLocationReload,
 | 
				
			||||||
 | 
					} from '../../../utils/dom-util';
 | 
				
			||||||
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
 | 
					import {GerritNav} from '../../core/gr-navigation/gr-navigation';
 | 
				
			||||||
import {getPluginEndpoints} from '../../shared/gr-js-api-interface/gr-plugin-endpoints';
 | 
					import {getPluginEndpoints} from '../../shared/gr-js-api-interface/gr-plugin-endpoints';
 | 
				
			||||||
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
 | 
					import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
 | 
				
			||||||
@@ -896,7 +899,7 @@ export class GrChangeView extends KeyboardShortcutMixin(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _reloadWindow() {
 | 
					  _reloadWindow() {
 | 
				
			||||||
    window.location.reload();
 | 
					    windowLocationReload();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _handleCommitMessageCancel() {
 | 
					  _handleCommitMessageCancel() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,6 +38,7 @@ import {
 | 
				
			|||||||
  ServerErrorEvent,
 | 
					  ServerErrorEvent,
 | 
				
			||||||
  ShowAlertEvent,
 | 
					  ShowAlertEvent,
 | 
				
			||||||
} from '../../../types/events';
 | 
					} from '../../../types/events';
 | 
				
			||||||
 | 
					import {windowLocationReload} from '../../../utils/dom-util';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const HIDE_ALERT_TIMEOUT_MS = 5000;
 | 
					const HIDE_ALERT_TIMEOUT_MS = 5000;
 | 
				
			||||||
const CHECK_SIGN_IN_INTERVAL_MS = 60 * 1000;
 | 
					const CHECK_SIGN_IN_INTERVAL_MS = 60 * 1000;
 | 
				
			||||||
@@ -446,7 +447,7 @@ export class GrErrorManager extends GestureEventListeners(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _reloadPage() {
 | 
					  _reloadPage() {
 | 
				
			||||||
    window.location.reload();
 | 
					    windowLocationReload();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  _createLoginPopup() {
 | 
					  _createLoginPopup() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,6 +67,7 @@ import {LocationChangeEventDetail} from '../../../types/events';
 | 
				
			|||||||
import {GerritView, updateState} from '../../../services/router/router-model';
 | 
					import {GerritView, updateState} from '../../../services/router/router-model';
 | 
				
			||||||
import {firePageError} from '../../../utils/event-util';
 | 
					import {firePageError} from '../../../utils/event-util';
 | 
				
			||||||
import {addQuotesWhen} from '../../../utils/string-util';
 | 
					import {addQuotesWhen} from '../../../utils/string-util';
 | 
				
			||||||
 | 
					import {windowLocationReload} from '../../../utils/dom-util';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const RoutePattern = {
 | 
					const RoutePattern = {
 | 
				
			||||||
  ROOT: '/',
 | 
					  ROOT: '/',
 | 
				
			||||||
@@ -1725,7 +1726,7 @@ export class GrRouter extends GestureEventListeners(
 | 
				
			|||||||
   * by the catchall _handleDefaultRoute handler.
 | 
					   * by the catchall _handleDefaultRoute handler.
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  _handlePassThroughRoute() {
 | 
					  _handlePassThroughRoute() {
 | 
				
			||||||
    location.reload();
 | 
					    windowLocationReload();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
@@ -1762,7 +1763,7 @@ export class GrRouter extends GestureEventListeners(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  _handleDocumentationRedirectRoute(data: PageContextWithQueryMap) {
 | 
					  _handleDocumentationRedirectRoute(data: PageContextWithQueryMap) {
 | 
				
			||||||
    if (data.params[1]) {
 | 
					    if (data.params[1]) {
 | 
				
			||||||
      location.reload();
 | 
					      windowLocationReload();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      // Redirect /Documentation to /Documentation/index.html
 | 
					      // Redirect /Documentation to /Documentation/index.html
 | 
				
			||||||
      this._redirect('/Documentation/index.html');
 | 
					      this._redirect('/Documentation/index.html');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,6 +79,7 @@ import {
 | 
				
			|||||||
import {ViewState} from '../types/types';
 | 
					import {ViewState} from '../types/types';
 | 
				
			||||||
import {EventType} from '../utils/event-util';
 | 
					import {EventType} from '../utils/event-util';
 | 
				
			||||||
import {GerritView} from '../services/router/router-model';
 | 
					import {GerritView} from '../services/router/router-model';
 | 
				
			||||||
 | 
					import {windowLocationReload} from '../utils/dom-util';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface ErrorInfo {
 | 
					interface ErrorInfo {
 | 
				
			||||||
  text: string;
 | 
					  text: string;
 | 
				
			||||||
@@ -241,7 +242,7 @@ export class GrAppElement extends KeyboardShortcutMixin(
 | 
				
			|||||||
    // Ideally individual views should handle this event and respond with a soft
 | 
					    // Ideally individual views should handle this event and respond with a soft
 | 
				
			||||||
    // reload. This is a catch-all for all views that cannot or have not
 | 
					    // reload. This is a catch-all for all views that cannot or have not
 | 
				
			||||||
    // implemented that.
 | 
					    // implemented that.
 | 
				
			||||||
    this.addEventListener('reload', () => window.location.reload());
 | 
					    this.addEventListener('reload', () => windowLocationReload());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /** @override */
 | 
					  /** @override */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ import {RevisionInfo, ChangeInfo, RequestPayload} from '../../../types/common';
 | 
				
			|||||||
import {ShowAlertEventDetail} from '../../../types/events';
 | 
					import {ShowAlertEventDetail} from '../../../types/events';
 | 
				
			||||||
import {PluginApi} from '../../plugins/gr-plugin-types';
 | 
					import {PluginApi} from '../../plugins/gr-plugin-types';
 | 
				
			||||||
import {UIActionInfo} from './gr-change-actions-js-api';
 | 
					import {UIActionInfo} from './gr-change-actions-js-api';
 | 
				
			||||||
 | 
					import {windowLocationReload} from '../../../utils/dom-util';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface GrPopupInterface {
 | 
					interface GrPopupInterface {
 | 
				
			||||||
  close(): void;
 | 
					  close(): void;
 | 
				
			||||||
@@ -57,7 +58,7 @@ export class GrPluginActionContext {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  refresh() {
 | 
					  refresh() {
 | 
				
			||||||
    window.location.reload();
 | 
					    windowLocationReload();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  textfield(): HTMLElement {
 | 
					  textfield(): HTMLElement {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -153,6 +153,12 @@ export function querySelectorAll(
 | 
				
			|||||||
  return [...results];
 | 
					  return [...results];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function windowLocationReload() {
 | 
				
			||||||
 | 
					  const e = new Error();
 | 
				
			||||||
 | 
					  console.info(`Calling window.location.realod(): ${e.stack}`);
 | 
				
			||||||
 | 
					  window.location.reload();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Retrieves the dom path of the current event.
 | 
					 * Retrieves the dom path of the current event.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user