added server state option
This commit is contained in:
parent
cda0d0a159
commit
36659fea46
@ -442,16 +442,8 @@ export const SERVER_ACTIONS: ActionInfo[] = [
|
||||
requestType: "post",
|
||||
endpoint: "/servers/{server_id}/start",
|
||||
permissions: Permission.Start,
|
||||
response_action: "Ignore"
|
||||
},
|
||||
{
|
||||
name: "Terminal",
|
||||
args: {
|
||||
},
|
||||
requestType: "post",
|
||||
endpoint: "/servers/{server_id}/attach",
|
||||
permissions: Permission.RunCommand,
|
||||
response_action: "Terminal"
|
||||
response_action: "Ignore",
|
||||
ServerState: "off",
|
||||
},
|
||||
{
|
||||
name: "Stop",
|
||||
@ -465,7 +457,18 @@ export const SERVER_ACTIONS: ActionInfo[] = [
|
||||
requestType: "post",
|
||||
endpoint: "/servers/{server_id}/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",
|
||||
@ -500,7 +503,8 @@ export const SERVER_ACTIONS: ActionInfo[] = [
|
||||
requestType: "post",
|
||||
endpoint: "/servers/{server_id}/run_command",
|
||||
permissions: Permission.RunCommand,
|
||||
response_action: "Ignore"
|
||||
response_action: "Ignore",
|
||||
ServerState: "on",
|
||||
},
|
||||
{
|
||||
name: "Browse",
|
||||
|
@ -114,6 +114,7 @@ export interface ActionInfo {
|
||||
args: {}
|
||||
permissions?: number
|
||||
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.Ports.map((port, index, array) => { return <Chip label={`${port.Number}/${port.Protocol}`} /> })}</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>
|
||||
</TableRow>
|
||||
</actionIdentifierContext.Provider>
|
||||
|
Loading…
x
Reference in New Issue
Block a user