Skip to content

feat(machine-id): Add bot instance details page (web)#55055

Merged
nicholasmarais1158 merged 38 commits intomasterfrom
nicholasmarais1158/feat/53584-bot-instance-details
May 27, 2025
Merged

feat(machine-id): Add bot instance details page (web)#55055
nicholasmarais1158 merged 38 commits intomasterfrom
nicholasmarais1158/feat/53584-bot-instance-details

Conversation

@nicholasmarais1158
Copy link
Copy Markdown
Contributor

@nicholasmarais1158 nicholasmarais1158 commented May 22, 2025

Description

The change adds a details page for bot instances. Clicking a row on the bot instance list opens the details page. This page can be deep linked from other parts of the app (if necessary) with a bot name and instance id.

Updates #53584

Changelog: View details for a bot instance

Changes

  • Add non-navigation route for new page
  • New webapi endpoint at GET /webapi/sites/:site/machine-id/bot/:name/bot-instance/:id - also returns the yaml representation
  • Link from Instances List on row click
  • Add "copy" Aria label to shared CopyButton component

Demo (network throttled)

Screen.Recording.2025-05-22.at.16.41.37.mov

@nicholasmarais1158 nicholasmarais1158 marked this pull request as ready for review May 22, 2025 16:27
@github-actions github-actions Bot requested review from kiosion and ravicious May 22, 2025 16:28
Comment thread lib/web/machineid.go Outdated
Comment thread lib/web/machineid.go Outdated
Comment thread lib/web/machineid.go
"strconv"
"time"

yaml "github.com/ghodss/yaml"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I can't keep track of which YAML package to use anymore, and I see this package is already a dependency of lib/web so I think you got it right. Worth noting that ghodss/yaml seems less common in our codebase though.

teleport on master [$!] ➜ ag --go -Q --count 'gopkg.in/yaml' | wc -l
      58

teleport on master [$!] ➜ ag --go -Q --count 'ghodss/yaml' | wc -l
      21

Comment thread lib/web/machineid_test.go Outdated
clusterName := env.server.ClusterName()

botName := "test-bot"
instanceId := uuid.New().String()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
instanceId := uuid.New().String()
instanceID := uuid.New().String()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed in b732185.

Comment thread lib/web/machineid_test.go Outdated
},
Status: &machineidv1.BotInstanceStatus{},
}, protocmp.Transform(), protocmp.IgnoreFields(&machineidv1.BotInstance{}, "metadata")))
assert.Equal(t, resp.Yaml, fmt.Sprintf("kind: bot_instance\nmetadata:\n name: %[1]s\n revision: %[2]s\nspec:\n bot_name: test-bot\n instance_id: %[1]s\nstatus: {}\nversion: v1\n", instanceId, resp.BotInstance.Metadata.Revision))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert.Equal(t, resp.Yaml, fmt.Sprintf("kind: bot_instance\nmetadata:\n name: %[1]s\n revision: %[2]s\nspec:\n bot_name: test-bot\n instance_id: %[1]s\nstatus: {}\nversion: v1\n", instanceId, resp.BotInstance.Metadata.Revision))
assert.YAMLEq(t, resp.Yaml, fmt.Sprintf("kind: bot_instance\nmetadata:\n name: %[1]s\n revision: %[2]s\nspec:\n bot_name: test-bot\n instance_id: %[1]s\nstatus: {}\nversion: v1\n", instanceId, resp.BotInstance.Metadata.Revision))

This will be slightly more robust.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Done in b7ef4a9.


import { useGetBotInstance } from '../hooks';

const docsURL =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const docsURL =
const docsUrl =

I know it's confusing, but our convention is for acronyms to be all caps in Go, and first-letter caps in Typescript.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed in b732185.

Base automatically changed from nickmarais/feat/53584-bot-instances-list to master May 27, 2025 08:22
…-details

