generalize show/hide loading spinner