Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml editor #40

Merged
merged 46 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ca01d98
Changed file structure
javier-op Jun 3, 2022
999ffac
Now reads clusters from a json module
javier-op Jun 3, 2022
d99b86d
Added json clusters file to gitignore
javier-op Jun 3, 2022
7597900
Removed log
javier-op Jun 3, 2022
e13c629
Added pagination to GameServerTable
javier-op Jun 6, 2022
8e62e5d
Added timeout for fetch and fixed bug when changing bewtween clusters…
javier-op Jun 6, 2022
6b735c0
Fixed minor bug
javier-op Jun 6, 2022
1e1e46f
Formatting
javier-op Jun 6, 2022
4ab0f19
Added timeouts for requests and refactored error messages
javier-op Jun 7, 2022
030e0c0
Fixed minor bug for GameServers with no nodeName
javier-op Jun 7, 2022
0f8f68f
Added copyable text fields for assigned IP and Ports in the AllocateForm
javier-op Jun 7, 2022
bc21451
Updated readme with the new clusters.json file
javier-op Jun 7, 2022
04c5464
Updated workflow with new json file
javier-op Jun 7, 2022
dd6ae80
Changed command in workflow
javier-op Jun 7, 2022
1b54e5b
minor error
javier-op Jun 7, 2022
8b13a7e
Fixed spec patch form
javier-op Jun 8, 2022
5264f15
Refactored errors
javier-op Jun 8, 2022
4fadb88
Added error message for empty sessionID and fixed minor bug
javier-op Jun 8, 2022
5d87c1c
Extra validations in allocate form
javier-op Jun 8, 2022
d7fc102
Refactored error in AllcoateForm and SpecForm
javier-op Jun 8, 2022
c829b22
Added GameServerBuildCreate
javier-op Jun 10, 2022
9282f78
== clusterApi
javier-op Jun 10, 2022
210db14
Merge branch 'config_json' of github.com:PlayFab/thundernetescp into …
javier-op Jun 10, 2022
13559c7
Fixed error message
javier-op Jun 10, 2022
60b61e2
Added request accepted message
javier-op Jun 10, 2022
f9d0050
Minor fix
javier-op Jun 10, 2022
f1034ba
Now able to read GameServerBuilds from clusters and show them as yaml
javier-op Jun 13, 2022
0c53d35
Minor errors
javier-op Jun 14, 2022
afe9e88
Added buttons to delete GameServerBuilds on table
javier-op Jun 14, 2022
1d2785d
Added buttons to delete GameServers on table
javier-op Jun 14, 2022
7ea967b
Merge branch 'main' of github.com:PlayFab/thundernetescp into yaml_ed…
javier-op Jun 14, 2022
61853d7
Changed error message and fixed dialog transition
javier-op Jun 15, 2022
fbd773b
Removed console.logs
javier-op Jun 15, 2022
9ed8ad4
Fixed typo in endpoint
javier-op Jun 15, 2022
375aae8
Removed another console.log
javier-op Jun 15, 2022
6b12aae
Changed some texts and removed undescriptive aria labels
javier-op Jun 15, 2022
638ba14
More text updates
javier-op Jun 15, 2022
46fcc2c
Fixed error loading default template in GameServerBuildCreate
javier-op Jun 15, 2022
bbdeb54
Changed undefined for false in requestAccepted states
javier-op Jun 15, 2022
6e6ca90
Changed empty table header for one with a visually hidden name
javier-op Jun 16, 2022
0c3e7c8
Minor text and spacing changes
javier-op Jun 17, 2022
da7b507
Inverted button order in delete prompt
javier-op Jun 17, 2022
a3752d7
Added colored circle for heatlh status
javier-op Jun 20, 2022
69ef32c
Changed how we handle closing errors, considering the state as immutable
javier-op Jun 24, 2022
e4440f6
Moved some function inside a useCallback
javier-op Jun 24, 2022
5588d5f
Added useMemo hook in many places to avoid recalculating values
javier-op Jun 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 145 additions & 8 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@monaco-editor/react": "^4.4.5",
"@mui/icons-material": "^5.8.0",
"@mui/material": "^5.8.0",
"@svgr/webpack": "^6.2.1",
Expand All @@ -21,7 +22,8 @@
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"typescript": "^4.6.4",
"web-vitals": "^2.1.4"
"web-vitals": "^2.1.4",
"yaml": "^2.1.1"
},
"overrides": {
"@svgr/webpack": "$@svgr/webpack"
Expand Down
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Routes, Route } from 'react-router-dom';
import { Box, Toolbar } from '@mui/material';
import ClusterDetail from './ClusterDetail/ClusterDetail';
import GameServerBuildCreate from './GameServerBuildCreate/GameServerBuildCreate';
import GameServerBuildDetail from './GameServerBuildDetail/GameServerBuildDetail';
import Home from './Home/Home';
import SideMenu from './Common/SideMenu';
Expand All @@ -17,7 +18,7 @@ function App() {
<Routes>
<Route path="/" element={<Home clusters={clusters} />} />
<Route path=":clusterName" element={<ClusterDetail clusters={clusters} />} />
<Route path=":clusterName/gsb/create" element={<h2>Create Game Server Build</h2>}/>
<Route path=":clusterName/gsb/create" element={<GameServerBuildCreate clusters={clusters}/>}/>
javier-op marked this conversation as resolved.
Show resolved Hide resolved
<Route path=":clusterName/gsb/:namespace/:buildName" element={<GameServerBuildDetail clusters={clusters}/>} />
</Routes>
</Box>
Expand Down
35 changes: 20 additions & 15 deletions src/ClusterDetail/ClusterDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom";
import { Alert, Box, Button, Grid, Typography } from "@mui/material";
import { useParams } from "react-router-dom";
Expand Down Expand Up @@ -67,10 +67,13 @@ function ClusterDetail({ clusters }: ClusterDetailProps) {
});
}, [clusterName, clusterApi]);