# Conflicts:
#	lib/web/apiserver.go
#	lib/web/machineid.go
#	lib/web/machineid_test.go
#	web/packages/teleport/src/BotInstances/BotInstances.tsx
#	web/packages/teleport/src/BotInstances/List/BotInstancesList.tsx
#	web/packages/teleport/src/config.ts
#	web/packages/teleport/src/features.tsx
#	web/packages/teleport/src/services/bot/bot.ts
#	web/packages/teleport/src/services/bot/consts.ts
#	web/packages/teleport/src/services/bot/types.ts
#	web/packages/teleport/src/test/helpers/botInstances.ts
@nicholasmarais1158 nicholasmarais1158 added this pull request to the merge queue May 27, 2025
Merged via the queue into master with commit e271f9b May 27, 2025
44 checks passed
@nicholasmarais1158 nicholasmarais1158 deleted the nicholasmarais1158/feat/53584-bot-instance-details branch May 27, 2025 14:41
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@nicholasmarais1158 See the table below for backport results.

Branch Result
branch/v17 Failed

nicholasmarais1158 added a commit that referenced this pull request Jun 2, 2025
* Add navigation item

* Add bot instances page

* Populate page info

* Add missing license header

* Update bot instance nav icon

* Reword hint text

* Add active at timestamp tooltip

* Rename active at header

* Remove copy and sort

* Lint and test fixes

* Support backend search term filtering

* Simplify code

* Add search term filter auth tests

* Allow disabling `<Table />` loading indicator

* Rework frontend to use backend paging and filter (remove sort)

* Fix lint (ts)

* Remove unused BotInstances icon

* Add URL state (page and search)

* Use nil-safe getters on protos

* Fix crash on items w/o heartbeat data

* Add bot instance details page

* Fix lint (ts)

* Fix formatting (prettier)

* Fix yaml time serialisation

* Rename ButtonIcon from jsx to tsx

* Convert ButtonIcon to tsx

* Fix copy button on row

* Correct casing

* Use `assert.YAMLEq`

* Revert changes to ButtonIcon - too big for this PR
github-merge-queue Bot pushed a commit that referenced this pull request Jun 3, 2025
* feat(machine-id): Bot instances list (web) (#54925)

* Add navigation item

* Add bot instances page

* Populate page info

* Add missing license header

* Update bot instance nav icon

* Reword hint text

* Add active at timestamp tooltip

* Rename active at header

* Remove copy and sort

* Lint and test fixes

* Support backend search term filtering

* Simplify code

* Add search term filter auth tests

* Allow disabling `<Table />` loading indicator

* Rework frontend to use backend paging and filter (remove sort)

* Fix lint (ts)

* Remove unused BotInstances icon

* Add URL state (page and search)

* Use nil-safe getters on protos

* Fix crash on items w/o heartbeat data
# Conflicts:
#	api/gen/proto/go/teleport/machineid/v1/bot_instance_service.pb.go

* Update protos grpc

* feat(machine-id): Add bot instance details page (web) (#55055)

* Add navigation item

* Add bot instances page

* Populate page info

* Add missing license header

* Update bot instance nav icon

* Reword hint text

* Add active at timestamp tooltip

* Rename active at header

* Remove copy and sort

* Lint and test fixes

* Support backend search term filtering

* Simplify code

* Add search term filter auth tests

* Allow disabling `<Table />` loading indicator

* Rework frontend to use backend paging and filter (remove sort)

* Fix lint (ts)

* Remove unused BotInstances icon

* Add URL state (page and search)

* Use nil-safe getters on protos

* Fix crash on items w/o heartbeat data

* Add bot instance details page

* Fix lint (ts)

* Fix formatting (prettier)

* Fix yaml time serialisation

* Rename ButtonIcon from jsx to tsx

* Convert ButtonIcon to tsx

* Fix copy button on row

* Correct casing

* Use `assert.YAMLEq`

* Revert changes to ButtonIcon - too big for this PR

* chore: Export feature for enterprise (bot instance details) (#55177)
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.

3 participants