added server state option
This commit is contained in:
parent
cda0d0a159
commit
36659fea46
@ -442,16 +442,8 @@ export const SERVER_ACTIONS: ActionInfo[] = [
|
|||||||
requestType: "post",
|
requestType: "post",
|
||||||
endpoint: "/servers/{server_id}/start",
|
endpoint: "/servers/{server_id}/start",
|
||||||
permissions: Permission.Start,
|
permissions: Permission.Start,
|
||||||
response_action: "Ignore"
|
response_action: "Ignore",
|
||||||
},
|
ServerState: "off",
|
||||||
{
|
|
||||||
name: "Terminal",
|
|
||||||
args: {
|
|
||||||
},
|
|
||||||
requestType: "post",
|
|
||||||
endpoint: "/servers/{server_id}/attach",
|
|
||||||
permissions: Permission.RunCommand,
|
|
||||||
response_action: "Terminal"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Stop",
|
name: "Stop",
|
||||||
@ -465,7 +457,18 @@ export const SERVER_ACTIONS: ActionInfo[] = [
|
|||||||
requestType: "post",
|
requestType: "post",
|
||||||
endpoint: "/servers/{server_id}/stop",
|
endpoint: "/servers/{server_id}/stop",
|
||||||
permissions: Permission.Stop,
|
permissions: Permission.Stop,
|
||||||
response_action: "Ignore"
|
response_action: "Ignore",
|
||||||
|
ServerState: "on",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Terminal",
|
||||||
|
args: {
|
||||||
|
},
|
||||||
|
requestType: "post",
|
||||||
|
endpoint: "/servers/{server_id}/attach",
|
||||||
|
permissions: Permission.RunCommand,
|
||||||
|
response_action: "Terminal",
|
||||||
|
ServerState: "on",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Delete Server",
|
name: "Delete Server",
|
||||||
@ -500,7 +503,8 @@ export const SERVER_ACTIONS: ActionInfo[] = [
|
|||||||
requestType: "post",
|
requestType: "post",
|
||||||
endpoint: "/servers/{server_id}/run_command",
|
endpoint: "/servers/{server_id}/run_command",
|
||||||
permissions: Permission.RunCommand,
|
permissions: Permission.RunCommand,
|
||||||
response_action: "Ignore"
|
response_action: "Ignore",
|
||||||
|
ServerState: "on",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Browse",
|
name: "Browse",
|
||||||
|
@ -114,6 +114,7 @@ export interface ActionInfo {
|
|||||||
args: {}
|
args: {}
|
||||||
permissions?: number
|
permissions?: number
|
||||||
response_action?: 'Ignore' | 'Browse' | 'Terminal'
|
response_action?: 'Ignore' | 'Browse' | 'Terminal'
|
||||||
|
ServerState?: 'on' | 'off'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,15 @@ function ServerItem(props: { server_info: ServerInfo }) {
|
|||||||
<TableCell>{props.server_info.Domain}</TableCell>
|
<TableCell>{props.server_info.Domain}</TableCell>
|
||||||
<TableCell>{props.server_info.Ports.map((port, index, array) => { return <Chip label={`${port.Number}/${port.Protocol}`} /> })}</TableCell>
|
<TableCell>{props.server_info.Ports.map((port, index, array) => { return <Chip label={`${port.Number}/${port.Protocol}`} /> })}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<ActionGroup actions={actions} identifierSubstring="server_id" />
|
<ActionGroup actions={actions.filter((value, _, _)=>{
|
||||||
|
switch (value.ServerState){
|
||||||
|
case undefined:
|
||||||
|
return true
|
||||||
|
case "off":
|
||||||
|
return !props.server_info.On
|
||||||
|
case "on":
|
||||||
|
return props.server_info.On
|
||||||
|
}})} identifierSubstring="server_id" />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</actionIdentifierContext.Provider>
|
</actionIdentifierContext.Provider>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user