IDEMPIERE-5400 - Dashboard Goal Content should render as single Gauge Indicator (#1458)
* IDEMPIERE-5400 - Dashboard Goal Content should render as single Gauge Indicator * IDEMPIERE-5400 - better css responsivity * IDEMPIERE-5400 - add update goal * IDEMPIERE-5400 - fixes * IDEMPIERE-5400 - resolved conflict, migration fix * IDEMPIERE-5400 - fix bad merge
This commit is contained in:
parent
ee3476c3eb
commit
1f4a23657a
|
@ -0,0 +1,10 @@
|
|||
-- IDEMPIERE-5400
|
||||
SELECT register_migration_script('202208301110_IDEMPIERE-5400.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Aug 30, 2022, 11:10:28 AM CEST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200544,'Gauge Indicator',53316,'G',0,0,'Y',TO_TIMESTAMP('2022-08-30 11:10:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-08-30 11:10:28','YYYY-MM-DD HH24:MI:SS'),100,'D','38f8439b-0232-4ea6-9e3f-98574b2b7326')
|
||||
;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
-- IDEMPIERE-5400
|
||||
SELECT register_migration_script('202208301110_IDEMPIERE-5400.sql') FROM dual;
|
||||
|
||||
-- Aug 30, 2022, 11:10:28 AM CEST
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200544,'Gauge Indicator',53316,'G',0,0,'Y',TO_TIMESTAMP('2022-08-30 11:10:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-08-30 11:10:28','YYYY-MM-DD HH24:MI:SS'),100,'D','38f8439b-0232-4ea6-9e3f-98574b2b7326')
|
||||
;
|
||||
|
|
@ -33,7 +33,7 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent,
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20220906L;
|
||||
private static final long serialVersionUID = 20220907L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_PA_DashboardContent (Properties ctx, int PA_DashboardContent_ID, String trxName)
|
||||
|
@ -314,6 +314,8 @@ public class X_PA_DashboardContent extends PO implements I_PA_DashboardContent,
|
|||
public static final int GOALDISPLAY_AD_Reference_ID=53316;
|
||||
/** Chart = C */
|
||||
public static final String GOALDISPLAY_Chart = "C";
|
||||
/** Gauge Indicator = G */
|
||||
public static final String GOALDISPLAY_GaugeIndicator = "G";
|
||||
/** HTML Table = T */
|
||||
public static final String GOALDISPLAY_HTMLTable = "T";
|
||||
/** Set Goal Display.
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/**********************************************************************
|
||||
* This file is part of iDempiere ERP Open Source *
|
||||
* http://www.idempiere.org *
|
||||
* *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* - Igor Pojzl, Cloudempiere *
|
||||
* - Peter Takacs, Cloudempiere *
|
||||
**********************************************************************/
|
||||
|
||||
package org.adempiere.webui.apps.graph;
|
||||
|
||||
import org.adempiere.webui.apps.graph.WPerformanceIndicator.Options;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.compiere.model.MGoal;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Label;
|
||||
|
||||
public class WPAWidget extends Panel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5684412399657327777L;
|
||||
|
||||
/**************************************************************************
|
||||
* Constructor
|
||||
*/
|
||||
public WPAWidget (MGoal goal, Options options)
|
||||
{
|
||||
super();
|
||||
goal.updateGoal(false);
|
||||
init(goal, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static/Dynamic Init
|
||||
* @param goal
|
||||
* @param options
|
||||
*/
|
||||
private void init(MGoal goal, Options options)
|
||||
{
|
||||
Div div = new Div();
|
||||
appendChild(div);
|
||||
WPerformanceIndicator pi = new WPerformanceIndicator(goal, options);
|
||||
div.appendChild(pi);
|
||||
if (goal.getMeasure() != null)
|
||||
pi.addEventListener(Events.ON_CLICK, e -> new WPerformanceDetail(pi.getGoal())); //Action Listener for Drill Down
|
||||
Div titleDiv = new Div();
|
||||
titleDiv.setSclass("performance-indicator-title");
|
||||
Label label = new Label(pi.getTitle());
|
||||
div.appendChild(titleDiv);
|
||||
titleDiv.appendChild(label);
|
||||
} // init
|
||||
}
|
|
@ -37,6 +37,7 @@ import org.adempiere.webui.Extensions;
|
|||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.apps.graph.IChartRendererService;
|
||||
import org.adempiere.webui.apps.graph.WGraph;
|
||||
import org.adempiere.webui.apps.graph.WPAWidget;
|
||||
import org.adempiere.webui.apps.graph.WPerformanceDetail;
|
||||
import org.adempiere.webui.apps.graph.model.ChartModel;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
|
@ -667,6 +668,15 @@ public class DashboardController implements EventListener<Event> {
|
|||
int PA_Goal_ID = dc.getPA_Goal_ID();
|
||||
if(PA_Goal_ID > 0)
|
||||
{
|
||||
|
||||
String goalDisplay = dc.getGoalDisplay();
|
||||
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
|
||||
if(MDashboardContent.GOALDISPLAY_GaugeIndicator.equals(goalDisplay)) {
|
||||
WPAWidget paWidget = new WPAWidget(goal, null);
|
||||
((HtmlBasedComponent)content).setSclass("performance-gadget");
|
||||
content.appendChild(paWidget);
|
||||
}
|
||||
else {
|
||||
//link to open performance detail
|
||||
Div div = new Div();
|
||||
Toolbarbutton link = new Toolbarbutton();
|
||||
|
@ -685,12 +695,11 @@ public class DashboardController implements EventListener<Event> {
|
|||
div.appendChild(link);
|
||||
content.appendChild(div);
|
||||
|
||||
String goalDisplay = dc.getGoalDisplay();
|
||||
MGoal goal = new MGoal(Env.getCtx(), PA_Goal_ID, null);
|
||||
WGraph graph = new WGraph(goal, 55, false, true,
|
||||
!(MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay)),
|
||||
MDashboardContent.GOALDISPLAY_Chart.equals(goalDisplay));
|
||||
content.appendChild(graph);
|
||||
}
|
||||
empty = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,6 +216,24 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.performance-indicator-title {
|
||||
text-align: center;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
line-height:12px;
|
||||
}
|
||||
|
||||
.performance-gadget {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.performance-gadget > .z-div {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
.dashboard-row .chart-gadget {
|
||||
max-height: 300px;
|
||||
|
|
Loading…
Reference in New Issue