diff --git a/src/mol-plugin/context.ts b/src/mol-plugin/context.ts index 26fb5b3a2f32e1d6db2838800d9cc7ac21250c4c..17cd0f5eddb3f8617f2f41ac038f44de15363019 100644 --- a/src/mol-plugin/context.ts +++ b/src/mol-plugin/context.ts @@ -146,7 +146,7 @@ export class PluginContext { tree.toRoot().apply(b.transformer, b.defaultParams, { ref: b.transformer.id }); } - await this.runTask(this.state.behaviorState.update(tree)); + await this.runTask(this.state.behaviorState.update(tree, true)); } initDataActions() { diff --git a/src/mol-state/state.ts b/src/mol-state/state.ts index 9aa7fa3c958495f109e00ee7bab624bff98f8c46..9733c06add1823d77dcef5785eb3dfe878783532 100644 --- a/src/mol-state/state.ts +++ b/src/mol-state/state.ts @@ -118,7 +118,7 @@ class State { }); } - update(tree: StateTree | StateTreeBuilder): Task<void> { + update(tree: StateTree | StateTreeBuilder, silent: boolean = false): Task<void> { const _tree = (StateTreeBuilder.is(tree) ? tree.getTree() : tree).asTransient(); return Task.create('Update Tree', async taskCtx => { let updated = false; @@ -139,6 +139,8 @@ class State { results: [], + silent, + changed: false, hadError: false, newCurrent: void 0 @@ -209,6 +211,9 @@ interface UpdateContext { results: UpdateNodeResult[], + // suppress timing messages + silent: boolean, + changed: boolean, hadError: boolean, newCurrent?: Ref @@ -492,13 +497,13 @@ async function updateSubtree(ctx: UpdateContext, root: Ref) { ctx.results.push(update); if (update.action === 'created') { isNull = update.obj === StateObject.Null; - if (!isNull) ctx.parent.events.log.next(LogEntry.info(`Created ${update.obj.label} in ${formatTimespan(time)}.`)); + if (!isNull && !ctx.silent) ctx.parent.events.log.next(LogEntry.info(`Created ${update.obj.label} in ${formatTimespan(time)}.`)); } else if (update.action === 'updated') { isNull = update.obj === StateObject.Null; - if (!isNull) ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`)); + if (!isNull && !ctx.silent) ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`)); } else if (update.action === 'replaced') { isNull = update.obj === StateObject.Null; - if (!isNull) ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`)); + if (!isNull && !ctx.silent) ctx.parent.events.log.next(LogEntry.info(`Updated ${update.obj.label} in ${formatTimespan(time)}.`)); } } catch (e) { ctx.changed = true;