@cellaware/utils 8.5.3 → 8.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chatwms/cosmos.js
CHANGED
|
@@ -6,7 +6,7 @@ const COSMOS_SQL_ACTION_WORDS_REGEX = /\b(insert|update|delete|create|alter|drop
|
|
|
6
6
|
const COSMOS_SQL_SELECT_REGEX = /\b(select)\b/gmi;
|
|
7
7
|
const COSMOS_SQL_FROM_REGEX = /\b(from)\b/gmi;
|
|
8
8
|
const COSMOS_SQL_WHERE_REGEX = /\b(where)\b/gmi;
|
|
9
|
-
const COSMOS_SQL_APPROVED_TABLES_REGEX = /\b(alert_executions|alert_subscriptions|alerts|client_configs|conversation_details|conversation_feedback|conversation_headers|conversation_metadata|conversation_removed_details|conversation_sampled_details|conversation_sampled_metadata|dashboard_usage|dashboard_widgets|dashboards|notifications|report_lines|report_usage|reports|user_roles)\b/gmi;
|
|
9
|
+
const COSMOS_SQL_APPROVED_TABLES_REGEX = /\b(alert_executions|alert_subscriptions|alerts|client_configs|conversation_details|conversation_feedback|conversation_headers|conversation_metadata|conversation_removed_details|conversation_sampled_details|conversation_sampled_metadata|dashboard_usage|dashboard_widgets|dashboards|notifications|report_lines|report_schedules|report_usage|reports|user_roles)\b/gmi;
|
|
10
10
|
const _SUBQUERY_QUERY_PLACEHOLDER_UNWRAPPED = '{{query}}';
|
|
11
11
|
const SUBQUERY_QUERY_PLACEHOLDER = `(${_SUBQUERY_QUERY_PLACEHOLDER_UNWRAPPED})`;
|
|
12
12
|
const VARIABLE_COSMOS_USER_ID = '__USER_ID__';
|
|
@@ -124,6 +124,10 @@ const COSMOS_TABLES = [
|
|
|
124
124
|
table_name: 'report_lines',
|
|
125
125
|
table_description: 'Report Lines'
|
|
126
126
|
},
|
|
127
|
+
{
|
|
128
|
+
table_name: 'report_schedules',
|
|
129
|
+
table_description: 'Report Schedules'
|
|
130
|
+
},
|
|
127
131
|
{
|
|
128
132
|
table_name: 'report_usage',
|
|
129
133
|
table_description: 'Report Usage'
|
|
@@ -126,5 +126,8 @@ export declare function codifyCondition(condition: DatagridCondition): string;
|
|
|
126
126
|
* https://github.com/cellaware/chatwms-az-swa-ng/blob/development/src/app/utils/data.ts#L126
|
|
127
127
|
*/
|
|
128
128
|
export declare function stripNumericValueFormat(value: string | number | undefined): any;
|
|
129
|
+
/**
|
|
130
|
+
* **Important:** `html` output will be limited to **500 rows** and **8 columns**.
|
|
131
|
+
*/
|
|
129
132
|
export declare function transformDatagrid(rows: any[], datagridState: DatagridStateBase, locale: string, condition?: DatagridCondition): DatagridState;
|
|
130
133
|
export {};
|
package/dist/chatwms/datagrid.js
CHANGED
|
@@ -792,7 +792,7 @@ function buildHtmlTableHeader(columnNames) {
|
|
|
792
792
|
function buildHtmlTableFooter() {
|
|
793
793
|
return '\n\t</tbody>\n</table>';
|
|
794
794
|
}
|
|
795
|
-
function buildHtmlRow(rowValues, rowStyles, columnStyles) {
|
|
795
|
+
function buildHtmlRow(rowValues, rowStyles, columnStyles, columnCount) {
|
|
796
796
|
let buf = '';
|
|
797
797
|
// Apply row styles.
|
|
798
798
|
if (rowStyles.length > 0) {
|
|
@@ -804,6 +804,9 @@ function buildHtmlRow(rowValues, rowStyles, columnStyles) {
|
|
|
804
804
|
// Write cell values with styles.
|
|
805
805
|
let colIdx = 0;
|
|
806
806
|
for (const rowValue of rowValues) {
|
|
807
|
+
if (colIdx >= columnCount) {
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
807
810
|
if (columnStyles[colIdx].styles.length > 0) {
|
|
808
811
|
buf += `\n\t\t\t<td class="${columnStyles[colIdx].styles.join(' ')}">${rowValue}</td>`;
|
|
809
812
|
}
|
|
@@ -815,7 +818,12 @@ function buildHtmlRow(rowValues, rowStyles, columnStyles) {
|
|
|
815
818
|
buf += '\n\t\t</tr>';
|
|
816
819
|
return buf;
|
|
817
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* **Important:** `html` output will be limited to **500 rows** and **8 columns**.
|
|
823
|
+
*/
|
|
818
824
|
export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
825
|
+
const HTML_ROWS = 500;
|
|
826
|
+
const HTML_COLS = 8;
|
|
819
827
|
const columnState = datagridState.columnState ?? [];
|
|
820
828
|
const filterModel = datagridState.filterModel ?? {};
|
|
821
829
|
const isPivotMode = !!datagridState.isPivotMode;
|
|
@@ -890,7 +898,9 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
890
898
|
}
|
|
891
899
|
});
|
|
892
900
|
chartRowData.push(chartRow);
|
|
893
|
-
|
|
901
|
+
if (rowIdx < HTML_ROWS) {
|
|
902
|
+
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
903
|
+
}
|
|
894
904
|
rowIdx++;
|
|
895
905
|
});
|
|
896
906
|
if (!!condition) {
|
|
@@ -929,7 +939,9 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
929
939
|
}
|
|
930
940
|
});
|
|
931
941
|
chartRowData.push(chartRow);
|
|
932
|
-
|
|
942
|
+
if (rowIdx < HTML_ROWS) {
|
|
943
|
+
htmlBuf += buildHtmlRow(htmlRowValues, htmlRowStyles, htmlColumnStyles, HTML_COLS);
|
|
944
|
+
}
|
|
933
945
|
rowIdx++;
|
|
934
946
|
});
|
|
935
947
|
if (!!condition) {
|
|
@@ -940,6 +952,6 @@ export function transformDatagrid(rows, datagridState, locale, condition) {
|
|
|
940
952
|
...datagridState,
|
|
941
953
|
adjRowData: rows,
|
|
942
954
|
chartRowData,
|
|
943
|
-
html: `${buildHtmlTableHeader(htmlColumnNames)}${htmlBuf}${buildHtmlTableFooter()}`
|
|
955
|
+
html: `${buildHtmlTableHeader(htmlColumnNames.slice(0, HTML_COLS))}${htmlBuf}${buildHtmlTableFooter()}`
|
|
944
956
|
};
|
|
945
957
|
}
|