Seshu-Kumar-M | f7800f4 | 2016-09-16 18:35:58 +0800 | [diff] [blame^] | 1 | /* Copyright 2016, Huawei Technologies Co., Ltd.
|
Seshu-Kumar-M | 72f3252 | 2016-09-14 18:06:11 +0800 | [diff] [blame] | 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 |
|
| 16 | function deleteSite(objectId){
|
| 17 | alert(objectId);
|
| 18 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/sites"+objectId;
|
| 19 | $
|
| 20 | .ajax({
|
| 21 | type : "DELETE",
|
| 22 | url : requestUrl,
|
| 23 | contentType : "application/json",
|
| 24 | success : function(jsonobj) {
|
| 25 | alert("Details deleted successfully!!!");
|
| 26 | //TODO: Update the table
|
| 27 | },
|
| 28 | error : function(xhr, ajaxOptions, thrownError) {
|
| 29 | alert("Error on deleting site: " + xhr.responseText);
|
| 30 | }
|
| 31 | });
|
| 32 | }
|
| 33 | function deleteLink(objectId){
|
| 34 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/topological-links"+objectId;
|
| 35 | $
|
| 36 | .ajax({
|
| 37 | type : "DELETE",
|
| 38 | url : requestUrl,
|
| 39 | contentType : "application/json",
|
| 40 | success : function(jsonobj) {
|
| 41 | alert("Details deleted successfully!!!");
|
| 42 | //TODO: Update the table
|
| 43 | },
|
| 44 | error : function(xhr, ajaxOptions, thrownError) {
|
| 45 | alert("Error on deleting link : " + xhr.responseText);
|
| 46 | }
|
| 47 | });
|
| 48 | }
|
| 49 |
|
| 50 | function deleteNe(objectId){
|
| 51 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/sdnobrs/v1/managed-elements"+objectId;
|
| 52 | $
|
| 53 | .ajax({
|
| 54 | type : "DELETE",
|
| 55 | url : requestUrl,
|
| 56 | contentType : "application/json",
|
| 57 | success : function(jsonobj) {
|
| 58 | alert("Details deleted successfully!!!");
|
| 59 | //TODO: Update the table
|
| 60 | },
|
| 61 | error : function(xhr, ajaxOptions, thrownError) {
|
| 62 | alert("Error on deleting ne : " + xhr.responseText);
|
| 63 | }
|
| 64 | });
|
| 65 | }
|
| 66 |
|
| 67 | function deletePort(objectId){
|
| 68 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/logical-termination-points"+objectId;
|
| 69 | $
|
| 70 | .ajax({
|
| 71 | type : "DELETE",
|
| 72 | url : requestUrl,
|
| 73 | contentType : "application/json",
|
| 74 | success : function(jsonobj) {
|
| 75 | alert("Details deleted successfully!!!");
|
| 76 | //TODO: Update the table
|
| 77 | },
|
| 78 | error : function(xhr, ajaxOptions, thrownError) {
|
| 79 | alert("Error on deleting port : " + xhr.responseText);
|
| 80 | }
|
| 81 | });
|
| 82 | }
|
| 83 | function loadSiteData(){
|
| 84 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/sites";
|
| 85 | $
|
| 86 | .ajax({
|
| 87 | type : "GET",
|
| 88 | url : requestUrl,
|
| 89 | contentType : "application/json",
|
| 90 | success : function(jsonobj) {
|
| 91 | alert("loading Site data");
|
| 92 | //TODO: Update the table
|
| 93 | },
|
| 94 | error : function(xhr, ajaxOptions, thrownError) {
|
| 95 | alert("Error on getting site data : " + xhr.responseText);
|
| 96 | }
|
| 97 | });
|
| 98 | }
|
| 99 | function loadLinkData(){
|
| 100 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/topological-links";
|
| 101 | $
|
| 102 | .ajax({
|
| 103 | type : "GET",
|
| 104 | url : requestUrl,
|
| 105 | contentType : "application/json",
|
| 106 | success : function(jsonobj) {
|
| 107 | alert("loading Link data");
|
| 108 | //TODO: Update the table
|
| 109 | },
|
| 110 | error : function(xhr, ajaxOptions, thrownError) {
|
| 111 | alert("Error on getting link data : " + xhr.responseText);
|
| 112 | }
|
| 113 | });
|
| 114 | }
|
| 115 | function loadNeData(){
|
| 116 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/sdnobrs/v1/managed-elements";
|
| 117 | $
|
| 118 | .ajax({
|
| 119 | type : "GET",
|
| 120 | url : requestUrl,
|
| 121 | contentType : "application/json",
|
| 122 | success : function(jsonobj) {
|
| 123 | alert("loading NE data");
|
| 124 | //TODO: Update the table
|
| 125 | },
|
| 126 | error : function(xhr, ajaxOptions, thrownError) {
|
| 127 | alert("Error on getting ne data : " + xhr.responseText);
|
| 128 | }
|
| 129 | });
|
| 130 | }
|
| 131 | function loadPortData(){
|
| 132 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/logical-termination-points";
|
| 133 | $
|
| 134 | .ajax({
|
| 135 | type : "GET",
|
| 136 | url : requestUrl,
|
| 137 | contentType : "application/json",
|
| 138 | success : function(jsonobj) {
|
| 139 | alert("loading port data");
|
| 140 | //TODO: Update the table
|
| 141 | },
|
| 142 | error : function(xhr, ajaxOptions, thrownError) {
|
| 143 | alert("Error on getting port data : " + xhr.responseText);
|
| 144 | }
|
| 145 | });
|
| 146 | }
|
| 147 | $(function(){
|
| 148 | $('.creat-btn').click(function(){
|
| 149 | $('#vmAppDialog').addClass('in').css({'display':'block'});
|
| 150 |
|
| 151 | });
|
| 152 | $('.close,.button-previous').click(function(){
|
| 153 | $('#vmAppDialog').removeClass('in').css('display','none');
|
| 154 | });
|
| 155 | $('.detail-top ul li').click(function(){
|
| 156 | $(this).addClass('current').siblings().removeClass('current');
|
| 157 | });
|
| 158 | $('.para').click(function(){
|
| 159 | if($('#serviceTemplateName').val() == ''){
|
| 160 | alert('Please choose the service templet!');
|
| 161 | $('#flavorTab').css('display','none');
|
| 162 | }else{
|
| 163 | $('#flavorTab').css('display','block');
|
| 164 | }
|
| 165 | $('#basicTab').css('display','block');
|
| 166 | });
|
| 167 | $('.basic').click(function(){
|
| 168 | $('#flavorTab').css('display','none');
|
| 169 | });
|
| 170 |
|
| 171 | $('.table tbody tr').click(function(){
|
| 172 | $(this).addClass('openoTable_row_selected').siblings().removeClass('openoTable_row_selected');
|
| 173 | });
|
| 174 | $('.table tr:odd').addClass('active');
|
| 175 | $('#false').click(function(){
|
| 176 | $('#vmAppDialog').addClass('in').css({'display':'block'});
|
| 177 | });
|
| 178 | $('.close,.button-previous').click(function(){
|
| 179 | $('#vmAppDialog').removeClass('in').css('display','none');
|
| 180 | });
|
| 181 | $('#filterTpLogicalType').click(function(){
|
| 182 | $('#filterTpLogicalType_select_popupcontainer').toggleClass('openo-hide');
|
| 183 | $('#filterTpLogicalType').toggleClass('openo-focus');
|
| 184 | var oLeft = $('#open_base_tpL_td6').offset().left;
|
| 185 | var oTop = $('#open_base_tpL_td6').offset().top;
|
| 186 | var oHeight = $('#open_base_tpL_td6').height();
|
| 187 | $('#filterTpLogicalType_select_popupcontainer').css({'left':oLeft,'top':oTop + oHeight + 10});
|
| 188 | });
|
| 189 | $('div.openo-select-popup-container>div.openo-select-item>label').click(function(){
|
| 190 | var Lvalue = $(this).html();
|
| 191 | $('#filterTpLogicalType_select_input').attr('value',Lvalue);
|
| 192 | $('#filterTpLogicalType_select_popupcontainer').addClass('openo-hide');
|
| 193 | $('#filterTpLogicalType').removeClass('openo-focus');
|
| 194 | });
|
| 195 | $.fn.serializeObject = function() {
|
| 196 | var o = {};
|
| 197 | var a = this.serializeArray();
|
| 198 | $.each(a, function() {
|
| 199 | if (o[this.name] !== undefined) {
|
| 200 | if (!o[this.name].push) {
|
| 201 | o[this.name] = [ o[this.name] ];
|
| 202 | }
|
| 203 | o[this.name].push(this.value || '');
|
| 204 | } else {
|
| 205 | o[this.name] = this.value || '';
|
| 206 | }
|
| 207 | });
|
| 208 | return o;
|
| 209 | };
|
| 210 | $('#createSite').click(function(){
|
| 211 | var formData = JSON.stringify($("#vmAppForm").serializeObject());
|
| 212 | alert(formData);
|
| 213 | var jsonobj = JSON.parse(formData);
|
| 214 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/sites";
|
| 215 | $
|
| 216 | .ajax({
|
| 217 | type : "POST",
|
| 218 | url : requestUrl,
|
| 219 | contentType : "application/json",
|
| 220 | dataType : "json",
|
| 221 | data : formData,
|
| 222 | success : function(jsonobj) {
|
| 223 | alert("Details saved successfully!!!");
|
| 224 | var data = [jsonobj.name,jsonobj.hostName,jsonobj.productName,jsonobj.vendor,jsonobj.description];
|
| 225 | $('#example').dataTable().fnAddData(data);
|
| 226 | $('.modal').modal('hide');
|
| 227 | },
|
| 228 | error : function(xhr, ajaxOptions, thrownError) {
|
| 229 | alert("Error on page : " + xhr.responseText);
|
| 230 | }
|
| 231 | });
|
| 232 | });
|
| 233 |
|
| 234 | $('#createNe').click(function(){
|
| 235 | var formData = JSON.stringify($("#neForm").serializeObject());
|
| 236 | alert(formData);
|
| 237 | var jsonobj = JSON.parse(formData);
|
| 238 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/sdnobrs/v1/managed-elements";
|
| 239 | $
|
| 240 | .ajax({
|
| 241 | type : "POST",
|
| 242 | url : requestUrl,
|
| 243 | contentType : "application/json",
|
| 244 | dataType : "json",
|
| 245 | data : formData,
|
| 246 | success : function(jsonobj) {
|
| 247 | alert("Details saved successfully!!!");
|
| 248 | var data = [jsonobj.name,jsonobj.hostName,jsonobj.productName,jsonobj.vendor,jsonobj.description];
|
| 249 | $('#example').dataTable().fnAddData(data);
|
| 250 | $('.modal').modal('hide');
|
| 251 | },
|
| 252 | error : function(xhr, ajaxOptions, thrownError) {
|
| 253 | alert("Error on page : " + xhr.responseText);
|
| 254 | }
|
| 255 | });
|
| 256 | });
|
| 257 |
|
| 258 | $('#createPort').click(function(){
|
| 259 | var formData = JSON.stringify($("#portForm").serializeObject());
|
| 260 | alert(formData);
|
| 261 | var jsonobj = JSON.parse(formData);
|
| 262 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/logical-termination-points";
|
| 263 | $
|
| 264 | .ajax({
|
| 265 | type : "POST",
|
| 266 | url : requestUrl,
|
| 267 | contentType : "application/json",
|
| 268 | dataType : "json",
|
| 269 | data : formData,
|
| 270 | success : function(jsonobj) {
|
| 271 | alert("Details saved successfully!!!");
|
| 272 | var data = [jsonobj.name,jsonobj.hostName,jsonobj.productName,jsonobj.vendor,jsonobj.description];
|
| 273 | $('#example').dataTable().fnAddData(data);
|
| 274 | $('.modal').modal('hide');
|
| 275 | },
|
| 276 | error : function(xhr, ajaxOptions, thrownError) {
|
| 277 | alert("Error on page : " + xhr.responseText);
|
| 278 | }
|
| 279 | });
|
| 280 | });
|
| 281 |
|
| 282 | $('#createLink').click(function(){
|
| 283 | var formData = JSON.stringify($("#linkForm").serializeObject());
|
| 284 | alert(formData);
|
| 285 | var jsonobj = JSON.parse(formData);
|
| 286 | var requestUrl = "http://localhost:8080/org.openo.sdno.brs/openoapi/sdnobrs/v1/topological-links";
|
| 287 | $
|
| 288 | .ajax({
|
| 289 | type : "POST",
|
| 290 | url : requestUrl,
|
| 291 | contentType : "application/json",
|
| 292 | dataType : "json",
|
| 293 | data : formData,
|
| 294 | success : function(jsonobj) {
|
| 295 | alert("Details saved successfully!!!");
|
| 296 | var data = [jsonobj.name,jsonobj.hostName,jsonobj.productName,jsonobj.vendor,jsonobj.description];
|
| 297 | $('#example').dataTable().fnAddData(data);
|
| 298 | $('.modal').modal('hide');
|
| 299 | },
|
| 300 | error : function(xhr, ajaxOptions, thrownError) {
|
| 301 | alert("Error on page : " + xhr.responseText);
|
| 302 | }
|
| 303 | });
|
| 304 | });
|
| 305 |
|
| 306 | }) |