@urbanos/react-discovery-ui 2.1.43
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/LICENSE +201 -0
- package/README.md +118 -0
- package/lib/ReactDiscoveryUI.js +103 -0
- package/lib/ReactDiscoveryUI.scss +13 -0
- package/lib/assets/arrow.svg +6 -0
- package/lib/assets/blk-database.svg +48 -0
- package/lib/assets/chart.svg +1 -0
- package/lib/assets/down.png +0 -0
- package/lib/assets/down.svg +1 -0
- package/lib/assets/folder_icon.png +0 -0
- package/lib/assets/folder_icon.svg +1 -0
- package/lib/assets/ic_arrow.svg +15 -0
- package/lib/assets/loadingicon.svg +57 -0
- package/lib/assets/no_image.png +0 -0
- package/lib/assets/plus.png +0 -0
- package/lib/assets/plus.svg +1 -0
- package/lib/assets/user.svg +1 -0
- package/lib/auth/auth0-client-provider.js +37 -0
- package/lib/auth/auth0-client-provider.test.js +33 -0
- package/lib/auth/auth0-wrapper.js +155 -0
- package/lib/auth/auth0-wrapper.test.js +100 -0
- package/lib/components/auth0-login-zone/auth0-login-zone.js +147 -0
- package/lib/components/auth0-login-zone/auth0-login-zone.test.js +177 -0
- package/lib/components/auth0-login-zone/index.js +9 -0
- package/lib/components/code-editor/code-editor.css +173 -0
- package/lib/components/code-editor/code-editor.js +64 -0
- package/lib/components/code-editor/index.js +9 -0
- package/lib/components/collapsable-box/collapsable-box.js +81 -0
- package/lib/components/collapsable-box/collapsable-box.scss +39 -0
- package/lib/components/collapsable-box/collapsable-box.test.js +87 -0
- package/lib/components/collapsable-box/index.js +9 -0
- package/lib/components/data-card/data-card.js +63 -0
- package/lib/components/data-card/data-card.scss +93 -0
- package/lib/components/data-card/data-card.test.js +74 -0
- package/lib/components/data-card/index.js +9 -0
- package/lib/components/data-view/data-view.js +194 -0
- package/lib/components/data-view/data-view.scss +39 -0
- package/lib/components/data-view/data-view.test.js +155 -0
- package/lib/components/data-view/index.js +9 -0
- package/lib/components/dataset-api-doc/api-example.js +120 -0
- package/lib/components/dataset-api-doc/api-example.scss +84 -0
- package/lib/components/dataset-api-doc/api-example.test.js +88 -0
- package/lib/components/dataset-api-doc/dataset-api-doc.js +117 -0
- package/lib/components/dataset-api-doc/dataset-api-doc.scss +8 -0
- package/lib/components/dataset-api-doc/dataset-api-doc.test.js +42 -0
- package/lib/components/dataset-api-doc/index.js +9 -0
- package/lib/components/dataset-details/dataset-details.js +64 -0
- package/lib/components/dataset-details/dataset-details.scss +58 -0
- package/lib/components/dataset-details/dataset-details.test.js +38 -0
- package/lib/components/dataset-details/index.js +9 -0
- package/lib/components/dataset-dictionary/dataset-dictionary.js +127 -0
- package/lib/components/dataset-dictionary/dataset-dictionary.scss +42 -0
- package/lib/components/dataset-dictionary/dataset-dictionary.test.js +286 -0
- package/lib/components/dataset-dictionary/index.js +9 -0
- package/lib/components/dataset-list/dataset-list.js +22 -0
- package/lib/components/dataset-list/dataset-list.scss +9 -0
- package/lib/components/dataset-list/dataset-list.test.js +16 -0
- package/lib/components/dataset-list/index.js +9 -0
- package/lib/components/dataset-metadata/dataset-metadata.js +169 -0
- package/lib/components/dataset-metadata/dataset-metadata.scss +34 -0
- package/lib/components/dataset-metadata/dataset-metadata.test.js +24 -0
- package/lib/components/dataset-metadata/index.js +9 -0
- package/lib/components/dataset-preview/connector.js +26 -0
- package/lib/components/dataset-preview/dataset-preview.js +58 -0
- package/lib/components/dataset-preview/dataset-preview.scss +24 -0
- package/lib/components/dataset-preview/dataset-preview.test.js +34 -0
- package/lib/components/dataset-preview/index.js +9 -0
- package/lib/components/dataset-quality/dataset-quality.js +56 -0
- package/lib/components/dataset-quality/dataset-quality.scss +24 -0
- package/lib/components/dataset-quality/dataset-quality.test.js +34 -0
- package/lib/components/dataset-quality/index.js +9 -0
- package/lib/components/dataset-recommendations/connector.js +24 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.js +47 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.scss +17 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.test.js +37 -0
- package/lib/components/dataset-recommendations/index.js +9 -0
- package/lib/components/detail-toggle-icon/detail-toggle-icon.js +41 -0
- package/lib/components/detail-toggle-icon/detail-toggle-icon.scss +13 -0
- package/lib/components/detail-toggle-icon/detail-toggle-icon.test.js +20 -0
- package/lib/components/detail-toggle-icon/index.js +9 -0
- package/lib/components/facet-list/facet-list.js +47 -0
- package/lib/components/facet-list/facet-list.scss +19 -0
- package/lib/components/facet-list/facet-list.test.js +94 -0
- package/lib/components/facet-list/index.js +9 -0
- package/lib/components/facet-sidebar/facet-sidebar.js +101 -0
- package/lib/components/facet-sidebar/facet-sidebar.scss +129 -0
- package/lib/components/facet-sidebar/facet-sidebar.test.js +93 -0
- package/lib/components/facet-sidebar/index.js +9 -0
- package/lib/components/generic-elements/alert-component/alert-component.js +51 -0
- package/lib/components/generic-elements/alert-component/alert-component.scss +26 -0
- package/lib/components/generic-elements/alert-component/alert-component.test.js +26 -0
- package/lib/components/generic-elements/alert-component/index.js +9 -0
- package/lib/components/generic-elements/arrow-button/arrow-button.js +30 -0
- package/lib/components/generic-elements/arrow-button/index.js +9 -0
- package/lib/components/generic-elements/auto-anchoring-popover/index.js +61 -0
- package/lib/components/generic-elements/back-button/back-button.js +14 -0
- package/lib/components/generic-elements/back-button/back-button.scss +14 -0
- package/lib/components/generic-elements/back-button/index.js +9 -0
- package/lib/components/generic-elements/call-to-action-button/call-to-action-button.js +118 -0
- package/lib/components/generic-elements/call-to-action-button/call-to-action-button.scss +19 -0
- package/lib/components/generic-elements/call-to-action-button/call-to-action-button.test.js +68 -0
- package/lib/components/generic-elements/call-to-action-button/index.js +9 -0
- package/lib/components/generic-elements/chart-icon/index.js +23 -0
- package/lib/components/generic-elements/checkbox/checkbox.js +50 -0
- package/lib/components/generic-elements/checkbox/checkbox.scss +44 -0
- package/lib/components/generic-elements/checkbox/checkbox.test.js +71 -0
- package/lib/components/generic-elements/checkbox/index.js +9 -0
- package/lib/components/generic-elements/error-component/error-component.js +21 -0
- package/lib/components/generic-elements/error-component/error-component.scss +16 -0
- package/lib/components/generic-elements/error-component/error-component.test.js +12 -0
- package/lib/components/generic-elements/error-component/index.js +9 -0
- package/lib/components/generic-elements/folder-icon/index.js +23 -0
- package/lib/components/generic-elements/generated-link/generated-link.js +25 -0
- package/lib/components/generic-elements/generated-link/index.js +13 -0
- package/lib/components/generic-elements/loading-element/index.js +9 -0
- package/lib/components/generic-elements/loading-element/loading-element.js +22 -0
- package/lib/components/generic-elements/loading-element/loading-element.scss +6 -0
- package/lib/components/generic-elements/loading-element/loading-element.test.js +11 -0
- package/lib/components/generic-elements/paginator/index.js +9 -0
- package/lib/components/generic-elements/paginator/paginator.js +84 -0
- package/lib/components/generic-elements/paginator/paginator.scss +38 -0
- package/lib/components/generic-elements/paginator/paginator.test.js +140 -0
- package/lib/components/generic-elements/plus-icon/index.js +21 -0
- package/lib/components/generic-elements/save-indicator/index.js +9 -0
- package/lib/components/generic-elements/save-indicator/save-indicator.js +39 -0
- package/lib/components/generic-elements/save-indicator/save-indicator.scss +31 -0
- package/lib/components/generic-elements/save-indicator/save-indicator.test.js +89 -0
- package/lib/components/generic-elements/search/index.js +9 -0
- package/lib/components/generic-elements/search/search.js +93 -0
- package/lib/components/generic-elements/search/search.scss +90 -0
- package/lib/components/generic-elements/search/search.test.js +41 -0
- package/lib/components/generic-elements/select/index.js +9 -0
- package/lib/components/generic-elements/select/select.js +44 -0
- package/lib/components/generic-elements/select/select.scss +22 -0
- package/lib/components/generic-elements/select/select.test.js +34 -0
- package/lib/components/generic-elements/share-link/index.js +9 -0
- package/lib/components/generic-elements/share-link/share-link.js +23 -0
- package/lib/components/generic-elements/share-link/share-link.scss +17 -0
- package/lib/components/generic-elements/share-link/share-link.test.js +28 -0
- package/lib/components/generic-elements/sql-icon/index.js +20 -0
- package/lib/components/generic-elements/tab-button/index.js +9 -0
- package/lib/components/generic-elements/tab-button/tab-button.js +25 -0
- package/lib/components/generic-elements/tab-button/tab-button.scss +27 -0
- package/lib/components/generic-elements/visualize-button/index.js +9 -0
- package/lib/components/generic-elements/visualize-button/visualize-button.js +37 -0
- package/lib/components/generic-elements/visualize-button/visualize-button.scss +14 -0
- package/lib/components/login-zone/connector.js +25 -0
- package/lib/components/login-zone/index.js +9 -0
- package/lib/components/login-zone/login-svgs-and-text.js +39 -0
- package/lib/components/login-zone/login-zone.js +21 -0
- package/lib/components/login-zone/login-zone.scss +115 -0
- package/lib/components/login-zone/login-zone.test.js +17 -0
- package/lib/components/login-zone/login.js +48 -0
- package/lib/components/login-zone/logout.js +39 -0
- package/lib/components/network-loading-element/connector.js +17 -0
- package/lib/components/network-loading-element/index.js +9 -0
- package/lib/components/network-loading-element/network-loading-element.js +23 -0
- package/lib/components/network-loading-element/network-loading-element.scss +21 -0
- package/lib/components/network-loading-element/network-loading-element.test.js +34 -0
- package/lib/components/organization/index.js +9 -0
- package/lib/components/organization/organization.js +27 -0
- package/lib/components/organization/organization.scss +32 -0
- package/lib/components/protected-route/protected-route.js +101 -0
- package/lib/components/protected-route/protected-route.scss +4 -0
- package/lib/components/protected-route/protected-route.test.js +63 -0
- package/lib/components/query-form/index.js +9 -0
- package/lib/components/query-form/query-form.js +262 -0
- package/lib/components/query-form/query-form.scss +167 -0
- package/lib/components/query-form/query-form.test.js +248 -0
- package/lib/components/recommendation-list/index.js +9 -0
- package/lib/components/recommendation-list/recommendation-list.js +72 -0
- package/lib/components/recommendation-list/recommendation-list.scss +61 -0
- package/lib/components/recommendation-list/recommendation-list.test.js +38 -0
- package/lib/components/remote-toggle/__snapshots__/remote-toggle.test.js.snap +3 -0
- package/lib/components/remote-toggle/index.js +13 -0
- package/lib/components/remote-toggle/remote-toggle.js +35 -0
- package/lib/components/remote-toggle/remote-toggle.scss +0 -0
- package/lib/components/remote-toggle/remote-toggle.test.js +10 -0
- package/lib/components/share/index.js +9 -0
- package/lib/components/share/share.js +109 -0
- package/lib/components/share/share.scss +66 -0
- package/lib/components/streaming-api-doc/index.js +9 -0
- package/lib/components/streaming-api-doc/streaming-api-doc.js +76 -0
- package/lib/components/streaming-api-doc/streaming-api-doc.scss +23 -0
- package/lib/components/streaming-api-doc/streaming-api-doc.test.js +24 -0
- package/lib/components/tooltip/index.js +9 -0
- package/lib/components/tooltip/tooltip.js +17 -0
- package/lib/components/tooltip/tooltip.scss +16 -0
- package/lib/components/tooltip/tooltip.test.js +19 -0
- package/lib/components/visualization-list-menu-item/index.js +9 -0
- package/lib/components/visualization-list-menu-item/visualization-list-menu-item.js +53 -0
- package/lib/components/visualization-list-menu-item/visualization-list-menu-item.scss +21 -0
- package/lib/components/visualization-list-menu-item/visualization-list-menu-item.test.js +42 -0
- package/lib/components/visualization-save-menu-item/index.js +9 -0
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.js +101 -0
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.scss +37 -0
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.test.js +185 -0
- package/lib/components/visualizations/geojson/connector.js +29 -0
- package/lib/components/visualizations/geojson/geojson-visualization.js +151 -0
- package/lib/components/visualizations/geojson/geojson-visualization.scss +24 -0
- package/lib/components/visualizations/geojson/geojson-visualization.test.js +238 -0
- package/lib/components/visualizations/geojson/index.js +9 -0
- package/lib/pages/apikey-view/apiKey-view.test.js +204 -0
- package/lib/pages/apikey-view/apikey-view.js +166 -0
- package/lib/pages/apikey-view/apikey-view.scss +340 -0
- package/lib/pages/apikey-view/connector.js +31 -0
- package/lib/pages/apikey-view/index.js +9 -0
- package/lib/pages/chart-view/chart-view.js +92 -0
- package/lib/pages/chart-view/chart-view.scss +35 -0
- package/lib/pages/chart-view/chart-view.test.js +206 -0
- package/lib/pages/chart-view/connector.js +30 -0
- package/lib/pages/chart-view/index.js +9 -0
- package/lib/pages/dataset-detail-view/connector.js +38 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view-connector.test.js +42 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view.js +99 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view.scss +190 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view.test.js +305 -0
- package/lib/pages/dataset-detail-view/index.js +9 -0
- package/lib/pages/dataset-list-view/connector.js +30 -0
- package/lib/pages/dataset-list-view/dataset-list-view.js +132 -0
- package/lib/pages/dataset-list-view/dataset-list-view.scss +242 -0
- package/lib/pages/dataset-list-view/dataset-list-view.test.js +162 -0
- package/lib/pages/dataset-list-view/index.js +9 -0
- package/lib/pages/dataset-view/connector.js +55 -0
- package/lib/pages/dataset-view/dataset-view-connector.test.js +78 -0
- package/lib/pages/dataset-view/dataset-view.js +175 -0
- package/lib/pages/dataset-view/dataset-view.scss +95 -0
- package/lib/pages/dataset-view/dataset-view.test.js +157 -0
- package/lib/pages/dataset-view/index.js +9 -0
- package/lib/pages/login-view/connector.js +25 -0
- package/lib/pages/login-view/index.js +9 -0
- package/lib/pages/login-view/login-view.js +83 -0
- package/lib/pages/login-view/login-view.scss +62 -0
- package/lib/pages/login-view/login-view.test.js +23 -0
- package/lib/pages/oauth-error-view/index.js +9 -0
- package/lib/pages/oauth-error-view/oauth-error-view.js +25 -0
- package/lib/pages/oauth-error-view/oauth-error-view.scss +13 -0
- package/lib/pages/oauth-error-view/oauth-error-view.test.js +13 -0
- package/lib/pages/oauth-view/connector.js +22 -0
- package/lib/pages/oauth-view/index.js +9 -0
- package/lib/pages/oauth-view/oauth-view.js +124 -0
- package/lib/pages/oauth-view/oauth-view.scss +7 -0
- package/lib/pages/oauth-view/oauth-view.test.js +195 -0
- package/lib/pages/query-view/connector.js +40 -0
- package/lib/pages/query-view/index.js +9 -0
- package/lib/pages/query-view/query-view.js +80 -0
- package/lib/pages/query-view/query-view.scss +39 -0
- package/lib/pages/query-view/query-view.test.js +104 -0
- package/lib/pages/user-profile-view/connector.js +39 -0
- package/lib/pages/user-profile-view/index.js +9 -0
- package/lib/pages/user-profile-view/user-profile-view.js +154 -0
- package/lib/pages/user-profile-view/user-profile-view.scss +81 -0
- package/lib/pages/user-profile-view/user-profile-view.test.js +129 -0
- package/lib/pages/visualization-view/connector.js +52 -0
- package/lib/pages/visualization-view/index.js +9 -0
- package/lib/pages/visualization-view/visualization-view-connector.test.js +62 -0
- package/lib/pages/visualization-view/visualization-view.js +128 -0
- package/lib/pages/visualization-view/visualization-view.scss +115 -0
- package/lib/pages/visualization-view/visualization-view.test.js +188 -0
- package/lib/routes.js +18 -0
- package/lib/search-params/search-params-manager.js +171 -0
- package/lib/search-params/search-params-manager.test.js +490 -0
- package/lib/store/actions.js +428 -0
- package/lib/store/dataset-selectors.js +47 -0
- package/lib/store/dataset-selectors.test.js +154 -0
- package/lib/store/query-selectors.js +53 -0
- package/lib/store/query-selectors.test.js +153 -0
- package/lib/store/reducers/index.js +20 -0
- package/lib/store/reducers/query-reducer.js +52 -0
- package/lib/store/reducers/query-reducer.test.js +89 -0
- package/lib/store/reducers/reducers.js +196 -0
- package/lib/store/reducers/reducers.test.js +309 -0
- package/lib/store/reducers/visualization-reducer.js +167 -0
- package/lib/store/reducers/visualization-reducer.test.js +426 -0
- package/lib/store/sagas/api-invoker.js +79 -0
- package/lib/store/sagas/api-invoker.test.js +139 -0
- package/lib/store/sagas/apiKey-saga.js +81 -0
- package/lib/store/sagas/apiKey-saga.test.js +57 -0
- package/lib/store/sagas/dataset-download-saga.js +43 -0
- package/lib/store/sagas/dataset-list-saga.js +49 -0
- package/lib/store/sagas/dataset-list-saga.test.js +72 -0
- package/lib/store/sagas/dataset-preview-saga.js +44 -0
- package/lib/store/sagas/dataset-query-saga.js +43 -0
- package/lib/store/sagas/dataset-recommendation-saga.js +40 -0
- package/lib/store/sagas/dataset-saga.js +50 -0
- package/lib/store/sagas/freestyle-query-saga.js +127 -0
- package/lib/store/sagas/freestyle-query-saga.test.js +145 -0
- package/lib/store/sagas/index.js +44 -0
- package/lib/store/sagas/login-saga.js +85 -0
- package/lib/store/sagas/login-saga.test.js +84 -0
- package/lib/store/sagas/logout-saga.js +96 -0
- package/lib/store/sagas/oauth-saga.js +78 -0
- package/lib/store/sagas/oauth-saga.test.js +51 -0
- package/lib/store/sagas/process-login-saga.js +62 -0
- package/lib/store/sagas/process-login-saga.test.js +83 -0
- package/lib/store/sagas/visualization-saga.js +371 -0
- package/lib/store/sagas/visualization-saga.test.js +388 -0
- package/lib/store/selectors.js +83 -0
- package/lib/store/visualization-selectors.js +85 -0
- package/lib/store/visualization-selectors.test.js +195 -0
- package/lib/styles/mixins.scss +117 -0
- package/lib/styles/variables.scss +41 -0
- package/lib/utils/file-type-utils.js +18 -0
- package/lib/utils/file-type-utils.test.js +29 -0
- package/lib/utils/geojson-utils.js +70 -0
- package/lib/utils/geojson-utils.test.js +129 -0
- package/lib/utils/http-clients.js +218 -0
- package/lib/utils/http-clients.test.js +88 -0
- package/lib/utils/index.js +34 -0
- package/lib/utils/modified-date-string-builder.js +29 -0
- package/lib/utils/modified-date-string-builder.test.js +93 -0
- package/lib/utils/query-string-builder.js +38 -0
- package/lib/utils/query-string-builder.test.js +33 -0
- package/lib/utils/recommendation-utils.js +12 -0
- package/lib/utils/recommendation-utils.test.js +9 -0
- package/package.json +172 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
require("./dataset-preview.scss");
|
|
10
|
+
require("react-table/react-table.css");
|
|
11
|
+
var _collapsableBox = _interopRequireDefault(require("../../components/collapsable-box"));
|
|
12
|
+
var _dataView = _interopRequireDefault(require("../data-view"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
17
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
22
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
23
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
24
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
25
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
26
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
27
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
28
|
+
function _default() {
|
|
29
|
+
_classCallCheck(this, _default);
|
|
30
|
+
return _callSuper(this, _default, arguments);
|
|
31
|
+
}
|
|
32
|
+
_inherits(_default, _Component);
|
|
33
|
+
return _createClass(_default, [{
|
|
34
|
+
key: "componentDidMount",
|
|
35
|
+
value: function componentDidMount() {
|
|
36
|
+
this.props.retrieveDatasetPreview(this.props.datasetId);
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
key: "render",
|
|
40
|
+
value: function render() {
|
|
41
|
+
var datasetPreview = this.props.datasetPreview || {};
|
|
42
|
+
var columns = datasetPreview.meta ? datasetPreview.meta.columns : [];
|
|
43
|
+
var data = datasetPreview.data || datasetPreview;
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
id: "dataset-preview"
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_collapsableBox.default, {
|
|
47
|
+
title: "Sample",
|
|
48
|
+
headerHtml: "This only shows the first 50 rows, to view the entire dataset please download",
|
|
49
|
+
expanded: true
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_dataView.default, {
|
|
51
|
+
data: data,
|
|
52
|
+
columns: columns,
|
|
53
|
+
loading: this.props.previewLoading,
|
|
54
|
+
format: this.props.format
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
}]);
|
|
58
|
+
}(_react.Component);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@import '../../styles/variables.scss';
|
|
2
|
+
@import '../../styles/mixins.scss';
|
|
3
|
+
#dataset-preview {
|
|
4
|
+
.header-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.header-text-items {
|
|
10
|
+
margin: 1rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.preview-header {
|
|
14
|
+
@include header();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#dataset-preview-raw {
|
|
18
|
+
overflow: scroll;
|
|
19
|
+
max-height: 30rem;
|
|
20
|
+
min-height: 10rem;
|
|
21
|
+
padding: 1rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mount
|
|
3
|
+
} from 'enzyme'
|
|
4
|
+
import DatasetPreview from './dataset-preview'
|
|
5
|
+
|
|
6
|
+
describe('dataset preview', () => {
|
|
7
|
+
describe('mounting', () => {
|
|
8
|
+
let retrieveDatasetPreviewMock
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
const matchMedia = jest.fn()
|
|
11
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
12
|
+
writable: true,
|
|
13
|
+
value: jest.fn().mockImplementation(query => ({
|
|
14
|
+
matches: true
|
|
15
|
+
}))
|
|
16
|
+
})
|
|
17
|
+
retrieveDatasetPreviewMock = jest.fn()
|
|
18
|
+
mount(<DatasetPreview
|
|
19
|
+
datasetId='12345'
|
|
20
|
+
retrieveDatasetPreview={retrieveDatasetPreviewMock}
|
|
21
|
+
datasetPreview={
|
|
22
|
+
{
|
|
23
|
+
data: [],
|
|
24
|
+
meta: { columns: [] }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/>)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('retrieveDatasetPreview should be called', () => {
|
|
31
|
+
expect(retrieveDatasetPreviewMock).toBeCalled()
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _connector = _interopRequireDefault(require("./connector"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _connector.default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
require("./dataset-quality.scss");
|
|
10
|
+
var _collapsableBox = _interopRequireDefault(require("../../components/collapsable-box"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
13
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
14
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
19
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
22
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
23
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
25
|
+
function _default() {
|
|
26
|
+
_classCallCheck(this, _default);
|
|
27
|
+
return _callSuper(this, _default, arguments);
|
|
28
|
+
}
|
|
29
|
+
_inherits(_default, _Component);
|
|
30
|
+
return _createClass(_default, [{
|
|
31
|
+
key: "streamingHeader",
|
|
32
|
+
value: function streamingHeader() {
|
|
33
|
+
if (!this.props.completeness) {
|
|
34
|
+
return /*#__PURE__*/React.createElement("div", null);
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "quality-header"
|
|
38
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "completeness-score"
|
|
40
|
+
}, Math.round(this.props.completeness.total_score * 100), "%"), /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "completeness-description"
|
|
42
|
+
}, "The percentage of relevant non-empty fields contained in the dataset."));
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "render",
|
|
46
|
+
value: function render() {
|
|
47
|
+
return /*#__PURE__*/React.createElement("dataset-quality", {
|
|
48
|
+
class: "dataset-quality"
|
|
49
|
+
}, /*#__PURE__*/React.createElement(_collapsableBox.default, {
|
|
50
|
+
title: "Completeness",
|
|
51
|
+
headerHtml: this.streamingHeader(),
|
|
52
|
+
expanded: false
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", null)));
|
|
54
|
+
}
|
|
55
|
+
}]);
|
|
56
|
+
}(_react.Component);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@import '../../styles/mixins.scss';
|
|
2
|
+
@import '../../styles/variables.scss';
|
|
3
|
+
|
|
4
|
+
dataset-quality {
|
|
5
|
+
|
|
6
|
+
.completeness-score {
|
|
7
|
+
color: $csv-green;
|
|
8
|
+
font-size: 2rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.quality-header {
|
|
12
|
+
@include flex-row();
|
|
13
|
+
margin: 1rem 1rem 1rem 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.completeness-score {
|
|
17
|
+
@include flex-column();
|
|
18
|
+
margin-right: 1rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.completeness-description {
|
|
22
|
+
@include flex-column();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { render } from 'enzyme'
|
|
2
|
+
import DatasetQuality from './dataset-quality'
|
|
3
|
+
|
|
4
|
+
describe('Dataset Quality ', () => {
|
|
5
|
+
describe('Completeness', () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
const matchMedia = jest.fn()
|
|
8
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
9
|
+
writable: true,
|
|
10
|
+
value: jest.fn().mockImplementation(query => ({
|
|
11
|
+
matches: true
|
|
12
|
+
}))
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('should convert quality to a percentage', () => {
|
|
17
|
+
const subject = render(<DatasetQuality completeness={{ total_score: 0.95 }} />)
|
|
18
|
+
expect(subject.find('.completeness-score').text()).toEqual('95%')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('rounds to nearest number', () => {
|
|
22
|
+
let subject = render(<DatasetQuality completeness={{ total_score: 0.954312 }} />)
|
|
23
|
+
expect(subject.find('.completeness-score').text()).toEqual('95%')
|
|
24
|
+
|
|
25
|
+
subject = render(<DatasetQuality completeness={{ total_score: 0.956312 }} />)
|
|
26
|
+
expect(subject.find('.completeness-score').text()).toEqual('96%')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('should not display completeness if it is null', () => {
|
|
30
|
+
const subject = render(<DatasetQuality completeness={null} />)
|
|
31
|
+
expect(subject.find('quality-header').length).toEqual(0)
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _datasetQuality = _interopRequireDefault(require("./dataset-quality"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _datasetQuality.default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactRedux = require("react-redux");
|
|
8
|
+
var _datasetRecommendations = _interopRequireDefault(require("./dataset-recommendations"));
|
|
9
|
+
var _selectors = require("../../store/selectors");
|
|
10
|
+
var _actions = require("../../store/actions");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
13
|
+
return {
|
|
14
|
+
recommendations: (0, _selectors.getDatasetRecommendations)(state)
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
18
|
+
return {
|
|
19
|
+
getRecommendations: function getRecommendations(datasetId) {
|
|
20
|
+
return dispatch((0, _actions.datasetRecommendations)(datasetId));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_datasetRecommendations.default);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
require("./dataset-recommendations.scss");
|
|
9
|
+
var _collapsableBox = _interopRequireDefault(require("../collapsable-box"));
|
|
10
|
+
var _utils = require("../../utils");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var DatasetRecommendations = function DatasetRecommendations(props) {
|
|
13
|
+
var dataset = props.dataset,
|
|
14
|
+
getRecommendations = props.getRecommendations,
|
|
15
|
+
recommendations = props.recommendations;
|
|
16
|
+
var onInit = function onInit() {
|
|
17
|
+
getRecommendations(dataset.id);
|
|
18
|
+
};
|
|
19
|
+
React.useEffect(onInit, []);
|
|
20
|
+
var isContentUnavailable = !recommendations || recommendations.length == 0;
|
|
21
|
+
if (isContentUnavailable) {
|
|
22
|
+
return /*#__PURE__*/React.createElement("dataset-recommendations", null);
|
|
23
|
+
}
|
|
24
|
+
return /*#__PURE__*/React.createElement("dataset-recommendations", {
|
|
25
|
+
class: "dataset-recommendations"
|
|
26
|
+
}, /*#__PURE__*/React.createElement(_collapsableBox.default, {
|
|
27
|
+
title: "Recommended Datasets",
|
|
28
|
+
expanded: false
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: "recommendation-content"
|
|
31
|
+
}, recommendations.map(function (rec) {
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "recommended-dataset",
|
|
34
|
+
key: rec.id
|
|
35
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
36
|
+
role: "link",
|
|
37
|
+
href: _utils.RecommendationUtils.getDatasetUrl(rec),
|
|
38
|
+
target: "_blank"
|
|
39
|
+
}, rec.dataTitle));
|
|
40
|
+
}))));
|
|
41
|
+
};
|
|
42
|
+
DatasetRecommendations.propTypes = {
|
|
43
|
+
dataset: _propTypes.default.object.isRequired,
|
|
44
|
+
getRecommendations: _propTypes.default.func.isRequired,
|
|
45
|
+
recommendations: _propTypes.default.array
|
|
46
|
+
};
|
|
47
|
+
var _default = exports.default = DatasetRecommendations;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../../styles/mixins.scss';
|
|
2
|
+
@import '../../styles/variables.scss';
|
|
3
|
+
|
|
4
|
+
dataset-recommendations {
|
|
5
|
+
.recommended-dataset {
|
|
6
|
+
padding-top: 0.5em;
|
|
7
|
+
padding-left: 1em;
|
|
8
|
+
|
|
9
|
+
a {
|
|
10
|
+
@include link();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.recommendation-content:last-child {
|
|
16
|
+
padding-bottom: 0.5em;
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
import DatasetRecommendations from './dataset-recommendations'
|
|
3
|
+
import { recommendations } from '../../../test-helpers/recommendations'
|
|
4
|
+
|
|
5
|
+
let subject
|
|
6
|
+
|
|
7
|
+
describe('DatasetRecommendations', () => {
|
|
8
|
+
describe('with no recommedations found', () => {
|
|
9
|
+
test('returns no content when recommendations is undefined', () => {
|
|
10
|
+
subject = createSubject(recommendations)
|
|
11
|
+
expect(subject.find(DatasetRecommendations).children().length).toEqual(0)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('returns no content when there are no recommendations', () => {
|
|
15
|
+
subject = createSubject([])
|
|
16
|
+
expect(subject.find(DatasetRecommendations).children().length).toEqual(0)
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
describe('rendering', () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
subject = createSubject(recommendations)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('returns urls for each recommended dataset', () => {
|
|
26
|
+
expect(subject.find('.recommended-dataset').length).toEqual(recommendations.length)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
function createSubject (recommendations) {
|
|
32
|
+
return shallow(<DatasetRecommendations
|
|
33
|
+
dataset={{}}
|
|
34
|
+
getRecommendations={jest.fn}
|
|
35
|
+
recommendations={recommendations}
|
|
36
|
+
/>)
|
|
37
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _connector = _interopRequireDefault(require("./connector"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _connector.default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("./detail-toggle-icon.scss");
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _ExpandLess = _interopRequireDefault(require("@material-ui/icons/ExpandLess"));
|
|
11
|
+
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
14
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
15
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
20
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
23
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
24
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
25
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
26
|
+
function _default(props) {
|
|
27
|
+
_classCallCheck(this, _default);
|
|
28
|
+
return _callSuper(this, _default, [props]);
|
|
29
|
+
}
|
|
30
|
+
_inherits(_default, _Component);
|
|
31
|
+
return _createClass(_default, [{
|
|
32
|
+
key: "render",
|
|
33
|
+
value: function render() {
|
|
34
|
+
return /*#__PURE__*/React.createElement("detail-toggle-icon", null, this.props.expanded ? /*#__PURE__*/React.createElement(_ExpandLess.default, {
|
|
35
|
+
className: "collapse-icon"
|
|
36
|
+
}) : /*#__PURE__*/React.createElement(_ExpandMore.default, {
|
|
37
|
+
className: "collapse-icon"
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}]);
|
|
41
|
+
}(_react.Component);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallow, render } from 'enzyme'
|
|
2
|
+
import DetailToggleIcon from './detail-toggle-icon'
|
|
3
|
+
import ExpandLess from '@material-ui/icons/ExpandLess'
|
|
4
|
+
import ExpandMore from '@material-ui/icons/ExpandMore'
|
|
5
|
+
|
|
6
|
+
describe('detail toggle icon', () => {
|
|
7
|
+
let subject
|
|
8
|
+
|
|
9
|
+
test('is expanded when props.expanded is true', () => {
|
|
10
|
+
subject = shallow(<DetailToggleIcon expanded />)
|
|
11
|
+
expect(subject.find(ExpandLess)).toHaveLength(1)
|
|
12
|
+
expect(subject.find(ExpandMore)).toHaveLength(0)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('is expanded when props.expanded is false', () => {
|
|
16
|
+
subject = shallow(<DetailToggleIcon expanded={false} />)
|
|
17
|
+
expect(subject.find(ExpandLess)).toHaveLength(0)
|
|
18
|
+
expect(subject.find(ExpandMore)).toHaveLength(1)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _detailToggleIcon = _interopRequireDefault(require("./detail-toggle-icon"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _detailToggleIcon.default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
+
var _checkbox = _interopRequireDefault(require("../generic-elements/checkbox"));
|
|
9
|
+
require("./facet-list.scss");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var FacetList = function FacetList(props) {
|
|
12
|
+
var getText = function getText(name, count) {
|
|
13
|
+
return "".concat(name || 'Unorganized', " (").concat(count, ")");
|
|
14
|
+
};
|
|
15
|
+
var simplePluralize = function simplePluralize(word) {
|
|
16
|
+
return word.endsWith('s') ? word : "".concat(word, "s");
|
|
17
|
+
};
|
|
18
|
+
var showMore = props.facets.length > props.limit;
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
"data-testid": "facet-list-".concat(props.title),
|
|
21
|
+
className: "section facet-list"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: "section-header"
|
|
24
|
+
}, simplePluralize(props.title)), _lodash.default.chain(props.facets).orderBy(['selected', 'count', function (facet) {
|
|
25
|
+
return facet.name.toLowerCase();
|
|
26
|
+
}], ['desc', 'desc', 'asc']).slice(0, props.limit).map(function (_ref) {
|
|
27
|
+
var name = _ref.name,
|
|
28
|
+
count = _ref.count,
|
|
29
|
+
selected = _ref.selected;
|
|
30
|
+
return /*#__PURE__*/React.createElement(_checkbox.default, {
|
|
31
|
+
id: "facet-list-".concat(name),
|
|
32
|
+
clickHandler: function clickHandler() {
|
|
33
|
+
return props.clickHandler(name);
|
|
34
|
+
},
|
|
35
|
+
text: getText(name, count),
|
|
36
|
+
selected: selected,
|
|
37
|
+
key: name
|
|
38
|
+
});
|
|
39
|
+
}).value(), showMore && /*#__PURE__*/React.createElement("a", {
|
|
40
|
+
role: "link",
|
|
41
|
+
className: "show-more",
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
return props.showMoreHandler(props.title, props.facets);
|
|
44
|
+
}
|
|
45
|
+
}, "Show more"));
|
|
46
|
+
};
|
|
47
|
+
var _default = exports.default = FacetList;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import "../../styles/variables.scss";
|
|
2
|
+
@import "../../styles/mixins.scss";
|
|
3
|
+
|
|
4
|
+
.facet-list {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
|
|
8
|
+
.section-header {
|
|
9
|
+
@include header-small();
|
|
10
|
+
text-transform: uppercase;
|
|
11
|
+
padding-top: 1.25rem;
|
|
12
|
+
padding-bottom: 0.25rem;
|
|
13
|
+
border-top: 1px solid $light-grey;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.show-more {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import FacetList from './facet-list'
|
|
2
|
+
import Checkbox from '../generic-elements/checkbox'
|
|
3
|
+
import { shallow, mount } from 'enzyme'
|
|
4
|
+
|
|
5
|
+
describe('facet list', () => {
|
|
6
|
+
let subject, mockClickHandler, mockShowMoreHandler
|
|
7
|
+
|
|
8
|
+
const facets = [
|
|
9
|
+
{ name: 'neat COTA', count: 1, selected: true },
|
|
10
|
+
{ name: 'Apple', count: 1, selected: false },
|
|
11
|
+
{ name: 'Massive Data', count: 5, selected: false },
|
|
12
|
+
{ name: 'Interesting Things', count: 3, selected: true },
|
|
13
|
+
{ name: 'Conduent', count: 2, selected: false },
|
|
14
|
+
{ name: 'Weyland-Yutani', count: 1, selected: false }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
mockClickHandler = jest.fn()
|
|
19
|
+
mockShowMoreHandler = jest.fn()
|
|
20
|
+
subject = shallow(
|
|
21
|
+
<FacetList
|
|
22
|
+
facets={facets}
|
|
23
|
+
clickHandler={mockClickHandler}
|
|
24
|
+
title='Organization'
|
|
25
|
+
limit={5}
|
|
26
|
+
showMoreHandler={mockShowMoreHandler}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('renders the given facets', () => {
|
|
32
|
+
expect(subject.find(Checkbox)).toHaveLength(5)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('sorts the facets in descending order by selected, count and name and limits the number displayed', () => {
|
|
36
|
+
const facets = subject.find(Checkbox).map(item => item.props().text)
|
|
37
|
+
|
|
38
|
+
expect(facets).toEqual([
|
|
39
|
+
'Interesting Things (3)',
|
|
40
|
+
'neat COTA (1)',
|
|
41
|
+
'Massive Data (5)',
|
|
42
|
+
'Conduent (2)',
|
|
43
|
+
'Apple (1)'
|
|
44
|
+
])
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('gives facets the selected class if the facet is selected', () => {
|
|
48
|
+
expect(subject.find(Checkbox).filterWhere(n => n.props().selected)).toHaveLength(2)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
describe('show more', () => {
|
|
52
|
+
it('button appears when there are more facets than limit', () => {
|
|
53
|
+
expect(subject.find('.show-more')).toHaveLength(1)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('button does not appear when there are fewer facets than limit', () => {
|
|
57
|
+
subject = shallow(
|
|
58
|
+
<FacetList
|
|
59
|
+
facets={facets}
|
|
60
|
+
clickHandler={mockClickHandler}
|
|
61
|
+
title='Organization'
|
|
62
|
+
limit={6}
|
|
63
|
+
showMoreHandler={mockShowMoreHandler}
|
|
64
|
+
/>)
|
|
65
|
+
|
|
66
|
+
expect(subject.find('.show-more')).toHaveLength(0)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('should call the showMoreHandler when the show more button is clicked', () => {
|
|
70
|
+
subject.find('.show-more').simulate('click')
|
|
71
|
+
|
|
72
|
+
expect(mockShowMoreHandler).toHaveBeenCalledWith('Organization', facets)
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
describe('title', () => {
|
|
77
|
+
it('should add s to title when it does not exist', () => {
|
|
78
|
+
expect(subject.find('.section-header').text()).toEqual('Organizations')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('should not add s to title when it does exist', () => {
|
|
82
|
+
subject = shallow(
|
|
83
|
+
<FacetList
|
|
84
|
+
facets={facets}
|
|
85
|
+
clickHandler={mockClickHandler}
|
|
86
|
+
title='Organizations'
|
|
87
|
+
limit={6}
|
|
88
|
+
showMoreHandler={mockShowMoreHandler}
|
|
89
|
+
/>)
|
|
90
|
+
|
|
91
|
+
expect(subject.find('.section-header').text()).toEqual('Organizations')
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})
|