ui: Add search and filtering to the databases pages#92589
Conversation
maryliag
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @gtr)
-- commits line 2 at r1:
Nit: you can't use Fixes because it still needs to be done on CC Console, so this should be Part Of, and you should include on the commit message
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 51 at r1 (raw file):
calculateActiveFilters, } from "src/queryFilter"; import { nodeRegions } from "src/transactionsPage/transactions.fixture";
fixture files are used for testing, if you need a new struct type, it should be created on another location
maryliag
left a comment
There was a problem hiding this comment.
Nice work!
What happens when you're on Database details and change from tables to grants?
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @gtr)
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 372 at r2 (raw file):
{ app: filters.app, timeNumber: filters.timeNumber,
you don't need to sync values that you don't actually show filters for
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 415 at r2 (raw file):
table => { if (regionsSelected.length == 0 && nodesSelected.length == 0) return true; if (isTenant) return true;
why is returning true for tenants?
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 752 at r2 (raw file):
const activeFilters = calculateActiveFilters(filters); const nodes = isTenant
tenants will have a list of nodes, we just don't show nodes info when is tenant, we hide that and show only region info
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 758 at r2 (raw file):
.sort(); const regions = isTenant
tenants do have regions
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 51 at r2 (raw file):
handleFiltersFromQueryString } from "../queryFilter"; import { merge} from "lodash";
nit: you need the space after merge
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 413 at r2 (raw file):
{ app: filters.app, timeNumber: filters.timeNumber,
ditto: sync only the values you're using on this filter
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 447 at r2 (raw file):
db => { if (regionsSelected.length == 0 && nodesSelected.length == 0) return true; if (isTenant) return true;
same question: why returning true on this case?
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 599 at r2 (raw file):
render(): React.ReactElement { this.columns.find(c => c.name === "nodeRegions").showByDefault = true;
curious: why this change?
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 620 at r2 (raw file):
.sort(); console.log("nodes:", Object.keys(nodeRegions).join(","));
remove this log
pkg/ui/workspaces/db-console/src/views/databases/databasesPage/redux.spec.ts line 201 at r2 (raw file):
lastError: null, name: "system", nodes: [],
if you want to test, you should add actual values for the cases where it loaded and have no error
gtr
left a comment
There was a problem hiding this comment.
Good question! My most recent update makes it so that when you're on the Database details page and change from tables to grants, the filters component gets hidden. The search box still works because it looks at the table name column.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @maryliag)
Previously, maryliag (Marylia Gutierrez) wrote…
Nit: you can't use
Fixesbecause it still needs to be done on CC Console, so this should bePart Of, and you should include on the commit message
Done.
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 51 at r1 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
fixture files are used for testing, if you need a new struct type, it should be created on another location
Good catch! I added a selector for nodeRegions in the Redux layer.
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 372 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
you don't need to sync values that you don't actually show filters for
Removed all the values except nodes and regions.
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 415 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
why is returning true for tenants?
I was under the assumption that if the cluster is a tenant cluster, then the node/region would be irrelevant. Removed this line.
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 752 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
tenants will have a list of nodes, we just don't show nodes info when is tenant, we hide that and show only region info
Oh okay, got it! I removed the isTenant check for this line but added a check to the Filter's showNodes option to only show nodes when it is not a tenant and then the length of the nodes is greater than 1:
showNodes={!isTenant && nodes.length > 1}
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 758 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
tenants do have regions
Fixed.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 51 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
nit: you need the space after
merge
Done.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 413 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
ditto: sync only the values you're using on this filter
Done.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 447 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
same question: why returning true on this case?
Removed this line.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 599 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
curious: why this change?
I left this in by accident! Reverted back.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 620 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
remove this log
Done.
Code quote:
console.log("pkg/ui/workspaces/db-console/src/views/databases/databasesPage/redux.spec.ts line 201 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
if you want to test, you should add actual values for the cases where it loaded and have no error
I added test cases for different nodes:
driver.assertDatabaseProperties("system", {
...
nodes: [1, 2, 4],
...
nodesByRegionString: "undefined(n1,n2,n4)",
...
});But I am unable to define a region; currently it displays undefined.
maryliag
left a comment
There was a problem hiding this comment.
Reviewed 3 of 6 files at r1, 1 of 3 files at r2, 6 of 6 files at r3, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @gtr)
-- commits line 4 at r3:
tip: if you just type #68826 github automatically creates the link for you, so you don't need to worry
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 415 at r2 (raw file):
Previously, gtr (Gerardo Torres Castro) wrote…
I was under the assumption that if the cluster is a tenant cluster, then the node/region would be irrelevant. Removed this line.
The line is still here :)
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 413 at r2 (raw file):
Previously, gtr (Gerardo Torres Castro) wrote…
Done.
Still seeing all the non-used value
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 447 at r2 (raw file):
Previously, gtr (Gerardo Torres Castro) wrote…
Removed this line.
Still seeing
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 611 at r3 (raw file):
} = this.props; console.log("databasesPage.isTenant =", isTenant);
remove this log
pkg/ui/workspaces/db-console/src/views/databases/databasesPage/redux.spec.ts line 380 at r3 (raw file):
}); // function makeStateWithNodeRegions() {
remove unused function/comment
gtr
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @maryliag)
Previously, maryliag (Marylia Gutierrez) wrote…
tip: if you just type
#68826github automatically creates the link for you, so you don't need to worry
Got it! I had done this on the GitHub's description but not the git commit comment.
pkg/ui/workspaces/cluster-ui/src/databaseDetailsPage/databaseDetailsPage.tsx line 415 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
The line is still here :)
Oops, deleted.
Code quote:
if (isTenant) return true;pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 413 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
Still seeing all the non-used value
Done.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 447 at r2 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
Still seeing
Done.
Code quote:
if (isTenant) return true;pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx line 611 at r3 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
remove this log
Done.
pkg/ui/workspaces/db-console/src/views/databases/databasesPage/redux.spec.ts line 380 at r3 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
remove unused function/comment
Done.
Code quote:
makeStateWithNodeRegions()4383f1b to
3fb09f0
Compare
|
Updates on the In order to test the database properties (specifically export function stubNodesUI(
response: cockroach.server.serverpb.INodesResponseExternal,
) {
stubGet(`/nodes_ui`, NodesResponse.encode(response), STATUS_PREFIX);
}The assertion happens after we fill in the database details and node/region info: driver.assertDatabaseProperties("system", {
...
name: "system",
nodes: [1, 2, 4],
sizeInBytes: 7168,
tableCount: 2,
rangeCount: 3,
nodesByRegionString: "gcp-us-east1(n1,n2,n4)",
...
});
driver.assertDatabaseProperties("test", {
...
name: "test",
nodes: [3, 5, 6],
sizeInBytes: 1234,
tableCount: 1,
rangeCount: 42,
nodesByRegionString: "gcp-europe-west1(n3,n6), gcp-europe-west2(n5)",
...
});The next part of testing this function involves recognizing whether the cluster is a tenant cluster. If so, we redact node information and only show the regions for // Hardcoded isTenant value for db-console.
const isTenant = false;However, I modified the functions that generate the The region column and the region filter only displays the region names. However, I'm still not entirely convinced that we should hard code this value since there would be three places where we would have to do so:
|
Part of #68826, #68825. Previously, the databases and databases details pages did not contain search and filter components that the txns and stmts pages did. This change adds search and filter components to both the databases and databases details pages. The search box filters by database/table name while the filter allows filtering by node and region. Release note (ui change): the databases page and the databases details pages each now contain search and filter components, allowing the ability to search and filter through databases and their tables.
maryliag
left a comment
There was a problem hiding this comment.
The value for isTenant is only set when the page comes from CC on the props, but we don't set it when coming from DB console, this way the value will be undefined and when doing checks of isTenant? it will only be true when coming from CC, but undefined from DB console.
Because we only use on the page itself, we don't need to worry about setting a value for DB console, but now because you changed some of the functions definitions/parameter on the redux file, then you indeed need to hard code a value to be passed on.
Reviewed 10 of 10 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @gtr)
Okay that makes sense, TFTR! |
|
bors r+ |
|
Build succeeded: |

Part Of #68826, #68825.
Previously, the databases and databases details pages did not contain
search and filter components that the txns and stmts pages did. This
change adds search and filter components to both the databases and
databases details pages. The search box filters by database/table name
while the filter allows filtering by node and region.
Databases Page video.
Tables Page video.
Release note (ui change): the databases page and the databases details
pages each now contain search and filter components, allowing the
ability to search and filter through databases and their tables.