wuyuanyi135 / custom-plotly-panel

Simple Grafana panel with customizable Plotly.js plot
Apache License 2.0
0 stars 0 forks source link

Can't build #1

Open tobiasdirksen opened 4 years ago

tobiasdirksen commented 4 years ago

This is a great idea! However, I can't build it. I have yarn 1.22.4 on Ubuntu 18.04. I get this error. Any ideas?

yarn run v1.22.4
$ grafana-toolkit plugin:build
✔ Cleaning
✔ Preparing
⠙ Prettier check
  Fix Prettier issues in following files:
  /var/lib/grafana/plugins/custom-plotly-panel/src/editor.tsx
  /var/lib/grafana/plugins/custom-plotly-panel/src/panel.tsx

  Run toolkit:dev to fix errors
  Trace: Error: Prettier failed
      at /var/lib/grafana/plugins/custom-plotly-panel/node_modules/@grafana/toolkit/src/cli/tasks/plugin.build.js:129:31
      at step (/var/lib/grafana/plugins/custom-plotly-panel/node_modules/tslib/tslib.js:136:27)
      at Object.next (/var/lib/grafana/plugins/custom-plotly-panel/node_modules/tslib/tslib.js:117:57)
      at fulfilled (/var/lib/grafana/plugins/custom-plotly-panel/node_modules/tslib/tslib.js:107:62)
      at /var/lib/grafana/plugins/custom-plotly-panel/node_modules/@grafana/toolkit/src/cli/utils/useSpinner.js:24:29
      at step (/var/lib/grafana/plugins/custom-plotly-panel/node_modules/tslib/tslib.js:136:27)
      at Object.throw (/var/lib/grafana/plugins/custom-plotly-panel/node_modules/tslib/tslib.js:117:57)
      at rejected (/var/lib/grafana/plugins/custom-plotly-panel/node_modules/tslib/tslib.js:108:69)
✖ Prettier failed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
todi@grafana-dashboards:/var/lib/grafana/plugins/custom-plotly-panel$
wuyuanyi135 commented 4 years ago

Hi, sorry for the late response.

This issue was due to that I did not follow the prettier style guide back that time. I must have forgotten to test yarn build before tag the release :P. After installing the latest @grafana/toolkit I can see the issues:

  /content/custom-plotly-panel/src/panel.tsx
     6:1   error  'moment' import is restricted from being used  no-restricted-imports
    12:12  error  eval can be harmful                            no-eval

As a dirty fix, you can disable these errors. If you just want to test it you may run yarn dev instead so that the linting steps are skipped.

This project is basically a proof of concept and it needs further polishing. I encourage you to fork and update the dependencies and packages to make it more robust.

wuyuanyi135 commented 4 years ago

In addition, you can try downloading the distribution file in the release and see if it can work with your version of grafana.

tobiasdirksen commented 4 years ago

Thanks a lot. I couldn't get it to work in Grafana 7.0, but I will get back to you when I'm back from vacation.

tobiasdirksen commented 3 years ago

Sorry for late response. The distribution file works better since the default plot is there, but there is no customization options, where I can write my code. billede

wuyuanyi135 commented 3 years ago

@tobiasdirksen I did not use Grafana for long. This looks like a newer version. Usually when you insert a panel there should be some parameter configuration controls. I guess they are in the settings tab.

tobiasdirksen commented 3 years ago

Yes they changed the layout quite a lot in version 7. The code section should be to the right between visualization and links, so I'm afraid the plugin doesn't work in v7+.

wuyuanyi135 commented 3 years ago

Yes. I guess there will be some migration work to make it compatible with the latest version. I'm currently occupied with my work so I could not maintain this project. If you can refer to the latest plugin boilerplate and change the necessary sections.