Skip to content

Commit

Permalink
add buf generated package and refactor compmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisibrahimd committed Aug 27, 2022
1 parent 9d3a3e8 commit 43696c5
Show file tree
Hide file tree
Showing 92 changed files with 461 additions and 35,657 deletions.
26 changes: 1 addition & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,7 @@ FROM node:16 AS builder
WORKDIR /app
# Copy all files from current directory to working dir in image
COPY . .
RUN BIN="/usr/local/bin" && \
VERSION="3.15.8" && \
BINARY_NAME="protoc" && \
echo "${BINARY_NAME}-${VERSION}-$(uname -s)-$(uname -m).zip" && \
curl -LO \
"https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/${BINARY_NAME}-${VERSION}-$(uname -s)-$(uname -m).zip" && \
unzip "${BINARY_NAME}-${VERSION}-$(uname -s)-$(uname -m).zip" -d /tmp && \
cp "/tmp/bin/${BINARY_NAME}" "${BIN}/${BINARY_NAME}" && \
chmod +x "${BIN}/${BINARY_NAME}"
# install protoc-gen-grpc-web
RUN BIN="/usr/local/bin" && \
VERSION="1.3.0" && \
BINARY_NAME="protoc-gen-grpc-web" && \
curl -sSL \
"https://github.com/grpc/grpc-web/releases/download/${VERSION}/${BINARY_NAME}-${VERSION}-$(uname -s)-$(uname -m)" \
-o "${BIN}/${BINARY_NAME}" && \
chmod +x "${BIN}/${BINARY_NAME}"
# install buf
RUN BIN="/usr/local/bin" && \
VERSION="1.0.0-rc10" && \
BINARY_NAME="buf" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/${BINARY_NAME}-$(uname -s)-$(uname -m)" \
-o "${BIN}/${BINARY_NAME}" && \
chmod +x "${BIN}/${BINARY_NAME}"

