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

[NEW] Section to monitor and manage bot accounts on admin interface v2.0 #13609

Closed
wants to merge 88 commits into from
Closed

[NEW] Section to monitor and manage bot accounts on admin interface v2.0 #13609

wants to merge 88 commits into from

Conversation

mikaelmello
Copy link
Contributor

This is a refactor of #10832, including only the management part of the PR and removing any server-side communications to bots. The following text comes from the original PR with some parts removed.

This is part of the GSoC project to improve the integration of Rocket.Chat with bots, the discussion about changes on the User model is found here.

1. customClientData

This is supposed to be a field called by the bot in which it can set additional information about itself.

This field can be used to store any information about the client, such as text commands implemented by the bot.

2. Bot Management Admin Panel

The package rocketchat-bot-manager consists of adding a new section on the administration panel to manage bot accounts, that is, accounts with the type attribute set as 'bot', as discussed here.

2.1. List view

The list view is a list of all the existing bot accounts. It is accessible from the admin sidenav and shows the following information about an account:

  • Status (online/away/busy/offline)
  • Name
  • Username
  • Framework used by the account

Screenshot

2.2. Creation of a bot account

To create a bot account, the admin must first go to the list view and then click on the plus button on the right sidetab, opening a form similar to the one used to create a normal account, except for all e-mail related fields that have been removed.

Screenshot

2.3. Visualizing general info about an account

In the list view, the admin can click on any listed account and a flextab will be opened on the right side, displaying some information about the clicked account. Currently, it is displayed:

  • Roles of the account
  • Last login
  • Framework used by the account
  • Stack of clients the accounts is running on

If the admin clicks on the 'More Details' button, it will be taken to the Details page.

Screenshot 1 - Offline account. Screenshot 2 - Online account

2.4. Overview of the newly implemented management features

2.4.1. Getting statistics from a bot

Statistics that can be retrieved from the server, the total number of messages sent by the account for example

2.5. Bot Details view

The main management page of a bot is its details page. It displays:

  • Status (offline/online)
  • Editable field displaying the account name
  • Editable field displaying the account username
  • Editable field to be filled with a new password, if it is to bechanged
  • Framework/Adapter used by the bot
  • Connection status displaying the bot's IP address
  • Uptime of how long the bot has been online
  • Roles and the possibility to add or remove them

Screenshot 1 - Offline. Screenshot 2 - Online

The admin can also delete the account and convert the account to the user type. Converting it to the user type will simply edit the type attribute and ask for an e-mail if the account does not have one.

Regarding the statistics view, it is displayed when the admin clicks on 'Load' and currently shows:

  • Total number of messages sent by the bot
  • Total number of messages in which the bot is mentioned
  • Total number of rooms that bot has joined

Related:

Closes:

Screenshots are outdated with the old style, but it has been updated

If this PR tracks interest, I'll update the following PR: RocketChat/Rocket.Chat.js.SDK#15

Since there are a lot of images, it is better to use a list

+ add adminBotInfo template
+ move new permission to startup of server inside package instead of using
  the rocketchat-authorization package
+ change icon used by Bots from code to hubot
- remove roles column from list of bot users
rocketchat-lib
+ add insertOrUpdateBot method
+ add saveBot function
No i18n strings are defined, style will drastically change, this is just to have
a base to work with when we start to retrieve the data.

Remove users of type bot from the Users admin view
+ fix Bots server model and publication
+ add Bots model on client side
+ load cache of Bots model
Fix botData not being updated because of wrong variable being used
Get ipAddress when the bot calls the updateBotData method
+ add pause/resume buttons on the Bot details page
  - they send a pause or resumeSubscription command to the publication
  - they update the paused property of the Bots model

+ new model ClientCommands with a simple schema having text commands
+ new methods to send client commands down the publication

The clientCommands publication publishes to a logged in user only those
commands directed at them
To reply to a command, you call replyClientCommand with the commandId
Reset bot state whenever it subscribes again to clientCommands
- Add comments and some refactoring of the code
- Split between bot live statistics and server statistics
- Add new server stat: mention count
Done to reset data about the client that could be outdated on a new
connection
Whenever the reactive var 'bot' was changed it would create a new
interval, causing several pings to happen at the same time causing
a DOS in the bot.
@mikaelmello
Copy link
Contributor Author

Paging @timkinnane and @ggazzo.

I can take new screenshots if it is necessary

@claassistantio
Copy link

claassistantio commented Dec 14, 2019

CLA assistant check
All committers have signed the CLA.

@mikaelmello mikaelmello closed this Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants