summaryrefslogtreecommitdiffstats
path: root/portal
diff options
context:
space:
mode:
Diffstat (limited to 'portal')
-rw-r--r--portal/src/main/webapp/extsys/vim/css/vim.css5
-rw-r--r--portal/src/main/webapp/extsys/vim/js/vimController.js125
-rw-r--r--portal/src/main/webapp/extsys/vim/vimView.html66
3 files changed, 97 insertions, 99 deletions
diff --git a/portal/src/main/webapp/extsys/vim/css/vim.css b/portal/src/main/webapp/extsys/vim/css/vim.css
index 0998451..aa24232 100644
--- a/portal/src/main/webapp/extsys/vim/css/vim.css
+++ b/portal/src/main/webapp/extsys/vim/css/vim.css
@@ -547,4 +547,9 @@ h3 {
margin-top: 35px;
position: absolute;
background: #ddd;
+}
+.md-text-overflow {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
} \ No newline at end of file
diff --git a/portal/src/main/webapp/extsys/vim/js/vimController.js b/portal/src/main/webapp/extsys/vim/js/vimController.js
index 486936c..2996e28 100644
--- a/portal/src/main/webapp/extsys/vim/js/vimController.js
+++ b/portal/src/main/webapp/extsys/vim/js/vimController.js
@@ -24,23 +24,23 @@ var vm = avalon
saveType: "add",
modalTitle: $.i18n.prop('com_zte_ums_eco_roc_vim_register'),
$blankElement: {
- "cloud-owner": "ZTE",
+ "cloudOwner": "ZTE",
"status": "active",
- "cloud-region-id": "",
- "cloud-type": "openstack",
- "cloud-region-version": "v1.0",
- "owner-defined-type": "",
- "cloud-zone": "",
- "complex-name": "",
- "cloud-extra-info": "",
- "auth-info-items": [
+ "cloudRegionId": "",
+ "cloudType": "openstack",
+ "cloudRegionVersion": "v1.0",
+ "ownerDefinedType": "",
+ "cloudZone": "",
+ "complexName": "",
+ "cloudExtraInfo": "",
+ "vimAuthInfos": [
{
- "username": "",
+ "userName": "",
"password": "",
- "auth-url": "",
- "ssl-cacert": "",
- "ssl-insecure": "",
- "cloud-domain": ""
+ "authUrl": "",
+ "sslCacert": "",
+ "sslInsecure": "false",
+ "cloudDomain": ""
}
]
},
@@ -52,10 +52,10 @@ var vm = avalon
},
isSave: true,
action: {ADD: 'add', UPDATE: 'update'},
- $queryVimInfoUrl: 'mock-data/vim.json',//'/onapapi/aai/esr/v1/vims',
- $addVimInfoUrl: '/onapapi/aai/esr/v1/vims/',
- $updateVimInfoUrl: '/onapapi/aai/esr/v1/vims/',
- $delVimInfoUrl: '/onapapi/aai/esr/v1/vims/{vim_id}',
+ $queryVimInfoUrl: '/api/aai-esr-server/v1/vims',
+ $addVimInfoUrl: '/api/aai-esr-server/v1/vims',
+ $updateVimInfoUrl: '/api/aai-esr-server/v1/vims/{cloudOwner}/{cloudRegionId}',
+ $delVimInfoUrl: '/api/aai-esr-server/v1/vims?cloudOwner={cloudOwner}&cloudRegionId={cloudRegionId}',
$initTable: function () {
$.ajax({
"type": 'get',
@@ -120,85 +120,74 @@ var vm = avalon
//add vim
persistVim: function () {
var newElement = vm.getVIMSave();
- vm.vimInfo.push(newElement);
- return true;
- /*$.ajax({
+ var res = false;
+ $.ajax({
type: "Post",
url: vm.$addVimInfoUrl,
- data: JSON.stringify(vm.currentElement.$model),
+ data: JSON.stringify(newElement),
async: false,
dataType: "json",
contentType: 'application/json',
success: function (data, statusText, jqXHR) {
vm.executeWait.visible = false;
vm.executeError.visible = false;
- if (jqXHR.status == "201") {
- vm.addVim.vimId = data.vimId;
- vm.addVim.name = data.name;
- vm.addVim.tenant = data.tenant;
- vm.addVim.type = data.type;
- var newVim = jQuery.extend({}, vm.addVim);
- vm.vimInfo.push(newVim);
-
+ if (jqXHR.status == "200") {
+ vm.vimInfo.push(newElement);
+ res = true;
$('#addVimDlg').modal('hide');
resUtil.growl($.i18n.prop("com_zte_ums_eco_roc_vim_growl_msg_title") + $.i18n.prop("com_zte_ums_eco_roc_vim_growl_msg_save_success"), "success");
} else {
+ res = false;
vm.executeError.visible = true;
vm.executeError.text = $.i18n.prop("com_zte_ums_eco_roc_vim_growl_msg_save_failed");
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
+ res = false;
vm.executeError.visible = true;
vm.executeError.text = textStatus + ":" + errorThrown;
vm.executeWait.visible = false;
vm.isSave = false;
}
- });*/
+ });
+ return res;
},
//update vim
updateVim: function () {
- vm.fillElement(vm.getVIMSave(), vm.vimInfo[vm.currentIndex]);
- return true;
- /* $.ajax({
+ var currentElement = vm.getVIMSave();
+ var res = false;
+ var url = vm.$updateVimInfoUrl.replace("{cloudOwner}", currentElement["cloudOwner"]).replace("{cloudRegionId}", currentElement["cloudRegionId"]);
+ $.ajax({
type: "Put",
- url: vm.$updateVimInfoUrl + vm.addVim.vimId,
+ url: url,
contentType: 'application/json',
- data: JSON.stringify(vm.currentElement.$model),
+ data: JSON.stringify(currentElement),
dataType: "json",
async: false,
success: function (data, statusText, jqXHR) {
vm.executeWait.visible = false;
vm.executeError.visible = false;
if (jqXHR.status == "200") {
- for (var i = 0; i < vm.vimInfo.length; i++) {
- if (vm.vimInfo[i].vimId == vm.addVim.vimId) {
- vm.vimInfo[i].name = vm.addVim.vimName;
- vm.vimInfo[i].userName = vm.addVim.userName;
- vm.vimInfo[i].password = vm.addVim.password;
- vm.vimInfo[i].url = vm.addVim.url;
- vm.vimInfo[i].tenant = vm.addVim.tenant;
- vm.vimInfo[i].domain = vm.addVim.domain;
- vm.vimInfo[i].description = vm.addVim.description;
- vm.vimInfo[i].type = vm.addVim.vimType;
- vm.vimInfo[i].version=vm.addVim.version;
- vm.vimInfo[i].vendor=vm.addVim.vendor;
- }
- }
+ vm.fillElement(currentElement, vm.vimInfo[vm.currentIndex]);
+ res = true;
$('#addVimDlg').modal('hide');
resUtil.growl($.i18n.prop('com_zte_ums_eco_roc_vim_growl_msg_title') + $.i18n.prop('com_zte_ums_eco_roc_vim_growl_msg_save_success'), "success");
}
else {
+ res = true;
vm.executeError.visible = true;
vm.executeError.text = $.i18n.prop('com_zte_ums_eco_roc_vim_growl_msg_save_failed');
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
+ res = true;
vm.isSave = false;
vm.executeError.visible = true;
vm.executeError.text = textStatus + ":" + errorThrown;
vm.executeWait.visible = false;
}
- });*/
+ });
+ return res;
},
delVim: function (index) {
bootbox.confirm($.i18n.prop('com_zte_ums_eco_roc_vim_confirm_delete_vim_record'), function (result) {
@@ -230,28 +219,28 @@ var vm = avalon
});
},
fillElement: function (sourceElement, targetElement) {
- targetElement["cloud-owner"] = sourceElement["cloud-owner"];
+ targetElement["cloudOwner"] = sourceElement["cloudOwner"];
targetElement["status"] = sourceElement["status"];
- targetElement["cloud-region-id"] = sourceElement["cloud-region-id"];
- targetElement["cloud-type"] = sourceElement["cloud-type"];
- targetElement["cloud-region-version"] = sourceElement["cloud-region-version"];
- targetElement["owner-defined-type"] = sourceElement["owner-defined-type"];
- targetElement["cloud-zone"] = sourceElement["cloud-zone"];
- targetElement["complex-name"] = sourceElement["complex-name"];
- targetElement["cloud-extra-info"] = sourceElement["cloud-extra-info"];
- if(!targetElement["auth-info-items"]){
- targetElement["auth-info-items"] = [{}];
+ targetElement["cloudRegionId"] = sourceElement["cloudRegionId"];
+ targetElement["cloudType"] = sourceElement["cloudType"];
+ targetElement["cloudRegionVersion"] = sourceElement["cloudRegionVersion"];
+ targetElement["ownerDefinedType"] = sourceElement["ownerDefinedType"];
+ targetElement["cloudZone"] = sourceElement["cloudZone"];
+ targetElement["complexName"] = sourceElement["complexName"];
+ targetElement["cloudExtraInfo"] = sourceElement["cloudExtraInfo"];
+ if(!targetElement["vimAuthInfos"]){
+ targetElement["vimAuthInfos"] = [{}];
}
- targetElement["auth-info-items"][0]["username"] = sourceElement["auth-info-items"][0]["username"];
- targetElement["auth-info-items"][0]["password"] = sourceElement["auth-info-items"][0]["password"];
- targetElement["auth-info-items"][0]["auth-url"] = sourceElement["auth-info-items"][0]["auth-url"];
- targetElement["auth-info-items"][0]["ssl-cacert"] = sourceElement["auth-info-items"][0]["ssl-cacert"];
- targetElement["auth-info-items"][0]["ssl-insecure"] = sourceElement["auth-info-items"][0]["ssl-insecure"];
- targetElement["auth-info-items"][0]["cloud-domain"] = sourceElement["auth-info-items"][0]["cloud-domain"];
+ targetElement["vimAuthInfos"][0]["userName"] = sourceElement["vimAuthInfos"][0]["userName"];
+ targetElement["vimAuthInfos"][0]["password"] = sourceElement["vimAuthInfos"][0]["password"];
+ targetElement["vimAuthInfos"][0]["authUrl"] = sourceElement["vimAuthInfos"][0]["authUrl"];
+ targetElement["vimAuthInfos"][0]["sslCacert"] = sourceElement["vimAuthInfos"][0]["sslCacert"];
+ targetElement["vimAuthInfos"][0]["sslInsecure"] = sourceElement["vimAuthInfos"][0]["sslInsecure"];
+ targetElement["vimAuthInfos"][0]["cloudDomain"] = sourceElement["vimAuthInfos"][0]["cloudDomain"];
},
getVIMSave: function () {
var vimSave = $.extend(true, {}, vm.currentElement.$model);
- vimSave["auth-info-items"] = $.extend(true, {}, vm.currentElement["auth-info-items"].$model);
+ vimSave["vimAuthInfos"] = $.extend(true, [], vm.currentElement["vimAuthInfos"].$model);
return vimSave;
},
gotoChartPage: function (oid, name, tenant) {
diff --git a/portal/src/main/webapp/extsys/vim/vimView.html b/portal/src/main/webapp/extsys/vim/vimView.html
index ba67d45..8be2a4a 100644
--- a/portal/src/main/webapp/extsys/vim/vimView.html
+++ b/portal/src/main/webapp/extsys/vim/vimView.html
@@ -52,84 +52,85 @@
<form class="form-horizontal" id="vim_form" role="form">
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-owner</span>
+ <span>cloudOwner</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['cloud-owner']" name="cloudOwner" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['cloudOwner']" name="cloudOwner" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-region-id</span>
+ <span>cloudRegionId</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['cloud-region-id']" name="cloudRegionId" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['cloudRegionId']" name="cloudRegionId" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-type</span>
+ <span>cloudType</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <select ms-duplex="currentElement['cloud-type']">
+ <select ms-duplex="currentElement['cloudType']">
<option value='openstack'>openstack</option>
+ <option value='vmware'>vmware</option>
</select>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-region-version</span>
+ <span>cloudRegionVersion</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['cloud-region-version']" name="cloudRegionVersion" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['cloudRegionVersion']" name="cloudRegionVersion" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>owner-defined-type</span>
+ <span>ownerDefinedType</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['owner-defined-type']" name="ownerDefinedType" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['ownerDefinedType']" name="ownerDefinedType" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-zone</span>
+ <span>cloudZone</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['cloud-zone']" name="cloudZone" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['cloudZone']" name="cloudZone" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>complex-name</span>
+ <span>complexName</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['complex-name']" name="complexName" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['complexName']" name="complexName" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-extra-info</span>
+ <span>cloudExtraInfo</span>
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['cloud-extra-info']" name="cloudExtraInfo" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['cloudExtraInfo']" name="cloudExtraInfo" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
@@ -139,7 +140,7 @@
<span class="required" aria-required="true">*</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['auth-info-items'][0].username" name="username" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['vimAuthInfos'][0].userName" name="username" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
@@ -148,43 +149,45 @@
<span>password</span>
</label>
<div class="col-sm-7">
- <input type="password" ms-duplex="currentElement['auth-info-items'][0].password" name="password" class="form-control"/>
+ <input type="password" ms-duplex="currentElement['vimAuthInfos'][0].password" name="password" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>auth-url</span>
+ <span>authUrl</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['auth-info-items'][0]['auth-url']" name="authUrl" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['vimAuthInfos'][0]['authUrl']" name="authUrl" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>ssl-cacert</span>
+ <span>sslCacert</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['auth-info-items'][0]['ssl-cacert']" name="sslCacert" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['vimAuthInfos'][0]['sslCacert']" name="sslCacert" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>ssl-insecure</span>
+ <span>sslInsecure</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['auth-info-items'][0]['ssl-insecure']" name="sslInsecure" class="form-control"/>
- <span class="help-block"></span>
+ <select ms-duplex="currentElement['vimAuthInfos'][0]['sslInsecure']" name="sslInsecure" class="form-control">
+ <option value="false">false</option>
+ <option value="true">true</option>
+ </select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">
- <span>cloud-domain</span>
+ <span>cloudDomain</span>
</label>
<div class="col-sm-7">
- <input type="text" ms-duplex="currentElement['auth-info-items'][0]['cloud-domain']" name="cloudDomain" class="form-control"/>
+ <input type="text" ms-duplex="currentElement['vimAuthInfos'][0]['cloudDomain']" name="cloudDomain" class="form-control"/>
<span class="help-block"></span>
</div>
</div>
@@ -227,14 +230,15 @@
<i class="fa fa-cloud fa-5x color_cloud"></i>
</div>
<div class="m-t-xl">
- <h3 ms-text="el['cloud-owner'] + ':' + el['cloud-region-id']"></h3>
+ <h3 class="md-text-overflow" ms-title="'cloudOwner:' + el['cloudOwner']" ms-text="'cloudOwner:' + el['cloudOwner']"></h3>
+ <h3 class="md-text-overflow" ms-title="'cloudRegionId:' + el['cloudRegionId']" ms-text="'cloudRegionId:' + el['cloudRegionId']"></h3>
<div class="font">
<span id_i18n="com_zte_ums_eco_roc_vim_display_type"name_i18n="com_zte_conductor_ui_i18n"></span>
- <span ms-text="el['cloud-type']"></span>
+ <span class="md-text-overflow" ms-title="el['cloudType']" ms-text="el['cloudType']"></span>
</div>
<div class="font">
<span id_i18n="com_zte_ums_eco_roc_vim_display_version"name_i18n="com_zte_conductor_ui_i18n"></span>
- <span ms-text="el['cloud-region-version']"></span>
+ <span class="md-text-overflow" ms-title="el['cloudRegionVersion']" ms-text="el['cloudRegionVersion']"></span>
</div>
</div>
</div>
@@ -242,7 +246,7 @@
<div class="pull-right">
<a class="btn btn-default btn-sm" ms-click="$showVimTable($index, 'update')"><i
class="fa fa-pencil-square-o fa-lg"></i></a>
- <a class="btn btn-default btn-sm" ms-click="delVim($index)"><i class="fa fa-trash-o fa-lg"> </i></a>
+ <a class="btn btn-default btn-sm" disabled="disabled" ms-click="delVim($index)"><i class="fa fa-trash-o fa-lg"> </i></a>
<!--<a class="btn btn-default btn-sm" ms-click="gotoChartPage(el.oid,el.name,el.user)"><i class="fa fa-pie-chart fa-lg"> </i></a>-->
</div>
</div>