Update loading khi mới dô trang
This commit is contained in:
parent
2382ab1f6f
commit
4bffffa920
|
|
@ -132,9 +132,10 @@ export class WebSocketIo {
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
const listLine = Array.from(this.lineMap.values())
|
||||||
io.to(socket.id).emit(
|
io.to(socket.id).emit(
|
||||||
'init',
|
'init',
|
||||||
Array.from(this.lineMap.values()).map((el) => {
|
listLine.map((el) => {
|
||||||
const config = el?.config || {}
|
const config = el?.config || {}
|
||||||
if (config.status !== 'connected') {
|
if (config.status !== 'connected') {
|
||||||
config.runningScenario = ''
|
config.runningScenario = ''
|
||||||
|
|
@ -1120,11 +1121,11 @@ export class WebSocketIo {
|
||||||
userOpenCLI: '',
|
userOpenCLI: '',
|
||||||
openCLI: false,
|
openCLI: false,
|
||||||
listFeatureTested: [''],
|
listFeatureTested: [''],
|
||||||
|
output: line.config.output.slice(0, 5000) || '',
|
||||||
},
|
},
|
||||||
} as LineConnection)
|
} as LineConnection)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
lineMap: newMap ? [...newMap.entries()] : [],
|
lineMap: newMap ? [...newMap.entries()] : [],
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import {
|
||||||
Grid,
|
Grid,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
LoadingOverlay,
|
LoadingOverlay,
|
||||||
|
Loader,
|
||||||
|
Box,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import type {
|
import type {
|
||||||
FileInfo,
|
FileInfo,
|
||||||
|
|
@ -106,6 +108,7 @@ function App() {
|
||||||
const [listCategories, setListCategories] = useState<TCategories[]>([]);
|
const [listCategories, setListCategories] = useState<TCategories[]>([]);
|
||||||
const [listIos, setListIos] = useState<FileInfo[]>([]);
|
const [listIos, setListIos] = useState<FileInfo[]>([]);
|
||||||
const [listLicense, setListLicense] = useState<FileInfo[]>([]);
|
const [listLicense, setListLicense] = useState<FileInfo[]>([]);
|
||||||
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const connectApcSwitch = (station: TStation) => {
|
const connectApcSwitch = (station: TStation) => {
|
||||||
if (!station?.is_active) return;
|
if (!station?.is_active) return;
|
||||||
|
|
@ -227,6 +230,12 @@ function App() {
|
||||||
getListLicense();
|
getListLicense();
|
||||||
}, [socket]);
|
}, [socket]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsLoading(false);
|
||||||
|
}, 3000);
|
||||||
|
}, [socket]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!socket || !stations?.length) return;
|
if (!socket || !stations?.length) return;
|
||||||
|
|
||||||
|
|
@ -640,7 +649,19 @@ function App() {
|
||||||
style={{ overflowX: "hidden" }}
|
style={{ overflowX: "hidden" }}
|
||||||
className={componentClasses.hideScrollBar}
|
className={componentClasses.hideScrollBar}
|
||||||
>
|
>
|
||||||
{station.lines.length > 0 ? (
|
{isLoading ? (
|
||||||
|
<Box
|
||||||
|
style={{
|
||||||
|
height: "15vh",
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Loader color="blue" />
|
||||||
|
</Box>
|
||||||
|
) : station.lines.length > 0 ? (
|
||||||
station.lines.length < 9 ? (
|
station.lines.length < 9 ? (
|
||||||
<Grid
|
<Grid
|
||||||
gutter="md"
|
gutter="md"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue