Skip to content

Commit

Permalink
Firewall policy wizard bug fixes and comments
Browse files Browse the repository at this point in the history
1) Checkbox selection retains in grid though row is deleted successfully
2) Remove Tags Tab from Unwanted places in modal popups
3) Look for ways to keep global-applicaiton-policy-set as first row
4) Code clean up

Related-Bug: #1727927
Closes-Bug: #1730282
Change-Id: Id5f8a84123f452e3808c4a22d162812a2db20c32
(cherry picked from commit 5f464c2)
  • Loading branch information
Akhil committed Nov 7, 2017
1 parent 59cf1f7 commit b761384
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 122 deletions.
Expand Up @@ -58,7 +58,7 @@ define([
document.getElementById(modalId));
kbValidation.bind(self, {collection:
self.model.model().attributes.subnetCollection});
},null,true);
},null,true,false);
},
renderDeleteAddressGrp: function(options) {
var delTemplate =
Expand Down
Expand Up @@ -76,38 +76,6 @@ define([
);
}));
rowActionConfig.push(ctwgc.getDeleteAction(function (rowIndex) {
if(viewConfig.isWizard){
fwzUtils.appendDeleteContainer($(arguments[1].context).parent()[0], 'fw-policy-wizard-global-grid-id', true);
$(".cancelWizardDeletePopup").off('click').on('click', function(){
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
});
$(".saveWizardRecords").off('click').on('click', function(){
var dataItem = $('#' + ctwc.FW_POLICY_GRID_ID).data('contrailGrid')._dataView.getItem(rowIndex);
var model = new FWPolicyModel();
model.deleteFWPolicies([dataItem], {
success: function () {
$('#' + ctwc.FW_POLICY_GRID_ID).
data('contrailGrid')._dataView.refreshData();
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
},
error: function (error) {
$("#grid-details-error-container").text('');
$("#grid-details-error-container").text(error.responseText);
$(".aps-details-error-container").show();
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
}
});
});
}else{
var dataItem = $(gridElId).data("contrailGrid").
_dataView.getItem(rowIndex),
fwPolicyModel = new FWPolicyModel(dataItem),
Expand All @@ -123,7 +91,6 @@ define([
}
}
);
}
}));
if(viewConfig.isWizard){
var options = [];
Expand Down Expand Up @@ -239,66 +206,7 @@ define([
}
}
];
if(viewConfig.isWizard == true){
var headerActionConfig = [
{
"type" : "link",
"title" : ctwl.TITLE_FW_POLICY_MULTI_DELETE,
"iconClass": 'fa fa-trash',
"linkElementId": 'btnDeleteFWPolicy',
"onClick" : function() {
fwzUtils.appendDeleteContainer($('#btnDeleteFWPolicy')[0], 'fw-policy-wizard-global-grid-id', true);
$(".cancelWizardDeletePopup").off('click').on('click', function(){
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
});
$(".saveWizardRecords").off('click').on('click', function(){
var checkedRows = $('#' + ctwc.FW_POLICY_GRID_ID).data('contrailGrid').getCheckedRows();
if(checkedRows && checkedRows.length > 0) {
var model = new FWPolicyModel();
model.deleteFWPolicies(checkedRows, {
success: function () {
$('#' + ctwc.FW_POLICY_GRID_ID).
data('contrailGrid')._dataView.refreshData();
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
},
error: function (error) {
$("#grid-details-error-container").text('');
$("#grid-details-error-container").text(error.responseText);
$(".aps-details-error-container").show();
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
}
});
}
});
}
},
{
"type" : "link",
"title" : ctwl.TITLE_CREATE_FW_POLICY,
"iconClass" : "fa fa-plus",
"onClick" : function() {
newApplicationSet = {};
$("#aps-overlay-container").hide();
$('#applicationpolicyset_policy_wizard .actions').css("display", "block");
$('#aps-main-back-button').hide();
$('#applicationpolicyset_policy_wizard a.btn-primary').trigger("click");
}
}
];
return headerActionConfig;
}
else{
return headerActionConfig;
}
}
};

