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
Bug fix for slow loading on /assets page for many linked users (#1856)
Nathan Couture7e052e5d88bd
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex fc7d5e496..4329dd469 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -127,7 +127,6 @@ export interface ViewerConfig {interface UserAssetLinkInfo {userId: string;usernameAndId: string;- roles: string[];restrictedUser: boolean;}@@ -791,11 +790,10 @@ function getPanelContent(id: string, assetInfo: AssetInfo, hostElement: LitElemereturn;}- const cols = [i18next.t("username"), i18next.t("roles"), i18next.t("restrictedUser")];+ const cols = [i18next.t("username"), i18next.t("restrictedUser")];const rows = assetLinkInfos.sort(Util.sortByString(u => u.usernameAndId)).map(assetLinkInfo => {return [assetLinkInfo.usernameAndId,- assetLinkInfo.roles.join(", "),assetLinkInfo.restrictedUser ? i18next.t("yes") : i18next.t("no")];});@@ -972,15 +970,6 @@ async function getLinkedUserInfo(userAssetLink: UserAssetLink): Promise<UserAsseconst userId = userAssetLink.id!.userId!;const username = userAssetLink.userFullName!;- const roleNames = await manager.rest.api.UserResource.getUserClientRoles(manager.displayRealm, userId, manager.clientId)- .then((response) => {- return response.data;- })- .catch((err) => {- console.info('User not allowed to get roles', err);- return [];- });-const isRestrictedUser = await manager.rest.api.UserResource.getUserRealmRoles(manager.displayRealm, userId).then((rolesRes) => {return rolesRes.data ? !!rolesRes.data.find(r => r === RESTRICTED_USER_REALM_ROLE) : false;@@ -989,7 +978,6 @@ async function getLinkedUserInfo(userAssetLink: UserAssetLink): Promise<UserAssereturn {userId: userId,usernameAndId: username,- roles: roleNames,restrictedUser: isRestrictedUser};}