const handleCloseAlert = (error: string) => {
errors.delete(error);
setErrors(prev => new Set(prev));
};
const handleCloseAlert = useCallback((error: string) => {
setErrors(prev => {
const newErrors = new Set(prev);
newErrors.delete(error);
return newErrors;
});
}, []);

const groupDataByNode = (gsList: Array<GameServer>) => {
const emptyValues = () => {
Expand Down Expand Up @@ -107,15 +110,17 @@ function ClusterDetail({ clusters }: ClusterDetailProps) {
};
}, [getGameServers, getGameServerBuilds]);

const nodeData = groupDataByNode(gsList);
const errorsArray = Array.from(errors).sort();
const errorMessages = errorsArray.map((error, index) =>
<Box key={index} display="flex" justifyContent="center">
<Alert severity="error" onClose={() => { handleCloseAlert(error) }}>
{error}
</Alert>
</Box>
);
const nodeData = useMemo(() => groupDataByNode(gsList), [gsList]);
const errorMessages = useMemo(() => {
const errorsArray = Array.from(errors).sort();
return errorsArray.map((error, index) =>
<Box key={index} display="flex" justifyContent="center">
<Alert severity="error" onClose={() => { handleCloseAlert(error) }}>
{error}
</Alert>
</Box>
);
}, [errors, handleCloseAlert]);

return (
<React.Fragment>
Expand All @@ -142,7 +147,7 @@ function ClusterDetail({ clusters }: ClusterDetailProps) {
</Grid>
</Grid>
<Box sx={{ marginBottom: "30px" }}>
javier-op marked this conversation as resolved.
Show resolved Hide resolved
<GameServerBuildTable gsbList={gsbList} />
<GameServerBuildTable clusterApi={clusterApi} gsbList={gsbList} />
</Box>
<Typography variant="h5" gutterBottom component="div">
Nodes
Expand Down
Loading