cad stability
This commit is contained in:
parent
f59bb9d801
commit
fe714b1123
40 changed files with 1655 additions and 49 deletions
|
@ -0,0 +1,57 @@
|
|||
|
||||
import { Button } from 'antd';
|
||||
import * as React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { HttpRepository, HttpMethod, HttpRoute } from '../../core/repository/http_repository';
|
||||
|
||||
|
||||
export const pathStabilityScreen = '/stability/preview/usecase/'
|
||||
|
||||
interface IStabilityCheckResponce {
|
||||
status: "rejected" | "fulfilled";
|
||||
value: undefined | string;
|
||||
index: number;
|
||||
}
|
||||
interface IStability {
|
||||
status: boolean;
|
||||
detail: string;
|
||||
}
|
||||
|
||||
export const StabilityPreviewScreen: React.FunctionComponent = () => {
|
||||
const id = useParams().id
|
||||
const [stabilityResult, setStability] = React.useState<IStability[] | null>(null);
|
||||
React.useEffect(() => {
|
||||
const stabilityCheck = async () => {
|
||||
const result = await HttpRepository.jsonRequest<Array<string>>(HttpMethod.GET, '/' + id + '/generation/step-structure.json')
|
||||
const promises = []
|
||||
for (let i = 0; i !== result.length; i++) {
|
||||
const stabilitySubId = i + 1
|
||||
promises.push(HttpRepository.jsonRequest<Array<string>>(HttpMethod.GET, '/' + id + '/generation/stability/' + stabilitySubId + '/geometry.json'))
|
||||
}
|
||||
const stabilityCheck = await (await Promise.allSettled(promises)).map<IStability>((element, index) => {
|
||||
return {
|
||||
status: element.status === 'fulfilled' ? true : false,
|
||||
detail: result[index],
|
||||
}
|
||||
})
|
||||
setStability(stabilityCheck)
|
||||
};
|
||||
stabilityCheck()
|
||||
}, []);
|
||||
return (<div>
|
||||
{stabilityResult != null ? (<>
|
||||
{stabilityResult.map((el, index) => {
|
||||
return (<div><div>{el.detail}</div> <div>{el.status ? (<>Sucses</>) : (<><Button onClick={async () => {
|
||||
await HttpRepository.jsonRequest(HttpMethod.POST, '/assembly/stability/write/computed', {
|
||||
"id": id,
|
||||
"buildNumber": (index + 1).toString()
|
||||
})
|
||||
}}>need input </Button></>)}</div> </div>)
|
||||
})}
|
||||
|
||||
</>) : (<div>loading</div>)}
|
||||
|
||||
</div>);
|
||||
};
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue