@kineticdata/react 6.0.0 → 6.0.1
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/lib/apis/http.js +33 -1
- package/lib/apis/http.test.js +100 -0
- package/lib/apis/system/index.js +141 -10
- package/lib/apis/task/index.js +15 -1
- package/lib/components/agent/bridge/BridgeTable.js +4 -1
- package/lib/components/agent/filestore/FilestoreTable.js +4 -1
- package/lib/components/agent/handler/AgentHandlerTable.js +5 -2
- package/lib/components/common/ToastContainer.js +170 -0
- package/lib/components/common/defaults/Toast.js +26 -0
- package/lib/components/common/defaults/index.js +13 -0
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +7 -3
- package/lib/components/core/bridge_model/BridgeModelTable.js +5 -2
- package/lib/components/core/category/CategoryTable.js +13 -6
- package/lib/components/core/field_definition/FieldDefinitionTable.js +11 -5
- package/lib/components/core/form/FormTable.js +22 -11
- package/lib/components/core/form_type/FormTypeTable.js +3 -1
- package/lib/components/core/index_definition/IndexDefinitionTable.js +12 -5
- package/lib/components/core/kapp/KappTable.js +17 -32
- package/lib/components/core/log/LogTable.js +8 -2
- package/lib/components/core/security_definition/SecurityDefinitionTable.js +9 -4
- package/lib/components/core/submission/FormSubmissionTable.js +37 -19
- package/lib/components/core/submission/KappSubmissionTable.js +37 -19
- package/lib/components/core/team/TeamForm.js +1 -1
- package/lib/components/core/team/TeamTable.js +11 -5
- package/lib/components/core/user/UserTable.js +23 -5
- package/lib/components/core/webapi/WebApiForm.js +49 -30
- package/lib/components/core/webapi/WebApiTable.js +14 -7
- package/lib/components/core/webhook/WebhookTable.js +19 -9
- package/lib/components/core/webhook_job/WebhookJobTable.js +39 -19
- package/lib/components/form/Form.helpers.js +81 -19
- package/lib/components/form/Form.models.js +1 -0
- package/lib/components/index.js +53 -0
- package/lib/components/system/SystemCassandraForm.js +98 -0
- package/lib/components/system/SystemElasticSearchForm.js +98 -0
- package/lib/components/system/SystemFilestoreForm.js +10 -5
- package/lib/components/system/SystemIngressForm.js +77 -29
- package/lib/components/system/SystemTaskAdapterForm.js +29 -5
- package/lib/components/system/SystemTrustedCertificateForm.js +40 -0
- package/lib/components/system/SystemTrustedCertificatesTable.js +74 -0
- package/lib/components/system/helpers.js +226 -45
- package/lib/components/system/spaces/SystemTenantForm.js +75 -34
- package/lib/components/table/Table.js +88 -7
- package/lib/components/table/Table.redux.js +68 -47
- package/lib/components/table/Table.test.js +39 -0
- package/lib/components/table/defaults/ColumnControl.js +26 -0
- package/lib/components/table/defaults/index.js +3 -1
- package/lib/components/task/errors/RunErrorTable.js +33 -14
- package/lib/components/task/handlers/HandlerTable.js +23 -11
- package/lib/components/task/runs/RunTable.js +22 -9
- package/lib/components/task/sources/SourceTable.js +15 -7
- package/lib/components/task/triggers/TriggerTable.js +50 -23
- package/lib/components/task/workflows/LinkedWorkflowTable.js +32 -16
- package/lib/components/task/workflows/WorkflowTable.js +30 -15
- package/lib/index.js +4 -3
- package/package.json +17 -4
- package/proxyhelper.js +17 -11
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.generateTable = exports.generateColumns = exports.extractColumnComponents = exports.buildTableHeaderRow = exports.buildTableHeaderCell = exports.buildTableHeader = exports.buildTableFooterRow = exports.buildTableFooterCells = exports.buildTableFooter = exports.buildTableBodyRows = exports.buildTableBodyCells = exports.buildTableBody = exports.buildTable = exports.Table = void 0;
|
|
8
|
+
exports.sortColumns = exports.getToggleableColumns = exports.generateTable = exports.generateColumns = exports.extractColumnComponents = exports.buildTableHeaderRow = exports.buildTableHeaderCell = exports.buildTableHeader = exports.buildTableFooterRow = exports.buildTableFooterCells = exports.buildTableFooter = exports.buildTableBodyRows = exports.buildTableBodyCells = exports.buildTableBody = exports.buildTable = exports.Table = void 0;
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
@@ -46,7 +46,10 @@ var TableComponent = function TableComponent(props) {
|
|
|
46
46
|
_filterFormKey = props.filterFormKey,
|
|
47
47
|
count = props.count,
|
|
48
48
|
extraData = props.extraData;
|
|
49
|
-
var
|
|
49
|
+
var columnControl = buildColumnControl(props);
|
|
50
|
+
var table = buildTable((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {
|
|
51
|
+
columnControl: columnControl
|
|
52
|
+
}));
|
|
50
53
|
var filter = components.FilterForm ? buildFilterForm(props) : buildFilterLayout(props);
|
|
51
54
|
var pagination = buildPaginationControl(props);
|
|
52
55
|
return children({
|
|
@@ -56,6 +59,7 @@ var TableComponent = function TableComponent(props) {
|
|
|
56
59
|
filter: filter,
|
|
57
60
|
appliedFilters: appliedFilters,
|
|
58
61
|
pagination: pagination,
|
|
62
|
+
columnControl: columnControl,
|
|
59
63
|
initializing: initializing,
|
|
60
64
|
loading: loading,
|
|
61
65
|
rows: rows,
|
|
@@ -283,6 +287,44 @@ var buildPaginationControl = function buildPaginationControl(props) {
|
|
|
283
287
|
extraData: extraData
|
|
284
288
|
});
|
|
285
289
|
};
|
|
290
|
+
var getToggleableColumns = function getToggleableColumns(columns, columnSet, tableKey) {
|
|
291
|
+
return columns.reduce(function (list, column) {
|
|
292
|
+
var label = column.get('columnLabel') && column.get('columnLabel').trim() || column.get('title') && column.get('title').trim();
|
|
293
|
+
// Include all columns that have a columnLabel or title, and are toggleable
|
|
294
|
+
// or are in the initial columnSet
|
|
295
|
+
if (label && (column.get('toggleable') || columnSet.includes(column.get('value')))) {
|
|
296
|
+
return list.push((0, _immutable.Map)({
|
|
297
|
+
value: column.get('value'),
|
|
298
|
+
label: label,
|
|
299
|
+
checked: columnSet.includes(column.get('value')),
|
|
300
|
+
// Only enable the column toggle if it's toggleable, so that any
|
|
301
|
+
// non-toggleable columns that are in the initial column set will be
|
|
302
|
+
// shown but disabled in the control
|
|
303
|
+
enabled: !!column.get('toggleable'),
|
|
304
|
+
toggle: !!column.get('toggleable') ? onToggleColumn(tableKey, column.get('value')) : undefined
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
return list;
|
|
308
|
+
}, (0, _immutable.List)());
|
|
309
|
+
};
|
|
310
|
+
exports.getToggleableColumns = getToggleableColumns;
|
|
311
|
+
var buildColumnControl = function buildColumnControl(props) {
|
|
312
|
+
var tableKey = props.tableKey,
|
|
313
|
+
columns = props.columns,
|
|
314
|
+
columnSet = props.columnSet,
|
|
315
|
+
components = props.components,
|
|
316
|
+
renderOptions = props.renderOptions,
|
|
317
|
+
tableOptions = props.tableOptions,
|
|
318
|
+
extraData = props.extraData;
|
|
319
|
+
var ColumnControl = components.ColumnControl;
|
|
320
|
+
return /*#__PURE__*/_react["default"].createElement(ColumnControl, {
|
|
321
|
+
tableKey: tableKey,
|
|
322
|
+
columns: getToggleableColumns(columns, columnSet, tableKey),
|
|
323
|
+
renderOptions: renderOptions,
|
|
324
|
+
tableOptions: tableOptions,
|
|
325
|
+
extraData: extraData
|
|
326
|
+
});
|
|
327
|
+
};
|
|
286
328
|
var buildTable = function buildTable(props) {
|
|
287
329
|
var TableLayout = props.components.TableLayout;
|
|
288
330
|
var header = buildTableHeader(props);
|
|
@@ -338,13 +380,15 @@ var buildTableHeaderCell = function buildTableHeaderCell(props) {
|
|
|
338
380
|
columnComponents = props.columnComponents,
|
|
339
381
|
renderOptions = props.renderOptions,
|
|
340
382
|
tableOptions = props.tableOptions,
|
|
341
|
-
appliedFilters = props.appliedFilters
|
|
383
|
+
appliedFilters = props.appliedFilters,
|
|
384
|
+
columnControl = props.columnControl;
|
|
342
385
|
var HeaderCell = columnComponents.getIn([column.get('value'), 'HeaderCell'], components.HeaderCell);
|
|
343
386
|
var sorting = column === props.sortColumn && props.sortDirection;
|
|
344
387
|
var sortable = props.sortable && column.get('sortable');
|
|
345
388
|
return /*#__PURE__*/_react["default"].createElement(KeyWrapper, {
|
|
346
389
|
key: "column-".concat(index)
|
|
347
390
|
}, /*#__PURE__*/_react["default"].createElement(HeaderCell, {
|
|
391
|
+
columnControl: columnControl,
|
|
348
392
|
onSortColumn: onSortColumn(tableKey, column),
|
|
349
393
|
title: column.get('title'),
|
|
350
394
|
renderOptions: renderOptions,
|
|
@@ -517,6 +561,14 @@ var onSortColumn = function onSortColumn(tableKey, column) {
|
|
|
517
561
|
});
|
|
518
562
|
};
|
|
519
563
|
};
|
|
564
|
+
var onToggleColumn = function onToggleColumn(tableKey, column) {
|
|
565
|
+
return function () {
|
|
566
|
+
return (0, _store.dispatch)('TOGGLE_COLUMN', {
|
|
567
|
+
tableKey: tableKey,
|
|
568
|
+
column: column
|
|
569
|
+
});
|
|
570
|
+
};
|
|
571
|
+
};
|
|
520
572
|
var mapStateToProps = function mapStateToProps() {
|
|
521
573
|
return function (state, props) {
|
|
522
574
|
return state.getIn(['tables', props.tableKey], (0, _immutable.Map)()).toObject();
|
|
@@ -541,13 +593,41 @@ var TableImpl = (0, _recompose.compose)((0, _store.connect)(mapStateToProps), (0
|
|
|
541
593
|
var generateColumns = function generateColumns(columns) {
|
|
542
594
|
var addColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
543
595
|
var alterColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
544
|
-
return (0, _immutable.List)(
|
|
596
|
+
return (0, _immutable.List)(columns).concat(addColumns).map(function (c) {
|
|
545
597
|
return (0, _immutable.Map)((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, c), alterColumns[c.value]), {}, {
|
|
546
598
|
value: c.value
|
|
547
599
|
}));
|
|
548
600
|
});
|
|
549
601
|
};
|
|
550
602
|
exports.generateColumns = generateColumns;
|
|
603
|
+
var sortColumns = function sortColumns(columns, columnSet) {
|
|
604
|
+
return columns
|
|
605
|
+
// First sort columns by the columnOrder value if provided
|
|
606
|
+
.sortBy(function (column) {
|
|
607
|
+
return column.get('columnOrder') === 'first' ? -1 : column.get('columnOrder') === 'last' ? 1 : 0;
|
|
608
|
+
})
|
|
609
|
+
// Next reduce the columns list into a list of groups, starting a new group
|
|
610
|
+
// each time we get to a column that's in the columnSet. This will result in
|
|
611
|
+
// each group having at most one columnSet column, and that column will be
|
|
612
|
+
// the first one in the group.
|
|
613
|
+
.reduce(function (list, column) {
|
|
614
|
+
return columnSet.includes(column.get('value')) ? list.push((0, _immutable.List)([column])) : list.update(-1, function (group) {
|
|
615
|
+
return group ? group.push(column) : (0, _immutable.List)([column]);
|
|
616
|
+
});
|
|
617
|
+
}, (0, _immutable.List)())
|
|
618
|
+
// Then sort the groups, taking the first column from each group, finding
|
|
619
|
+
// its index in the column set, and using that index as a sort value. Any
|
|
620
|
+
// groups without a columnSet column will be sorted to the end.
|
|
621
|
+
.sortBy(function (group) {
|
|
622
|
+
var columnSetIndex = columnSet.findIndex(function (c) {
|
|
623
|
+
return c === group.getIn([0, 'value']);
|
|
624
|
+
});
|
|
625
|
+
return columnSetIndex >= 0 ? columnSetIndex : columnSet.size + 1;
|
|
626
|
+
})
|
|
627
|
+
// Lastly flatten the groups back to a list of columns
|
|
628
|
+
.flatten(true);
|
|
629
|
+
};
|
|
630
|
+
exports.sortColumns = sortColumns;
|
|
551
631
|
var extractColumnComponents = function extractColumnComponents(columns) {
|
|
552
632
|
return columns.filter(function (c) {
|
|
553
633
|
return c.has('components');
|
|
@@ -619,6 +699,7 @@ var generateTable = function generateTable(_ref4) {
|
|
|
619
699
|
filterSet: props.filterSet,
|
|
620
700
|
filterAutoFocus: props.filterAutoFocus,
|
|
621
701
|
columnSet: props.columnSet,
|
|
702
|
+
columnSetOrder: props.columnSetOrder,
|
|
622
703
|
pageSize: props.pageSize,
|
|
623
704
|
defaultSortColumn: props.defaultSortColumn,
|
|
624
705
|
defaultSortDirection: props.defaultSortDirection,
|
|
@@ -676,7 +757,7 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
676
757
|
var allColumns = columns.map(function (c) {
|
|
677
758
|
return c.get('value');
|
|
678
759
|
});
|
|
679
|
-
var
|
|
760
|
+
var initialColumnSet = (0, _immutable.List)(this.props.columnSet ? typeof this.props.columnSet === 'function' ? this.props.columnSet(allColumns) : this.props.columnSet : allColumns).filter(function (c) {
|
|
680
761
|
return columns.find(function (c2) {
|
|
681
762
|
return c2.get('value') === c;
|
|
682
763
|
});
|
|
@@ -686,8 +767,8 @@ var Table = /*#__PURE__*/function (_Component) {
|
|
|
686
767
|
return /*#__PURE__*/_react["default"].createElement(TableImpl, Object.assign({}, _this2.props, {
|
|
687
768
|
components: componentConfig.merge(_this2.props.components).toJS(),
|
|
688
769
|
columnComponents: columnComponents,
|
|
689
|
-
columns: columns,
|
|
690
|
-
columnSet:
|
|
770
|
+
columns: sortColumns(columns, initialColumnSet),
|
|
771
|
+
columnSet: initialColumnSet,
|
|
691
772
|
tableKey: _this2.tableKey,
|
|
692
773
|
auto: _this2.auto
|
|
693
774
|
}), _this2.props.children);
|
|
@@ -118,6 +118,7 @@ exports.generateInitialSortColumn = generateInitialSortColumn;
|
|
|
118
118
|
data = _ref3$payload.data,
|
|
119
119
|
dataSource = _ref3$payload.dataSource,
|
|
120
120
|
columns = _ref3$payload.columns,
|
|
121
|
+
columnSet = _ref3$payload.columnSet,
|
|
121
122
|
_ref3$payload$pageSiz = _ref3$payload.pageSize,
|
|
122
123
|
pageSize = _ref3$payload$pageSiz === void 0 ? 25 : _ref3$payload$pageSiz,
|
|
123
124
|
_ref3$payload$default = _ref3$payload.defaultSortColumn,
|
|
@@ -135,6 +136,7 @@ exports.generateInitialSortColumn = generateInitialSortColumn;
|
|
|
135
136
|
tableOptions: tableOptions,
|
|
136
137
|
columns: columns,
|
|
137
138
|
rows: (0, _immutable.List)(),
|
|
139
|
+
columnSet: columnSet,
|
|
138
140
|
initializing: true,
|
|
139
141
|
loading: true,
|
|
140
142
|
pageSize: pageSize,
|
|
@@ -158,45 +160,64 @@ exports.generateInitialSortColumn = generateInitialSortColumn;
|
|
|
158
160
|
initialize: true
|
|
159
161
|
}));
|
|
160
162
|
},
|
|
161
|
-
|
|
163
|
+
TOGGLE_COLUMN: function TOGGLE_COLUMN(state, _ref4) {
|
|
162
164
|
var _ref4$payload = _ref4.payload,
|
|
163
165
|
tableKey = _ref4$payload.tableKey,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
column = _ref4$payload.column;
|
|
167
|
+
return state.updateIn(['tables', tableKey, 'columnSet'], function (columnSet) {
|
|
168
|
+
return state
|
|
169
|
+
// Get all columns
|
|
170
|
+
.getIn(['tables', tableKey, 'columns'])
|
|
171
|
+
// Filter to only columns that are toggleable or in the current
|
|
172
|
+
// columnSet, while toggling the current column if it's toggleable
|
|
173
|
+
.filter(function (c) {
|
|
174
|
+
return !c.get('toggleable') ? columnSet.includes(c.get('value')) : columnSet.includes(c.get('value')) ? c.get('value') !== column : c.get('value') === column;
|
|
175
|
+
})
|
|
176
|
+
// Map to columns values to get the new columnSet
|
|
177
|
+
.map(function (c) {
|
|
178
|
+
return c.get('value');
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
SET_ROWS: function SET_ROWS(state, _ref5) {
|
|
183
|
+
var _ref5$payload = _ref5.payload,
|
|
184
|
+
tableKey = _ref5$payload.tableKey,
|
|
185
|
+
rows = _ref5$payload.rows,
|
|
186
|
+
data = _ref5$payload.data,
|
|
187
|
+
_ref5$payload$extraDa = _ref5$payload.extraData,
|
|
188
|
+
extraData = _ref5$payload$extraDa === void 0 ? null : _ref5$payload$extraDa,
|
|
189
|
+
nextPageToken = _ref5$payload.nextPageToken,
|
|
190
|
+
count = _ref5$payload.count,
|
|
191
|
+
_ref5$payload$error = _ref5$payload.error,
|
|
192
|
+
error = _ref5$payload$error === void 0 ? null : _ref5$payload$error;
|
|
172
193
|
return state.updateIn(['tables', tableKey], function (table) {
|
|
173
194
|
return table && table.set('rows', rows).set('data', data).set('extraData', extraData).set('currentPageToken', nextPageToken).set('nextPageToken', null).set('count', count).set('error', error).set('initializing', false).set('loading', false);
|
|
174
195
|
});
|
|
175
196
|
},
|
|
176
|
-
NEXT_PAGE: function NEXT_PAGE(state,
|
|
177
|
-
var tableKey =
|
|
197
|
+
NEXT_PAGE: function NEXT_PAGE(state, _ref6) {
|
|
198
|
+
var tableKey = _ref6.payload.tableKey;
|
|
178
199
|
return state.updateIn(['tables', tableKey], function (tableData) {
|
|
179
200
|
return isClientSide(tableData) ? clientSideNextPage(tableData) : serverSideNextPage(tableData);
|
|
180
201
|
}).setIn(['tables', tableKey, 'error'], null);
|
|
181
202
|
},
|
|
182
|
-
PREV_PAGE: function PREV_PAGE(state,
|
|
183
|
-
var tableKey =
|
|
203
|
+
PREV_PAGE: function PREV_PAGE(state, _ref7) {
|
|
204
|
+
var tableKey = _ref7.payload.tableKey;
|
|
184
205
|
return state.updateIn(['tables', tableKey], function (tableData) {
|
|
185
206
|
return isClientSide(tableData) ? clientSidePrevPage(tableData) : serverSidePrevPage(tableData);
|
|
186
207
|
}).setIn(['tables', tableKey, 'error'], null);
|
|
187
208
|
},
|
|
188
|
-
GOTO_PAGE: function GOTO_PAGE(state,
|
|
189
|
-
var
|
|
190
|
-
tableKey =
|
|
191
|
-
pageNumber =
|
|
209
|
+
GOTO_PAGE: function GOTO_PAGE(state, _ref8) {
|
|
210
|
+
var _ref8$payload = _ref8.payload,
|
|
211
|
+
tableKey = _ref8$payload.tableKey,
|
|
212
|
+
pageNumber = _ref8$payload.pageNumber;
|
|
192
213
|
return state.updateIn(['tables', tableKey], function (tableData) {
|
|
193
214
|
return isClientSide(tableData) ? clientSideGotoPage(tableData, pageNumber) : serverSideGotoPage(tableData, pageNumber);
|
|
194
215
|
}).setIn(['tables', tableKey, 'error'], null);
|
|
195
216
|
},
|
|
196
|
-
SORT_COLUMN: function SORT_COLUMN(state,
|
|
197
|
-
var
|
|
198
|
-
tableKey =
|
|
199
|
-
column =
|
|
217
|
+
SORT_COLUMN: function SORT_COLUMN(state, _ref9) {
|
|
218
|
+
var _ref9$payload = _ref9.payload,
|
|
219
|
+
tableKey = _ref9$payload.tableKey,
|
|
220
|
+
column = _ref9$payload.column;
|
|
200
221
|
return state.updateIn(['tables', tableKey], function (t) {
|
|
201
222
|
var sortColumn = t.get('sortColumn');
|
|
202
223
|
var sortDirection = t.get('sortDirection');
|
|
@@ -207,46 +228,46 @@ exports.generateInitialSortColumn = generateInitialSortColumn;
|
|
|
207
228
|
.set('sortDirection', sortColumn === column ? sortDirection === 'asc' ? 'desc' : 'asc' : 'asc').set('sortColumn', column).set('error', null);
|
|
208
229
|
});
|
|
209
230
|
},
|
|
210
|
-
SET_FILTER: function SET_FILTER(state,
|
|
211
|
-
var
|
|
212
|
-
tableKey =
|
|
213
|
-
filter =
|
|
214
|
-
value =
|
|
231
|
+
SET_FILTER: function SET_FILTER(state, _ref10) {
|
|
232
|
+
var _ref10$payload = _ref10.payload,
|
|
233
|
+
tableKey = _ref10$payload.tableKey,
|
|
234
|
+
filter = _ref10$payload.filter,
|
|
235
|
+
value = _ref10$payload.value;
|
|
215
236
|
return state.updateIn(['tables', tableKey], function (table) {
|
|
216
237
|
return table.setIn(['filters', filter, 'value'], value).set('validFilters', evaluateValidFilters(table));
|
|
217
238
|
});
|
|
218
239
|
},
|
|
219
|
-
APPLY_FILTERS: function APPLY_FILTERS(state,
|
|
220
|
-
var tableKey =
|
|
240
|
+
APPLY_FILTERS: function APPLY_FILTERS(state, _ref11) {
|
|
241
|
+
var tableKey = _ref11.payload.tableKey;
|
|
221
242
|
return state.updateIn(['tables', tableKey], function (table) {
|
|
222
243
|
return table.set('loading', true).set('appliedFilters', state.getIn(['tables', tableKey, 'filters'])).set('pageOffset', 0).set('currentPageToken', null).set('nextPageToken', null).set('pageTokens', (0, _immutable.List)()).set('error', null);
|
|
223
244
|
});
|
|
224
245
|
},
|
|
225
|
-
APPLY_FILTER_FORM: function APPLY_FILTER_FORM(state,
|
|
226
|
-
var
|
|
227
|
-
tableKey =
|
|
228
|
-
appliedFilters =
|
|
246
|
+
APPLY_FILTER_FORM: function APPLY_FILTER_FORM(state, _ref12) {
|
|
247
|
+
var _ref12$payload = _ref12.payload,
|
|
248
|
+
tableKey = _ref12$payload.tableKey,
|
|
249
|
+
appliedFilters = _ref12$payload.appliedFilters;
|
|
229
250
|
return state.updateIn(['tables', tableKey], function (table) {
|
|
230
251
|
return table.set('loading', true).set('appliedFilters', appliedFilters).set('pageOffset', 0).set('currentPageToken', null).set('nextPageToken', null).set('pageTokens', (0, _immutable.List)()).set('error', null);
|
|
231
252
|
});
|
|
232
253
|
},
|
|
233
|
-
REFETCH_TABLE_DATA: function REFETCH_TABLE_DATA(state,
|
|
234
|
-
var tableKey =
|
|
254
|
+
REFETCH_TABLE_DATA: function REFETCH_TABLE_DATA(state, _ref13) {
|
|
255
|
+
var tableKey = _ref13.payload.tableKey;
|
|
235
256
|
return state.hasIn(['tables', tableKey]) ? state.updateIn(['tables', tableKey], function (tableData) {
|
|
236
257
|
return tableData.get('dataSource') ? tableData.set('loading', true).set('pageOffset', 0).set('currentPageToken', null).set('nextPageToken', null).set('pageTokens', (0, _immutable.List)()).set('data', null).set('error', null) : tableData;
|
|
237
258
|
}) : state;
|
|
238
259
|
},
|
|
239
|
-
CLEAR_TABLE_FILTERS: function CLEAR_TABLE_FILTERS(state,
|
|
240
|
-
var tableKey =
|
|
260
|
+
CLEAR_TABLE_FILTERS: function CLEAR_TABLE_FILTERS(state, _ref14) {
|
|
261
|
+
var tableKey = _ref14.payload.tableKey;
|
|
241
262
|
return state.setIn(['tables', tableKey, 'filters'], generateFilters(tableKey, state.getIn(['tables', tableKey, 'columns'])));
|
|
242
263
|
},
|
|
243
|
-
CLEAR_SELECTED_FILTERS: function CLEAR_SELECTED_FILTERS(state,
|
|
244
|
-
var tableKey =
|
|
264
|
+
CLEAR_SELECTED_FILTERS: function CLEAR_SELECTED_FILTERS(state, _ref15) {
|
|
265
|
+
var tableKey = _ref15.payload.tableKey;
|
|
245
266
|
return state.setIn(['tables', tableKey, 'filters'], state.getIn(['tables', tableKey, 'appliedFilters']));
|
|
246
267
|
}
|
|
247
268
|
});
|
|
248
|
-
function calculateRowsTask(
|
|
249
|
-
var payload =
|
|
269
|
+
function calculateRowsTask(_ref16) {
|
|
270
|
+
var payload = _ref16.payload;
|
|
250
271
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
251
272
|
var tableKey, tableData, response, rows, data, nextPageToken, count, error, extraData, onFetch;
|
|
252
273
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
@@ -334,8 +355,8 @@ function calculateRowsTask(_ref15) {
|
|
|
334
355
|
}, _callee, null, [[0, 24]]);
|
|
335
356
|
})();
|
|
336
357
|
}
|
|
337
|
-
function configureTableTask(
|
|
338
|
-
var payload =
|
|
358
|
+
function configureTableTask(_ref17) {
|
|
359
|
+
var payload = _ref17.payload;
|
|
339
360
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
|
340
361
|
var filterForm, tableKey, initialFilterValues;
|
|
341
362
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
@@ -391,8 +412,8 @@ function pollingTask(tableKey) {
|
|
|
391
412
|
}
|
|
392
413
|
}, _marked);
|
|
393
414
|
}
|
|
394
|
-
function startPollingTask(
|
|
395
|
-
var payload =
|
|
415
|
+
function startPollingTask(_ref18) {
|
|
416
|
+
var payload = _ref18.payload;
|
|
396
417
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
|
397
418
|
var refreshInterval, tableKey;
|
|
398
419
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context4) {
|
|
@@ -416,8 +437,8 @@ function startPollingTask(_ref17) {
|
|
|
416
437
|
}, _callee3);
|
|
417
438
|
})();
|
|
418
439
|
}
|
|
419
|
-
function stopPollingTask(
|
|
420
|
-
var payload =
|
|
440
|
+
function stopPollingTask(_ref19) {
|
|
441
|
+
var payload = _ref19.payload;
|
|
421
442
|
return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
|
422
443
|
var tableKey;
|
|
423
444
|
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context5) {
|
|
@@ -592,7 +613,7 @@ var calculateRows = function calculateRows(tableData) {
|
|
|
592
613
|
return Promise.resolve({
|
|
593
614
|
rows: rows,
|
|
594
615
|
data: data,
|
|
595
|
-
count:
|
|
616
|
+
count: data.size
|
|
596
617
|
});
|
|
597
618
|
} else if (dataSource) {
|
|
598
619
|
var paramData = {
|
|
@@ -626,6 +626,45 @@ describe('<Table />', function () {
|
|
|
626
626
|
expect(column).not.toBeUndefined();
|
|
627
627
|
});
|
|
628
628
|
});
|
|
629
|
+
describe('#sortColumns', function () {
|
|
630
|
+
test('sort columns returns expected sort order', function () {
|
|
631
|
+
var columns = (0, _immutable.List)([(0, _immutable.Map)({
|
|
632
|
+
value: 'a',
|
|
633
|
+
title: 'A'
|
|
634
|
+
}), (0, _immutable.Map)({
|
|
635
|
+
value: 'b',
|
|
636
|
+
title: 'B'
|
|
637
|
+
}), (0, _immutable.Map)({
|
|
638
|
+
value: 'c',
|
|
639
|
+
title: 'C'
|
|
640
|
+
})]);
|
|
641
|
+
var columnSet = (0, _immutable.List)(['b', 'a']);
|
|
642
|
+
expect((0, _Table.sortColumns)(columns, columnSet).toJS().map(function (c) {
|
|
643
|
+
return c.value;
|
|
644
|
+
}).join('')).toBe('bca');
|
|
645
|
+
});
|
|
646
|
+
});
|
|
647
|
+
describe('#getToggleableColumns', function () {
|
|
648
|
+
test('toggleable columns list is correct', function () {
|
|
649
|
+
var columns = (0, _immutable.List)([(0, _immutable.Map)({
|
|
650
|
+
value: 'a',
|
|
651
|
+
title: 'A',
|
|
652
|
+
toggleable: true
|
|
653
|
+
}), (0, _immutable.Map)({
|
|
654
|
+
value: 'b',
|
|
655
|
+
title: 'B'
|
|
656
|
+
}), (0, _immutable.Map)({
|
|
657
|
+
value: 'c',
|
|
658
|
+
title: 'C'
|
|
659
|
+
}), (0, _immutable.Map)({
|
|
660
|
+
value: 'd'
|
|
661
|
+
})]);
|
|
662
|
+
var columnSet = (0, _immutable.List)(['a', 'b', 'd']);
|
|
663
|
+
expect((0, _Table.getToggleableColumns)(columns, columnSet, 'table-key').toJS().map(function (c) {
|
|
664
|
+
return c.value;
|
|
665
|
+
}).join('')).toBe('ab');
|
|
666
|
+
});
|
|
667
|
+
});
|
|
629
668
|
xdescribe('#extractColumnComponents', function () {
|
|
630
669
|
var columns, addColumns, alterColumns;
|
|
631
670
|
beforeEach(function () {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var ColumnControl = function ColumnControl(_ref) {
|
|
10
|
+
var columns = _ref.columns;
|
|
11
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, columns.map(function (column) {
|
|
12
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
13
|
+
className: "field"
|
|
14
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
15
|
+
type: "checkbox",
|
|
16
|
+
id: "column-".concat(column.get('value')),
|
|
17
|
+
checked: column.get('checked'),
|
|
18
|
+
disabled: !column.get('enabled'),
|
|
19
|
+
onChange: column.get('toggle')
|
|
20
|
+
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
21
|
+
htmlFor: "column-".concat(column.get('value'))
|
|
22
|
+
}, column.get('label')));
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
var _default = ColumnControl;
|
|
26
|
+
exports["default"] = _default;
|
|
@@ -21,6 +21,7 @@ var _FilterLayout = _interopRequireDefault(require("./FilterLayout"));
|
|
|
21
21
|
var _BooleanFilter = _interopRequireDefault(require("./BooleanFilter"));
|
|
22
22
|
var _TextFilter = _interopRequireDefault(require("./TextFilter"));
|
|
23
23
|
var _PaginationControl = _interopRequireDefault(require("./PaginationControl"));
|
|
24
|
+
var _ColumnControl = _interopRequireDefault(require("./ColumnControl"));
|
|
24
25
|
var DefaultTableConfig = (0, _immutable.Map)({
|
|
25
26
|
TableLayout: _TableLayout["default"],
|
|
26
27
|
Header: _Header["default"],
|
|
@@ -36,6 +37,7 @@ var DefaultTableConfig = (0, _immutable.Map)({
|
|
|
36
37
|
FilterLayout: _FilterLayout["default"],
|
|
37
38
|
TextFilter: _TextFilter["default"],
|
|
38
39
|
BooleanFilter: _BooleanFilter["default"],
|
|
39
|
-
PaginationControl: _PaginationControl["default"]
|
|
40
|
+
PaginationControl: _PaginationControl["default"],
|
|
41
|
+
ColumnControl: _ColumnControl["default"]
|
|
40
42
|
});
|
|
41
43
|
exports.DefaultTableConfig = DefaultTableConfig;
|
|
@@ -88,45 +88,57 @@ var filters = function filters() {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
var columns = [{
|
|
91
|
+
// Note: This appears as 'Occured' in the columnControl
|
|
91
92
|
value: 'createdAt',
|
|
92
93
|
title: 'Created At',
|
|
93
|
-
sortable: true
|
|
94
|
+
sortable: true,
|
|
95
|
+
toggleable: true
|
|
94
96
|
}, {
|
|
95
97
|
value: 'createdBy',
|
|
96
98
|
title: 'Created By',
|
|
97
|
-
sortable: false
|
|
99
|
+
sortable: false,
|
|
100
|
+
toggleable: true
|
|
98
101
|
}, {
|
|
99
102
|
value: 'engineIdentification',
|
|
100
103
|
title: 'Engine Identification',
|
|
101
|
-
sortable: false
|
|
104
|
+
sortable: false,
|
|
105
|
+
toggleable: true
|
|
102
106
|
}, {
|
|
103
107
|
value: 'id',
|
|
104
108
|
title: 'Error Id',
|
|
105
|
-
sortable: false
|
|
109
|
+
sortable: false,
|
|
110
|
+
toggleable: false,
|
|
111
|
+
columnOrder: 'first'
|
|
106
112
|
}, {
|
|
107
113
|
value: 'relatedItem1Id',
|
|
108
114
|
title: 'Related Item 1 ID',
|
|
109
|
-
sortable: false
|
|
115
|
+
sortable: false,
|
|
116
|
+
toggleable: true
|
|
110
117
|
}, {
|
|
111
118
|
value: 'relatedItem1Type',
|
|
112
119
|
title: 'Related Item 1 Type',
|
|
113
|
-
sortable: false
|
|
120
|
+
sortable: false,
|
|
121
|
+
toggleable: true
|
|
114
122
|
}, {
|
|
115
123
|
value: 'relatedItem2Id',
|
|
116
124
|
title: 'Related Item 2 ID',
|
|
117
|
-
sortable: false
|
|
125
|
+
sortable: false,
|
|
126
|
+
toggleable: true
|
|
118
127
|
}, {
|
|
119
128
|
value: 'relatedItem2Type',
|
|
120
129
|
title: 'Related Item 2 Type',
|
|
121
|
-
sortable: false
|
|
130
|
+
sortable: false,
|
|
131
|
+
toggleable: true
|
|
122
132
|
}, {
|
|
123
133
|
value: 'status',
|
|
124
134
|
title: 'Status',
|
|
125
|
-
sortable: false
|
|
135
|
+
sortable: false,
|
|
136
|
+
toggleable: true
|
|
126
137
|
}, {
|
|
127
138
|
value: 'sourceName',
|
|
128
139
|
title: 'Source',
|
|
129
140
|
sortable: false,
|
|
141
|
+
toggleable: true,
|
|
130
142
|
valueTransform: function valueTransform(_value, row) {
|
|
131
143
|
return (0, _immutable.getIn)(row, ['run', 'tree', 'sourceName'], '');
|
|
132
144
|
}
|
|
@@ -134,6 +146,7 @@ var columns = [{
|
|
|
134
146
|
value: 'sourceGroup',
|
|
135
147
|
title: 'Group',
|
|
136
148
|
sortable: false,
|
|
149
|
+
toggleable: true,
|
|
137
150
|
valueTransform: function valueTransform(_value, row) {
|
|
138
151
|
return (0, _immutable.getIn)(row, ['run', 'tree', 'sourceGroup'], '');
|
|
139
152
|
}
|
|
@@ -141,29 +154,35 @@ var columns = [{
|
|
|
141
154
|
value: 'treeName',
|
|
142
155
|
title: 'Name',
|
|
143
156
|
sortable: false,
|
|
157
|
+
toggleable: true,
|
|
144
158
|
valueTransform: function valueTransform(_value, row) {
|
|
145
159
|
return (0, _immutable.getIn)(row, ['run', 'tree', 'name'], '');
|
|
146
160
|
}
|
|
147
161
|
}, {
|
|
148
162
|
value: 'Summary',
|
|
149
163
|
title: 'Summary',
|
|
150
|
-
sortable: false
|
|
164
|
+
sortable: false,
|
|
165
|
+
toggleable: true
|
|
151
166
|
}, {
|
|
152
167
|
value: 'text',
|
|
153
168
|
title: 'Text',
|
|
154
|
-
sortable: false
|
|
169
|
+
sortable: false,
|
|
170
|
+
toggleable: true
|
|
155
171
|
}, {
|
|
156
172
|
value: 'type',
|
|
157
173
|
title: 'Type',
|
|
158
|
-
sortable: false
|
|
174
|
+
sortable: false,
|
|
175
|
+
toggleable: true
|
|
159
176
|
}, {
|
|
160
177
|
value: 'updatedAt',
|
|
161
178
|
title: 'Updated At',
|
|
162
|
-
sortable: true
|
|
179
|
+
sortable: true,
|
|
180
|
+
toggleable: true
|
|
163
181
|
}, {
|
|
164
182
|
value: 'updatedBy',
|
|
165
183
|
title: 'Updated By',
|
|
166
|
-
sortable: false
|
|
184
|
+
sortable: false,
|
|
185
|
+
toggleable: true
|
|
167
186
|
}];
|
|
168
187
|
var RunErrorTable = (0, _Table.generateTable)({
|
|
169
188
|
tableOptions: ['runId'],
|
|
@@ -62,37 +62,49 @@ var filters = function filters() {
|
|
|
62
62
|
};
|
|
63
63
|
var columns = [{
|
|
64
64
|
title: 'ID',
|
|
65
|
-
value: 'id'
|
|
65
|
+
value: 'id',
|
|
66
|
+
toggleable: true
|
|
66
67
|
}, {
|
|
67
68
|
title: 'Name',
|
|
68
|
-
value: 'name'
|
|
69
|
+
value: 'name',
|
|
70
|
+
toggleable: false,
|
|
71
|
+
columnOrder: 'first'
|
|
69
72
|
}, {
|
|
70
73
|
title: 'Status',
|
|
71
|
-
value: 'status'
|
|
74
|
+
value: 'status',
|
|
75
|
+
toggleable: true
|
|
72
76
|
}, {
|
|
73
77
|
title: 'Definition ID',
|
|
74
|
-
value: 'definitionId'
|
|
78
|
+
value: 'definitionId',
|
|
79
|
+
toggleable: true
|
|
75
80
|
}, {
|
|
76
81
|
title: 'Definition Name',
|
|
77
|
-
value: 'definitionName'
|
|
82
|
+
value: 'definitionName',
|
|
83
|
+
toggleable: true
|
|
78
84
|
}, {
|
|
79
85
|
title: 'Definition Version',
|
|
80
|
-
value: 'definitionVersion'
|
|
86
|
+
value: 'definitionVersion',
|
|
87
|
+
toggleable: true
|
|
81
88
|
}, {
|
|
82
89
|
title: 'Description',
|
|
83
|
-
value: 'description'
|
|
90
|
+
value: 'description',
|
|
91
|
+
toggleable: true
|
|
84
92
|
}, {
|
|
85
93
|
title: 'Created',
|
|
86
|
-
value: 'createdAt'
|
|
94
|
+
value: 'createdAt',
|
|
95
|
+
toggleable: true
|
|
87
96
|
}, {
|
|
88
97
|
title: 'Created By',
|
|
89
|
-
value: 'createdBy'
|
|
98
|
+
value: 'createdBy',
|
|
99
|
+
toggleable: true
|
|
90
100
|
}, {
|
|
91
101
|
title: 'Updated',
|
|
92
|
-
value: 'updatedAt'
|
|
102
|
+
value: 'updatedAt',
|
|
103
|
+
toggleable: true
|
|
93
104
|
}, {
|
|
94
105
|
title: 'Updated By',
|
|
95
|
-
value: 'updatedBy'
|
|
106
|
+
value: 'updatedBy',
|
|
107
|
+
toggleable: true
|
|
96
108
|
}];
|
|
97
109
|
var HandlerTable = (0, _Table.generateTable)({
|
|
98
110
|
columns: columns,
|