expressions: set exception as message field
This commit is contained in:
@ -1,25 +1,24 @@
|
||||
import { DefaultClient, QueryArguments, PBResponse } from "./Client";
|
||||
import { Event } from "./Events";
|
||||
|
||||
export class Notification {
|
||||
pk: string;
|
||||
name: string;
|
||||
mode: string;
|
||||
mode_verbose: string;
|
||||
webhook_url: string;
|
||||
severity: string;
|
||||
body: string;
|
||||
created: string;
|
||||
event?: Event;
|
||||
seen: boolean;
|
||||
|
||||
constructor() {
|
||||
throw Error();
|
||||
}
|
||||
|
||||
static get(pk: string): Promise<Transport> {
|
||||
return DefaultClient.fetch<Transport>(["events", "transports", pk]);
|
||||
static get(pk: string): Promise<Notification> {
|
||||
return DefaultClient.fetch<Notification>(["events", "notifications", pk]);
|
||||
}
|
||||
|
||||
static list(filter?: QueryArguments): Promise<PBResponse<Transport>> {
|
||||
return DefaultClient.fetch<PBResponse<Transport>>(["events", "transports"], filter);
|
||||
static list(filter?: QueryArguments): Promise<PBResponse<Notification>> {
|
||||
return DefaultClient.fetch<PBResponse<Notification>>(["events", "notifications"], filter);
|
||||
}
|
||||
|
||||
static adminUrl(rest: string): string {
|
||||
return `/administration/events/transports/${rest}`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { css, CSSResult, customElement, html, LitElement, TemplateResult } from "lit-element";
|
||||
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
|
||||
// @ts-ignore
|
||||
import NavStyle from "@patternfly/patternfly/components/Nav/nav.css";
|
||||
// @ts-ignore
|
||||
@ -8,8 +8,11 @@ import AvatarStyle from "@patternfly/patternfly/components/Avatar/avatar.css";
|
||||
import { User } from "../../api/Users";
|
||||
import { until } from "lit-html/directives/until";
|
||||
|
||||
import "../notifications/NotificationTrigger";
|
||||
|
||||
@customElement("ak-sidebar-user")
|
||||
export class SidebarUser extends LitElement {
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return [
|
||||
fa,
|
||||
@ -24,19 +27,8 @@ export class SidebarUser extends LitElement {
|
||||
}
|
||||
.pf-c-nav__link {
|
||||
align-items: center;
|
||||
}
|
||||
.user-avatar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.user-avatar > span {
|
||||
line-height: var(--pf-c-avatar--Height);
|
||||
padding-left: var(--pf-global--spacer--sm);
|
||||
font-size: var(--pf-global--FontSize--lg);
|
||||
}
|
||||
.user-logout {
|
||||
flex-shrink: 3;
|
||||
max-width: 75px;
|
||||
justify-content: center;
|
||||
}
|
||||
`,
|
||||
];
|
||||
@ -46,10 +38,11 @@ export class SidebarUser extends LitElement {
|
||||
return html`
|
||||
<a href="#/-/user/" class="pf-c-nav__link user-avatar" id="user-settings">
|
||||
${until(User.me().then(u => {
|
||||
return html`<img class="pf-c-avatar" src="${u.avatar}" alt="" />
|
||||
<span>${u.name}</span>`;
|
||||
}), html``)}
|
||||
return html`<img class="pf-c-avatar" src="${u.avatar}" alt="" />`;}), html``)}
|
||||
</a>
|
||||
<ak-notification-trigger class="pf-c-nav__link user-notifications">
|
||||
<i class="fas fa-bell pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
|
||||
</ak-notification-trigger>
|
||||
<a href="/flows/-/default/invalidation/" class="pf-c-nav__link user-logout" id="logout">
|
||||
<i class="fas fa-sign-out-alt" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
||||
@ -5,11 +5,15 @@ import { SidebarItem } from "../elements/sidebar/Sidebar";
|
||||
import "../elements/router/RouterOutlet";
|
||||
import "../elements/messages/MessageContainer";
|
||||
import "../elements/sidebar/SidebarHamburger";
|
||||
import "../elements/notifications/NotificationDrawer"
|
||||
|
||||
export abstract class Interface extends LitElement {
|
||||
@property({type: Boolean})
|
||||
sidebarOpen = true;
|
||||
|
||||
@property({type: Boolean})
|
||||
notificationOpen = false;
|
||||
|
||||
abstract get sidebar(): SidebarItem[];
|
||||
|
||||
createRenderRoot(): ShadowRoot | Element {
|
||||
@ -25,6 +29,9 @@ export abstract class Interface extends LitElement {
|
||||
window.addEventListener("ak-sidebar-toggle", () => {
|
||||
this.sidebarOpen = !this.sidebarOpen;
|
||||
});
|
||||
window.addEventListener("ak-notification-toggle", () => {
|
||||
this.notificationOpen = !this.notificationOpen;
|
||||
});
|
||||
}
|
||||
|
||||
render(): TemplateResult {
|
||||
@ -35,10 +42,22 @@ export abstract class Interface extends LitElement {
|
||||
</ak-sidebar-hamburger>
|
||||
<ak-sidebar class="pf-c-page__sidebar ${this.sidebarOpen ? "pf-m-expanded" : "pf-m-collapsed"}" .items=${this.sidebar}>
|
||||
</ak-sidebar>
|
||||
<main class="pf-c-page__main">
|
||||
<ak-router-outlet role="main" class="pf-c-page__main" tabindex="-1" id="main-content" defaultUrl="/library">
|
||||
</ak-router-outlet>
|
||||
</main>
|
||||
<div class="pf-c-page__drawer">
|
||||
<div class="pf-c-drawer ${this.notificationOpen ? "pf-m-expanded" : "pf-m-collapsed"}">
|
||||
<div class="pf-c-drawer__main">
|
||||
<div class="pf-c-drawer__content">
|
||||
<div class="pf-c-drawer__body">
|
||||
<main class="pf-c-page__main">
|
||||
<ak-router-outlet role="main" class="pf-c-page__main" tabindex="-1" id="main-content" defaultUrl="/library">
|
||||
</ak-router-outlet>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<ak-notification-drawer class="pf-c-drawer__panel pf-m-width-33">
|
||||
</ak-notification-drawer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ export class EventInfo extends LitElement {
|
||||
return html`<div class="pf-l-flex">
|
||||
<div class="pf-l-flex__item">
|
||||
<h3>${gettext("Exception")}</h3>
|
||||
<code>${this.event.context.error || this.event.context.message}</code>
|
||||
<code>${this.event.context.message || this.event.context.error}</code>
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<h3>${gettext("Expression")}</h3>
|
||||
@ -117,7 +117,7 @@ export class EventInfo extends LitElement {
|
||||
</div>
|
||||
<div class="pf-l-flex__item">
|
||||
<h3>${gettext("Exception")}</h3>
|
||||
<code>${this.event.context.error}</code>
|
||||
<code>${this.event.context.message || this.event.context.error}</code>
|
||||
</div>
|
||||
</div>`;
|
||||
case "policy_execution":
|
||||
|
||||
Reference in New Issue
Block a user