Expand Down
Expand Up @@ -58,7 +58,7 @@ define([
document.getElementById(modalId));
kbValidation.bind(self, {collection:
self.model.model().attributes.serviceTypeCollection});
},null,true);
},null,true,false);
},
renderDeleteServiceGrp: function(options) {
var delTemplate =
Expand Down
Expand Up @@ -179,8 +179,10 @@ define([
success: function () {
$('#' + ctwc.NEW_APPLICATION_POLICY_SET_GRID_ID).
data('contrailGrid')._dataView.refreshData();
$('#' + ctwc.NEW_APPLICATION_POLICY_SET_GRID_ID).data("contrailGrid").refreshGrid();
$('#overlay-background-id').removeClass('overlay-background');
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('.confirmation-popover').remove();
$('#overlay-background-id').removeClass('overlay-background');
}
},
Expand Down Expand Up @@ -225,8 +227,10 @@ define([
success: function () {
$('#' + ctwc.NEW_APPLICATION_POLICY_SET_GRID_ID).
data('contrailGrid')._dataView.refreshData();
$('#' + ctwc.NEW_APPLICATION_POLICY_SET_GRID_ID).data("contrailGrid").refreshGrid();
$('#overlay-background-id').removeClass('overlay-background');
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('.confirmation-popover').remove();
$('#overlay-background-id').removeClass('overlay-background');
}
},
Expand Down
Expand Up @@ -67,6 +67,8 @@ define([
success: function () {
$('#' + ctwc.FW_STANDALONE_ALL_POLICY_GRID_ID).
data('contrailGrid')._dataView.refreshData();
$('#' + ctwc.FW_STANDALONE_ALL_POLICY_GRID_ID).data("contrailGrid").refreshGrid();
$('#delete-popup-background').removeClass('overlay-background');
if(dataItem.application_policy_set_back_refs){
$("#firewall_policies_all").text($("#firewall_policies_all").text()-1);
$("#stand_alone_policies").text($("#stand_alone_policies").text());
Expand All @@ -76,7 +78,7 @@ define([
$("#stand_alone_policies").text($("#stand_alone_policies").text()-1);
}
if($('.confirmation-popover').length != 0){
$('.confirmation-popover').remove();
$('.confirmation-popover').remove();
$('#delete-popup-background').removeClass('overlay-background');
}
},
Expand Down Expand Up @@ -176,6 +178,8 @@ define([
success: function () {
$('#' + ctwc.FW_STANDALONE_ALL_POLICY_GRID_ID).
data('contrailGrid')._dataView.refreshData();
$('#' + ctwc.FW_STANDALONE_ALL_POLICY_GRID_ID).data("contrailGrid").refreshGrid();
$('#delete-popup-background').removeClass('overlay-background');
for(var i=0; i<checkedRows.length; i++){
if(checkedRows[i].application_policy_set_back_refs){
$("#firewall_policies_all").text($("#firewall_policies_all").text()-1);
Expand Down
Expand Up @@ -62,7 +62,7 @@ define([
document.getElementById('aps-gird-container'));
kbValidation.bind(self, {collection:
self.model.model().attributes.subnetCollection});
},null,true);
},null,true,false);
},
setErrorContainer : function(headerText){
$('#aps-gird-container').append($('<h6></h6>').text(headerText).addClass('aps-details-header'));
Expand All @@ -75,28 +75,6 @@ define([
$('#aps-gird-container').append($('<div id = "gird-details-container"></div>'));
}
});
function getAddressGroup(viewConfig){
if(viewConfig.isGlobal) {
return {
elementId:
cowu.formatElementId([ctwc.FW_WZ_SECURITY_POLICY_AS_GLOBAL_LIST_VIEW_ID]),
view: "fwPolicyWizardASGlobalListView",
app: cowc.APP_CONTRAIL_CONTROLLER,
viewPathPrefix: "config/firewall/fwpolicywizard/common/ui/js/views/",
viewConfig: $.extend(true, {}, viewConfig)
};
} else {
return {
elementId:
cowu.formatElementId([ctwc.SECURITY_POLICY_TAG_LIST_VIEW_ID]),
view: "fwPolicyWizardASProjectListView",
app: cowc.APP_CONTRAIL_CONTROLLER,
viewPathPrefix: "config/firewall/fwpolicywizard/common/ui/js/views/",
viewConfig: $.extend(true, {}, viewConfig,
{projectSelectedValueData: viewConfig.projectSelectedValueData})
}
}
};
var getAddressGroupViewConfig = function (isDisable) {
return {
elementId: ctwc.APS_ADDRESS_GRP_ID,
Expand Down
Expand Up @@ -62,7 +62,7 @@ define([
document.getElementById('aps-gird-container'));
kbValidation.bind(self, {collection:
self.model.model().attributes.serviceTypeCollection});
},null,true);
},null,true,false);
},
setErrorContainer : function(headerText){
$('#aps-gird-container').append($('<h6></h6>').text(headerText).addClass('aps-details-header'));
Expand Down
Expand Up @@ -57,7 +57,17 @@ define([
if(getValueByJsonPath(response, "0;application-policy-sets")){
appPolicyData = getValueByJsonPath(response, "0;application-policy-sets", []);
_.each(appPolicyData, function(val){
if("application-policy-set" in val) {
if("application-policy-set" in val &&
val['application-policy-set'].name == "global-application-policy-set") {
dataItems.push(val['application-policy-set']);
}
});
}
if(getValueByJsonPath(response, "0;application-policy-sets")){
appPolicyData = getValueByJsonPath(response, "0;application-policy-sets", []);
_.each(appPolicyData, function(val){
if("application-policy-set" in val &&
val['application-policy-set'].name != "global-application-policy-set") {
dataItems.push(val['application-policy-set']);
}
});
Expand Down

0 comments on commit b761384

Please sign in to comment.