|
@@ -81,7 +81,10 @@
|
|
|
}
|
|
|
|
|
|
$("#httpProxyList").append(`<tr eptuuid="${subd.RootOrMatchingDomain}" payload="${subdData}" class="subdEntry">
|
|
|
- <td data-label="" editable="true" datatype="inbound"><a href="//${subd.RootOrMatchingDomain}" target="_blank">${subd.RootOrMatchingDomain}</a> ${inboundTlsIcon}</td>
|
|
|
+ <td data-label="" editable="true" datatype="inbound">
|
|
|
+ <a href="//${subd.RootOrMatchingDomain}" target="_blank">${subd.RootOrMatchingDomain}</a> ${inboundTlsIcon}<br>
|
|
|
+ <small class="accessRuleNameUnderHost" ruleid="${subd.AccessFilterUUID}"></small>
|
|
|
+ </td>
|
|
|
<td data-label="" editable="true" datatype="domain">${subd.Domain} ${tlsIcon}</td>
|
|
|
<td data-label="" editable="true" datatype="vdir">${vdList}</td>
|
|
|
<td data-label="" editable="true" datatype="basicauth">
|
|
@@ -98,9 +101,65 @@
|
|
|
</tr>`);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ resolveAccessRuleNameOnHostRPlist();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ //Resolve & Update all rule names on host PR list
|
|
|
+ function resolveAccessRuleNameOnHostRPlist(){
|
|
|
+ //Resolve the access filters
|
|
|
+ $.get("/api/access/list", function(data){
|
|
|
+ console.log(data);
|
|
|
+ if (data.error == undefined){
|
|
|
+ //Build a map base on the data
|
|
|
+ let accessRuleMap = {};
|
|
|
+ for (var i = 0; i < data.length; i++){
|
|
|
+ accessRuleMap[data[i].ID] = data[i];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $(".accessRuleNameUnderHost").each(function(){
|
|
|
+ let thisAccessRuleID = $(this).attr("ruleid");
|
|
|
+ if (thisAccessRuleID== ""){
|
|
|
+ thisAccessRuleID = "default"
|
|
|
+ }
|
|
|
+
|
|
|
+ if (thisAccessRuleID == "default"){
|
|
|
+ //No need to label default access rules
|
|
|
+ $(this).html("");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let rule = accessRuleMap[thisAccessRuleID];
|
|
|
+ let icon = `<i class="ui grey filter icon"></i>`;
|
|
|
+ if (rule.ID == "default"){
|
|
|
+ icon = `<i class="ui yellow star icon"></i>`;
|
|
|
+ }else if (rule.BlacklistEnabled && !rule.WhitelistEnabled){
|
|
|
+ //This is a blacklist filter
|
|
|
+ icon = `<i class="ui red filter icon"></i>`;
|
|
|
+ }else if (rule.WhitelistEnabled && !rule.BlacklistEnabled){
|
|
|
+ //This is a whitelist filter
|
|
|
+ icon = `<i class="ui green filter icon"></i>`;
|
|
|
+ }else if (rule.WhitelistEnabled && rule.BlacklistEnabled){
|
|
|
+ //Whitelist and blacklist filter
|
|
|
+ icon = `<i class="ui yellow filter icon"></i>`;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rule != undefined){
|
|
|
+ $(this).html(`${icon} ${rule.Name}`);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ //Update the access rule name on given epuuid, call by hostAccessEditor.html
|
|
|
+ function updateAccessRuleNameUnderHost(epuuid, newruleUID){
|
|
|
+ $(`tr[eptuuid='${epuuid}'].subdEntry`).find(".accessRuleNameUnderHost").attr("ruleid", newruleUID);
|
|
|
+ resolveAccessRuleNameOnHostRPlist();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
Inline editor for httprp.html
|