Merge "Remove shared-styles from gr-linked-text"
diff --git a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts
index d6f4bdd..41a7598 100644
--- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.ts
@@ -252,7 +252,7 @@
})
.catch(err => {
fireTitleChange(this, title || this._computeTitle(user));
- console.warn(err);
+ this.reporting.error(err);
})
.then(() => {
this._loading = false;
diff --git a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_html.ts b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_html.ts
index 1924a66..42a6847 100644
--- a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_html.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_html.ts
@@ -29,7 +29,7 @@
</style>
<gr-avatar
account="[[_accountDetails]]"
- image-size="100"
+ imageSize="100"
aria-label="Account avatar"
></gr-avatar>
<div class="info">
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
index bd9103e..c34a6ae 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
@@ -327,10 +327,9 @@
margin-bottom: var(--spacing-m);
}
.zeroState {
- color: var(--primary-text-color);
+ color: var(--deemphasized-text-color);
}
.loading.zeroState {
- color: var(--deemphasized-text-color);
margin-right: var(--spacing-m);
}
div.error {
@@ -561,7 +560,7 @@
account =>
html`<gr-avatar
.account="${account}"
- image-size="32"
+ imageSize="32"
></gr-avatar>`
)}
${countUnresolvedComments} unresolved</gr-summary-chip
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
index 3542ead..58cf489 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -634,7 +634,7 @@
this._dynamicTabContentEndpoints.length !==
this._dynamicTabHeaderEndpoints.length
) {
- console.warn('Different number of tab headers and tab content.');
+ this.reporting.error(new Error('Mismatch of headers and content.'));
}
})
.then(() => this._initActiveTabs(this.params));
@@ -767,7 +767,7 @@
}
}
if (activeIndex === -1) {
- console.warn('tab not found with given info', activeDetails);
+ this.reporting.error(new Error(`tab not found for ${activeDetails}`));
return;
}
const tabName = tabs[activeIndex].dataset['name'];
diff --git a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.ts b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.ts
index 532097b..ff303e3 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.ts
@@ -44,6 +44,7 @@
import {DiffViewMode} from '../../../constants/constants';
import {GrButton} from '../../shared/gr-button/gr-button';
import {fireEvent} from '../../../utils/event-util';
+import {KeyboardShortcutMixin} from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin';
declare global {
interface HTMLElementTagNameMap {
@@ -60,7 +61,7 @@
}
@customElement('gr-file-list-header')
-export class GrFileListHeader extends PolymerElement {
+export class GrFileListHeader extends KeyboardShortcutMixin(PolymerElement) {
static get template() {
return htmlTemplate;
}
diff --git a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_html.ts b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_html.ts
index 69be729..8b9b80c 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_html.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_html.ts
@@ -173,6 +173,7 @@
class="download"
title="[[createTitle(Shortcut.OPEN_DOWNLOAD_DIALOG,
ShortcutSection.ACTIONS)]]"
+ has-tooltip=""
on-click="_handleDownloadTap"
>Download</gr-button
>
@@ -186,6 +187,7 @@
link=""
title="[[createTitle(Shortcut.TOGGLE_ALL_INLINE_DIFFS,
ShortcutSection.FILE_LIST)]]"
+ has-tooltip=""
on-click="_expandAllDiffs"
>Expand All</gr-button
>
@@ -195,6 +197,7 @@
on-click="_collapseAllDiffs"
title="[[createTitle(Shortcut.TOGGLE_ALL_INLINE_DIFFS,
ShortcutSection.FILE_LIST)]]"
+ has-tooltip=""
>Collapse All</gr-button
>
</template>
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
index f61e024..5ce6e3b 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
@@ -385,25 +385,19 @@
this._dynamicHeaderEndpoints.length !==
this._dynamicContentEndpoints.length
) {
- console.warn(
- 'Different number of dynamic file-list header and content.'
- );
+ this.reporting.error(new Error('dynamic header/content mismatch'));
}
if (
this._dynamicPrependedHeaderEndpoints.length !==
this._dynamicPrependedContentEndpoints.length
) {
- console.warn(
- 'Different number of dynamic file-list header and content.'
- );
+ this.reporting.error(new Error('dynamic header/content mismatch'));
}
if (
this._dynamicHeaderEndpoints.length !==
this._dynamicSummaryEndpoints.length
) {
- console.warn(
- 'Different number of dynamic file-list headers and summary.'
- );
+ this.reporting.error(new Error('dynamic header/content mismatch'));
}
});
}
@@ -1429,7 +1423,9 @@
console.info('Expanding diff', iter, 'of', initialCount, ':', path);
const diffElem = this._findDiffByPath(path, diffElements);
if (!diffElem) {
- console.warn(`Did not find <gr-diff-host> element for ${path}`);
+ this.reporting.error(
+ new Error(`Did not find <gr-diff-host> element for ${path}`)
+ );
return Promise.resolve();
}
if (!this.changeComments || !this.patchRange || !this.diffPrefs) {
diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts
index 6be0c07..4e2aaf1 100644
--- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.ts
@@ -270,7 +270,9 @@
| undefined;
if (!el && this._showAllActivity) {
- console.warn(`Failed to scroll to message: ${messageID}`);
+ this.reporting.error(
+ new Error(`Failed to scroll to message: ${messageID}`)
+ );
return;
}
if (!el) {
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index d3d6010..939b23c 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -758,7 +758,7 @@
if (changeReviewers) {
for (const key of Object.keys(changeReviewers)) {
if (key !== 'REVIEWER' && key !== 'CC') {
- console.warn('unexpected reviewer state:', key);
+ this.reporting.error(new Error(`Unexpected reviewer state: ${key}`));
continue;
}
if (!changeReviewers[key]) continue;
@@ -1085,9 +1085,8 @@
} else if (isReviewerGroupSuggestion(suggestion)) {
entry = suggestion.group;
} else {
- console.warn(
- 'received suggestion that was neither account nor group:',
- suggestion
+ this.reporting.error(
+ new Error(`Suggestion is neither account nor group: ${suggestion}`)
);
return false;
}
diff --git a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.ts b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.ts
index 2f4adf5..8283be79 100644
--- a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.ts
@@ -112,7 +112,7 @@
}
_computeEmptyThreadsMessage(threads: CommentThread[]) {
- return !threads.length ? 'No comments.' : 'No unresolved comments';
+ return !threads.length ? 'No comments' : 'No unresolved comments';
}
_showPartyPopper(threads: CommentThread[]) {
diff --git a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js
index 1fe00ff..3d6cfd4 100644
--- a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js
+++ b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js
@@ -611,7 +611,7 @@
test('default empty message should show', () => {
assert.isTrue(
element.shadowRoot.querySelector('#threads').textContent.trim()
- .includes('No comments.'));
+ .includes('No comments'));
});
});
});
diff --git a/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_html.ts b/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_html.ts
index 0fa2f1e..97f4a89 100644
--- a/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_html.ts
+++ b/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_html.ts
@@ -45,7 +45,7 @@
account="[[account]]"
hidden$="[[!_hasAvatars]]"
hidden=""
- image-size="56"
+ imageSize="56"
aria-label="Account avatar"
></gr-avatar>
</gr-dropdown>
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
index 351e1bb..8f9dfe2 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
@@ -231,7 +231,7 @@
);
}
}
- console.info(`server error: ${errorText}`);
+ this.reporting.error(new Error(`Server error: ${errorText}`));
});
};
@@ -319,7 +319,7 @@
private readonly handleNetworkError = (e: NetworkErrorEvent) => {
this._showAlert('Server unavailable');
- console.error(e.detail.error.message);
+ this.reporting.error(new Error(`network error: ${e.detail.error.message}`));
};
// TODO(dhruvsr): allow less priority alerts to override high priority alerts
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js
index 91f119e..fe4d9da 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js
@@ -207,7 +207,6 @@
});
test('show network error', done => {
- const consoleErrorStub = sinon.stub(console, 'error');
const showAlertStub = sinon.stub(element, '_showAlert');
element.dispatchEvent(
new CustomEvent('network-error', {
@@ -218,8 +217,6 @@
assert.isTrue(showAlertStub.calledOnce);
assert.isTrue(showAlertStub.lastCall.calledWithExactly(
'Server unavailable'));
- assert.isTrue(consoleErrorStub.calledOnce);
- assert.isTrue(consoleErrorStub.lastCall.calledWithExactly('ZOMG'));
done();
});
});
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts
index b42deda..72c7a62 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.ts
@@ -398,7 +398,7 @@
if (e instanceof Response) {
this._handleGetDiffError(e);
} else {
- console.warn('Error encountered loading diff:', e);
+ this.reporting.error(e);
}
} finally {
this.reporting.timeEnd(Timing.DIFF_TOTAL);
@@ -483,12 +483,12 @@
});
})
.catch(err => {
- console.warn('Applying coverage from provider failed: ', err);
+ this.reporting.error(err);
});
});
})
.catch(err => {
- console.warn('Loading coverage ranges failed: ', err);
+ this.reporting.error(err);
});
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
index 2285afc..dacd8e7 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.ts
@@ -1099,7 +1099,9 @@
// the top-level change info view) and therefore undefined in `params`.
// If route is of type /comment/<commentId>/ then no patchNum is present
if (!value.patchNum && !value.commentLink) {
- console.warn('invalid url, no patchNum found');
+ this.reporting.error(
+ new Error(`Invalid diff view URL, no patchNum found: ${value}`)
+ );
return;
}
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
index 0c6dd4d..0c36cd5 100644
--- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
@@ -57,7 +57,7 @@
try {
mayContinue = callback(e);
} catch (exception) {
- console.warn(`Plugin error handing event: ${exception}`);
+ this.reporting.error(exception);
}
if (mayContinue === false) {
e.stopImmediatePropagation();
diff --git a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_html.ts b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_html.ts
index 6ca484d..e530ac8 100644
--- a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_html.ts
+++ b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_html.ts
@@ -35,7 +35,7 @@
<section>
<span class="title"></span>
<span class="value">
- <gr-avatar account="[[_account]]" image-size="120"></gr-avatar>
+ <gr-avatar account="[[_account]]" imageSize="120"></gr-avatar>
</span>
</section>
<section class$="[[_hideAvatarChangeUrl(_avatarChangeUrl)]]">
diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_html.ts b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_html.ts
index be590b1..a642337 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_html.ts
+++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_html.ts
@@ -128,7 +128,7 @@
class$="[[_computeHasAttentionClass(highlightAttention, account, change, forceAttention)]]"
>
<template is="dom-if" if="[[!hideAvatar]]">
- <gr-avatar account="[[account]]" image-size="32"></gr-avatar>
+ <gr-avatar account="[[account]]" imageSize="32"></gr-avatar>
</template>
<span class="text">
<span class="name">[[_computeName(account, _config, firstName)]]</span>
diff --git a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list.ts b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list.ts
index 231fc36..130969e 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list.ts
+++ b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list.ts
@@ -326,7 +326,9 @@
return;
}
}
- console.warn('received remove event for missing account', toRemove);
+ this.reporting.error(
+ new Error(`Received "remove" event for missing account: ${toRemove}`)
+ );
}
_getNativeInput(paperInput: PaperInputElementExt) {
diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.ts b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.ts
index e30e995..80576a7 100644
--- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.ts
+++ b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.ts
@@ -14,22 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import '../../../styles/shared-styles';
-import {PolymerElement} from '@polymer/polymer/polymer-element';
-import {htmlTemplate} from './gr-avatar_html';
import {getBaseUrl} from '../../../utils/url-util';
import {getPluginLoader} from '../gr-js-api-interface/gr-plugin-loader';
-import {customElement, property} from '@polymer/decorators';
import {AccountInfo} from '../../../types/common';
import {appContext} from '../../../services/app-context';
+import {GrLitElement} from '../../lit/gr-lit-element';
+import {css, customElement, html, property} from 'lit-element';
@customElement('gr-avatar')
-export class GrAvatar extends PolymerElement {
- static get template() {
- return htmlTemplate;
- }
-
- @property({type: Object, observer: '_accountChanged'})
+export class GrAvatar extends GrLitElement {
+ @property({type: Object})
account?: AccountInfo;
@property({type: Number})
@@ -40,6 +34,27 @@
private readonly restApiService = appContext.restApiService;
+ static get styles() {
+ return [
+ css`
+ :host {
+ display: inline-block;
+ border-radius: 50%;
+ background-size: cover;
+ background-color: var(
+ --avatar-background-color,
+ var(--gray-background)
+ );
+ }
+ `,
+ ];
+ }
+
+ render() {
+ this._updateAvatarURL();
+ return html``;
+ }
+
/** @override */
connectedCallback() {
super.connectedCallback();
@@ -57,10 +72,6 @@
return this.restApiService.getConfig();
}
- _accountChanged() {
- this._updateAvatarURL();
- }
-
_updateAvatarURL() {
if (!this._hasAvatars || !this.account) {
this.hidden = true;
@@ -80,7 +91,7 @@
);
}
- _buildAvatarURL(account: AccountInfo) {
+ _buildAvatarURL(account?: AccountInfo) {
if (!account) {
return '';
}
diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_html.ts b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_html.ts
deleted file mode 100644
index a1e51df..0000000
--- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_html.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * @license
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import {html} from '@polymer/polymer/lib/utils/html-tag';
-
-export const htmlTemplate = html`
- <style>
- :host {
- display: inline-block;
- border-radius: 50%;
- background-size: cover;
- background-color: var(--avatar-background-color, var(--gray-background));
- }
- </style>
-`;
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts
index b4b4c19..d6ad030 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts
@@ -706,7 +706,9 @@
const index = this._indexOf(comment, this.comments);
if (index === -1) {
// This should never happen: comment belongs to another thread.
- console.warn('Comment update for another comment thread.');
+ this.reporting.error(
+ new Error(`Comment update for another comment thread: ${comment}`)
+ );
return;
}
this.set(['comments', index], comment);
diff --git a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts
index 17b659f..7298af7 100644
--- a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts
+++ b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts
@@ -20,6 +20,7 @@
import {customElement, property} from '@polymer/decorators';
import {htmlTemplate} from './gr-formatted-text_html';
import {CommentLinks} from '../../../types/common';
+import {appContext} from '../../../services/app-context';
const CODE_MARKER_PATTERN = /^(`{1,3})([^`]+?)\1$/;
@@ -57,6 +58,8 @@
@property({type: Boolean})
noTrailingMargin = false;
+ private readonly reporting = appContext.reportingService;
+
static get observers() {
return ['_contentOrConfigChanged(content, config)'];
}
@@ -304,7 +307,7 @@
return ul;
}
- console.warn('Unrecognized type.');
+ this.reporting.error(new Error(`Unrecognized block type: ${block.type}`));
return document.createElement('span');
});
}
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_html.ts b/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_html.ts
index d0986de..dac5962 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_html.ts
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_html.ts
@@ -75,7 +75,7 @@
<template is="dom-if" if="[[_isShowing]]">
<div class="top">
<div class="avatar">
- <gr-avatar account="[[account]]" image-size="56"></gr-avatar>
+ <gr-avatar account="[[account]]" imageSize="56"></gr-avatar>
</div>
<div class="account">
<h3 class="name heading-3">[[account.name]]</h3>
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts
index 3f75970..82c7118 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.ts
@@ -42,7 +42,9 @@
): GrAnnotationActionsInterface {
this.reporting.trackApi(this.plugin, 'annotation', 'setCoverageProvider');
if (this.coverageProvider) {
- console.warn('Overwriting an existing coverage provider.');
+ this.reporting.error(
+ new Error(`Overwriting cov provider: ${this.plugin.getPluginName()}`)
+ );
}
this.coverageProvider = coverageProvider;
return this;
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 15d4680..b9c4c32 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
@@ -80,7 +80,7 @@
*/
private setEl(el?: GrChangeActionsElement) {
if (!el) {
- console.warn('changeActions() is not ready');
+ this.reporting.error(new Error(`changeActions() API is not ready`));
return;
}
this.el = el;
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 2135c30..46c7ad6 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
@@ -22,6 +22,7 @@
import {windowLocationReload} from '../../../utils/dom-util';
import {PopupPluginApi} from '../../../api/popup';
import {GrPopupInterface} from '../../plugins/gr-popup-interface/gr-popup-interface';
+import {appContext} from '../../../services/app-context';
interface ButtonCallBacks {
onclick: (event: Event) => boolean;
@@ -30,6 +31,8 @@
export class GrPluginActionContext {
private popups: PopupPluginApi[] = [];
+ private readonly reporting = appContext.reportingService;
+
constructor(
public readonly plugin: PluginApi,
public readonly action: UIActionInfo,
@@ -108,7 +111,9 @@
call(payload: RequestPayload, onSuccess: (result: unknown) => void) {
if (!this.action.method) return;
if (!this.action.__url) {
- console.warn(`Unable to ${this.action.method} to ${this.action.__key}!`);
+ this.reporting.error(
+ new Error(`Unable to ${this.action.method} to ${this.action.__key}!`)
+ );
return;
}
this.plugin
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts
index fe101c5..6fc8f1b 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.ts
@@ -132,7 +132,7 @@
try {
url = new URL(url);
} catch (e) {
- console.warn(e);
+ this._getReporting().error(e);
return false;
}
}
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 35acdef..cfa6c04 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
@@ -79,9 +79,10 @@
this.domHooks = new GrDomHooksManager(this);
if (!url) {
- console.warn(
- 'Plugin not being loaded from /plugins base path.',
- 'Unable to determine name.'
+ this.report.error(
+ new Error(
+ `Plugin not being loaded from /plugins base path. Unable to determine name.`
+ )
);
return this;
}
diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts
index db22ce5..31a709a 100644
--- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts
+++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.ts
@@ -81,6 +81,8 @@
private readonly restApiService = appContext.restApiService;
+ private readonly reporting = appContext.reportingService;
+
// TODO(TS): not used, remove later
_xhrPromise?: Promise<void>;
@@ -209,7 +211,7 @@
}
})
.catch(err => {
- console.warn(err);
+ this.reporting.error(err);
target.disabled = false;
return;
});
diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_html.ts b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_html.ts
index 56ab8c6..b6583d9 100644
--- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_html.ts
+++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_html.ts
@@ -88,7 +88,7 @@
<p
class$="placeholder [[_computeShowPlaceholder(labelInfo, change.labels.*)]]"
>
- No votes.
+ No votes
</p>
<table>
<template