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/index.d.ts CHANGED
@@ -441,6 +441,7 @@ declare type Props$1 = {
441
441
  [k: string]: any;
442
442
  }[];
443
443
  columns: IntelliTableColumn[];
444
+ csvName?: string;
444
445
  };
445
446
  declare const IntelliTable: React.FC<Props$1>;
446
447
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.41",
3
+ "version": "3.2.2-beta.42",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -51,6 +51,8 @@ type Props = {
51
51
  }[],
52
52
  // Column information
53
53
  columns: IntelliTableColumn[],
54
+ // Name of the CSV file. If excluded, title is used
55
+ csvName?: string,
54
56
  };
55
57
 
56
58
  // Sort types
@@ -192,6 +194,16 @@ const IntelliTable: React.FC<Props> = (props) => {
192
194
  : [{ id: 'empty-row' }]
193
195
  );
194
196
 
197
+ // Get CSV filename
198
+ let filename = `${title}.csv`;
199
+ if (props.csvName) {
200
+ filename = (
201
+ props.csvName.endsWith('.csv')
202
+ ? props.csvName
203
+ : `${props.csvName}.csv`
204
+ );
205
+ }
206
+
195
207
  /* -------------- State ------------- */
196
208
 
197
209
  // Initial state
@@ -22,6 +22,7 @@ import {
22
22
  import visitServerEndpoint from '../helpers/visitServerEndpoint';
23
23
  import getTimeInfoInET from '../helpers/getTimeInfoInET';
24
24
  import { alert, showFatalError } from './AppWrapper';
25
+ import getHumanReadableDate from '../helpers/getHumanReadableDate';
25
26
 
26
27
  // Import shared constants
27
28
  import LOG_REVIEW_ROUTE_PATH_PREFIX from '../constants/LOG_REVIEW_ROUTE_PATH_PREFIX';
@@ -901,7 +902,7 @@ const LogReviewer: React.FC<Props> = (props) => {
901
902
  <button
902
903
  type="button"
903
904
  id="LogReviewer-toggle-advanced-filter-drawer"
904
- className={`btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'}`}
905
+ className={`btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'} me-2`}
905
906
  aria-label="toggle advanced filter drawer"
906
907
  onClick={() => {
907
908
  dispatch({
@@ -916,6 +917,25 @@ const LogReviewer: React.FC<Props> = (props) => {
916
917
  />
917
918
  Advanced
918
919
  </button>
920
+ {/* Reset */}
921
+ <button
922
+ type="button"
923
+ id="LogReviewer-reset-filters-button"
924
+ className="btn btn-light"
925
+ aria-label="reset filters"
926
+ onClick={() => {
927
+ dispatch({
928
+ type: ActionType.ResetFilters,
929
+ initActionErrorFilterState,
930
+ initAdvancedFilterState,
931
+ initContextFilterState,
932
+ initDateFilterState,
933
+ initTagFilterState,
934
+ });
935
+ }}
936
+ >
937
+ Reset All
938
+ </button>
919
939
  </div>
920
940
  </div>
921
941
  );
@@ -2131,6 +2151,7 @@ const LogReviewer: React.FC<Props> = (props) => {
2131
2151
  const dataTable = (
2132
2152
  <IntelliTable
2133
2153
  title="Matching Logs:"
2154
+ csvName={`Logs from ${getHumanReadableDate()}`}
2134
2155
  id="logs"
2135
2156
  data={logs}
2136
2157
  columns={columns}
@@ -43,6 +43,7 @@ const genCSV = (
43
43
 
44
44
  // Add each row
45
45
  data.forEach((datum) => {
46
+ csv += '\n';
46
47
  csv += (
47
48
  columns
48
49
  .map((column) => {