ryantxu / ajax-panel

Ajax Panel Plugin for Grafana
MIT License
153 stars 154 forks source link

rsp.headers is not a function ERROR #66

Open vinilima07 opened 4 years ago

vinilima07 commented 4 years ago

My grafana version is 6.7.0 My ajax plugin is the latest. I am trying to use the plugin and i am getting the error in dev tools console after call a post request, the request is sent normally and the response is get normally to.

image

This is making the ajax plugin to not render the message that is sent on response but after i click in grafana refresh button the previous message is rendered.

amotl commented 4 years ago

Dear Vinicius,

this is probably a duplicate of #60 and might have been fixed through #64 already. If you will be able to build this plugin for yourself, it might help you along.

With kind regards, Andreas.

vinilima07 commented 4 years ago

@amotl Thank you so much, so, until they merge the commit with master i did the same modifications in the file that the commit do, but i am having problem building the plugin: This is my error, any orientation will be very helpful. image

the error is showed up after i run: yarn build

amotl commented 4 years ago

Dear Vinicius,

I just tried and had no problems building the vanilla master using yarn install followed by yarn build.

The Prettier is sometimes a bit picky, so it might just be this guy complaining.

You might well want to directly clone https://github.com/BlackLight/ajax-panel. Thanks again for the fix, @BlackLight.

With kind regards, Andreas.

amotl commented 4 years ago

Indeed, after switching to @BlackLight's fork, I am also getting (different) errors:

  ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts
  [tsl] ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts(499,31)
        TS2554: Expected 1 arguments, but got 0.

  ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts
  [tsl] ERROR in /Users/amo/dev/panodata/sources/ajax-panel/src/module.ts(507,18)
        TS2349: This expression is not callable.
    Type 'typeof import("/Users/amo/dev/panodata/sources/ajax-panel/node_modules/@grafana/data/index")' has no call signatures.
amotl commented 4 years ago

Dear Vinicius,

[1] fixes the build for me. However, I haven't tested it on a real Grafana instance.

With kind regards, Andreas.

[1] https://github.com/panodata/ajax-panel/tree/fixfixfix

vinilima07 commented 4 years ago

Dear @amotl , I tried to use BlackLigh solution, but for me this modifications only remove the 'type function error'. So i made some modifications based on this https://github.com/ryantxu/ajax-panel/issues/60#issuecomment-626465545 This modifications was a solution to Panel refresh problem, now when he receive the response from server he is refreshed, it wasn't happening before. I will post my solution and make a pull request as soon as i can.

Again, thank you very much!

vinilima07 commented 4 years ago

I made a solution for this issue and two other issues i think! https://github.com/ryantxu/ajax-panel/issues/60#issue-591703784 https://github.com/ryantxu/ajax-panel/issues/65#issue-628320015 my repo: https://github.com/viniciusfdev/ajax-panel.git

@robertpascale i think this will help you!

robertpascale commented 4 years ago

Hi @viniciusfdev , That's great - but I'm not sure how I can use your patch. I currently run grafana in a docker container on a NAS box, and I just add the plugin via the docker environment variable as follows: GF_INSTALL_PLUGINS=ryantxu-ajax-panel I don't have any way of compiling my own and even if I did, I'm not sure how I would embed it in the docker container. Hopefully @ryantxu may action the pull request and roll it in to the next production release.

vinilima07 commented 4 years ago

Dear @robertpascale, I'm also running grafana on the docker, if you really need this fix as early as I do, just clone my repository, install all the dependencies needed to create the grafana plugin like @ grafana / tools and yarn, run 'yarn install' and 'yarn build ', doing this, a folder called' dist 'will appear, the' dist 'folder is used by grafana to create a plugin, so you need to put this' dist' folder inside another folder as' ajax-plugin 'and put inside the directory / data / plugis in the grafana container (with docker cp or using volumes).

kavdev commented 3 years ago

running into this with grafana 7.1.1