Skip to content

Commit bf656b2

Browse files
authored
Merge pull request #194 from netcreateorg/dev-bl/toml
TOML Template Editor
2 parents e901c43 + baa5a49 commit bf656b2

22 files changed

Lines changed: 2045 additions & 345 deletions

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ The Wiki has [detailed instructions](https://github.com/netcreateorg/netcreate-2
1717

1818
This will get NetCreate installed and ready to run. It may take some time for the `npm ci` command to finish installing, so be patient!
1919

20+
The first time you run Net.Create, you also need to create a `net-create.config` file. This will tell Net.Create which dataset to open and which ports to use. We have a script that can do this for you. Run:
21+
* `./nc.js --dataset=demo` -- where `demo` will be the name of the dataset you want to use.
22+
2023
## QUICK OPERATION GUIDE
2124

2225
Once you have NetCreate installed, make sure you are in the `netcreate-2018/build` directory. From there, you can execute **scripts** through the `npm` tool that is installed as part of NodeJS.

build/app/assets/templates/_default.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"_cmt4": "//updated is included in the edge tables if in admin mode, and in the graph tooltip if indicated here. Probably those should be more consistent."
114114
},
115115
"delete": {
116+
"_cmt5": "// Only admins see the delete button. This hides delete button even for admins.",
116117
"type": "hidden",
117118
"hidden": false
118119
}
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name = "Untitled"
2+
description = "Default empty template"
3+
requireLogin = false
4+
hideDeleteNodeButton = false
5+
duplicateWarning = "You’re entering a duplicate node. Do you want to View the Existing node, or Continue creating?"
6+
nodeIsLockedMessage = "This node is currently being edited by someone else, please try again later."
7+
edgeIsLockedMessage = "This edge is currently being edited by someone else, please try again later."
8+
nodeDefaultTransparency = 1.0
9+
edgeDefaultTransparency = 0.3
10+
searchColor = "#FFFF00"
11+
sourceColor = "#FFa500"
12+
13+
[citation]
14+
text = "No citation set"
15+
hidden = false
16+
17+
[nodeDefs.id]
18+
type = "number"
19+
displayLabel = "id"
20+
exportLabel = "ID"
21+
help = "System-generated unique id number"
22+
23+
[nodeDefs.label]
24+
type = "string"
25+
displayLabel = "label"
26+
exportLabel = "Label"
27+
help = "Display name of the node"
28+
includeInGraphTooltip = true
29+
30+
[nodeDefs.type]
31+
type = "select"
32+
displayLabel = "Type"
33+
exportLabel = "Type"
34+
help = "Multiple people are a 'Group'"
35+
includeInGraphTooltip = true
36+
hidden = false
37+
38+
[[nodeDefs.type.options]]
39+
label = ""
40+
color = "#eeeeee"
41+
42+
[[nodeDefs.type.options]]
43+
label = "Person"
44+
color = "#00fbff"
45+
46+
[[nodeDefs.type.options]]
47+
label = "Group"
48+
color = "#3399ff"
49+
50+
[[nodeDefs.type.options]]
51+
label = "Place"
52+
color = "#00ff00"
53+
54+
[[nodeDefs.type.options]]
55+
label = "Thing"
56+
color = "#009999"
57+
58+
[[nodeDefs.type.options]]
59+
label = "Event"
60+
color = "#ff0000"
61+
62+
[nodeDefs.notes]
63+
type = "string"
64+
displayLabel = "Significance"
65+
exportLabel = "Notes"
66+
help = "Add some details"
67+
includeInGraphTooltip = true
68+
hidden = false
69+
70+
[nodeDefs.info]
71+
type = "number"
72+
displayLabel = "Number"
73+
exportLabel = "Info"
74+
help = "Some number comparison"
75+
includeInGraphTooltip = true
76+
hidden = false
77+
78+
[nodeDefs.degrees]
79+
type = "number"
80+
displayLabel = "Degrees"
81+
exportLabel = "Degrees"
82+
help = "Number of edges"
83+
includeInGraphTooltip = true
84+
hidden = false
85+
86+
[nodeDefs.created]
87+
type = "string"
88+
displayLabel = "Created"
89+
exportLabel = "Created"
90+
help = "Date and time node was created"
91+
includeInGraphTooltip = true
92+
hidden = false
93+
94+
[nodeDefs.updated]
95+
type = "string"
96+
displayLabel = "Last Updated"
97+
exportLabel = "Last Updated"
98+
help = "Date and time node was last modified"
99+
includeInGraphTooltip = true
100+
hidden = false
101+
102+
[edgeDefs.id]
103+
type = "number"
104+
displayLabel = "id"
105+
exportLabel = "ID"
106+
help = "System-generated unique id number"
107+
108+
[edgeDefs.source]
109+
type = "node"
110+
displayLabel = "Source"
111+
exportLabel = "Source"
112+
help = ""
113+
hidden = false
114+
115+
[edgeDefs.target]
116+
type = "node"
117+
displayLabel = "Target"
118+
exportLabel = "Target"
119+
help = ""
120+
hidden = false
121+
122+
[edgeDefs.type]
123+
type = "select"
124+
displayLabel = "Type"
125+
exportLabel = "Type"
126+
help = ""
127+
hidden = false
128+
129+
[[edgeDefs.type.options]]
130+
label = ""
131+
color = "#c2c2c2"
132+
133+
[[edgeDefs.type.options]]
134+
label = "you've got, a \"friend\""
135+
color = "#0dbd00"
136+
137+
[[edgeDefs.type.options]]
138+
label = "has unfriendly interaction with"
139+
color = "#ff0000"
140+
141+
[[edgeDefs.type.options]]
142+
label = "is a member of"
143+
color = "#9ebeff"
144+
145+
[[edgeDefs.type.options]]
146+
label = "visits"
147+
color = "#ffae00"
148+
149+
[edgeDefs.notes]
150+
type = "string"
151+
displayLabel = "Significatnce"
152+
exportLabel = "Significatnce"
153+
help = ""
154+
hidden = false
155+
156+
[edgeDefs.info]
157+
type = "number"
158+
displayLabel = "Date"
159+
exportLabel = "Date"
160+
help = "'YYYY-MM-DD' format"
161+
hidden = false
162+
163+
[edgeDefs.citation]
164+
type = "string"
165+
displayLabel = "Citation"
166+
exportLabel = "Citation"
167+
help = "Source Book.Chapter (Part 2 06.03)"
168+
hidden = false
169+
170+
[edgeDefs.category]
171+
type = "string"
172+
displayLabel = "Category"
173+
exportLabel = "Category"
174+
help = "Category?"
175+
hidden = false

