Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
63c1be3
export: Fix node header key typo. `Notes` header was not being expor…
benloh Jan 19, 2022
ebac845
toml: Document `delete` functionality in default template.
benloh Jan 24, 2022
69a181e
toml: Add `IsAdmin` to settings so NodeSelector and More can use it t…
benloh Jan 24, 2022
3fd6308
toml: Add Template, template-logic, and show on More panel.
benloh Jan 24, 2022
3a3c674
toml: Only show Template editor for admins.
benloh Jan 24, 2022
acf70fc
toml: Add json-editor.
benloh Jan 24, 2022
07a9dd8
toml: Add TOML file support.
benloh Jan 24, 2022
b94776a
toml: Lint/doc.
benloh Jan 24, 2022
db5f2ba
toml: Pull out LoadTemplate as its own function so it can be re-used.
benloh Jan 24, 2022
9b030b2
toml: Load TOML template.
benloh Jan 24, 2022
1b9ed38
toml: Save TOML template file to disk.
benloh Jan 24, 2022
f443d2a
toml: Note WriteTemplateJSON is now deprecated.
benloh Jan 24, 2022
c4af672
toml: Lint.
benloh Jan 24, 2022
7c4b7b0
toml: Lint/doc.
benloh Jan 24, 2022
ba88459
toml: Validate toml template. Convert from JSON.
benloh Jan 24, 2022
fb3c4ed
toml: Convert JSON template fields to updated TOML fields.
benloh Jan 24, 2022
af27e9f
toml: Validate TOML file when importing file. (Does not check fields…
benloh Jan 24, 2022
2ebb03c
toml: Convert JSON to TOML in Filters. Also fix bug where default tr…
benloh Jan 24, 2022
6bf9154
toml: Fall back to and migrate JSON template if available if no TOML …
benloh Jan 25, 2022
9557072
toml: lint/doc
benloh Jan 25, 2022
32a02c8
toml: Update TEMPLATE value in nc-logic if AppState changed.
benloh Jan 25, 2022
fa621b2
toml: Return curren template when EDIT_CURRENT_TEMPLATE is received.
benloh Jan 25, 2022
55a30cd
toml: Update descriptions for `exportLabel`. Clarify that it's for a…
benloh Jan 25, 2022
89202f8
toml: lint/doc
benloh Jan 25, 2022
3bde1e0
toml: Remove deprecated fields during migration.
benloh Jan 25, 2022
64667a0
toml: Add `category` to edge schema.
benloh Jan 25, 2022
4d54c1d
toml: Add `id` to node/edge import AFTER importing fields to overwrit…
benloh Jan 25, 2022
ae3fd33
toml: Simplify node type options by removing `id`. It was not used a…
benloh Jan 25, 2022
0b54555
toml: Add `_default.template.toml`
benloh Jan 25, 2022
32ee3e6
toml: Set default template and schema nodeDefaultTransparency to 1.0.
benloh Jan 25, 2022
4c12524
toml: Disallow hiding id, label, source, and target fields.
benloh Jan 25, 2022
de7140d
toml: Add `searchColor` and `sourceColor` to template.
benloh Jan 25, 2022
f2245d9
toml: Flesh out 'created' and 'updated' fields. Remove bad options.
benloh Jan 25, 2022
87624a5
toml: Remove second template load after JSON conversion.
benloh Jan 26, 2022
06b5c69
toml: lint
benloh Jan 26, 2022
4055d5d
toml: Update editor options to allow users to add missing properties …
benloh Jan 26, 2022
f4cf266
toml: lint/doc
benloh Jan 26, 2022
b933604
toml: Add note to readme to run `./nc.js` on first run to create `net…
benloh Jan 26, 2022
e01151f
toml: Default template should not require login.
benloh Jan 26, 2022
4601151
toml: lint
benloh Jan 27, 2022
baa5a49
toml: Disable Template when Node / Edge being edited and vice versa.
benloh Jan 27, 2022
065e7b8
flatten: Migrate old attribute data to flattened node/edge object pro…
benloh Jan 27, 2022
51ede11
flatten: Graph flattened data.
benloh Jan 27, 2022
fe7a789
flatten: Display flattened nodes
benloh Jan 27, 2022
4b877ad
flatten: Display flattened edge data
benloh Jan 27, 2022
910b77b
flatten: Display flattened Node Table data.
benloh Jan 27, 2022
e47999b
flatten: Display flattened Edge Table data
benloh Jan 27, 2022
7f86465
flatten: lint/doc
benloh Jan 27, 2022
7facf0f
flatten: Remove deprecated flattening maps for filters.
benloh Jan 27, 2022
f1c0e57
flatten: Use TEMPLATE settings for export. Deprecate attributes call…
benloh Jan 27, 2022
da520dc
flatten: Fix JSONtoTOML migration: auto-set 'type' nodeDef and edgeDe…
benloh Jan 28, 2022
02699bc
flatten: Fix default template label defautls.
benloh Jan 28, 2022
7a45819
flatten: Fix filters to use flattened object key references (removed …
benloh Jan 28, 2022
08a914c
toml: Add description, examples, for Template Name
benloh Jan 28, 2022
a34e319
toml: Make 'hideDeleteNodeButton` a checkbox.
benloh Jan 28, 2022
f29cb5f
typeedit: lint
benloh Feb 1, 2022
0f6678e
typeedit: Move template schema out of template-logic.
benloh Feb 1, 2022
940a24b
typeedit: Add UI to rename or delete node/edge type option label, inc…
benloh Feb 1, 2022
2483eb5
typeedit: Remove debug statements.
benloh Feb 1, 2022
82aa79c
typeedit: Split node and edge colormaps into separate objects. Addre…
benloh Feb 2, 2022
9032f6a
typeedit: Add doc note to client-state noting unexpted behavior of Se…
benloh Feb 3, 2022
b2d1807
typeedit: Lock out template/node/edge editing on network. Prevent ot…
benloh Feb 8, 2022
48e4748
typeedit: Add command line method to unlock template.
benloh Feb 8, 2022
2512b30
teypedit: Add warning message about editing templates only if you're …
benloh Feb 8, 2022
f4fe7a7
typeedit: doc
benloh Feb 8, 2022
10b0f56
typeedit: Don't show 'disabled' message if you're the one doing the t…
benloh Feb 8, 2022
99e3f7d
typeedit: Convert template-schema to non-UNISYS module so it can be l…
benloh Feb 8, 2022
997192d
typeedit: Add 'templateIsLocked' message to schema.
benloh Feb 8, 2022
c48aee5
typeedit: Load key system messages from schema if not defined in load…
benloh Feb 8, 2022
562f623
typeedit: Fall back to default schema definitions if TOML file does n…
benloh Feb 8, 2022
8a3f904
typeedit: Doc
benloh Feb 8, 2022
9ec5765
typeedit: Add NodeSelector.css
benloh Feb 8, 2022
658c049
typeedit: Show template is locked message on Node and Edge editors.
benloh Feb 8, 2022
7e5df48
typeedit: Simplify NodeSelector state references.
benloh Feb 8, 2022
8d95f0c
typeedit: Add support for standalone files generation with TOML templ…
benloh Feb 9, 2022
28c400f
typeedit: Hide "Edit" buttons if standalone.
benloh Feb 9, 2022
c13ccca
typeedit: Inject recommendation to use "Edit Node Types" and "Edit Ed…
benloh Feb 9, 2022
eaf8c1f
typeedit: Only show "Recomend Node Type Options" editor message when …
benloh Feb 11, 2022
d1f1288
typeedit: Force legend key to update when template updates.
benloh Feb 11, 2022
059d4fa
typeedit: Handle network-initated update of TEMPLATE appstate.
benloh Feb 14, 2022
5cd1004
typeedit: Check for valid source/target before converting source/targ…
benloh Feb 14, 2022
6d5d5ff
typeedit: After "Add Row", disable "Label" so the new entry uses "Cha…
benloh Feb 14, 2022
388243e
typeedit: lint/doc
benloh Feb 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ The Wiki has [detailed instructions](https://github.com/netcreateorg/netcreate-2

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!

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:
* `./nc.js --dataset=demo` -- where `demo` will be the name of the dataset you want to use.

## QUICK OPERATION GUIDE

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.
Expand Down
1 change: 1 addition & 0 deletions build/app/assets/templates/_default.template
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"_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."
},
"delete": {
"_cmt5": "// Only admins see the delete button. This hides delete button even for admins.",
"type": "hidden",
"hidden": false
}
Expand Down
175 changes: 175 additions & 0 deletions build/app/assets/templates/_default.template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name = "Untitled"
description = "Default empty template"
requireLogin = false
hideDeleteNodeButton = false
duplicateWarning = "You’re entering a duplicate node. Do you want to View the Existing node, or Continue creating?"
nodeIsLockedMessage = "This node is currently being edited by someone else, please try again later."
edgeIsLockedMessage = "This edge is currently being edited by someone else, please try again later."
nodeDefaultTransparency = 1.0
edgeDefaultTransparency = 0.3
searchColor = "#FFFF00"
sourceColor = "#FFa500"

[citation]
text = "No citation set"
hidden = false

[nodeDefs.id]
type = "number"
displayLabel = "Id"
exportLabel = "ID"
help = "System-generated unique id number"

[nodeDefs.label]
type = "string"
displayLabel = "Label"
exportLabel = "Label"
help = "Display name of the node"
includeInGraphTooltip = true

[nodeDefs.type]
type = "select"
displayLabel = "Type"
exportLabel = "Type"
help = "Multiple people are a 'Group'"
includeInGraphTooltip = true
hidden = false

[[nodeDefs.type.options]]
label = ""
color = "#eeeeee"

[[nodeDefs.type.options]]
label = "Person"
color = "#00fbff"

[[nodeDefs.type.options]]
label = "Group"
color = "#3399ff"

[[nodeDefs.type.options]]
label = "Place"
color = "#00ff00"

[[nodeDefs.type.options]]
label = "Thing"
color = "#009999"

[[nodeDefs.type.options]]
label = "Event"
color = "#ff0000"

[nodeDefs.notes]
type = "string"
displayLabel = "Significance"
exportLabel = "Notes"
help = "Add some details"
includeInGraphTooltip = true
hidden = false

[nodeDefs.info]
type = "number"
displayLabel = "Number"
exportLabel = "Info"
help = "Some number comparison"
includeInGraphTooltip = true
hidden = false

[nodeDefs.degrees]
type = "number"
displayLabel = "Degrees"
exportLabel = "Degrees"
help = "Number of edges"
includeInGraphTooltip = true
hidden = false

[nodeDefs.created]
type = "string"
displayLabel = "Created"
exportLabel = "Created"
help = "Date and time node was created"
includeInGraphTooltip = true
hidden = false

[nodeDefs.updated]
type = "string"
displayLabel = "Last Updated"
exportLabel = "Last Updated"
help = "Date and time node was last modified"
includeInGraphTooltip = true
hidden = false

[edgeDefs.id]
type = "number"
displayLabel = "Id"
exportLabel = "ID"
help = "System-generated unique id number"

[edgeDefs.source]
type = "node"
displayLabel = "Source"
exportLabel = "Source"
help = ""
hidden = false

[edgeDefs.target]
type = "node"
displayLabel = "Target"
exportLabel = "Target"
help = ""
hidden = false

[edgeDefs.type]
type = "select"
displayLabel = "Type"
exportLabel = "Type"
help = ""
hidden = false

[[edgeDefs.type.options]]
label = ""
color = "#c2c2c2"

[[edgeDefs.type.options]]
label = "you've got, a \"friend\""
color = "#0dbd00"

[[edgeDefs.type.options]]
label = "has unfriendly interaction with"
color = "#ff0000"

[[edgeDefs.type.options]]
label = "is a member of"
color = "#9ebeff"

[[edgeDefs.type.options]]
label = "visits"
color = "#ffae00"

[edgeDefs.notes]
type = "string"
displayLabel = "Significatnce"
exportLabel = "Significatnce"
help = ""
hidden = false

[edgeDefs.info]
type = "number"
displayLabel = "Date"
exportLabel = "Date"
help = "'YYYY-MM-DD' format"
hidden = false

[edgeDefs.citation]
type = "string"
displayLabel = "Citation"
exportLabel = "Citation"
help = "Source Book.Chapter (Part 2 06.03)"
hidden = false

[edgeDefs.category]
type = "string"
displayLabel = "Category"
exportLabel = "Category"
help = "Category?"
hidden = false
6 changes: 6 additions & 0 deletions build/app/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ let RELOAD_TIMER = null;
/*/ MOD.CurrentTime = () => {
return DATE.toDateString();
};
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/
/*/ MOD.IsAdmin = () => {
return (MOD.EJSProp('client').ip === '127.0.0.1') ||
location.href.includes('admin=true');
}

/// SERVER-PROVIDED PROPERTIES ////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
64 changes: 62 additions & 2 deletions build/app/system/datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const DBG = { load: true };

/// SYSTEM LIBRARIES //////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const TOML = require("@iarna/toml");
const SETTINGS = require("settings");
const SESSION = require("unisys/common-session");
const UNISYS = require("unisys/client");
Expand All @@ -34,7 +35,14 @@ let D3DATA = {};
/*/ establish message handlers during INITIALIZE phase
/*/
DSTOR.Hook("INITIALIZE", () => {
// DBUPDATE_ALL is a local call originating from within the app
// Used to update the full D3DATA object during template updates
UDATA.HandleMessage("DBUPDATE_ALL", function(data) {
DSTOR.UpdateDataPromise(data);
});

// DB_UPDATE is a local call originating from within the app
// Generally used to update individual nodes and edges
UDATA.HandleMessage("DB_UPDATE", function(data) {
DSTOR.UpdateServerDB(data);
});
Expand Down Expand Up @@ -152,16 +160,68 @@ DSTOR.PromiseJSONFile = function(jsonFile) {
return promise;
};
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ API: Load default data set from a TOML file in /assets/data
/*/
DSTOR.PromiseTOMLFile = function (tomlFile) {
if (typeof tomlFile !== "string") {
throw new Error("pass arg <filename_in_assets/data>");
}
let promise = new Promise((resolve, reject) => {
let xobj = new XMLHttpRequest();
xobj.addEventListener("load", event => {
if (event.target.status === 404) {
reject(new Error(`file not found`));
return;
}
const data = event.target.responseText;
const tomlData = Object.assign(D3DATA, TOML.parse(data));
resolve(tomlData);
});
xobj.open("GET", `${tomlFile}`, true);
xobj.send();
});
return promise;
};
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ API: Load D3 Database
/*/
DSTOR.PromiseD3Data = function() {
// UDATA.Call() returns a promise
return UDATA.Call("SRV_DBGET", {});
return UDATA.Call("SRV_DBGET", {}); // server.js
};
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ API: Write Template file to Server
/*/
DSTOR.SaveTemplateFile = template => {
// UDATA.Call() returns a promise
return UDATA.Call("SRV_TEMPLATESAVE", {template}); // server.js
};
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ API: Get Template File Path.
Called by template-logic when downloading template file.
/*/
DSTOR.GetTemplateTOMLFileName = () => {
return UDATA.Call("SRV_GET_TEMPLATETOML_FILENAME");
}
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ API: Update database from d3data-formatted object
/*/
DSTOR.UpdateDataPromise = function (d3data) {
return new Promise((resolve, reject) => {
UDATA.Call("SRV_DBUPDATE_ALL", d3data).then(res => {
if (res.OK) {
console.log(PR, `database update OK`);
resolve(res);
} else {
reject(new Error(JSON.stringify(res)));
}
});
});
};
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*/ API: (WIP) write database from d3data-formatted object
/*/
DSTOR.OverwriteDataPromise = function(d3data) {
DSTOR.OverwriteDataPromise = function (d3data) {
return new Promise((resolve, reject) => {
UDATA.Call("SRV_DBSET", d3data).then(res => {
if (res.OK) {
Expand Down
5 changes: 5 additions & 0 deletions build/app/unisys/client-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ var STATES_LISTEN = new Map(); // namespace str => emitter
if (!namespace) throw Error(BAD_NSPACE);
// update old state by partially overwrite of state
if (!STATES.has(namespace)) STATES.set(namespace,{});
// NOTE Because we're using Object.assign:
// * Objects already in the state will remain in the state
// if not overwritten by newState. This can result in
// the mysterious re-appearance of old paramters.
// * No deep clones
Object.assign(STATES.get(namespace),newState);
// forward new state to namespace listeners
let msgr = m_GetStateMessager(namespace);
Expand Down
Loading