Avoid using underscores for private properties
TS Lint guide recommends avoiding use of underscore with private
properties
Change-Id: I2abacd23f31b1e1529f640fcdb495ff87782eaba
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts
index bd2781f..5305cea 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts
@@ -99,7 +99,7 @@
return htmlTemplate;
}
- private _account?: AccountDetailInfo;
+ private account?: AccountDetailInfo;
@property({type: Object})
params?: AdminViewParams;
@@ -189,7 +189,7 @@
getPluginLoader().awaitPluginsLoaded(),
];
return Promise.all(promises).then(result => {
- this._account = result[0];
+ this.account = result[0];
let options: AdminNavLinksOption | undefined = undefined;
if (this._repoName) {
options = {repoName: this._repoName};
@@ -204,7 +204,7 @@
}
return getAdminLinks(
- this._account,
+ this.account,
() =>
this.restApiService.getAccountCapabilities().then(capabilities => {
if (!capabilities) {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
index 26ff799..56c5733 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
@@ -118,7 +118,7 @@
@property({type: Boolean})
_loading = true;
- private _originalInheritsFrom?: ProjectInfo | null;
+ private originalInheritsFrom?: ProjectInfo | null;
private readonly restApiService = appContext.restApiService;
@@ -173,7 +173,7 @@
...res.inherits_from,
}
: null;
- this._originalInheritsFrom = res.inherits_from
+ this.originalInheritsFrom = res.inherits_from
? {
...res.inherits_from,
}
@@ -306,7 +306,7 @@
}
// Restore inheritFrom.
if (this._inheritsFrom) {
- this._inheritsFrom = {...this._originalInheritsFrom};
+ this._inheritsFrom = {...this.originalInheritsFrom};
this._inheritFromFilter =
'name' in this._inheritsFrom ? this._inheritsFrom.name : undefined;
}
@@ -446,8 +446,8 @@
remove: {},
};
- const originalInheritsFromId = this._originalInheritsFrom
- ? singleDecodeURL(this._originalInheritsFrom.id)
+ const originalInheritsFromId = this.originalInheritsFrom
+ ? singleDecodeURL(this.originalInheritsFrom.id)
: null;
// TODO(TS): this._inheritsFrom as ProjectInfo might be a mistake.
// _inheritsFrom can be {}
diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
index 19f43c2..b60a585 100644
--- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
+++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
@@ -611,7 +611,7 @@
private readonly flagsService = appContext.flagsService;
- private _isPortingCommentsExperimentEnabled = false;
+ private isPortingCommentsExperimentEnabled = false;
/** @override */
created() {
@@ -620,7 +620,7 @@
constructor() {
super();
- this._isPortingCommentsExperimentEnabled = this.flagsService.isEnabled(
+ this.isPortingCommentsExperimentEnabled = this.flagsService.isEnabled(
KnownExperimentId.PORTING_COMMENTS
);
}
@@ -636,10 +636,10 @@
this.restApiService.getDiffComments(changeNum),
this.restApiService.getDiffRobotComments(changeNum),
this.restApiService.getDiffDrafts(changeNum),
- this._isPortingCommentsExperimentEnabled
+ this.isPortingCommentsExperimentEnabled
? this.restApiService.getPortedComments(changeNum, revision)
: Promise.resolve({}),
- this._isPortingCommentsExperimentEnabled
+ this.isPortingCommentsExperimentEnabled
? this.restApiService.getPortedDrafts(changeNum, revision)
: Promise.resolve({}),
];
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
index da1b928..829038b 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
@@ -80,7 +80,7 @@
readonly groups: GrDiffGroup[];
- private _blameInfo: BlameInfo[] | null;
+ private blameInfo: BlameInfo[] | null;
private readonly _layerUpdateListener: (
start: LineNumber,
@@ -104,7 +104,7 @@
this._prefs = prefs;
this._outputEl = outputEl;
this.groups = [];
- this._blameInfo = null;
+ this.blameInfo = null;
if (isNaN(prefs.tab_size) || prefs.tab_size <= 0) {
throw Error('Invalid tab size from preferences.');
@@ -765,7 +765,7 @@
* re-render its blame cell content.
*/
setBlame(blame: BlameInfo[] | null) {
- this._blameInfo = blame;
+ this.blameInfo = blame;
if (!blame) return;
// TODO(wyatta): make this loop asynchronous.
@@ -890,11 +890,11 @@
* @return The commit information.
*/
_getBlameCommitForBaseLine(lineNum: LineNumber) {
- if (!this._blameInfo) {
+ if (!this.blameInfo) {
return null;
}
- for (const blameCommit of this._blameInfo) {
+ for (const blameCommit of this.blameInfo) {
for (const range of blameCommit.ranges) {
if (range.start <= lineNum && range.end >= lineNum) {
return blameCommit;
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts
index 5ac37dc..cc3be07 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts
@@ -61,7 +61,7 @@
return htmlTemplate;
}
- private _preventAutoScrollOnManualScroll = false;
+ private preventAutoScrollOnManualScroll = false;
private lastDisplayedNavigateToNextFileToast: number | null = null;
@@ -338,10 +338,10 @@
}
private _boundHandleWindowScroll = () => {
- if (this._preventAutoScrollOnManualScroll) {
+ if (this.preventAutoScrollOnManualScroll) {
this._scrollMode = ScrollMode.NEVER;
this._focusOnMove = false;
- this._preventAutoScrollOnManualScroll = false;
+ this.preventAutoScrollOnManualScroll = false;
}
};
@@ -360,14 +360,14 @@
};
private _boundHandleDiffRenderStart = () => {
- this._preventAutoScrollOnManualScroll = true;
+ this.preventAutoScrollOnManualScroll = true;
};
private _boundHandleDiffRenderContent = () => {
this._updateStops();
// When done rendering, turn focus on move and automatic scrolling back on
this._focusOnMove = true;
- this._preventAutoScrollOnManualScroll = false;
+ this.preventAutoScrollOnManualScroll = false;
};
private _boundHandleDiffLineSelected = (event: Event) => {
diff --git a/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.ts b/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.ts
index 3a61bce..a03c5dc 100644
--- a/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.ts
@@ -19,24 +19,24 @@
import {HookApi} from '../../../api/hook';
export class GrChangeMetadataApi implements ChangeMetadataPluginApi {
- private _hook: HookApi | null;
+ private hook: HookApi | null;
public plugin: PluginApi;
constructor(plugin: PluginApi) {
this.plugin = plugin;
- this._hook = null;
+ this.hook = null;
}
_createHook() {
- this._hook = this.plugin.hook('change-metadata-item');
+ this.hook = this.plugin.hook('change-metadata-item');
}
onLabelsChanged(callback: (value: unknown) => void) {
- if (!this._hook) {
+ if (!this.hook) {
this._createHook();
}
- this._hook!.onAttached((element: Element) =>
+ this.hook!.onAttached((element: Element) =>
this.plugin.attributeHelper(element).bind('labels', callback)
);
return this;
diff --git a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts
index d2568ad..3e8f0a4 100644
--- a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts
@@ -19,13 +19,13 @@
import {HookApi, HookCallback} from '../../../api/hook';
export class GrDomHooksManager {
- private _hooks: Record<string, GrDomHook>;
+ private hooks: Record<string, GrDomHook>;
- private _plugin: PluginApi;
+ private plugin: PluginApi;
constructor(plugin: PluginApi) {
- this._plugin = plugin;
- this._hooks = {};
+ this.plugin = plugin;
+ this.hooks = {};
}
_getHookName(endpointName: string, moduleName?: string) {
@@ -36,37 +36,36 @@
// TODO: this still can not prevent if plugin has invalid char
// other than uppercase, but is the first step
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
- const pluginName: string =
- this._plugin.getPluginName() || 'unknown_plugin';
+ const pluginName: string = this.plugin.getPluginName() || 'unknownplugin';
return pluginName.toLowerCase() + '-autogenerated-' + endpointName;
}
}
getDomHook(endpointName: string, moduleName?: string) {
const hookName = this._getHookName(endpointName, moduleName);
- if (!this._hooks[hookName]) {
- this._hooks[hookName] = new GrDomHook(hookName, moduleName);
+ if (!this.hooks[hookName]) {
+ this.hooks[hookName] = new GrDomHook(hookName, moduleName);
}
- return this._hooks[hookName];
+ return this.hooks[hookName];
}
}
export class GrDomHook implements HookApi {
- private _instances: HTMLElement[] = [];
+ private instances: HTMLElement[] = [];
- private _attachCallbacks: HookCallback[] = [];
+ private attachCallbacks: HookCallback[] = [];
- private _detachCallbacks: HookCallback[] = [];
+ private detachCallbacks: HookCallback[] = [];
- private _moduleName: string;
+ private moduleName: string;
- private _lastAttachedPromise: Promise<HTMLElement> | null = null;
+ private lastAttachedPromise: Promise<HTMLElement> | null = null;
constructor(hookName: string, moduleName?: string) {
if (moduleName) {
- this._moduleName = moduleName;
+ this.moduleName = moduleName;
} else {
- this._moduleName = hookName;
+ this.moduleName = hookName;
this._createPlaceholder(hookName);
}
}
@@ -89,16 +88,16 @@
}
handleInstanceDetached(instance: HTMLElement) {
- const index = this._instances.indexOf(instance);
+ const index = this.instances.indexOf(instance);
if (index !== -1) {
- this._instances.splice(index, 1);
+ this.instances.splice(index, 1);
}
- this._detachCallbacks.forEach(callback => callback(instance));
+ this.detachCallbacks.forEach(callback => callback(instance));
}
handleInstanceAttached(instance: HTMLElement) {
- this._instances.push(instance);
- this._attachCallbacks.forEach(callback => callback(instance));
+ this.instances.push(instance);
+ this.attachCallbacks.forEach(callback => callback(instance));
}
/**
@@ -106,32 +105,32 @@
* Returns a Promise, that's resolved when attachment is done.
*/
getLastAttached(): Promise<HTMLElement> {
- if (this._instances.length) {
- return Promise.resolve(this._instances.slice(-1)[0]);
+ if (this.instances.length) {
+ return Promise.resolve(this.instances.slice(-1)[0]);
}
- if (!this._lastAttachedPromise) {
+ if (!this.lastAttachedPromise) {
let resolve: HookCallback;
const promise = new Promise<HTMLElement>(r => {
resolve = r;
- this._attachCallbacks.push(resolve);
+ this.attachCallbacks.push(resolve);
});
- this._lastAttachedPromise = promise.then((element: HTMLElement) => {
- this._lastAttachedPromise = null;
- const index = this._attachCallbacks.indexOf(resolve);
+ this.lastAttachedPromise = promise.then((element: HTMLElement) => {
+ this.lastAttachedPromise = null;
+ const index = this.attachCallbacks.indexOf(resolve);
if (index !== -1) {
- this._attachCallbacks.splice(index, 1);
+ this.attachCallbacks.splice(index, 1);
}
return element;
});
}
- return this._lastAttachedPromise;
+ return this.lastAttachedPromise;
}
/**
* Get all DOM hook elements.
*/
getAllAttached() {
- return this._instances;
+ return this.instances;
}
/**
@@ -139,7 +138,7 @@
* is attached.
*/
onAttached(callback: HookCallback) {
- this._attachCallbacks.push(callback);
+ this.attachCallbacks.push(callback);
return this;
}
@@ -149,7 +148,7 @@
*
*/
onDetached(callback: HookCallback) {
- this._detachCallbacks.push(callback);
+ this.detachCallbacks.push(callback);
return this;
}
@@ -157,6 +156,6 @@
* Name of DOM hook element that will be installed into the endpoint.
*/
getModuleName() {
- return this._moduleName;
+ return this.moduleName;
}
}
diff --git a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks_test.js b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks_test.js
index 49223b9..883f2a6 100644
--- a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks_test.js
+++ b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks_test.js
@@ -45,7 +45,7 @@
});
test('getModuleName()', () => {
- const hookName = Object.keys(instance._hooks).pop();
+ const hookName = Object.keys(instance.hooks).pop();
assert.equal(hookName, 'testplugin-autogenerated-foo-bar');
assert.equal(hook.getModuleName(), 'testplugin-autogenerated-foo-bar');
});
@@ -57,7 +57,7 @@
});
test('getModuleName()', () => {
- const hookName = Object.keys(instance._hooks).pop();
+ const hookName = Object.keys(instance.hooks).pop();
assert.equal(hookName, 'foo-bar my-el');
assert.equal(hook.getModuleName(), 'my-el');
});
diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts
index 07d11ec..dcabc80 100644
--- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts
@@ -27,23 +27,23 @@
/**
* Plugin popup API.
* Provides method for opening and closing popups from plugin.
- * opt_moduleName is a name of custom element that will be automatically
+ * optmoduleName is a name of custom element that will be automatically
* inserted on popup opening.
*/
export class GrPopupInterface implements PopupPluginApi {
- private _openingPromise: Promise<GrPopupInterface> | null = null;
+ private openingPromise: Promise<GrPopupInterface> | null = null;
- private _popup: GrPluginPopup | null = null;
+ private popup: GrPluginPopup | null = null;
constructor(
readonly plugin: PluginApi,
- private _moduleName: string | null = null
+ private moduleName: string | null = null
) {}
_getElement() {
// TODO(TS): maybe consider removing this if no one is using
// anything other than native methods on the return
- return (dom(this._popup) as unknown) as HTMLElement;
+ return (dom(this.popup) as unknown) as HTMLElement;
}
/**
@@ -52,34 +52,34 @@
* if it was provided with constructor.
*/
open(): Promise<PopupPluginApi> {
- if (!this._openingPromise) {
- this._openingPromise = this.plugin
+ if (!this.openingPromise) {
+ this.openingPromise = this.plugin
.hook('plugin-overlay')
.getLastAttached()
.then(hookEl => {
const popup = document.createElement('gr-plugin-popup');
- if (this._moduleName) {
+ if (this.moduleName) {
const el = popup.appendChild(
- document.createElement(this._moduleName) as CustomPolymerPluginEl
+ document.createElement(this.moduleName) as CustomPolymerPluginEl
);
el.plugin = this.plugin;
}
- this._popup = hookEl.appendChild(popup);
+ this.popup = hookEl.appendChild(popup);
flush();
- return this._popup.open().then(() => this);
+ return this.popup.open().then(() => this);
});
}
- return this._openingPromise;
+ return this.openingPromise;
}
/**
* Hides the popup.
*/
close() {
- if (!this._popup) {
+ if (!this.popup) {
return;
}
- this._popup.close();
- this._openingPromise = null;
+ this.popup.close();
+ this.openingPromise = null;
}
}
diff --git a/polygerrit-ui/app/elements/plugins/gr-repo-api/gr-repo-api.ts b/polygerrit-ui/app/elements/plugins/gr-repo-api/gr-repo-api.ts
index e42ca08..0418edb 100644
--- a/polygerrit-ui/app/elements/plugins/gr-repo-api/gr-repo-api.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-repo-api/gr-repo-api.ts
@@ -29,7 +29,7 @@
}
export class GrRepoApi implements RepoPluginApi {
- private _hook?: HookApi;
+ private hook?: HookApi;
constructor(readonly plugin: PluginApi) {}
@@ -43,12 +43,12 @@
}
createCommand(title: string, callback: RepoCommandCallback) {
- if (this._hook) {
+ if (this.hook) {
console.warn('Already set up.');
return this;
}
- this._hook = this._createHook(title);
- this._hook.onAttached(element => {
+ this.hook = this._createHook(title);
+ this.hook.onAttached(element => {
if (callback(element.repoName, element.config) === false) {
element.hidden = true;
}
@@ -57,11 +57,11 @@
}
onTap(callback: (event: Event) => boolean) {
- if (!this._hook) {
+ if (!this.hook) {
console.warn('Call createCommand first.');
return this;
}
- this._hook.onAttached(element => {
+ this.hook.onAttached(element => {
this.plugin.eventHelper(element).on('command-tap', callback);
});
return this;
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts
index e67e1f6..b8f0161 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts
@@ -110,13 +110,13 @@
@property({type: String})
containerId = 'gr-hovercard-container';
- private _hideDebouncer: Debouncer | null = null;
+ private hideDebouncer: Debouncer | null = null;
- private _showDebouncer: Debouncer | null = null;
+ private showDebouncer: Debouncer | null = null;
- private _isScheduledToShow?: boolean;
+ private isScheduledToShow?: boolean;
- private _isScheduledToHide?: boolean;
+ private isScheduledToHide?: boolean;
/** @override */
attached() {
@@ -174,24 +174,24 @@
debounceHide() {
this.cancelShowDebouncer();
- if (!this._isShowing || this._isScheduledToHide) return;
- this._isScheduledToHide = true;
- this._hideDebouncer = Debouncer.debounce(
- this._hideDebouncer,
+ if (!this._isShowing || this.isScheduledToHide) return;
+ this.isScheduledToHide = true;
+ this.hideDebouncer = Debouncer.debounce(
+ this.hideDebouncer,
timeOut.after(HIDE_DELAY_MS),
() => {
// This happens when hide immediately through click or mouse leave
// on the hovercard
- if (!this._isScheduledToHide) return;
+ if (!this.isScheduledToHide) return;
this.hide();
}
);
}
cancelHideDebouncer() {
- if (this._hideDebouncer) {
- this._hideDebouncer.cancel();
- this._isScheduledToHide = false;
+ if (this.hideDebouncer) {
+ this.hideDebouncer.cancel();
+ this.isScheduledToHide = false;
}
}
@@ -305,23 +305,23 @@
*/
debounceShowBy(delayMs: number) {
this.cancelHideDebouncer();
- if (this._isShowing || this._isScheduledToShow) return;
- this._isScheduledToShow = true;
- this._showDebouncer = Debouncer.debounce(
- this._showDebouncer,
+ if (this._isShowing || this.isScheduledToShow) return;
+ this.isScheduledToShow = true;
+ this.showDebouncer = Debouncer.debounce(
+ this.showDebouncer,
timeOut.after(delayMs),
() => {
// This happens when the mouse leaves the target before the delay is over.
- if (!this._isScheduledToShow) return;
+ if (!this.isScheduledToShow) return;
this.show();
}
);
}
cancelShowDebouncer() {
- if (this._showDebouncer) {
- this._showDebouncer.cancel();
- this._isScheduledToShow = false;
+ if (this.showDebouncer) {
+ this.showDebouncer.cancel();
+ this.isScheduledToShow = false;
}
}
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard_test.js b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard_test.js
index 6b2e620..628b1e9 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard_test.js
@@ -120,18 +120,18 @@
button.dispatchEvent(new CustomEvent('mouseenter'));
await enterPromise;
- assert.isTrue(element._isScheduledToShow);
- element._showDebouncer.flush();
+ assert.isTrue(element.isScheduledToShow);
+ element.showDebouncer.flush();
assert.isTrue(element._isShowing);
- assert.isFalse(element._isScheduledToShow);
+ assert.isFalse(element.isScheduledToShow);
button.dispatchEvent(new CustomEvent('mouseleave'));
await leavePromise;
- assert.isTrue(element._isScheduledToHide);
+ assert.isTrue(element.isScheduledToHide);
assert.isTrue(element._isShowing);
- element._hideDebouncer.flush();
- assert.isFalse(element._isScheduledToShow);
+ element.hideDebouncer.flush();
+ assert.isFalse(element.isScheduledToShow);
assert.isFalse(element._isShowing);
button.removeEventListener('mouseenter', enterResolve);
@@ -152,11 +152,11 @@
button.dispatchEvent(new CustomEvent('mouseenter'));
await enterPromise;
- assert.isTrue(element._isScheduledToShow);
+ assert.isTrue(element.isScheduledToShow);
MockInteractions.tap(button);
await clickPromise;
- assert.isFalse(element._isScheduledToShow);
+ assert.isFalse(element.isScheduledToShow);
assert.isFalse(element._isShowing);
button.removeEventListener('mouseenter', enterResolve);
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
index 2f2b5ce..a4c6974 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
@@ -60,7 +60,7 @@
}
export class GrChangeActionsInterface implements ChangeActionsPluginApi {
- private _el?: GrChangeActionsElement;
+ private el?: GrChangeActionsElement;
RevisionActions = RevisionActions;
@@ -80,7 +80,7 @@
console.warn('changeActions() is not ready');
return;
}
- this._el = el;
+ this.el = el;
}
/**
@@ -88,7 +88,7 @@
* element and retrieve if the interface was created before element.
*/
private ensureEl(): GrChangeActionsElement {
- if (!this._el) {
+ if (!this.el) {
const sharedApiElement = appContext.jsApiService;
this.setEl(
(sharedApiElement.getElement(
@@ -96,7 +96,7 @@
) as unknown) as GrChangeActionsElement
);
}
- return this._el!;
+ return this.el!;
}
addPrimaryActionKey(key: PrimaryActionKey) {
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.js
index 6a8a0dd..12a4056 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface_test.js
@@ -426,7 +426,7 @@
// eslint-disable-next-line no-invalid-this
const grPopupInterface = this;
assert.equal(grPopupInterface.plugin, plugin);
- assert.equal(grPopupInterface._moduleName, 'some-name');
+ assert.equal(grPopupInterface.moduleName, 'some-name');
});
plugin.popup('some-name');
assert.isTrue(openStub.calledOnce);
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts
index 21e4876..2135c30 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-action-context.ts
@@ -28,7 +28,7 @@
}
export class GrPluginActionContext {
- private _popups: PopupPluginApi[] = [];
+ private popups: PopupPluginApi[] = [];
constructor(
public readonly plugin: PluginApi,
@@ -44,15 +44,15 @@
throw new Error('Popup element not found');
}
popupEl.appendChild(element);
- this._popups.push(popApi);
+ this.popups.push(popApi);
});
}
hide() {
- for (const popupApi of this._popups) {
+ for (const popupApi of this.popups) {
popupApi.close();
}
- this._popups.splice(0);
+ this.popups.splice(0);
}
refresh() {
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts
index 2752c74..82df2fa 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.ts
@@ -51,10 +51,10 @@
private readonly _importedUrls = new Set<string>();
- private _pluginLoaded = false;
+ private pluginLoaded = false;
setPluginsReady() {
- this._pluginLoaded = true;
+ this.pluginLoaded = true;
}
onNewEndpoint(endpoint: string, callback: Callback) {
@@ -125,7 +125,7 @@
// one register before plugins ready
// the other done after, then only the later one will have the callbacks
// invoked.
- if (this._pluginLoaded && this._callbacks.has(endpoint)) {
+ if (this.pluginLoaded && this._callbacks.has(endpoint)) {
this._callbacks.get(endpoint)!.forEach(callback => callback(moduleInfo));
}
}
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
index 45ffdcd9..e7843af 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
@@ -78,14 +78,14 @@
export class Plugin implements PluginApi {
readonly _url?: URL;
- private _domHooks: GrDomHooksManager;
+ private domHooks: GrDomHooksManager;
private readonly _name: string = PLUGIN_NAME_NOT_SET;
private readonly jsApi = appContext.jsApiService;
constructor(url?: string) {
- this._domHooks = new GrDomHooksManager(this);
+ this.domHooks = new GrDomHooksManager(this);
if (!url) {
console.warn(
@@ -151,7 +151,7 @@
const type =
options && options.replace ? EndpointType.REPLACE : EndpointType.DECORATE;
const slot = (options && options.slot) || '';
- const domHook = this._domHooks.getDomHook(endpoint, moduleName);
+ const domHook = this.domHooks.getDomHook(endpoint, moduleName);
moduleName = moduleName || domHook.getModuleName();
getPluginEndpoints().registerModule(this, {
slot,
diff --git a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.ts b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.ts
index d29cba7..20e5296 100644
--- a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.ts
+++ b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.ts
@@ -56,7 +56,7 @@
* @event fullscreen-overlay-opened
*/
- private _fullScreenOpen = false;
+ private fullScreenOpen = false;
private _boundHandleClose: () => void = () => super.close();
@@ -99,7 +99,7 @@
super.open.apply(this);
if (this._isMobile()) {
fireEvent(this, 'fullscreen-overlay-opened');
- this._fullScreenOpen = true;
+ this.fullScreenOpen = true;
}
this._awaitOpen(resolve, reject);
});
@@ -112,9 +112,9 @@
// called after iron-overlay is closed. Does not actually close the overlay
_overlayClosed() {
window.removeEventListener('popstate', this._boundHandleClose);
- if (this._fullScreenOpen) {
+ if (this.fullScreenOpen) {
fireEvent(this, 'fullscreen-overlay-closed');
- this._fullScreenOpen = false;
+ this.fullScreenOpen = false;
}
if (this.returnFocusTo) {
this.returnFocusTo.focus();
diff --git a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.js b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.js
index 4b6ae34..72c3399 100644
--- a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.js
@@ -57,11 +57,11 @@
await element.open();
assert.isTrue(element._isMobile.called);
- assert.isTrue(element._fullScreenOpen);
+ assert.isTrue(element.fullScreenOpen);
assert.isTrue(openHandler.called);
element._overlayClosed();
- assert.isFalse(element._fullScreenOpen);
+ assert.isFalse(element.fullScreenOpen);
assert.isTrue(closeHandler.called);
});
@@ -75,11 +75,11 @@
await element.open();
assert.isTrue(element._isMobile.called);
- assert.isFalse(element._fullScreenOpen);
+ assert.isFalse(element.fullScreenOpen);
assert.isFalse(openHandler.called);
element._overlayClosed();
- assert.isFalse(element._fullScreenOpen);
+ assert.isFalse(element.fullScreenOpen);
assert.isFalse(closeHandler.called);
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
index fa2a28e..68f15dc 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
@@ -75,7 +75,7 @@
export class SiteBasedCache {
// TODO(TS): Type looks unusual. Fix it.
// Container of per-canonical-path caches.
- private readonly _data = new Map<
+ private readonly data = new Map<
string | undefined,
unknown | Map<string, ParsedJSON | null>
>();
@@ -93,13 +93,13 @@
// Returns the cache for the current canonical path.
_cache(): Map<string, unknown> {
- if (!this._data.has(window.CANONICAL_PATH)) {
- this._data.set(
+ if (!this.data.has(window.CANONICAL_PATH)) {
+ this.data.set(
window.CANONICAL_PATH,
new Map<string, ParsedJSON | null>()
);
}
- return this._data.get(window.CANONICAL_PATH) as Map<
+ return this.data.get(window.CANONICAL_PATH) as Map<
string,
ParsedJSON | null
>;
@@ -140,7 +140,7 @@
newMap.set(key, value);
}
}
- this._data.set(window.CANONICAL_PATH, newMap);
+ this.data.set(window.CANONICAL_PATH, newMap);
}
}
@@ -149,25 +149,25 @@
};
export class FetchPromisesCache {
- private _data: FetchPromisesCacheData;
+ private data: FetchPromisesCacheData;
constructor() {
- this._data = {};
+ this.data = {};
}
public testOnlyGetData() {
- return this._data;
+ return this.data;
}
/**
* @return true only if a value for a key sets and it is not undefined
*/
has(key: string): boolean {
- return !!this._data[key];
+ return !!this.data[key];
}
get(key: string) {
- return this._data[key];
+ return this.data[key];
}
/**
@@ -175,17 +175,17 @@
* mark key as deleted.
*/
set(key: string, value: Promise<ParsedJSON | undefined> | undefined) {
- this._data[key] = value;
+ this.data[key] = value;
}
invalidatePrefix(prefix: string) {
const newData: FetchPromisesCacheData = {};
- Object.entries(this._data).forEach(([key, value]) => {
+ Object.entries(this.data).forEach(([key, value]) => {
if (!key.startsWith(prefix)) {
newData[key] = value;
}
});
- this._data = newData;
+ this.data = newData;
}
}
export type FetchParams = {
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts
index 1a1062c..95e06c0 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts
@@ -81,9 +81,9 @@
// type. This class should be refactored to avoid reassignment.
private readonly result: ChangeInfoParserInput;
- private _batch: ParserBatch | null = null;
+ private batch: ParserBatch | null = null;
- private _updateItems: {[accountId: string]: UpdateItem} | null = null;
+ private updateItems: {[accountId: string]: UpdateItem} | null = null;
private readonly _lastState: {[accountId: string]: ReviewerState} = {};
@@ -105,7 +105,7 @@
* Is a part of _groupUpdates(). Creates a new batch of updates.
*/
private _startBatch(update: ReviewerUpdateInfo): ParserBatch {
- this._updateItems = {};
+ this.updateItems = {};
return {
author: update.updated_by,
date: update.updated,
@@ -121,7 +121,7 @@
*/
private _completeBatch(batch: ParserBatch) {
const items = [];
- for (const [accountId, item] of Object.entries(this._updateItems ?? {})) {
+ for (const [accountId, item] of Object.entries(this.updateItems ?? {})) {
if (this._lastState[accountId] !== item.state) {
this._lastState[accountId] = item.state;
items.push(item);
@@ -142,27 +142,27 @@
_groupUpdates(): ParserBatchWithNonEmptyUpdates[] {
const updates = this.result.reviewer_updates;
const newUpdates = updates.reduce((newUpdates, update) => {
- if (!this._batch) {
- this._batch = this._startBatch(update);
+ if (!this.batch) {
+ this.batch = this._startBatch(update);
}
const updateDate = parseDate(update.updated).getTime();
- const batchUpdateDate = parseDate(this._batch.date).getTime();
+ const batchUpdateDate = parseDate(this.batch.date).getTime();
const reviewerId = accountKey(update.reviewer);
if (
updateDate - batchUpdateDate > REVIEWER_UPDATE_THRESHOLD_MILLIS ||
- update.updated_by._account_id !== this._batch.author._account_id
+ update.updated_by._account_id !== this.batch.author._account_id
) {
// Next sequential update should form new group.
- this._completeBatch(this._batch);
- if (isParserBatchWithNonEmptyUpdates(this._batch)) {
- newUpdates.push(this._batch);
+ this._completeBatch(this.batch);
+ if (isParserBatchWithNonEmptyUpdates(this.batch)) {
+ newUpdates.push(this.batch);
}
- this._batch = this._startBatch(update);
+ this.batch = this._startBatch(update);
}
- // _startBatch assigns _updateItems. When _groupUpdates is calling,
- // _batch and _updateItems are not set => _startBatch is called. The
- // _startBatch method assigns _updateItems
- const updateItems = this._updateItems!;
+ // _startBatch assigns updateItems. When _groupUpdates is calling,
+ // batch and updateItems are not set => _startBatch is called. The
+ // _startBatch method assigns updateItems
+ const updateItems = this.updateItems!;
updateItems[reviewerId] = {
reviewer: update.reviewer,
state: update.state,
@@ -174,8 +174,8 @@
}, [] as ParserBatchWithNonEmptyUpdates[]);
// reviewer_updates always has at least 1 item
// (otherwise parse is not created) => updates.reduce calls callback
- // at least once and callback assigns this._batch
- const batch = this._batch!;
+ // at least once and callback assigns this.batch
+ const batch = this.batch!;
this._completeBatch(batch);
if (isParserBatchWithNonEmptyUpdates(batch)) {
newUpdates.push(batch);
diff --git a/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider.ts b/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider.ts
index 7969b84..5818003 100644
--- a/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider.ts
+++ b/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider.ts
@@ -19,10 +19,10 @@
import {AccountInfo} from '../../types/common';
export class GrEmailSuggestionsProvider {
- constructor(private _restAPI: RestApiService) {}
+ constructor(private restAPI: RestApiService) {}
getSuggestions(input: string) {
- return this._restAPI.getSuggestedAccounts(`${input}`).then(accounts => {
+ return this.restAPI.getSuggestedAccounts(`${input}`).then(accounts => {
if (!accounts) {
return [];
}
diff --git a/polygerrit-ui/app/scripts/gr-group-suggestions-provider/gr-group-suggestions-provider.ts b/polygerrit-ui/app/scripts/gr-group-suggestions-provider/gr-group-suggestions-provider.ts
index 1cf1c39..ff113fb 100644
--- a/polygerrit-ui/app/scripts/gr-group-suggestions-provider/gr-group-suggestions-provider.ts
+++ b/polygerrit-ui/app/scripts/gr-group-suggestions-provider/gr-group-suggestions-provider.ts
@@ -19,10 +19,10 @@
import {GroupBaseInfo} from '../../types/common';
export class GrGroupSuggestionsProvider {
- constructor(private _restAPI: RestApiService) {}
+ constructor(private restAPI: RestApiService) {}
getSuggestions(input: string) {
- return this._restAPI.getSuggestedGroups(`${input}`).then(groups => {
+ return this.restAPI.getSuggestedGroups(`${input}`).then(groups => {
if (!groups) {
return [];
}
diff --git a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts
index 1572ba1..45116aa 100644
--- a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts
+++ b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts
@@ -73,13 +73,13 @@
}
}
- private _initPromise?: Promise<void>;
+ private initPromise?: Promise<void>;
- private _config?: ServerInfo;
+ private config?: ServerInfo;
- private _loggedIn = false;
+ private loggedIn = false;
- private _initialized = false;
+ private initialized = false;
private constructor(
private readonly _restAPI: RestApiService,
@@ -87,26 +87,25 @@
) {}
init() {
- if (this._initPromise) {
- return this._initPromise;
+ if (this.initPromise) {
+ return this.initPromise;
}
const getConfigPromise = this._restAPI.getConfig().then(cfg => {
- this._config = cfg;
+ this.config = cfg;
});
const getLoggedInPromise = this._restAPI.getLoggedIn().then(loggedIn => {
- this._loggedIn = loggedIn;
+ this.loggedIn = loggedIn;
});
- this._initPromise = Promise.all([
- getConfigPromise,
- getLoggedInPromise,
- ]).then(() => {
- this._initialized = true;
- });
- return this._initPromise;
+ this.initPromise = Promise.all([getConfigPromise, getLoggedInPromise]).then(
+ () => {
+ this.initialized = true;
+ }
+ );
+ return this.initPromise;
}
getSuggestions(input: string): Promise<Suggestion[]> {
- if (!this._initialized || !this._loggedIn) {
+ if (!this.initialized || !this.loggedIn) {
return Promise.resolve([]);
}
@@ -117,7 +116,7 @@
if (isReviewerAccountSuggestion(suggestion)) {
// Reviewer is an account suggestion from getChangeSuggestedReviewers.
return {
- name: getAccountDisplayName(this._config, suggestion.account),
+ name: getAccountDisplayName(this.config, suggestion.account),
value: suggestion,
};
}
@@ -133,7 +132,7 @@
if (isAccountSuggestions(suggestion)) {
// Reviewer is an account suggestion from getSuggestedAccounts.
return {
- name: getAccountDisplayName(this._config, suggestion),
+ name: getAccountDisplayName(this.config, suggestion),
value: {account: suggestion, count: 1},
};
}
diff --git a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider_test.js b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider_test.js
index c7de24a..d3cad45 100644
--- a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider_test.js
+++ b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider_test.js
@@ -130,7 +130,7 @@
value: {account: {}},
});
- provider._config = {
+ provider.config = {
user: {
anonymous_coward_name: 'Anonymous Coward Name',
},
@@ -179,10 +179,10 @@
});
test('getSuggestions short circuits when logged out', () => {
- provider._loggedIn = false;
+ provider.loggedIn = false;
return provider.getSuggestions('').then(() => {
assert.isFalse(getChangeSuggestedReviewersStub.called);
- provider._loggedIn = true;
+ provider.loggedIn = true;
return provider.getSuggestions('').then(() => {
assert.isTrue(getChangeSuggestedReviewersStub.called);
});
diff --git a/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts b/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts
index 8fe7c35..6fadfde 100644
--- a/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts
+++ b/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts
@@ -61,26 +61,26 @@
static CREDS_EXPIRED_MSG = 'Credentials expired.';
- private _authCheckPromise?: Promise<Response>;
+ private authCheckPromise?: Promise<Response>;
private _last_auth_check_time: number = Date.now();
private _status = AuthStatus.UNDETERMINED;
- private _retriesLeft = MAX_GET_TOKEN_RETRIES;
+ private retriesLeft = MAX_GET_TOKEN_RETRIES;
- private _cachedTokenPromise: Promise<Token | null> | null = null;
+ private cachedTokenPromise: Promise<Token | null> | null = null;
- private _type?: AuthType;
+ private type?: AuthType;
- private _defaultOptions: AuthRequestInit = {};
+ private defaultOptions: AuthRequestInit = {};
- private _getToken: GetTokenCallback;
+ private getToken: GetTokenCallback;
public eventEmitter: EventEmitterService;
constructor(eventEmitter: EventEmitterService) {
- this._getToken = () => Promise.resolve(this._cachedTokenPromise);
+ this.getToken = () => Promise.resolve(this.cachedTokenPromise);
this.eventEmitter = eventEmitter;
}
@@ -93,15 +93,15 @@
*/
authCheck(): Promise<boolean> {
if (
- !this._authCheckPromise ||
+ !this.authCheckPromise ||
Date.now() - this._last_auth_check_time > MAX_AUTH_CHECK_WAIT_TIME_MS
) {
// Refetch after last check expired
- this._authCheckPromise = fetch(`${this.baseUrl}/auth-check`);
+ this.authCheckPromise = fetch(`${this.baseUrl}/auth-check`);
this._last_auth_check_time = Date.now();
}
- return this._authCheckPromise
+ return this.authCheckPromise
.then(res => {
// auth-check will return 204 if authed
// treat the rest as unauthed
@@ -115,14 +115,14 @@
})
.catch(() => {
this._setStatus(AuthStatus.ERROR);
- // Reset _authCheckPromise to avoid caching the failed promise
- this._authCheckPromise = undefined;
+ // Reset authCheckPromise to avoid caching the failed promise
+ this.authCheckPromise = undefined;
return false;
});
}
clearCache() {
- this._authCheckPromise = undefined;
+ this.authCheckPromise = undefined;
}
private _setStatus(status: AuthStatus) {
@@ -149,15 +149,15 @@
* Enable cross-domain authentication using OAuth access token.
*/
setup(getToken: GetTokenCallback, defaultOptions: DefaultAuthOptions) {
- this._retriesLeft = MAX_GET_TOKEN_RETRIES;
+ this.retriesLeft = MAX_GET_TOKEN_RETRIES;
if (getToken) {
- this._type = AuthType.ACCESS_TOKEN;
- this._cachedTokenPromise = null;
- this._getToken = getToken;
+ this.type = AuthType.ACCESS_TOKEN;
+ this.cachedTokenPromise = null;
+ this.getToken = getToken;
}
- this._defaultOptions = {};
+ this.defaultOptions = {};
if (defaultOptions) {
- this._defaultOptions.credentials = defaultOptions.credentials;
+ this.defaultOptions.credentials = defaultOptions.credentials;
}
}
@@ -167,10 +167,10 @@
fetch(url: string, opt_options?: AuthRequestInit): Promise<Response> {
const options: AuthRequestInitWithHeaders = {
headers: new Headers(),
- ...this._defaultOptions,
+ ...this.defaultOptions,
...opt_options,
};
- if (this._type === AuthType.ACCESS_TOKEN) {
+ if (this.type === AuthType.ACCESS_TOKEN) {
return this._getAccessToken().then(accessToken =>
this._fetchWithAccessToken(url, options, accessToken)
);
@@ -224,17 +224,17 @@
}
private _getAccessToken(): Promise<string | null> {
- if (!this._cachedTokenPromise) {
- this._cachedTokenPromise = this._getToken();
+ if (!this.cachedTokenPromise) {
+ this.cachedTokenPromise = this.getToken();
}
- return this._cachedTokenPromise.then(token => {
+ return this.cachedTokenPromise.then(token => {
if (this._isTokenValid(token)) {
- this._retriesLeft = MAX_GET_TOKEN_RETRIES;
+ this.retriesLeft = MAX_GET_TOKEN_RETRIES;
return token.access_token;
}
- if (this._retriesLeft > 0) {
- this._retriesLeft--;
- this._cachedTokenPromise = null;
+ if (this.retriesLeft > 0) {
+ this.retriesLeft--;
+ this.cachedTokenPromise = null;
return this._getAccessToken();
}
// Fall back to anonymous access.
diff --git a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
index f80cb75..af06450 100644
--- a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
+++ b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
@@ -292,17 +292,17 @@
private readonly _baselines = STARTUP_TIMERS;
- private _reportRepoName: string | undefined;
+ private reportRepoName: string | undefined;
- private _reportChangeId: NumericChangeId | undefined;
+ private reportChangeId: NumericChangeId | undefined;
- private _timers: {timeBetweenDraftActions: Timer | null} = {
+ private timers: {timeBetweenDraftActions: Timer | null} = {
timeBetweenDraftActions: null,
};
- private _pending: PendingReportInfo[] = [];
+ private pending: PendingReportInfo[] = [];
- private _slowRpcList: SlowRpcCall[] = [];
+ private slowRpcList: SlowRpcCall[] = [];
/**
* Keeps track of which ids were already reported to have been executed.
@@ -321,7 +321,7 @@
}
private get slowRpcSnapshot() {
- return (this._slowRpcList || []).slice();
+ return (this.slowRpcList || []).slice();
}
private _arePluginsLoaded() {
@@ -366,16 +366,16 @@
}
// We report events immediately when metrics plugin is loaded
- if (this._isMetricsPluginLoaded() && !this._pending.length) {
+ if (this._isMetricsPluginLoaded() && !this.pending.length) {
this._reportEvent(eventInfo, noLog);
} else {
// We cache until metrics plugin is loaded
- this._pending.push([eventInfo, noLog]);
+ this.pending.push([eventInfo, noLog]);
if (this._isMetricsPluginLoaded()) {
- this._pending.forEach(([eventInfo, opt_noLog]) => {
+ this.pending.forEach(([eventInfo, opt_noLog]) => {
this._reportEvent(eventInfo, opt_noLog);
});
- this._pending = [];
+ this.pending = [];
}
}
}
@@ -417,11 +417,11 @@
eventInfo.eventDetails = JSON.stringify(eventDetails);
}
- if (this._reportRepoName) {
- eventInfo.repoName = this._reportRepoName;
+ if (this.reportRepoName) {
+ eventInfo.repoName = this.reportRepoName;
}
- if (this._reportChangeId) {
- eventInfo.changeId = `${this._reportChangeId}`;
+ if (this.reportChangeId) {
+ eventInfo.changeId = `${this.reportChangeId}`;
}
const isInBackgroundTab = document.visibilityState === 'hidden';
@@ -501,10 +501,10 @@
this.time(TIMER.DIFF_VIEW_DISPLAYED);
this.time(TIMER.DIFF_VIEW_LOAD_FULL);
this.time(TIMER.FILE_LIST_DISPLAYED);
- this._reportRepoName = undefined;
- this._reportChangeId = undefined;
+ this.reportRepoName = undefined;
+ this.reportChangeId = undefined;
// reset slow rpc list since here start page loads which report these rpcs
- this._slowRpcList = [];
+ this.slowRpcList = [];
this.hiddenDurationTimer.reset();
}
@@ -765,7 +765,7 @@
true
);
if (elapsed >= SLOW_RPC_THRESHOLD) {
- this._slowRpcList.push({anonymizedUrl, elapsed});
+ this.slowRpcList.push({anonymizedUrl, elapsed});
}
}
@@ -812,10 +812,10 @@
// If there is no timer defined, then this is the first interaction.
// Set up the timer so that it's ready to record the intervening time when
// called again.
- const timer = this._timers.timeBetweenDraftActions;
+ const timer = this.timers.timeBetweenDraftActions;
if (!timer) {
// Create a timer with a maximum length.
- this._timers.timeBetweenDraftActions = this.getTimer(
+ this.timers.timeBetweenDraftActions = this.getTimer(
DRAFT_ACTION_TIMER
).withMaximum(DRAFT_ACTION_TIMER_MAX);
return;
@@ -848,11 +848,11 @@
}
setRepoName(repoName: string) {
- this._reportRepoName = repoName;
+ this.reportRepoName = repoName;
}
setChangeId(changeId: NumericChangeId) {
- this._reportChangeId = changeId;
+ this.reportChangeId = changeId;
}
}