From 37a5be906c22a7a0ab205f50be600ad85f00e80d Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Wed, 24 Nov 2021 17:11:02 +0100 Subject: Update for backend changes --- README.md | 18 ++---------------- env.sh | 3 +++ init.sh | 18 ------------------ soc_collector | 2 +- src/components/List.js | 5 ++--- src/components/ObjectView.js | 4 ++-- 6 files changed, 10 insertions(+), 40 deletions(-) create mode 100644 env.sh delete mode 100644 init.sh diff --git a/README.md b/README.md index 8ec1b10..577354a 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,7 @@ ## Development setup Quick start: -- `source init.sh` - -What it does: -- Starts `soc_collector` listening on `COLLECTOR_URL` -- Starts `jwt_mock.go` listening on `JWT_URL` -- Starts `soc_dashboard` listening on `http://localhost:8001` - ---- +- `source env.sh` +- `npm run start` The commit pointed to by the `soc_collector` submodule is compatible with `main` in this repo. - ---- - -To populate `soc_collector` with data from `example_data.json`: - -``` -cat example_data.json | curl -s -u user3:pw3 --data-binary @- ${COLLECTOR_URL}/sc/v0/add -``` diff --git a/env.sh b/env.sh new file mode 100644 index 0000000..c0e05d6 --- /dev/null +++ b/env.sh @@ -0,0 +1,3 @@ +export PER_PAGE=2 +export COLLECTOR_URL=http://localhost:80 +export JWT_URL=http://localhost:8000/api/v1.0/auth diff --git a/init.sh b/init.sh deleted file mode 100644 index 0edf74f..0000000 --- a/init.sh +++ /dev/null @@ -1,18 +0,0 @@ -export COUCHDB_USER=couchdb -export COUCHDB_PASSWORD=insecure -export COUCHDB_NAME=test -export COUCHDB_HOSTNAME=localhost -cd soc_collector/docker/ -docker compose up -d -sleep 2 - -cd ../demo/ -python ../src/wsgi.py & -cd ../.. -go run jwt_mock.go & -sleep 2 - -export PER_PAGE=2 -export COLLECTOR_URL=http://localhost:8000 -export JWT_URL=http://localhost:8080 -npm run start diff --git a/soc_collector b/soc_collector index d09b9f8..9d3a7ed 160000 --- a/soc_collector +++ b/soc_collector @@ -1 +1 @@ -Subproject commit d09b9f8625426eaec3b533da40783666e947ce2d +Subproject commit 9d3a7ed5a71f4d9caf248987d689350f72a1699c diff --git a/src/components/List.js b/src/components/List.js index 69f2a50..0bf359b 100644 --- a/src/components/List.js +++ b/src/components/List.js @@ -54,7 +54,7 @@ class List extends React.Component { getData() { fetch(`${process.env.COLLECTOR_URL}/sc/v0/get?${this.queryString()}`, { headers: { - Authorization: "Basic " + btoa("user1:pw1") + Authorization: "Bearer " + localStorage.getItem("token") } }) // TODO: Look at `status` or return code or both? @@ -70,7 +70,7 @@ class List extends React.Component { if (json.status != "success") throw `Unexpected status from soc_collector: ${json.status}`; this.setState({ - objects: json.data + objects: json.docs }); }) .catch(e => this.props.setError(e)); @@ -95,7 +95,6 @@ class List extends React.Component { setPage(event, value) { this.setState({ page: value }, () => { - console.log(this.state); this.getData(); window.scrollTo(0, 0); }); diff --git a/src/components/ObjectView.js b/src/components/ObjectView.js index 3b39c96..cecadeb 100644 --- a/src/components/ObjectView.js +++ b/src/components/ObjectView.js @@ -19,7 +19,7 @@ class ObjectView extends React.Component { getData() { fetch(`${process.env.COLLECTOR_URL}/sc/v0/get/${this.props.id}`, { headers: { - Authorization: "Basic " + btoa("user1:pw1") + Authorization: "Bearer " + localStorage.getItem("token") } }) // TODO: Look at `status` or return code or both? @@ -35,7 +35,7 @@ class ObjectView extends React.Component { if (json.status != "success") throw `Unexpected status from soc_collector: ${json.status}`; this.setState({ - object: json.data + object: json.docs }); }) .catch(e => this.props.setError(e)); -- cgit v1.1