Skip to content

Console maintained objects list#36389

Open
leedqin wants to merge 6 commits into
MaterializeInc:mainfrom
leedqin:console-maintained-objects-list
Open

Console maintained objects list#36389
leedqin wants to merge 6 commits into
MaterializeInc:mainfrom
leedqin:console-maintained-objects-list

Conversation

@leedqin
Copy link
Copy Markdown
Contributor

@leedqin leedqin commented May 4, 2026

Motivation

Maintained Objects List to show objects (sources, indexes, tables, mvs) in a table view to dive deeper into freshness (pMax), hydration status, clusters.

First PR/ n for maintained objects feature. Fixes CNS-50

Description

  • Maintained objects list wraps around TanStack table with column filters for pMax, hydration status, object type, clusters
  • Added sql queries and tests for freshness lag and hydration status and did client side join with the data from allObjects subscribe
  • Filter Chips component for the table to show which filters are active
  • Url params logic to save the filters in url params
  • Expanded the tanstack table to have filters on the column headers

Objects List
image

Filters for the objects list
image

Objects filter:
image

pMax Filter:
image

Cluster Filter
image

Tips for the reviewer

  • Would recommend reviewing it by commit since the data/ query logic is in the first commit. And the rendering/ table filtering logic is in the second one

@leedqin leedqin force-pushed the console-maintained-objects-list branch 3 times, most recently from 7f76cdf to a7d5aa8 Compare May 4, 2026 18:38
@leedqin leedqin added the A-CONSOLE Area: Console label May 4, 2026
@leedqin leedqin marked this pull request as ready for review May 4, 2026 18:40
@leedqin leedqin requested a review from a team as a code owner May 4, 2026 18:40
@leedqin leedqin requested review from SangJunBak and removed request for a team May 4, 2026 18:40
*/
export function buildLagAggregateQuery({
lookbackMinutes,
}: LagAggregateParams) {
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.

nit: I kind of feel like we should be making sure we're validating that lookbackMinutes is less than a day on the API side.

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.

Will add a sql test for for this

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.

Ah is this the test you're referring to 6e2ae07?

Sorry I should've been more clear. So the underlying relation only has 24 hours of history. I was saying along with the client validation (of just hiding the option), maybe we should also validate closer to the API side (similar to how we validate the start time for the query history https://github.com/leedqin/materialize//blob/console-maintained-objects-list/console/src/api/materialize/query-history/queryHistoryList.ts#L164-L178).

This is more of a nit because we're only exposing upto 24 hours as a lookback window on the client side. However it's a bit more useful if other hooks/pages try to reuse the build function. We don't need to do this however

@SangJunBak
Copy link
Copy Markdown
Contributor

I think when we scroll, the search bar should be anchored to the left, similar to the query history

Screen.Recording.2026-05-04.at.4.50.13.PM.mov

@SangJunBak
Copy link
Copy Markdown
Contributor

SangJunBak commented May 4, 2026

Nit: Margins on this chip seem a bit small. Is this consistent with our tags?

Screenshot 2026-05-04 at 4 53 29 PM

@SangJunBak
Copy link
Copy Markdown
Contributor

Ux nit: It feels jarring to have this go to a number. Can we change this to like "2 selected"?

Screen.Recording.2026-05-04.at.4.55.59.PM.mov

Copy link
Copy Markdown
Contributor

@SangJunBak SangJunBak left a comment

Choose a reason for hiding this comment

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

Reviewed the first commit! Will review the second later

const data = React.useMemo<MaintainedObjectListItem[]>(() => {
const lagById = new Map(lag.data.map((r) => [r.object_id, r]));
const hydrationById = new Map(hydration.data.map((r) => [r.object_id, r]));
const num = (v: bigint | null | undefined) => (v ? Number(v) : 0);
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.

Let's just make this a top level function

Comment thread console/src/platform/maintained-objects/queries.ts Outdated
Comment on lines +121 to +126
// Subsources and progress sources are managed by their parent source.
return !(
obj.objectType === "source" &&
(obj.sourceType === "subsource" || obj.sourceType === "progress")
);
})
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.

Technically progress sources are now just the source and subsources are tables. Did we account for this?

name: string;
schemaName: string | null;
databaseName: string | null;
objectType: MaintainedObjectType;
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.

Why are these nullable again?

Comment thread console/src/platform/maintained-objects/queries.ts
Comment thread console/src/platform/maintained-objects/queries.ts
const lag = useSubscribeToLagAggregate({ lookbackMinutes });
const hydration = useSubscribeToHydrationAggregate();

const data = React.useMemo<MaintainedObjectListItem[]>(() => {
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.

Nit: Rather than making the data structure a list, I like to make the "main" data structure an object / map keyed by the ID then derive a sorted list from it.So in this case, the ID would be object_id.

Comment thread console/src/components/Table/tableTypes.ts Outdated
@leedqin
Copy link
Copy Markdown
Contributor Author

leedqin commented May 4, 2026

image would recommend to not review the filter chips component in the second commit and look at the third commit instead since that addresses the UX nits and show multi select filter as it's own chip to make it clear to the user which filters are selected

export const disabledFlexibleDeploymentFlags: Record<string, boolean> = {};
export const disabledFlexibleDeploymentFlags: Record<string, boolean> = {
"maintained-objects-ui-50": false,
};
Copy link
Copy Markdown
Contributor

@SangJunBak SangJunBak May 5, 2026

Choose a reason for hiding this comment

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

What does the rollout look like for self managed? Wanted to call out that if we're aiming for releasing to self managed by next week, then there's no way a user can toggle htis

@SangJunBak
Copy link
Copy Markdown
Contributor

Noticing an extra footer here:
Screenshot 2026-05-05 at 1 28 53 PM

@SangJunBak
Copy link
Copy Markdown
Contributor

It's weird to me how we change the color of freshness to orange for >=5 seconds but then our filters start at a minute

Screenshot 2026-05-05 at 1 47 46 PM

Copy link
Copy Markdown
Contributor

@SangJunBak SangJunBak left a comment

Choose a reason for hiding this comment

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

Moreso found some design flaws/bugs, but everything else looks good to me!

};

return (
<RadioGroup
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.

style nit: Noticing the color scheme doesn't match our app's (it's blue instead of purple)
Image

*/
export function buildLagAggregateQuery({
lookbackMinutes,
}: LagAggregateParams) {
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.

Ah is this the test you're referring to 6e2ae07?

Sorry I should've been more clear. So the underlying relation only has 24 hours of history. I was saying along with the client validation (of just hiding the option), maybe we should also validate closer to the API side (similar to how we validate the start time for the query history https://github.com/leedqin/materialize//blob/console-maintained-objects-list/console/src/api/materialize/query-history/queryHistoryList.ts#L164-L178).

This is more of a nit because we're only exposing upto 24 hours as a lookback window on the client side. However it's a bit more useful if other hooks/pages try to reuse the build function. We don't need to do this however

@SangJunBak
Copy link
Copy Markdown
Contributor

Noticing we're persisting the lookback to local storage but the URL still blips. Why not just have it in the URL, especially if it doesn't sync to the lookback selects on other pages?

Screen.Recording.2026-05-05.at.1.49.35.PM.mov

leedqin added 5 commits May 5, 2026 18:06
- Sql queries and tests. Leveraging allObjects subscribe query in the console and only added a query for showing pMax values and hydration statuses. Joining this data client side to be rendered in a table
- Added a filter on Universal Table column header
- Added a Maintained Objects route behind a Launch Darkly flag
- Added filter chips to show filters selected
- Added the filter components fror the different filter columns: freshness, multi select and search for cluster, object types, hydration status
- Maintained Objects List with cells defined for each column, columns using Tanstack sorting / filtering, universal tanstack table components with Url params and pagination
- Maintained Objects List react table with happy path of listing objects and listing objects with filters
- Changed the filter chips to show all the filters seelected i.e "Type: source x", "Type: index x" "Cluter: quickstart" etc
- ujpdated the margins to match the Tag component margins
- Moved search to the left
- Added a sql test to validate lookback minutes behavior for freshness
- Collapsed cluster and lag objects
- MaintainedObjectLIst is now a map keyed by the object id rather than a structured list
- Added pMAX ≥ 5s and ≥ 10s filter options to match the column's
  warning/outdated color thresholds (was previously starting at 1 minute)
- Switched the freshness filter radios to the form variant so they pick up
  the brand purple instead of Chakra's default blue
- Removed the duplicate "X of Y objects" footer that overlapped with the
  TablePagination summary when more than one page was visible
@leedqin leedqin force-pushed the console-maintained-objects-list branch from 49fd430 to 85ce905 Compare May 6, 2026 17:02
@SangJunBak
Copy link
Copy Markdown
Contributor

SangJunBak commented May 7, 2026

I don't think the unit UI makes sense without an apply button, similar to the query history filters. E.g. if I were to filter for >=30 minutes

Screen.Recording.2026-05-07.at.10.17.04.AM.mov

- Made the freshness filter a draft-then-apply flow matching query-history's FilterMenu, so typing a number or switching units no longer fires the filter through intermediate values
- Added an Apply / Clear footer with a top divider; Enter in the number field also commits
@leedqin
Copy link
Copy Markdown
Contributor Author

leedqin commented May 11, 2026

apply_freshness_filter.mov

Added the Apply Filter for freshness

@leedqin leedqin requested a review from SangJunBak May 11, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CONSOLE Area: Console

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants