Skip to content

Commit 42018e2

Browse files
Reset settings button add
1 parent 9806062 commit 42018e2

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

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.7.0",
3+
"version": "0.7.1",
44
"description": "Visualizer for iKnow entities",
55
"main": "gulpfile.babel.js",
66
"scripts": {

src/static/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ <h1>Tabular View Settings</h1>
124124
<span id="settings.tabularColumns"></span>
125125
</div>
126126
</div>
127+
<hr/>
128+
<div>
129+
<button id="settings.resetSettings">Reset Settings</button>
130+
</div>
127131
</div>
128132
</div>
129133
</body>

src/static/js/settings/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as model from "../model";
22
import * as graph from "../graph";
33
import * as sourceSettings from "./sourceSettings";
44
import * as tabularViewSettings from "./tabularViewSettings";
5+
import * as storage from "../storage";
56
import { getChanges, applyChanges } from "./values";
67
import { makeAutosizable } from "../utils";
78

@@ -27,6 +28,12 @@ export function init () {
2728

2829
// make inputs auto-sizable
2930
[].slice.call(document.querySelectorAll(`input[autosize]`)).forEach((i) => makeAutosizable(i));
31+
document.getElementById("settings.resetSettings").addEventListener("click", () => {
32+
if (!confirm("Do you want to set all the settings to defaults?"))
33+
return;
34+
storage.reset();
35+
location.reload();
36+
});
3037

3138
sourceSettings.init();
3239
tabularViewSettings.init();

src/static/js/storage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export function load (key) {
1010
return storage[key];
1111
}
1212

13+
export function reset () {
14+
localStorage.removeItem(STORAGE_NAME);
15+
}
16+
1317
function updateLocalStorage () {
1418
localStorage.setItem(STORAGE_NAME, JSON.stringify(storage));
1519
}

src/static/scss/basic.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ select {
5151

5252
}
5353

54+
input[type=button], button {
55+
56+
background-color: $colorA;
57+
color: white;
58+
text-shadow: 0 1px 1px black;
59+
border: 0;
60+
border-radius: 12px;
61+
padding: 5px;
62+
margin: 2px;
63+
cursor: pointer;
64+
transition: $defaultTransition;
65+
box-shadow: 0 1px 1px gray;
66+
67+
&:hover {
68+
color: $highlightColor;
69+
box-shadow: 0 2px 5px gray;
70+
}
71+
72+
}
73+
5474
.central {
5575

5676
position: absolute;

0 commit comments

Comments
 (0)