<script>
  var config = {
        metric: null,
        resource: '<%= @resource.uuid -%>',
        resourceQualifier: '<%= @resource.qualifier -%>',
        rule: <% if @rule %>'<%= @rule.key -%>'<% else %>null<% end %>,
        severity: <% if @severity %>'<%= @severity -%>'<% else %>null<% end %>,
        periodDate: <% if @period %>'<%= @snapshot.period_datetime(@period) -%>'<% else %>null<% end %>
      },
      url = window.baseUrl + '/component_issues/index?id=<%= @resource.key -%>#resolved=false';
  if (config.rule) {
    url = url + '|rules=' + config.rule;
  }
  if (config.severity) {
    url = url + '|severities=' + config.severity;
  }
  if (config.periodDate) {
    var createdAfter = moment(config.periodDate).format('YYYY-MM-DD');
    url = url + '|createdAfter=' + createdAfter;
  }
  window.location = url;
</script>
