2 * Copyright 2016-2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 vnfmUtil.delVnfm = function (vnfmId) {
19 bootbox.confirm($.i18n.prop("nfv-vnfm-iui-message-delete-confirm"), function (result) {
23 url: vm.$restUrl.delVnfmInfoUrl + vnfmId,
25 success: function (data, statusText, jqXHR) {
26 if (jqXHR.status == "204") {
27 for (var i = 0; i < vm.vnfmInfo.length; i++) {
28 if (vnfmId == vm.vnfmInfo[i].vnfmId) {
29 //delete the vnfm object from vnfm array
30 vm.vnfmInfo.splice(i, 1);
34 commonUtil.showMessage($.i18n.prop("nfv-vnfm-iui-message-delete-success"), "success");
36 commonUtil.showMessage($.i18n.prop("nfv-vnfm-iui-message-delete-fail"), "warning");
40 commonUtil.showMessage($.i18n.prop("nfv-vnfm-iui-message-delete-fail"), "warning");
47 vnfmUtil.updateVnfm = function (data) {
48 vm.addVnfm.vnfmId = data.vnfmId;
49 vm.addVnfm.name = data.name;
50 //vm.addVnfm.moc = data.moc;
51 //vm.addVnfm.mocDisabled = true;
52 vm.addVnfm.vendor = data.vendor;
53 vm.addVnfm.version = data.version;
54 vm.addVnfm.description = data.description;
55 vm.addVnfm.type = data.type;
56 vm.addVnfm.vimId = data.vimId;
57 vm.addVnfm.url = data.url;
58 vm.addVnfm.nameReadonly=true;
59 vm.addVnfm.userName = data.userName;
60 vm.addVnfm.password = data.password;
61 vm.addVnfm.saveType = "update";
62 vm.addVnfm.title = $.i18n.prop("nfv-vnfm-iui-test-update");
63 vm.server_rtn.info_block = false;
64 vm.server_rtn.warning_block = false;
68 $(".form-group").each(function () {
69 $(this).removeClass('has-success');
70 $(this).removeClass('has-error');
71 $(this).find(".help-block[id]").remove();
73 $("#addVnfmDlg").modal("show");
76 vnfmUtil.tooltipVnfmStatus = function () {
77 $("[data-toggle='tooltip']").tooltip();