diff options
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | env.sh | 3 | ||||
-rw-r--r-- | init.sh | 18 | ||||
m--------- | soc_collector | 0 | ||||
-rw-r--r-- | src/components/List.js | 5 | ||||
-rw-r--r-- | src/components/ObjectView.js | 4 |
6 files changed, 9 insertions, 39 deletions
@@ -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 -``` @@ -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 -Subproject d09b9f8625426eaec3b533da40783666e947ce2 +Subproject 9d3a7ed5a71f4d9caf248987d689350f72a1699 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)); |