@urbanos/react-discovery-ui 2.1.59 → 2.1.60
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/ReactDiscoveryUI.js +1 -1
- package/lib/components/collapsable-box/collapsable-box.js +2 -0
- package/lib/components/data-card/data-card.js +18 -1
- package/lib/components/data-view/data-view.js +2 -1
- package/lib/components/dataset-api-doc/api-example.js +2 -1
- package/lib/components/dataset-dictionary/dataset-dictionary.js +36 -37
- package/lib/components/dataset-dictionary/dataset-dictionary.scss +21 -2
- package/lib/components/dataset-dictionary/dataset-dictionary.test.js +23 -29
- package/lib/components/dataset-metadata/dataset-metadata.scss +1 -0
- package/lib/components/dataset-quality/dataset-quality.scss +1 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.js +2 -1
- package/lib/components/recommendation-list/recommendation-list.js +2 -1
- package/lib/components/share/share.scss +0 -1
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.scss +1 -3
- package/lib/pages/dataset-detail-view/dataset-detail-view.scss +3 -2
- package/lib/pages/dataset-view/dataset-view.js +23 -24
- package/lib/pages/dataset-view/dataset-view.scss +7 -5
- package/lib/pages/query-view/query-view.js +2 -2
- package/lib/styles/variables.scss +2 -2
- package/package.json +2 -1
package/lib/ReactDiscoveryUI.js
CHANGED
|
@@ -43,7 +43,7 @@ var noMatch = function noMatch() {
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
var DiscoveryUI = function DiscoveryUI() {
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement("main
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement("main", {
|
|
47
47
|
class: "main-app-element"
|
|
48
48
|
}, /*#__PURE__*/_react.default.createElement(_networkLoadingElement.default, null), /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Switch, null, /*#__PURE__*/_react.default.createElement(_protectedRoute.default, {
|
|
49
49
|
exact: true,
|
|
@@ -93,6 +93,8 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
93
93
|
}, this.props.title), this.props.headerHtml), /*#__PURE__*/React.createElement(_detailToggleIcon.default, {
|
|
94
94
|
expanded: this.state.expanded
|
|
95
95
|
})), /*#__PURE__*/React.createElement(_reactCollapse.Collapse, {
|
|
96
|
+
"aria-hidden": !this.state.expanded,
|
|
97
|
+
hidden: !this.state.expanded,
|
|
96
98
|
isOpened: this.state.expanded
|
|
97
99
|
}, /*#__PURE__*/React.createElement("div", {
|
|
98
100
|
id: this.contentId
|
|
@@ -12,6 +12,12 @@ var _no_image = _interopRequireDefault(require("../../assets/no_image.png"));
|
|
|
12
12
|
var _utils = require("../../utils/");
|
|
13
13
|
var _loadingElement = _interopRequireDefault(require("../../components/generic-elements/loading-element"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
21
|
var DataCard = function DataCard(props) {
|
|
16
22
|
var maxDescriptionLength = 240;
|
|
17
23
|
var fileTypes = function fileTypes(_fileTypes) {
|
|
@@ -23,6 +29,14 @@ var DataCard = function DataCard(props) {
|
|
|
23
29
|
});
|
|
24
30
|
};
|
|
25
31
|
var dataset = props.dataset;
|
|
32
|
+
var _React$useState = React.useState('loading'),
|
|
33
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
34
|
+
imageStatus = _React$useState2[0],
|
|
35
|
+
setImageStatus = _React$useState2[1];
|
|
36
|
+
var logoAltText = function logoAltText() {
|
|
37
|
+
if (imageStatus === 'fallback') return "No image available for ".concat(dataset.organization_title);
|
|
38
|
+
return "The logo for ".concat(dataset.organization_title);
|
|
39
|
+
};
|
|
26
40
|
var truncatedDescription = truncateDescription(dataset.description, maxDescriptionLength);
|
|
27
41
|
return /*#__PURE__*/React.createElement("data-card", null, /*#__PURE__*/React.createElement("div", {
|
|
28
42
|
className: "logo"
|
|
@@ -32,7 +46,10 @@ var DataCard = function DataCard(props) {
|
|
|
32
46
|
src: dataset.organization_image_url,
|
|
33
47
|
fallbackImage: _no_image.default,
|
|
34
48
|
initialImage: /*#__PURE__*/React.createElement(_loadingElement.default, null),
|
|
35
|
-
alt:
|
|
49
|
+
alt: logoAltText(imageStatus, dataset),
|
|
50
|
+
onError: function onError(errorUrl) {
|
|
51
|
+
if (errorUrl === dataset.organization_image_url) setImageStatus('fallback');
|
|
52
|
+
}
|
|
36
53
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
37
54
|
className: "details"
|
|
38
55
|
}, /*#__PURE__*/React.createElement(_reactRouterDom.Link, {
|
|
@@ -240,6 +240,7 @@ var DataTable = function DataTable(_ref) {
|
|
|
240
240
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
241
241
|
className: "pagination"
|
|
242
242
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
243
|
+
"data-testid": "previous-page-button",
|
|
243
244
|
onClick: function onClick() {
|
|
244
245
|
return table.previousPage();
|
|
245
246
|
},
|
|
@@ -248,8 +249,8 @@ var DataTable = function DataTable(_ref) {
|
|
|
248
249
|
}, '<'), /*#__PURE__*/_react.default.createElement("span", null, "Page", ' ', /*#__PURE__*/_react.default.createElement("input", {
|
|
249
250
|
id: "page-number-input",
|
|
250
251
|
type: "number",
|
|
251
|
-
label: "Page number input",
|
|
252
252
|
"data-testid": "page-number-input",
|
|
253
|
+
"aria-label": "page-number-input",
|
|
253
254
|
value: table.getState().pagination.pageIndex + 1,
|
|
254
255
|
onChange: function onChange(e) {
|
|
255
256
|
var pageNum = e.target.value ? Number(e.target.value) - 1 : 0;
|
|
@@ -37,7 +37,8 @@ function renderParameters(params) {
|
|
|
37
37
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
38
38
|
className: "example-header"
|
|
39
39
|
}, "Optional Parameters"), /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className: "example-parameters"
|
|
40
|
+
className: "example-parameters",
|
|
41
|
+
tabIndex: "0"
|
|
41
42
|
}, /*#__PURE__*/React.createElement("table", {
|
|
42
43
|
className: "example-table"
|
|
43
44
|
}, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Name"), /*#__PURE__*/React.createElement("th", null, "Default"), /*#__PURE__*/React.createElement("th", null, "Example"), /*#__PURE__*/React.createElement("th", null, "Description"))), /*#__PURE__*/React.createElement("tbody", null, params.map(renderParameter)))));
|
|
@@ -25,22 +25,7 @@ var isMap = function isMap(schemaElement) {
|
|
|
25
25
|
return schemaElement.type === 'map' || schemaElement.itemType === 'map';
|
|
26
26
|
};
|
|
27
27
|
var schemaColumns = [{
|
|
28
|
-
id: '
|
|
29
|
-
header: function header() {
|
|
30
|
-
return null;
|
|
31
|
-
},
|
|
32
|
-
size: expanderWidth,
|
|
33
|
-
enableSorting: false,
|
|
34
|
-
cell: function cell(_ref) {
|
|
35
|
-
var row = _ref.row;
|
|
36
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
|
-
className: "expander",
|
|
38
|
-
style: {
|
|
39
|
-
cursor: isMap(row.original) ? 'pointer' : undefined
|
|
40
|
-
}
|
|
41
|
-
}, isMap(row.original) ? row.getIsExpanded() ? expandedArrow : collapsedArrow : '');
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
28
|
+
id: 'field',
|
|
44
29
|
header: 'Field',
|
|
45
30
|
accessorKey: 'name',
|
|
46
31
|
meta: {
|
|
@@ -48,25 +33,39 @@ var schemaColumns = [{
|
|
|
48
33
|
className: 'field-name-cell'
|
|
49
34
|
},
|
|
50
35
|
size: 240,
|
|
51
|
-
cell: function cell(
|
|
52
|
-
var getValue =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
cell: function cell(_ref) {
|
|
37
|
+
var getValue = _ref.getValue,
|
|
38
|
+
row = _ref.row;
|
|
39
|
+
var fieldName = getValue();
|
|
40
|
+
var rowIsMap = isMap(row.original);
|
|
41
|
+
var isExpanded = row.getIsExpanded();
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: "field-cell-content"
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
45
|
+
text: fieldName
|
|
46
|
+
}), rowIsMap && /*#__PURE__*/_react.default.createElement("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
className: "field-expander-button",
|
|
49
|
+
onClick: row.getToggleExpandedHandler(),
|
|
50
|
+
"aria-expanded": isExpanded,
|
|
51
|
+
"aria-label": "".concat(isExpanded ? 'Collapse' : 'Expand', " ").concat(fieldName)
|
|
52
|
+
}, isExpanded ? expandedArrow : collapsedArrow));
|
|
56
53
|
}
|
|
57
54
|
}, {
|
|
55
|
+
id: 'type',
|
|
58
56
|
header: 'Type',
|
|
59
57
|
accessorKey: 'type',
|
|
60
58
|
meta: {
|
|
61
59
|
headerClassName: 'table-header'
|
|
62
60
|
},
|
|
63
61
|
size: 120,
|
|
64
|
-
cell: function cell(
|
|
65
|
-
var getValue =
|
|
66
|
-
row =
|
|
62
|
+
cell: function cell(_ref2) {
|
|
63
|
+
var getValue = _ref2.getValue,
|
|
64
|
+
row = _ref2.row;
|
|
67
65
|
return /*#__PURE__*/_react.default.createElement("div", null, getValue() === 'list' ? "list of ".concat(row.original.itemType) : getValue());
|
|
68
66
|
}
|
|
69
67
|
}, {
|
|
68
|
+
id: 'description',
|
|
70
69
|
header: 'Description',
|
|
71
70
|
accessorKey: 'description',
|
|
72
71
|
meta: {
|
|
@@ -77,11 +76,11 @@ var schemaColumns = [{
|
|
|
77
76
|
var isEmpty = function isEmpty(schema) {
|
|
78
77
|
return !schema || schema.length < 1;
|
|
79
78
|
};
|
|
80
|
-
var _SchemaTable = function SchemaTable(
|
|
81
|
-
var schema =
|
|
82
|
-
|
|
83
|
-
parentFieldName =
|
|
84
|
-
style =
|
|
79
|
+
var _SchemaTable = function SchemaTable(_ref3) {
|
|
80
|
+
var schema = _ref3.schema,
|
|
81
|
+
_ref3$parentFieldName = _ref3.parentFieldName,
|
|
82
|
+
parentFieldName = _ref3$parentFieldName === void 0 ? '' : _ref3$parentFieldName,
|
|
83
|
+
style = _ref3.style;
|
|
85
84
|
var _useState = (0, _react.useState)([]),
|
|
86
85
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
86
|
sorting = _useState2[0],
|
|
@@ -121,8 +120,9 @@ var _SchemaTable = function SchemaTable(_ref4) {
|
|
|
121
120
|
var _header$column$column;
|
|
122
121
|
return /*#__PURE__*/_react.default.createElement("th", {
|
|
123
122
|
key: header.id,
|
|
123
|
+
"aria-label": header.id,
|
|
124
124
|
scope: "col",
|
|
125
|
-
className: ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.headerClassName) || '',
|
|
125
|
+
className: ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.headerClassName) || 'table-header',
|
|
126
126
|
style: {
|
|
127
127
|
width: header.column.getSize() !== 150 ? "".concat(header.column.getSize(), "px") : undefined,
|
|
128
128
|
cursor: header.column.getCanSort() ? 'pointer' : undefined
|
|
@@ -138,8 +138,7 @@ var _SchemaTable = function SchemaTable(_ref4) {
|
|
|
138
138
|
var _cell$column$columnDe;
|
|
139
139
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
140
140
|
key: cell.id,
|
|
141
|
-
className:
|
|
142
|
-
onClick: cell.column.id === 'expander' && isMap(row.original) ? row.getToggleExpandedHandler() : undefined
|
|
141
|
+
className: ((_cell$column$columnDe = cell.column.columnDef.meta) === null || _cell$column$columnDe === void 0 ? void 0 : _cell$column$columnDe.className) || ''
|
|
143
142
|
}, (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext()));
|
|
144
143
|
})), row.getIsExpanded() && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
145
144
|
colSpan: schemaColumns.length
|
|
@@ -164,11 +163,11 @@ var viewLink = function viewLink(datasetId) {
|
|
|
164
163
|
className: "view-text"
|
|
165
164
|
}, "View as JSON")));
|
|
166
165
|
};
|
|
167
|
-
var _default = exports.default = function _default(
|
|
168
|
-
var schema =
|
|
169
|
-
datasetId =
|
|
170
|
-
|
|
171
|
-
expanded =
|
|
166
|
+
var _default = exports.default = function _default(_ref4) {
|
|
167
|
+
var schema = _ref4.schema,
|
|
168
|
+
datasetId = _ref4.datasetId,
|
|
169
|
+
_ref4$expanded = _ref4.expanded,
|
|
170
|
+
expanded = _ref4$expanded === void 0 ? true : _ref4$expanded;
|
|
172
171
|
var title = 'Data Dictionary';
|
|
173
172
|
if (isEmpty(schema)) {
|
|
174
173
|
title = title + ' Unavailable';
|
|
@@ -8,6 +8,7 @@ dataset-dictionary {
|
|
|
8
8
|
|
|
9
9
|
.view-text {
|
|
10
10
|
font-size: 1.2rem;
|
|
11
|
+
color: $dark-blue;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
a {
|
|
@@ -33,8 +34,26 @@ dataset-dictionary {
|
|
|
33
34
|
white-space: unset;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
.
|
|
37
|
-
|
|
37
|
+
.field-cell-content {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.field-expander-button {
|
|
44
|
+
border: 0;
|
|
45
|
+
background: transparent;
|
|
46
|
+
padding: 0;
|
|
47
|
+
min-width: 1rem;
|
|
48
|
+
line-height: 1;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
color: $almost-black;
|
|
51
|
+
font-size: 1rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.field-expander-button:focus-visible {
|
|
55
|
+
outline: 2px solid $dark-blue;
|
|
56
|
+
outline-offset: 2px;
|
|
38
57
|
}
|
|
39
58
|
}
|
|
40
59
|
|
|
@@ -26,20 +26,19 @@ describe('dataset dictionary', () => {
|
|
|
26
26
|
const table = subject.find('.dataset-schema-table')
|
|
27
27
|
const headers = table.find('th')
|
|
28
28
|
|
|
29
|
-
expect(headers.length).toBe(
|
|
30
|
-
expect(headers.at(
|
|
31
|
-
expect(headers.at(
|
|
32
|
-
expect(headers.at(
|
|
29
|
+
expect(headers.length).toBe(3)
|
|
30
|
+
expect(headers.at(0).text()).toBe('Field')
|
|
31
|
+
expect(headers.at(1).text()).toBe('Type')
|
|
32
|
+
expect(headers.at(2).text()).toBe('Description')
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
it('has the correct table values', () => {
|
|
36
36
|
const table = subject.find('.dataset-schema-table')
|
|
37
37
|
const cells = table.find('td')
|
|
38
38
|
|
|
39
|
-
const expansionPlaceholder = ''
|
|
40
39
|
const expectedCellValues = [
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
'name', 'string', 'the name',
|
|
41
|
+
'age', 'integer', 'the age'
|
|
43
42
|
]
|
|
44
43
|
expect(cells.length).toBe(expectedCellValues.length)
|
|
45
44
|
expectCorrectCellValues(expectedCellValues, cells)
|
|
@@ -51,7 +50,7 @@ describe('dataset dictionary', () => {
|
|
|
51
50
|
|
|
52
51
|
it('is sortable via column headers', () => {
|
|
53
52
|
const headers = subject.find('.dataset-schema-table th')
|
|
54
|
-
expect(headers.at(
|
|
53
|
+
expect(headers.at(0).prop('onClick')).toBeTruthy()
|
|
55
54
|
})
|
|
56
55
|
|
|
57
56
|
it('has no left margin on the top-level table', () => {
|
|
@@ -71,7 +70,7 @@ describe('dataset dictionary', () => {
|
|
|
71
70
|
const table = subject.find('.dataset-schema-table')
|
|
72
71
|
const cells = table.find('td')
|
|
73
72
|
|
|
74
|
-
const typeIndex =
|
|
73
|
+
const typeIndex = 1
|
|
75
74
|
expect(cells.at(typeIndex).text()).toBe(`list of ${schemaWithList[0].itemType}`)
|
|
76
75
|
})
|
|
77
76
|
})
|
|
@@ -107,23 +106,20 @@ describe('dataset dictionary', () => {
|
|
|
107
106
|
})
|
|
108
107
|
|
|
109
108
|
it('has the correct table values', () => {
|
|
110
|
-
const expansionPlaceholder = ''
|
|
111
|
-
const expansionArrow = '▸'
|
|
112
109
|
const expectedCellValues = [
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
'name', 'string', 'the name',
|
|
111
|
+
'mother', 'map', 'the mother'
|
|
115
112
|
]
|
|
116
113
|
expect(topLevelCells.length).toBe(expectedCellValues.length)
|
|
117
114
|
expectCorrectCellValues(expectedCellValues, topLevelCells)
|
|
115
|
+
expect(topLevelTable.find('.field-expander-button').at(0).text()).toBe('▸')
|
|
118
116
|
})
|
|
119
117
|
|
|
120
118
|
describe('with the map type expanded', () => {
|
|
121
|
-
const expanderCellIndex = 4
|
|
122
|
-
|
|
123
119
|
let subTable, subTableCells
|
|
124
120
|
|
|
125
121
|
beforeEach(() => {
|
|
126
|
-
|
|
122
|
+
topLevelTable.find('.field-expander-button').at(0).simulate('click')
|
|
127
123
|
topLevelTable = subject.find('.dataset-schema-table')
|
|
128
124
|
|
|
129
125
|
subTable = topLevelTable.find('.dataset-schema-table.mother')
|
|
@@ -131,7 +127,7 @@ describe('dataset dictionary', () => {
|
|
|
131
127
|
})
|
|
132
128
|
|
|
133
129
|
it('toggles the direction of the arrow', () => {
|
|
134
|
-
expect(
|
|
130
|
+
expect(topLevelTable.find('.field-expander-button').at(0).text()).toBe('▾')
|
|
135
131
|
})
|
|
136
132
|
|
|
137
133
|
it('renders a sub table for the map with correct values', () => {
|
|
@@ -139,14 +135,13 @@ describe('dataset dictionary', () => {
|
|
|
139
135
|
})
|
|
140
136
|
|
|
141
137
|
it('has the correct values in the sub table', () => {
|
|
142
|
-
const expansionPlaceholder = ''
|
|
143
|
-
const expansionArrow = '▸'
|
|
144
138
|
const expectedCellValues = [
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
'name', 'string', 'mother\'s name',
|
|
140
|
+
'children', 'list of map', 'the chillins'
|
|
147
141
|
]
|
|
148
142
|
expect(subTableCells.length).toBe(expectedCellValues.length)
|
|
149
143
|
expectCorrectCellValues(expectedCellValues, subTableCells)
|
|
144
|
+
expect(subTable.find('.field-expander-button').at(0).text()).toBe('▸')
|
|
150
145
|
})
|
|
151
146
|
|
|
152
147
|
it('indents the sub table', () => {
|
|
@@ -154,15 +149,15 @@ describe('dataset dictionary', () => {
|
|
|
154
149
|
})
|
|
155
150
|
|
|
156
151
|
it('toggles the direction of the arrow again when collapsed', () => {
|
|
157
|
-
|
|
158
|
-
expect(
|
|
152
|
+
topLevelTable.find('.field-expander-button').at(0).simulate('click')
|
|
153
|
+
expect(subject.find('.dataset-schema-table').find('.field-expander-button').at(0).text()).toBe('▸')
|
|
159
154
|
})
|
|
160
155
|
|
|
161
156
|
describe('and the list of map type expanded', () => {
|
|
162
157
|
let subSubTable, subSubTableCells
|
|
163
158
|
|
|
164
159
|
beforeEach(() => {
|
|
165
|
-
|
|
160
|
+
subTable.find('.field-expander-button').at(0).simulate('click')
|
|
166
161
|
subTable = subject.find('.dataset-schema-table.mother')
|
|
167
162
|
|
|
168
163
|
subSubTable = subTable.find('.dataset-schema-table.children')
|
|
@@ -174,9 +169,8 @@ describe('dataset dictionary', () => {
|
|
|
174
169
|
})
|
|
175
170
|
|
|
176
171
|
it('has the correct values in the sub sub table', () => {
|
|
177
|
-
const expansionPlaceholder = ''
|
|
178
172
|
const expectedCellValues = [
|
|
179
|
-
|
|
173
|
+
'age', 'integer', 'the child\'s age'
|
|
180
174
|
]
|
|
181
175
|
expect(subSubTableCells.length).toBe(expectedCellValues.length)
|
|
182
176
|
expectCorrectCellValues(expectedCellValues, subSubTableCells)
|
|
@@ -198,8 +192,8 @@ describe('dataset dictionary', () => {
|
|
|
198
192
|
beforeEach(() => {
|
|
199
193
|
subject = mount(<DatasetDictionary schema={schemaWithMaps} expanded />)
|
|
200
194
|
topLevelTable = subject.find('.dataset-schema-table')
|
|
201
|
-
const
|
|
202
|
-
|
|
195
|
+
const expanderButtons = topLevelTable.find('.field-expander-button')
|
|
196
|
+
expanderButtons.at(0).simulate('click')
|
|
203
197
|
topLevelTable = subject.find('.dataset-schema-table')
|
|
204
198
|
})
|
|
205
199
|
|
|
@@ -267,7 +261,7 @@ describe('dataset dictionary', () => {
|
|
|
267
261
|
|
|
268
262
|
const expectCorrectCellValues = (expectedCellValues, cells) => {
|
|
269
263
|
expectedCellValues.forEach((expected, index) => {
|
|
270
|
-
if (index %
|
|
264
|
+
if (index % 3 === 0) { // handle special rendering for field name tooltip
|
|
271
265
|
expect(cells.at(index).find(Tooltip).props().text).toBe(expected)
|
|
272
266
|
} else {
|
|
273
267
|
expect(cells.at(index).text()).toBe(expected)
|
|
@@ -29,6 +29,7 @@ var DatasetRecommendations = function DatasetRecommendations(props) {
|
|
|
29
29
|
}, /*#__PURE__*/React.createElement("div", {
|
|
30
30
|
className: "recommendation-content"
|
|
31
31
|
}, recommendations.map(function (rec) {
|
|
32
|
+
var _rec$dataTitle;
|
|
32
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
34
|
className: "recommended-dataset",
|
|
34
35
|
key: rec.id
|
|
@@ -37,7 +38,7 @@ var DatasetRecommendations = function DatasetRecommendations(props) {
|
|
|
37
38
|
href: _utils.RecommendationUtils.getDatasetUrl(rec),
|
|
38
39
|
target: "_blank",
|
|
39
40
|
rel: "noreferrer"
|
|
40
|
-
}, rec.dataTitle));
|
|
41
|
+
}, (_rec$dataTitle = rec.dataTitle) !== null && _rec$dataTitle !== void 0 ? _rec$dataTitle : rec.id));
|
|
41
42
|
}))));
|
|
42
43
|
};
|
|
43
44
|
DatasetRecommendations.propTypes = {
|
|
@@ -32,6 +32,7 @@ var RecommendationList = function RecommendationList(props) {
|
|
|
32
32
|
};
|
|
33
33
|
var recommendationItems = function recommendationItems() {
|
|
34
34
|
return recommendations.map(function (recommendation) {
|
|
35
|
+
var _recommendation$dataT;
|
|
35
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
37
|
key: recommendation.id
|
|
37
38
|
}, /*#__PURE__*/React.createElement(_reactTooltip.default, {
|
|
@@ -60,7 +61,7 @@ var RecommendationList = function RecommendationList(props) {
|
|
|
60
61
|
target: "_blank",
|
|
61
62
|
className: "action",
|
|
62
63
|
rel: "noreferrer"
|
|
63
|
-
}, recommendation.dataTitle)));
|
|
64
|
+
}, (_recommendation$dataT = recommendation.dataTitle) !== null && _recommendation$dataT !== void 0 ? _recommendation$dataT : recommendation.id)));
|
|
64
65
|
});
|
|
65
66
|
};
|
|
66
67
|
return /*#__PURE__*/React.createElement("recommendation-list", null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -57,7 +57,7 @@ dataset-detail-view {
|
|
|
57
57
|
border:none;
|
|
58
58
|
padding:0px;
|
|
59
59
|
margin:0;
|
|
60
|
-
color
|
|
60
|
+
color:$dark-blue;
|
|
61
61
|
border-radius:0 !important;
|
|
62
62
|
display:block;
|
|
63
63
|
float:left;
|
|
@@ -120,7 +120,8 @@ dataset-detail-view {
|
|
|
120
120
|
border:none;
|
|
121
121
|
padding:0px;
|
|
122
122
|
margin:0;
|
|
123
|
-
|
|
123
|
+
font-size:1.2rem;
|
|
124
|
+
color:$dark-blue;
|
|
124
125
|
}
|
|
125
126
|
dataset-details .keyword:after {
|
|
126
127
|
content:","
|
|
@@ -128,9 +128,9 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
128
128
|
onSelect: function onSelect(tabIndex) {
|
|
129
129
|
return _this2.selectTab(tabIndex);
|
|
130
130
|
}
|
|
131
|
-
}, /*#__PURE__*/_react.default.createElement(_reactTabs.TabList, {
|
|
132
|
-
className: "header"
|
|
133
131
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
132
|
+
className: "header"
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement(_reactTabs.TabList, {
|
|
134
134
|
className: "tab-area header-tabs"
|
|
135
135
|
}, /*#__PURE__*/_react.default.createElement(_reactTabs.Tab, {
|
|
136
136
|
"data-testid": "dataset-details"
|
|
@@ -142,20 +142,35 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
142
142
|
"data-testid": "visualize"
|
|
143
143
|
}, "Visualize ", /*#__PURE__*/_react.default.createElement(_chartIcon.default, {
|
|
144
144
|
className: "chartIcon"
|
|
145
|
-
})), this.isNotDatasetDetailsTab() && /*#__PURE__*/_react.default.createElement(
|
|
146
|
-
|
|
145
|
+
}))), this.isNotDatasetDetailsTab() && /*#__PURE__*/_react.default.createElement("span", {
|
|
146
|
+
className: "help-area"
|
|
147
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
148
|
+
role: null,
|
|
147
149
|
className: "helpLink primary-color",
|
|
148
150
|
target: "_blank",
|
|
149
151
|
href: "https://en.wikipedia.org/wiki/SQL_syntax",
|
|
150
152
|
rel: "noreferrer"
|
|
151
153
|
}, "SQL Help"), this.isVisualizationEnabled() && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", null, "|"), /*#__PURE__*/_react.default.createElement("a", {
|
|
152
|
-
role: "link",
|
|
153
154
|
id: "plotlyhelp",
|
|
154
155
|
className: "helpLink primary-color",
|
|
155
156
|
target: "_blank",
|
|
156
157
|
href: "https://plotly.com/chart-studio-help/tutorials/#basic",
|
|
157
158
|
rel: "noreferrer"
|
|
158
|
-
}, "Plot.ly Help")))
|
|
159
|
+
}, "Plot.ly Help"))), this.isNotDatasetDetailsTab() && /*#__PURE__*/_react.default.createElement("span", {
|
|
160
|
+
className: "action-area"
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement(_visualizationListMenuItem.default, {
|
|
162
|
+
isAuthenticated: this.props.auth.isAuthenticated
|
|
163
|
+
}), /*#__PURE__*/_react.default.createElement(_visualizationSaveMenuItem.default, {
|
|
164
|
+
isSaveable: this.props.isSaveable,
|
|
165
|
+
handleTitleChange: this.handleTitleChange.bind(this),
|
|
166
|
+
handleSaveOrUpdate: this.handleSaveOrUpdate.bind(this),
|
|
167
|
+
linkUrl: this.generateVisualizationLink(),
|
|
168
|
+
isSaveFailure: this.props.isSaveFailure,
|
|
169
|
+
isSaveSuccess: this.props.isSaveSuccess,
|
|
170
|
+
title: this.state.localTitle,
|
|
171
|
+
allowedActions: this.props.allowedActions,
|
|
172
|
+
isAuthenticated: this.props.auth.isAuthenticated
|
|
173
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
159
174
|
className: "mobile-tab-menu"
|
|
160
175
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
161
176
|
type: "button",
|
|
@@ -168,17 +183,15 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
168
183
|
};
|
|
169
184
|
});
|
|
170
185
|
},
|
|
171
|
-
"aria-
|
|
186
|
+
"aria-controls": "mobile-tab-dropdown",
|
|
172
187
|
"aria-expanded": this.state.isMobileMenuOpen
|
|
173
188
|
}, "\u2630"), this.state.isMobileMenuOpen && /*#__PURE__*/_react.default.createElement("div", {
|
|
174
189
|
className: "mobile-tab-dropdown"
|
|
175
190
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
176
|
-
type: "button",
|
|
177
191
|
onClick: function onClick() {
|
|
178
192
|
return _this2.selectTab(0);
|
|
179
193
|
}
|
|
180
194
|
}, "Dataset Details"), /*#__PURE__*/_react.default.createElement("button", {
|
|
181
|
-
type: "button",
|
|
182
195
|
onClick: function onClick() {
|
|
183
196
|
return _this2.selectTab(1);
|
|
184
197
|
}
|
|
@@ -187,21 +200,7 @@ var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
187
200
|
onClick: function onClick() {
|
|
188
201
|
return _this2.selectTab(2);
|
|
189
202
|
}
|
|
190
|
-
}, "Visualize"))),
|
|
191
|
-
className: "action-area"
|
|
192
|
-
}, /*#__PURE__*/_react.default.createElement(_visualizationListMenuItem.default, {
|
|
193
|
-
isAuthenticated: this.props.auth.isAuthenticated
|
|
194
|
-
}), /*#__PURE__*/_react.default.createElement(_visualizationSaveMenuItem.default, {
|
|
195
|
-
isSaveable: this.props.isSaveable,
|
|
196
|
-
handleTitleChange: this.handleTitleChange.bind(this),
|
|
197
|
-
handleSaveOrUpdate: this.handleSaveOrUpdate.bind(this),
|
|
198
|
-
linkUrl: this.generateVisualizationLink(),
|
|
199
|
-
isSaveFailure: this.props.isSaveFailure,
|
|
200
|
-
isSaveSuccess: this.props.isSaveSuccess,
|
|
201
|
-
title: this.state.localTitle,
|
|
202
|
-
allowedActions: this.props.allowedActions,
|
|
203
|
-
isAuthenticated: this.props.auth.isAuthenticated
|
|
204
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactTabs.TabPanel, {
|
|
203
|
+
}, "Visualize")))), /*#__PURE__*/_react.default.createElement(_reactTabs.TabPanel, {
|
|
205
204
|
forceRender: true
|
|
206
205
|
}, /*#__PURE__*/_react.default.createElement(_datasetDetailView.default, null)), /*#__PURE__*/_react.default.createElement(_reactTabs.TabPanel, null, /*#__PURE__*/_react.default.createElement(_queryView.default, {
|
|
207
206
|
shouldAutoExecuteQuery: this.props.shouldAutoExecuteQuery
|
|
@@ -24,6 +24,11 @@ dataset-view {
|
|
|
24
24
|
font-size: 12px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
.help-area {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
.helpLink:first-of-type {
|
|
28
33
|
border-left: 1px solid $light-grey;
|
|
29
34
|
padding-left: 15px;
|
|
@@ -41,7 +46,7 @@ dataset-view {
|
|
|
41
46
|
border: 0;
|
|
42
47
|
position: relative;
|
|
43
48
|
list-style: initial;
|
|
44
|
-
padding:
|
|
49
|
+
padding: 0px 18px;
|
|
45
50
|
cursor: pointer;
|
|
46
51
|
color: $dark-grey;
|
|
47
52
|
}
|
|
@@ -105,13 +110,10 @@ dataset-view {
|
|
|
105
110
|
justify-content: space-between;
|
|
106
111
|
}
|
|
107
112
|
|
|
108
|
-
.header-tabs {
|
|
113
|
+
.header-tabs, .action-area, .help-area {
|
|
109
114
|
display: none !important;
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
.tab-area {
|
|
113
|
-
font-size: small;
|
|
114
|
-
}
|
|
115
117
|
|
|
116
118
|
.react-tabs__tab {
|
|
117
119
|
padding: 6px 12px;
|
|
@@ -38,8 +38,8 @@ var QueryView = function QueryView(props) {
|
|
|
38
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
39
|
page = _useState2[0],
|
|
40
40
|
setPage = _useState2[1];
|
|
41
|
-
var onNextPageClicked = function onNextPageClicked(
|
|
42
|
-
setPage(
|
|
41
|
+
var onNextPageClicked = function onNextPageClicked() {
|
|
42
|
+
setPage(page);
|
|
43
43
|
};
|
|
44
44
|
_react.default.useEffect(function () {
|
|
45
45
|
if (shouldAutoExecuteQuery) {
|
|
@@ -6,7 +6,7 @@ $header-grey: #ebedf0;
|
|
|
6
6
|
$light-grey: #d2d4d6;
|
|
7
7
|
$medium-grey: #97999c;
|
|
8
8
|
$dark-grey: #636466;
|
|
9
|
-
$csv-green: #
|
|
9
|
+
$csv-green: #558000;
|
|
10
10
|
$green: #71a702;
|
|
11
11
|
$error-color: #B80000;
|
|
12
12
|
$warning-background: #ffdbdd;
|
|
@@ -38,4 +38,4 @@ $below-min-break: "only screen and (max-width: #{$break-min})";
|
|
|
38
38
|
errorColor: $error-color;
|
|
39
39
|
lightBlue: $light-blue;
|
|
40
40
|
aboveMaxBreak: unquote($above-max-break);
|
|
41
|
-
}
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urbanos/react-discovery-ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.60",
|
|
4
4
|
"description": "React component for dataset discovery UI",
|
|
5
5
|
"main": "./lib/ReactDiscoveryUI.js",
|
|
6
6
|
"repository": {
|
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
"cypress": "^15.10.0",
|
|
108
108
|
"enzyme": "^3.11.0",
|
|
109
109
|
"enzyme-adapter-react-16": "^1.15.8",
|
|
110
|
+
"eslint": "^8.57.1",
|
|
110
111
|
"eslint-utils": "^3.0.0",
|
|
111
112
|
"file-loader": "^6.2.0",
|
|
112
113
|
"html-webpack-plugin": "^5.6.3",
|