CDAT / vcs-js

3 stars 3 forks source link

Add template functions #55

Closed James-Crean closed 6 years ago

James-Crean commented 6 years ago

Fixes #50

This PR adds basic C.R.U.D. methods for vcs templates.

It does not deal with the issue of state permanency. Templates, like everything else, is reset if the user restarts the application. Since this is not an issue relating to just templates, a separate issue will need to be made to address this.

James-Crean commented 6 years ago

Thanks for the starter code! I read through the documentation in the README and it was very helpful. I noticed that I had to start the server manually before running the tests, such as:

vtkpython scripts/vcs-test-server.py &
npm run test

If I didnt the test suit would get stuck at waitOn is waiting for resource: "tcp:0.0.0.0:61234"


I wrote some tests for the functions I added. I can get karma to run the suit and the tests work and pass, but I am getting some odd webpack output. It claims to compile successfully, then complains that it failed to compile.

Output:

webpack: Compiled successfully.
webpack: Compiling...
Hash: f54565751b4ad0a3c2aa
Version: webpack 3.10.0
Time: 6099ms
        Asset     Size  Chunks                    Chunk Names
test/entry.js  10.4 MB       0  [emitted]  [big]  test/entry.js
  [31] ./src/RemoteRenderer.js 9.03 kB {0} [built]
  [32] ./node_modules/paraviewweb/src/Common/Misc/SizeHelper/index.js 2.15 kB {0} [built]
  [33] ./src/vtkweb/index.js 38.2 kB {0} [built]
  [34] ./src/plotly/index.js 10.4 kB {0} [built]
  [35] ./src/cdms/index.js 38.5 kB {0} [built]
  [37] ./src/config.js 855 bytes {0} [built]
  [63] ./src/plotly/isofill.js 6.25 kB {0} [built]
  [71] ./test/entry.js 229 bytes {0} [built]
  [72] ./test/cases .*\.js$ 195 bytes {0} [built]
  [73] ./test/cases/templates.js 2.64 kB {0} [optional] [built]
 [151] ./node_modules/ndarray-unpack/unpack.js 401 bytes {0} [built]
 [180] ./test/cases/vtkweb.js 5.79 kB {0} [optional] [built]
 [186] ./src .*\.js$ 317 bytes {0} [built]
 [187] ./src/file.js 3.92 kB {0} [optional] [built]
 [188] ./src/index.js 53 kB {0} [optional] [built]
    + 174 hidden modules

ERROR in ./node_modules/canvas-prebuilt/canvas/lib/bindings.js
Module not found: Error: Can't resolve '../build/Release/canvas' in '/Users/crean2/projects/vcs-js/node_modules/canvas-prebuilt/canvas/lib'
 @ ./node_modules/canvas-prebuilt/canvas/lib/bindings.js 3:17-51
 @ ./node_modules/canvas-prebuilt/canvas/lib/canvas.js
 @ ./node_modules/resemblejs/resemble.js
 @ ./test/util/TestUtils.js
 @ ./test/cases/templates.js
 @ ./test/cases .*\.js$
 @ ./test/entry.js

ERROR in ./node_modules/canvas-prebuilt/canvas/lib/canvas.js
Module not found: Error: Can't resolve 'fs' in '/Users/crean2/projects/vcs-js/node_modules/canvas-prebuilt/canvas/lib'
 @ ./node_modules/canvas-prebuilt/canvas/lib/canvas.js 22:9-22
 @ ./node_modules/resemblejs/resemble.js
 @ ./test/util/TestUtils.js
 @ ./test/cases/templates.js
 @ ./test/cases .*\.js$
 @ ./test/entry.js
webpack: Failed to compile.

Are either of these things specific to my setup or are they something you encounter as well?

scottwittenburg commented 6 years ago

@James-Crean those canvas-prebuilt issues appear on my machine and Travis as well, but don't seem to affect anything or cause tests to fail. I haven't dug into that issue otherwise.

As for having to start the server manually as you described, that is not expected. Simply npm run test should do the trick. Did you seem some error output like

Please provide path to uvcdat conda environment...

and giving instructions on what to do? Perhaps that was the issue.