build/app/settings.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ let RELOAD_TIMER = null;
6363
/*/ MOD.CurrentTime = () => {
6464
return DATE.toDateString();
6565
};
66+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
67+
/*/
68+
/*/ MOD.IsAdmin = () => {
69+
return (MOD.EJSProp('client').ip === '127.0.0.1') ||
70+
location.href.includes('admin=true');
71+
}
6672

6773
/// SERVER-PROVIDED PROPERTIES ////////////////////////////////////////////////
6874
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

build/app/system/datastore.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,26 @@ DSTOR.PromiseJSONFile = function(jsonFile) {
156156
/*/
157157
DSTOR.PromiseD3Data = function() {
158158
// UDATA.Call() returns a promise
159-
return UDATA.Call("SRV_DBGET", {});
159+
return UDATA.Call("SRV_DBGET", {}); // server.js
160160
};
161161
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
162+
/*/ API: Write Template file to Server
163+
/*/
164+
DSTOR.SaveTemplateFile = template => {
165+
// UDATA.Call() returns a promise
166+
return UDATA.Call("SRV_TEMPLATESAVE", {template}); // server.js
167+
};
168+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
169+
/*/ API: Get Template File Path.
170+
Called by template-logic when downloading template file.
171+
/*/
172+
DSTOR.GetTemplateTOMLFileName = () => {
173+
return UDATA.Call("SRV_GET_TEMPLATETOML_FILENAME");
174+
}
175+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
162176
/*/ API: (WIP) write database from d3data-formatted object
163177
/*/
164-
DSTOR.OverwriteDataPromise = function(d3data) {
178+
DSTOR.OverwriteDataPromise = function (d3data) {
165179
return new Promise((resolve, reject) => {
166180
UDATA.Call("SRV_DBSET", d3data).then(res => {
167181
if (res.OK) {

0 commit comments

Comments
 (0)