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
UI fixes: linked users table on or-asset-viewer
Martin Peeterse09c6762d6df
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex 961355111..6967316f6 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -801,7 +801,7 @@ function getPanelContent(id: string, assetInfo: AssetInfo, hostElement: LitElemeassetLinkInfo.restrictedUser ? i18next.t("yes") : i18next.t("no")];});- return html`<or-mwc-table .rows="${rows}" .config="${{stickyFirstColumn:false}}" .columns="${cols}"+ return html`<or-mwc-table id="linked-users-table" .rows="${rows}" .config="${{stickyFirstColumn:false}}" .columns="${cols}"@or-mwc-table-row-click="${(ev: OrMwcTableRowClickEvent) => {hostElement.dispatchEvent(new OrAssetViewerLoadUserEvent(assetLinkInfos[ev.detail.index].userId));}}">@@ -941,7 +941,7 @@ async function getLinkedUserInfo(userAssetLink: UserAssetLink): Promise<UserAsseconst roleNames = await manager.rest.api.UserResource.getUserRoles(manager.displayRealm, userId).then((response) => {- return response.data.filter(role => role.composite).map(r => r.name!);+ return response.data.filter(role => role.composite && role.assigned).map(r => r.name!);}).catch((err) => {console.info('User not allowed to get roles', err);diff --git a/ui/component/or-mwc-components/src/or-mwc-table.ts b/ui/component/or-mwc-components/src/or-mwc-table.tsindex f2674fc6d..3f35b4c05 100644--- a/ui/component/or-mwc-components/src/or-mwc-table.ts+++ b/ui/component/or-mwc-components/src/or-mwc-table.ts@@ -288,12 +288,12 @@ export class OrMwcTable extends LitElement {protected render() {const tableClasses = {"mdc-data-table": true,- "mdc-data-table__paginated": !!this.config.pagination,+ "mdc-data-table__paginated": !!this.config.pagination?.enable,"mdc-data-table__fullheight": !!this.config.fullHeight,"has-sticky-first-column": !!this.config.stickyFirstColumn}// Only show pagination if enabled in config, and when "the amount of rows doesn't fit on the page".- const showPagination = this.config.pagination && (!!this.rowsTemplate || (this.rows && (this.rows.length > this.paginationSize)));+ const showPagination = this.config.pagination?.enable && (!!this.rowsTemplate || (this.rows && (this.rows.length > this.paginationSize)));const tableWidth = this.shadowRoot?.firstElementChild?.clientWidth;return html`<div class="${classMap(tableClasses)}">@@ -347,7 +347,7 @@ export class OrMwcTable extends LitElement {<!-- Table content, where either the template or an array of rows is displayed --><tbody class="mdc-data-table__content">${when(this.rowsTemplate, () => {- if (this.config.pagination) { // if paginated, filter out the rows by index by manually collecting a list of <tr> elements.+ if (this.config.pagination?.enable) { // if paginated, filter out the rows by index by manually collecting a list of <tr> elements.this.updateComplete.then(async () => {const elem = await this.getTableElem(false);const rows = elem?.querySelectorAll('tr');@@ -360,7 +360,7 @@ export class OrMwcTable extends LitElement {return html`${this.rowsTemplate}`;}, () => {return this.rows ? (this.rows as any[])- .filter((row, index) => (index >= (this.paginationIndex * this.paginationSize)) && (index < (this.paginationIndex * this.paginationSize + this.paginationSize)))+ .filter((row, index) => !this.config.pagination?.enable || (index >= (this.paginationIndex * this.paginationSize)) && (index < (this.paginationIndex * this.paginationSize + this.paginationSize))).map((item: TableRow | string[]) => {const content: (string | number | TemplateResult)[] | undefined = (Array.isArray(item) ? item : (item as TableRow).content);const styles = {