@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,41 @@
|
|
|
1
|
+
import Search from './search'
|
|
2
|
+
import { shallow } from 'enzyme'
|
|
3
|
+
|
|
4
|
+
const ENTER_KEY = 13
|
|
5
|
+
|
|
6
|
+
describe('search', () => {
|
|
7
|
+
let searchCallback, subject
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
searchCallback = jest.fn()
|
|
11
|
+
subject = shallow(<Search callback={searchCallback} defaultText='some search' />)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('does not invoke callback when any key is pressed other than enter', () => {
|
|
15
|
+
subject.find('.search-bar').simulate('keyup', { keyCode: 1 })
|
|
16
|
+
|
|
17
|
+
expect(searchCallback).not.toHaveBeenCalled()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('invoke callback when user initiates search by pressing enter button', () => {
|
|
21
|
+
subject.find('.search-bar').simulate('keyup', { keyCode: ENTER_KEY })
|
|
22
|
+
|
|
23
|
+
expect(searchCallback).toHaveBeenCalledWith('some search')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('show the clear button when there is text in the search input', () => {
|
|
27
|
+
expect(subject.find('.clear').hasClass('disabled')).toBeFalsy()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('clear the text in the search box when the clear icon is clicked', () => {
|
|
31
|
+
subject.find('.clear-icon').simulate('click')
|
|
32
|
+
|
|
33
|
+
expect(subject.find('input').value).toBeFalsy()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('hide the clear button when there is no text in the search input', () => {
|
|
37
|
+
subject = shallow(<Search callback={jest.fn()} />)
|
|
38
|
+
|
|
39
|
+
expect(subject.find('.clear').hasClass('disabled')).toBeTruthy()
|
|
40
|
+
})
|
|
41
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _select = _interopRequireDefault(require("./select"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _select.default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("./select.scss");
|
|
8
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var createOption = function createOption(option) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
12
|
+
key: option.value,
|
|
13
|
+
value: option.value
|
|
14
|
+
}, option.label);
|
|
15
|
+
};
|
|
16
|
+
var _default = exports.default = function _default(_ref) {
|
|
17
|
+
var options = _ref.options,
|
|
18
|
+
label = _ref.label,
|
|
19
|
+
selectChangeCallback = _ref.selectChangeCallback,
|
|
20
|
+
className = _ref.className,
|
|
21
|
+
_ref$testId = _ref.testId,
|
|
22
|
+
testId = _ref$testId === void 0 ? '' : _ref$testId;
|
|
23
|
+
var defaultOption = _lodash.default.find(options, function (it) {
|
|
24
|
+
return it.default;
|
|
25
|
+
});
|
|
26
|
+
return /*#__PURE__*/React.createElement("select-element", {
|
|
27
|
+
class: className
|
|
28
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
29
|
+
className: "label",
|
|
30
|
+
htmlFor: "select-".concat(label)
|
|
31
|
+
}, label), /*#__PURE__*/React.createElement("select", {
|
|
32
|
+
"data-testid": testId,
|
|
33
|
+
value: defaultOption ? defaultOption.value : options[0].value,
|
|
34
|
+
className: "selector",
|
|
35
|
+
id: "select-".concat(label),
|
|
36
|
+
name: "select-".concat(label),
|
|
37
|
+
onChange: function onChange(event) {
|
|
38
|
+
return _onChange(event, selectChangeCallback);
|
|
39
|
+
}
|
|
40
|
+
}, options.map(createOption)));
|
|
41
|
+
};
|
|
42
|
+
var _onChange = function _onChange(event, selectChangeCallback) {
|
|
43
|
+
selectChangeCallback(event.target.value);
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import '../../../styles/mixins.scss';
|
|
2
|
+
@import '../../../styles/variables.scss';
|
|
3
|
+
|
|
4
|
+
select-element {
|
|
5
|
+
@include custom-element();
|
|
6
|
+
@include flex-row();
|
|
7
|
+
|
|
8
|
+
.selector {
|
|
9
|
+
height: 100%;
|
|
10
|
+
outline: 1px solid $medium-grey;
|
|
11
|
+
background-color: white;
|
|
12
|
+
border: 0;
|
|
13
|
+
text-align: left;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.label {
|
|
19
|
+
padding-right: 0.5rem;
|
|
20
|
+
text-transform: uppercase;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Select from './select'
|
|
2
|
+
import { shallow } from 'enzyme'
|
|
3
|
+
|
|
4
|
+
const sortOpts = [
|
|
5
|
+
{ value: 'foo', label: 'Foo', default: true },
|
|
6
|
+
{ value: 'bar', label: 'Bar' }
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
describe('Select', () => {
|
|
10
|
+
test('sets the value and text of the sort option', () => {
|
|
11
|
+
const subject = shallow(<Select options={sortOpts} />)
|
|
12
|
+
|
|
13
|
+
expect(subject.find('option').at(0).text()).toEqual('Foo')
|
|
14
|
+
expect(subject.find('option').at(1).props().value).toEqual('bar')
|
|
15
|
+
expect(subject.find('.selector').props().value).toEqual('foo')
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
describe('selecting an option', () => {
|
|
20
|
+
let subject, selectChangeCallback
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
selectChangeCallback = jest.fn()
|
|
24
|
+
subject = shallow(<Select options={sortOpts} selectChangeCallback={selectChangeCallback} />)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('clicking a different option', () => {
|
|
28
|
+
const secondOpt = subject.find('select')
|
|
29
|
+
|
|
30
|
+
secondOpt.simulate('change', { target: { value: 'bar' } })
|
|
31
|
+
|
|
32
|
+
expect(selectChangeCallback).toHaveBeenCalledWith('bar')
|
|
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 _shareLink = _interopRequireDefault(require("./share-link"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _shareLink.default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("./share-link.scss");
|
|
8
|
+
var _reactCopyToClipboard = require("react-copy-to-clipboard");
|
|
9
|
+
var _FilterNone = _interopRequireDefault(require("@material-ui/icons/FilterNone"));
|
|
10
|
+
var _reactRouterDom = require("react-router-dom");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var ShareLink = function ShareLink(_ref) {
|
|
13
|
+
var linkUrl = _ref.linkUrl;
|
|
14
|
+
var absoluteURL = "".concat(window.location.origin).concat(linkUrl);
|
|
15
|
+
return /*#__PURE__*/React.createElement("share-link", null, /*#__PURE__*/React.createElement(_reactRouterDom.Link, {
|
|
16
|
+
to: linkUrl
|
|
17
|
+
}, absoluteURL), /*#__PURE__*/React.createElement(_reactCopyToClipboard.CopyToClipboard, {
|
|
18
|
+
text: absoluteURL
|
|
19
|
+
}, /*#__PURE__*/React.createElement(_FilterNone.default, {
|
|
20
|
+
className: "filter-icon"
|
|
21
|
+
})));
|
|
22
|
+
};
|
|
23
|
+
var _default = exports.default = ShareLink;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../../../styles/mixins.scss';
|
|
2
|
+
@import '../../../styles/variables.scss';
|
|
3
|
+
|
|
4
|
+
share-link {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
|
|
8
|
+
.filter-icon {
|
|
9
|
+
color: $light-blue;
|
|
10
|
+
margin-left: 1rem;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
a {
|
|
15
|
+
@include sub-link();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
|
|
3
|
+
import ShareLink from '.'
|
|
4
|
+
import { CopyToClipboard } from 'react-copy-to-clipboard'
|
|
5
|
+
import { Link } from 'react-router-dom'
|
|
6
|
+
|
|
7
|
+
describe('share-link', () => {
|
|
8
|
+
const linkUrl = '/path/to/thing'
|
|
9
|
+
const windowOrigin = 'http://origin'
|
|
10
|
+
let subject
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
setOrigin(windowOrigin)
|
|
14
|
+
subject = shallow(<ShareLink linkUrl={linkUrl} />)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('has a link to a relative path', () => {
|
|
18
|
+
expect(subject.find(Link).props().to).toBe(linkUrl)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('allows copying an absolute link to the clipboard', () => {
|
|
22
|
+
expect(subject.find(CopyToClipboard).props().text).toBe(`${windowOrigin}${linkUrl}`)
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const setOrigin = origin => {
|
|
27
|
+
Object.defineProperty(window, 'location', { value: { origin } })
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactSvgInline = _interopRequireDefault(require("react-svg-inline"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var sqlSVG = "<svg version=\"1.1\" id=\"sqlSVG-Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" x=\"0\" y=\"0\" viewBox=\"0 0 58.201 58.201\" xml:space=\"preserve\"><path d=\"M31.707 33.07a81.522 81.522 0 01-5.22 0c-7.341-.201-13.191-1.238-17.403-2.717C7.104 29.685 5.409 28.899 4.1 28v9.4c2.846 2.971 12.394 5.711 25 5.711s22.154-2.74 25-5.711V28c-1.318.905-3.028 1.697-5.025 2.367-4.21 1.472-10.048 2.503-17.368 2.703z\"/><path d=\"M4.1 14.889v9.4c2.638 2.754 11.033 5.31 22.286 5.668.115.004.233.005.349.008.326.009.651.018.982.023a79.019 79.019 0 002.766.001c.33-.005.656-.014.982-.023l.349-.008c11.253-.359 19.648-2.915 22.286-5.668v-9.401C49.233 18.232 38.944 20 29.1 20s-20.132-1.768-25-5.111zM53.965 8.542C52.843 4.241 44.215 0 29.1 0 14.023 0 5.404 4.22 4.247 8.51A.97.97 0 004.1 9v2.306C6.937 14.267 16.417 17 29.1 17s22.164-2.733 25-5.694V9a.92.92 0 00-.135-.458zM4.1 41v8.201a.94.94 0 00.117.451c1.181 4.895 11.747 8.549 24.883 8.549 13.106 0 23.655-3.639 24.875-8.516a.993.993 0 00.125-.484v-8.199c-4.135 2.911-12.655 5.199-25 5.199-12.346 0-20.866-2.29-25-5.201z\"/></svg>";
|
|
10
|
+
var _default = exports.default = function _default(_ref) {
|
|
11
|
+
var className = _ref.className;
|
|
12
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
13
|
+
className: className
|
|
14
|
+
}, /*#__PURE__*/React.createElement(_reactSvgInline.default, {
|
|
15
|
+
svg: sqlSVG,
|
|
16
|
+
height: "14px",
|
|
17
|
+
width: "14px",
|
|
18
|
+
accessibilityDesc: "Sql Icon"
|
|
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 _tabButton = _interopRequireDefault(require("./tab-button"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _tabButton.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 _react = _interopRequireDefault(require("react"));
|
|
8
|
+
require("./tab-button.scss");
|
|
9
|
+
var _excluded = ["children", "className"];
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
14
|
+
var TabButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
_ref$className = _ref.className,
|
|
17
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("button", _extends({
|
|
20
|
+
ref: ref,
|
|
21
|
+
className: "tab-button ".concat(className),
|
|
22
|
+
role: "button"
|
|
23
|
+
}, props), children);
|
|
24
|
+
});
|
|
25
|
+
var _default = exports.default = TabButton;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@import '../../../styles/variables.scss';
|
|
2
|
+
@import '../../../styles/mixins.scss';
|
|
3
|
+
|
|
4
|
+
.tab-button {
|
|
5
|
+
border: 0;
|
|
6
|
+
position: relative;
|
|
7
|
+
list-style: initial;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
color: $dark-grey;
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
fill: currentColor;
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
color: $almost-black;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
color: $almost-black;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:disabled,
|
|
22
|
+
&:disabled:hover,
|
|
23
|
+
&:disabled:focus {
|
|
24
|
+
cursor: default;
|
|
25
|
+
color: $dark-grey;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _visualizeButton = _interopRequireDefault(require("./visualize-button"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _visualizeButton.default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("./visualize-button.scss");
|
|
8
|
+
var _reactSvgInline = _interopRequireDefault(require("react-svg-inline"));
|
|
9
|
+
var _routes = _interopRequireDefault(require("../../../routes"));
|
|
10
|
+
var _generatedLink = require("../generated-link");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var chart = "<svg id=\"chart-Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 65.5 28\"><path d=\"M0 17.5h13V28H0zM17.5 0h13v28h-13zM35 12.5h13V28H35zM52.5 5h13v23h-13z\"/></svg>";
|
|
13
|
+
var _default = exports.default = function _default(_ref) {
|
|
14
|
+
var organizationName = _ref.organizationName,
|
|
15
|
+
datasetName = _ref.datasetName,
|
|
16
|
+
systemName = _ref.systemName;
|
|
17
|
+
return /*#__PURE__*/React.createElement(_generatedLink.GeneratedLink, {
|
|
18
|
+
path: _routes.default.datasetView,
|
|
19
|
+
params: {
|
|
20
|
+
organizationName: organizationName,
|
|
21
|
+
datasetName: datasetName
|
|
22
|
+
},
|
|
23
|
+
queryStringParams: {
|
|
24
|
+
systemName: systemName,
|
|
25
|
+
selectedIndex: 1
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "visualize-button"
|
|
29
|
+
}, "Visualize", /*#__PURE__*/React.createElement(_reactSvgInline.default, {
|
|
30
|
+
style: {
|
|
31
|
+
marginLeft: '.3rem'
|
|
32
|
+
},
|
|
33
|
+
svg: chart,
|
|
34
|
+
height: "inherit",
|
|
35
|
+
accessibilityDesc: "Chart"
|
|
36
|
+
})));
|
|
37
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import '../../../styles/variables.scss';
|
|
2
|
+
@import '../../../styles/mixins.scss';
|
|
3
|
+
|
|
4
|
+
.visualize-button {
|
|
5
|
+
@include button();
|
|
6
|
+
display: inline-block;
|
|
7
|
+
padding: 1.0rem;
|
|
8
|
+
width: auto;
|
|
9
|
+
background-color: $light-blue;
|
|
10
|
+
color: white;
|
|
11
|
+
letter-spacing: 0.05rem;
|
|
12
|
+
margin: 1rem 0rem 1rem 1rem;
|
|
13
|
+
align-self: flex-end;
|
|
14
|
+
}
|
|
@@ -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 _loginZone = _interopRequireDefault(require("./login-zone"));
|
|
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.lastLogoutAttemptFailed)(state)
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
19
|
+
return {
|
|
20
|
+
logout: function logout(credentials) {
|
|
21
|
+
return dispatch((0, _actions.logout)(credentials));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = (0, _reactRouterDom.withRouter)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_loginZone.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,39 @@
|
|
|
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
|
+
var _Person = _interopRequireDefault(require("@material-ui/icons/Person"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
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); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
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); }
|
|
16
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
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); }
|
|
18
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
21
|
+
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); }
|
|
22
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
23
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
24
|
+
function _default(props) {
|
|
25
|
+
_classCallCheck(this, _default);
|
|
26
|
+
return _callSuper(this, _default, [props]);
|
|
27
|
+
}
|
|
28
|
+
_inherits(_default, _Component);
|
|
29
|
+
return _createClass(_default, [{
|
|
30
|
+
key: "render",
|
|
31
|
+
value: function render() {
|
|
32
|
+
return /*#__PURE__*/React.createElement("login-svgs-and-text", null, /*#__PURE__*/React.createElement(_Person.default, {
|
|
33
|
+
className: "user-icon"
|
|
34
|
+
}), /*#__PURE__*/React.createElement("span", null, this.props.text), /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
className: "arrow"
|
|
36
|
+
}, this.props.symbol));
|
|
37
|
+
}
|
|
38
|
+
}]);
|
|
39
|
+
}(_react.Component);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("./login-zone.scss");
|
|
8
|
+
var _login = _interopRequireDefault(require("./login"));
|
|
9
|
+
var _logout = _interopRequireDefault(require("./logout"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var LoginZone = function LoginZone(props) {
|
|
12
|
+
var logout = function logout() {
|
|
13
|
+
return props.logout({
|
|
14
|
+
history: props.history
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
return /*#__PURE__*/React.createElement("login-zone", null, props.token ? /*#__PURE__*/React.createElement(_logout.default, {
|
|
18
|
+
logout: logout
|
|
19
|
+
}) : /*#__PURE__*/React.createElement(_login.default, null));
|
|
20
|
+
};
|
|
21
|
+
var _default = exports.default = LoginZone;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
@import '../../styles/variables.scss';
|
|
2
|
+
@import '../../styles/mixins.scss';
|
|
3
|
+
|
|
4
|
+
login-zone {
|
|
5
|
+
|
|
6
|
+
div.user-menu {
|
|
7
|
+
background-color: $light-blue;
|
|
8
|
+
color: white;
|
|
9
|
+
fill: white;
|
|
10
|
+
font-weight: bold;
|
|
11
|
+
padding: 0.25rem 0;
|
|
12
|
+
position: absolute;
|
|
13
|
+
z-index: 10000;
|
|
14
|
+
box-shadow: 2px 2px 5px grey;
|
|
15
|
+
width: 15rem;
|
|
16
|
+
|
|
17
|
+
li {
|
|
18
|
+
min-height: 30px;
|
|
19
|
+
list-style-type: none;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
text-decoration: underline;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
a {
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
color: inherit;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.menu-text {
|
|
35
|
+
margin-left: 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
login-svgs-and-text {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
padding: 0.25rem 1rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
p {
|
|
46
|
+
margin: 0.5rem 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
h3 {
|
|
50
|
+
@include header-small();
|
|
51
|
+
margin: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.user-icon {
|
|
55
|
+
vertical-align: top;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.user-icon-svg {
|
|
59
|
+
height: 1.4rem;
|
|
60
|
+
width: 1.4rem;
|
|
61
|
+
fill: white;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.arrow {
|
|
65
|
+
margin-left: 0.5rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
button.action {
|
|
69
|
+
background-color: $light-blue;
|
|
70
|
+
color: white;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
button.clickable {
|
|
74
|
+
&:hover {
|
|
75
|
+
background-color: $almost-black;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:active {
|
|
79
|
+
background-color: $medium-grey;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
button.status {
|
|
84
|
+
background-color: transparent;
|
|
85
|
+
color: $light-blue;
|
|
86
|
+
|
|
87
|
+
&:hover {
|
|
88
|
+
background-color: $light-blue;
|
|
89
|
+
color: white;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:focus {
|
|
93
|
+
background-color: $light-grey;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.logintext {
|
|
98
|
+
display: block;
|
|
99
|
+
margin-left: 4px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
button {
|
|
103
|
+
border: none;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
font-weight: bold;
|
|
106
|
+
text-align: left;
|
|
107
|
+
padding: 1px 0px 2px;
|
|
108
|
+
outline: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
loading-element {
|
|
112
|
+
width: 2rem;
|
|
113
|
+
margin: auto;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { render } from 'enzyme'
|
|
2
|
+
import LoginZone from './login-zone'
|
|
3
|
+
import { BrowserRouter } from 'react-router-dom'
|
|
4
|
+
|
|
5
|
+
describe('LoginZone ', () => {
|
|
6
|
+
test('Should Render logout when token is present', () => {
|
|
7
|
+
const subject = render(<LoginZone token='blah' logout={jest.fn()} />)
|
|
8
|
+
expect(subject.find('logout-component').length).toEqual(1)
|
|
9
|
+
expect(subject.length).toEqual(1)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
test('Should Render login when token is not present', () => {
|
|
13
|
+
const subject = render(<BrowserRouter><LoginZone logout={jest.fn()} /></BrowserRouter>)
|
|
14
|
+
expect(subject.find('login-component').length).toEqual(1)
|
|
15
|
+
expect(subject.length).toEqual(1)
|
|
16
|
+
})
|
|
17
|
+
})
|