Skip to content

Commit

Permalink
1.x Release (#24)
Browse files Browse the repository at this point in the history
* Update Resource and useDatastore to work with filtered resources (#8)

* Add conditions from options on initial load of useDatastore

* Add basic test for intitial condition

* Fix condtion on test

* Add basic url query code to useDatastore and Resource

* Clean up basic test for new url to json function

* Update version to alpha.2

* Add Conditions and Operators to the URL Datastore query function (#9)

* Update urlQuery function to work only with conditions and condition operators

* update to alpha.3

* Fix comman in package.json and add new yarn.lock

* Add react-dom to devDependencies

* Add QS library and dataset search url functions (#10)

* Add QS library and functions for url parameters

* Change to function from arrow function

* Add new functions to index.js

* Update version to alpha.4

* Add manual mode and remove check for children in Resource (#12)

* Update to 1.x alpha 5

* Added new require conditions option and updated sort to sorts in data… (#13)

* Added new require conditions option and updated sort to sorts in datastore call.

* copy paste fix.

* Update version to 1.x alpha 6

* Fix npm issue update to 1.x-alpha7

* Revert sorts to sort fix

* Dataset error catch (#14)

* Catch axios error and send back for metastoreDataset.

* bump version

* Datastore sort v2 (#17)

* Adjusted sort handling.

* Added in ability to set properties from hook.

* Bumped version

* allowed initial sort.

* Bump alpha version

* WCMS-4505: added export of properties and setProperties for datastore hook. (#19)

* Add additional params (#20)

* Add additional parameters to the hooks for aca/redirect keys

* Additional params are now an object

* Add back params to useDatastore

* bump 1.x alpha to 14

* Fix undefined additionalParams in metastore

* Bug fix: Add catch method to metadatastore hook/fetch (#21)

* Remove pagination hook and fix bug when changing limits (#22)

* Remove pagination hook and fix bug when changing limits

* Add beta version

* Change offset to 0 when conditions change

* Remove legacy Resource component (#23)

Co-authored-by: Brian Seek <[email protected]>
  • Loading branch information
dgading and brianseek authored Sep 29, 2021
1 parent 042303f commit bb8f047
Show file tree
Hide file tree
Showing 20 changed files with 1,977 additions and 7,834 deletions.
83 changes: 40 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@civicactions/data-catalog-services",
"version": "0.1.4",
"version": "1.0.0",
"description": "Functions and React components to connect to the DKAN api.",
"main": "lib/index.js",
"scripts": {
Expand All @@ -11,29 +11,26 @@
"lint": "eslint ./src",
"test": "jest --verbose",
"test:watch": "npm run test -- --watch",
"test:coverage": "npm run test -- --coverage",
"docz:dev": "docz dev",
"docz:build": "docz build",
"docz:serve": "docz build && docz serve",
"docz:publish": "docz build && gh-pages -d ./docs"
"test:coverage": "npm run test -- --coverage"
},
"author": "CivicActions <[email protected]>",
"license": "GPL-3.0",
"dependencies": {
"@civicactions/data-catalog-components": "^1.1.0",
"@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-brands-svg-icons": "^5.11.2",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/react-fontawesome": "^0.1.4",
"@civicactions/data-catalog-components": "^1.7.0",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-brands-svg-icons": "^5.15.2",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/react-fontawesome": "^0.1.14",
"@reach/router": "^1.3.3",
"axios": "^0.19.0",
"bootstrap": "^4.2.1",
"bootstrap": "^4.6.0",
"excerpts": "0.0.3",
"html-to-react": "^1.3.4",
"immutability-helper": "^3.0.2",
"lodash": "^4.17.15",
"lodash": "^4.17.21",
"prop-types": "^15.6.2",
"query-string": "^6.8.3",
"qs": "^6.10.1",
"query-string": "^6.14.0",
"react-aria-modal": "^4.0.0",
"react-dnd": "^10.0.2",
"react-dnd-cjs": "^9.5.1",
Expand All @@ -46,41 +43,41 @@
"react-js-pagination": "^3.0.2",
"react-loader-advanced": "^1.7.1",
"react-loading-spin": "^1.0.9",
"react-table": "^7.0.4",
"react-table": "^7.6.3",
"reactstrap": "^7.1.0",
"styled-components": "^5.0.1",
"swagger-ui-react": "3.25.0",
"validator": "^12.2.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/code-frame": "^7.8.3",
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/cli": "^7.12.17",
"@babel/code-frame": "^7.12.13",
"@babel/core": "^7.12.17",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-proposal-decorators": "^7.12.13",
"@babel/plugin-proposal-do-expressions": "^7.12.13",
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-proposal-export-namespace-from": "^7.12.13",
"@babel/plugin-proposal-function-bind": "^7.12.13",
"@babel/plugin-proposal-function-sent": "^7.12.13",
"@babel/plugin-proposal-json-strings": "^7.12.13",
"@babel/plugin-proposal-logical-assignment-operators": "^7.12.13",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13",
"@babel/plugin-proposal-numeric-separator": "^7.12.13",
"@babel/plugin-proposal-optional-chaining": "^7.12.17",
"@babel/plugin-proposal-pipeline-operator": "^7.12.13",
"@babel/plugin-proposal-throw-expressions": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.6.2",
"@testing-library/dom": "^7.29.0",
"@testing-library/jest-dom": "^5.10.1",
"@babel/plugin-transform-runtime": "^7.12.17",
"@babel/preset-env": "^7.12.17",
"@babel/preset-react": "^7.12.13",
"@babel/runtime": "^7.12.18",
"@testing-library/dom": "^7.29.6",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^10.2.1",
"@testing-library/react-hooks": "^3.3.0",
"@testing-library/user-event": "^12.6.0",
"@testing-library/user-event": "^12.7.2",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
Expand All @@ -92,21 +89,21 @@
"babel-preset-stage-0": "^6.24.1",
"core-js": "^2.6.5",
"css-loader": "^2.1.0",
"docz": "^2.3.1",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^6.2.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^1.7.0",
"extract-text-webpack-plugin": "^3.0.2",
"gh-pages": "^2.2.0",
"jest": "^24.9.0",
"node-sass": "^4.13.1",
"prettier": "^1.16.0",
"react-scripts": "^4.0.1",
"react-dom": "^16.13.1",
"react-scripts": "^4.0.3",
"react-test-renderer": "^16.9.0",
"sass-loader": "^7.1.0",
"url-loader": "^1.1.2"
Expand Down
4 changes: 0 additions & 4 deletions src/Resource/helpers.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { createContext } from 'react';

export const ResourceDispatch = createContext(null);

// Build columns in correct structure for Datatable component.
export function prepareColumns(columns) {
return columns.map((column) => ({
Expand Down
12 changes: 0 additions & 12 deletions src/Resource/helpers.test.js

This file was deleted.

74 changes: 0 additions & 74 deletions src/Resource/index.jsx

This file was deleted.

63 changes: 0 additions & 63 deletions src/Resource/resource.test.jsx

This file was deleted.

28 changes: 19 additions & 9 deletions src/hooks/useDatastore/fetch.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import axios from 'axios';
import qs from 'qs'

export async function fetchDataFromQuery(id, rootUrl, options) {
const { keys, limit, offset, conditions, sort, prepareColumns, setValues, setCount, setColumns, setLoading } = options;
export async function fetchDataFromQuery(id, rootUrl, options, additionalParams) {
const { keys, limit, offset, conditions, sort, prepareColumns, properties, setValues, setCount, setColumns, setLoading, setSchema } = options;
if(!id) {
// TODO: Throw error
return false;
}
if(typeof setLoading === 'function') {
setLoading(true);
}
return await axios.post(`${rootUrl}/datastore/query/?`, {
resources: [{id: id, alias: 't'}],
keys: keys,
limit: limit,
offset: offset,
conditions: conditions,
sort: sort,
return await axios({
method: 'GET',
url: `${rootUrl}/datastore/query/${id}`,
params: {
keys: keys,
limit: limit,
offset: offset,
conditions: conditions,
sorts: sort,
properties: properties,
...additionalParams,
},
paramsSerializer: (params) => {
return qs.stringify(params)
}
})
.then((res) => {
const { data } = res;
Expand All @@ -24,6 +33,7 @@ export async function fetchDataFromQuery(id, rootUrl, options) {
if(data.results.length) {
setColumns(prepareColumns ? prepareColumns(Object.keys(data.results[0])) : Object.keys(data.results[0]))
}
setSchema(data.schema)
if(typeof setLoading === 'function') {
setLoading(false);
}
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useDatastore/fetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ describe('fetchDataFromQuery', () => {
limit: 20,
offset: 0,
conditions: [],
sort: {asc: [], desc: []},
sorts: [],
setValues: () => {},
setCount: () => {},
setColumns: () => {}
setColumns: () => {},
setSchema: () => {}
})
expect(results.count).toEqual(data.data.count);
expect(results.results).toEqual(data.data.results);
Expand Down
Loading

0 comments on commit bb8f047

Please sign in to comment.