Skip to content

Commit

Permalink
Minor cleanup (#220)
Browse files Browse the repository at this point in the history
* Fix README; add missing dev dependency

* Fix validators to filter out bad events and sources

* Better defaults in config
  • Loading branch information
breezykermo authored Oct 21, 2021
1 parent f33a99e commit 72c1c12
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ git clone https://github.com/forensic-architecture/timemap
npm install
```

3. Run the development server, which will be available at http://localhost:8080.
3. Copy the example config

```shell
npm run dev
cp example.config.js config.js
```

4. Run the development server, which will be available at http://localhost:8080.

```shell
CONFIG=config.js npm run dev
```

To run with a file that is not 'config.js' in the root directory, set the `CONFIG` environment variable:
Expand All @@ -55,7 +61,7 @@ To run with a file that is not 'config.js' in the root directory, set the `CONFI
CONFIG="myotherconfig.js" npm run dev
```

In order for TimeMap to be able to display interesting information, you'll have to make sure to have the capacity to serve data, as well as adjusting some configuration parameters. Follow the in-depth tutorial linked above!
At this stage, you'll probably only see a basic map with several error modals. In order for TimeMap to be able to display interesting information, you'll have to make sure to have the capacity to serve data, as well as adjusting some configuration parameters. See the [in-depth tutorial](https://forensic-architecture.org/investigation/timemap-for-cartographic-platforms) or [datasheet-server](https://github.com/forensic-architecture/datasheet-server).

#### Running without datasheet-server

Expand Down
2 changes: 0 additions & 2 deletions example.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = {
display_title: 'example',
SERVER_ROOT: 'http://localhost:4040',
EVENTS_EXT: '/api/timemap_data/export_events/deeprows',
CATEGORIES_EXT: '/api/timemap_data/export_categories/rows',
ASSOCIATIONS_EXT: '/api/timemap_data/export_associations/deeprows',
SOURCES_EXT: '/api/timemap_data/export_sources/deepids',
SITES_EXT: '',
Expand All @@ -18,7 +17,6 @@ module.exports = {
},
features: {
COLOR_BY_ASSOCIATION: true,
USE_CATEGORIES: true,
USE_ASSOCIATIONS: true,
USE_SOURCES: true,
USE_COVER: false,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"workbox-webpack-plugin": "5.1.4"
},
"devDependencies": {
"@babel/highlight": "^7.14.5",
"ava": "1.0.0-beta.8",
"mocha": "^5.2.0",
"node-sass": "4.13.1",
Expand Down
2 changes: 1 addition & 1 deletion src/common/data/copy.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"categories": "Categories",
"categories_label": "Categories",
"explore_by_category__title": "Explore events by category",
"explore_by_category__description": "‘Categories’ refer to the victims of a given incident.<br><br>If no categories are selected, all datapoints are displayed.",
"explore_by_category__description": "",
"shapes": "Shapes",
"shapes_label": "Shapes",
"explore_by_shapes__title": "Explore events by shape breakdown",
Expand Down
1 change: 1 addition & 0 deletions src/components/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class Toolbar extends React.Component {
return (
<div
className={classes}
key={iconKey}
onClick={() => {
this.selectTab(_selected);
}}
Expand Down
3 changes: 3 additions & 0 deletions src/reducers/validate/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,15 @@ export function validateDomain(domain, features) {

function validateArray(items, domainKey, schema) {
items.forEach((item) => {
if (domainKey === "events" && item.date === "" && item.time === "")
return;
validateArrayItem(item, domainKey, schema);
});
}

function validateObject(obj, domainKey, itemSchema) {
Object.keys(obj).forEach((key) => {
if (key === "") return;
const vl = obj[key];
const result = Joi.validate(vl, itemSchema);
if (result.error !== null) {
Expand Down

0 comments on commit 72c1c12

Please sign in to comment.