[webui] move common code into mixins
[webui] continue refactoring the top smells