blob: e812a46cdf77fced8df5b1024343ca7fe9b37dd7 [file] [log] [blame]
Seshu-Kumar-M72f32522016-09-14 18:06:11 +08001/* Copyright (c) 2016, Huawei Technologies Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
Seshu-Kumar-Ma06adb72016-09-14 16:45:06 +080016$(function(){
17 $('.creat-btn').click(function(){
18 $('#vmAppDialog').addClass('in').css({'display':'block'});
19
20 });
21 $('.close,.button-previous').click(function(){
22 $('#vmAppDialog').removeClass('in').css('display','none');
23 });
24 $('.detail-top ul li').click(function(){
25 $(this).addClass('current').siblings().removeClass('current');
26 });
27 $('.para').click(function(){
28 if($('#serviceTemplateName').val() == ''){
29 alert('Please choose the service templet!');
30 $('#flavorTab').css('display','none');
31 }else{
32 $('#flavorTab').css('display','block');
33 }
34 $('#basicTab').css('display','block');
35 });
36 $('.basic').click(function(){
37 $('#flavorTab').css('display','none');
38 });
39
40 $('.table tbody tr').click(function(){
41 $(this).addClass('openoTable_row_selected').siblings().removeClass('openoTable_row_selected');
42 });
43 $('.table tr:odd').addClass('active');
44 $('#false').click(function(){
45 $('#vmAppDialog').addClass('in').css({'display':'block'});
46 });
47 $('.close,.button-previous').click(function(){
48 $('#vmAppDialog').removeClass('in').css('display','none');
49 });
50 $('#filterTpLogicalType').click(function(){
51 $('#filterTpLogicalType_select_popupcontainer').toggleClass('openo-hide');
52 $('#filterTpLogicalType').toggleClass('openo-focus');
53 var oLeft = $('#open_base_tpL_td6').offset().left;
54 var oTop = $('#open_base_tpL_td6').offset().top;
55 var oHeight = $('#open_base_tpL_td6').height();
56 $('#filterTpLogicalType_select_popupcontainer').css({'left':oLeft,'top':oTop + oHeight + 10});
57 });
58 $('div.openo-select-popup-container>div.openo-select-item>label').click(function(){
59 var Lvalue = $(this).html();
60 $('#filterTpLogicalType_select_input').attr('value',Lvalue);
61 $('#filterTpLogicalType_select_popupcontainer').addClass('openo-hide');
62 $('#filterTpLogicalType').removeClass('openo-focus');
63 });
64 $.fn.serializeObject = function() {
65 var o = {};
66 var a = this.serializeArray();
67 $.each(a, function() {
68 if (o[this.name] !== undefined) {
69 if (!o[this.name].push) {
70 o[this.name] = [ o[this.name] ];
71 }
72 o[this.name].push(this.value || '');
73 } else {
74 o[this.name] = this.value || '';
75 }
76 });
77 return o;
78 };
79
80$('#createNS').click(function(){
81 var formData = JSON.stringify($("#neForm").serializeObject());
82 var jsonobj = JSON.parse(formData);
83 var newJson = {"managedElement": jsonobj};
84 formData = JSON.stringify(newJson);
85 var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/managed-elements";
86 $
87 .ajax({
88 type : "POST",
89 url : requestUrl,
90 contentType : "application/json",
91 dataType : "json",
92 data : formData,
93 success : function(jsonResp) {
94 alert("NS saved successfully!!!");
95 jsonobj["id"]= jsonResp.managedElement.id;
96 $('#ne').bootstrapTable("append", jsonobj);
97 $('#vmAppDialog').removeClass('in').css('display','none');
98
99 },
100 error : function(xhr, ajaxOptions, thrownError) {
101 alert("Error on page : " + xhr.responseText);
102 }
103 });
104 });
105})