dce-reactkit 3.2.2-beta.41 → 3.2.2-beta.44
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/cjs/index.js +46 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/IntelliTable.d.ts +1 -0
- package/dist/esm/index.js +46 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/IntelliTable.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/CSVDownloadButton.tsx +1 -1
- package/src/components/IntelliTable.tsx +13 -1
- package/src/components/LogReviewer.tsx +22 -1
- package/src/helpers/genCSV.ts +1 -0
package/dist/cjs/index.js
CHANGED
|
@@ -2107,6 +2107,29 @@ const ItemPicker = (props) => {
|
|
|
2107
2107
|
React__default["default"].createElement(NestableItemList, { items: items, onChanged: onChanged }))));
|
|
2108
2108
|
};
|
|
2109
2109
|
|
|
2110
|
+
// Import shared helpers
|
|
2111
|
+
/**
|
|
2112
|
+
* Get a human-readable description of a date (all in ET)
|
|
2113
|
+
* @author Gabe Abrams
|
|
2114
|
+
* @param [dateOrTimestamp=today] the date or timestamp for the date to describe
|
|
2115
|
+
* @returns human-readable description of the date
|
|
2116
|
+
*/
|
|
2117
|
+
const getHumanReadableDate = (dateOrTimestamp) => {
|
|
2118
|
+
// Get the date info
|
|
2119
|
+
const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
|
|
2120
|
+
const currYear = getTimeInfoInET().year;
|
|
2121
|
+
// Get the short month description
|
|
2122
|
+
const monthName = getMonthName(month).short;
|
|
2123
|
+
// Create start of description
|
|
2124
|
+
let description = `${monthName} ${day}${getOrdinal(day)}`;
|
|
2125
|
+
// Add on year if it's different
|
|
2126
|
+
if (year !== currYear) {
|
|
2127
|
+
description += ` ${year}`;
|
|
2128
|
+
}
|
|
2129
|
+
// Return description
|
|
2130
|
+
return description;
|
|
2131
|
+
};
|
|
2132
|
+
|
|
2110
2133
|
/**
|
|
2111
2134
|
* Path of the route for storing client-side logs
|
|
2112
2135
|
* @author Gabe Abrams
|
|
@@ -2242,6 +2265,7 @@ const genCSV = (data, columns) => {
|
|
|
2242
2265
|
.join(','));
|
|
2243
2266
|
// Add each row
|
|
2244
2267
|
data.forEach((datum) => {
|
|
2268
|
+
csv += '\n';
|
|
2245
2269
|
csv += (columns
|
|
2246
2270
|
.map((column) => {
|
|
2247
2271
|
let contents;
|
|
@@ -2289,7 +2313,7 @@ const CSVDownloadButton = (props) => {
|
|
|
2289
2313
|
/* Main UI */
|
|
2290
2314
|
/*----------------------------------------*/
|
|
2291
2315
|
// Render the button
|
|
2292
|
-
return (React__default["default"].createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${csv}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
|
|
2316
|
+
return (React__default["default"].createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${encodeURIComponent(csv)}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
|
|
2293
2317
|
? `Click to download ${filename}`
|
|
2294
2318
|
: ariaLabel), style: style, onClick: onClick },
|
|
2295
2319
|
!children && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
@@ -2370,6 +2394,13 @@ const IntelliTable = (props) => {
|
|
|
2370
2394
|
const data = ((props.data && props.data.length > 0)
|
|
2371
2395
|
? props.data
|
|
2372
2396
|
: [{ id: 'empty-row' }]);
|
|
2397
|
+
// Get CSV filename
|
|
2398
|
+
let filename = `${title}.csv`;
|
|
2399
|
+
if (props.csvName) {
|
|
2400
|
+
filename = (props.csvName.endsWith('.csv')
|
|
2401
|
+
? props.csvName
|
|
2402
|
+
: `${props.csvName}.csv`);
|
|
2403
|
+
}
|
|
2373
2404
|
/* -------------- State ------------- */
|
|
2374
2405
|
// Initial state
|
|
2375
2406
|
const initColumnVisibilityMap = {};
|
|
@@ -2642,7 +2673,7 @@ const IntelliTable = (props) => {
|
|
|
2642
2673
|
React__default["default"].createElement("div", { className: "d-flex align-items-center justify-content-start" },
|
|
2643
2674
|
React__default["default"].createElement("h3", { className: "m-0" }, title),
|
|
2644
2675
|
React__default["default"].createElement("div", { className: "flex-grow-1 text-end" },
|
|
2645
|
-
React__default["default"].createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename:
|
|
2676
|
+
React__default["default"].createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
|
|
2646
2677
|
React__default["default"].createElement("button", { type: "button", className: "btn btn-secondary ms-2", "aria-label": `show panel for customizing which columns show in table ${title}`, id: `IntelliTable-${id}-show-column-customization-modal`, onClick: () => {
|
|
2647
2678
|
dispatch({
|
|
2648
2679
|
type: ActionType$1.ToggleColVisCusModalVisibility,
|
|
@@ -3146,14 +3177,24 @@ const LogReviewer = (props) => {
|
|
|
3146
3177
|
} },
|
|
3147
3178
|
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faHammer, className: "me-2" }),
|
|
3148
3179
|
"Action"),
|
|
3149
|
-
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'}`, "aria-label": "toggle advanced filter drawer", onClick: () => {
|
|
3180
|
+
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle advanced filter drawer", onClick: () => {
|
|
3150
3181
|
dispatch({
|
|
3151
3182
|
type: ActionType.ToggleFilterDrawer,
|
|
3152
3183
|
filterDrawer: FilterDrawer.Advanced,
|
|
3153
3184
|
});
|
|
3154
3185
|
} },
|
|
3155
3186
|
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faList, className: "me-2" }),
|
|
3156
|
-
"Advanced")
|
|
3187
|
+
"Advanced"),
|
|
3188
|
+
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
|
|
3189
|
+
dispatch({
|
|
3190
|
+
type: ActionType.ResetFilters,
|
|
3191
|
+
initActionErrorFilterState,
|
|
3192
|
+
initAdvancedFilterState,
|
|
3193
|
+
initContextFilterState,
|
|
3194
|
+
initDateFilterState,
|
|
3195
|
+
initTagFilterState,
|
|
3196
|
+
});
|
|
3197
|
+
} }, "Reset All"))));
|
|
3157
3198
|
// Filter drawer
|
|
3158
3199
|
let filterDrawer;
|
|
3159
3200
|
if (expandedFilterDrawer) {
|
|
@@ -3942,7 +3983,7 @@ const LogReviewer = (props) => {
|
|
|
3942
3983
|
React__default["default"].createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
|
|
3943
3984
|
: undefined);
|
|
3944
3985
|
// Create intelliTable
|
|
3945
|
-
const dataTable = (React__default["default"].createElement(IntelliTable, { title: "Matching Logs:", id: "logs", data: logs, columns: columns }));
|
|
3986
|
+
const dataTable = (React__default["default"].createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
|
|
3946
3987
|
// Main body
|
|
3947
3988
|
body = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
3948
3989
|
filters,
|
|
@@ -5189,29 +5230,6 @@ const startMinWait = (minWaitMs) => {
|
|
|
5189
5230
|
});
|
|
5190
5231
|
};
|
|
5191
5232
|
|
|
5192
|
-
// Import shared helpers
|
|
5193
|
-
/**
|
|
5194
|
-
* Get a human-readable description of a date (all in ET)
|
|
5195
|
-
* @author Gabe Abrams
|
|
5196
|
-
* @param [dateOrTimestamp=today] the date or timestamp for the date to describe
|
|
5197
|
-
* @returns human-readable description of the date
|
|
5198
|
-
*/
|
|
5199
|
-
const getHumanReadableDate = (dateOrTimestamp) => {
|
|
5200
|
-
// Get the date info
|
|
5201
|
-
const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
|
|
5202
|
-
const currYear = getTimeInfoInET().year;
|
|
5203
|
-
// Get the short month description
|
|
5204
|
-
const monthName = getMonthName(month).short;
|
|
5205
|
-
// Create start of description
|
|
5206
|
-
let description = `${monthName} ${day}${getOrdinal(day)}`;
|
|
5207
|
-
// Add on year if it's different
|
|
5208
|
-
if (year !== currYear) {
|
|
5209
|
-
description += ` ${year}`;
|
|
5210
|
-
}
|
|
5211
|
-
// Return description
|
|
5212
|
-
return description;
|
|
5213
|
-
};
|
|
5214
|
-
|
|
5215
5233
|
/**
|
|
5216
5234
|
* Get the current part of day (morning, evening, etc.)
|
|
5217
5235
|
* @author Gabe Abrams
|