mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
initial checkin of quicksight dashboard widget POC, updated to remove hard coded credentials
This commit is contained in:
@ -36,11 +36,26 @@
|
||||
<!-- noe at this time -->
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>2.17.259</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- other qqq modules deps -->
|
||||
<!-- none, this is core. -->
|
||||
|
||||
<!-- 3rd party deps specifically for this module -->
|
||||
<dependency>
|
||||
<groupId>software.amazon.awssdk</groupId>
|
||||
<artifactId>quicksight</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
|
@ -3,6 +3,7 @@ package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
|
||||
|
||||
@ -15,6 +16,6 @@ public abstract class AbstractWidgetRenderer
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public abstract Object render(QInstance qInstance, QSession session) throws QException;
|
||||
public abstract Object render(QInstance qInstance, QSession session, QWidgetMetaDataInterface qWidgetMetaData) throws QException;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.QuickSightChart;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QuickSightChartMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||||
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
||||
import software.amazon.awssdk.services.quicksight.QuickSightClient;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.quicksight.model.GenerateEmbedUrlForRegisteredUserRequest;
|
||||
import software.amazon.awssdk.services.quicksight.model.GenerateEmbedUrlForRegisteredUserResponse;
|
||||
import software.amazon.awssdk.services.quicksight.model.RegisteredUserDashboardEmbeddingConfiguration;
|
||||
import software.amazon.awssdk.services.quicksight.model.RegisteredUserEmbeddingExperienceConfiguration;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class QuickSightChartRenderer extends AbstractWidgetRenderer
|
||||
{
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public Object render(QInstance qInstance, QSession session, QWidgetMetaDataInterface metaData) throws QException
|
||||
{
|
||||
try
|
||||
{
|
||||
QuickSightChartMetaData quickSightMetaData = (QuickSightChartMetaData) metaData;
|
||||
QuickSightClient quickSightClient = getQuickSightClient(quickSightMetaData);
|
||||
|
||||
final RegisteredUserEmbeddingExperienceConfiguration experienceConfiguration = RegisteredUserEmbeddingExperienceConfiguration.builder()
|
||||
.dashboard(
|
||||
RegisteredUserDashboardEmbeddingConfiguration.builder()
|
||||
.initialDashboardId(quickSightMetaData.getDashboardId())
|
||||
.build())
|
||||
.build();
|
||||
|
||||
final GenerateEmbedUrlForRegisteredUserRequest generateEmbedUrlForRegisteredUserRequest = GenerateEmbedUrlForRegisteredUserRequest.builder()
|
||||
.awsAccountId(quickSightMetaData.getAccountId())
|
||||
.userArn(quickSightMetaData.getUserArn())
|
||||
.experienceConfiguration(experienceConfiguration)
|
||||
.build();
|
||||
|
||||
final GenerateEmbedUrlForRegisteredUserResponse generateEmbedUrlForRegisteredUserResponse = quickSightClient.generateEmbedUrlForRegisteredUser(generateEmbedUrlForRegisteredUserRequest);
|
||||
|
||||
String embedUrl = generateEmbedUrlForRegisteredUserResponse.embedUrl();
|
||||
return (new QuickSightChart(metaData.getName(), quickSightMetaData.getLabel(), embedUrl));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw (new QException("Error rendering widget", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private QuickSightClient getQuickSightClient(QuickSightChartMetaData metaData)
|
||||
{
|
||||
AwsBasicCredentials awsCredentials = AwsBasicCredentials.create(metaData.getAccessKey(), metaData.getSecretKey());
|
||||
|
||||
QuickSightClient amazonQuickSightClient = QuickSightClient.builder()
|
||||
.credentialsProvider(StaticCredentialsProvider.create(awsCredentials))
|
||||
.region(Region.of(metaData.getRegion()))
|
||||
.build();
|
||||
|
||||
return (amazonQuickSightClient);
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,7 @@ package com.kingsrook.qqq.backend.core.actions.dashboard;
|
||||
import com.kingsrook.qqq.backend.core.actions.customizers.QCodeLoader;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
|
||||
|
||||
@ -19,8 +19,9 @@ public class WidgetDataLoader
|
||||
*******************************************************************************/
|
||||
public Object execute(QInstance qInstance, QSession session, String name) throws QException
|
||||
{
|
||||
QWidgetMetaData widget = qInstance.getWidget(name);
|
||||
QWidgetMetaDataInterface widget = qInstance.getWidget(name);
|
||||
AbstractWidgetRenderer widgetRenderer = QCodeLoader.getAdHoc(AbstractWidgetRenderer.class, widget.getCodeReference());
|
||||
return (widgetRenderer.render(qInstance, session));
|
||||
Object w = widgetRenderer.render(qInstance, session, widget);
|
||||
return (widgetRenderer.render(qInstance, session, widget));
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import java.util.List;
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class BarChart
|
||||
public class BarChart implements QWidget
|
||||
{
|
||||
|
||||
/*
|
||||
@ -19,7 +19,6 @@ public class BarChart
|
||||
},
|
||||
*/
|
||||
|
||||
private String type = "barChart";
|
||||
private String title;
|
||||
private Data barChartData;
|
||||
|
||||
@ -34,12 +33,23 @@ public class BarChart
|
||||
setBarChartData(new BarChart.Data()
|
||||
.withLabels(labels)
|
||||
.withDatasets(new BarChart.Data.DataSet()
|
||||
.withLabel("Parcel Invoice Lines")
|
||||
.withLabel(seriesLabel)
|
||||
.withData(data)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getType()
|
||||
{
|
||||
return "barChart";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for title
|
||||
**
|
||||
@ -108,39 +118,6 @@ public class BarChart
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public BarChart withType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public interface QWidget
|
||||
{
|
||||
/*******************************************************************************
|
||||
** Getter for type
|
||||
*******************************************************************************/
|
||||
String getType();
|
||||
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class QuickSightChart implements QWidget
|
||||
{
|
||||
private String label;
|
||||
private String name;
|
||||
private String url;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChart(String name, String label, String url)
|
||||
{
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for type
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getType()
|
||||
{
|
||||
return "quickSightChart";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for url
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for url
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for url
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChart withUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for name
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for name
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for name
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChart withName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for label
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getLabel()
|
||||
{
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for label
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for label
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChart withLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
return (this);
|
||||
}
|
||||
|
||||
}
|
@ -29,7 +29,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.kingsrook.qqq.backend.core.instances.QInstanceValidationKey;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.layout.QAppMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSource;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
|
||||
@ -60,7 +60,7 @@ public class QInstance
|
||||
private Map<String, QProcessMetaData> processes = new LinkedHashMap<>();
|
||||
private Map<String, QAppMetaData> apps = new LinkedHashMap<>();
|
||||
|
||||
private Map<String, QWidgetMetaData> widgets = new LinkedHashMap<>();
|
||||
private Map<String, QWidgetMetaDataInterface> widgets = new LinkedHashMap<>();
|
||||
|
||||
// todo - lock down the object (no more changes allowed) after it's been validated?
|
||||
|
||||
@ -455,7 +455,7 @@ public class QInstance
|
||||
** Getter for widgets
|
||||
**
|
||||
*******************************************************************************/
|
||||
public Map<String, QWidgetMetaData> getWidgets()
|
||||
public Map<String, QWidgetMetaDataInterface> getWidgets()
|
||||
{
|
||||
return widgets;
|
||||
}
|
||||
@ -466,7 +466,7 @@ public class QInstance
|
||||
** Setter for widgets
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setWidgets(Map<String, QWidgetMetaData> widgets)
|
||||
public void setWidgets(Map<String, QWidgetMetaDataInterface> widgets)
|
||||
{
|
||||
this.widgets = widgets;
|
||||
}
|
||||
@ -475,7 +475,7 @@ public class QInstance
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void addWidget(QWidgetMetaData widget)
|
||||
public void addWidget(QWidgetMetaDataInterface widget)
|
||||
{
|
||||
this.addWidget(widget.getName(), widget);
|
||||
}
|
||||
@ -485,7 +485,7 @@ public class QInstance
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void addWidget(String name, QWidgetMetaData widget)
|
||||
public void addWidget(String name, QWidgetMetaDataInterface widget)
|
||||
{
|
||||
if(this.widgets.containsKey(name))
|
||||
{
|
||||
@ -499,7 +499,7 @@ public class QInstance
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QWidgetMetaData getWidget(String name)
|
||||
public QWidgetMetaDataInterface getWidget(String name)
|
||||
{
|
||||
return (this.widgets.get(name));
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class QWidgetMetaData
|
||||
public class QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
{
|
||||
private String name;
|
||||
private QCodeReference codeReference;
|
||||
protected String name;
|
||||
protected QCodeReference codeReference;
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.kingsrook.qqq.backend.core.model.metadata.dashboard;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public interface QWidgetMetaDataInterface
|
||||
{
|
||||
/*******************************************************************************
|
||||
** Getter for name
|
||||
*******************************************************************************/
|
||||
String getName();
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for name
|
||||
*******************************************************************************/
|
||||
void setName(String name);
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for name
|
||||
*******************************************************************************/
|
||||
QWidgetMetaDataInterface withName(String name);
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for codeReference
|
||||
*******************************************************************************/
|
||||
QCodeReference getCodeReference();
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for codeReference
|
||||
*******************************************************************************/
|
||||
void setCodeReference(QCodeReference codeReference);
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for codeReference
|
||||
*******************************************************************************/
|
||||
QWidgetMetaDataInterface withCodeReference(QCodeReference codeReference);
|
||||
|
||||
}
|
@ -0,0 +1,305 @@
|
||||
package com.kingsrook.qqq.backend.core.model.metadata.dashboard;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public class QuickSightChartMetaData extends QWidgetMetaData implements QWidgetMetaDataInterface
|
||||
{
|
||||
private String label;
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
private String dashboardId;
|
||||
private String accountId;
|
||||
private String userArn;
|
||||
private String region;
|
||||
private Collection<String> allowedDomains;
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for name
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for accessKey
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getAccessKey()
|
||||
{
|
||||
return accessKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for accessKey
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setAccessKey(String accessKey)
|
||||
{
|
||||
this.accessKey = accessKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for accessKey
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withAccessKey(String accessKey)
|
||||
{
|
||||
this.accessKey = accessKey;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for label
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getLabel()
|
||||
{
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for label
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for label
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for secretKey
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getSecretKey()
|
||||
{
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for secretKey
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setSecretKey(String secretKey)
|
||||
{
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for secretKey
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withSecretKey(String secretKey)
|
||||
{
|
||||
this.secretKey = secretKey;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for dashboardId
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getDashboardId()
|
||||
{
|
||||
return dashboardId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for dashboardId
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setDashboardId(String dashboardId)
|
||||
{
|
||||
this.dashboardId = dashboardId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for dashboardId
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withDashboardId(String dashboardId)
|
||||
{
|
||||
this.dashboardId = dashboardId;
|
||||
return (this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for accountId
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getAccountId()
|
||||
{
|
||||
return accountId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for accountId
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setAccountId(String accountId)
|
||||
{
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for accountId
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withAccountId(String accountId)
|
||||
{
|
||||
this.accountId = accountId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for userArn
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getUserArn()
|
||||
{
|
||||
return userArn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for userArn
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setUserArn(String userArn)
|
||||
{
|
||||
this.userArn = userArn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for userArn
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withUserArn(String userArn)
|
||||
{
|
||||
this.userArn = userArn;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for region
|
||||
**
|
||||
*******************************************************************************/
|
||||
public String getRegion()
|
||||
{
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for region
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setRegion(String region)
|
||||
{
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for region
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withRegion(String region)
|
||||
{
|
||||
this.region = region;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Getter for allowedDomains
|
||||
**
|
||||
*******************************************************************************/
|
||||
public Collection<String> getAllowedDomains()
|
||||
{
|
||||
return allowedDomains;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Setter for allowedDomains
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void setAllowedDomains(Collection<String> allowedDomains)
|
||||
{
|
||||
this.allowedDomains = allowedDomains;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Fluent setter for allowedDomains
|
||||
**
|
||||
*******************************************************************************/
|
||||
public QuickSightChartMetaData withAllowedDomains(Collection<String> allowedDomains)
|
||||
{
|
||||
this.allowedDomains = allowedDomains;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.BarChart;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
|
||||
|
||||
@ -18,7 +19,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public Object render(QInstance qInstance, QSession session) throws QException
|
||||
public Object render(QInstance qInstance, QSession session, QWidgetMetaDataInterface metaData) throws QException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -25,7 +25,9 @@ package com.kingsrook.qqq.backend.module.rdbms.jdbc;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import com.kingsrook.qqq.backend.module.rdbms.model.metadata.RDBMSBackendMetaData;
|
||||
import io.github.cdimascio.dotenv.Dotenv;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
@ -101,13 +103,14 @@ class ConnectionManagerTest
|
||||
|
||||
private RDBMSBackendMetaData getAuroraBacked()
|
||||
{
|
||||
Dotenv dotenv = Dotenv.configure().load();
|
||||
return new RDBMSBackendMetaData()
|
||||
.withName("aurora-test")
|
||||
.withVendor("aurora")
|
||||
.withHostName("nf-one-development-aurora.cwuhqcx1inwx.us-east-2.rds.amazonaws.com")
|
||||
.withPort(3306)
|
||||
.withDatabaseName("nutrifresh_one")
|
||||
.withUsername("nf_admin")
|
||||
.withPassword("%!2rwcH+fb#WgPg");
|
||||
.withVendor(dotenv.get("RDBMS_VENDOR"))
|
||||
.withHostName(dotenv.get("RDBMS_HOSTNAME"))
|
||||
.withPort(Integer.valueOf(Objects.requireNonNull(dotenv.get("RDBMS_PORT"))))
|
||||
.withDatabaseName(dotenv.get("RDBMS_DATABASE_NAME"))
|
||||
.withUsername(dotenv.get("RDBMS_USERNAME"))
|
||||
.withPassword(dotenv.get("RDBMS_PASSWORD"));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.BarChart;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
|
||||
|
||||
@ -19,7 +20,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public Object render(QInstance qInstance, QSession session) throws QException
|
||||
public Object render(QInstance qInstance, QSession session, QWidgetMetaDataInterface metaData) throws QException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -128,9 +128,9 @@
|
||||
<version>4.10.0</version>
|
||||
<configuration>
|
||||
<propertyFile>/src/main/resources/liquibase/liquibase.properties</propertyFile>
|
||||
<url>${env.LB_DB_URL}</url>
|
||||
<username>${env.LB_DB_USERNAME}</username>
|
||||
<password>${env.LB_DB_PASSWORD}</password>
|
||||
<url>${env.RDBMS_URL}</url>
|
||||
<username>${env.RDBMS_USERNAME}</username>
|
||||
<password>${env.RDBMS_PASSWORD}</password>
|
||||
<contexts>${env.LB_CONTEXTS}</contexts>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -23,6 +23,9 @@ package com.kingsrook.sampleapp;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import com.amazonaws.regions.Regions;
|
||||
import com.kingsrook.qqq.backend.core.actions.dashboard.QuickSightChartRenderer;
|
||||
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QValueException;
|
||||
@ -35,6 +38,8 @@ import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeUsage;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QuickSightChartMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
@ -71,10 +76,6 @@ public class SampleMetaDataProvider
|
||||
public static final String RDBMS_BACKEND_NAME = "rdbms";
|
||||
public static final String FILESYSTEM_BACKEND_NAME = "filesystem";
|
||||
|
||||
public static final String AUTH0_AUTHENTICATION_MODULE_NAME = "auth0";
|
||||
// public static final String AUTH0_BASE_URL = "https://kingsrook.us.auth0.com/";
|
||||
public static final String AUTH0_BASE_URL = "https://nutrifresh-one-development.us.auth0.com/";
|
||||
|
||||
public static final String APP_NAME_GREETINGS = "greetingsApp";
|
||||
public static final String APP_NAME_PEOPLE = "peopleApp";
|
||||
public static final String APP_NAME_MISCELLANEOUS = "miscellaneous";
|
||||
@ -133,6 +134,20 @@ public class SampleMetaDataProvider
|
||||
qInstance.addWidget(new QWidgetMetaData()
|
||||
.withName(PersonsByCreateDateBarChart.class.getSimpleName())
|
||||
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class, null)));
|
||||
|
||||
Dotenv dotenv = Dotenv.configure().load();
|
||||
QWidgetMetaDataInterface quickSightChartMetaData = new QuickSightChartMetaData()
|
||||
.withAccountId(dotenv.get("QUICKSIGHT_ACCCOUNT_ID"))
|
||||
.withAccessKey(dotenv.get("QUICKSIGHT_ACCESS_KEY"))
|
||||
.withSecretKey(dotenv.get("QUICKSIGHT_SECRET_KEY"))
|
||||
.withUserArn(dotenv.get("QUICKSIGHT_USER_ARN"))
|
||||
.withDashboardId("9e452e78-8509-4c81-bb7f-967abfc356da")
|
||||
.withRegion(Regions.US_EAST_2.getName())
|
||||
.withName(QuickSightChartRenderer.class.getSimpleName())
|
||||
.withLabel("Example Quicksight Chart")
|
||||
.withCodeReference(new QCodeReference(QuickSightChartRenderer.class, null));
|
||||
|
||||
qInstance.addWidget(quickSightChartMetaData);
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +168,11 @@ public class SampleMetaDataProvider
|
||||
.withIcon(new QIcon().withName("location_city")))
|
||||
.withChild(qInstance.getProcess(PROCESS_NAME_GREET_INTERACTIVE))
|
||||
.withIcon(new QIcon().withName("waving_hand"))
|
||||
.withWidgets(List.of(PersonsByCreateDateBarChart.class.getSimpleName()))
|
||||
.withWidgets(List.of
|
||||
(
|
||||
PersonsByCreateDateBarChart.class.getSimpleName(),
|
||||
QuickSightChartRenderer.class.getSimpleName()
|
||||
))
|
||||
);
|
||||
|
||||
qInstance.addApp(new QAppMetaData()
|
||||
@ -194,11 +213,11 @@ public class SampleMetaDataProvider
|
||||
Dotenv dotenv = Dotenv.configure().load();
|
||||
return new RDBMSBackendMetaData()
|
||||
.withName(RDBMS_BACKEND_NAME)
|
||||
.withVendor("mysql")
|
||||
.withHostName("127.0.0.1")
|
||||
.withPort(3306)
|
||||
.withDatabaseName("qqq")
|
||||
.withUsername("root")
|
||||
.withVendor(dotenv.get("RDBMS_VENDOR"))
|
||||
.withHostName(dotenv.get("RDBMS_HOSTNAME"))
|
||||
.withPort(Integer.valueOf(Objects.requireNonNull(dotenv.get("RDBMS_PORT"))))
|
||||
.withDatabaseName(dotenv.get("RDBMS_DATABASE_NAME"))
|
||||
.withUsername(dotenv.get("RDBMS_USERNAME"))
|
||||
.withPassword(dotenv.get("RDBMS_PASSWORD"));
|
||||
}
|
||||
else
|
||||
|
@ -7,6 +7,7 @@ import com.kingsrook.qqq.backend.core.actions.dashboard.AbstractWidgetRenderer;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.BarChart;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaDataInterface;
|
||||
import com.kingsrook.qqq.backend.core.model.session.QSession;
|
||||
|
||||
|
||||
@ -19,7 +20,7 @@ public class PersonsByCreateDateBarChart extends AbstractWidgetRenderer
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Override
|
||||
public Object render(QInstance qInstance, QSession session) throws QException
|
||||
public Object render(QInstance qInstance, QSession session, QWidgetMetaDataInterface metaData) throws QException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ class PersonsByCreateDateBarChartTest
|
||||
@Test
|
||||
void test() throws QException
|
||||
{
|
||||
Object widgetData = new PersonsByCreateDateBarChart().render(SampleMetaDataProvider.defineInstance(), new QSession());
|
||||
Object widgetData = new PersonsByCreateDateBarChart().render(SampleMetaDataProvider.defineInstance(), new QSession(), null);
|
||||
assertThat(widgetData).isInstanceOf(BarChart.class);
|
||||
BarChart barChart = (BarChart) widgetData;
|
||||
assertEquals("barChart", barChart.getType());
|
||||
|
Reference in New Issue
Block a user