@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,175 @@
|
|
|
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
|
+
var _reactTabs = require("react-tabs");
|
|
10
|
+
require("react-tabs/style/react-tabs.css");
|
|
11
|
+
var _chartIcon = _interopRequireDefault(require("../../components/generic-elements/chart-icon"));
|
|
12
|
+
var _sqlIcon = _interopRequireDefault(require("../../components/generic-elements/sql-icon"));
|
|
13
|
+
var _qs = _interopRequireDefault(require("qs"));
|
|
14
|
+
var _routes = _interopRequireDefault(require("../../routes"));
|
|
15
|
+
var _reactRouter = require("react-router");
|
|
16
|
+
require("./dataset-view.scss");
|
|
17
|
+
var _queryView = _interopRequireDefault(require("../query-view"));
|
|
18
|
+
var _chartView = _interopRequireDefault(require("../chart-view"));
|
|
19
|
+
var _datasetDetailView = _interopRequireDefault(require("../dataset-detail-view"));
|
|
20
|
+
var _loadingElement = _interopRequireDefault(require("../../components/generic-elements/loading-element"));
|
|
21
|
+
var _visualizationListMenuItem = _interopRequireDefault(require("../../components/visualization-list-menu-item"));
|
|
22
|
+
var _visualizationSaveMenuItem = _interopRequireDefault(require("../../components/visualization-save-menu-item"));
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
+
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); }
|
|
25
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
26
|
+
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); } }
|
|
27
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
29
|
+
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); }
|
|
30
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
31
|
+
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); }
|
|
32
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
33
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
34
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
35
|
+
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); }
|
|
36
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
37
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
38
|
+
function _default() {
|
|
39
|
+
var _this;
|
|
40
|
+
_classCallCheck(this, _default);
|
|
41
|
+
_this = _callSuper(this, _default);
|
|
42
|
+
_this.state = {
|
|
43
|
+
index: 0,
|
|
44
|
+
localTitle: ''
|
|
45
|
+
};
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
_inherits(_default, _Component);
|
|
49
|
+
return _createClass(_default, [{
|
|
50
|
+
key: "generateVisualizationLink",
|
|
51
|
+
value: function generateVisualizationLink() {
|
|
52
|
+
return this.props.visualizationId && (0, _reactRouter.generatePath)(_routes.default.visualizationView, {
|
|
53
|
+
id: this.props.visualizationId
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "componentDidMount",
|
|
58
|
+
value: function componentDidMount() {
|
|
59
|
+
this.props.reset();
|
|
60
|
+
this.props.retrieveDatasetDetails(this.props.match.params.organizationName, this.props.match.params.datasetName);
|
|
61
|
+
if (this.state.index != this.getIndexFromQueryParams()) {
|
|
62
|
+
this.setState({
|
|
63
|
+
index: this.getIndexFromQueryParams()
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "getIndexFromQueryParams",
|
|
69
|
+
value: function getIndexFromQueryParams() {
|
|
70
|
+
var _qs$parse = _qs.default.parse(this.props.location.search, {
|
|
71
|
+
ignoreQueryPrefix: true
|
|
72
|
+
}),
|
|
73
|
+
selectedIndex = _qs$parse.selectedIndex;
|
|
74
|
+
return selectedIndex ? parseInt(selectedIndex) : 0;
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
key: "handleTitleChange",
|
|
78
|
+
value: function handleTitleChange(event) {
|
|
79
|
+
if (event.target.value !== this.state.localTitle) {
|
|
80
|
+
this.setState({
|
|
81
|
+
localTitle: event.target.value
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "handleSaveOrUpdate",
|
|
87
|
+
value: function handleSaveOrUpdate(_ref) {
|
|
88
|
+
var shouldCreateCopy = _ref.shouldCreateCopy;
|
|
89
|
+
this.props.save({
|
|
90
|
+
id: this.props.visualizationId,
|
|
91
|
+
title: this.state.localTitle,
|
|
92
|
+
query: this.props.query,
|
|
93
|
+
shouldCreateCopy: shouldCreateCopy
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "isNotDatasetDetailsTab",
|
|
98
|
+
value: function isNotDatasetDetailsTab() {
|
|
99
|
+
return this.state.index !== 0;
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "isVisualizationEnabled",
|
|
103
|
+
value: function isVisualizationEnabled() {
|
|
104
|
+
return window.DISABLE_VISUALIZATIONS === 'false';
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "render",
|
|
108
|
+
value: function render() {
|
|
109
|
+
var _this2 = this;
|
|
110
|
+
if (!this.props.isDatasetLoaded) {
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement("dataset-view", null, /*#__PURE__*/_react.default.createElement(_loadingElement.default, null));
|
|
112
|
+
}
|
|
113
|
+
if (this.props.isRemoteDataset || this.props.isHostDataset) {
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement("dataset-view", null, /*#__PURE__*/_react.default.createElement(_datasetDetailView.default, null));
|
|
115
|
+
}
|
|
116
|
+
return /*#__PURE__*/_react.default.createElement("dataset-view", null, /*#__PURE__*/_react.default.createElement(_reactTabs.Tabs, {
|
|
117
|
+
className: "dataset-view",
|
|
118
|
+
selectedIndex: this.state.index,
|
|
119
|
+
onSelect: function onSelect(tabIndex) {
|
|
120
|
+
return _this2.setState({
|
|
121
|
+
index: tabIndex
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, /*#__PURE__*/_react.default.createElement(_reactTabs.TabList, {
|
|
125
|
+
className: "header"
|
|
126
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
127
|
+
className: "tab-area"
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement(_reactTabs.Tab, {
|
|
129
|
+
"data-testid": "dataset-details"
|
|
130
|
+
}, "Dataset Details"), /*#__PURE__*/_react.default.createElement(_reactTabs.Tab, {
|
|
131
|
+
"data-testid": "dataset-write-sql"
|
|
132
|
+
}, "Write SQL ", /*#__PURE__*/_react.default.createElement(_sqlIcon.default, {
|
|
133
|
+
className: "sqlIcon"
|
|
134
|
+
})), this.isVisualizationEnabled() && /*#__PURE__*/_react.default.createElement(_reactTabs.Tab, {
|
|
135
|
+
"data-testid": "visualize"
|
|
136
|
+
}, "Visualize ", /*#__PURE__*/_react.default.createElement(_chartIcon.default, {
|
|
137
|
+
className: "chartIcon"
|
|
138
|
+
})), this.isNotDatasetDetailsTab() && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
139
|
+
role: "link",
|
|
140
|
+
className: "helpLink primary-color",
|
|
141
|
+
target: "_blank",
|
|
142
|
+
href: "https://en.wikipedia.org/wiki/SQL_syntax"
|
|
143
|
+
}, "SQL Help"), this.isVisualizationEnabled() && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", null, "|"), /*#__PURE__*/_react.default.createElement("a", {
|
|
144
|
+
role: "link",
|
|
145
|
+
id: "plotlyhelp",
|
|
146
|
+
className: "helpLink primary-color",
|
|
147
|
+
target: "_blank",
|
|
148
|
+
href: "https://plotly.com/chart-studio-help/tutorials/#basic"
|
|
149
|
+
}, "Plot.ly Help")))), this.isNotDatasetDetailsTab() && /*#__PURE__*/_react.default.createElement("span", {
|
|
150
|
+
className: "action-area"
|
|
151
|
+
}, /*#__PURE__*/_react.default.createElement(_visualizationListMenuItem.default, {
|
|
152
|
+
isAuthenticated: this.props.auth.isAuthenticated
|
|
153
|
+
}), /*#__PURE__*/_react.default.createElement(_visualizationSaveMenuItem.default, {
|
|
154
|
+
isSaveable: this.props.isSaveable,
|
|
155
|
+
handleTitleChange: this.handleTitleChange.bind(this),
|
|
156
|
+
handleSaveOrUpdate: this.handleSaveOrUpdate.bind(this),
|
|
157
|
+
linkUrl: this.generateVisualizationLink(),
|
|
158
|
+
isSaveFailure: this.props.isSaveFailure,
|
|
159
|
+
isSaveSuccess: this.props.isSaveSuccess,
|
|
160
|
+
title: this.state.localTitle,
|
|
161
|
+
allowedActions: this.props.allowedActions,
|
|
162
|
+
isAuthenticated: this.props.auth.isAuthenticated
|
|
163
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactTabs.TabPanel, {
|
|
164
|
+
forceRender: true
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement(_datasetDetailView.default, null)), /*#__PURE__*/_react.default.createElement(_reactTabs.TabPanel, null, /*#__PURE__*/_react.default.createElement(_queryView.default, {
|
|
166
|
+
shouldAutoExecuteQuery: this.props.shouldAutoExecuteQuery
|
|
167
|
+
})), this.isVisualizationEnabled() && /*#__PURE__*/_react.default.createElement(_reactTabs.TabPanel, {
|
|
168
|
+
className: "visualization",
|
|
169
|
+
selectedClassName: "visualization--selected"
|
|
170
|
+
}, /*#__PURE__*/_react.default.createElement(_chartView.default, {
|
|
171
|
+
shouldAutoExecuteQuery: this.props.shouldAutoExecuteQuery
|
|
172
|
+
}))));
|
|
173
|
+
}
|
|
174
|
+
}]);
|
|
175
|
+
}(_react.Component);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@import "../../styles/mixins.scss";
|
|
2
|
+
@import "../../styles/variables.scss";
|
|
3
|
+
@import "../visualization-view/visualization-view.scss";
|
|
4
|
+
|
|
5
|
+
dataset-view {
|
|
6
|
+
@extend visualization-view;
|
|
7
|
+
|
|
8
|
+
.chartIcon {
|
|
9
|
+
padding-left: 5px;
|
|
10
|
+
|
|
11
|
+
path {
|
|
12
|
+
fill: $medium-grey;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sqlIcon {
|
|
17
|
+
padding-left: 5px;
|
|
18
|
+
fill: $medium-grey;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.helpLink {
|
|
22
|
+
padding: 5px;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.helpLink:first-of-type {
|
|
28
|
+
border-left: 1px solid $light-grey;
|
|
29
|
+
padding-left: 15px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.react-tabs__tab-list {
|
|
33
|
+
border-bottom: 0;
|
|
34
|
+
box-shadow: 0px 1px 3px $light-grey;
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.react-tabs__tab {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
border: 0;
|
|
42
|
+
position: relative;
|
|
43
|
+
list-style: initial;
|
|
44
|
+
padding: 12px 24px;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
color: $dark-grey;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.react-tabs__tab--selected {
|
|
50
|
+
background: transparent;
|
|
51
|
+
border-bottom: 5px solid;
|
|
52
|
+
border-color: $light-blue;
|
|
53
|
+
color: $almost-black;
|
|
54
|
+
|
|
55
|
+
.sqlIcon {
|
|
56
|
+
padding-left: 5px;
|
|
57
|
+
fill: $almost-black;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.chartIcon {
|
|
61
|
+
path {
|
|
62
|
+
fill: $almost-black;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.react-tabs__tab:hover {
|
|
68
|
+
color: $almost-black;
|
|
69
|
+
|
|
70
|
+
.sqlIcon {
|
|
71
|
+
padding-left: 5px;
|
|
72
|
+
fill: $almost-black;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.chartIcon {
|
|
76
|
+
path {
|
|
77
|
+
fill: $almost-black;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.visualization {
|
|
83
|
+
height: 85vh;
|
|
84
|
+
width: 100vw;
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.visualization--selected {
|
|
89
|
+
display: flex;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
loading-element {
|
|
93
|
+
@include default-loading-icon();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
import { Tab, TabPanel, TabList } from 'react-tabs'
|
|
3
|
+
|
|
4
|
+
import DatasetView from './dataset-view'
|
|
5
|
+
import QueryView from '../query-view'
|
|
6
|
+
import ChartView from '../chart-view'
|
|
7
|
+
import DatasetDetailView from '../dataset-detail-view'
|
|
8
|
+
import LoadingElement from '../../components/generic-elements/loading-element'
|
|
9
|
+
import VisualizationSaveMenuItem from '../../components/visualization-save-menu-item'
|
|
10
|
+
import VisualizationListMenuItem from '../../components/visualization-list-menu-item'
|
|
11
|
+
import ChartIcon from '../../components/generic-elements/chart-icon'
|
|
12
|
+
|
|
13
|
+
describe('dataset view', () => {
|
|
14
|
+
let subject
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
window.DISABLE_VISUALIZATIONS = 'false'
|
|
17
|
+
subject = createSubject()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('has three tabs', () => {
|
|
21
|
+
expect(subject.find(Tab).length).toEqual(3)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('has three tab panels', () => {
|
|
25
|
+
expect(subject.find(TabPanel).length).toEqual(3)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('has a dataset details component', () => {
|
|
29
|
+
expect(subject.find(DatasetDetailView).length).toEqual(1)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('has a chart view component', () => {
|
|
33
|
+
expect(subject.find(ChartView).length).toEqual(1)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('passes shouldAutoExecuteQuery property to the chart view', () => {
|
|
37
|
+
expect(subject.find(ChartView).props().shouldAutoExecuteQuery).toBe(true)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('has a query view component', () => {
|
|
41
|
+
expect(subject.find(QueryView).length).toEqual(1)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('passes shouldAutoExecuteQuery property to the query view', () => {
|
|
45
|
+
expect(subject.find(QueryView).props().shouldAutoExecuteQuery).toBe(true)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('displays the save icon in the header with expected props', () => {
|
|
49
|
+
subject.setState({ index: 1 })
|
|
50
|
+
expect(subject.find(VisualizationSaveMenuItem)).toHaveLength(1)
|
|
51
|
+
expect(subject.find(VisualizationSaveMenuItem).props().isAuthenticated).toBe(true)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('displays the user page icon in the header with expected props', () => {
|
|
55
|
+
subject.setState({ index: 1 })
|
|
56
|
+
expect(subject.find(VisualizationListMenuItem)).toHaveLength(1)
|
|
57
|
+
expect(subject.find(VisualizationListMenuItem).props().isAuthenticated).toBe(true)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('hides the save and user page icon on the dataset detail tab', () => {
|
|
61
|
+
subject.setState({ index: 0 })
|
|
62
|
+
expect(subject.find(VisualizationSaveMenuItem)).toHaveLength(0)
|
|
63
|
+
expect(subject.find(VisualizationListMenuItem)).toHaveLength(0)
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
describe('Visualizations when DISABLE_VISUALIZATIONS is true', () => {
|
|
68
|
+
let subject
|
|
69
|
+
beforeEach(() => {
|
|
70
|
+
window.DISABLE_VISUALIZATIONS = 'true'
|
|
71
|
+
subject = createSubject()
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
window.DISABLE_VISUALIZATIONS = 'false'
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('does not have the visualizations tab', () => {
|
|
79
|
+
expect(subject.find(ChartIcon).length).toEqual(0)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('does not have the visualizations view', () => {
|
|
83
|
+
expect(subject.find(ChartView).length).toEqual(0)
|
|
84
|
+
})
|
|
85
|
+
it('does not have the plot.ly help link', () => {
|
|
86
|
+
subject.setState({ index: 1 })
|
|
87
|
+
const test = subject.find('#plotlyhelp')
|
|
88
|
+
expect(test.length).toEqual(0)
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
describe('dataset view when dataset is not loaded', () => {
|
|
93
|
+
let subject
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
subject = createSubject({ isDatasetLoaded: false })
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('shows a loading element', () => {
|
|
99
|
+
expect(subject.find(LoadingElement)).toHaveLength(1)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('does not have a dataset details component', () => {
|
|
103
|
+
expect(subject.find(DatasetDetailView)).toHaveLength(0)
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
describe('dataset view for a remote dataset', () => {
|
|
108
|
+
let subject
|
|
109
|
+
beforeEach(() => {
|
|
110
|
+
subject = createSubject({ isRemoteDataset: true })
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('shows a DatasetDetailView', () => {
|
|
114
|
+
expect(subject.find(DatasetDetailView)).toHaveLength(1)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it('does not show tabs', () => {
|
|
118
|
+
expect(subject.find(Tab)).toHaveLength(0)
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
describe('dataset view for a host dataset', () => {
|
|
123
|
+
let subject
|
|
124
|
+
beforeEach(() => {
|
|
125
|
+
subject = createSubject({ isHostDataset: true })
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('shows a DatasetDetailView', () => {
|
|
129
|
+
expect(subject.find(DatasetDetailView)).toHaveLength(1)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('does not show tabs', () => {
|
|
133
|
+
expect(subject.find(Tab)).toHaveLength(0)
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
const createSubject = (props = {}) => {
|
|
138
|
+
const defaultProps = {
|
|
139
|
+
match: { params: { organizationName: 'org', datasetName: 'dataset' } },
|
|
140
|
+
dataset: {},
|
|
141
|
+
location: { search: '?systemName=org__dataset' },
|
|
142
|
+
systemName: 'org__dataset',
|
|
143
|
+
retrieveDatasetDetails: jest.fn(),
|
|
144
|
+
setQuery: jest.fn(),
|
|
145
|
+
resetQuery: jest.fn(),
|
|
146
|
+
isDatasetLoaded: true,
|
|
147
|
+
isHostDataset: false,
|
|
148
|
+
isRemoteDataset: false,
|
|
149
|
+
reset: jest.fn(),
|
|
150
|
+
shouldAutoExecuteQuery: true,
|
|
151
|
+
auth: { isAuthenticated: true }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const propsWithDefaults = Object.assign({}, defaultProps, props)
|
|
155
|
+
|
|
156
|
+
return shallow(<DatasetView {...propsWithDefaults} />)
|
|
157
|
+
}
|
|
@@ -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,25 @@
|
|
|
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 _loginView = _interopRequireDefault(require("./login-view"));
|
|
9
|
+
var _selectors = require("../../store/selectors");
|
|
10
|
+
var _actions = require("../../store/actions");
|
|
11
|
+
var _reactRouterDom = require("react-router-dom");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
var mapStateToProps = function mapStateToProps(state) {
|
|
14
|
+
return {
|
|
15
|
+
lastAttemptFailed: (0, _selectors.lastLoginAttemptFailed)(state)
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
19
|
+
return {
|
|
20
|
+
login: function login(credentials) {
|
|
21
|
+
return dispatch((0, _actions.login)(credentials));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_loginView.default));
|
|
@@ -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,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactRouter = require("react-router");
|
|
9
|
+
require("./login-view.scss");
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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; } }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
var LoginView = function LoginView(props) {
|
|
17
|
+
var _useState = (0, _react.useState)(''),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
username = _useState2[0],
|
|
20
|
+
setUsername = _useState2[1];
|
|
21
|
+
var _useState3 = (0, _react.useState)(''),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
password = _useState4[0],
|
|
24
|
+
setPassword = _useState4[1];
|
|
25
|
+
var enterKeyLogin = function enterKeyLogin(event) {
|
|
26
|
+
return event.key === 'Enter' && event.preventDefault() && login();
|
|
27
|
+
};
|
|
28
|
+
var spaceKeyLogin = function spaceKeyLogin(event) {
|
|
29
|
+
return event.key === ' ' && event.preventDefault() && login();
|
|
30
|
+
};
|
|
31
|
+
var login = function login() {
|
|
32
|
+
return props.login({
|
|
33
|
+
username: username,
|
|
34
|
+
password: password,
|
|
35
|
+
history: props.history
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return sessionStorage.getItem('api-token') ? /*#__PURE__*/React.createElement(_reactRouter.Redirect, {
|
|
39
|
+
to: {
|
|
40
|
+
pathname: '/'
|
|
41
|
+
}
|
|
42
|
+
}) : /*#__PURE__*/React.createElement("login-view", null, /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: "box",
|
|
44
|
+
onKeyPress: enterKeyLogin
|
|
45
|
+
}, /*#__PURE__*/React.createElement("h3", null, "Restricted Dataset Login"), /*#__PURE__*/React.createElement("div", null, "This area is restricted to authorized users only."), props.lastAttemptFailed && /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "error-message"
|
|
47
|
+
}, "Username and/or password invalid."), /*#__PURE__*/React.createElement("label", {
|
|
48
|
+
htmlFor: "username"
|
|
49
|
+
}, "Username"), /*#__PURE__*/React.createElement("input", {
|
|
50
|
+
id: "username",
|
|
51
|
+
className: "username",
|
|
52
|
+
type: "text",
|
|
53
|
+
tabIndex: 1,
|
|
54
|
+
value: username,
|
|
55
|
+
onChange: function onChange(e) {
|
|
56
|
+
return setUsername(e.target.value);
|
|
57
|
+
},
|
|
58
|
+
autoFocus: true
|
|
59
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
60
|
+
htmlFor: "password"
|
|
61
|
+
}, "Password"), /*#__PURE__*/React.createElement("input", {
|
|
62
|
+
id: "password",
|
|
63
|
+
className: "password",
|
|
64
|
+
type: "password",
|
|
65
|
+
tabIndex: 2,
|
|
66
|
+
value: password,
|
|
67
|
+
onChange: function onChange(e) {
|
|
68
|
+
return setPassword(e.target.value);
|
|
69
|
+
}
|
|
70
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "login-row"
|
|
72
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
73
|
+
role: "link",
|
|
74
|
+
href: "".concat(window.DISC_UI_URL, "/reset-password")
|
|
75
|
+
}, "Forgot your username and/or password?")), /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "submit",
|
|
77
|
+
role: "button",
|
|
78
|
+
tabIndex: 3,
|
|
79
|
+
onClick: login,
|
|
80
|
+
onKeyPress: spaceKeyLogin
|
|
81
|
+
}, "Login")));
|
|
82
|
+
};
|
|
83
|
+
var _default = exports.default = LoginView;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import '../../styles/mixins.scss';
|
|
2
|
+
@import '../../styles/variables.scss';
|
|
3
|
+
|
|
4
|
+
login-view {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
width: 8 * $column-width;
|
|
8
|
+
margin: 5rem auto 0 auto;
|
|
9
|
+
|
|
10
|
+
.submit {
|
|
11
|
+
background-color: $light-blue;
|
|
12
|
+
color: white;
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
text-align: center;
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
margin-top: 1rem;
|
|
18
|
+
padding: 0.6rem 1rem;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
background-color: $almost-black;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.login-row {
|
|
26
|
+
padding-top: 0.5rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.box {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
border: 1px solid $light-grey;
|
|
33
|
+
padding: 2.25rem $column-width;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input {
|
|
37
|
+
border: 1px solid $light-grey;
|
|
38
|
+
background-color: white;
|
|
39
|
+
box-shadow: inset 0 1px 4px 0 rgba(0, 0, 0, 0.1);
|
|
40
|
+
padding: 0.75rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
h3 {
|
|
44
|
+
@include header-medium();
|
|
45
|
+
margin: 0 0 0.75rem 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
label {
|
|
49
|
+
margin: 1rem 0 0.25rem 0;
|
|
50
|
+
font-weight: bold;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.error-message {
|
|
54
|
+
color: #B80000;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
a {
|
|
58
|
+
@include link();
|
|
59
|
+
font-size: 1rem;
|
|
60
|
+
text-decoration: underline;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
import LoginView from './login-view'
|
|
3
|
+
|
|
4
|
+
describe('login view', () => {
|
|
5
|
+
let subject, loginSpy
|
|
6
|
+
const fakeHistory = jest.fn()
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
loginSpy = jest.fn()
|
|
10
|
+
subject = shallow(<LoginView login={loginSpy} lastAttemptFailed={false} history={fakeHistory} />)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('when the login button is clicked, a login is dispatched with creds', () => {
|
|
14
|
+
const username = 'lettuce'
|
|
15
|
+
const password = 'tarpsoff123'
|
|
16
|
+
|
|
17
|
+
subject.find('.username').simulate('change', { target: { value: username } })
|
|
18
|
+
subject.find('.password').simulate('change', { target: { value: password } })
|
|
19
|
+
subject.find('.submit').simulate('click')
|
|
20
|
+
|
|
21
|
+
expect(loginSpy).toHaveBeenCalledWith({ username: username, password: password, history: fakeHistory })
|
|
22
|
+
})
|
|
23
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _oauthErrorView = _interopRequireDefault(require("./oauth-error-view"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _oauthErrorView.default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactRouterDom = require("react-router-dom");
|
|
8
|
+
require("./oauth-error-view.scss");
|
|
9
|
+
var _qs = _interopRequireDefault(require("qs"));
|
|
10
|
+
var _routes = _interopRequireDefault(require("../../routes.js"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var getError = function getError(search) {
|
|
13
|
+
return _qs.default.parse(search, {
|
|
14
|
+
ignoreQueryPrefix: true
|
|
15
|
+
}).error_description;
|
|
16
|
+
};
|
|
17
|
+
var OAuthErrorView = function OAuthErrorView() {
|
|
18
|
+
return /*#__PURE__*/React.createElement("oauth-error-view", null, /*#__PURE__*/React.createElement("h2", null, "Oops! We can't process that request. Please click ", /*#__PURE__*/React.createElement("a", {
|
|
19
|
+
role: "link",
|
|
20
|
+
href: _routes.default.root
|
|
21
|
+
}, "here"), " to go back to the home page. "), /*#__PURE__*/React.createElement("p", {
|
|
22
|
+
className: "error-message"
|
|
23
|
+
}, getError(window.location.search)));
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = OAuthErrorView;
|