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

OCS Web control panel system for Agents #163

Merged
merged 17 commits into from
Sep 24, 2020
Merged

OCS Web control panel system for Agents #163

merged 17 commits into from
Sep 24, 2020

Conversation

mhasself
Copy link
Member

@mhasself mhasself commented Aug 26, 2020

Significant advancements to the OCS Web system. monitor.html now has a tabbed interface where panels can be opened for controlling and monitoring each Agent. A "generic" control panel can be opened, or a panel matched to the specific Agent Class can be used in order to provide operation-specific parameters.

This has significant documentation describing how to develop a new custom panel.

Description

This includes simple "specialized" panels for the Aggregator and FakeData agents, as well as the Generic panel. Simple panels for other agents can be made by copying the (fairly compact) examples these provide.

There are some changes to ocs/ocs_agent.py and site_config.py, in order to store and expose the Agent's class name (e.g. 'FakeDataAgent') to the world.

Motivation and Context

I don't believe there's an issue for this, but it's been the plan for a long time and has been re-re-re-requested recently.

How Has This Been Tested?

This has been tested with a combined docker+host OCS setup, using recent versions of Firefox and Chrome.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Unless I am preparing a release, I have opened this PR onto the develop branch.

Now ocsbow.js:OCSConnection handles all the reconnection stuff, and
monitor.js just registers callbacks to populate the UI.
Each panel is rendered in its own "tab".  No panels right now but see
next commit...
Includes some fake_data_agent improvements to make control more
interesting.
That way we the OCSConnection can manage reconnection and the
AgentClients do not need to be recreated.
Use AgentList to monitor heartbeat feeds and callback to anyone who
has subscribed to monitor a particular Agent.  Turn stuff red when
agent connection is lost.
…ribute

The two new API calls are 'get_agent_class' and 'get_api', the latter
of which returns a single blob with all tasks, processes, feeds, and
the agent_class.  These simplify the www control system (especially in
that agent_class allows the right control panel to be associated with
an agent instance).

In current use, OCSAgent is constructed in ocs_agent.init_site_agent.
The Agent codes typically only mention their class name when they call
site_config.parse_args.  So it convenient, though perhaps not the best
design, to have parse_args simply add the agent_class to the args
returned by parse_args, and have init_site_agent extract it from
there.
This makes use of the new api calls (get_api and get_class_name), but
will be operable even if not all Agents support them.

Also a couple of bug fixes to tab activation; tab creationg +
activation for debugging.  Also some code cleanup.
- OcsUiHelper takes a client for setting up default start/stop actions
- OcsUiHelper.dropdown (demonstrated in FakeData)
- Rename OcsUiHelper.panel to .set_context
- Rename OcsUiHelper.ind to .get
- Rename OcsUiHelper.progress_bar to .progressbar
Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Couple of small comments inline below. Other misc. thing I came across/questions I had:

  • In testing I found I can start a delay task, but can't abort mid-delay.
  • Is the name delay_box special in any way, or are we just trying to avoid a collision with the name delay. If I can make a UI suggestion, can we have the "Suggestions" drop down populate the "Delay (s)" field with the selected value? That way the "Delay" field is the definitive place for the delay parameter, and there is no potential confusion between selecting a suggestion and entering a value.
  • set_boxes() seems to be missing from the OcsUiHelper Method Reference

I should note that I've looked at the Python changes here, and the FakeDataAgent.js, but not most of the other .js or .html/.css.

I don't want to hold up moving forward on this, so maybe if the UI suggestion is good we should open an issue for it. Similarly for the abort functionality, I assume that should be working?

agents/fake_data/fake_data_agent.py Outdated Show resolved Hide resolved
agents/fake_data/fake_data_agent.py Outdated Show resolved Hide resolved
@mhasself
Copy link
Member Author

Thanks -- pushed fixes and will merge soon if there are no further objections.

  • "Abort" is part of OCS API but there is no way for Agents to handle it currently... so I've commented it out of the UI for now.
  • Addressed your documentation points.
  • You're right that the dropdown is silly, but perhaps we can just plan to delete it when there's a better Operation in FakeData Agent that can use it as a UI element. Having the element change another element's value is a more advanced example.

@mhasself mhasself merged commit b0a810c into develop Sep 24, 2020
@mhasself mhasself deleted the www-control branch September 24, 2020 16:20
@BrianJKoopman BrianJKoopman mentioned this pull request Oct 29, 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.

None yet

2 participants