# Only install production packages
RUN npm install
# Build app
Expand Down
52 changes: 46 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@buf/grpc_web_scoretrak_scoretrakapis": "^1.7.5",
"@date-io/core": "^1.3.13",
"@material-table/core": "^4.3.44",
"@material-ui/core": "^4.11.3",
Expand Down
3 changes: 0 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { createTheme } from "@material-ui/core";
import { useTitle } from "react-use";
import { usePaletteType } from "./contexts/PaletteTypeContext";
import { Route, Routes } from "react-router-dom";
import { TitleContextProvider } from "./contexts/BannerTitleContext";
import DefaultLayout from "./layouts/DefaultLayout";
import AuthLayout from "./layouts/AuthLayout";
import SignIn from "./routes/auth/sign_in";
Expand Down Expand Up @@ -65,7 +64,6 @@ function App() {
>
<PolicyProvider>
<ReportProvider>
<TitleContextProvider>
<Routes>
<Route path={"/"} element={<ScoreboardLayout />}>
<Route index element={<Scoreboard />} />
Expand All @@ -85,7 +83,6 @@ function App() {
<Route index element={<Settings />} />
</Route>
</Routes>
</TitleContextProvider>
</ReportProvider>
</PolicyProvider>
</SnackbarProvider>
Expand Down
7 changes: 1 addition & 6 deletions src/components/MainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,20 @@ import Typography from "@material-ui/core/Typography";
import AppBar from "@material-ui/core/AppBar";
import { makeStyles } from "@material-ui/core/styles";
import { Brightness4, Brightness7 } from "@material-ui/icons";
import { Box, Button, Container, Menu, MenuItem, useTheme } from "@material-ui/core";
import { Box, Button, Container, useTheme } from "@material-ui/core";
import { usePaletteType } from "../contexts/PaletteTypeContext";
import { useBannerTitle } from "../contexts/BannerTitleContext";
import { Role, token } from "../grpc/token/token";
import SettingsIcon from "@material-ui/icons/Settings";
import DescriptionIcon from "@material-ui/icons/Description";
import BarChartIcon from "@material-ui/icons/BarChart";
import DetailsIcon from "@material-ui/icons/Details";
import {
Link as RouterLink,
NavigateOptions,
To,
useNavigate,
} from "react-router-dom";
import { useReport } from "../contexts/ReportContext";
import CheckCircleIcon from "@material-ui/icons/CheckCircle";
import { usePolicy } from "../contexts/PolicyContext";
import { MouseEvent, useState } from "react";

const useStyles = makeStyles((_) => ({
root: {
Expand All @@ -42,7 +38,6 @@ export function MainNav() {
const theme = useTheme();
const { togglePaletteType } = usePaletteType();
const classes = useStyles();
const { bannerTitle } = useBannerTitle();
const navigate = useNavigate();

const handleLogout = () => {
Expand Down
6 changes: 2 additions & 4 deletions src/components/MaterialTables/HostGroupMaterialTable.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { useEffect, useState } from "react";
import Box from "@material-ui/core/Box";
import MaterialTable, { Column } from "@material-table/core";
import { Severity } from "../../types/types";
import { CircularProgress } from "@material-ui/core";
import { UUID } from "../../lib/scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { UUID } from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/proto/v1/uuid_pb";
import {
DeleteRequest,
StoreRequest,
UpdateRequest,
} from "../../lib/scoretrakapis/scoretrak/host_group/v1/host_group_pb";
} from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/host_group/v1/host_group_pb";
import { useSnackbar } from "notistack";
import { SnackbarDismissButton } from "../SnackbarDismissButton";
import {
Expand Down
4 changes: 2 additions & 2 deletions src/components/MaterialTables/HostMaterialTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
DeleteRequest,
StoreRequest,
UpdateRequest,
} from "../../lib/scoretrakapis/scoretrak/host/v1/host_pb";
import { UUID } from "../../lib/scoretrakapis/scoretrak/proto/v1/uuid_pb";
} from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/host/v1/host_pb";
import { UUID } from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { CircularProgress } from "@material-ui/core";
import { IHost } from "../../types/material_table";
import {
Expand Down
4 changes: 2 additions & 2 deletions src/components/MaterialTables/PropertyMaterialTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
DeleteRequest,
StoreRequest,
UpdateRequest,
} from "../../lib/scoretrakapis/scoretrak/property/v1/property_pb";
} from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/property/v1/property_pb";
import Box from "@material-ui/core/Box";
import { UUID } from "../../lib/scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { UUID } from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { CircularProgress } from "@material-ui/core";
import {
useAddPropertyMutation,
Expand Down
8 changes: 4 additions & 4 deletions src/components/MaterialTables/ServiceGroupMenuTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
RedeployRequest,
StoreRequest,
UpdateRequest,
} from "../../lib/scoretrakapis/scoretrak/service_group/v1/service_group_pb";
import { UUID } from "../../lib/scoretrakapis/scoretrak/proto/v1/uuid_pb";
} from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/service_group/v1/service_group_pb";
import { UUID } from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/proto/v1/uuid_pb";
import MaterialTable, { Column } from "@material-table/core";
import { Box, CircularProgress } from "@material-ui/core";
import { CircularProgress } from "@material-ui/core";
import { useSnackbar } from "notistack";
import { SnackbarDismissButton } from "../SnackbarDismissButton";
import { gRPCClients } from "../../grpc/gRPCClients";
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function ServiceGroupMaterialTable() {
icon: "replay",
tooltip: "redeploy workers",
onClick: (event, rowData) => {
return gRPCClients.serviceGroupClient
return gRPCClients.service_group.v1.serviceGroupServicePromiseClient
.redeploy(
new RedeployRequest().setId(
new UUID().setValue(
Expand Down
14 changes: 5 additions & 9 deletions src/components/MaterialTables/ServiceMaterialTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
StoreRequest,
TestServiceRequest,
UpdateRequest,
} from "../../lib/scoretrakapis/scoretrak/service/v1/service_pb";
import { UUID } from "../../lib/scoretrakapis/scoretrak/proto/v1/uuid_pb";
} from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/service/v1/service_pb";
import { UUID } from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { CircularProgress } from "@material-ui/core";
import { gRPCClients } from "../../grpc/gRPCClients";
import { IService } from "../../types/material_table";
Expand Down Expand Up @@ -38,13 +38,9 @@ export function ServiceMaterialTable() {
} = useServicesQuery();
const {
data: serviceGroupsData,
isLoading: serviceGroupsIsLoading,
isSuccess: serviceGroupsIsSuccess,
} = useServiceGroupsQuery();
const {
data: hostsData,
isLoading: hostsIsLoading,
isSuccess: hostsIsSuccess,
} = useHostsQuery();

const addService = useAddServiceMutation();
Expand Down Expand Up @@ -126,7 +122,7 @@ export function ServiceMaterialTable() {
setColumns((prevState) => {
for (let i = 0; i < prevState.length; i++) {
const column = prevState[i];
if (column.title == "Service Group ID") {
if (column.title === "Service Group ID") {
column.lookup = lookup;
}
}
Expand All @@ -150,7 +146,7 @@ export function ServiceMaterialTable() {
setColumns((prevState) => {
for (let i = 0; i < prevState.length; i++) {
const column = prevState[i];
if (column.title == "Host ID") {
if (column.title === "Host ID") {
column.lookup = lookup;
}
}
Expand All @@ -170,7 +166,7 @@ export function ServiceMaterialTable() {
icon: "flash_on",
tooltip: "test service",
onClick: (event, rowData) => {
return gRPCClients.serviceClient
return gRPCClients.service.v1.serviceServicePromiseClient
.testService(
new TestServiceRequest().setId(
new UUID().setValue((rowData as IService).id as string)
Expand Down
9 changes: 2 additions & 7 deletions src/components/MaterialTables/TeamMaterialTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@ import MaterialTable, { Column } from "@material-table/core";
import {
DeleteRequest,
StoreRequest,
Team,
UpdateRequest,
} from "../../lib/scoretrakapis/scoretrak/team/v1/team_pb";
} from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/team/v1/team_pb";
import { Severity } from "../../types/types";
import { SnackbarDismissButton } from "../SnackbarDismissButton";
import { UUID } from "../../lib/scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { UUID } from "@buf/grpc_web_scoretrak_scoretrakapis/scoretrak/proto/v1/uuid_pb";
import { CircularProgress } from "@material-ui/core";
import {
BoolValue,
UInt64Value,
} from "google-protobuf/google/protobuf/wrappers_pb";
import { ITeam } from "../../types/material_table";
import {
useAddTeamMutation,
Expand Down
Loading

0 comments on commit 43696c5

Please sign in to comment.