Skip to content

Commit

Permalink
v1.0.0-beta3
Browse files Browse the repository at this point in the history
* Fix bug in export when rule-number is unknown
  • Loading branch information
tkoopman committed May 16, 2018
1 parent b15bd42 commit 10b8ea3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions psCheckPoint/Extra/Export/ExportTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@
function (o) { return o.type == n; }
);
if (sortProperty) {
objs = objs.sort(function (x, y) { return x[sortProperty].localeCompare(y[sortProperty]); });
objs = objs.sort(function (x, y) {
if (x[sortProperty] && y[sortProperty]) {
return x[sortProperty].localeCompare(y[sortProperty]);
} else if (x[sortProperty]) { return 1; }
else if (y[sortProperty]) { return -1; }
else { return 0; }
});
}

return objs;
Expand Down Expand Up @@ -355,15 +361,19 @@
}
}
function compareRuleNumbers(a, b) {
var c = a.split(".");
var d = b.split(".");
var i;
for (i = 0; i < Math.min(c.length, d.length); i++) {
var diff = parseInt(c[i]) - parseInt(d[i]);
if (diff !== 0) { return diff; }
}
if (a & b) {
var c = a.split(".");
var d = b.split(".");
var i;
for (i = 0; i < Math.min(c.length, d.length); i++) {
var diff = parseInt(c[i]) - parseInt(d[i]);
if (diff !== 0) { return diff; }
}

return c.length - d.length;
return c.length - d.length;
} else if (a) { return 1; }
else if (b) { return -1; }
else { return 0; }
}
function onLoad() {
jsonData = RestoreJsonNetReferences(JSON.parse(document.getElementById('data').innerHTML));
Expand Down Expand Up @@ -421,7 +431,7 @@
accessRules += packageRules.length;
});
} else {
var objs = getObjectsByType("access-rule", "rule-number");
var objs = getObjectsByType("access-rule").sort(function (x, y) { return compareRuleNumbers(x["rule-number"], y["rule-number"]); });
if (objs) {
var layers = [];
objs.forEach(function (o) {
Expand Down
2 changes: 1 addition & 1 deletion psCheckPoint/psCheckPoint.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CheckPoint.NET" Version="0.3.7" />
<PackageReference Include="CheckPoint.NET" Version="0.3.8" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.6'">
Expand Down

0 comments on commit 10b8ea3

Please sign in to comment.