mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
add pvs filters (via post) to table endpoint; more test coverage, plus maybe report on untested classes in ci
This commit is contained in:
@ -24,6 +24,11 @@ commands:
|
|||||||
sudo apt install -y openjdk-17-jdk
|
sudo apt install -y openjdk-17-jdk
|
||||||
sudo rm /etc/alternatives/java
|
sudo rm /etc/alternatives/java
|
||||||
sudo ln -s /usr/lib/jvm/java-17-openjdk-amd64/bin/java /etc/alternatives/java
|
sudo ln -s /usr/lib/jvm/java-17-openjdk-amd64/bin/java /etc/alternatives/java
|
||||||
|
- run:
|
||||||
|
name: Install html2text
|
||||||
|
command: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y html2text
|
||||||
|
|
||||||
mvn_verify:
|
mvn_verify:
|
||||||
steps:
|
steps:
|
||||||
@ -59,6 +64,10 @@ commands:
|
|||||||
when: always
|
when: always
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: ~/test-results
|
path: ~/test-results
|
||||||
|
- find_untested_classes:
|
||||||
|
name: Find Un-tested Classes
|
||||||
|
command: |
|
||||||
|
for i in */target/site/jacoco/*/index.html; do html2text -width 500 -nobs $i | sed '1,/^Total/d;' | grep -v Created | sed 's/ \+/ /g' | sed 's/ [[:digit:]]$//' | grep -v 0$ | cut -d' ' -f1; done
|
||||||
- save_cache:
|
- save_cache:
|
||||||
paths:
|
paths:
|
||||||
- ~/.m2
|
- ~/.m2
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* QQQ - Low-code Application Framework for Engineers.
|
||||||
|
* Copyright (C) 2021-2023. 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.actions.dashboard.widgets;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.WidgetType;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Unit test for DefaultWidgetRenderer
|
||||||
|
*******************************************************************************/
|
||||||
|
class DefaultWidgetRendererTest
|
||||||
|
{
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Test
|
||||||
|
void test() throws QException
|
||||||
|
{
|
||||||
|
RenderWidgetInput input = new RenderWidgetInput();
|
||||||
|
input.setWidgetMetaData(new QWidgetMetaData().withType(WidgetType.PIE_CHART.getType()));
|
||||||
|
RenderWidgetOutput output = new DefaultWidgetRenderer().render(input);
|
||||||
|
assertEquals(WidgetType.PIE_CHART.getType(), output.getWidgetData().getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* QQQ - Low-code Application Framework for Engineers.
|
||||||
|
* Copyright (C) 2021-2023. 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.actions.dashboard.widgets;
|
||||||
|
|
||||||
|
|
||||||
|
import com.kingsrook.qqq.backend.core.BaseTest;
|
||||||
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
|
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Unit test for com.kingsrook.qqq.backend.core.actions.dashboard.widgets.DividerWidgetRenderer
|
||||||
|
*******************************************************************************/
|
||||||
|
class DividerWidgetRendererTest extends BaseTest
|
||||||
|
{
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
@Test
|
||||||
|
void test() throws QException
|
||||||
|
{
|
||||||
|
new DividerWidgetRenderer().render(new RenderWidgetInput());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -57,6 +57,7 @@ import com.kingsrook.qqq.backend.core.actions.values.SearchPossibleValueSourceAc
|
|||||||
import com.kingsrook.qqq.backend.core.adapters.QInstanceAdapter;
|
import com.kingsrook.qqq.backend.core.adapters.QInstanceAdapter;
|
||||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QAuthenticationException;
|
import com.kingsrook.qqq.backend.core.exceptions.QAuthenticationException;
|
||||||
|
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QInstanceValidationException;
|
import com.kingsrook.qqq.backend.core.exceptions.QInstanceValidationException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QModuleDispatchException;
|
import com.kingsrook.qqq.backend.core.exceptions.QModuleDispatchException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
||||||
@ -333,6 +334,7 @@ public class QJavalinImplementation
|
|||||||
get("/export/{filename}", QJavalinImplementation::dataExportWithFilename);
|
get("/export/{filename}", QJavalinImplementation::dataExportWithFilename);
|
||||||
post("/export/{filename}", QJavalinImplementation::dataExportWithFilename);
|
post("/export/{filename}", QJavalinImplementation::dataExportWithFilename);
|
||||||
get("/possibleValues/{fieldName}", QJavalinImplementation::possibleValues);
|
get("/possibleValues/{fieldName}", QJavalinImplementation::possibleValues);
|
||||||
|
post("/possibleValues/{fieldName}", QJavalinImplementation::possibleValues);
|
||||||
|
|
||||||
// todo - add put and/or patch at this level (without a primaryKey) to do a bulk update based on primaryKeys in the records.
|
// todo - add put and/or patch at this level (without a primaryKey) to do a bulk update based on primaryKeys in the records.
|
||||||
path("/{primaryKey}", () ->
|
path("/{primaryKey}", () ->
|
||||||
@ -1257,8 +1259,6 @@ public class QJavalinImplementation
|
|||||||
{
|
{
|
||||||
String tableName = context.pathParam("table");
|
String tableName = context.pathParam("table");
|
||||||
String fieldName = context.pathParam("fieldName");
|
String fieldName = context.pathParam("fieldName");
|
||||||
String searchTerm = context.queryParam("searchTerm");
|
|
||||||
String ids = context.queryParam("ids");
|
|
||||||
|
|
||||||
QTableMetaData table = qInstance.getTable(tableName);
|
QTableMetaData table = qInstance.getTable(tableName);
|
||||||
if(table == null)
|
if(table == null)
|
||||||
@ -1281,11 +1281,46 @@ public class QJavalinImplementation
|
|||||||
throw (new QNotFoundException("Field " + fieldName + " in table " + tableName + " is not associated with a possible value source."));
|
throw (new QNotFoundException("Field " + fieldName + " in table " + tableName + " is not associated with a possible value source."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishPossibleValuesRequest(context, field);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
handleException(context, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
static void finishPossibleValuesRequest(Context context, QFieldMetaData field) throws IOException, QException
|
||||||
|
{
|
||||||
|
String searchTerm = context.queryParam("searchTerm");
|
||||||
|
String ids = context.queryParam("ids");
|
||||||
|
|
||||||
|
Map<String, Serializable> values = new HashMap<>();
|
||||||
|
if(context.formParamMap().containsKey("values"))
|
||||||
|
{
|
||||||
|
List<String> valuesParamList = context.formParamMap().get("values");
|
||||||
|
if(CollectionUtils.nullSafeHasContents(valuesParamList))
|
||||||
|
{
|
||||||
|
String valuesParam = valuesParamList.get(0);
|
||||||
|
values = JsonUtils.toObject(valuesParam, Map.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SearchPossibleValueSourceInput input = new SearchPossibleValueSourceInput();
|
SearchPossibleValueSourceInput input = new SearchPossibleValueSourceInput();
|
||||||
setupSession(context, input);
|
setupSession(context, input);
|
||||||
input.setPossibleValueSourceName(field.getPossibleValueSourceName());
|
input.setPossibleValueSourceName(field.getPossibleValueSourceName());
|
||||||
input.setSearchTerm(searchTerm);
|
input.setSearchTerm(searchTerm);
|
||||||
|
|
||||||
|
if(field.getPossibleValueSourceFilter() != null)
|
||||||
|
{
|
||||||
|
field.getPossibleValueSourceFilter().interpretValues(values);
|
||||||
|
input.setDefaultQueryFilter(field.getPossibleValueSourceFilter());
|
||||||
|
}
|
||||||
|
|
||||||
if(StringUtils.hasContent(ids))
|
if(StringUtils.hasContent(ids))
|
||||||
{
|
{
|
||||||
List<Serializable> idList = new ArrayList<>(Arrays.asList(ids.split(",")));
|
List<Serializable> idList = new ArrayList<>(Arrays.asList(ids.split(",")));
|
||||||
@ -1298,11 +1333,6 @@ public class QJavalinImplementation
|
|||||||
result.put("options", output.getResults());
|
result.put("options", output.getResults());
|
||||||
context.result(JsonUtils.toJson(result));
|
context.result(JsonUtils.toJson(result));
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
handleException(context, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ import com.kingsrook.qqq.backend.core.actions.processes.RunProcessAction;
|
|||||||
import com.kingsrook.qqq.backend.core.actions.reporting.GenerateReportAction;
|
import com.kingsrook.qqq.backend.core.actions.reporting.GenerateReportAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
import com.kingsrook.qqq.backend.core.actions.values.QValueFormatter;
|
||||||
import com.kingsrook.qqq.backend.core.actions.values.SearchPossibleValueSourceAction;
|
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
import com.kingsrook.qqq.backend.core.exceptions.QNotFoundException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QPermissionDeniedException;
|
import com.kingsrook.qqq.backend.core.exceptions.QPermissionDeniedException;
|
||||||
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
|
||||||
@ -66,8 +65,6 @@ import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput;
|
|||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
|
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.values.SearchPossibleValueSourceInput;
|
|
||||||
import com.kingsrook.qqq.backend.core.model.actions.values.SearchPossibleValueSourceOutput;
|
|
||||||
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||||
@ -749,19 +746,6 @@ public class QJavalinProcessHandler
|
|||||||
{
|
{
|
||||||
String processName = context.pathParam("processName");
|
String processName = context.pathParam("processName");
|
||||||
String fieldName = context.pathParam("fieldName");
|
String fieldName = context.pathParam("fieldName");
|
||||||
String searchTerm = context.queryParam("searchTerm");
|
|
||||||
String ids = context.queryParam("ids");
|
|
||||||
|
|
||||||
Map<String, Serializable> values = new HashMap<>();
|
|
||||||
if(context.formParamMap().containsKey("values"))
|
|
||||||
{
|
|
||||||
List<String> valuesParamList = context.formParamMap().get("values");
|
|
||||||
if(CollectionUtils.nullSafeHasContents(valuesParamList))
|
|
||||||
{
|
|
||||||
String valuesParam = valuesParamList.get(0);
|
|
||||||
values = JsonUtils.toObject(valuesParam, Map.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcessMetaData process = QJavalinImplementation.qInstance.getProcess(processName);
|
QProcessMetaData process = QJavalinImplementation.qInstance.getProcess(processName);
|
||||||
if(process == null)
|
if(process == null)
|
||||||
@ -777,28 +761,7 @@ public class QJavalinProcessHandler
|
|||||||
throw (new QNotFoundException("Field " + fieldName + " in process " + processName + " is not associated with a possible value source."));
|
throw (new QNotFoundException("Field " + fieldName + " in process " + processName + " is not associated with a possible value source."));
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchPossibleValueSourceInput input = new SearchPossibleValueSourceInput();
|
QJavalinImplementation.finishPossibleValuesRequest(context, field);
|
||||||
QJavalinImplementation.setupSession(context, input);
|
|
||||||
input.setPossibleValueSourceName(field.getPossibleValueSourceName());
|
|
||||||
input.setSearchTerm(searchTerm);
|
|
||||||
|
|
||||||
if(field.getPossibleValueSourceFilter() != null)
|
|
||||||
{
|
|
||||||
field.getPossibleValueSourceFilter().interpretValues(values);
|
|
||||||
input.setDefaultQueryFilter(field.getPossibleValueSourceFilter());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(StringUtils.hasContent(ids))
|
|
||||||
{
|
|
||||||
List<Serializable> idList = new ArrayList<>(Arrays.asList(ids.split(",")));
|
|
||||||
input.setIdList(idList);
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchPossibleValueSourceOutput output = new SearchPossibleValueSourceAction().execute(input);
|
|
||||||
|
|
||||||
Map<String, Object> result = new HashMap<>();
|
|
||||||
result.put("options", output.getResults());
|
|
||||||
context.result(JsonUtils.toJson(result));
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user