Simplify prometheus_metrics and its tests
From https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8434#note_119158757
ee/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js has a lot of repetitive lines for hide/show classes. This is hard to read/understand, and very error prone. Can mean we forget to hide an element sometimes, or hide everything and have a blank screen.
I suggest changing to:
// $els is all the `.find` things at the top
hideAll() {
this.$els.forEach(e => e.addClass('hidden'))
}
setVisible(...els) {
this.hideAll()
els.forEach(el => el.removeClass('hidden'))
}
// later in the file
case PANEL_STATE.NO_INTEGRATION:
this.setVisible(this.customMetricsNoIntegrationText, this.customMetricsNoIntegrationText)
default:
this.setVisible(this.monitoredCustomMetricsEmpty)
Can make a similar change for the karma test.