Skip to content

Commit

Permalink
[FIX] Fixed a potential memory leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
MakarovS96 committed Aug 21, 2017
1 parent f3460c2 commit 0feb52c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 34 deletions.
62 changes: 33 additions & 29 deletions csp/src/controller/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
}

function checkDepends(cur_filter) {
var dep = false; //The result of the dependency test.

if (cur_filter.active) {
cur_filter.dependsOn = "";
return;
Expand All @@ -68,40 +70,42 @@
for (var i = 0; i < $scope.model.filters.length; i++) {
if ($scope.model.filters[i].dependsOn) {
if ($scope.model.filters[i].active && !$scope.model.filters[i].dependsOn.localeCompare(cur_filter.name)) {
dep = true;
break;
}
}
}

var instance = $uibModal.open({
templateUrl: 'src/view/warningModal.html',
controller: 'warning',
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
animation: true,
size: 'sm',
resolve: {
filter: function () {
return cur_filter;
}
}
});

instance.result.then(function () {
if (dep) {
var instance = $uibModal.open({
templateUrl: 'src/view/warningModal.html',
controller: 'warning',
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
animation: true,
size: 'sm',
resolve: {
filter: function () {
return cur_filter;
}
}
});

for (var i = 0; i < $scope.model.filters.length; i++) {
if ($scope.model.filters[i].dependsOn === null) {
$scope.model.filters[i].dependsOn = "";
}
}
}, function () {
instance.result.then(function () {

for (var i = 0; i < $scope.model.filters.length; i++) {
if ($scope.model.filters[i].dependsOn === null) {
$scope.model.filters[i].dependsOn = cur_filter.name;
}
}
});
for (var i = 0; i < $scope.model.filters.length; i++) {
if ($scope.model.filters[i].dependsOn === null) {
$scope.model.filters[i].dependsOn = "";
}
}
}, function () {

break;
for (var i = 0; i < $scope.model.filters.length; i++) {
if ($scope.model.filters[i].dependsOn === null) {
$scope.model.filters[i].dependsOn = cur_filter.name;
}
}
}
});
}
}

Expand Down
13 changes: 9 additions & 4 deletions csp/src/view/sql.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
<div class="row">
<div class="col-md-offset-3 col-md-6">
<div class="row text-center">
<i>The first column of the query will be used as the <a
href="http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2MODADV_ch_kpi#D2MODADV_kpi_result_set"
target="_blank"
>KPI Series</a>.</i>
<div>
<i>The first column of the query will be used as the <a
href="http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=D2MODADV_ch_kpi#D2MODADV_kpi_result_set"
target="_blank"
>KPI Series</a>.</i>
</div>
<div>
<i>Please, don't use aliases in your SQL queries, otherwise the operation of dynamically generated filters may be incorrect. </i>
</div>
</div>

<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "SQLKPI",
"author": "Makarov S.D",
"version": "0.1.0",
"version": "0.1.1",
"devDependencies": {
"del": "^3.0.0",
"gulp": "github:gulpjs/gulp#4.0",
Expand Down

0 comments on commit 0feb52c

Please sign in to comment.