{% extends "layout2.html" %} {% load i18n %} {% load static %} {% block css_include %} {% endblock %} {% block js_include %} {% endblock %} {% block content %}

 {% translate "Multi-Tenants" %}

{% endblock %} {% block jquery_code %} var aoColumns = [ { sTitle: "ID", name: "id", aTargets: [0], defaultContent: "", mData: "id", bVisible: false }, { sTitle: '{% translate "Name" %}', name: "name", aTargets: [1], defaultContent: "", mData: "name", mRender: function(data, type, row){ if( row.internal ) return data+"*"; return data; } }, { sTitle: '{% translate "Associated CTI feeds" %}', name: "reputation_contexts", aTargets: [2], defaultContent: "", mData: "reputation_contexts" }, { sTitle: '{% translate "Associated listeners" %}', name: "frontends", aTargets: [3], defaultContent: "", mData: "frontends", mRender: function(data, type, row){ var result = ""; } }, { sTitle: '{% translate "Action" %}', mData:"id", aTargets: [4], defaultContent: "", mRender: function(data, type, row) { var res = ''; if( row.frontends.length == 0 && !row.internal ) { res += ' ' + ''; } return res; } } ]; var tenant_table = $("#tenant_list").dataTable({ bServerSide : true, order : [[1, 'desc']], iDisplayLength: 10, bProcessing : true, bSort : true, sAjaxSource : '', sServerMethod : 'POST', aoColumnDefs: aoColumns, language: language_datatable, fnServerData : function(sSource, aoData, fnCallback){ var columns = []; for (var i in aoColumns){ columns.push(aoColumns[i].mData); } aoData.push({ name: 'columns', value: JSON.stringify(columns) }) $.ajax({ type : "POST", url : sSource, data : aoData, success: function(data, callback){ if (check_json_error(data)) fnCallback(data); } }) }, fnCreatedRow: function(nRow, aData, iDataIndex){ /* Events binding to edit a tenants */ $(nRow).on('click', 'td', function(e) { if (e.target.tagName !== "TD") return; const url = "{% url 'system.tenants.edit' %}" + aData.id /* Open a tenants edition in a new tab with ctrl click */ if (e.ctrlKey || e.metaKey) { window.open(url, '_blank'); } else { window.location.href = url; } }); // /$(nRow).on('click', 'td' /* Open a tenants edition in a new tab with middle click */ $(nRow).on('mousedown', 'td', function(e){ if (e.target.tagName === "TD" && e.button === 1) { window.open("{% url 'system.tenants.edit' %}" + aData.id, '_blank'); } }); // /$(nRow).on('mousedown', 'td' } }); {% endblock %}