Skip to content

Commit d54c9eb

Browse files
author
Jessica Wang
committed
CLOUDSTACK-4850: UI > Infrastructure > zone detail > UCS manager > Blade tab > (1) change action "Associate Profile to Blade" to "Associate Template to Blade", change Profile dropdown to Template dropdown, add ProfileName field in dialog. (2) action "Disassociate Profile from Blade": add checkbox "Delete Profile".
1 parent 4188916 commit d54c9eb

1 file changed

Lines changed: 58 additions & 63 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 58 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -13843,24 +13843,24 @@
1384313843
});
1384413844
},
1384513845
actions: {
13846-
associateProfileToBlade: {
13847-
label: 'Associate Profile to Blade',
13846+
associateTemplateToBlade: {
13847+
label: 'Associate Template to Blade',
1384813848
addRow: 'false',
1384913849
messages: {
1385013850
notification: function(args) {
13851-
return 'Associate Profile to Blade';
13851+
return 'Associate Template to Blade';
1385213852
}
1385313853
},
1385413854
createForm: {
13855-
title: 'Associate Profile to Blade',
13855+
title: 'Associate Template to Blade',
1385613856
fields: {
13857-
profiledn: {
13858-
label: 'Select Profile',
13857+
templatedn: {
13858+
label: 'Select Template',
1385913859
select: function(args) {
1386013860
var items = [];
1386113861

1386213862
$.ajax({
13863-
url: createURL('listUcsProfiles'),
13863+
url: createURL('listUcsTemplates'),
1386413864
data: {
1386513865
ucsmanagerid: args.context.ucsManagers[0].id
1386613866
},
@@ -13869,54 +13869,30 @@
1386913869
//for testing only (begin)
1387013870
/*
1387113871
json = {
13872-
"listucsprofileresponse": {
13873-
"count": 5,
13874-
"ucsprofile": [
13872+
"listucstemplatesresponse": {
13873+
"count": 1,
13874+
"ucstemplate": [
1387513875
{
13876-
"ucsdn": "org-root/ls-profile-for-blade-2"
13877-
},
13878-
{
13879-
"ucsdn": "org-root/ls-profile-for-blade-1"
13880-
},
13881-
{
13882-
"ucsdn": "org-root/ls-simpleProfile"
13883-
},
13884-
{
13885-
"ucsdn": "org-root/ls-testProfile"
13886-
},
13887-
{
13888-
"ucsdn": "org-root/ls-UCS_Test"
13876+
"ucsdn": "org-root/ls-test"
1388913877
}
1389013878
]
1389113879
}
1389213880
};
1389313881
*/
1389413882
//for testing only (end)
1389513883

13896-
var ucsprofiles = json.listucsprofileresponse.ucsprofile;
13897-
if (ucsprofiles != null) {
13898-
for (var i = 0; i < ucsprofiles.length; i++) {
13884+
var ucstemplates = json.listucstemplatesresponse.ucstemplate;
13885+
if (ucstemplates != null) {
13886+
for (var i = 0; i < ucstemplates.length; i++) {
1389913887
items.push({
13900-
id: ucsprofiles[i].ucsdn,
13901-
description: ucsprofiles[i].ucsdn
13888+
id: ucstemplates[i].ucsdn,
13889+
description: ucstemplates[i].ucsdn
1390213890
});
1390313891
}
1390413892
}
1390513893
}
1390613894
});
1390713895

13908-
//for testing only (begin)
13909-
/*
13910-
items.push({id: 'org-root/ls-testProfile1', description: 'org-root/ls-testProfile1'});
13911-
items.push({id: 'org-root/ls-testProfile2', description: 'org-root/ls-testProfile2'});
13912-
items.push({id: 'org-root/ls-testProfile3', description: 'org-root/ls-testProfile3'});
13913-
items.push({id: 'org-root/ls-testProfile4', description: 'org-root/ls-testProfile4'});
13914-
items.push({id: 'org-root/ls-testProfile5', description: 'org-root/ls-testProfile5'});
13915-
items.push({id: 'org-root/ls-testProfile6', description: 'org-root/ls-testProfile6'});
13916-
items.push({id: 'org-root/ls-testProfile7', description: 'org-root/ls-testProfile7'});
13917-
*/
13918-
//for testing only (end)
13919-
1392013896
args.response.success({
1392113897
data: items
1392213898
});
@@ -13925,29 +13901,40 @@
1392513901
validation: {
1392613902
required: true
1392713903
}
13904+
},
13905+
profilename: {
13906+
label: 'Profile'
1392813907
}
1392913908
}
1393013909
},
1393113910
action: function(args) {
13932-
$.ajax({
13933-
url: createURL('associateUcsProfileToBlade'), //This API has been changed from sync to async at 7/25/2013
13934-
data: {
13911+
var data = {
1393513912
ucsmanagerid: args.context.ucsManagers[0].id,
13936-
profiledn: args.data.profiledn,
13913+
templatedn: args.data.templatedn,
1393713914
bladeid: args.context.blades[0].id
13938-
},
13915+
};
13916+
13917+
if (args.data.profilename != null && args.data.profilename.length > 0) {
13918+
$.extend(data, {
13919+
profilename: args.data.profilename
13920+
});
13921+
}
13922+
13923+
$.ajax({
13924+
url: createURL('instantiateUcsTemplateAndAssocaciateToBlade'),
13925+
data: data,
1393913926
success: function(json) {
1394013927
//for testing only (begin)
1394113928
/*
1394213929
json = {
13943-
"associateucsprofiletobladeresponse": {
13944-
"jobid": "770bec68-7739-4127-8609-4b87bd7867d2"
13930+
"instantiateucstemplateandassociatetobladeresponse": {
13931+
"jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92"
1394513932
}
1394613933
}
1394713934
*/
1394813935
//for testing only (end)
1394913936

13950-
var jid = json.associateucsprofiletobladeresponse.jobid;
13937+
var jid = json.instantiateucstemplateandassociatetobladeresponse.jobid;
1395113938
args.response.success({
1395213939
_custom: {
1395313940
jobId: jid,
@@ -13956,23 +13943,23 @@
1395613943
/*
1395713944
json = {
1395813945
"queryasyncjobresultresponse": {
13959-
"accountid": "b24f6e36-f0ca-11e2-8c16-d637902e3581",
13960-
"userid": "b24f7d8d-f0ca-11e2-8c16-d637902e3581",
13961-
"cmd": "org.apache.cloudstack.api.AssociateUcsProfileToBladeCmd",
13946+
"accountid": "970b694a-2f8c-11e3-a77d-000c29b36ff5",
13947+
"userid": "970b7b4f-2f8c-11e3-a77d-000c29b36ff5",
13948+
"cmd": "org.apache.cloudstack.api.InstantiateUcsTemplateAndAssociateToBladeCmd",
1396213949
"jobstatus": 1,
1396313950
"jobprocstatus": 0,
1396413951
"jobresultcode": 0,
1396513952
"jobresulttype": "object",
1396613953
"jobresult": {
1396713954
"ucsblade": {
13968-
"id": "80ab25c8-3dcf-400e-8849-84dc5e1e6594",
13969-
"ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4",
13970-
"bladedn": "sys/chassis-1/blade-4",
13971-
"profiledn": "org-root/ls-profile-for-blade-4"
13955+
"id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30",
13956+
"ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a",
13957+
"bladedn": "sys/chassis-1/blade-3",
13958+
"profiledn": "org-root/ls-xxxx"
1397213959
}
1397313960
},
13974-
"created": "2013-07-26T13:53:01-0700",
13975-
"jobid": "770bec68-7739-4127-8609-4b87bd7867d2"
13961+
"created": "2013-10-10T17:29:00-0700",
13962+
"jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92"
1397613963
}
1397713964
};
1397813965
*/
@@ -13995,19 +13982,27 @@
1399513982
label: 'Disassociate Profile from Blade',
1399613983
addRow: 'false',
1399713984
messages: {
13998-
confirm: function(args) {
13999-
return 'Please confirm that you want to disassociate Profile from Blade.';
14000-
},
1400113985
notification: function(args) {
1400213986
return 'Disassociate Profile from Blade';
1400313987
}
1400413988
},
13989+
createForm: {
13990+
title: 'Disassociate Profile from Blade',
13991+
fields: {
13992+
deleteprofile: {
13993+
label: 'Delete Profile',
13994+
isBoolean: true,
13995+
isChecked: true
13996+
}
13997+
}
13998+
},
1400513999
action: function(args) {
14000+
debugger;
1400614001
$.ajax({
1400714002
url: createURL('disassociateUcsProfileFromBlade'),
1400814003
data: {
14009-
//ucsmanagerid: args.context.ucsManagers[0].id,
14010-
bladeid: args.context.blades[0].id
14004+
bladeid: args.context.blades[0].id,
14005+
deleteprofile: (args.data.deleteprofile == 'on'? true: false)
1401114006
},
1401214007
success: function(json) {
1401314008
//for testing only (begin)
@@ -16152,7 +16147,7 @@
1615216147
var jsonObj = args.context.item;
1615316148
var allowedActions = [];
1615416149
if(jsonObj.profiledn == null) {
16155-
allowedActions.push("associateProfileToBlade");
16150+
allowedActions.push("associateTemplateToBlade");
1615616151
} else {
1615716152
allowedActions.push("disassociateProfileFromBlade");
1615816153
}

0 commit comments

Comments
 (0)