Commit 5a38b4e7 authored by PidgeyL's avatar PidgeyL
Browse files

finish moving all statusses to the status file

parent 4f8be263
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -675,14 +675,11 @@ def listManagementAdd():
            version = getVersionsOfProduct(product)
        else:
            product = (getBrowseList(vendor))['product']
        if added:
            status = ["cpe_added", "success"]
        else:
            status = ["cpe_not_added", "error"]
        status = "added_to_list" if added else "could_not_add_to_list"
    else:
        browseList = getBrowseList(None)
        vendor = browseList['vendor']
        status = ["invalid_cpe_format", "error"]
        status = "invalid_cpe"
    j={"status":status, "listType":listType}
    return jsonify(j)

@@ -704,8 +701,7 @@ def listManagement(vendor=None, product=None):
        else:
            # product selected, product versions required
            version = getVersionsOfProduct(urllib.parse.quote_plus(product).lower())
        status = ["default", "none"]
        return render_template('listmanagement.html', status=status, vendor=vendor, product=product, version=version)
        return render_template('listmanagement.html', vendor=vendor, product=product, version=version)
    except redisExceptions.ConnectionError:
        return render_template('error.html',
                               status={'except':'redis-connection',
+0 −1
Original line number Diff line number Diff line
@@ -81,7 +81,6 @@ function addItem(cpetype) {
  clear(listType);
}
function fillTable(data){
  alert('in here');
  var rules=data['rules'];
  $("#cpes > tbody > tr").remove();
  $("#keywords > tbody > tr").remove();
+5 −3
Original line number Diff line number Diff line
function addCPE(list, item){
  alert("ok")
  var url = "/admin/listmanagement/add/"+list+"/"+btoa(item);
  window.location = url;
  $.getJSON('/admin/listmanagement/add', {
    list:list, item:item
  }, function(data) {
    parseStatus(data);
  });
}
+0 −1
Original line number Diff line number Diff line
{% extends 'layouts/master-page' %}
{% block title %}{{ listType }} management{% endblock %}
{% block head %}
  <!-- javascript -->
  <script type="text/javascript" src="/static/js/custom/list.js"></script>
{% endblock %}
{% block content %}
+1 −32
Original line number Diff line number Diff line
{% extends 'layouts/master-page' %}
{% block title %}CPE browser{% endblock %}
{% block head %}
  <script type="text/javascript">
    function addCPE(list, item){
      $.getJSON('/admin/listmanagement/add', {
        list:list, item:item
      }, function(data) {
        $("#status").removeClass();
        $("#status_icon").removeClass();
        if(data['status'][1] =='success'){
          $("#status").addClass("alert alert-success");
          $("#status_icon").addClass("glyphicon glyphicon-ok-sign");
        }else if (data['status'][1] =='info'){
          $("#status").addClass("alert alert-info");
          $("#status_icon").addClass("glyphicon glyphicon-info-sign");
        }else if (data['status'][1] =='warning'){
          $("#status").addClass("alert alert-warning");
          $("#status_icon").addClass("glyphicon glyphicon-warning-sign");
        }else if (data['status'][1] =='error'){
          $("#status").addClass("alert alert-danger");
          $("#status_icon").addClass("glyphicon glyphicon-remove-sign");
        }
        $("#status_message").empty();
        if(data['status'][0] =='cpe_added'){
			$("#status_message").append("Product added to the "+data["listType"]);
		}else if(data['status'][0] == 'cpe_not_added'){
			$("#status_message").append("Failed to add the product to the "+data["listType"]);
		}else if(data['status'][0] == 'invalid_cpe_format'){
			$("#status_message").append("The entered CPE format is invalid");
		}
		$("#status").removeTemporaryClass("hidden", 3000);
      });
    }
  </script>
  <script type="text/javascript" src="/static/js/custom/list.js"></script>
{% endblock %}
{% block content %}
  <!-- breadcrumb -->