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

ui: Add page to view schedules in DB console. #86409

Merged
merged 1 commit into from Aug 26, 2022

Conversation

benbardin
Copy link
Collaborator

@benbardin benbardin commented Aug 18, 2022

Summary
Adds /schedules page in DB console. Structure is very similar to /jobs page. The new /schedules page provides a bit more observability into what schedules are running, and their various states.

Release note (ui change): Add page to view schedules in DB console.
Release justification: Low-risk - new, read-only page.
See also #70725

Artifacts
Loom link: https://www.loom.com/share/0fb4fee5859d4a46a3b6442892ae9ef6

Screen Shot 2022-08-18 at 2 23 40 PM

Screen Shot 2022-08-18 at 2 23 14 PM

Screen Shot 2022-08-18 at 2 36 39 PM

Screen Shot 2022-08-18 at 2 23 20 PM

@benbardin benbardin requested review from a team August 18, 2022 18:47
@benbardin benbardin requested review from a team as code owners August 18, 2022 18:47
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@kevin-v-ngo
Copy link

Hi Ben, can you provide a few screenshots in the description? Just to help product folks (PM, Docs, Design etc.) know the scope of the change and provide feedback where we can :)

Example issue which does this

@benbardin
Copy link
Collaborator Author

🤦 Absolutely! I took the screenshots, just forgot to attach them :) Thanks @kevin-v-ngo !

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Hi Ben, the pages look great! I do have a few suggestions 😄

When you're making big changes on the UI, it's a good practice to also add a video of the page working, clicking things around, selecting different values on the dropdown, etc. We do have access to enterprise account on loom, so you can use that https://www.loom.com/looms/videos

If you plan to ever have this page available on cloud, I wouldn't use the admin.go endpoint, because is not available there. Also we do have a new SQL over http API that we're leaning to use from now on, avoiding the need to create several endpoint, and now you can use directly on the UI. Here is an example of how we're using:

export function getClusterLocksState(): Promise<ClusterLocksResponse> {

Also, I'm not sure what I should be looking on the first screenshot, it doesn't look like that page has any changes

Reviewed 37 of 39 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @benbardin and @maryliag)


-- commits line 2 at r1:
nit: use all lower case for the title
can you add more explanation about what this PR is about, what info expect to see, which issues is related to, etc?


pkg/ui/workspaces/cluster-ui/src/schedules/scheduleDetailsPage/scheduleDetailsConnected.tsx line 2 at r1 (raw file):

// Copyright 2022 The Cockroach Authors.
//

this file would only be used if the page exists on CC Console. Is the plan to add on CC Console. If so, as my other comment mentioned, it won't work if your endpoint is on admin.go

I assume you used the Jobs page as your guide, but we did add that to Cloud and made changes on the specific admin endpoint for jobs to allow that. So make sure you're testing if this works on Cloud.


pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/schedulesPage.fixture.tsx line 259 at r1 (raw file):

const history = createMemoryHistory({ initialEntries: ["/statements"] });

const staticScheduleProps: Pick<

nit: since you list for pick is big, you can use Omit<... instead, and just add the 4 you don't care about:
schedules
schedulesError
schedulesLoading
onFilterChange


pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/schedulesPageConnected.tsx line 3 at r1 (raw file):

// Copyright 2022 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License

same comment as the other "Connected" file. This is only used if you have the page on CC Console


pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/scheduleTable.tsx line 127 at r1 (raw file):

      </Tooltip>
    ),
    cell: schedule => schedule.recurrence,

Not sure if that is the design decision, but having @hourly @weekly looks a little weird, I would prefer if you can so schedule => schedule.recurrence.substring(1) to remove the @ and have just the text
Just my opinion, feel free to ignore if that is by design


pkg/ui/workspaces/cluster-ui/src/store/scheduleDetails/index.ts line 12 at r1 (raw file):

export * from "./schedule.reducer";
export * from "./schedule.sagas";

these 2 files (reducer, sagas) are only used for CC Console


pkg/ui/workspaces/cluster-ui/src/store/schedules/index.ts line 13 at r1 (raw file):

export * from "./schedules.reducer";
export * from "./schedules.sagas";
export * from "./schedules.selectors";

same thing as the other comments, reducer and saga is only used on CC Console

@kevin-v-ngo
Copy link

It's great that we're providing more observability for schedules!

I'm adding @jeremycbloom, @livlobo, and @thtruo. Wasn't sure if there were designs for this. I remember wanting to avoid or at least having guidelines on the top level information architecture when introducing top-level left nav to avoid info overload - Schedules also seems very related to Jobs.

Tommy, we'll need to update the CockroachUX ownership here.

Copy link
Collaborator Author

@benbardin benbardin left a comment

Choose a reason for hiding this comment

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

