2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
25 //When element is first created it should have a red box because it hasn't been edited
26 function newElementProcessor(id) {
27 if ($('g[data-element-id="' + id + '"]').length > 0) {
29 var _idNode = $('g[data-element-id="' + id + '"]')
30 _idNode.children("rect").each(function() {
31 if ($(this).attr('class') === 'djs-outline') {
32 $(this).attr('class', "djs-outline-no-property-saved")
33 $(this).attr('fill', 'red')
40 function setMultiSelect() {
41 $("select").each(function(index, mySelect) {
43 var mySelectObj = $(mySelect);
44 if (! mySelectObj.parents(".multiselect-native-select")) {
45 // keep native for this one
49 if (mySelectObj.parents(".multiselect-native-select").length > 0) {
50 var selectDrop = mySelectObj.parent(".multiselect-native-select").find("select");
51 mySelectObj.parent(".multiselect-native-select").parent().html(selectDrop);
59 if (mySelectObj.attr("multiple")
60 && mySelectObj.attr("multiple") != 'false') {
61 options.includeSelectAllOption = true;
64 if (mySelectObj.attr("enableFilter")
65 && mySelectObj.attr("enableFilter") != 'false') {
66 options.enableCaseInsensitiveFiltering = true;
67 options.enableFiltering = true;
70 mySelectObj.multiselect(options);
74 function setPolicyOptions() {
75 console.log("reset policy default options");
77 var actor_values = defaults_props['policy']['actor'];
79 for (key in actor_values) {
80 if ($("#actor").length > 0) {
81 $("#actor").append("<option value=\"" + key + "\">" + actor_values[key] + "</opton>")
84 $("#actor").multiselect("rebuild");
87 var recipe_values = defaults_props['policy']['vnfRecipe'];
89 for (key in recipe_values) {
90 if ($("#recipe").length > 0) {
91 $("#recipe").append("<option value=\"" + key + "\">" + recipe_values[key] + "</opton>")
94 $("#recipe").multiselect("rebuild");
96 var parentPolicyConditions_values = defaults_props['policy']['parentPolicyConditions'];
97 if (parentPolicyConditions_values) {
98 for (key in parentPolicyConditions_values) {
99 if ($("#parentPolicyConditions").length > 0) {
100 $("#parentPolicyConditions").append("<option value=\"" + key + "\">" + parentPolicyConditions_values[key] + "</opton>")
103 $("#parentPolicyConditions").multiselect("rebuild");
105 var timeUnitsGuard_values = defaults_props['policy']['timeUnitsGuard'];
106 if (timeUnitsGuard_values) {
107 for (key in timeUnitsGuard_values) {
108 if ($("#timeUnitsGuard").length > 0) {
109 $("#timeUnitsGuard").append("<option value=\"" + key + "\">" + timeUnitsGuard_values[key] + "</opton>")
112 $("#timeUnitsGuard").multiselect("rebuild");
114 function showWarn() {
115 $("#paramsWarn").show();
116 $('#servName').text($("#service option:selected").text());
125 //Typically used when opening a new model/template
126 function reloadDefaultVariables(isTemp) {
131 $(window).on('load',function() {
134 url: '/restservices/clds/v1/clds/properties',
135 success: function(data) {
136 defaults_props = JSON.parse(data);
138 error: function(s, a, err) {