IDEMPIERE-5607 - Dashboard Process Tenant data rendered in System (#1707)
* IDEMPIERE-5607 - Dashboard Process Tenant data rendered in System * IDEMPIERE-5607 - do not render DPPerformance if it is empty
This commit is contained in:
parent
a55a1bfbcf
commit
f0532b214a
|
@ -104,4 +104,9 @@ public class DPPerformance extends DashboardPanel {
|
||||||
public boolean isLazy() {
|
public boolean isLazy() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return performanceData.length <= 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,4 +55,12 @@ public abstract class DashboardPanel extends Window implements IDashboardPanel {
|
||||||
public boolean isLazy() {
|
public boolean isLazy() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empty Dashboard Panels are not rendered on the Dashboard
|
||||||
|
* @return true if the panel is empty
|
||||||
|
*/
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ import org.compiere.model.MProcess;
|
||||||
import org.compiere.model.MProcessPara;
|
import org.compiere.model.MProcessPara;
|
||||||
import org.compiere.model.MStatusLine;
|
import org.compiere.model.MStatusLine;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
import org.compiere.print.ReportEngine;
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -445,6 +446,12 @@ public class DashboardController implements EventListener<Event> {
|
||||||
if (dpanel.isLazy()) {
|
if (dpanel.isLazy()) {
|
||||||
try {
|
try {
|
||||||
dpanel.refresh(spt);
|
dpanel.refresh(spt);
|
||||||
|
if(dpanel.isEmpty()) {
|
||||||
|
spt.executeAsync(() -> {
|
||||||
|
panel.detach();
|
||||||
|
panel.setAttribute(PANEL_EMPTY_ATTRIBUTE, Boolean.TRUE);
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
@ -746,57 +753,68 @@ public class DashboardController implements EventListener<Event> {
|
||||||
int AD_Process_ID = dashboardContent.getAD_Process_ID();
|
int AD_Process_ID = dashboardContent.getAD_Process_ID();
|
||||||
if(AD_Process_ID > 0)
|
if(AD_Process_ID > 0)
|
||||||
{
|
{
|
||||||
String sql = "SELECT AD_MENU_ID FROM AD_MENU WHERE AD_Process_ID=?";
|
boolean systemAccess = false;
|
||||||
int AD_Menu_ID = DB.getSQLValueEx(null, sql, AD_Process_ID);
|
MProcess process = MProcess.get(Env.getCtx(), AD_Process_ID);
|
||||||
ToolBarButton btn = new ToolBarButton();
|
String accessLevel = process.getAccessLevel();
|
||||||
MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
|
if ( MTable.ACCESSLEVEL_All.equals(accessLevel)
|
||||||
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
|
|| MTable.ACCESSLEVEL_SystemOnly.equals(accessLevel)
|
||||||
btn.addEventListener(Events.ON_CLICK, this);
|
|| MTable.ACCESSLEVEL_SystemPlusClient.equals(accessLevel)) {
|
||||||
|
systemAccess = true;
|
||||||
if (dashboardContent.isEmbedReportContent())
|
}
|
||||||
{
|
int thisClientId = Env.getAD_Client_ID(Env.getCtx());
|
||||||
String processParameters = dashboardContent.getProcessParameters();
|
if((thisClientId == 0 && systemAccess) || thisClientId != 0) {
|
||||||
|
String sql = "SELECT AD_Menu_ID FROM AD_Menu WHERE AD_Process_ID=?";
|
||||||
Div layout = new Div();
|
int AD_Menu_ID = DB.getSQLValueEx(null, sql, AD_Process_ID);
|
||||||
layout.setHeight("100%");
|
ToolBarButton btn = new ToolBarButton();
|
||||||
layout.setStyle("display: flex;flex-direction: column;");
|
MMenu menu = new MMenu(Env.getCtx(), AD_Menu_ID, null);
|
||||||
components.add(layout);
|
btn.setAttribute("AD_Menu_ID", AD_Menu_ID);
|
||||||
Iframe iframe = new Iframe();
|
btn.addEventListener(Events.ON_CLICK, this);
|
||||||
iframe.setSclass("dashboard-report-iframe");
|
|
||||||
iframe.setStyle("flex-grow: 1;");
|
|
||||||
layout.appendChild(iframe);
|
|
||||||
iframe.setContent(generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, appDesktop, contextPath));
|
|
||||||
|
|
||||||
Toolbar toolbar = new Toolbar();
|
|
||||||
layout.appendChild(toolbar);
|
|
||||||
btn.setLabel(Msg.getMsg(Env.getCtx(), "OpenRunDialog"));
|
|
||||||
toolbar.appendChild(btn);
|
|
||||||
|
|
||||||
btn = new ToolBarButton();
|
if (dashboardContent.isEmbedReportContent())
|
||||||
btn.setAttribute("AD_Process_ID", AD_Process_ID);
|
{
|
||||||
btn.setAttribute("ProcessParameters", processParameters);
|
String processParameters = dashboardContent.getProcessParameters();
|
||||||
btn.setAttribute("AD_PrintFormat_ID", dashboardContent.getAD_PrintFormat_ID());
|
|
||||||
btn.addEventListener(Events.ON_CLICK, this);
|
Div layout = new Div();
|
||||||
btn.setLabel(Msg.getMsg(Env.getCtx(), "ViewReportInNewTab"));
|
layout.setHeight("100%");
|
||||||
toolbar.appendChild(new Separator("vertical"));
|
layout.setStyle("display: flex;flex-direction: column;");
|
||||||
toolbar.appendChild(btn);
|
components.add(layout);
|
||||||
|
Iframe iframe = new Iframe();
|
||||||
btn = new ToolBarButton();
|
iframe.setSclass("dashboard-report-iframe");
|
||||||
if (ThemeManager.isUseFontIconForImage()) {
|
iframe.setStyle("flex-grow: 1;");
|
||||||
btn.setIconSclass("z-icon-Refresh");
|
layout.appendChild(iframe);
|
||||||
btn.setSclass("trash-toolbarbutton");
|
iframe.setContent(generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, appDesktop, contextPath));
|
||||||
|
|
||||||
|
Toolbar toolbar = new Toolbar();
|
||||||
|
layout.appendChild(toolbar);
|
||||||
|
btn.setLabel(Msg.getMsg(Env.getCtx(), "OpenRunDialog"));
|
||||||
|
toolbar.appendChild(btn);
|
||||||
|
|
||||||
|
btn = new ToolBarButton();
|
||||||
|
btn.setAttribute("AD_Process_ID", AD_Process_ID);
|
||||||
|
btn.setAttribute("ProcessParameters", processParameters);
|
||||||
|
btn.setAttribute("AD_PrintFormat_ID", dashboardContent.getAD_PrintFormat_ID());
|
||||||
|
btn.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btn.setLabel(Msg.getMsg(Env.getCtx(), "ViewReportInNewTab"));
|
||||||
|
toolbar.appendChild(new Separator("vertical"));
|
||||||
|
toolbar.appendChild(btn);
|
||||||
|
|
||||||
|
btn = new ToolBarButton();
|
||||||
|
if (ThemeManager.isUseFontIconForImage()) {
|
||||||
|
btn.setIconSclass("z-icon-Refresh");
|
||||||
|
btn.setSclass("trash-toolbarbutton");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
btn.setImage(ThemeManager.getThemeResource("images/Refresh16.png"));
|
||||||
|
|
||||||
|
btn.addEventListener(Events.ON_CLICK, e -> iframe.setContent(generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, appDesktop, contextPath)));
|
||||||
|
toolbar.appendChild(btn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
btn.setImage(ThemeManager.getThemeResource("images/Refresh16.png"));
|
{
|
||||||
|
btn.setLabel(menu.getName());
|
||||||
btn.addEventListener(Events.ON_CLICK, e -> iframe.setContent(generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, appDesktop, contextPath)));
|
components.add(btn);
|
||||||
toolbar.appendChild(btn);
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
btn.setLabel(menu.getName());
|
|
||||||
components.add(btn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Goal
|
// Goal
|
||||||
|
|
Loading…
Reference in New Issue