Skip to content

Commit 9806062

Browse files
Big commit: tabular view improvements, custom editable table columns, settings refactoring
1 parent b57b12b commit 9806062

21 files changed

+401
-165
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.6.3",
3+
"version": "0.7.0",
44
"description": "Visualizer for iKnow entities",
55
"main": "gulpfile.babel.js",
66
"scripts": {
156 Bytes
Binary file not shown.

src/static/fonts/iknowentitybrowsericons.svg

Lines changed: 2 additions & 0 deletions
Loading
156 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.

src/static/index.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,7 @@
8888
<div class="wrapper">
8989
<table id="tabular">
9090
<thead>
91-
<tr>
92-
<th data-prop="id">ID</th>
93-
<th data-prop="label">Label</th>
94-
<th data-prop="entities.0.score">Score</th>
95-
<th data-prop="entities.0.frequency">Frequency</th>
96-
<th data-prop="entities.0.spread">Spread</th>
97-
<th data-prop="edgeType">Relation</th>
98-
<th data-prop="parent.label">Parent</th>
99-
<th></th>
100-
</tr>
91+
<tr></tr>
10192
</thead>
10293
<tbody id="tabular-selected">
10394

@@ -126,6 +117,13 @@ <h1>General Settings</h1>
126117
/ <input autosize placeholder="seed string" id="settings.seed" type="text" value="crew"/>
127118
</div>
128119
</div>
120+
<h1>Tabular View Settings</h1>
121+
<div>
122+
<div>
123+
<b>Columns:</b>
124+
<span id="settings.tabularColumns"></span>
125+
</div>
126+
</div>
129127
</div>
130128
</div>
131129
</body>

src/static/js/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import * as graph from "./graph";
22
import * as tabular from "./tabular";
33
import * as settings from "./settings";
4-
import * as source from "./source";
54
import * as model from "./model";
65
import * as controls from "./controls";
76

87
window.init = () => {
98

109
tabular.init();
1110
settings.init();
12-
source.init();
1311
graph.init();
1412
controls.init();
1513
model.init();

src/static/js/model/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sampleData from "../sample_output2.json";
2-
import { getData, getOption } from "../source";
2+
import { getData } from "../source";
3+
import { getOption } from "../settings/values";
34
import { toggleLoader } from "../utils";
45
import * as history from "./history";
56

@@ -101,13 +102,14 @@ function preprocess (graph) {
101102
id: 0,
102103
label: getOption("seed"),
103104
type: "entity",
105+
edgeType: "root",
104106
entities: [{
105107
id: -1,
106108
value: getOption("seed"),
107-
[SIZE_CRITERIA]: 9999,
108109
score: 9999,
109110
spread: 0,
110-
frequency: 9999
111+
frequency: 9999,
112+
[SIZE_CRITERIA]: 9999
111113
}]
112114
});
113115
}

src/static/js/settings/index.js

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as model from "../model";
22
import * as graph from "../graph";
3-
import { getChanges, applyChanges } from "../source";
3+
import * as sourceSettings from "./sourceSettings";
4+
import * as tabularViewSettings from "./tabularViewSettings";
5+
import { getChanges, applyChanges } from "./values";
6+
import { makeAutosizable } from "../utils";
47

58
function toggleSettings (uiStateModel) {
69
uiStateModel.settingsToggled = !uiStateModel.settingsToggled;
@@ -23,29 +26,9 @@ export function init () {
2326
.on("click", toggleSettings);
2427

2528
// make inputs auto-sizable
26-
[].slice.call(document.querySelectorAll(`input[autosize]`)).forEach((input) => {
29+
[].slice.call(document.querySelectorAll(`input[autosize]`)).forEach((i) => makeAutosizable(i));
2730

28-
function updateInput () {
29-
let style = window.getComputedStyle(input),
30-
ghost = document.createElement(`span`);
31-
ghost.style.cssText = `box-sizing:content-box;display:inline-block;height:0;`
32-
+ `overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;`
33-
+ `font-family:${ style.fontFamily };font-size:${ style.fontSize };`
34-
+ `padding:${ style.padding }`;
35-
ghost.textContent = input.value;
36-
document.body.appendChild(ghost);
37-
input.style.width = ghost.offsetWidth + 4
38-
+ (input.getAttribute("type") === "number" ? 20 : 0) + "px";
39-
document.body.removeChild(ghost);
40-
}
41-
42-
input.style.minWidth = "30px";
43-
input.style.maxWidth = "90%";
44-
input.addEventListener(`input`, () => updateInput());
45-
updateInput();
46-
47-
return input;
48-
49-
});
31+
sourceSettings.init();
32+
tabularViewSettings.init();
5033

5134
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { setInputValue } from "./values.js";
2+
3+
function bind (elements) {
4+
for (let e of elements) {
5+
setInputValue(document.getElementById(e)).addEventListener(`change`, setInputValue);
6+
}
7+
}
8+
9+
export function init () {
10+
11+
bind([
12+
"settings.host",
13+
"settings.port",
14+
"settings.domain",
15+
"settings.queryType",
16+
"settings.seed",
17+
"settings.webAppName"
18+
]);
19+
20+
}

0 commit comments

Comments
 (0)