/*-
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
*
*/
app
.controller(
'operationalPolicyCtrl',
[
'$scope',
'$rootScope',
'$uibModalInstance',
'data',
'operationalPolicyService',
'dialogs',
function($scope, $rootScope, $uibModalInstance, data, operationalPolicyService, dialogs) {
console.log("//////operationalPolicyCtrl");
$scope.policy_ids = []
var allPolicies = {};
$scope.guardType = "GUARD_MIN_MAX";
$scope.number = 0;
$scope.clname="";
function getAllFormId() {
return Array.from(document.getElementsByClassName("formId"));
}
function searchActiveFormId() {
var formArray = getAllFormId();
for (var i = 0, max = formArray.length; i < max; i++) {
console.log("Search active FormId, current element " + formArray[i].id);
if (formArray[i].style.display !== "none") {
console.log("Active form is:" + formArray[i].id);
return formArray[i];
}
}
console.log("No active formId found !");
}
function initTargetResourceId() {
if (vf_Services !== null && vf_Services !== undefined) {
// Set all the Resource Invariant UUID in the target resource ID
// list (+Empty and other)
Object.keys(vf_Services["shared"]["byVf"]).forEach(function(key) {
$("#targetResourceId").append($('').val(key).html(key));
});
}
}
function add_one_more() {
console.log("add one more");
$("#nav_Tabs li").removeClass("active");
// FormSpan contains a block of the form that is not being
// displayed. We will create clones of that and add them to tabs
var form = $("#formSpan").clone(true, true)
var count = 0;
// Each new tab will have the formId class attached to it. This way
// we can track how many forms we currently have out there and
// assign listeners to them
if ($(".formId").length > 0) {
var greatest = 0;
var s = $(".formId");
for (var i = 0; i < s.length; i++) {
if (parseInt($(s[i]).attr("id").substring(6)) > greatest) {
greatest = parseInt($(s[i]).attr("id").substring(6))
}
}
count = greatest + 1;
$("#properties_tab").append((''));
} else {
count++;
$("#properties_tab").append('');
}
$("#add_one_more")
.parent()
.before(
'