added initial version of branding as metadata

This commit is contained in:
Tim Chamberlain
2022-09-06 19:00:12 -05:00
parent 25c9376ce4
commit 1c75df3a09
10 changed files with 237 additions and 19 deletions

View File

@ -109,6 +109,14 @@ public class MetaDataAction
}
metaDataOutput.setAppTree(appTree);
////////////////////////////////////
// add branding metadata if found //
////////////////////////////////////
if(metaDataInput.getInstance().getBranding() != null)
{
metaDataOutput.setBranding(metaDataInput.getInstance().getBranding());
}
// todo post-customization - can do whatever w/ the result if you want?
return metaDataOutput;

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.core.model.actions.metadata;
import java.util.List;
import java.util.Map;
import com.kingsrook.qqq.backend.core.model.actions.AbstractActionOutput;
import com.kingsrook.qqq.backend.core.model.metadata.branding.QBrandingMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.frontend.AppTreeNode;
import com.kingsrook.qqq.backend.core.model.metadata.frontend.QFrontendAppMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.frontend.QFrontendProcessMetaData;
@ -43,6 +44,8 @@ public class MetaDataOutput extends AbstractActionOutput
private List<AppTreeNode> appTree;
private QBrandingMetaData branding;
/*******************************************************************************
@ -89,7 +92,6 @@ public class MetaDataOutput extends AbstractActionOutput
/*******************************************************************************
** Getter for appTree
**
@ -131,4 +133,26 @@ public class MetaDataOutput extends AbstractActionOutput
{
this.apps = apps;
}
/*******************************************************************************
** Getter for branding
**
*******************************************************************************/
public QBrandingMetaData getBranding()
{
return branding;
}
/*******************************************************************************
** Setter for branding
**
*******************************************************************************/
public void setBranding(QBrandingMetaData branding)
{
this.branding = branding;
}
}

View File

@ -26,7 +26,7 @@ import java.util.List;
/*******************************************************************************
** Model containing datastructure expected by frontend material dashboard bar chart widget
** Model containing datastructure expected by frontend bar chart widget
**
*******************************************************************************/
public class BarChart implements QWidget

View File

@ -23,7 +23,7 @@ package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
/*******************************************************************************
** Interface for frontend material dashboard widget's datastructures
** Interface for frontend widget's datastructures
**
*******************************************************************************/
public interface QWidget

View File

@ -23,8 +23,8 @@ package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
/*******************************************************************************
** Model containing datastructure expected by frontend material dashboard
** AWS quick sight widget
** Model containing datastructure expected by frontend AWS quick sight widget
** TODO: this might just be an IFrameChart widget in the future
**
*******************************************************************************/
public class QuickSightChart implements QWidget

View File

@ -30,6 +30,7 @@ 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.automation.QAutomationProviderMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.branding.QBrandingMetaData;
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;
@ -53,6 +54,7 @@ public class QInstance
private Map<String, QBackendMetaData> backends = new HashMap<>();
private QAuthenticationMetaData authentication = null;
private QBrandingMetaData branding = null;
private Map<String, QAutomationProviderMetaData> automationProviders = new HashMap<>();
////////////////////////////////////////////////////////////////////////////////////////////
@ -508,6 +510,28 @@ public class QInstance
/*******************************************************************************
** Getter for branding
**
*******************************************************************************/
public QBrandingMetaData getBranding()
{
return branding;
}
/*******************************************************************************
** Setter for branding
**
*******************************************************************************/
public void setBranding(QBrandingMetaData branding)
{
this.branding = branding;
}
/*******************************************************************************
** Getter for authentication
**
@ -551,6 +575,7 @@ public class QInstance
}
/*******************************************************************************
**
*******************************************************************************/

View File

@ -0,0 +1,148 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2022. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.backend.core.model.metadata.branding;
/*******************************************************************************
** Meta-Data to define branding in a QQQ instance.
**
*******************************************************************************/
public class QBrandingMetaData
{
private String companyName;
private String logo;
private String icon;
/*******************************************************************************
**
*******************************************************************************/
@Override
public String toString()
{
return ("QBrandingMetaData[" + companyName + "]");
}
/*******************************************************************************
** Getter for companyName
**
*******************************************************************************/
public String getCompanyName()
{
return companyName;
}
/*******************************************************************************
** Setter for companyName
**
*******************************************************************************/
public void setCompanyName(String companyName)
{
this.companyName = companyName;
}
/*******************************************************************************
** Fluent setter for companyName
**
*******************************************************************************/
public QBrandingMetaData withCompanyName(String companyName)
{
this.companyName = companyName;
return this;
}
/*******************************************************************************
** Getter for logo
**
*******************************************************************************/
public String getLogo()
{
return logo;
}
/*******************************************************************************
** Setter for logo
**
*******************************************************************************/
public void setLogo(String logo)
{
this.logo = logo;
}
/*******************************************************************************
** Fluent setter for logo
**
*******************************************************************************/
public QBrandingMetaData withLogo(String logo)
{
this.logo = logo;
return this;
}
/*******************************************************************************
** Getter for icon
**
*******************************************************************************/
public String getIcon()
{
return icon;
}
/*******************************************************************************
** Setter for icon
**
*******************************************************************************/
public void setIcon(String icon)
{
this.icon = icon;
}
/*******************************************************************************
** Fluent setter for icon
**
*******************************************************************************/
public QBrandingMetaData withIcon(String icon)
{
this.icon = icon;
return this;
}
}

