From bb6de6e586126bb0fc8be9b9082c6999533fb492 Mon Sep 17 00:00:00 2001 From: Sara Bee <855595+doeg@users.noreply.github.com> Date: Thu, 4 Nov 2021 08:31:33 -0400 Subject: [PATCH 1/3] Add /vtctlds view Signed-off-by: Sara Bee <855595+doeg@users.noreply.github.com> --- web/vtadmin/src/api/http.ts | 11 +++ web/vtadmin/src/components/App.tsx | 5 ++ web/vtadmin/src/components/NavRail.tsx | 6 +- web/vtadmin/src/components/routes/Vtctlds.tsx | 90 +++++++++++++++++++ web/vtadmin/src/hooks/api.ts | 7 ++ web/vtadmin/src/index.css | 4 + 6 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 web/vtadmin/src/components/routes/Vtctlds.tsx diff --git a/web/vtadmin/src/api/http.ts b/web/vtadmin/src/api/http.ts index 28fb132a161..574f91f8371 100644 --- a/web/vtadmin/src/api/http.ts +++ b/web/vtadmin/src/api/http.ts @@ -149,6 +149,17 @@ export const fetchGates = async () => }, }); +export const fetchVtctlds = async () => + vtfetchEntities({ + endpoint: '/api/vtctlds', + extract: (res) => res.result.vtctlds, + transform: (e) => { + const err = pb.Vtctld.verify(e); + if (err) throw Error(err); + return pb.Vtctld.create(e); + }, + }); + export interface FetchKeyspaceParams { clusterID: string; name: string; diff --git a/web/vtadmin/src/components/App.tsx b/web/vtadmin/src/components/App.tsx index 4b98686a360..615060fae26 100644 --- a/web/vtadmin/src/components/App.tsx +++ b/web/vtadmin/src/components/App.tsx @@ -34,6 +34,7 @@ import { Keyspace } from './routes/keyspace/Keyspace'; import { Tablet } from './routes/tablet/Tablet'; import { Backups } from './routes/Backups'; import { Shard } from './routes/shard/Shard'; +import { Vtctlds } from './routes/Vtctlds'; export const App = () => { return ( @@ -85,6 +86,10 @@ export const App = () => { + + + + diff --git a/web/vtadmin/src/components/NavRail.tsx b/web/vtadmin/src/components/NavRail.tsx index 3586740d196..fc3b6572b13 100644 --- a/web/vtadmin/src/components/NavRail.tsx +++ b/web/vtadmin/src/components/NavRail.tsx @@ -18,7 +18,7 @@ import { Link, NavLink } from 'react-router-dom'; import style from './NavRail.module.scss'; import logo from '../img/vitess-icon-color.svg'; -import { useClusters, useGates, useKeyspaces, useSchemas, useTablets, useWorkflows } from '../hooks/api'; +import { useClusters, useGates, useKeyspaces, useSchemas, useTablets, useVtctlds, useWorkflows } from '../hooks/api'; import { Icon, Icons } from './Icon'; import { getTableDefinitions } from '../util/tableDefinitions'; @@ -28,6 +28,7 @@ export const NavRail = () => { const { data: gates = [] } = useGates(); const { data: schemas = [] } = useSchemas(); const { data: tablets = [] } = useTablets(); + const { data: vtctlds = [] } = useVtctlds(); const { data: workflows = [] } = useWorkflows(); const tds = React.useMemo(() => getTableDefinitions(schemas), [schemas]); @@ -65,6 +66,9 @@ export const NavRail = () => {
  • +
  • + +
  • diff --git a/web/vtadmin/src/icons/index.tsx b/web/vtadmin/src/icons/index.tsx index 9ddad6ebe32..464257fb194 100644 --- a/web/vtadmin/src/icons/index.tsx +++ b/web/vtadmin/src/icons/index.tsx @@ -40,6 +40,7 @@ export { ReactComponent as KeyK } from './keyK.svg'; export { ReactComponent as KeyR } from './keyR.svg'; export { ReactComponent as KeyS } from './keyS.svg'; export { ReactComponent as KeyT } from './keyT.svg'; +export { ReactComponent as KeyV } from './keyV.svg'; export { ReactComponent as Keyboard } from './keyboard.svg'; export { ReactComponent as Link } from './link.svg'; export { ReactComponent as PageFirst } from './pageFirst.svg'; diff --git a/web/vtadmin/src/icons/keyV.svg b/web/vtadmin/src/icons/keyV.svg new file mode 100644 index 00000000000..07cc33d99e2 --- /dev/null +++ b/web/vtadmin/src/icons/keyV.svg @@ -0,0 +1,4 @@ + + + +