web: fix unread count, use white-space pre

This commit is contained in:
Jens Langhammer 2021-01-16 17:02:48 +01:00
parent d020599e09
commit 4baf9e4a22
2 changed files with 8 additions and 9 deletions

View File

@ -93,8 +93,8 @@ class PolicyProcess(Process):
) )
# Create policy exception event # Create policy exception event
self.create_event(EventAction.POLICY_EXCEPTION, message=error_string) self.create_event(EventAction.POLICY_EXCEPTION, message=error_string)
LOGGER.debug("P_ENG(proc): error", exc=exc) LOGGER.debug("P_ENG(proc): error", exc=src_exc)
policy_result = PolicyResult(False, str(exc)) policy_result = PolicyResult(False, str(src_exc))
policy_result.source_policy = self.binding.policy policy_result.source_policy = self.binding.policy
# Invert result if policy.negate is set # Invert result if policy.negate is set
if self.binding.negate: if self.binding.negate:

View File

@ -22,6 +22,9 @@ export class NotificationDrawer extends LitElement {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.pf-c-notification-drawer__list-item-description {
white-space: pre;
}
` `
); );
} }
@ -29,7 +32,7 @@ export class NotificationDrawer extends LitElement {
firstUpdated(): void { firstUpdated(): void {
Notification.list().then(r => { Notification.list().then(r => {
this.notifications = r; this.notifications = r;
this.unread = r.results.filter((n) => n.seen).length; this.unread = r.results.filter((n) => !n.seen).length;
}); });
} }
@ -60,12 +63,8 @@ export class NotificationDrawer extends LitElement {
${item.event?.action} ${item.event?.action}
</h2> </h2>
</div> </div>
<div class="pf-c-notification-drawer__list-item-description"> <p class="pf-c-notification-drawer__list-item-description">${item.body}</p>
${item.body} <small class="pf-c-notification-drawer__list-item-timestamp">${age}</small>
</div>
<div class="pf-c-notification-drawer__list-item-timestamp">
${age}
</div>
</li>`; </li>`;
} }