1 /* Copyright 2016-2017, Huawei Technologies Co., Ltd.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 function hideFirstCol() {
16 // $('table tr').find('th:eq(0)').hide();
17 // $('table tr').find('td:eq(0)').hide();
19 function deleteLocation(objectId) {
20 var requestUrl = app_url+"/openoapi/resmgr/v1/locations/" + objectId;
24 contentType: "application/json",
25 success: function (jsonobj) {
26 $('#location_table').bootstrapTable('remove', {
30 bootbox.alert("Delete successfull !!!");
32 error: function (xhr, ajaxOptions, thrownError) {
33 bootbox.alert("Error on deleting data: " + xhr.responseText);
38 function editLocation(row) {
39 $('#vmAppDialog').addClass('in').css({
43 $('#country').val(row.country);
44 $('#location').val(row.location);
45 $('#description').val(row.description);
46 $('#latitude').val(row.latitude);
47 $('#longitude').val(row.longitude);
50 function loadLocationData() {
51 var requestUrl = app_url+"/openoapi/resmgr/v1/locations";
55 contentType: "application/json",
56 success: function (jsonobj) {
57 $('#location_table').bootstrapTable({
60 data: jsonobj.locations
62 $('#location_table').bootstrapTable('refresh');
65 error: function (xhr, ajaxOptions, thrownError) {
66 bootbox.alert("Error on getting site data : " + xhr.responseText);
73 $("#vmAppForm").validate({
88 $('.close,.button-previous').click(function () {
89 $('#vmAppDialog').removeClass('in').css('display', 'none');
91 $('.detail-top ul li').click(function () {
92 $(this).addClass('current').siblings().removeClass('current');
94 $('.para').click(function () {
95 if ($('#serviceTemplateName').val() == '') {
96 alert('Please choose the service templet!');
97 $('#flavorTab').css('display', 'none');
99 $('#flavorTab').css('display', 'block');
101 $('#basicTab').css('display', 'block');
103 $('.basic').click(function () {
104 $('#flavorTab').css('display', 'none');
107 $('.table tbody tr').click(
109 $(this).addClass('openoTable_row_selected').siblings()
110 .removeClass('openoTable_row_selected');
112 $('.table tr:odd').addClass('active');
113 $('#false').click(function () {
114 $('#vmAppForm')[0].reset();
115 $('#vmAppDialog').addClass('in').css({
119 $('.close,.button-previous').click(function () {
120 $('#vmAppDialog').removeClass('in').css('display', 'none');
122 $('#filterTpLogicalType').click(
124 $('#filterTpLogicalType_select_popupcontainer').toggleClass(
126 $('#filterTpLogicalType').toggleClass('openo-focus');
127 var oLeft = $('#open_base_tpL_td6').offset().left;
128 var oTop = $('#open_base_tpL_td6').offset().top;
129 var oHeight = $('#open_base_tpL_td6').height();
130 $('#filterTpLogicalType_select_popupcontainer').css({
132 'top': oTop + oHeight + 10
135 $('div.openo-select-popup-container>div.openo-select-item>label').click(
137 var Lvalue = $(this).html();
138 $('#filterTpLogicalType_select_input').attr('value', Lvalue);
139 $('#filterTpLogicalType_select_popupcontainer').addClass(
141 $('#filterTpLogicalType').removeClass('openo-focus');
143 $.fn.serializeObject = function () {
145 var a = this.serializeArray();
146 $.each(a, function () {
147 if (o[this.name] !== undefined) {
148 if (!o[this.name].push) {
149 o[this.name] = [o[this.name]];
151 o[this.name].push(this.value || '');
153 o[this.name] = this.value || '';
161 var formData = JSON.stringify($("#vmAppForm").serializeObject());
162 var jsonobj = JSON.parse(formData);
163 var requestUrl = app_url+"/openoapi/resmgr/v1/locations";
164 var requestUrl_query = app_url+"/openoapi/resmgr/v1/locations";
165 if ($('#id').val().length === 0) {//create
171 contentType: "application/json",
174 success: function (jsonResp) {
176 bootbox.alert(jsonResp.msg);
177 $('#vmAppDialog').removeClass('in').css({
182 error: function (xhr, ajaxOptions, thrownError) {
183 bootbox.alert("Error on page : " + xhr.responseText);
192 contentType: "application/json",
195 success: function (jsonResp) {
197 bootbox.alert(jsonResp.msg);
198 $('#vmAppDialog').removeClass('in').css({
203 error: function (xhr, ajaxOptions, thrownError) {
204 bootbox.alert("Error on page : " + xhr.responseText);