Refine machine details layout and improve download feedback
This commit is contained in:
parent
5f7efa13e6
commit
1251468b77
6 changed files with 96 additions and 10 deletions
|
|
@ -188,6 +188,7 @@ function App() {
|
|||
const [isMachineActive, setIsMachineActive] = useState(true)
|
||||
const [showSecret, setShowSecret] = useState(false)
|
||||
const [isLaunchingSystem, setIsLaunchingSystem] = useState(false)
|
||||
const [tokenValidationTick, setTokenValidationTick] = useState(0)
|
||||
const [, setIsValidatingToken] = useState(false)
|
||||
const tokenVerifiedRef = useRef(false)
|
||||
|
||||
|
|
@ -246,6 +247,7 @@ function App() {
|
|||
if (res.ok) {
|
||||
tokenVerifiedRef.current = true
|
||||
setStatus("online")
|
||||
setTokenValidationTick((tick) => tick + 1)
|
||||
try {
|
||||
await invoke("start_machine_agent", {
|
||||
baseUrl: apiBaseUrl,
|
||||
|
|
@ -290,9 +292,15 @@ function App() {
|
|||
} else {
|
||||
// Não limpa token em falhas genéricas (ex.: rede); apenas informa
|
||||
setError("Falha ao validar sessão da máquina. Tente novamente.")
|
||||
tokenVerifiedRef.current = true
|
||||
setTokenValidationTick((tick) => tick + 1)
|
||||
}
|
||||
} catch (err) {
|
||||
if (!cancelled) console.error("Falha ao validar token (rede)", err)
|
||||
if (!cancelled) {
|
||||
console.error("Falha ao validar token (rede)", err)
|
||||
tokenVerifiedRef.current = true
|
||||
setTokenValidationTick((tick) => tick + 1)
|
||||
}
|
||||
} finally {
|
||||
if (!cancelled) setIsValidatingToken(false)
|
||||
}
|
||||
|
|
@ -731,7 +739,7 @@ function App() {
|
|||
autoLaunchRef.current = true
|
||||
setIsLaunchingSystem(true)
|
||||
openSystem()
|
||||
}, [token, status, config?.accessRole, openSystem])
|
||||
}, [token, status, config?.accessRole, openSystem, tokenValidationTick])
|
||||
|
||||
if (isLaunchingSystem && token) {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue