Only change the UI file when needed

Refs #10626