diff --git a/src/qqq/components/misc/SavedViews.tsx b/src/qqq/components/misc/SavedViews.tsx
index 9407d3c..2000137 100644
--- a/src/qqq/components/misc/SavedViews.tsx
+++ b/src/qqq/components/misc/SavedViews.tsx
@@ -87,7 +87,7 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, tab
const RENAME_OPTION = "Rename...";
const DELETE_OPTION = "Delete...";
const CLEAR_OPTION = "New View";
- const dropdownOptions = [DUPLICATE_OPTION, RENAME_OPTION, DELETE_OPTION, CLEAR_OPTION];
+ const NEW_REPORT_OPTION = "Create Report from Current View";
const {accentColor, accentColorLight} = useContext(QContext);
@@ -187,10 +187,26 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, tab
case DELETE_OPTION:
setIsDeleteFilter(true)
break;
+ case NEW_REPORT_OPTION:
+ createNewReport();
+ break;
}
}
+ /*******************************************************************************
+ **
+ *******************************************************************************/
+ function createNewReport()
+ {
+ const defaultValues: {[key: string]: any} = {};
+ defaultValues.tableName = tableMetaData.name;
+ defaultValues.queryFilterJson = JSON.stringify(view.queryFilter, null, 3);
+ defaultValues.columnsJson = JSON.stringify(view.queryColumns, null, 3);
+ navigate(`${metaData.getTablePathByName("savedReport")}/create#defaultValues=${encodeURIComponent(JSON.stringify(defaultValues))}`);
+ }
+
+
/*******************************************************************************
** fired when save or delete button saved on confirmation dialogs
@@ -376,6 +392,7 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, tab
const hasStorePermission = metaData?.processes.has("storeSavedView");
const hasDeletePermission = metaData?.processes.has("deleteSavedView");
const hasQueryPermission = metaData?.processes.has("querySavedView");
+ const hasSavedReportsPermission = metaData?.tables.has("savedReport");
const tooltipMaxWidth = (maxWidth: string) =>
{
@@ -429,7 +446,7 @@ function SavedViews({qController, metaData, tableMetaData, currentSavedView, tab
}
{
- hasStorePermission && currentSavedView != null &&
+ hasDeletePermission && currentSavedView != null &&
}
+ {
+ hasSavedReportsPermission &&
+
+
+
+ }
{