|
|
@ -13,8 +13,9 @@ import FactCheckOutlined from "@mui/icons-material/FactCheckOutlined" |
|
|
|
import {Box, CircularProgress, IconButton, LinearProgress, TableContainer, Table, TableBody, TableCell, TableHead, TableRow, TablePagination} from "@mui/material" |
|
|
|
import {Box, CircularProgress, IconButton, LinearProgress, TableContainer, Table, TableBody, TableCell, TableHead, TableRow, TablePagination} from "@mui/material" |
|
|
|
import ConfirmDialog from "../confirm-dialog"; |
|
|
|
import ConfirmDialog from "../confirm-dialog"; |
|
|
|
import smClient from "../../../api/sm/sm-client"; |
|
|
|
import smClient from "../../../api/sm/sm-client"; |
|
|
|
import {ProcessesResponseInterface, Status} from "../../../api/sm/responses/processes"; |
|
|
|
import {ProcessInterface, Status} from "../../../api/sm/responses/processes"; |
|
|
|
import Command, {CommandInterface} from "../commands/elements/command"; |
|
|
|
import Command from "../commands/elements/command"; |
|
|
|
|
|
|
|
import {CommandInterface} from "../../../api/sm/responses/comamnds"; |
|
|
|
|
|
|
|
|
|
|
|
enum Action { |
|
|
|
enum Action { |
|
|
|
Run, |
|
|
|
Run, |
|
|
@ -26,14 +27,14 @@ enum Action { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default function Processes() { |
|
|
|
export default function Processes() { |
|
|
|
const [processes, setProcesses] = useState<ProcessesResponseInterface[]>([]); |
|
|
|
const [processes, setProcesses] = useState<ProcessInterface[]>([]); |
|
|
|
const [page, setPage] = useState<number>(0); |
|
|
|
const [page, setPage] = useState<number>(0); |
|
|
|
const [count, setCount] = useState<number>(0); |
|
|
|
const [count, setCount] = useState<number>(0); |
|
|
|
const [loading, setLoading] = useState<boolean>(true); |
|
|
|
const [loading, setLoading] = useState<boolean>(true); |
|
|
|
const [modalLoading, setModalLoading] = useState<boolean>(true); |
|
|
|
const [modalLoading, setModalLoading] = useState<boolean>(true); |
|
|
|
const [action, setAction] = useState<Action | null>(null); |
|
|
|
const [action, setAction] = useState<Action | null>(null); |
|
|
|
const [command, setCommand] = useState<CommandInterface | null>(null); |
|
|
|
const [command, setCommand] = useState<CommandInterface | null>(null); |
|
|
|
const [selectedProcess, setSelectedProcess] = useState<ProcessesResponseInterface | null>(null); |
|
|
|
const [selectedProcess, setSelectedProcess] = useState<ProcessInterface | null>(null); |
|
|
|
const [optionList, setOptionList] = useState<Record<string, any>>({}); |
|
|
|
const [optionList, setOptionList] = useState<Record<string, any>>({}); |
|
|
|
const [argumentList, setArgumentList] = useState<Record<string, any>>({}); |
|
|
|
const [argumentList, setArgumentList] = useState<Record<string, any>>({}); |
|
|
|
|
|
|
|
|
|
|
@ -52,7 +53,7 @@ export default function Processes() { |
|
|
|
setLoading(false) |
|
|
|
setLoading(false) |
|
|
|
refreshLock = false |
|
|
|
refreshLock = false |
|
|
|
} |
|
|
|
} |
|
|
|
let output = async (process: ProcessesResponseInterface) => { |
|
|
|
let output = async (process: ProcessInterface) => { |
|
|
|
const { data: output } = await smClient.getProcessOutput({ |
|
|
|
const { data: output } = await smClient.getProcessOutput({ |
|
|
|
id: process.id |
|
|
|
id: process.id |
|
|
|
}) |
|
|
|
}) |
|
|
@ -76,13 +77,13 @@ export default function Processes() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, [action]); |
|
|
|
}, [action]); |
|
|
|
|
|
|
|
|
|
|
|
let isFinished = (process: ProcessesResponseInterface) => process.cancelledAt || process.completedAt |
|
|
|
let isFinished = (process: ProcessInterface) => process.cancelledAt || process.completedAt |
|
|
|
|
|
|
|
|
|
|
|
const handleChangePage = (event: any, page: number) => { |
|
|
|
const handleChangePage = (event: any, page: number) => { |
|
|
|
setPage(page); |
|
|
|
setPage(page); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const openDialog = (process: ProcessesResponseInterface, action: Action) => { |
|
|
|
const openDialog = (process: ProcessInterface, action: Action) => { |
|
|
|
setSelectedProcess(process) |
|
|
|
setSelectedProcess(process) |
|
|
|
setAction(action) |
|
|
|
setAction(action) |
|
|
|
} |
|
|
|
} |
|
|
@ -144,7 +145,7 @@ export default function Processes() { |
|
|
|
</TableRow> |
|
|
|
</TableRow> |
|
|
|
</TableHead> |
|
|
|
</TableHead> |
|
|
|
<TableBody> |
|
|
|
<TableBody> |
|
|
|
{processes.map((process: ProcessesResponseInterface, index: number) => ( |
|
|
|
{processes.map((process: ProcessInterface, index: number) => ( |
|
|
|
<TableRow key={process.id}> |
|
|
|
<TableRow key={process.id}> |
|
|
|
<TableCell>{process.name}</TableCell> |
|
|
|
<TableCell>{process.name}</TableCell> |
|
|
|
<TableCell> |
|
|
|
<TableCell> |
|
|
|