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")
|
||||
}
|
||||
|
||||
s.updating = true
|
||||
s.triggerStateUpdate()
|
||||
|
||||
if len(params.Components) == 0 {
|
||||
params.Components = defaultComponents
|
||||
}
|
||||
|
|
@ -198,7 +201,11 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error {
|
|||
_, shouldUpdateSystem := params.Components["system"]
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -47,17 +47,15 @@ export default function SettingsGeneralUpdateRoute() {
|
|||
if (appTargetVersion) components.app = appTargetVersion;
|
||||
if (systemTargetVersion) components.system = systemTargetVersion;
|
||||
|
||||
setShouldReload(true);
|
||||
setModalView("updating");
|
||||
|
||||
send("tryUpdateComponents", {
|
||||
params: {
|
||||
components,
|
||||
},
|
||||
params: { components, },
|
||||
includePreRelease: false,
|
||||
resetConfig,
|
||||
}, (resp) => {
|
||||
if ("error" in resp) return;
|
||||
setModalView("updating");
|
||||
});
|
||||
}, [send, setModalView, resetConfig]);
|
||||
}, [resetConfig, send, setModalView, setShouldReload]);
|
||||
|
||||
useEffect(() => {
|
||||
if (otaState.updating) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue