Skip to content

Commit b57b12b

Browse files
Do not refresh graph if settings weren't changed
1 parent d2de2f2 commit b57b12b

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Usage
2929
Development
3030
-----------
3131

32-
Requires [Node.JS](https://nodejs.org) (v0.10.0-6.2.2+),
32+
Requires [Node.JS](https://nodejs.org) (v4.0.0-7.5.0+) (but may work on previous versions),
3333
[Git](https://git-scm.com) and
3434
[Caché](http://www.intersystems.com/library/software-downloads/) 2017.1+
3535
to be installed.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iknow-entity-browser",
3-
"version": "0.6.2",
3+
"version": "0.6.3",
44
"description": "Visualizer for iKnow entities",
55
"main": "gulpfile.babel.js",
66
"scripts": {

src/static/js/settings/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as model from "../model";
22
import * as graph from "../graph";
3+
import { getChanges, applyChanges } from "../source";
34

45
function toggleSettings (uiStateModel) {
56
uiStateModel.settingsToggled = !uiStateModel.settingsToggled;
67
d3.select("#settings").classed("active", uiStateModel.settingsToggled);
78
d3.select("#windows").classed("offScreen", uiStateModel.settingsToggled);
8-
if (!uiStateModel.settingsToggled) {
9+
if (!uiStateModel.settingsToggled && getChanges().length !== 0) {
10+
applyChanges();
911
model.update(() => graph.update(true));
1012
}
1113
}

src/static/js/source/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ let settings = { // assign defaults here
1111
queryType: "related",
1212
seed: "crew"
1313
};
14+
let changes = [];
1415

1516
let initialStorage = storage.load(STORAGE_KEY);
1617
for (let option in initialStorage) {
1718
settings[option] = initialStorage[option];
1819
}
1920

21+
/**
22+
* This function "applies" settings so that getChanges() will return empty array until
23+
*/
24+
export function applyChanges () {
25+
changes = [];
26+
}
27+
28+
/**
29+
* @returns {string[]} of changed keys.
30+
*/
31+
export function getChanges () {
32+
return changes;
33+
}
34+
2035
export function getOption (opt) {
2136
return settings[opt];
2237
}
@@ -63,7 +78,7 @@ function setValue (e = {}) {
6378
if ((id = el.getAttribute(`id`)).indexOf(`settings.`) === 0) {
6479
let key = id.replace(/^settings\./, ``);
6580
if (isEvent) {
66-
settings[key] = el.value;
81+
changes.push(settings[key] = el.value);
6782
saveSettings();
6883
} else {
6984
el.value = settings[key];

0 commit comments

Comments
 (0)