Added a loom video, and switched to the new SQL endpoint! The first screenshot is meant to show the Schedules option in the sidebar, but that's a heck of a lot clearer in the video!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @hourly and @maryliag)


-- commits line 2 at r1:

Previously, maryliag (Marylia Gutierrez) wrote…

nit: use all lower case for the title
can you add more explanation about what this PR is about, what info expect to see, which issues is related to, etc?

done!


pkg/ui/workspaces/cluster-ui/src/schedules/scheduleDetailsPage/scheduleDetailsConnected.tsx line 2 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

this file would only be used if the page exists on CC Console. Is the plan to add on CC Console. If so, as my other comment mentioned, it won't work if your endpoint is on admin.go

I assume you used the Jobs page as your guide, but we did add that to Cloud and made changes on the specific admin endpoint for jobs to allow that. So make sure you're testing if this works on Cloud.

Moved to the generic SQL endpoint - I plan to migrate this to cloud in a later diff.


pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/schedulesPage.fixture.tsx line 259 at r1 (raw file):

schedules
schedulesError
schedulesLoading
onFilterChange
done


pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/schedulesPageConnected.tsx line 3 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

same comment as the other "Connected" file. This is only used if you have the page on CC Console

removed


pkg/ui/workspaces/cluster-ui/src/schedules/schedulesPage/scheduleTable.tsx line 127 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

Not sure if that is the design decision, but having @hourly @weekly looks a little weird, I would prefer if you can so schedule => schedule.recurrence.substring(1) to remove the @ and have just the text
Just my opinion, feel free to ignore if that is by design

Yeah, it's intentional - This column is actually a cron expression, I just don't like typing things like "3 4 5 * *" in my demos :) "@hourly" is a (semi-)standard cron syntax here, so it's probably most reasonable to keep it consistent.


pkg/ui/workspaces/cluster-ui/src/store/scheduleDetails/index.ts line 12 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

these 2 files (reducer, sagas) are only used for CC Console

removed


pkg/ui/workspaces/cluster-ui/src/store/schedules/index.ts line 13 at r1 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

same thing as the other comments, reducer and saga is only used on CC Console

removed

Copy link
Collaborator Author

@benbardin benbardin left a comment

Choose a reason for hiding this comment

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

Yes, they are very related! I'd certainly be open to consolidating Schedules and Jobs into a single tab. That said, given the approaching branch cut I do think there's value in shipping what we have - that way we can start getting feedback, and this is easy enough to revise for a later release. But if others notice pitfalls I've missed I'm glad to hear them!

All that said, tests are now 💚 so I think this is ready for another review

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @hourly and @maryliag)

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Thank you for working on the changes! It looks great!! I have just one more suggestion about how you're getting the details :)

Reviewed 14 of 36 files at r2, 2 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @benbardin and @maryliag)


pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts line 23 at r3 (raw file):

  state: string;
  recurrence: string;
  jobsrunning: number;

on the ScheduleColumns and Schedule types you're using a mix of camel case, sneak case and this one that doesn't differentiate the second word. Make sure you pick one style and use it consistently


pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts line 109 at r3 (raw file):

        // may also be truncated.
        sql: `
          WITH schedules AS (SHOW SCHEDULES)

looks like you're using this to get the info for the details page, but is the same query you did to get all info, just filter by the specific one. When you get all, that is saved on cache, so instead of having to make another call, you can simply look for the result on your cache.

Take a look at this example, which is very similar, on it we have an overview with all statements, we don't make any new calls and on the selector for the details you just do a find on the cache:
83ae32f#diff-8d9a8801f6be479b8728f6010c8a626e6e3d243c850a40815e592c7e75a54dcfL55-L66


pkg/ui/workspaces/cluster-ui/src/schedules/scheduleDetailsPage/scheduleDetails.tsx line 64 at r3 (raw file):

        <Row gutter={24}>
          <Col className="gutter-row" span={24}>
            <SqlBox value={schedule.command} />

nit: I added a new size type that we're trying to use now, so if you rebase, change this to <SqlBox value={schedule.command} size={SqlBoxSize.custom} />


pkg/ui/workspaces/db-console/src/redux/apiReducers.ts line 441 at r3 (raw file):

export const scheduleKey = (scheduleID: Long): string => scheduleID.toString();

const scheduleReducerObj = new KeyedCachedDataReducer(

with the suggestion I mention, you won't need this cache specific per schedule

Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

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

Regarding the code itself and the changes requested, :lgtm:
Now it's up to the others tagged here, as Kevin mentioned, if there are changes on design, location of page or content.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @benbardin and @maryliag)

Copy link
Collaborator Author

@benbardin benbardin left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @maryliag)


pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts line 23 at r3 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

on the ScheduleColumns and Schedule types you're using a mix of camel case, sneak case and this one that doesn't differentiate the second word. Make sure you pick one style and use it consistently

discussed offline, needs to match the sql columns


pkg/ui/workspaces/cluster-ui/src/api/schedulesApi.ts line 109 at r3 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

looks like you're using this to get the info for the details page, but is the same query you did to get all info, just filter by the specific one. When you get all, that is saved on cache, so instead of having to make another call, you can simply look for the result on your cache.

Take a look at this example, which is very similar, on it we have an overview with all statements, we don't make any new calls and on the selector for the details you just do a find on the cache:
83ae32f#diff-8d9a8801f6be479b8728f6010c8a626e6e3d243c850a40815e592c7e75a54dcfL55-L66

discussed offline, probably not right for this use case


pkg/ui/workspaces/cluster-ui/src/schedules/scheduleDetailsPage/scheduleDetails.tsx line 64 at r3 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

nit: I added a new size type that we're trying to use now, so if you rebase, change this to <SqlBox value={schedule.command} size={SqlBoxSize.custom} />

done


pkg/ui/workspaces/db-console/src/redux/apiReducers.ts line 441 at r3 (raw file):

Previously, maryliag (Marylia Gutierrez) wrote…

with the suggestion I mention, you won't need this cache specific per schedule

discussed offline, probably not right for this use cas

@thtruo
Copy link
Contributor

thtruo commented Aug 25, 2022

Thanks for looping me in @benbardin and @kevin-v-ngo ! The new Schedules view is neat!

Yes, they are very related! I'd certainly be open to consolidating Schedules and Jobs into a single tab. That said, given the approaching branch cut I do think there's value in shipping what we have - that way we can start getting feedback, and this is easy enough to revise for a later release. But if others notice pitfalls I've missed I'm glad to hear them!

I have the same opinion - if Schedules and Jobs are related, ideally they are consolidated in a single page and separated by tabs (similar to the SQL Activity page). Do you think consolidating them together will happen in time for the public release of v22.2? I assumed so, but wanted to clarify that in case I'm misinterpreting your point around "revise for a later release".

Just to share some context behind one of my concerns around not having them consolidated them in time for v22.2 - if the first time users see a new "Schedules" top-level nav item, and then in a subsequent patch release that nav item disappears (b/c it is consolidated with something else), that shifting information hierarchy could lead to user confusion. And we'd like to avoid that where possible :)

@benbardin
Copy link
Collaborator Author

Thanks @thtruo !

I don't think I can do better than this before the branch cut Tuesday (or even before 22.2 GA), not least because we may want visual designs for a consolidated tab that I'm not skilled enough to make :) I think our choices are either ship this for 22.2 and revise for 23.1 as need/resources indicate, or choose not to ship this now. I bias towards shipping, but certainly agree we should be thoughtful around cognitive load.

What do you think - "go" or "no go," here? Or is there another option I'm missing?

@thtruo
Copy link
Contributor

thtruo commented Aug 25, 2022

Ack @benbardin
I'm not comfortable making a go/no-go decision - definitely defer to your team and @livlobo to make that call :) My 2 cents is - as it stands I would not block your addition to 22.2 just because we're missing the consolidated UX. However, I would encourage Design (cc @jeremycbloom) to help mock up a consolidated design and to give your team a reference to evaluate the work involved, and opportunistically make those changes in one of the 22.2.0-beta releases (there are several release trains throughout Oct) so that the consolidated UX is available in time for the public release date happening in Nov.
Again, that's my hot-take. If that's not feasible in your team's roadmap, I'd also bias towards shipping what you have now regardless

@livlobo
Copy link
Contributor

livlobo commented Aug 25, 2022

@benbardin @thtruo - there is enough user-facing value in shipping this for 22.2 as-is. I vote ship-it.

Re: consolidation - we can have further discussions with @jeremycbloom and align across other product areas to see if consolidating all "jobs" makes sense from a user perspective for a future iteration.

Adds /schedules page in DB console. Structure is very similar to /jobs pa
ge. The new /schedules page provides a bit more observability into
what schedules are running, and their various states.

Release note (ui change): Add page to view schedules in DB console.

Release justification: Low-risk - new, read-only page.
@benbardin
Copy link
Collaborator Author

Test failure is unrelated

bors r+

@maryliag
Copy link
Contributor

maryliag commented Aug 26, 2022

would having something like this enough for the change? https://www.loom.com/share/134c2296a97a4eb5941cf54a5d162a63

To clarify, this would only show like this for DB Console, CC Console would not be affected by this change (since the schedules page won't exist there, meaning only Jobs page show there)

@maryliag
Copy link
Contributor

If it helps I create the PR #86945
Let me know if you want that, otherwise I can close it

@craig
Copy link
Contributor

craig bot commented Aug 26, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 26, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 26, 2022

Build succeeded:

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

6 participants