Merge "Forward dependency-requests from gr-alert to gr-error-manager"
diff --git a/modules/jgit b/modules/jgit
index 85182df..21a4978 160000
--- a/modules/jgit
+++ b/modules/jgit
@@ -1 +1 @@
-Subproject commit 85182df26779dd6373d188b6adc936454b4c9189
+Subproject commit 21a497843cb804f5e714d8c93526422639efcc80
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 ac3e965..8d9f223 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
@@ -401,6 +401,7 @@
// private but used in tests
createToastAlert(showDismiss?: boolean) {
const el = document.createElement('gr-alert');
+ el.owner = this;
el.toast = true;
el.showDismiss = !!showDismiss;
return el;
diff --git a/polygerrit-ui/app/elements/shared/gr-alert/gr-alert.ts b/polygerrit-ui/app/elements/shared/gr-alert/gr-alert.ts
index d27e19d..9b80282 100644
--- a/polygerrit-ui/app/elements/shared/gr-alert/gr-alert.ts
+++ b/polygerrit-ui/app/elements/shared/gr-alert/gr-alert.ts
@@ -10,6 +10,7 @@
import {LitElement, css, html} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {sharedStyles} from '../../../styles/shared-styles';
+import {DependencyRequestEvent} from '../../../models/dependency';
declare global {
interface HTMLElementTagNameMap {
@@ -124,6 +125,9 @@
@property({type: Boolean})
showDismiss = false;
+ @property({type: Object})
+ owner: HTMLElement | null = null;
+
@property()
_boundTransitionEndHandler?: (
this: HTMLElement,
@@ -137,9 +141,11 @@
super.connectedCallback();
this._boundTransitionEndHandler = () => this._handleTransitionEnd();
this.addEventListener('transitionend', this._boundTransitionEndHandler);
+ this.addEventListener('request-dependency', this.resolveDep);
}
override disconnectedCallback() {
+ this.removeEventListener('request-dependency', this.resolveDep);
if (this._boundTransitionEndHandler) {
this.removeEventListener(
'transitionend',
@@ -149,6 +155,16 @@
super.disconnectedCallback();
}
+ /**
+ * Hovercards aren't children of <gr-app>. Dependencies must be resolved via
+ * their targets, so re-route 'request-dependency' events.
+ */
+ readonly resolveDep = (e: DependencyRequestEvent<unknown>) => {
+ this.owner?.dispatchEvent(
+ new DependencyRequestEvent<unknown>(e.dependency, e.callback)
+ );
+ };
+
show(text: string, actionText?: string, actionCallback?: () => void) {
this.text = text;
this.actionText = actionText;