Add .js side checks for hostname != nil.

Please see https://github.com/opentechinstitute/luci-commotion/issues/159 for instructions.