Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

monitors: show every users' code monitors to admins#54981

Merged
Strum355 merged 15 commits into
mainfrom
nsc/codemonitor-siteadmin-listall
Jul 24, 2023
Merged

monitors: show every users' code monitors to admins#54981
Strum355 merged 15 commits into
mainfrom
nsc/codemonitor-siteadmin-listall

Conversation

@Strum355

@Strum355 Strum355 commented Jul 14, 2023

Copy link
Copy Markdown
Contributor

Closes https://github.com/sourcegraph/sourcegraph/issues/50898

Screenshot from site-admin user view

image

Test plan

Added storybook test & manual local testing

@cla-bot cla-bot Bot added the cla-signed label Jul 14, 2023
@Strum355 Strum355 self-assigned this Jul 14, 2023
@Strum355 Strum355 marked this pull request as ready for review July 17, 2023 13:22
@sourcegraph-bot

sourcegraph-bot commented Jul 17, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@pjlast

pjlast commented Jul 18, 2023

Copy link
Copy Markdown
Contributor

Should the Code Monitor owner be updated as well to display the actual owner, and not the signed in user, when viewing the code monitor? https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/web/src/enterprise/code-monitoring/components/CodeMonitorForm.tsx?L184-195

Think it can maybe still stay disabled, but at least show the correct owner

@pjlast pjlast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

@Strum355 Strum355 force-pushed the nsc/codemonitor-siteadmin-listall branch from 7a878bf to 853647d Compare July 19, 2023 21:24

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great full stack work! I left a few inline comments and suggestions on placement and API surface, LMK what you think!

Comment thread cmd/frontend/graphqlbackend/code_monitors.graphql Outdated
id: id!,
update: {
namespace: authenticatedUser.id,
namespace: codeMonitor.owner.id,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we don't initialize the above owner to the authenticatedUser, does this page still use the correct namespace?

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.

ManageCodeMonitorPage is the edit page for an already created monitor, so the owner would already be set (and is immutable). Does that answer it, im not sure if i understood completely

Comment thread internal/database/code_monitor_webhook.go Outdated
Comment thread internal/database/code_monitor_emails.go
Comment thread client/web/src/enterprise/code-monitoring/CodeMonitoringNode.tsx Outdated
Comment on lines +120 to +123
<div className="row mb-5">
<div className="d-flex flex-column w-100 col">
{authenticatedUser?.siteAdmin && (
<>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if this list would be better suited in the site-admin menu, thus not cluttering this list view too much for site-admins that use code monitors for actual usage vs them wearing their site-admin hat and wanting to look at all entries.

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.

Its a fairly uncluttered page as-is imo, so I dont think its problematic to list them here as well (I'm personally a fan of having things colocated instead of having to go through extra hoops after realizing "oh theyre not listed where I thought they might be").
Not sure under which site-admin section they should go anyway 😅

@Strum355 Strum355 force-pushed the nsc/codemonitor-siteadmin-listall branch from 432fc8b to a4a9547 Compare July 24, 2023 11:31
@Strum355 Strum355 enabled auto-merge (squash) July 24, 2023 11:32
@Strum355 Strum355 disabled auto-merge July 24, 2023 11:59
@Strum355 Strum355 enabled auto-merge (squash) July 24, 2023 12:00
@Strum355 Strum355 merged commit 8f08f57 into main Jul 24, 2023
@Strum355 Strum355 deleted the nsc/codemonitor-siteadmin-listall branch July 24, 2023 12:11
MaedahBatool pushed a commit that referenced this pull request Jul 28, 2023
Closes https://github.com/sourcegraph/sourcegraph/issues/50898

<details>
<summary>Screenshot from site-admin user view</summary>


![image](https://github.com/sourcegraph/sourcegraph/assets/18282288/3a9f54de-af07-4874-867b-6f61ececfb19)

</details>


## Test plan

Added storybook test, unit tests & manual local testing
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Site admin user code monitor access

4 participants