Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Add a command centre for opsdroid #1872

Closed
FabioRosado opened this issue Dec 4, 2021 · 2 comments · Fixed by #1875
Closed

Idea: Add a command centre for opsdroid #1872

FabioRosado opened this issue Dec 4, 2021 · 2 comments · Fixed by #1875

Comments

@FabioRosado
Copy link
Member

FabioRosado commented Dec 4, 2021

This issue is currently a draft/brain dump for this idea - I will do some clean up in the future

Goal

Allow users to test opsdroid from the browser and enable/disable modules from a running bot.

Problem

You need to edit your config when opsdroid isn't running to add connectors/skills. You also need to add a connector to interact with opsdroid since the default connector is the WebSocket one.

Context

Often, when opsdroid is running, and you have many skills/connectors, it can be hard to figure out what modules are running without looking into the config, having logging set to debug mode, or running one of the list config CLI commands. Users also need to install a connector to interact with the bot since opsdroid comes only pre-installed with the WebSocket connector.

Implementation Details

Extending the opsdroid API

We need to extend the existing API to allow us to list all modules by type (connectors, parsers, skills) and update modules to toggle them on/off. We could as well allow users to include modules.

I have a POC branch where I am hacking some of the API. It does mostly:

  • Add get route to list connectors, skills, parsers, config (
  • sensitive configuration params like tokens are removed from the config that we return
  • Add patch route to update a module
  • Add a new payload dataclass with a bunch of validation so we can handle user input better
  • Add command-center parameter to the web section to enable the new API endpoints, and in the future, the UI
    • Added a token parameter under command-center that will be used for a poor-man authorization
      • In the future, I want to generate a new token on each start of opsdroid (if the user didn't provide one) and push this into an envvar so the UI can use it

The configuration looks like this atm:

web:
  command-center:
    enabled: True
    token: <my-token>

We should also create a new param under command-center to allow users to toggle the UI on/off as well letting them specify a port in which the UI runs.

Using Opsdroid web

Background info and current status

Jacob created an electron app (opsdroid desktop that allowed users to download the app, start opsdroid, and you could interact with opsdroid from within the electron app. A user (sorry don't recall who) suggested that we split the electron app and the web component to run opsdroid within the browser.

In response, opsdroid web was created. But we haven't touched it in a very, very, very long time, and at least on Node 16, you can't even start opsdroid web because many modules are deprecated and a lot of things fail. I've started updating opsdroid web dependencies, but I still have issues with some things. Once the API is finished, I will dedicate more time to working on the opsdroid web.

Once opsdroid desktop is usable, we could make opsdroid desktop install opsdroid web from npm and be a wrapper for it (this was the original idea for us to split the app, but I don't think we implemented this?)

Suggestions

Since we already have opsdroid web created, we can use this as our command centre UI and extend it since opsdroid web is just a chat window.

TBD -> Opsdroid web mockup

Here's a rough overview of the things that I would like to add to opsdroid dev:

  • Keep the chat windows always on the right
  • Add a sidebar that shows status by calling the /stats endpoint from time to time
  • Add a tab that contains the config (with sensitive parameters removed)
    • Section with modules that users can enable/disable
    • Allow users to toggle core skills even if they haven't been running
  • Use an environment var to toggle the sidebar for the command-centre on/off
@jacobtomlinson
Copy link
Member

Yes to all the things!

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 16, 2022
@cognifloyd cognifloyd removed the stale label Apr 17, 2022
@FabioRosado FabioRosado changed the title [Draft] Idea: Add a command centre for opsdroid Idea: Add a command centre for opsdroid May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants