Skip to content

Commit

Permalink
Merge pull request #605 from OpenKnowledgeMaps/dev
Browse files Browse the repository at this point in the history
Biweekly release (21-11-25)
  • Loading branch information
chreman authored Nov 25, 2021
2 parents f0618c2 + 6095a04 commit 09c5da4
Show file tree
Hide file tree
Showing 30 changed files with 477 additions and 187 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Head Start is a web-based knowledge mapping software intended to give researcher
### Client
To get started, clone this repository. Next, duplicate the file `config.example.js` in the root folder and rename it to `config.js`.

Make sure to have `npm` version 6.11.3 installed (it comes with Node.js 10.17.0, best way to install is with [nvm](https://github.com/nvm-sh/nvm), `nvm install 10.17.0`) and run the following two commands to build the Headstart client:
Make sure to have installed `node` version >= 14.18.1 and `npm` version >=8.1.1 (best way to install is with [nvm](https://github.com/nvm-sh/nvm), `nvm install 14.18.1`) and run the following two commands to build the Headstart client:

npm install
npm run dev
Expand All @@ -24,9 +24,12 @@ To run Headstart on a different server (e.g. Apache), you need to set the public
* Dev: specify the full path including protocol, e.g. `http://localhost/headstart/dist`
* Production: specify the full path excluding protocol, e.g. `//example.org/headstart/dist`

Point your browser to the following address:
Point your browser to one of the following addresses:

http://localhost:8080/examples/local_files/index.html
http://localhost:8080/local_files/
http://localhost:8080/local_streamgraph/
http://localhost:8080/project_website/base.html
http://localhost:8080/project_website/pubmed.html

If everything has worked out, you should see the visualization shown above.

Expand All @@ -42,7 +45,7 @@ See [Installing and configuring the server](doc/server_config.md) for instructio

Maintainer: [Peter Kraker](https://github.com/pkraker) ([[email protected]](mailto:[email protected]))

Authors: [Maxi Schramm](https://github.com/tanteuschi), [Christopher Kittel](https://github.com/chreman), [Asura Enkhbayar](https://github.com/Bubblbu), [Scott Chamberlain](https://github.com/sckott), [Rainer Bachleitner](https://github.com/rbachleitner), [Yael Stein](https://github.com/jaels), [Thomas Arrow](https://github.com/tarrow), [Mike Skaug](https://github.com/mikeskaug), [Philipp Weissensteiner](https://github.com/wpp), and the [Open Knowledge Maps team](http://openknowledgemaps.org/team)
Authors: [Maxi Schramm](https://github.com/tanteuschi), [Christopher Kittel](https://github.com/chreman), [Jan Konstant](https://github.com/konstiman), [Asura Enkhbayar](https://github.com/Bubblbu), [Scott Chamberlain](https://github.com/sckott), [Rainer Bachleitner](https://github.com/rbachleitner), [Yael Stein](https://github.com/jaels), [Thomas Arrow](https://github.com/tarrow), [Mike Skaug](https://github.com/mikeskaug), [Philipp Weissensteiner](https://github.com/wpp), and the [Open Knowledge Maps team](http://openknowledgemaps.org/team)


## Features
Expand Down
1 change: 0 additions & 1 deletion examples/gsheets/data-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var data_config = {

content_based: true,
is_evaluation: true,
evaluation_service: ["matomo"],

is_force_areas: true,
area_force_alpha: 0.03,
Expand Down
2 changes: 1 addition & 1 deletion examples/local_streamgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {

Then the process is the same as with the local files example: start the dev server npm start. When the build is done, the streamgraph can be accessed at

`http://localhost:8080/examples/local_streamgraph/index.html`
`http://localhost:8080/local_streamgraph/`

In future, it might be nice to come up with a solution that doesn't involve config file, but uses for example a system variable or a specific npm run command.

Expand Down
2 changes: 1 addition & 1 deletion examples/project_website/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">

<head>
<base href="//localhost:8080/examples/project_website/">
<base href="//localhost:8080/project_website/">

<script type="text/javascript" src="./data-config_base.js"></script>
<title>
Expand Down
1 change: 0 additions & 1 deletion examples/project_website/data-config_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var data_config = {
show_keywords: true,

is_evaluation: true,
evaluation_service: ["matomo"],

use_hypothesis: true,

Expand Down
1 change: 0 additions & 1 deletion examples/project_website/data-config_pubmed.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var data_config = {
show_keywords: true,

is_evaluation: true,
evaluation_service: ["matomo"],

use_hypothesis: true,

Expand Down
2 changes: 1 addition & 1 deletion examples/project_website/pubmed.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">

<head>
<base href="//localhost:8080/examples/project_website/">
<base href="//localhost:8080/project_website/">


<script type="text/javascript" src="./data-config_pubmed.js"></script>
Expand Down
1 change: 0 additions & 1 deletion examples/viper/js/data-config_openaire.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ var data_config = {
},

is_evaluation: true,
evaluation_service: ["ga", "matomo"],

use_hypothesis: true,

Expand Down
19 changes: 9 additions & 10 deletions vis/js/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const NOT_QUEUED_IN_ANIMATION = [
"ZOOM_OUT",
"SELECT_PAPER",
"DESELECT_PAPER",
"DESELECT_PAPER_BACKLINK",
"FILE_CLICKED",
"SEARCH",
"FILTER",
Expand All @@ -29,20 +28,23 @@ export const NOT_QUEUED_IN_ANIMATION = [

export const zoomIn = (
selectedAreaData,
source = null,
callback,
alreadyZoomed = false
alreadyZoomed = false,
isFromBackButton = false,
selectedPaperData = null
) => ({
type: "ZOOM_IN",
selectedAreaData,
source,
callback,
alreadyZoomed,
isFromBackButton,
selectedPaperData,
});

export const zoomOut = (callback) => ({
export const zoomOut = (callback, isFromBackButton = false) => ({
type: "ZOOM_OUT",
callback,
isFromBackButton,
});

/**
Expand Down Expand Up @@ -97,10 +99,11 @@ export const filter = (id) => ({ type: "FILTER", id });

export const sort = (id) => ({ type: "SORT", id });

export const selectPaper = (paper) => ({
export const selectPaper = (paper, isFromBackButton = false) => ({
type: "SELECT_PAPER",
safeId: paper.safe_id,
paper,
isFromBackButton,
});

export const deselectPaper = () => ({ type: "DESELECT_PAPER" });
Expand All @@ -114,10 +117,6 @@ export const showPreview = (paper) => ({ type: "SHOW_PREVIEW", paper });

export const hidePreview = () => ({ type: "HIDE_PREVIEW" });

export const deselectPaperBacklink = () => ({
type: "DESELECT_PAPER_BACKLINK",
});

export const updateDimensions = (chart, list) => ({
type: "RESIZE",
listHeight: list.height,
Expand Down
1 change: 0 additions & 1 deletion vis/js/components/KnowledgeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const KnowledgeMap = (props) => {
};

const handleOtherAreaZoomIn = (bubble) => {
handleDeselectPaper();
handleZoomIn(bubble, true);
trackMatomoEvent("Knowledge map", "Zoom in", "Bubble");
};
Expand Down
3 changes: 1 addition & 2 deletions vis/js/components/Streamgraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
TOOLTIP_OFFSET,
} from "../utils/streamgraph";

import { deselectPaper, zoomIn, zoomOut } from "../actions";
import { zoomIn, zoomOut } from "../actions";

/**
* Class representing the streamgraph visualization.
Expand Down Expand Up @@ -541,7 +541,6 @@ const mapStateToProps = (state) => ({

const mapDispatchToProps = (dispatch) => ({
onAreaClick: (stream) => {
dispatch(deselectPaper());
dispatch(
zoomIn({ title: stream.key, color: stream.color, docIds: stream.docIds })
);
Expand Down
9 changes: 3 additions & 6 deletions vis/js/components/listentries/BasicListEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { shorten } from "../../utils/string";
const BasicListEntries = ({
displayedData,
handleZoomIn,
handleSelectPaper,
handleDeselectPaper,
handleSelectPaperWithZoom,
handlePDFClick,
handleAreaMouseover,
handleAreaMouseout,
Expand All @@ -31,16 +30,14 @@ const BasicListEntries = ({
if (disableClicks) {
return;
}
handleSelectPaper(paper);
handleZoomIn(paper);
handleSelectPaperWithZoom(paper);
};

const handleAreaClick = (paper) => {
if (disableClicks) {
return;
}
handleDeselectPaper();
handleZoomIn(paper, "list-area");
handleZoomIn(paper);
};

return (
Expand Down
10 changes: 5 additions & 5 deletions vis/js/components/listentries/ClassificationListEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ClassificationListEntries = ({
disableClicks,
handleZoomIn,
handleSelectPaper,
handleDeselectPaper,
handleSelectPaperWithZoom,
handlePDFClick,
handleAreaMouseover,
handleAreaMouseout,
Expand All @@ -37,18 +37,18 @@ const ClassificationListEntries = ({
if (disableClicks) {
return;
}
handleSelectPaper(paper);
if (!isStreamgraph) {
handleZoomIn(paper);
handleSelectPaperWithZoom(paper);
} else {
handleSelectPaper(paper);
}
};

const handleAreaClick = (paper) => {
if (disableClicks) {
return;
}
handleDeselectPaper();
handleZoomIn(paper, "list-area");
handleZoomIn(paper);
};

return (
Expand Down
10 changes: 5 additions & 5 deletions vis/js/components/listentries/StandardListEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const StandardListEntries = ({
disableClicks,
handleZoomIn,
handleSelectPaper,
handleDeselectPaper,
handleSelectPaperWithZoom,
handlePDFClick,
handleAreaMouseover,
handleAreaMouseout,
Expand All @@ -44,18 +44,18 @@ const StandardListEntries = ({
if (disableClicks) {
return;
}
handleSelectPaper(paper);
if (!isStreamgraph) {
handleZoomIn(paper);
handleSelectPaperWithZoom(paper);
} else {
handleSelectPaper(paper);
}
};

const handleAreaClick = (paper) => {
if (disableClicks) {
return;
}
handleDeselectPaper();
handleZoomIn(paper, "list-area");
handleZoomIn(paper);
};

return (
Expand Down
2 changes: 0 additions & 2 deletions vis/js/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ var config = {
show_loading_screen: false,
//evaluation mode/events logging
is_evaluation: false,
//which evaluation service to use. can also be an array. currently possible: "log", "matomo" and "ga"
evaluation_service: "log",
//enable logging of mouseover events (use only temporarily as it creates A LOT of logging events)
enable_mouseover_evaluation: false,
//whether to embed the okmaps credit
Expand Down
62 changes: 0 additions & 62 deletions vis/js/headstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,68 +32,6 @@ HeadstartFSM.prototype = {
}
},

// TODO delete this completely
recordAction: function(id, category, action, user, timestamp, additional_params, post_data) {

if(!config.is_evaluation) {
return;
}

let services = config.evaluation_service;

if(typeof services === "string") {
services = [services];
}

if (services.includes("log")) {
this.recordActionLog(category, action, id, user, timestamp, additional_params, post_data);
}
if (services.includes("ga")) {
this.recordActionGA(category, action, id, user, timestamp, additional_params, post_data);
}
},

recordActionLog: function(id, category, action, user, type, timestamp, additional_params, post_data) {
timestamp = (typeof timestamp !== 'undefined') ? (escape(timestamp)) : ("");
additional_params = (typeof additional_params !== 'undefined') ? ('&' + additional_params) : ("");
if(typeof post_data !== 'undefined') {
post_data = {post_data:post_data};
} else {
post_data = {};
}

let php_script = config.server_url + "services/writeActionToLog.php";

$.ajax({
url: php_script +
'?user=' + user +
'&category=' + category +
'&action=' + action +
'&item=' + encodeURI(id) +
'&type=' + type +
'&item_timestamp=' + timestamp + additional_params + '&jsoncallback=?',
type: "POST",
data: post_data,
dataType: "json",
success: function(output) {
console.log(output);
}
});
},

recordActionGA: function(category, action, id) {
//gtag.js
if(typeof gtag === "function") {
gtag('event', action, {
'event_category': category,
'event_label': id
});
//analytics.js
} else if (typeof ga === "function") {
ga('send', 'event', category, action, id);
}
},

markProjectChanged: function (id) {

let php_script = config.server_url + "services/markProjectChanged.php";
Expand Down
Loading

0 comments on commit 09c5da4

Please sign in to comment.