mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-01 11:34:04 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b1ce61fb8 | |||
| 6c93a41942 | |||
| b4154fdc5b | |||
| ea7de662dc | |||
| cc5b618884 |
@@ -86,7 +86,13 @@ await restartingUpdate.reply(0, snapshot({ operations: { ...operations, canFastU
|
||||
restartingUpdate.feed.action("update", "Dom")
|
||||
assert.equal(preparedUpdates.length, 1, "update intent is saved before the request can disconnect")
|
||||
await restartingUpdate.reply(1, snapshot({ operations: { ...operations, canFastUpdate: true, request: request("update", "pending", "Dom") } }))
|
||||
assert.equal(restartScreens.at(-1).target, "Dom", "accepted updates show the reconnect screen before disconnect")
|
||||
assert.deepEqual(restartScreens, [], "accepted updates keep their progress page visible")
|
||||
restartingUpdate.fire(1000)
|
||||
await restartingUpdate.reply(2, { error: "Updater status is unavailable" }, 503)
|
||||
assert.deepEqual(restartScreens, [], "an updater status error does not mean the device restarted")
|
||||
restartingUpdate.fire(2000)
|
||||
await restartingUpdate.fail(3)
|
||||
assert.equal(restartScreens.at(-1).target, "Dom", "connection loss starts the reconnect screen")
|
||||
restartingUpdate.feed.stop()
|
||||
|
||||
let canceledPreparation = 0
|
||||
|
||||
@@ -128,19 +128,15 @@ kept.recovery.start({ ...baseline, instance: 'one' })
|
||||
kept.recovery.start({ ...baseline, instance: 'two' })
|
||||
assert.equal(JSON.parse(kept.values.get(UPDATE_RESTART_KEY)).instance, 'one')
|
||||
|
||||
// Only update-related restarts/disconnects trigger the full-screen handoff.
|
||||
// Keep update progress visible until Galaxy actually loses the device connection.
|
||||
const restarts = []
|
||||
const feed = new SoftwareStatusFeed({ publish() {}, restarting: value => restarts.push(value) })
|
||||
feed.data = status(baseline.commit, pending)
|
||||
feed.error = 'Connection lost'
|
||||
feed.installBaseline = baseline
|
||||
feed.data = status(baseline.commit, { action: 'update', state: 'pending' })
|
||||
feed.emit('ready')
|
||||
feed.error = 'Updater status is unavailable'
|
||||
feed.emit('ready')
|
||||
assert.equal(restarts.length, 0)
|
||||
feed.installBaseline = baseline
|
||||
feed.error = 'Server rejected request'
|
||||
feed.emit('ready')
|
||||
assert.equal(restarts.length, 1)
|
||||
feed.data.operations.request = null
|
||||
feed.error = 'Connection lost'
|
||||
feed.connectionLost = true
|
||||
feed.emit('ready')
|
||||
assert.equal(restarts.length, 2)
|
||||
assert.deepEqual(restarts, [baseline])
|
||||
|
||||
@@ -101,7 +101,8 @@ createApp({
|
||||
return authState.status === "checking" ? "Connecting…" : "Not connected"
|
||||
},
|
||||
},
|
||||
errorCaptured() {
|
||||
errorCaptured(error, _instance, info) {
|
||||
console.error("Galaxy page error", info, error)
|
||||
if (updateRestart.prepared) updateRestart.start(updateRestart.prepared, { provisional: true })
|
||||
else state.pageError = "This page could not finish loading."
|
||||
return false
|
||||
|
||||
@@ -104,9 +104,7 @@ export class SoftwareStatusFeed {
|
||||
}
|
||||
|
||||
emit(status) {
|
||||
if (this.installBaseline && (this.connectionLost || this.error === "Updater status is unavailable" ||
|
||||
this.data?.operations?.request?.state === "pending" &&
|
||||
["update", "fast", "rollback", "version", "install"].includes(this.data.operations.request.action))) this.restarting(this.installBaseline)
|
||||
if (this.installBaseline && this.connectionLost) this.restarting(this.installBaseline)
|
||||
this.publish({ status, data: this.data, busy: this.busy, uncertain: this.uncertain,
|
||||
notice: this.notice, error: this.error }) }
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ export const ToggleBackup = {
|
||||
},
|
||||
},
|
||||
template: `<section class="gx-card gx-panel gx-stack" :inert="busy" :aria-busy="busy || undefined">
|
||||
<h3>Toggle backup</h3><p class="gx-note">Save your editable toggles, onroad layout and colors. Restore compatible settings while parked.</p>
|
||||
<h3>Toggle backup</h3><p class="gx-note">AAASavesssssss your editable toggles, onroad layout and colors. Restore compatible settings while parked.</p>
|
||||
<div class="gx-actions"><button type="button" class="gx-btn gx-btn--tonal" @click="exportBackup">Back up toggles</button>
|
||||
<button type="button" class="gx-btn gx-btn--tonal" @click="$refs.file.click()">Restore toggles</button>
|
||||
<input ref="file" type="file" accept=".json,application/json" class="gx-sr-only" tabindex="-1" aria-label="Choose toggle backup" @change="chooseFile"></div>
|
||||
|
||||
Reference in New Issue
Block a user