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

feat: Add a modal to enable/disable Agents [WEB-1718] #8721

Merged
merged 6 commits into from
Jan 24, 2024
Merged

Conversation

mapmeld
Copy link
Contributor

@mapmeld mapmeld commented Jan 19, 2024

Description

When admin views a cluster resource pool, they'll see a dropdown in the breadcrumbs section:

Screen Shot 2024-01-19 at 3 05 07 PM

If there are no active agents, there is a Message

Screen Shot 2024-01-19 at 3 05 03 PM

If there are available agents, they appear as a set of toggle switches reflecting enabled/disabled state.
The "Apply Changes" button becomes enabled once changes are made.

Screen Shot 2024-01-19 at 3 06 50 PM

When there are 10+ toggles, there is a text filter:

Screen Shot 2024-01-19 at 3 09 00 PM

The original ticket suggests a dropdown to allow jobs to finish or 'gracefully terminate', but no such option is available in the current EnableAgent Go code

Test Plan

I've included const defaultNodes and nodes = defaultNodes as comments; uncommenting these makes two agents visible. When you click Apply Changes, you will see an API call and error (because these are not real agent IDs).

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

@cla-bot cla-bot bot added the cla-signed label Jan 19, 2024
Copy link

netlify bot commented Jan 19, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit 9ca6fce
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65aff6d9e677430008441707
😎 Deploy Preview https://deploy-preview-8721--determined-ui.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 145 lines in your changes are missing coverage. Please review.

Comparison is base (bf5b1d1) 47.26% compared to head (9ca6fce) 42.09%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8721      +/-   ##
==========================================
- Coverage   47.26%   42.09%   -5.17%     
==========================================
  Files        1045      729     -316     
  Lines      166700   128322   -38378     
  Branches     2244     2245       +1     
==========================================
- Hits        78783    54018   -24765     
+ Misses      87759    74145   -13614     
- Partials      158      159       +1     
Flag Coverage Δ
harness ?
web 42.51% <8.22%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
webui/react/src/services/apiConfig.ts 72.81% <100.00%> (+0.17%) ⬆️
webui/react/src/types.ts 100.00% <100.00%> (ø)
webui/react/src/services/decoder.ts 23.30% <0.00%> (-0.03%) ⬇️
webui/react/src/services/api.ts 0.00% <0.00%> (ø)
...eact/src/pages/ResourcePool/ResourcepoolDetail.tsx 0.00% <0.00%> (ø)
webui/react/src/components/ManageNodesModal.tsx 0.00% <0.00%> (ø)

... and 317 files with indirect coverage changes

@mapmeld mapmeld changed the title Add a modal to enable/disable Agents [WEB-1718] feat: Add a modal to enable/disable Agents [WEB-1718] Jan 19, 2024
@mapmeld mapmeld force-pushed the resource_pool branch 2 times, most recently from 2731fd2 to 8740364 Compare January 22, 2024 17:46
@mapmeld mapmeld requested a review from ashtonG January 22, 2024 17:48
@mapmeld mapmeld marked this pull request as ready for review January 22, 2024 17:48
@mapmeld mapmeld requested a review from a team as a code owner January 22, 2024 17:48

const onFormSubmit = useCallback(async () => {
for (const nodeId in toggleStates) {
if (toggleStates[nodeId] !== originalNodes[nodeId]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

consider memoizing originalNodes so each render doesn't recalculate the node state. Alternatively (assuming the endpoints are idempotent), keep track of which endpoints were touched and apply the endpoints that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️ added useMemo

@mapmeld mapmeld merged commit 7f3ddfb into main Jan 24, 2024
74 of 85 checks passed
@mapmeld mapmeld deleted the resource_pool branch January 24, 2024 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants