Skip to content

Commit fa5b8a7

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 8b78c5f commit fa5b8a7

1 file changed

Lines changed: 71 additions & 76 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 71 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -13752,7 +13752,7 @@
1375213752
data: {
1375313753
id: args.context.ucsManagers[0].id
1375413754
},
13755-
success: function(json) {
13755+
success: function(json) {
1375613756
//for testing only (begin)
1375713757
/*
1375813758
json =
@@ -13849,24 +13849,24 @@
1384913849
});
1385013850
},
1385113851
actions: {
13852-
associateProfileToBlade: {
13853-
label: 'Associate Profile to Blade',
13852+
associateTemplateToBlade: {
13853+
label: 'Associate Template to Blade',
1385413854
addRow: 'false',
1385513855
messages: {
1385613856
notification: function(args) {
13857-
return 'Associate Profile to Blade';
13857+
return 'Associate Template to Blade';
1385813858
}
1385913859
},
1386013860
createForm: {
13861-
title: 'Associate Profile to Blade',
13861+
title: 'Associate Template to Blade',
1386213862
fields: {
13863-
profiledn: {
13864-
label: 'Select Profile',
13863+
templatedn: {
13864+
label: 'Select Template',
1386513865
select: function(args) {
1386613866
var items = [];
1386713867

1386813868
$.ajax({
13869-
url: createURL('listUcsProfiles'),
13869+
url: createURL('listUcsTemplates'),
1387013870
data: {
1387113871
ucsmanagerid: args.context.ucsManagers[0].id
1387213872
},
@@ -13875,53 +13875,29 @@
1387513875
//for testing only (begin)
1387613876
/*
1387713877
json = {
13878-
"listucsprofileresponse": {
13879-
"count": 5,
13880-
"ucsprofile": [
13881-
{
13882-
"ucsdn": "org-root/ls-profile-for-blade-2"
13883-
},
13884-
{
13885-
"ucsdn": "org-root/ls-profile-for-blade-1"
13886-
},
13887-
{
13888-
"ucsdn": "org-root/ls-simpleProfile"
13889-
},
13890-
{
13891-
"ucsdn": "org-root/ls-testProfile"
13892-
},
13893-
{
13894-
"ucsdn": "org-root/ls-UCS_Test"
13895-
}
13896-
]
13897-
}
13898-
};
13878+
"listucstemplatesresponse": {
13879+
"count": 1,
13880+
"ucstemplate": [
13881+
{
13882+
"ucsdn": "org-root/ls-test"
13883+
}
13884+
]
13885+
}
13886+
};
1389913887
*/
1390013888
//for testing only (end)
1390113889

13902-
var ucsprofiles = json.listucsprofileresponse.ucsprofile;
13903-
if (ucsprofiles != null) {
13904-
for (var i = 0; i < ucsprofiles.length; i++) {
13890+
var ucstemplates = json.listucstemplatesresponse.ucstemplate;
13891+
if (ucstemplates != null) {
13892+
for (var i = 0; i < ucstemplates.length; i++) {
1390513893
items.push({
13906-
id: ucsprofiles[i].ucsdn,
13907-
description: ucsprofiles[i].ucsdn
13894+
id: ucstemplates[i].ucsdn,
13895+
description: ucstemplates[i].ucsdn
1390813896
});
1390913897
}
1391013898
}
1391113899
}
13912-
});
13913-
13914-
//for testing only (begin)
13915-
/*
13916-
items.push({id: 'org-root/ls-testProfile1', description: 'org-root/ls-testProfile1'});
13917-
items.push({id: 'org-root/ls-testProfile2', description: 'org-root/ls-testProfile2'});
13918-
items.push({id: 'org-root/ls-testProfile3', description: 'org-root/ls-testProfile3'});
13919-
items.push({id: 'org-root/ls-testProfile4', description: 'org-root/ls-testProfile4'});
13920-
items.push({id: 'org-root/ls-testProfile5', description: 'org-root/ls-testProfile5'});
13921-
items.push({id: 'org-root/ls-testProfile6', description: 'org-root/ls-testProfile6'});
13922-
items.push({id: 'org-root/ls-testProfile7', description: 'org-root/ls-testProfile7'});
13923-
*/
13924-
//for testing only (end)
13900+
});
1392513901

