ui-console: Consolidate a bit of code, slightly reduce upstream diff.