@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,42 @@
|
|
|
1
|
+
@import '../../styles/variables.scss';
|
|
2
|
+
@import '../../styles/mixins.scss';
|
|
3
|
+
|
|
4
|
+
dataset-dictionary {
|
|
5
|
+
.view-link {
|
|
6
|
+
padding: 1rem;
|
|
7
|
+
text-align: right;
|
|
8
|
+
|
|
9
|
+
.view-text {
|
|
10
|
+
font-size: 1.2rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
@include sub-link();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dataset-schema-table {
|
|
19
|
+
color: $almost-black;
|
|
20
|
+
|
|
21
|
+
.ReactTable {
|
|
22
|
+
border-width: 0
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.table-header {
|
|
26
|
+
text-align: left;
|
|
27
|
+
font-weight: 800;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.description-cell {
|
|
31
|
+
white-space: unset;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.expander {
|
|
35
|
+
text-align: center;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.error {
|
|
40
|
+
color: $error-color
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { shallow, mount } from 'enzyme'
|
|
2
|
+
import DatasetDictionary from './dataset-dictionary'
|
|
3
|
+
import CollapsableBox from '../collapsable-box'
|
|
4
|
+
import ReactTable from 'react-table'
|
|
5
|
+
import Tooltip from '../tooltip'
|
|
6
|
+
|
|
7
|
+
describe('dataset dictionary', () => {
|
|
8
|
+
const basicSchema = [
|
|
9
|
+
{ name: 'name', type: 'string', description: 'the name' },
|
|
10
|
+
{ name: 'age', type: 'integer', description: 'the age' }
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
let subject
|
|
14
|
+
|
|
15
|
+
describe('with a basic schema', () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
const matchMedia = jest.fn()
|
|
18
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
19
|
+
writable: true,
|
|
20
|
+
value: jest.fn().mockImplementation(query => ({
|
|
21
|
+
matches: true
|
|
22
|
+
}))
|
|
23
|
+
})
|
|
24
|
+
subject = mount(<DatasetDictionary schema={basicSchema} expanded />)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('has the correct table headers', () => {
|
|
28
|
+
const table = subject.find('.dataset-schema-table')
|
|
29
|
+
const headers = table.find('.rt-th')
|
|
30
|
+
|
|
31
|
+
expect(headers.length).toBe(4)
|
|
32
|
+
expect(headers.at(1).text()).toBe('Field')
|
|
33
|
+
expect(headers.at(2).text()).toBe('Type')
|
|
34
|
+
expect(headers.at(3).text()).toBe('Description')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('has the correct table values', () => {
|
|
38
|
+
const table = subject.find('.dataset-schema-table')
|
|
39
|
+
const cells = table.find('.rt-td')
|
|
40
|
+
|
|
41
|
+
const expansionPlaceholder = ''
|
|
42
|
+
const expectedCellValues = [
|
|
43
|
+
expansionPlaceholder, 'name', 'string', 'the name',
|
|
44
|
+
expansionPlaceholder, 'age', 'integer', 'the age'
|
|
45
|
+
]
|
|
46
|
+
expect(cells.length).toBe(expectedCellValues.length)
|
|
47
|
+
expectCorrectCellValues(expectedCellValues, cells)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('does not have pagination', () => {
|
|
51
|
+
const table = subject.find(ReactTable)
|
|
52
|
+
expect(table.props().showPagination).toBe(false)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('has a page size to show the entire schema', () => {
|
|
56
|
+
const table = subject.find(ReactTable)
|
|
57
|
+
expect(table.props().defaultPageSize).toBe(Object.keys(basicSchema).length)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('is sortable', () => {
|
|
61
|
+
const table = subject.find(ReactTable)
|
|
62
|
+
expect(table.props().sortable).toBe(true)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('has no left margin', () => {
|
|
66
|
+
const table = subject.find(ReactTable)
|
|
67
|
+
|
|
68
|
+
expect(table.props().style.marginLeft).toBeFalsy()
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
describe('with a schema containing a list type', () => {
|
|
73
|
+
it('displays the list type appropriately', () => {
|
|
74
|
+
const schemaWithList = [
|
|
75
|
+
{ name: 'names', type: 'list', description: 'all the names', itemType: 'string' }
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
subject = mount(<DatasetDictionary schema={schemaWithList} expanded />)
|
|
79
|
+
|
|
80
|
+
const table = subject.find('.dataset-schema-table')
|
|
81
|
+
const cells = table.find('.rt-td')
|
|
82
|
+
|
|
83
|
+
const typeIndex = 2
|
|
84
|
+
expect(cells.at(typeIndex).text()).toBe(`list of ${schemaWithList[0].itemType}`)
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
describe('with nested map subschemas', () => {
|
|
89
|
+
const schemaWithMaps = [
|
|
90
|
+
{ name: 'name', type: 'string', description: 'the name' },
|
|
91
|
+
{
|
|
92
|
+
name: 'mother',
|
|
93
|
+
type: 'map',
|
|
94
|
+
description: 'the mother',
|
|
95
|
+
subSchema: [
|
|
96
|
+
{ name: 'name', type: 'string', description: 'mother\'s name' },
|
|
97
|
+
{
|
|
98
|
+
name: 'children',
|
|
99
|
+
type: 'list',
|
|
100
|
+
description: 'the chillins',
|
|
101
|
+
itemType: 'map',
|
|
102
|
+
subSchema: [
|
|
103
|
+
{ name: 'age', type: 'integer', description: 'the child\'s age' }
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
let topLevelTable, topLevelCells
|
|
111
|
+
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
subject = mount(<DatasetDictionary schema={schemaWithMaps} expanded />)
|
|
114
|
+
topLevelTable = subject.find('.dataset-schema-table')
|
|
115
|
+
topLevelCells = topLevelTable.find('.rt-td')
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('has the correct table values', () => {
|
|
119
|
+
const expansionPlaceholder = ''
|
|
120
|
+
const expansionArrow = '▸'
|
|
121
|
+
const expectedCellValues = [
|
|
122
|
+
expansionPlaceholder, 'name', 'string', 'the name',
|
|
123
|
+
expansionArrow, 'mother', 'map', 'the mother'
|
|
124
|
+
]
|
|
125
|
+
expect(topLevelCells.length).toBe(expectedCellValues.length)
|
|
126
|
+
expectCorrectCellValues(expectedCellValues, topLevelCells)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
describe('with the map type expanded', () => {
|
|
130
|
+
const expanderCellIndex = 4
|
|
131
|
+
|
|
132
|
+
let subTable, subTableCells
|
|
133
|
+
|
|
134
|
+
beforeEach(() => {
|
|
135
|
+
topLevelCells.at(expanderCellIndex).simulate('click')
|
|
136
|
+
topLevelTable = subject.find('.dataset-schema-table')
|
|
137
|
+
|
|
138
|
+
subTable = topLevelTable.find('.dataset-schema-table.mother')
|
|
139
|
+
subTableCells = subTable.find('.rt-td')
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
it('toggles the direction of the arrow', () => {
|
|
143
|
+
expect(topLevelCells.at(expanderCellIndex).text()).toBe('▾')
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it('renders a sub table for the map with correct values', () => {
|
|
147
|
+
expect(subTable.length).toBe(1)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('has the correct values in the sub table', () => {
|
|
151
|
+
const expansionPlaceholder = ''
|
|
152
|
+
const expansionArrow = '▸'
|
|
153
|
+
const expectedCellValues = [
|
|
154
|
+
expansionPlaceholder, 'name', 'string', 'mother\'s name',
|
|
155
|
+
expansionArrow, 'children', 'list of map', 'the chillins'
|
|
156
|
+
]
|
|
157
|
+
expect(subTableCells.length).toBe(expectedCellValues.length)
|
|
158
|
+
expectCorrectCellValues(expectedCellValues, subTableCells)
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it('indents the sub table', () => {
|
|
162
|
+
expect(subTable.find(ReactTable).props().style.marginLeft).toBe('35px')
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
it('toggles the direction of the arrow again when collapsed', () => {
|
|
166
|
+
topLevelCells.at(expanderCellIndex).simulate('click')
|
|
167
|
+
expect(topLevelCells.at(expanderCellIndex).text()).toBe('▸')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
describe('and the list of map type expanded', () => {
|
|
171
|
+
let subSubTable, subSubTableCells
|
|
172
|
+
|
|
173
|
+
beforeEach(() => {
|
|
174
|
+
subTableCells.at(expanderCellIndex).simulate('click')
|
|
175
|
+
subTable = subject.find('.dataset-schema-table.mother')
|
|
176
|
+
|
|
177
|
+
subSubTable = subTable.find('.dataset-schema-table.children')
|
|
178
|
+
subSubTableCells = subSubTable.find('.rt-td')
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
it('renders another sub table for the list of maps with correct values', () => {
|
|
182
|
+
expect(subSubTable.length).toBe(1)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
it('has the correct values in the sub sub table', () => {
|
|
186
|
+
const expansionPlaceholder = ''
|
|
187
|
+
const expectedCellValues = [
|
|
188
|
+
expansionPlaceholder, 'age', 'integer', 'the child\'s age'
|
|
189
|
+
]
|
|
190
|
+
expect(subSubTableCells.length).toBe(expectedCellValues.length)
|
|
191
|
+
expectCorrectCellValues(expectedCellValues, subSubTableCells)
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
describe('with a map missing its subschema', () => {
|
|
198
|
+
const schemaWithMaps = [
|
|
199
|
+
{ name: 'name', type: 'string', description: 'the name' },
|
|
200
|
+
{
|
|
201
|
+
name: 'mother', type: 'map', description: 'the mother'
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
let topLevelTable
|
|
206
|
+
|
|
207
|
+
beforeEach(() => {
|
|
208
|
+
subject = mount(<DatasetDictionary schema={schemaWithMaps} expanded />)
|
|
209
|
+
topLevelTable = subject.find('.dataset-schema-table')
|
|
210
|
+
const topLevelCells = topLevelTable.find('.rt-td.rt-expandable')
|
|
211
|
+
topLevelCells.at(1).simulate('click')
|
|
212
|
+
topLevelTable = subject.find('.dataset-schema-table')
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
it('displays an informative message', () => {
|
|
216
|
+
const messageDiv = topLevelTable.find('.error')
|
|
217
|
+
expect(messageDiv.text()).toBe('Schema information not found. Contact the data curator.')
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
describe('without a schema', () => {
|
|
222
|
+
beforeEach(() => {
|
|
223
|
+
subject = shallow(<DatasetDictionary expanded />)
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
it('renders the collapsable box with an informative message', () => {
|
|
227
|
+
const collapsableBox = subject.find(CollapsableBox)
|
|
228
|
+
expect(collapsableBox.length).toBe(1)
|
|
229
|
+
expect(collapsableBox.props().title).toBe('Data Dictionary Unavailable')
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
it('does not render the table', () => {
|
|
233
|
+
expect(subject.find('.dataset-schema-table').length).toBe(0)
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it('does not render the view link', () => {
|
|
237
|
+
expect(subject.find('.view-link a').length).toBe(0)
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
describe('with an empty schema', () => {
|
|
242
|
+
beforeEach(() => {
|
|
243
|
+
subject = mount(<DatasetDictionary schema={[]} expanded />)
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
it('renders the collapsable box with an informative message', () => {
|
|
247
|
+
const collapsableBox = subject.find(CollapsableBox)
|
|
248
|
+
expect(collapsableBox.length).toBe(1)
|
|
249
|
+
expect(collapsableBox.props().title).toBe('Data Dictionary Unavailable')
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it('does not render the table', () => {
|
|
253
|
+
expect(subject.find('.dataset-schema-table').length).toBe(0)
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
it('does not render the view link', () => {
|
|
257
|
+
expect(subject.find('.view-link a').length).toBe(0)
|
|
258
|
+
})
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
it('is rendered in an expanded box by default', () => {
|
|
262
|
+
subject = shallow(<DatasetDictionary schema={basicSchema} />)
|
|
263
|
+
|
|
264
|
+
const collapsableBox = subject.find(CollapsableBox)
|
|
265
|
+
expect(collapsableBox.length).toBe(1)
|
|
266
|
+
expect(collapsableBox.props().expanded).toBe(true)
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
it('renders a view link', () => {
|
|
270
|
+
window.DISC_API_URL = 'http://right.here.com'
|
|
271
|
+
subject = mount(<DatasetDictionary schema={basicSchema} datasetId='all-the-datas' />)
|
|
272
|
+
|
|
273
|
+
const link = subject.find('.view-link a')
|
|
274
|
+
expect(link.props().href).toBe(`${window.DISC_API_URL}/api/v1/dataset/all-the-datas/dictionary`)
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
const expectCorrectCellValues = (expectedCellValues, cells) => {
|
|
278
|
+
expectedCellValues.forEach((expected, index) => {
|
|
279
|
+
if (index % 4 == 1) { // handle special rendering for field name tooltip
|
|
280
|
+
expect(cells.at(index).find(Tooltip).props().text).toBe(expected)
|
|
281
|
+
} else {
|
|
282
|
+
expect(cells.at(index).text()).toBe(expected)
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _datasetDictionary = _interopRequireDefault(require("./dataset-dictionary"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _datasetDictionary.default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _dataCard = _interopRequireDefault(require("../data-card"));
|
|
8
|
+
require("./dataset-list.scss");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var createDatasetCard = function createDatasetCard(dataset) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(_dataCard.default, {
|
|
12
|
+
key: dataset.id,
|
|
13
|
+
dataset: dataset
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var _default = exports.default = function _default(_ref) {
|
|
17
|
+
var _ref$datasets = _ref.datasets,
|
|
18
|
+
datasets = _ref$datasets === void 0 ? [] : _ref$datasets;
|
|
19
|
+
return /*#__PURE__*/React.createElement("dataset-list", {
|
|
20
|
+
"data-testid": "dataset-list"
|
|
21
|
+
}, datasets.map(createDatasetCard) || /*#__PURE__*/React.createElement("div", null));
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
import DatasetList from './dataset-list'
|
|
3
|
+
import DatasetCard from '../data-card'
|
|
4
|
+
import expectedDatasetList from '../../../stubs/dataset-list-stub'
|
|
5
|
+
|
|
6
|
+
describe('dataset list view', () => {
|
|
7
|
+
let subject
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
subject = shallow(<DatasetList datasets={expectedDatasetList.results} />)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('displays the proper number of datacards based on datasets prop', () => {
|
|
14
|
+
expect(subject.find(DatasetCard).length).toEqual(expectedDatasetList.results.length)
|
|
15
|
+
})
|
|
16
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _datasetList = _interopRequireDefault(require("./dataset-list"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _datasetList.default;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
require("./dataset-metadata.scss");
|
|
10
|
+
var _reactTable = _interopRequireDefault(require("react-table"));
|
|
11
|
+
require("react-table/react-table.css");
|
|
12
|
+
var _collapsableBox = _interopRequireDefault(require("../../components/collapsable-box"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
16
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
17
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
21
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
22
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
23
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
24
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
25
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
26
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
27
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
28
|
+
function _default() {
|
|
29
|
+
_classCallCheck(this, _default);
|
|
30
|
+
return _callSuper(this, _default, arguments);
|
|
31
|
+
}
|
|
32
|
+
_inherits(_default, _Component);
|
|
33
|
+
return _createClass(_default, [{
|
|
34
|
+
key: "render",
|
|
35
|
+
value: function render() {
|
|
36
|
+
var dataset = this.props.dataset;
|
|
37
|
+
if (!this.props.dataset) {
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement("div", null);
|
|
39
|
+
}
|
|
40
|
+
var referenceUrls = dataset.referenceUrls || [];
|
|
41
|
+
var data = [{
|
|
42
|
+
Field: 'Maintainer',
|
|
43
|
+
Value: mailto(dataset.contactEmail, dataset.contactName)
|
|
44
|
+
}, {
|
|
45
|
+
Field: 'Last Updated',
|
|
46
|
+
Value: dataset.modified
|
|
47
|
+
}, {
|
|
48
|
+
Field: 'Data Last Ingested',
|
|
49
|
+
Value: dataset.lastUpdatedDate
|
|
50
|
+
}, {
|
|
51
|
+
Field: 'Rights',
|
|
52
|
+
Value: dataset.rights
|
|
53
|
+
}, {
|
|
54
|
+
Field: 'Spatial',
|
|
55
|
+
Value: dataset.spatial
|
|
56
|
+
}, {
|
|
57
|
+
Field: 'Temporal',
|
|
58
|
+
Value: dataset.temporal
|
|
59
|
+
}, {
|
|
60
|
+
Field: 'Release Date',
|
|
61
|
+
Value: dataset.issuedDate
|
|
62
|
+
}, {
|
|
63
|
+
Field: 'Frequency',
|
|
64
|
+
Value: dataset.publishFrequency
|
|
65
|
+
}, {
|
|
66
|
+
Field: 'Data Dictionary URL',
|
|
67
|
+
Value: /*#__PURE__*/_react.default.createElement("a", {
|
|
68
|
+
role: "link",
|
|
69
|
+
href: dataset.describedByUrl,
|
|
70
|
+
target: "_blank"
|
|
71
|
+
}, dataset.describedByUrl)
|
|
72
|
+
}, {
|
|
73
|
+
Field: 'Data Dictionary Type',
|
|
74
|
+
Value: dataset.describedByMimeType
|
|
75
|
+
}, {
|
|
76
|
+
Field: 'Collection',
|
|
77
|
+
Value: dataset.parentDataset
|
|
78
|
+
}, {
|
|
79
|
+
Field: 'Language',
|
|
80
|
+
Value: dataset.language
|
|
81
|
+
}, {
|
|
82
|
+
Field: 'Homepage URL',
|
|
83
|
+
Value: /*#__PURE__*/_react.default.createElement("a", {
|
|
84
|
+
role: "link",
|
|
85
|
+
href: dataset.homepage,
|
|
86
|
+
target: "_blank"
|
|
87
|
+
}, dataset.homepage)
|
|
88
|
+
}, {
|
|
89
|
+
Field: 'Related Documents',
|
|
90
|
+
Value: referenceUrls.map(function (url) {
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("a", {
|
|
92
|
+
role: "link",
|
|
93
|
+
href: url,
|
|
94
|
+
target: "_blank"
|
|
95
|
+
}, url));
|
|
96
|
+
})
|
|
97
|
+
}, {
|
|
98
|
+
Field: 'Source URL',
|
|
99
|
+
Value: /*#__PURE__*/_react.default.createElement("a", {
|
|
100
|
+
role: "link",
|
|
101
|
+
href: dataset.sourceUrl,
|
|
102
|
+
target: "_blank"
|
|
103
|
+
}, dataset.sourceUrl)
|
|
104
|
+
}, {
|
|
105
|
+
Field: 'Source Type',
|
|
106
|
+
Value: dataset.sourceType
|
|
107
|
+
}, {
|
|
108
|
+
Field: 'License',
|
|
109
|
+
Value: /*#__PURE__*/_react.default.createElement("a", {
|
|
110
|
+
role: "link",
|
|
111
|
+
href: dataset.license,
|
|
112
|
+
target: "_blank"
|
|
113
|
+
}, dataset.license)
|
|
114
|
+
}, {
|
|
115
|
+
Field: 'Category',
|
|
116
|
+
Value: dataset.catagories
|
|
117
|
+
}, {
|
|
118
|
+
Field: 'Count - Downloads',
|
|
119
|
+
Value: dataset.downloads
|
|
120
|
+
}, {
|
|
121
|
+
Field: 'Count - API Queries',
|
|
122
|
+
Value: dataset.queries
|
|
123
|
+
}, {
|
|
124
|
+
Field: 'Access Level',
|
|
125
|
+
Value: dataset.accessLevel
|
|
126
|
+
}, {
|
|
127
|
+
Field: 'Table Name',
|
|
128
|
+
Value: dataset.systemName
|
|
129
|
+
}];
|
|
130
|
+
var columns = [{
|
|
131
|
+
Header: 'Field',
|
|
132
|
+
accessor: 'Field',
|
|
133
|
+
headerClassName: 'table-header',
|
|
134
|
+
width: 160
|
|
135
|
+
}, {
|
|
136
|
+
Header: 'Value',
|
|
137
|
+
accessor: 'Value',
|
|
138
|
+
headerClassName: 'table-header'
|
|
139
|
+
}];
|
|
140
|
+
return /*#__PURE__*/_react.default.createElement("dataset-metadata", {
|
|
141
|
+
class: "dataset-metadata"
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement(_collapsableBox.default, {
|
|
143
|
+
title: "Additional Information",
|
|
144
|
+
expanded: true
|
|
145
|
+
}, /*#__PURE__*/_react.default.createElement(_reactTable.default, {
|
|
146
|
+
data: data,
|
|
147
|
+
columns: columns,
|
|
148
|
+
defaultPageSize: data.length,
|
|
149
|
+
className: "-striped -highlight",
|
|
150
|
+
showPagination: false,
|
|
151
|
+
sortable: true,
|
|
152
|
+
defaultSorted: [{
|
|
153
|
+
id: 'Field',
|
|
154
|
+
desc: false
|
|
155
|
+
}]
|
|
156
|
+
})));
|
|
157
|
+
}
|
|
158
|
+
}]);
|
|
159
|
+
}(_react.Component);
|
|
160
|
+
function mailto(email, name) {
|
|
161
|
+
if (email) {
|
|
162
|
+
return /*#__PURE__*/_react.default.createElement("a", {
|
|
163
|
+
role: "link",
|
|
164
|
+
href: 'mailto:' + email
|
|
165
|
+
}, name);
|
|
166
|
+
} else {
|
|
167
|
+
return /*#__PURE__*/_react.default.createElement("span", null, name);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import '../../styles/variables.scss';
|
|
2
|
+
@import '../../styles/mixins.scss';
|
|
3
|
+
|
|
4
|
+
dataset-metadata {
|
|
5
|
+
|
|
6
|
+
home-banner {
|
|
7
|
+
display:none !important;
|
|
8
|
+
}
|
|
9
|
+
home-banner .banner-background {
|
|
10
|
+
display:none !important;
|
|
11
|
+
}
|
|
12
|
+
.header-container {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.header-text-items {
|
|
18
|
+
margin: 1rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.metadata-header {
|
|
22
|
+
@include header();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.table-header {
|
|
26
|
+
background-color: $header-grey;
|
|
27
|
+
text-align: left;
|
|
28
|
+
font-weight: 800;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
a {
|
|
32
|
+
@include sub-link();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
import DatasetMetadata from './dataset-metadata'
|
|
3
|
+
|
|
4
|
+
describe('additional info element', () => {
|
|
5
|
+
test('card to render text based on props', () => {
|
|
6
|
+
const subject = shallow(<DatasetMetadata dataset={{ spatial: 'Ohio' }} />)
|
|
7
|
+
const table = subject.find('ReactTable')
|
|
8
|
+
expect(table.prop('data')[4]).toEqual({ Field: 'Spatial', Value: 'Ohio' })
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('card renders mailto link correctly', () => {
|
|
12
|
+
const subject = shallow(<DatasetMetadata dataset={{ contactName: 'John', contactEmail: 'john@smith.com' }} />)
|
|
13
|
+
const actual = JSON.stringify(subject.find('ReactTable').prop('data')[0])
|
|
14
|
+
const expected = JSON.stringify({ Field: 'Maintainer', Value: <a role="link" href='mailto:john@smith.com'>John</a> })
|
|
15
|
+
expect(actual).toEqual(expected)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('referenceUrls renders correctly', () => {
|
|
19
|
+
const subject = shallow(<DatasetMetadata dataset={{ referenceUrls: ['https://www.google.com', 'https://www.facebook.com'] }} />)
|
|
20
|
+
const actual = JSON.stringify(subject.find('ReactTable').prop('data')[13])
|
|
21
|
+
const expected = JSON.stringify({ Field: 'Related Documents', Value: [<div><a role="link" href='https://www.google.com' target='_blank'>https://www.google.com</a></div>, <div><a role="link" href='https://www.facebook.com' target='_blank'>https://www.facebook.com</a></div>] })
|
|
22
|
+
expect(actual).toEqual(expected)
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _datasetMetadata = _interopRequireDefault(require("./dataset-metadata"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _datasetMetadata.default;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 _datasetPreview = _interopRequireDefault(require("./dataset-preview"));
|
|
9
|
+
var _actions = require("../../store/actions");
|
|
10
|
+
var _selectors = require("../../store/selectors");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var mapStateToProps = function mapStateToProps(state, _ref) {
|
|
13
|
+
var format = _ref.format;
|
|
14
|
+
return {
|
|
15
|
+
datasetPreview: (0, _selectors.getDataSetPreview)(state, format),
|
|
16
|
+
previewLoading: state.presentation.previewLoading
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
20
|
+
return {
|
|
21
|
+
retrieveDatasetPreview: function retrieveDatasetPreview(datasetId) {
|
|
22
|
+
return dispatch((0, _actions.retrieveDatasetPreview)(datasetId));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_datasetPreview.default);
|