Skip to content

Commit

Permalink
Allow disabling SpawningPool apis
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebual committed Dec 31, 2022
1 parent aba1870 commit 7b0ecb6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
- chat
- sort Cards by most recently running
- EditCard.js can probably derive the list of games that support SpawningPool from Gateway, who can learn it based on gameApis reporting the feature
- Allow disabling SpawningPool instances (visible only in Edit Mode)

# Dev Guide

Expand Down
3 changes: 3 additions & 0 deletions gateway/src/routes/spawningPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ async function initSpawningPool() {
const spawningPools = await readSpawningPoolConfig();
for (let childApi of Object.values(spawningPools)) {
console.log("Checking child gameApi ", childApi.gameId);
if (childApi.disabled) {
continue;
}
try {
const { data } = await axios.get(
`http://localhost:${childApi.apiPort}/control`
Expand Down
11 changes: 11 additions & 0 deletions ui/src/components/EditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { css } from "@emotion/react";
import { TextField } from "@mui/material";
import { useStaticQuery, graphql } from "gatsby";
import Autocomplete from "@mui/material/Autocomplete";
import Switch from "@mui/material/Switch";
import FormControlLabel from "@mui/material/FormControlLabel";

const gameApiOptions = [
{
Expand Down Expand Up @@ -236,6 +238,15 @@ export default function EditCard({
</Grid>
</CardContent>
<CardActions>
<FormControlLabel
control={
<Switch
onChange={() => patchSettings({ disabled: !settings.disabled })}
checked={!settings.disabled}
/>
}
label="Enabled"
/>
<Button
color="primary"
css={css`
Expand Down

0 comments on commit 7b0ecb6

Please sign in to comment.