1392613902
args.response.success({
1392713903
data: items
@@ -13931,29 +13907,40 @@
1393113907
validation: {
1393213908
required: true
1393313909
}
13910+
},
13911+
profilename: {
13912+
label: 'Profile'
1393413913
}
1393513914
}
1393613915
},
1393713916
action: function(args) {
13917+
var data = {
13918+
ucsmanagerid: args.context.ucsManagers[0].id,
13919+
templatedn: args.data.templatedn,
13920+
bladeid: args.context.blades[0].id
13921+
};
13922+
13923+
if (args.data.profilename != null && args.data.profilename.length > 0) {
13924+
$.extend(data, {
13925+
profilename: args.data.profilename
13926+
});
13927+
}
13928+
1393813929
$.ajax({
13939-
url: createURL('associateUcsProfileToBlade'), //This API has been changed from sync to async at 7/25/2013
13940-
data: {
13941-
ucsmanagerid: args.context.ucsManagers[0].id,
13942-
profiledn: args.data.profiledn,
13943-
bladeid: args.context.blades[0].id
13944-
},
13930+
url: createURL('instantiateUcsTemplateAndAssocaciateToBlade'),
13931+
data: data,
1394513932
success: function(json) {
1394613933
//for testing only (begin)
1394713934
/*
1394813935
json = {
13949-
"associateucsprofiletobladeresponse": {
13950-
"jobid": "770bec68-7739-4127-8609-4b87bd7867d2"
13936+
"instantiateucstemplateandassociatetobladeresponse": {
13937+
"jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92"
1395113938
}
1395213939
}
1395313940
*/
1395413941
//for testing only (end)
1395513942

13956-
var jid = json.associateucsprofiletobladeresponse.jobid;
13943+
var jid = json.instantiateucstemplateandassociatetobladeresponse.jobid;
1395713944
args.response.success({
1395813945
_custom: {
1395913946
jobId: jid,
@@ -13962,25 +13949,25 @@
1396213949
/*
1396313950
json = {
1396413951
"queryasyncjobresultresponse": {
13965-
"accountid": "b24f6e36-f0ca-11e2-8c16-d637902e3581",
13966-
"userid": "b24f7d8d-f0ca-11e2-8c16-d637902e3581",
13967-
"cmd": "org.apache.cloudstack.api.AssociateUcsProfileToBladeCmd",
13952+
"accountid": "970b694a-2f8c-11e3-a77d-000c29b36ff5",
13953+
"userid": "970b7b4f-2f8c-11e3-a77d-000c29b36ff5",
13954+
"cmd": "org.apache.cloudstack.api.InstantiateUcsTemplateAndAssociateToBladeCmd",
1396813955
"jobstatus": 1,
1396913956
"jobprocstatus": 0,
1397013957
"jobresultcode": 0,
1397113958
"jobresulttype": "object",
1397213959
"jobresult": {
1397313960
"ucsblade": {
13974-
"id": "80ab25c8-3dcf-400e-8849-84dc5e1e6594",
13975-
"ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4",
13976-
"bladedn": "sys/chassis-1/blade-4",
13977-
"profiledn": "org-root/ls-profile-for-blade-4"
13961+
"id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30",
13962+
"ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a",
13963+
"bladedn": "sys/chassis-1/blade-3",
13964+
"profiledn": "org-root/ls-xxxx"
1397813965
}
1397913966
},
13980-
"created": "2013-07-26T13:53:01-0700",
13981-
"jobid": "770bec68-7739-4127-8609-4b87bd7867d2"
13967+
"created": "2013-10-10T17:29:00-0700",
13968+
"jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92"
1398213969
}
13983-
};
13970+
};
1398413971
*/
1398513972
//for testing only (end)
1398613973

@@ -14000,20 +13987,28 @@
1400013987
disassociateProfileFromBlade: {
1400113988
label: 'Disassociate Profile from Blade',
1400213989
addRow: 'false',
14003-
messages: {
14004-
confirm: function(args) {
14005-
return 'Please confirm that you want to disassociate Profile from Blade.';
14006-
},
13990+
messages: {
1400713991
notification: function(args) {
1400813992
return 'Disassociate Profile from Blade';
1400913993
}
14010-
},
14011-
action: function(args) {
13994+
},
13995+
createForm: {
13996+
title: 'Disassociate Profile from Blade',
13997+
fields: {
13998+
deleteprofile: {
13999+
label: 'Delete Profile',
14000+
isBoolean: true,
14001+
isChecked: true
14002+
}
14003+
}
14004+
},
14005+
action: function(args) {
14006+
debugger;
1401214007
$.ajax({
1401314008
url: createURL('disassociateUcsProfileFromBlade'),
14014-
data: {
14015-
//ucsmanagerid: args.context.ucsManagers[0].id,
14016-
bladeid: args.context.blades[0].id
14009+
data: {
14010+
bladeid: args.context.blades[0].id,
14011+
deleteprofile: (args.data.deleteprofile == 'on'? true: false)
1401714012
},
1401814013
success: function(json) {
1401914014
//for testing only (begin)
@@ -16158,7 +16153,7 @@
1615816153
var jsonObj = args.context.item;
1615916154
var allowedActions = [];
1616016155
if(jsonObj.profiledn == null) {
16161-
allowedActions.push("associateProfileToBlade");
16156+
allowedActions.push("associateTemplateToBlade");
1616216157
} else {
1616316158
allowedActions.push("disassociateProfileFromBlade");
1616416159
}

0 commit comments

Comments
 (0)