Logic Machine Forum
Trends load error - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Trends load error (/showthread.php?tid=632)



Trends load error - buuuudzik - 20.02.2017

Hello,

I found some little bug in visualisation and access.

When I have regular visualisation with some widgets with individual trends and I want give some access to part of this visualisation for some person there is a error of loading trends which shouldn't be loaded. This is probably because all widgets are loaded in all situations also when not necessary like in this case. I've checked that the fast solution is when I use address to trend with IP, but I think also about optimization.

How can I delete in correct way unnecesseary widgets when some page is from specific part of the visualisation or if logged person hasn't rights for this widgets?


RE: Trends load error - admin - 20.02.2017

Access right are per-plan, so the easiest way is to create separate plans with trends for each user.


RE: Trends load error - buuuudzik - 20.02.2017

I like more widgets than plans for trend viewing so I've prepared such script for deleting unnecessary widgets if first page is for example 173(homepage of specific user):
Code:
// Delete unnecessary widgets
$(function(){
 if (!$('body').hasClass('usermode')) {
   return;
 }
 
if (currentPlanId == 173){
$('#widget-58,#widget-59,#widget-61,#widget-62,#widget-63,#widget-64,#widget-65,#widget-66,#widget-67,#widget-68,#widget-69,#widget-71,#widget-73,#widget-74,#widget-75,#widget-76,#widget-77,#widget-79,'+
  '#widget-80,#widget-81,#widget-82,#widget-84,#widget-85,#widget-86,#widget-88,#widget-89,#widget-91,#widget-92,#widget-93,#widget-94,#widget-95,#widget-96,#widget-97,#widget-98,#widget-99,#widget-100,'+
  '#widget-101,#widget-102,#widget-103,#widget-104,#widget-105,#widget-106,#widget-107,#widget-108,#widget-109,#widget-166,#widget-167,#widget-168,#widget-169,#widget-170,#widget-171,#widget-378,'+
  '#widget-379,#widget-387,#widget-388,#widget-393,#widget-394,#widget-396,#widget-397').remove()  
   } else if(currentPlanId == 1){
// do nothing
};
 
 });