Fix subvariation display, progress bar, and linked-instrument discard
- ast-parser: read for_value= prop for sub-variations (was always null,
causing fallback to positional "subvariation N" label)
- StatusPoller: calculate progress from currently_rendered_notes /
notes_in_total; show remaining_time string from status.json
- ShapeEditor/EnvelopeEditor: pass { undo } through onChange so callers
can revert in-place mutations
- PaneFO: makeChangeHandler stashes undo from info arg; discardEdit
calls undo() before clearing pendingEdit; depends_on handler provides
its own undo for the inline node.dependsOn mutation
This commit is contained in:
@@ -1,35 +1,20 @@
|
||||
import { h, ref, onMounted, onUnmounted } from 'vue';
|
||||
import { h, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { fetchStatus } from '../api.js';
|
||||
|
||||
export const StatusPoller = {
|
||||
props: ['store'],
|
||||
setup(props) {
|
||||
const timer = ref(null);
|
||||
const eta = ref(null);
|
||||
|
||||
function nextInterval(status) {
|
||||
if (!status) return 2000;
|
||||
const pct = status.progress ?? 0;
|
||||
// At 0–20%: poll at centile-of-ETA intervals
|
||||
if (eta.value && pct > 0 && pct <= 20) {
|
||||
return Math.max(500, (eta.value * 10) | 0);
|
||||
}
|
||||
return 2000;
|
||||
}
|
||||
|
||||
async function poll() {
|
||||
try {
|
||||
const status = await fetchStatus(props.store.credentials);
|
||||
if (status.eta) eta.value = status.eta;
|
||||
props.store.synthesisStatus = status;
|
||||
if (status.frozen) {
|
||||
// done — stop polling
|
||||
return;
|
||||
}
|
||||
if (status.frozen) return;
|
||||
} catch (_) {
|
||||
// transient error — keep polling
|
||||
// transient — keep polling
|
||||
}
|
||||
timer.value = setTimeout(poll, nextInterval(props.store.synthesisStatus));
|
||||
timer.value = setTimeout(poll, 2000);
|
||||
}
|
||||
|
||||
onMounted(() => { poll(); });
|
||||
@@ -39,10 +24,16 @@ export const StatusPoller = {
|
||||
const s = props.store.synthesisStatus;
|
||||
if (!s) return h('div', { class: 'se-status' }, 'Polling…');
|
||||
|
||||
const pct = s.progress ?? 0;
|
||||
const label = s.frozen
|
||||
? (s.error ? `Error: ${s.error}` : 'Done')
|
||||
: `${s.state ?? 'Running'} ${pct}%`;
|
||||
const total = s.notes_in_total ?? 0;
|
||||
const done = s.currently_rendered_notes ?? 0;
|
||||
const pct = total > 0 ? Math.min(100, Math.round(done / total * 100)) : 0;
|
||||
|
||||
let label;
|
||||
if (s.frozen) {
|
||||
label = s.errors ? `Error: ${s.errors}` : 'Done';
|
||||
} else {
|
||||
label = s.remaining_time ?? `Synthesizing… ${pct}%`;
|
||||
}
|
||||
|
||||
return h('div', { class: 'se-status' }, [
|
||||
h('span', null, label),
|
||||
|
||||
Reference in New Issue
Block a user