}
}
-function setMultiSelect() {
- $("select").each(function(index, mySelect) {
-
- var mySelectObj = $(mySelect);
- if (! mySelectObj.parents(".multiselect-native-select")) {
- // keep native for this one
- return;
- }
-
- if (mySelectObj.parents(".multiselect-native-select").length > 0) {
- var selectDrop = mySelectObj.parent(".multiselect-native-select").find("select");
- mySelectObj.parent(".multiselect-native-select").parent().html(selectDrop);
- }
-
- var options = {
- numberDisplayed: 1,
- maxHeight: 200
- };
-
- if (mySelectObj.attr("multiple")
- && mySelectObj.attr("multiple") != 'false') {
- options.includeSelectAllOption = true;
- }
-
- if (mySelectObj.attr("enableFilter")
- && mySelectObj.attr("enableFilter") != 'false') {
- options.enableCaseInsensitiveFiltering = true;
- options.enableFiltering = true;
- }
-
- mySelectObj.multiselect(options);
- });
-}
-
-function setPolicyOptions() {
-console.log("reset policy default options");
- try {
- var actor_values = defaults_props['policy']['actor'];
- if (actor_values) {
- for (key in actor_values) {
- if ($("#actor").length > 0) {
- $("#actor").append("<option value=\"" + key + "\">" + actor_values[key] + "</opton>")
- }
- }
- $("#actor").multiselect("rebuild");
- }
-
- var recipe_values = defaults_props['policy']['vnfRecipe'];
- if (recipe_values) {
- for (key in recipe_values) {
- if ($("#recipe").length > 0) {
- $("#recipe").append("<option value=\"" + key + "\">" + recipe_values[key] + "</opton>")
- }
- }
- $("#recipe").multiselect("rebuild");
- }
- var parentPolicyConditions_values = defaults_props['policy']['parentPolicyConditions'];
- if (parentPolicyConditions_values) {
- for (key in parentPolicyConditions_values) {
- if ($("#parentPolicyConditions").length > 0) {
- $("#parentPolicyConditions").append("<option value=\"" + key + "\">" + parentPolicyConditions_values[key] + "</opton>")
- }
- }
- $("#parentPolicyConditions").multiselect("rebuild");
- }
- var timeUnitsGuard_values = defaults_props['policy']['timeUnitsGuard'];
- if (timeUnitsGuard_values) {
- for (key in timeUnitsGuard_values) {
- if ($("#timeUnitsGuard").length > 0) {
- $("#timeUnitsGuard").append("<option value=\"" + key + "\">" + timeUnitsGuard_values[key] + "</opton>")
- }
- }
- $("#timeUnitsGuard").multiselect("rebuild");
- }
- function showWarn() {
- $("#paramsWarn").show();
- $('#servName').text($("#service option:selected").text());
- }
- } catch (e) {
- console.log(e)
- }
-
-}
-
-
//Typically used when opening a new model/template
function reloadDefaultVariables(isTemp) {
isTemplate = isTemp;
}
-
-$(window).on('load',function() {
- $.ajax({
- dataType: "json",
- url: '/restservices/clds/v1/clds/properties',
- success: function(data) {
- defaults_props = JSON.parse(data);
- },
- error: function(s, a, err) {
- console.log(err)
- console.log(s)
- console.log(a)
- },
- timeout: 100000
- });
-})
-