message: Monitoring: Small clean up of poller code
diff: @@ -885,7 +885,8 @@ export class MonitoringUI extends React.Component<null, null> {
  poller();
  };
  - const {prometheusBaseURL} = (window as any).SERVER_FLAGS;
  + const {alertManagerBaseURL, prometheusBaseURL} = (window as any).SERVER_FLAGS;
  +
  if (prometheusBaseURL) {
  poll(`${prometheusBaseURL}/api/v1/rules`, 'alerts', data => {
  // Flatten the rules data to make it easier to work with, discard non-alerting rules since those are the only
  @@ -915,12 +916,7 @@ export class MonitoringUI extends React.Component<null, null> {
  store.dispatch(UIActions.monitoringErrored('alerts', new Error('prometheusBaseURL not set')));
  }
  - const {alertManagerBaseURL} = (window as any).SERVER_FLAGS;
  - if (!alertManagerBaseURL) {
  - store.dispatch(UIActions.monitoringErrored('silences', new Error('alertManagerBaseURL not set')));
  - return;
  - }
  -
  + if (alertManagerBaseURL) {
  poll(`${alertManagerBaseURL}/api/v1/silences`, 'silences', data => {
  // Set a name field on the Silence to make things easier
  _.each(data, s => {
  @@ -932,6 +928,9 @@ export class MonitoringUI extends React.Component<null, null> {
  });
  return data;
  });
  + } else {
  + store.dispatch(UIActions.monitoringErrored('silences', new Error('alertManagerBaseURL not set')));
  + }
  }
  componentWillUnmount() {
  