HTTP-APIs / hydra-python-agent-gui

GUI for the hydra python agent
MIT License
20 stars 40 forks source link

Server URL input as a dropdown #9

Open Guttz opened 5 years ago

Guttz commented 5 years ago

Deploy hydrus servers and input them in the Server URL input as a dropdown so when the user launches the UI he can already try some online ready server. Similar to how we have one already deployed now.

thrishik7 commented 4 years ago

@Guttz Can we use database to store the URLs when they are deployed or hosted, and then fetch them in the client . Or is there any other approach to this?

Guttz commented 4 years ago

For now, as I think we have only 1, a simple array in the source code would be ok.. We can change it in the future if necessary.

Guttz commented 4 years ago

Maybe something important would be to have a checking function when the demo initializes so it actually checks if the servers are up, before showing to the user, as the servers might not always be available.

thrishik7 commented 4 years ago

okay @Guttz , so it's like having an array of urls harded coded and checking if it is hosted or not?

Haysam-Bin-Tahir commented 4 years ago

Greetings @Guttz . I am willing to work on this issue. I currently am facing an issue with running the development server of "hydra-python-agent-gui". I have read the installation guide and have set up both client and Hydrus server. However, I am getting a blank page on localhost:3000. I believe this is due to the following errors:

error-hydrus-update

The blank page appears because of the following variables being null in the render function of app.js:

render() {
    const { classes } = this.props;

    if(this.state.classes && this.state.apidocGraph.nodes ){    //both are null in the component's state
      return ( <template> );
    }

The root of the issue is when the request is made to hydra-docs and adidoc-graph and 404 error occurs. That's why both of the above variables are not being set

  componentDidMount() {
    axios.get(this.agentEndpoint + "/hydra-doc")
      .then(res => {

        this.setState({
          //for this.supportedClass > if @id="vocab:EntryPoint" then supportedProperty.property.labe
          classes: res.data.supportedClass,
          serverURL: res.data.serverURL.replace(/\/$/, "") + "/"
        }, () => this.render())
      });

      axios.get(this.agentEndpoint + "/apidoc-graph")
      .then(res => {
        this.setState({
          //for this.supportedClass > if @id="vocab:EntryPoint" then supportedProperty.property.labe
          apidocGraph: res.data
        }, () => this.render())
      });
  }

Could you please guide a bit about what might've went wrong?

I also tried to solve the matter by replacing this.agentEndpoint with "http://localhost:8080" because of the hydrus server running on 8080 port but it didn't change anything.

I tried by peeking into the hydra_doc_writer to create a new hydraDoc too but I think that wouldn't be necessary as sample hydrodoc is being used as default. The following output line by running hydrus serve gave me this thought:

No hydradoc specified, using sample hydradoc as default.

thrishik7 commented 4 years ago

@Haysam-Bin-Tahir , hello may I know how are you running the client , are you running app.py . and if you are using hydrus server then the entrypoint should be http://localhost:8080/serverapi

Haysam-Bin-Tahir commented 4 years ago

@Haysam-Bin-Tahir , hello may I know how are you running the client , are you running app.py . and if you are using hydrus server then the entrypoint should be http://localhost:8080/serverapi

I am currently running the app by "npm start" into the folder "console-frontend".

I also changed the entrypoint to "http://localhost:8080/serverapi" but that gave authentication error (401).

thrishik7 commented 4 years ago

@Haysam-Bin-Tahir okay instead running app through npm start, try running python app.py outside the console-frontend directory ,this will run static files which is build by react app, under port 3000.

thrishik7 commented 4 years ago

@Haysam-Bin-Tahir , hello may I know how are you running the client , are you running app.py . and if you are using hydrus server then the entrypoint should be http://localhost:8080/serverapi

I am currently running the app by "npm start" into the folder "console-frontend".

I also changed the entrypoint to "http://localhost:8080/serverapi" but that gave authentication error (401).

for authenication error instead running hydrus serve run hydrus serve --no-auth.

Haysam-Bin-Tahir commented 4 years ago

It resolved the authorization error but still, the resources( hydra-doc and apidoc-graph ) are not found and 404 error is being generated. Does redis_setup.sh have a role in it? Because that is the only file that is not being run currently due to a docker error of "docker daemon not running".

P.S. I am still running npm start to run the GUI because of app.py not running due to connection error with "/serverapi/vocab" and I tried so many times with method variations that now I get the following error on running python app.py:

raise-error

I understand this might be a problem with my setup because I don't see other users complaining about it. So, it is okay if you are not able to detect the problem with this; I won't be taking any more time of yours on this. It is just a last try to see if we can reach somewhere. Thanks for your patience and kindness.

Guttz commented 4 years ago

Hey @Haysam-Bin-Tahir, to run the GUI you need RedisGraph running, hydrus running and then run the gui(python app.py). I would suggest that for these errors you interact with the community through our slack channel: https://join.slack.com/t/hydraecosystem/shared_invite/zt-9eudw2gz-5SN92uyOhYDBnFQHAAx9nw Thanks!

Guttz commented 4 years ago

okay @Guttz , so it's like having an array of urls harded coded and checking if it is hosted or not?

Yes, I think that's a ok solution for now.

Haysam-Bin-Tahir commented 4 years ago

Hey @Haysam-Bin-Tahir, to run the GUI you need RedisGraph running, hydrus running and then run the gui(python app.py). I would suggest that for these errors you interact with the community through our slack channel: https://join.slack.com/t/hydraecosystem/shared_invite/zt-9eudw2gz-5SN92uyOhYDBnFQHAAx9nw Thanks!

Thank you so much.