dce-reactkit 3.2.2-beta.41 → 3.2.2-beta.42

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.
@@ -12,6 +12,7 @@ declare type Props = {
12
12
  [k: string]: any;
13
13
  }[];
14
14
  columns: IntelliTableColumn[];
15
+ csvName?: string;
15
16
  };
16
17
  declare const IntelliTable: React.FC<Props>;
17
18
  export default IntelliTable;
package/dist/esm/index.js CHANGED
@@ -2099,6 +2099,29 @@ const ItemPicker = (props) => {
2099
2099
  React.createElement(NestableItemList, { items: items, onChanged: onChanged }))));
2100
2100
  };
2101
2101
 
2102
+ // Import shared helpers
2103
+ /**
2104
+ * Get a human-readable description of a date (all in ET)
2105
+ * @author Gabe Abrams
2106
+ * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
2107
+ * @returns human-readable description of the date
2108
+ */
2109
+ const getHumanReadableDate = (dateOrTimestamp) => {
2110
+ // Get the date info
2111
+ const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
2112
+ const currYear = getTimeInfoInET().year;
2113
+ // Get the short month description
2114
+ const monthName = getMonthName(month).short;
2115
+ // Create start of description
2116
+ let description = `${monthName} ${day}${getOrdinal(day)}`;
2117
+ // Add on year if it's different
2118
+ if (year !== currYear) {
2119
+ description += ` ${year}`;
2120
+ }
2121
+ // Return description
2122
+ return description;
2123
+ };
2124
+
2102
2125
  /**
2103
2126
  * Path of the route for storing client-side logs
2104
2127
  * @author Gabe Abrams
@@ -2234,6 +2257,7 @@ const genCSV = (data, columns) => {
2234
2257
  .join(','));
2235
2258
  // Add each row
2236
2259
  data.forEach((datum) => {
2260
+ csv += '\n';
2237
2261
  csv += (columns
2238
2262
  .map((column) => {
2239
2263
  let contents;
@@ -2362,6 +2386,11 @@ const IntelliTable = (props) => {
2362
2386
  const data = ((props.data && props.data.length > 0)
2363
2387
  ? props.data
2364
2388
  : [{ id: 'empty-row' }]);
2389
+ if (props.csvName) {
2390
+ (props.csvName.endsWith('.csv')
2391
+ ? props.csvName
2392
+ : `${props.csvName}.csv`);
2393
+ }
2365
2394
  /* -------------- State ------------- */
2366
2395
  // Initial state
2367
2396
  const initColumnVisibilityMap = {};
@@ -3138,14 +3167,24 @@ const LogReviewer = (props) => {
3138
3167
  } },
3139
3168
  React.createElement(FontAwesomeIcon, { icon: faHammer, className: "me-2" }),
3140
3169
  "Action"),
3141
- React.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: () => {
3170
+ React.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: () => {
3142
3171
  dispatch({
3143
3172
  type: ActionType.ToggleFilterDrawer,
3144
3173
  filterDrawer: FilterDrawer.Advanced,
3145
3174
  });
3146
3175
  } },
3147
3176
  React.createElement(FontAwesomeIcon, { icon: faList, className: "me-2" }),
3148
- "Advanced"))));
3177
+ "Advanced"),
3178
+ React.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
3179
+ dispatch({
3180
+ type: ActionType.ResetFilters,
3181
+ initActionErrorFilterState,
3182
+ initAdvancedFilterState,
3183
+ initContextFilterState,
3184
+ initDateFilterState,
3185
+ initTagFilterState,
3186
+ });
3187
+ } }, "Reset All"))));
3149
3188
  // Filter drawer
3150
3189
  let filterDrawer;
3151
3190
  if (expandedFilterDrawer) {
@@ -3934,7 +3973,7 @@ const LogReviewer = (props) => {
3934
3973
  React.createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
3935
3974
  : undefined);
3936
3975
  // Create intelliTable
3937
- const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", id: "logs", data: logs, columns: columns }));
3976
+ const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
3938
3977
  // Main body
3939
3978
  body = (React.createElement(React.Fragment, null,
3940
3979
  filters,
@@ -5181,29 +5220,6 @@ const startMinWait = (minWaitMs) => {
5181
5220
  });
5182
5221
  };
5183
5222
 
5184
- // Import shared helpers
5185
- /**
5186
- * Get a human-readable description of a date (all in ET)
5187
- * @author Gabe Abrams
5188
- * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
5189
- * @returns human-readable description of the date
5190
- */
5191
- const getHumanReadableDate = (dateOrTimestamp) => {
5192
- // Get the date info
5193
- const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
5194
- const currYear = getTimeInfoInET().year;
5195
- // Get the short month description
5196
- const monthName = getMonthName(month).short;
5197
- // Create start of description
5198
- let description = `${monthName} ${day}${getOrdinal(day)}`;
5199
- // Add on year if it's different
5200
- if (year !== currYear) {
5201
- description += ` ${year}`;
5202
- }
5203
- // Return description
5204
- return description;
5205
- };
5206
-
5207
5223
  /**
5208
5224
  * Get the current part of day (morning, evening, etc.)
5209
5225
  * @author Gabe Abrams