Compare commits
No commits in common. "v0.0.6" and "main" have entirely different histories.
@ -6,12 +6,6 @@ export interface Port {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface PortMapping {
|
|
||||||
ContainerPort: number
|
|
||||||
HostPort: number
|
|
||||||
Protocol: 'tcp' | 'udp'
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ImageInfo {
|
export interface ImageInfo {
|
||||||
Id: string
|
Id: string
|
||||||
Name: string
|
Name: string
|
||||||
@ -26,7 +20,7 @@ export interface ServerInfo {
|
|||||||
On: boolean
|
On: boolean
|
||||||
OwnerId: string
|
OwnerId: string
|
||||||
Image: ImageInfo
|
Image: ImageInfo
|
||||||
Ports: PortMapping[] | null
|
Ports: Port[] | null
|
||||||
Domain: string
|
Domain: string
|
||||||
Nickname?: string
|
Nickname?: string
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { AxiosInstance } from "axios"
|
import { AxiosInstance } from "axios"
|
||||||
import { ActionGroup, ActionInfo, DataTable, UserInfoContext, actionIdentifierContext, api, apiAuthenticatedContext} from "./common"
|
import { ActionGroup, ActionInfo, DataTable, UserInfoContext, actionIdentifierContext, api, apiAuthenticatedContext} from "./common"
|
||||||
import { Context, Dispatch, createContext, useContext, useEffect, useState } from "react"
|
import React, { Context, Dispatch, createContext, useContext, useEffect, useState } from "react"
|
||||||
import { TableRow, TableCell, Chip } from "@mui/material"
|
import { TableRow, TableCell, Chip } from "@mui/material"
|
||||||
import { PortMapping, ServerInfo } from "./interfaces"
|
import { ImageInfo, ServerInfo } from "./interfaces"
|
||||||
|
import { JSONSchema7 } from "json-schema"
|
||||||
import { CREATE_SERVER_ACTION, Permission, SERVER_ACTIONS } from "./actions"
|
import { CREATE_SERVER_ACTION, Permission, SERVER_ACTIONS } from "./actions"
|
||||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -18,12 +18,6 @@ export async function loadServers(api: AxiosInstance): Promise<{ status: number,
|
|||||||
|
|
||||||
const serverActionsContext: Context<ActionInfo[]> = createContext([] as ActionInfo[])
|
const serverActionsContext: Context<ActionInfo[]> = createContext([] as ActionInfo[])
|
||||||
|
|
||||||
function generateChipHandler(domain: string, port: PortMapping) {
|
|
||||||
return () => {
|
|
||||||
navigator.clipboard.writeText(`${domain}:${port.HostPort}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function ServerItem(props: { server_info: ServerInfo }) {
|
function ServerItem(props: { server_info: ServerInfo }) {
|
||||||
const actions = useContext(serverActionsContext)
|
const actions = useContext(serverActionsContext)
|
||||||
@ -60,7 +54,7 @@ function ServerItem(props: { server_info: ServerInfo }) {
|
|||||||
<TableCell>{props.server_info.Image.Name}</TableCell>
|
<TableCell>{props.server_info.Image.Name}</TableCell>
|
||||||
<TableCell>{props.server_info.Image.Version}</TableCell>
|
<TableCell>{props.server_info.Image.Version}</TableCell>
|
||||||
<TableCell>{props.server_info.Domain}</TableCell>
|
<TableCell>{props.server_info.Domain}</TableCell>
|
||||||
<TableCell>{props.server_info.Ports.map((port, index, array) => { return <Chip onClick={generateChipHandler(props.server_info.Domain, port)} label={`${port.HostPort}:${port.ContainerPort}/${port.Protocol}`} icon={<ContentCopyIcon />} /> })}</TableCell>
|
<TableCell>{props.server_info.Ports.map((port, index, array) => { return <Chip label={`${port.Number}/${port.Protocol}`} /> })}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<ActionGroup actions={actions.filter((value)=>{
|
<ActionGroup actions={actions.filter((value)=>{
|
||||||
switch (value.ServerState){
|
switch (value.ServerState){
|
||||||
@ -70,8 +64,7 @@ function ServerItem(props: { server_info: ServerInfo }) {
|
|||||||
return !props.server_info.On
|
return !props.server_info.On
|
||||||
case "on":
|
case "on":
|
||||||
return props.server_info.On
|
return props.server_info.On
|
||||||
}
|
}})} identifierSubstring="server_id" />
|
||||||
})} identifierSubstring="server_id" />
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</actionIdentifierContext.Provider>
|
</actionIdentifierContext.Provider>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user