From 35c45cc87c908cc93b7246fc600ebf0f900f26d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20Tomi=C4=87?= Date: Mon, 24 Jul 2023 14:29:04 +0000 Subject: [PATCH] chore(dashboard): Remove non-working dialog to Create Subnet --- .../components/subnets/AddSubnetDialog.tsx | 116 ------------------ .../src/components/subnets/AvailableNodes.tsx | 2 - 2 files changed, 118 deletions(-) delete mode 100644 dashboard/packages/app/src/components/subnets/AddSubnetDialog.tsx diff --git a/dashboard/packages/app/src/components/subnets/AddSubnetDialog.tsx b/dashboard/packages/app/src/components/subnets/AddSubnetDialog.tsx deleted file mode 100644 index fb19ae2e..00000000 --- a/dashboard/packages/app/src/components/subnets/AddSubnetDialog.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import React from 'react'; -import Button from '@material-ui/core/Button'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; -import { CodeSnippet } from '@backstage/core-components'; -import { Chip, Divider, Grid, List, ListItem, ListItemText, Typography } from '@material-ui/core'; -import { Node } from './types'; -import { useQuery } from 'react-query'; -import { useApi, configApiRef } from '@backstage/core-plugin-api'; - -const subnetSize = 13; - - -const generateSubnet = () => { - const config = useApi(configApiRef); - const { data } = useQuery("create_subnet", () => - fetch( - `${config.getString('backend.baseUrl')}/api/proxy/registry/create_subnet?size=${subnetSize}` - ).then((res) => res.json()) - ); - return data ?? []; -} - -const generateCreateSubnetInstructions = (nodes: Node[]) => { - return ` -./mainnet-op propose-to-create-subnet SUBNET_NUMBER \\ - ${nodes.map(n => n.principal).join(" \\\n ")} -`; -} - -export default function AddSubnetDialog() { - const [open, setOpen] = React.useState(false); - const subnetNodes = generateSubnet(); - - const handleClickOpen = () => { - setOpen(true); - }; - - const handleClose = () => { - setOpen(false); - }; - - return ( - - - - New subnet - - - {subnetNodes.map(n => - - - - )} - - - - - - Provider count: {new Set(subnetNodes.map(n => n.operator.provider.principal)).size} - - {subnetNodes.map(n => n.operator.provider.principal).reduce((r: { name: string, count: number }[], c) => { - let entry = r.find(p => p.name == c); - if (entry === undefined) { - r.push({ name: c, count: 0 }) - } - r.find(p => p.name == c)!.count++; - return r - }, []).map(p => - - - - )} - - - - - Operator count: {new Set(subnetNodes.map(n => n.operator.principal)).size} - - {subnetNodes.map(n => n.operator.datacenter?.owner?.name).reduce((r: { name: string, count: number }[], c) => { - let entry = r.find(p => p.name == c); - if (entry === undefined) { - r.push({ name: c || "Unknown", count: 0 }) - } - r.find(p => p.name == c)!.count++; - return r - }, []).map(p => - - - - )} - - - - - - - - - - - ); -} diff --git a/dashboard/packages/app/src/components/subnets/AvailableNodes.tsx b/dashboard/packages/app/src/components/subnets/AvailableNodes.tsx index 3690fa35..2120e226 100644 --- a/dashboard/packages/app/src/components/subnets/AvailableNodes.tsx +++ b/dashboard/packages/app/src/components/subnets/AvailableNodes.tsx @@ -7,7 +7,6 @@ import { Button, Chip, Dialog, DialogActions, DialogContent, DialogContentText, import { Node, Operator, Guest, NodeHealth } from './types'; import CheckCircleOutlineIcon from '@material-ui/icons/CheckCircleOutline'; import { green, blue, red, grey, lightBlue, orange } from '@material-ui/core/colors'; -import AddSubnetDialog from './AddSubnetDialog'; import ErrorOutlineSharpIcon from '@material-ui/icons/ErrorOutlineSharp'; import ReportProblemOutlinedIcon from '@material-ui/icons/ReportProblemOutlined'; import HelpOutlineOutlinedIcon from '@material-ui/icons/HelpOutlineOutlined'; @@ -169,7 +168,6 @@ function TabPanel({ - healths[n.principal] != "Healthy")} />