1 /* Copyright 2016-2017, Huawei Technologies Co., Ltd.
\r
3 * Licensed under the Apache License, Version 2.0 (the "License");
\r
4 * you may not use this file except in compliance with the License.
\r
5 * You may obtain a copy of the License at
\r
7 * http://www.apache.org/licenses/LICENSE-2.0
\r
9 * Unless required by applicable law or agreed to in writing, software
\r
10 * distributed under the License is distributed on an "AS IS" BASIS,
\r
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 * See the License for the specific language governing permissions and
\r
13 * limitations under the License.
\r
15 function hideFirstCol() {
\r
16 // $('table tr').find('th:eq(0)').hide();
\r
17 // $('table tr').find('td:eq(0)').hide();
\r
19 function deleteLocation(objectId) {
\r
20 var requestUrl = app_url+"/openoapi/resmgr/v1/locations/" + objectId;
\r
24 contentType: "application/json",
\r
25 success: function (jsonobj) {
\r
26 $('#location_table').bootstrapTable('remove', {
\r
30 bootbox.alert("Delete successfull !!!");
\r
32 error: function (xhr, ajaxOptions, thrownError) {
\r
33 bootbox.alert("Error on deleting data: " + xhr.responseText);
\r
38 function editLocation(row) {
\r
39 $('#vmAppDialog').addClass('in').css({
\r
42 $('#id').val(row.id);
\r
43 $('#country').val(row.country);
\r
44 $('#location').val(row.location);
\r
45 $('#description').val(row.description);
\r
46 $('#latitude').val(row.latitude);
\r
47 $('#longitude').val(row.longitude);
\r
50 function loadLocationData() {
\r
51 var requestUrl = app_url+"/openoapi/resmgr/v1/locations";
\r
55 contentType: "application/json",
\r
56 success: function (jsonobj) {
\r
57 $('#location_table').bootstrapTable({
\r
60 data: jsonobj.locations
\r
62 $('#location_table').bootstrapTable('refresh');
\r
65 error: function (xhr, ajaxOptions, thrownError) {
\r
66 bootbox.alert("Error on getting site data : " + xhr.responseText);
\r
73 $("#vmAppForm").validate({
\r
75 country: "required",
\r
76 location: "required",
\r
88 $('.close,.button-previous').click(function () {
\r
89 $('#vmAppDialog').removeClass('in').css('display', 'none');
\r
91 $('.detail-top ul li').click(function () {
\r
92 $(this).addClass('current').siblings().removeClass('current');
\r
94 $('.para').click(function () {
\r
95 if ($('#serviceTemplateName').val() == '') {
\r
96 alert('Please choose the service templet!');
\r
97 $('#flavorTab').css('display', 'none');
\r
99 $('#flavorTab').css('display', 'block');
\r
101 $('#basicTab').css('display', 'block');
\r
103 $('.basic').click(function () {
\r
104 $('#flavorTab').css('display', 'none');
\r
107 $('.table tbody tr').click(
\r
109 $(this).addClass('openoTable_row_selected').siblings()
\r
110 .removeClass('openoTable_row_selected');
\r
112 $('.table tr:odd').addClass('active');
\r
113 $('#false').click(function () {
\r
114 $('#vmAppForm')[0].reset();
\r
115 $('#vmAppDialog').addClass('in').css({
\r
119 $('.close,.button-previous').click(function () {
\r
120 $('#vmAppDialog').removeClass('in').css('display', 'none');
\r
122 $('#filterTpLogicalType').click(
\r
124 $('#filterTpLogicalType_select_popupcontainer').toggleClass(
\r
126 $('#filterTpLogicalType').toggleClass('openo-focus');
\r
127 var oLeft = $('#open_base_tpL_td6').offset().left;
\r
128 var oTop = $('#open_base_tpL_td6').offset().top;
\r
129 var oHeight = $('#open_base_tpL_td6').height();
\r
130 $('#filterTpLogicalType_select_popupcontainer').css({
\r
132 'top': oTop + oHeight + 10
\r
135 $('div.openo-select-popup-container>div.openo-select-item>label').click(
\r
137 var Lvalue = $(this).html();
\r
138 $('#filterTpLogicalType_select_input').attr('value', Lvalue);
\r
139 $('#filterTpLogicalType_select_popupcontainer').addClass(
\r
141 $('#filterTpLogicalType').removeClass('openo-focus');
\r
143 $.fn.serializeObject = function () {
\r
145 var a = this.serializeArray();
\r
146 $.each(a, function () {
\r
147 if (o[this.name] !== undefined) {
\r
148 if (!o[this.name].push) {
\r
149 o[this.name] = [o[this.name]];
\r
151 o[this.name].push(this.value || '');
\r
153 o[this.name] = this.value || '';
\r
158 $('#createLocation')
\r
161 var formData = JSON.stringify($("#vmAppForm").serializeObject());
\r
162 var jsonobj = JSON.parse(formData);
\r
163 var requestUrl = app_url+"/openoapi/resmgr/v1/locations";
\r
164 var requestUrl_query = app_url+"/openoapi/resmgr/v1/locations";
\r
165 if ($('#id').val().length === 0) {//create
\r
171 contentType: "application/json",
\r
174 success: function (jsonResp) {
\r
175 loadLocationData();
\r
176 bootbox.alert(jsonResp.msg);
\r
177 $('#vmAppDialog').removeClass('in').css({
\r
182 error: function (xhr, ajaxOptions, thrownError) {
\r
183 bootbox.alert("Error on page : " + xhr.responseText);
\r
192 contentType: "application/json",
\r
195 success: function (jsonResp) {
\r
196 loadLocationData();
\r
197 bootbox.alert(jsonResp.msg);
\r
198 $('#vmAppDialog').removeClass('in').css({
\r
203 error: function (xhr, ajaxOptions, thrownError) {
\r
204 bootbox.alert("Error on page : " + xhr.responseText);
\r