100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fix notification table and dialog layout overflow (#3366)
Koenc5cbda1cdce5
diff --git a/ui/app/manager/src/components/notifications/or-notification-form.ts b/ui/app/manager/src/components/notifications/or-notification-form.tsindex 89b90c3c5..ccf160c8f 100644--- a/ui/app/manager/src/components/notifications/or-notification-form.ts+++ b/ui/app/manager/src/components/notifications/or-notification-form.ts@@ -20,6 +20,7 @@ import { css, html } from "lit";import { OrElement } from "@openremote/or-element";import { customElement, property, state } from "lit/decorators.js";import { when } from "lit/directives/when.js";+import { classMap } from "lit/directives/class-map.js";import { i18next } from "@openremote/or-translate";import manager, { Util } from "@openremote/core";import {@@ -70,11 +71,15 @@ export class OrNotificationFormChangedEvent extends CustomEvent<void> {export class OrNotificationForm extends OrElement {static styles = css`:host {- display: block;+ display: flex;+ flex-direction: column;+ min-height: 100%;}.form-container {- height: 100%;+ display: flex;+ flex-direction: column;+ flex: 1 1 auto;}or-vaadin-select,@@ -86,10 +91,6 @@ export class OrNotificationForm extends OrElement {margin-bottom: 16px;}- or-asset-tree {- flex: 0 0 auto;- }-/* Grid styles */.formGridContainer {@@ -99,8 +100,10 @@ export class OrNotificationForm extends OrElement {grid-template-areas:"targetContainer messageContentContainer""targetContainer actionButtonContainer";+ /* The action row takes the height it needs and the content area the rest */+ grid-template-rows: 1fr auto;gap: var(--lumo-space-m);- height: 100%;+ flex: 1 1 auto;}.formGridContainer-readonly {@@ -110,8 +113,16 @@ export class OrNotificationForm extends OrElement {grid-template-areas:"targetContainer messageContentContainer""propContainer actionButtonContainer";+ grid-template-rows: 1fr auto;gap: var(--lumo-space-m);- height: 100%;+ flex: 1 1 auto;+ }++ /* Only push notifications have actions. Dropping that row as well as its item keeps the content+ area from ending a row gap short of the bottom */+ .formGridContainer.noActions {+ grid-template-areas: "targetContainer messageContentContainer";+ grid-template-rows: 1fr;}[class*="formGridContainer"] > * {@@ -126,11 +137,15 @@ export class OrNotificationForm extends OrElement {position: absolute;width: 100%;height: 100%;+ display: flex;+ flex-direction: column;}.messageContentContainer {grid-area: messageContentContainer;height: 100%;+ display: flex;+ flex-direction: column;}.actionButtonContainer {@@ -143,6 +158,7 @@ export class OrNotificationForm extends OrElement {.target-area {flex: 1 1 auto;+ min-height: 0;overflow: auto;}@@ -151,14 +167,13 @@ export class OrNotificationForm extends OrElement {}@media (max-width: 1024px) {- :host {- height: auto;- }-+ /* The noActions selectors are listed so this still wins over the two-column layout above */.formGridContainer,- .formGridContainer-readonly {+ .formGridContainer.noActions,+ .formGridContainer-readonly,+ .formGridContainer-readonly.noActions {grid-template-columns: 1fr;- height: auto;+ grid-template-rows: none;}.formGridContainer {@@ -168,6 +183,12 @@ export class OrNotificationForm extends OrElement {"actionButtonContainer";}+ .formGridContainer.noActions {+ grid-template-areas:+ "targetContainer"+ "messageContentContainer";+ }+.formGridContainer-readonly {grid-template-areas:"targetContainer"@@ -176,6 +197,13 @@ export class OrNotificationForm extends OrElement {"actionButtonContainer";}+ .formGridContainer-readonly.noActions {+ grid-template-areas:+ "targetContainer"+ "messageContentContainer"+ "propContainer";+ }+/* Return the target column to normal flow so its stacked row keeps a height */.targetContainer {position: relative;@@ -461,12 +489,18 @@ export class OrNotificationForm extends OrElement {protected render() {const inputDisabled = this.disabled || this.readonly;+ const hasActions = this._message.type === "push";+ const gridClasses = {+ formGridContainer: !this.readonly,+ "formGridContainer-readonly": this.readonly,+ noActions: !hasActions,+ };return html`<div class="form-container">- <div class="${this.readonly ? "formGridContainer-readonly" : "formGridContainer"}">+ <div class="${classMap(gridClasses)}">${this._renderTargetContainer(inputDisabled)} ${this._renderMessageContentContainer(inputDisabled)}- ${this._message.type === "push" ? this._renderActionButtonContainer(inputDisabled) : ""}+ ${hasActions ? this._renderActionButtonContainer(inputDisabled) : ""}${this.readonly ? this._renderPropertiesContainer() : ""}</div></div>diff --git a/ui/app/manager/src/components/notifications/or-notifications-table.ts b/ui/app/manager/src/components/notifications/or-notifications-table.tsindex 5f1718d75..e0e02736b 100644--- a/ui/app/manager/src/components/notifications/or-notifications-table.ts+++ b/ui/app/manager/src/components/notifications/or-notifications-table.ts@@ -192,6 +192,16 @@ export class OrNotificationsTable extends OrMwcTable {flex: 0 0 auto;}+ /* Caps what the body contributes to the column's content width, which a percentage cannot do+ since that resolves against the width being computed; the other columns keep sizing to their+ content. Raise this to show more of the body before it truncates. */+ .body-text {+ max-width: 40ch;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+.target-wrapper {display: flex;align-items: center;@@ -304,7 +314,7 @@ export class OrNotificationsTable extends OrMwcTable {return {content: [this.getTitleContent(notification, title),- body,+ this.getBodyContent(body),this.getStatusContent(notification),this.getSourceContent(notification.source),this.getTargetContent(notification),@@ -333,6 +343,11 @@ export class OrNotificationsTable extends OrMwcTable {`;}+ // The wrapper carries the title attribute the cell would otherwise get from a plain string value+ protected getBodyContent(body?: string): TemplateResult {+ return html`<div class="body-text" title="${body ?? ""}">${body}</div>`;+ }+protected getSourceContent(source: NotificationSource): TemplateResult {return html`<or-translate value="notifications.sources.${source}"></or-translate>`;}diff --git a/ui/app/manager/src/pages/page-notifications.ts b/ui/app/manager/src/pages/page-notifications.tsindex 08cf1252f..e9a2870be 100644--- a/ui/app/manager/src/pages/page-notifications.ts+++ b/ui/app/manager/src/pages/page-notifications.ts@@ -506,6 +506,7 @@ export class PageNotifications extends Page<AppStateKeyed> {<or-vaadin-dialogid="createDialog"width="1024px"+ height="976px"no-close-on-outside-clickno-close-on-escheader-title="${i18next.t("notifications.createNotification")}"