Option to choose the colour of the node in Ratel


(Eshwar) #1

Hi team,

Is there a way to choose the colour of the node while displaying in Ratel dashboard?
I guess the best way to do it might be based on an attribute of the node itself.

Thanks,
Eshwar


(Paul Korzhyk) #2

Not possible currently.

If you share your specific use case it’ll help plan the feature at some point.

I think we should definitely support this, but there are quite a few details that need to be answered, in order to make colors powerful enough. It also seems to be a feature for power users only.

Using a node attribute is a nice approach, I’ve tried something similar for the TodoMVC, but raises two questions: what if a node doesn’t have that attribute? What if attribute value isn’t an RGB color value? it’s impossible to write a query that converts number to string.


(Eshwar) #3

Hi @paulftw,

  1. I think we can fallback to the present approach if the attribute defining colour is not present in node.
  2. We can store the colour in Hex Codes instead of RGB. If its invalid, again fall back to the present approach.

What do you say?

Thanks,
Eshwar


(Eshwar) #4

Hi,

I thought of trying it on my own, but then I’m facing issues while building the ratel project.
Below are the error logs:

ratel-client@0.0.1 build:prod /data/ratel-play/ratel/client
node scripts/build.prod.js

/data/ratel-play/ratel/client/scripts/build.prod.js:60
({ stats, previousFileSizes, warnings }) => {
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions…js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

Any help is appreciated!

Thanks,
Eshwar


(Eshwar) #5

Hi @paulftw,

Can you please suggest how to go about this?

Thanks,
Eshwar


(Paul Korzhyk) #6

That error is usually thrown when JS interpreter doesn’t support lambda functions.
Have you tried upgrading your nodejs?

What is the output of node --version on your machine?


(Eshwar) #7

Hi @paulftw,

Thanks for the reply. I upgraded the node version.

$ node --version
v11.14.0

I get the below error now. I’m new to node, let me know if I’m missing something.
I just cloned the ratel repo and ran the build.prod.sh script.

(node:21143) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Failed to compile.

./src/assets/css/App.scss
Error: ENOENT: no such file or directory, scandir '/data/ratel-play/ratel/client/node_modules/node-sass/vendor'
 @ ./src/containers/App.js 8:761-792
 @ ./src/index.js
 @ multi ./node_modules/@babel/polyfill/lib/index.js ./config/polyfills.js ./src/index.js


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ratel-client@0.0.1 build:prod: `node scripts/build.prod.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ratel-client@0.0.1 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Thanks,
Eshwar


(Paul Korzhyk) #8

Can you try the following commands in the ratel folder:

cd client/
rm -rf node_modules/
yarn install
yarn start

this should start a development server and open http://localhost:3000/ in your browser.