View File

@ -26,7 +26,7 @@ import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
/*******************************************************************************
** Base metadata for frontend material dashboard widgets
** Base metadata for frontend dashboard widgets
**
*******************************************************************************/
public class QWidgetMetaData implements QWidgetMetaDataInterface

View File

@ -26,7 +26,7 @@ import java.util.Collection;
/*******************************************************************************
** AWS Quicksite specific meta data for frontend material dashboard widget
** AWS Quicksite specific meta data for frontend dashboard widget
**
*******************************************************************************/
public class QuickSightChartMetaData extends QWidgetMetaData implements QWidgetMetaDataInterface

View File

@ -37,6 +37,7 @@ import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInpu
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
import com.kingsrook.qqq.backend.core.model.metadata.QAuthenticationType;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.branding.QBrandingMetaData;
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;
@ -128,7 +129,7 @@ public class SampleMetaDataProvider
qInstance.addProcess(defineProcessSimpleThrow());
defineWidgets(qInstance);
defineBranding(qInstance);
defineApps(qInstance);
return (qInstance);
@ -136,6 +137,18 @@ public class SampleMetaDataProvider
/*******************************************************************************
**
*******************************************************************************/
private static void defineBranding(QInstance qInstance)
{
qInstance.setBranding(new QBrandingMetaData()
.withLogo("/kr-logo.png")
.withIcon("/kr-icon.png"));
}
/*******************************************************************************
**
*******************************************************************************/
@ -146,10 +159,10 @@ public class SampleMetaDataProvider
.withCodeReference(new QCodeReference(PersonsByCreateDateBarChart.class, null)));
QMetaDataVariableInterpreter interpreter = new QMetaDataVariableInterpreter();
String accountId = interpreter.interpret("${env.QUICKSIGHT_ACCOUNT_ID}");
String accessKey = interpreter.interpret("${env.QUICKSIGHT_ACCESS_KEY}");
String secretKey = interpreter.interpret("${env.QUICKSIGHT_SECRET_KEY}");
String userArn = interpreter.interpret("${env.QUICKSIGHT_USER_ARN}");
String accountId = interpreter.interpret("${env.QUICKSIGHT_ACCOUNT_ID}");
String accessKey = interpreter.interpret("${env.QUICKSIGHT_ACCESS_KEY}");
String secretKey = interpreter.interpret("${env.QUICKSIGHT_SECRET_KEY}");
String userArn = interpreter.interpret("${env.QUICKSIGHT_USER_ARN}");
QWidgetMetaDataInterface quickSightChartMetaData = new QuickSightChartMetaData()
.withAccountId(accountId)
@ -219,13 +232,13 @@ public class SampleMetaDataProvider
{
if(USE_MYSQL)
{
QMetaDataVariableInterpreter interpreter = new QMetaDataVariableInterpreter();
String vendor = interpreter.interpret("${env.RDBMS_VENDOR}");
String hostname = interpreter.interpret("${env.RDBMS_HOSTNAME}");
Integer port = Integer.valueOf(interpreter.interpret("${env.RDBMS_PORT}"));
String databaseName = interpreter.interpret("${env.RDBMS_DATABASE_NAME}");
String username = interpreter.interpret("${env.RDBMS_USERNAME}");
String password= interpreter.interpret("${env.RDBMS_PASSWORD}");
QMetaDataVariableInterpreter interpreter = new QMetaDataVariableInterpreter();
String vendor = interpreter.interpret("${env.RDBMS_VENDOR}");
String hostname = interpreter.interpret("${env.RDBMS_HOSTNAME}");
Integer port = Integer.valueOf(interpreter.interpret("${env.RDBMS_PORT}"));
String databaseName = interpreter.interpret("${env.RDBMS_DATABASE_NAME}");
String username = interpreter.interpret("${env.RDBMS_USERNAME}");
String password = interpreter.interpret("${env.RDBMS_PASSWORD}");
return new RDBMSBackendMetaData()
.withName(RDBMS_BACKEND_NAME)