mirror of https://github.com/jetkvm/kvm.git
feat(ota): set updating immediately
This commit is contained in:
parent
5f76e30e55
commit
8113cd40ad
|
|
@ -190,6 +190,9 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error {
|
||||||
return fmt.Errorf("update already in progress")
|
return fmt.Errorf("update already in progress")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.updating = true
|
||||||
|
s.triggerStateUpdate()
|
||||||
|
|
||||||
if len(params.Components) == 0 {
|
if len(params.Components) == 0 {
|
||||||
params.Components = defaultComponents
|
params.Components = defaultComponents
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +201,11 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error {
|
||||||
_, shouldUpdateSystem := params.Components["system"]
|
_, shouldUpdateSystem := params.Components["system"]
|
||||||
|
|
||||||
if !shouldUpdateApp && !shouldUpdateSystem {
|
if !shouldUpdateApp && !shouldUpdateSystem {
|
||||||
return fmt.Errorf("no components to update")
|
return s.componentUpdateError(
|
||||||
|
"Update aborted: no components were specified to update. Requested components: ",
|
||||||
|
fmt.Errorf("%v", params.Components),
|
||||||
|
&scopedLogger,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
appUpdate, systemUpdate, err := s.getUpdateStatus(ctx, params)
|
appUpdate, systemUpdate, err := s.getUpdateStatus(ctx, params)
|
||||||
|
|
|
||||||
|
|
@ -47,17 +47,15 @@ export default function SettingsGeneralUpdateRoute() {
|
||||||
if (appTargetVersion) components.app = appTargetVersion;
|
if (appTargetVersion) components.app = appTargetVersion;
|
||||||
if (systemTargetVersion) components.system = systemTargetVersion;
|
if (systemTargetVersion) components.system = systemTargetVersion;
|
||||||
|
|
||||||
|
setShouldReload(true);
|
||||||
|
setModalView("updating");
|
||||||
|
|
||||||
send("tryUpdateComponents", {
|
send("tryUpdateComponents", {
|
||||||
params: {
|
params: { components, },
|
||||||
components,
|
|
||||||
},
|
|
||||||
includePreRelease: false,
|
includePreRelease: false,
|
||||||
resetConfig,
|
resetConfig,
|
||||||
}, (resp) => {
|
|
||||||
if ("error" in resp) return;
|
|
||||||
setModalView("updating");
|
|
||||||
});
|
});
|
||||||
}, [send, setModalView, resetConfig]);
|
}, [resetConfig, send, setModalView, setShouldReload]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (otaState.updating) {
|
if (otaState.updating) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue