Format JS

This commit is contained in:
Ian Duffy 2013-07-18 15:39:28 +01:00 committed by Sebastien Goasguen
parent dfa612d1fe
commit ad69bc8da3
62 changed files with 64071 additions and 59088 deletions

View File

@ -36,14 +36,18 @@
listView: { listView: {
id: 'accounts', id: 'accounts',
fields: { fields: {
name: { label: 'label.name' }, name: {
label: 'label.name'
},
accounttype: { accounttype: {
label: 'label.role', label: 'label.role',
converter: function(args){ converter: function(args) {
return cloudStack.converters.toRole(args); return cloudStack.converters.toRole(args);
} }
}, },
domain: { label: 'label.domain' }, domain: {
label: 'label.domain'
},
state: { state: {
converter: function(str) { converter: function(str) {
// For localization // For localization
@ -62,7 +66,7 @@
add: { add: {
label: 'label.add.account', label: 'label.add.account',
preFilter: function(args) { preFilter: function(args) {
if(isAdmin()) if (isAdmin())
return true; return true;
else else
return false; return false;
@ -79,12 +83,16 @@
fields: { fields: {
username: { username: {
label: 'label.username', label: 'label.username',
validation: { required: true }, validation: {
required: true
},
docID: 'helpAccountUsername' docID: 'helpAccountUsername'
}, },
password: { password: {
label: 'label.password', label: 'label.password',
validation: { required: true }, validation: {
required: true
},
isPassword: true, isPassword: true,
id: 'password', id: 'password',
docID: 'helpAccountPassword' docID: 'helpAccountPassword'
@ -100,23 +108,32 @@
}, },
email: { email: {
label: 'label.email', label: 'label.email',
validation: { required: true, email:true }, validation: {
required: true,
email: true
},
docID: 'helpAccountEmail' docID: 'helpAccountEmail'
}, },
firstname: { firstname: {
label: 'label.first.name', label: 'label.first.name',
validation: { required: true }, validation: {
required: true
},
docID: 'helpAccountFirstName' docID: 'helpAccountFirstName'
}, },
lastname: { lastname: {
label: 'label.last.name', label: 'label.last.name',
validation: { required: true }, validation: {
required: true
},
docID: 'helpAccountLastName' docID: 'helpAccountLastName'
}, },
domainid: { domainid: {
label: 'label.domain', label: 'label.domain',
docID: 'helpAccountDomain', docID: 'helpAccountDomain',
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
var data = {}; var data = {};
@ -135,12 +152,17 @@
var items = []; var items = [];
domainObjs = json.listdomainsresponse.domain; domainObjs = json.listdomainsresponse.domain;
$(domainObjs).each(function() { $(domainObjs).each(function() {
items.push({ id: this.id, description: this.path }); items.push({
id: this.id,
description: this.path
});
if(this.level == 0) if (this.level == 0)
rootDomainId = this.id; rootDomainId = this.id;
}); });
args.response.success({ data: items }); args.response.success({
data: items
});
} }
}); });
} }
@ -152,12 +174,22 @@
accounttype: { accounttype: {
label: 'label.type', label: 'label.type',
docID: 'helpAccountType', docID: 'helpAccountType',
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
var items = []; var items = [];
items.push({id:0, description: "User"}); //regular-user items.push({
items.push({id:1, description: "Admin"}); //root-admin id: 0,
args.response.success({data: items}); description: "User"
}); //regular-user
items.push({
id: 1,
description: "Admin"
}); //root-admin
args.response.success({
data: items
});
} }
}, },
timezone: { timezone: {
@ -165,16 +197,26 @@
docID: 'helpAccountTimezone', docID: 'helpAccountTimezone',
select: function(args) { select: function(args) {
var items = []; var items = [];
items.push({id: "", description: ""}); items.push({
for(var p in timezoneMap) id: "",
items.push({id: p, description: timezoneMap[p]}); description: ""
args.response.success({data: items}); });
for (var p in timezoneMap)
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
} }
}, },
networkdomain: { networkdomain: {
label: 'label.network.domain', label: 'label.network.domain',
docID: 'helpAccountNetworkDomain', docID: 'helpAccountNetworkDomain',
validation: { required: false } validation: {
required: false
}
} }
} }
}, },
@ -200,7 +242,7 @@
}); });
var account = args.data.account; var account = args.data.account;
if(account == null || account.length == 0) { if (account == null || account.length == 0) {
account = args.data.username; account = args.data.username;
} }
$.extend(data, { $.extend(data, {
@ -215,13 +257,13 @@
accounttype: accountType accounttype: accountType
}); });
if(args.data.timezone != null && args.data.timezone.length > 0) { if (args.data.timezone != null && args.data.timezone.length > 0) {
$.extend(data, { $.extend(data, {
timezone: args.data.timezone timezone: args.data.timezone
}); });
} }
if(args.data.networkdomain != null && args.data.networkdomain.length > 0) { if (args.data.networkdomain != null && args.data.networkdomain.length > 0) {
$.extend(data, { $.extend(data, {
networkdomain: args.data.networkdomain networkdomain: args.data.networkdomain
}); });
@ -233,7 +275,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.createaccountresponse.account; var item = json.createaccountresponse.account;
args.response.success({data:item}); args.response.success({
data: item
});
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
args.response.error(parseXMLHttpResponse(XMLHttpResponse)); args.response.error(parseXMLHttpResponse(XMLHttpResponse));
@ -255,7 +299,7 @@
var data = {}; var data = {};
listViewDataProvider(args, data); listViewDataProvider(args, data);
if("domains" in args.context) { if ("domains" in args.context) {
$.extend(data, { $.extend(data, {
domainid: args.context.domains[0].id domainid: args.context.domains[0].id
}); });
@ -269,7 +313,7 @@
var items = json.listaccountsresponse.account; var items = json.listaccountsresponse.account;
args.response.success({ args.response.success({
actionFilter: accountActionfilter, actionFilter: accountActionfilter,
data:items data: items
}); });
} }
}); });
@ -278,7 +322,10 @@
detailView: { detailView: {
name: 'Account details', name: 'Account details',
isMaximized: true, isMaximized: true,
viewAll: { path: 'accounts.users', label: 'label.users' }, viewAll: {
path: 'accounts.users',
label: 'label.users'
},
actions: { actions: {
edit: { edit: {
@ -307,7 +354,7 @@
} }
}); });
if(args.data.vmLimit != null) { if (args.data.vmLimit != null) {
var data = { var data = {
resourceType: 0, resourceType: 0,
max: args.data.vmLimit, max: args.data.vmLimit,
@ -324,7 +371,7 @@
}); });
} }
if(args.data.ipLimit != null) { if (args.data.ipLimit != null) {
var data = { var data = {
resourceType: 1, resourceType: 1,
max: args.data.ipLimit, max: args.data.ipLimit,
@ -341,7 +388,7 @@
}); });
} }
if(args.data.volumeLimit != null) { if (args.data.volumeLimit != null) {
var data = { var data = {
resourceType: 2, resourceType: 2,
max: args.data.volumeLimit, max: args.data.volumeLimit,
@ -358,7 +405,7 @@
}); });
} }
if(args.data.snapshotLimit != null) { if (args.data.snapshotLimit != null) {
var data = { var data = {
resourceType: 3, resourceType: 3,
max: args.data.snapshotLimit, max: args.data.snapshotLimit,
@ -375,7 +422,7 @@
}); });
} }
if(args.data.templateLimit != null) { if (args.data.templateLimit != null) {
var data = { var data = {
resourceType: 4, resourceType: 4,
max: args.data.templateLimit, max: args.data.templateLimit,
@ -392,7 +439,7 @@
}); });
} }
if(args.data.vpcLimit != null) { if (args.data.vpcLimit != null) {
var data = { var data = {
resourceType: 7, resourceType: 7,
max: args.data.vpcLimit, max: args.data.vpcLimit,
@ -410,7 +457,7 @@
}); });
} }
if(args.data.cpuLimit != null) { if (args.data.cpuLimit != null) {
var data = { var data = {
resourceType: 8, resourceType: 8,
max: args.data.cpuLimit, max: args.data.cpuLimit,
@ -428,7 +475,7 @@
}); });
} }
if(args.data.memoryLimit != null) { if (args.data.memoryLimit != null) {
var data = { var data = {
resourceType: 9, resourceType: 9,
max: args.data.memoryLimit, max: args.data.memoryLimit,
@ -446,7 +493,7 @@
}); });
} }
if(args.data.primaryStorageLimit != null) { if (args.data.primaryStorageLimit != null) {
var data = { var data = {
resourceType: 10, resourceType: 10,
max: args.data.primaryStorageLimit, max: args.data.primaryStorageLimit,
@ -464,7 +511,7 @@
}); });
} }
if(args.data.secondaryStorageLimit != null) { if (args.data.secondaryStorageLimit != null) {
var data = { var data = {
resourceType: 11, resourceType: 11,
max: args.data.secondaryStorageLimit, max: args.data.secondaryStorageLimit,
@ -481,7 +528,9 @@
} }
}); });
} }
args.response.success({data: accountObj}); args.response.success({
data: accountObj
});
} }
}, },
@ -546,9 +595,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.disableaccountresponse.jobid; var jid = json.disableaccountresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.account; return json.queryasyncjobresultresponse.jobresult.account;
}, },
@ -556,8 +605,7 @@
return accountActionfilter; return accountActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -590,9 +638,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.disableaccountresponse.jobid; var jid = json.disableaccountresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.account; return json.queryasyncjobresultresponse.jobresult.account;
}, },
@ -600,8 +648,7 @@
return accountActionfilter; return accountActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -631,14 +678,18 @@
data: data, data: data,
async: true, async: true,
success: function(json) { success: function(json) {
args.response.success({data: json.enableaccountresponse.account}); args.response.success({
data: json.enableaccountresponse.account
});
} }
}); });
}, },
notification: { notification: {
poll: function(args) { poll: function(args) {
args.complete({ args.complete({
data: { state: 'enabled' } data: {
state: 'enabled'
}
}); });
} }
} }
@ -664,9 +715,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.deleteaccountresponse.jobid; var jid = json.deleteaccountresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return {}; //nothing in this account needs to be updated, in fact, this whole account has being deleted return {}; //nothing in this account needs to be updated, in fact, this whole account has being deleted
}, },
@ -674,8 +725,7 @@
return accountActionfilter; return accountActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -690,24 +740,30 @@
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{
name: { name: {
label: 'label.name', label: 'label.name',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
} }
}
}, {
id: {
label: 'ID'
}, },
{
id: { label: 'ID' },
accounttype: { accounttype: {
label: 'label.role', label: 'label.role',
converter: function(args){ converter: function(args) {
return cloudStack.converters.toRole(args); return cloudStack.converters.toRole(args);
} }
}, },
domain: { label: 'label.domain' }, domain: {
state: { label: 'label.state' }, label: 'label.domain'
},
state: {
label: 'label.state'
},
networkdomain: { networkdomain: {
label: 'label.network.domain', label: 'label.network.domain',
isEditable: true isEditable: true
@ -716,14 +772,15 @@
label: 'label.instance.limits', label: 'label.instance.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.accounts == undefined) if (context.accounts == undefined)
return false; return false;
else { else {
if (context.accounts[0].accounttype == roleTypeUser || context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits is only allowed on account whose type is user or domain-admin if (context.accounts[0].accounttype == roleTypeUser || context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits is only allowed on account whose type is user or domain-admin
return true; return true;
else else
return false; return false;
} } }
}
}, },
ipLimit: { ipLimit: {
label: 'label.ip.limits', label: 'label.ip.limits',
@ -807,8 +864,12 @@
} }
}, },
vmtotal: { label: 'label.total.of.vm' }, vmtotal: {
iptotal: { label: 'label.total.of.ip' }, label: 'label.total.of.vm'
},
iptotal: {
label: 'label.total.of.ip'
},
receivedbytes: { receivedbytes: {
label: 'label.bytes.received', label: 'label.bytes.received',
converter: function(args) { converter: function(args) {
@ -827,8 +888,7 @@
return cloudStack.converters.convertBytes(args); return cloudStack.converters.convertBytes(args);
} }
} }
} }],
],
dataProvider: function(args) { dataProvider: function(args) {
var data = { var data = {
@ -885,12 +945,10 @@
} }
} }
} }
args.response.success( args.response.success({
{
actionFilter: accountActionfilter, actionFilter: accountActionfilter,
data: accountObj data: accountObj
} });
);
} }
}); });
} }
@ -904,17 +962,21 @@
custom: cloudStack.uiCustom.granularSettings({ custom: cloudStack.uiCustom.granularSettings({
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url:createURL('listConfigurations&accountid=' + args.context.accounts[0].id), url: createURL('listConfigurations&accountid=' + args.context.accounts[0].id),
data: { page: args.page, pageSize: pageSize, listAll: true }, data: {
success:function(json){ page: args.page,
pageSize: pageSize,
listAll: true
},
success: function(json) {
args.response.success({ args.response.success({
data:json.listconfigurationsresponse.configuration data: json.listconfigurationsresponse.configuration
}); });
}, },
error:function(json){ error: function(json) {
args.response.error(parseXMLHttpResponse(json)); args.response.error(parseXMLHttpResponse(json));
} }
@ -930,11 +992,13 @@
}; };
$.ajax({ $.ajax({
url:createURL('updateConfiguration&accountid=' + args.context.accounts[0].id), url: createURL('updateConfiguration&accountid=' + args.context.accounts[0].id),
data:data, data: data,
success:function(json){ success: function(json) {
var item = json.updateconfigurationresponse.configuration; var item = json.updateconfigurationresponse.configuration;
args.response.success({data:item}); args.response.success({
data: item
});
}, },
error: function(json) { error: function(json) {
@ -958,14 +1022,21 @@
listView: { listView: {
id: 'users', id: 'users',
fields: { fields: {
username: { label: 'label.username', editable: true }, username: {
firstname: { label: 'label.first.name' }, label: 'label.username',
lastname: { label: 'label.last.name' } editable: true
},
firstname: {
label: 'label.first.name'
},
lastname: {
label: 'label.last.name'
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
var accountObj = args.context.accounts[0]; var accountObj = args.context.accounts[0];
if(isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
var data = { var data = {
domainid: accountObj.domainid, domainid: accountObj.domainid,
account: accountObj.name account: accountObj.name
@ -982,8 +1053,7 @@
}); });
} }
}) })
} } else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
args.response.success({ args.response.success({
actionFilter: userActionfilter, actionFilter: userActionfilter,
data: accountObj.user data: accountObj.user
@ -995,7 +1065,7 @@
label: 'label.add.user', label: 'label.add.user',
preFilter: function(args) { preFilter: function(args) {
if(isAdmin()) if (isAdmin())
return true; return true;
else else
return false; return false;
@ -1012,13 +1082,17 @@
fields: { fields: {
username: { username: {
label: 'label.username', label: 'label.username',
validation: { required: true }, validation: {
required: true
},
docID: 'helpUserUsername' docID: 'helpUserUsername'
}, },
password: { password: {
label: 'label.password', label: 'label.password',
isPassword: true, isPassword: true,
validation: { required: true }, validation: {
required: true
},
id: 'password', id: 'password',
docID: 'helpUserPassword' docID: 'helpUserPassword'
}, },
@ -1034,27 +1108,42 @@
email: { email: {
label: 'label.email', label: 'label.email',
docID: 'helpUserEmail', docID: 'helpUserEmail',
validation: { required: true, email: true } validation: {
required: true,
email: true
}
}, },
firstname: { firstname: {
label: 'label.first.name', label: 'label.first.name',
docID: 'helpUserFirstName', docID: 'helpUserFirstName',
validation: { required: true } validation: {
required: true
}
}, },
lastname: { lastname: {
label: 'label.last.name', label: 'label.last.name',
docID: 'helpUserLastName', docID: 'helpUserLastName',
validation: { required: true } validation: {
required: true
}
}, },
timezone: { timezone: {
label: 'label.timezone', label: 'label.timezone',
docID: 'helpUserTimezone', docID: 'helpUserTimezone',
select: function(args) { select: function(args) {
var items = []; var items = [];
items.push({id: "", description: ""}); items.push({
for(var p in timezoneMap) id: "",
items.push({id: p, description: timezoneMap[p]}); description: ""
args.response.success({data: items}); });
for (var p in timezoneMap)
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
} }
} }
} }
@ -1081,7 +1170,7 @@
lastname: args.data.lastname lastname: args.data.lastname
}); });
if(args.data.timezone != null && args.data.timezone.length > 0) { if (args.data.timezone != null && args.data.timezone.length > 0) {
$.extend(data, { $.extend(data, {
timezone: args.data.timezone timezone: args.data.timezone
}); });
@ -1099,7 +1188,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.createuserresponse.user; var item = json.createuserresponse.user;
args.response.success({data: item}); args.response.success({
data: item
});
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse); var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@ -1136,7 +1227,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.updateuserresponse.user; var item = json.updateuserresponse.user;
args.response.success({data:item}); args.response.success({
data: item
});
}, },
error: function(data) { error: function(data) {
args.response.error(parseXMLHttpResponse(data)); args.response.error(parseXMLHttpResponse(data));
@ -1159,7 +1252,9 @@
newPassword: { newPassword: {
label: 'label.new.password', label: 'label.new.password',
isPassword: true, isPassword: true,
validation: { required: true }, validation: {
required: true
},
id: 'newPassword' id: 'newPassword'
}, },
'password-confirm': { 'password-confirm': {
@ -1187,7 +1282,9 @@
data: data, data: data,
async: true, async: true,
success: function(json) { success: function(json) {
args.response.success({data: json.updateuserresponse.user}); args.response.success({
data: json.updateuserresponse.user
});
} }
}); });
}, },
@ -1216,7 +1313,9 @@
url: createURL('registerUserKeys'), url: createURL('registerUserKeys'),
data: data, data: data,
success: function(json) { success: function(json) {
args.response.success({data: json.registeruserkeysresponse.userkeys}); args.response.success({
data: json.registeruserkeysresponse.userkeys
});
} }
}); });
}, },
@ -1246,9 +1345,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var jid = json.disableuserresponse.jobid; var jid = json.disableuserresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.user; return json.queryasyncjobresultresponse.jobresult.user;
}, },
@ -1256,8 +1355,7 @@
return userActionfilter; return userActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -1284,7 +1382,9 @@
url: createURL('enableUser'), url: createURL('enableUser'),
data: data, data: data,
success: function(json) { success: function(json) {
args.response.success({data: json.enableuserresponse.user}); args.response.success({
data: json.enableuserresponse.user
});
}, },
error: function(json) { error: function(json) {
args.response.error(parseXMLHttpResponse(json)); args.response.error(parseXMLHttpResponse(json));
@ -1331,46 +1431,65 @@
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{
username: { username: {
label: 'label.name', label: 'label.name',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
} }
}
}, {
id: {
label: 'ID'
},
state: {
label: 'label.state'
},
apikey: {
label: 'label.api.key'
},
secretkey: {
label: 'label.secret.key'
},
account: {
label: 'label.account.name'
}, },
{
id: { label: 'ID' },
state: { label: 'label.state' },
apikey: { label: 'label.api.key' },
secretkey: { label: 'label.secret.key' },
account: { label: 'label.account.name' },
accounttype: { accounttype: {
label: 'label.role', label: 'label.role',
converter: function(args) { converter: function(args) {
return cloudStack.converters.toRole(args); return cloudStack.converters.toRole(args);
} }
}, },
domain: { label: 'label.domain' }, domain: {
label: 'label.domain'
},
email: { email: {
label: 'label.email', label: 'label.email',
isEditable: true, isEditable: true,
validation: { required: true, email: true } validation: {
required: true,
email: true
}
}, },
firstname: { firstname: {
label: 'label.first.name', label: 'label.first.name',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
}
}, },
lastname: { lastname: {
label: 'label.last.name', label: 'label.last.name',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
}
}, },
timezone: { timezone: {
label: 'label.timezone', label: 'label.timezone',
converter: function(args) { converter: function(args) {
if(args == null || args.length == 0) if (args == null || args.length == 0)
return ""; return "";
else else
return args; return args;
@ -1378,17 +1497,24 @@
isEditable: true, isEditable: true,
select: function(args) { select: function(args) {
var items = []; var items = [];
items.push({id: "", description: ""}); items.push({
for(var p in timezoneMap) id: "",
items.push({id: p, description: timezoneMap[p]}); description: ""
args.response.success({data: items}); });
for (var p in timezoneMap)
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
} }
} }
} }],
],
dataProvider: function(args) { dataProvider: function(args) {
if(isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
$.ajax({ $.ajax({
url: createURL('listUsers'), url: createURL('listUsers'),
data: { data: {
@ -1401,8 +1527,7 @@
}); });
} }
}); });
} } else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
args.response.success({ args.response.success({
actionFilter: userActionfilter, actionFilter: userActionfilter,
data: args.context.users[0] data: args.context.users[0]
@ -1423,22 +1548,22 @@
if (jsonObj.state == 'Destroyed') return []; if (jsonObj.state == 'Destroyed') return [];
if( isAdmin() && jsonObj.isdefault == false) if (isAdmin() && jsonObj.isdefault == false)
allowedActions.push("remove"); allowedActions.push("remove");
if(isAdmin()) { if (isAdmin()) {
allowedActions.push("edit"); //updating networkdomain is allowed on any account, including system-generated default admin account allowedActions.push("edit"); //updating networkdomain is allowed on any account, including system-generated default admin account
if(!(jsonObj.domain == "ROOT" && jsonObj.name == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account if (!(jsonObj.domain == "ROOT" && jsonObj.name == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account
if(jsonObj.state == "enabled") { if (jsonObj.state == "enabled") {
allowedActions.push("disable"); allowedActions.push("disable");
allowedActions.push("lock"); allowedActions.push("lock");
} else if(jsonObj.state == "disabled" || jsonObj.state == "locked") { } else if (jsonObj.state == "disabled" || jsonObj.state == "locked") {
allowedActions.push("enable"); allowedActions.push("enable");
} }
allowedActions.push("remove"); allowedActions.push("remove");
} }
allowedActions.push("updateResourceCount"); allowedActions.push("updateResourceCount");
} else if(isDomainAdmin()) { } else if (isDomainAdmin()) {
allowedActions.push("updateResourceCount"); allowedActions.push("updateResourceCount");
} }
return allowedActions; return allowedActions;
@ -1448,22 +1573,22 @@
var jsonObj = args.context.item; var jsonObj = args.context.item;
var allowedActions = []; var allowedActions = [];
if( isAdmin() && jsonObj.isdefault == false) if (isAdmin() && jsonObj.isdefault == false)
allowedActions.push("remove"); allowedActions.push("remove");
if(isAdmin()) { if (isAdmin()) {
allowedActions.push("edit"); allowedActions.push("edit");
allowedActions.push("changePassword"); allowedActions.push("changePassword");
allowedActions.push("generateKeys"); allowedActions.push("generateKeys");
if(!(jsonObj.domain == "ROOT" && jsonObj.account == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account user if (!(jsonObj.domain == "ROOT" && jsonObj.account == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account user
if(jsonObj.state == "enabled") if (jsonObj.state == "enabled")
allowedActions.push("disable"); allowedActions.push("disable");
if(jsonObj.state == "disabled") if (jsonObj.state == "disabled")
allowedActions.push("enable"); allowedActions.push("enable");
allowedActions.push("remove"); allowedActions.push("remove");
} }
} else { } else {
if(isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) { if (isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) {
allowedActions.push("changePassword"); allowedActions.push("changePassword");
allowedActions.push("generateKeys"); allowedActions.push("generateKeys");
} }

View File

@ -20,8 +20,12 @@
listView: { listView: {
id: 'affinityGroups', id: 'affinityGroups',
fields: { fields: {
name: { label: 'label.name' }, name: {
type: { label: 'label.type' } label: 'label.name'
},
type: {
label: 'label.type'
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
var data = {}; var data = {};
@ -37,7 +41,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.listaffinitygroupsresponse.affinitygroup; var items = json.listaffinitygroupsresponse.affinitygroup;
args.response.success({data: items}); args.response.success({
data: items
});
} }
}); });
}, },
@ -56,7 +62,9 @@
fields: { fields: {
name: { name: {
label: 'label.name', label: 'label.name',
validation: { required: true } validation: {
required: true
}
}, },
description: { description: {
label: 'label.description' label: 'label.description'
@ -69,12 +77,17 @@
success: function(json) { success: function(json) {
var types = []; var types = [];
var items = json.listaffinitygrouptypesresponse.affinityGroupType; var items = json.listaffinitygrouptypesresponse.affinityGroupType;
if(items != null) { if (items != null) {
for(var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
types.push({id: items[i].type, description: items[i].type}); types.push({
id: items[i].type,
description: items[i].type
});
} }
} }
args.response.success({data: types}) args.response.success({
data: types
})
} }
}); });
} }
@ -87,23 +100,24 @@
name: args.data.name, name: args.data.name,
type: args.data.type type: args.data.type
}; };
if(args.data.description != null && args.data.description.length > 0) if (args.data.description != null && args.data.description.length > 0)
$.extend(data, {description: args.data.description}); $.extend(data, {
description: args.data.description
});
$.ajax({ $.ajax({
url: createURL('createAffinityGroup'), url: createURL('createAffinityGroup'),
data: data, data: data,
success: function(json) { success: function(json) {
var jid = json.createaffinitygroupresponse.jobid; var jid = json.createaffinitygroupresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.affinitygroup; return json.queryasyncjobresultresponse.jobresult.affinitygroup;
} }
} }
} });
);
} }
}); });
}, },
@ -134,7 +148,7 @@
success: function(json) { success: function(json) {
var jid = json.deleteaffinitygroupresponse.jobid; var jid = json.deleteaffinitygroupresponse.jobid;
args.response.success({ args.response.success({
_custom:{ _custom: {
jobId: jid jobId: jid
} }
}); });
@ -147,21 +161,29 @@
} }
}, },
viewAll: { path: 'instances', label: 'label.instances' }, viewAll: {
path: 'instances',
label: 'label.instances'
},
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ name: {
name: { label: 'label.name' } label: 'label.name'
},
{
description: { label: 'label.description' },
type: { label: 'label.type' },
id: { label: 'label.id' }
} }
], }, {
description: {
label: 'label.description'
},
type: {
label: 'label.type'
},
id: {
label: 'label.id'
}
}],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
@ -171,7 +193,9 @@
}, },
success: function(json) { success: function(json) {
var item = json.listaffinitygroupsresponse.affinitygroup[0]; var item = json.listaffinitygroupsresponse.affinitygroup[0];
args.response.success({data: item}); args.response.success({
data: item
});
} }
}); });
} }

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,13 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
$.urlParam = function(name){ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (!results) { return 0; } return results[1] || 0;} $.urlParam = function(name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results) {
return 0;
}
return results[1] || 0;
}
/* /*
This file is meant to help with implementing single signon integration. If you are using the This file is meant to help with implementing single signon integration. If you are using the
@ -26,6 +32,7 @@ This callback function is called when either the session has timed out for the u
the session ID has been changed (i.e. another user logging into the UI via a different tab), the session ID has been changed (i.e. another user logging into the UI via a different tab),
or it's the first time the user has come to this page. or it's the first time the user has come to this page.
*/ */
function onLogoutCallback() { function onLogoutCallback() {
g_loginResponse = null; //clear single signon variable g_loginResponse g_loginResponse = null; //clear single signon variable g_loginResponse
@ -56,7 +63,7 @@ $(document).ready(function() {
var url = $.urlParam("loginUrl"); var url = $.urlParam("loginUrl");
if (url != undefined && url != null && url.length > 0) { if (url != undefined && url != null && url.length > 0) {
url = unescape(clientApiUrl+"?"+url); url = unescape(clientApiUrl + "?" + url);
$.ajax({ $.ajax({
url: url, url: url,
dataType: "json", dataType: "json",
@ -74,5 +81,3 @@ $(document).ready(function() {
}); });
} }
}); });

View File

@ -21,16 +21,13 @@
sectionPreFilter: function(args) { sectionPreFilter: function(args) {
var sections = []; var sections = [];
if(isAdmin()) { if (isAdmin()) {
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions", "affinityGroups"]; sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions", "affinityGroups"];
} } else if (isDomainAdmin()) {
else if(isDomainAdmin()) {
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects", "regions", "affinityGroups"]; sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects", "regions", "affinityGroups"];
} } else if (g_userProjectsEnabled) {
else if (g_userProjectsEnabled) {
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects", "regions", "affinityGroups"]; sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects", "regions", "affinityGroups"];
} } else { //normal user
else { //normal user
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "regions", "affinityGroups"]; sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "regions", "affinityGroups"];
} }
@ -83,26 +80,31 @@
var json = JSON.parse(data.responseText); var json = JSON.parse(data.responseText);
if (json != null) { if (json != null) {
var property; var property;
for(property in json) {} for (property in json) {}
var errorObj = json[property]; var errorObj = json[property];
if(errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature") { if (errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature") {
clickAction = function() { clickAction = function() {
$('#user-options a').eq(0).trigger('click'); $('#user-options a').eq(0).trigger('click');
}; };
} }
} }
} }
cloudStack.dialog.notice({ message: parseXMLHttpResponse(data), clickAction: clickAction }); cloudStack.dialog.notice({
message: parseXMLHttpResponse(data),
clickAction: clickAction
});
}, },
beforeSend: function(XMLHttpRequest) { beforeSend: function(XMLHttpRequest) {
if (g_mySession == $.cookie("JSESSIONID")) { if (g_mySession == $.cookie("JSESSIONID")) {
return true; return true;
} } else {
else {
var clickAction = function() { var clickAction = function() {
$('#user-options a').eq(0).trigger('click'); $('#user-options a').eq(0).trigger('click');
}; };
cloudStack.dialog.notice({ message: _l('label.session.expired'), clickAction: clickAction }); cloudStack.dialog.notice({
message: _l('label.session.expired'),
clickAction: clickAction
});
return false; return false;
} }
} }
@ -130,12 +132,11 @@
g_domainid = $.cookie('domainid'); g_domainid = $.cookie('domainid');
g_userfullname = $.cookie('userfullname'); g_userfullname = $.cookie('userfullname');
g_timezone = $.cookie('timezone'); g_timezone = $.cookie('timezone');
if($.cookie('timezoneoffset') != null) if ($.cookie('timezoneoffset') != null)
g_timezoneoffset = isNaN($.cookie('timezoneoffset'))? null: parseFloat($.cookie('timezoneoffset')); g_timezoneoffset = isNaN($.cookie('timezoneoffset')) ? null : parseFloat($.cookie('timezoneoffset'));
else else
g_timezoneoffset = null; g_timezoneoffset = null;
} } else { //single-sign-on (bypass login screen)
else { //single-sign-on (bypass login screen)
g_mySession = $.cookie('JSESSIONID'); g_mySession = $.cookie('JSESSIONID');
g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey); g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey);
g_role = g_loginResponse.type; g_role = g_loginResponse.type;
@ -145,8 +146,8 @@
g_domainid = g_loginResponse.domainid; g_domainid = g_loginResponse.domainid;
g_userfullname = g_loginResponse.firstname + ' ' + g_loginResponse.lastname; g_userfullname = g_loginResponse.firstname + ' ' + g_loginResponse.lastname;
g_timezone = g_loginResponse.timezone; g_timezone = g_loginResponse.timezone;
if(g_loginResponse.timezoneoffset != null) if (g_loginResponse.timezoneoffset != null)
g_timezoneoffset = isNaN(g_loginResponse.timezoneoffset)? null: parseFloat(g_loginResponse.timezoneoffset); g_timezoneoffset = isNaN(g_loginResponse.timezoneoffset) ? null : parseFloat(g_loginResponse.timezoneoffset);
else else
g_timezoneoffset = null; g_timezoneoffset = null;
} }
@ -158,25 +159,33 @@
async: false, async: false,
success: function(json) { success: function(json) {
g_capabilities = json.listcapabilitiesresponse.capability; g_capabilities = json.listcapabilitiesresponse.capability;
$.cookie('capabilities', g_capabilities, { expires: 1}); $.cookie('capabilities', g_capabilities, {
expires: 1
});
g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean
$.cookie('supportELB', g_supportELB, { expires: 1}); $.cookie('supportELB', g_supportELB, {
expires: 1
});
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) { if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
$.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1}); $.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, {
expires: 1
});
} }
g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects; g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
$.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 }); $.cookie('userProjectsEnabled', g_userProjectsEnabled, {
expires: 1
});
g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion; g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
if(json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) { if (json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax ) * 3; //multiply 3 to be on safe side var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax) * 3; //multiply 3 to be on safe side
//intervalLimit = 9999; //this line is for testing only, comment it before check in //intervalLimit = 9999; //this line is for testing only, comment it before check in
if(intervalLimit > g_queryAsyncJobResultInterval) if (intervalLimit > g_queryAsyncJobResultInterval)
g_queryAsyncJobResultInterval = intervalLimit; g_queryAsyncJobResultInterval = intervalLimit;
} }
@ -184,7 +193,7 @@
}, },
error: function(xmlHTTP) { //override default error handling, do nothing instead of showing error "unable to verify user credentials" on login screen error: function(xmlHTTP) { //override default error handling, do nothing instead of showing error "unable to verify user credentials" on login screen
}, },
beforeSend : function(XMLHttpResponse) { beforeSend: function(XMLHttpResponse) {
return true; return true;
} }
}); });
@ -198,7 +207,7 @@
async: false, async: false,
success: function(json) { success: function(json) {
var items = json.listimagestoreresponse.imagestore; var items = json.listimagestoreresponse.imagestore;
if(items != null && items.length > 0) if (items != null && items.length > 0)
havingSwift = true; havingSwift = true;
} }
}); });
@ -249,14 +258,13 @@
array1.push("&password=" + password); array1.push("&password=" + password);
var domain; var domain;
if(args.data.domain != null && args.data.domain.length > 0) { if (args.data.domain != null && args.data.domain.length > 0) {
if (args.data.domain.charAt(0) != "/") if (args.data.domain.charAt(0) != "/")
domain = "/" + args.data.domain; domain = "/" + args.data.domain;
else else
domain = args.data.domain; domain = args.data.domain;
array1.push("&domain=" + encodeURIComponent(domain)); array1.push("&domain=" + encodeURIComponent(domain));
} } else {
else {
array1.push("&domain=" + encodeURIComponent("/")); array1.push("&domain=" + encodeURIComponent("/"));
} }
@ -281,15 +289,33 @@
g_timezoneoffset = loginresponse.timezoneoffset; g_timezoneoffset = loginresponse.timezoneoffset;
g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname; g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname;
$.cookie('sessionKey', g_sessionKey, { expires: 1}); $.cookie('sessionKey', g_sessionKey, {
$.cookie('username', g_username, { expires: 1}); expires: 1
$.cookie('account', g_account, { expires: 1}); });
$.cookie('domainid', g_domainid, { expires: 1}); $.cookie('username', g_username, {
$.cookie('role', g_role, { expires: 1}); expires: 1
$.cookie('timezoneoffset', g_timezoneoffset, { expires: 1}); });
$.cookie('timezone', g_timezone, { expires: 1}); $.cookie('account', g_account, {
$.cookie('userfullname', g_userfullname, { expires: 1 }); expires: 1
$.cookie('userid', g_userid, { expires: 1 }); });
$.cookie('domainid', g_domainid, {
expires: 1
});
$.cookie('role', g_role, {
expires: 1
});
$.cookie('timezoneoffset', g_timezoneoffset, {
expires: 1
});
$.cookie('timezone', g_timezone, {
expires: 1
});
$.cookie('userfullname', g_userfullname, {
expires: 1
});
$.cookie('userid', g_userid, {
expires: 1
});
$.ajax({ $.ajax({
url: createURL("listCapabilities"), url: createURL("listCapabilities"),
@ -297,25 +323,33 @@
async: false, async: false,
success: function(json) { success: function(json) {
g_capabilities = json.listcapabilitiesresponse.capability; g_capabilities = json.listcapabilitiesresponse.capability;
$.cookie('capabilities', g_capabilities, { expires: 1}); $.cookie('capabilities', g_capabilities, {
expires: 1
});
g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean
$.cookie('supportELB', g_supportELB, { expires: 1}); $.cookie('supportELB', g_supportELB, {
expires: 1
});
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) { if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
$.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1}); $.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, {
expires: 1
});
} }
g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects; g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
$.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 }); $.cookie('userProjectsEnabled', g_userProjectsEnabled, {
expires: 1
});
g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion; g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
if(json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) { if (json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax ) * 3; //multiply 3 to be on safe side var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax) * 3; //multiply 3 to be on safe side
//intervalLimit = 8888; //this line is for testing only, comment it before check in //intervalLimit = 8888; //this line is for testing only, comment it before check in
if(intervalLimit > g_queryAsyncJobResultInterval) if (intervalLimit > g_queryAsyncJobResultInterval)
g_queryAsyncJobResultInterval = intervalLimit; g_queryAsyncJobResultInterval = intervalLimit;
} }
@ -337,13 +371,13 @@
if (isAdmin()) { if (isAdmin()) {
$.ajax({ $.ajax({
url: createURL("listImageStores"), url: createURL("listImageStores"),
data:{ data: {
provider: 'Swift' provider: 'Swift'
}, },
async: false, async: false,
success: function(json) { success: function(json) {
var items = json.listimagestoreresponse.imagestore; var items = json.listimagestoreresponse.imagestore;
if(items != null && items.length > 0) if (items != null && items.length > 0)
havingSwift = true; havingSwift = true;
} }
}); });
@ -373,13 +407,13 @@
}, },
error: function(XMLHttpRequest) { error: function(XMLHttpRequest) {
var errorMsg = parseXMLHttpResponse(XMLHttpRequest); var errorMsg = parseXMLHttpResponse(XMLHttpRequest);
if(errorMsg.length == 0 && XMLHttpRequest.status == 0) if (errorMsg.length == 0 && XMLHttpRequest.status == 0)
errorMsg = dictionary['error.unable.to.reach.management.server']; errorMsg = dictionary['error.unable.to.reach.management.server'];
else else
errorMsg = _l('error.invalid.username.password'); //override error message errorMsg = _l('error.invalid.username.password'); //override error message
args.response.error(errorMsg); args.response.error(errorMsg);
}, },
beforeSend : function(XMLHttpResponse) { beforeSend: function(XMLHttpResponse) {
return true; return true;
} }
}); });
@ -411,16 +445,16 @@
$.cookie('timezone', null); $.cookie('timezone', null);
$.cookie('supportELB', null); $.cookie('supportELB', null);
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen. if (onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document. document.location.reload(); //when onLogoutCallback() returns true, reload the current document.
} }
}, },
error: function() { error: function() {
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen. if (onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document. document.location.reload(); //when onLogoutCallback() returns true, reload the current document.
} }
}, },
beforeSend : function(XMLHttpResponse) { beforeSend: function(XMLHttpResponse) {
return true; return true;
} }
}); });
@ -447,7 +481,9 @@
context: context, context: context,
complete: function() { complete: function() {
// Show cloudStack main UI // Show cloudStack main UI
$container.cloudStack($.extend(cloudStackArgs, { hasLogo: false })); $container.cloudStack($.extend(cloudStackArgs, {
hasLogo: false
}));
} }
}); });
}; };
@ -455,7 +491,9 @@
initInstallWizard(); initInstallWizard();
} else { } else {
// Show cloudStack main UI // Show cloudStack main UI
$container.cloudStack($.extend(cloudStackArgs, { hasLogo: false })); $container.cloudStack($.extend(cloudStackArgs, {
hasLogo: false
}));
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -72,8 +72,7 @@
}, },
success: function(json) { success: function(json) {
dataFns.ipAddresses($.extend(data, { dataFns.ipAddresses($.extend(data, {
events: json.listeventsresponse.event ? events: json.listeventsresponse.event ? json.listeventsresponse.event : []
json.listeventsresponse.event : []
})); }));
} }
}); });
@ -142,18 +141,15 @@
}); });
}, },
capacity: function(data) { capacity: function(data) {
var latestData =null; var latestData = null;
if(window.fetchLatestflag == 1) if (window.fetchLatestflag == 1) {
{
latestData = { latestData = {
fetchLatest:true fetchLatest: true
} }
} } else {
else
{
latestData = { latestData = {
fetchLatest:false fetchLatest: false
} }
} }

View File

@ -18,99 +18,99 @@ cloudStack.docs = {
//Dedicate Resource //Dedicate Resource
helpDedicateResource:{ helpDedicateResource: {
desc:'Check this box to dedicate the resources to specific domain/account', desc: 'Check this box to dedicate the resources to specific domain/account',
externalLink:'' externalLink: ''
}, },
helpAccountForDedication:{ helpAccountForDedication: {
desc:'Please enter an account name which belongs to the above selected domain in order to dedicate this resource to this account', desc: 'Please enter an account name which belongs to the above selected domain in order to dedicate this resource to this account',
externalLink:'' externalLink: ''
}, },
//Delete/archive events //Delete/archive events
helpEventsDeleteType:{ helpEventsDeleteType: {
desc:'Delete all the events by specifying its TYPE eg . USER.LOGIN', desc: 'Delete all the events by specifying its TYPE eg . USER.LOGIN',
externalLink:'' externalLink: ''
}, },
helpEventsDeleteDate:{ helpEventsDeleteDate: {
desc:'Delete all the events which have been created after this date ', desc: 'Delete all the events which have been created after this date ',
externalLink:'' externalLink: ''
}, },
helpEventsArchiveType:{ helpEventsArchiveType: {
desc:'Archive all the events by specifying its TYPE (integer number)', desc: 'Archive all the events by specifying its TYPE (integer number)',
externalLink:'' externalLink: ''
}, },
helpEventsArchiveDate:{ helpEventsArchiveDate: {
desc:'Archive all the events which have been created after this date', desc: 'Archive all the events which have been created after this date',
externalLink:'' externalLink: ''
}, },
//Delete/archive Alerts //Delete/archive Alerts
helpAlertsDeleteType:{ helpAlertsDeleteType: {
desc:'Delete all the alerts by specifying its TYPE eg . USER.LOGIN', desc: 'Delete all the alerts by specifying its TYPE eg . USER.LOGIN',
externalLink:'' externalLink: ''
}, },
helpAlertsDeleteDate:{ helpAlertsDeleteDate: {
desc:'Delete all the alerts which have been created after this date ', desc: 'Delete all the alerts which have been created after this date ',
externalLink:'' externalLink: ''
}, },
helpAlertsArchiveType:{ helpAlertsArchiveType: {
desc:'Archive all the alerts by specifying its TYPE (integer number)', desc: 'Archive all the alerts by specifying its TYPE (integer number)',
externalLink:'' externalLink: ''
}, },
helpAlertsArchiveDate:{ helpAlertsArchiveDate: {
desc:'Archive all the alerts which have been created after this date', desc: 'Archive all the alerts which have been created after this date',
externalLink:'' externalLink: ''
}, },
//Ldap //Ldap
helpLdapQueryFilter: { helpLdapQueryFilter: {
desc:'Query filter is used to find a mapped user in the external LDAP server.Cloudstack provides some wildchars to represent the unique attributes in its database . Example - If Cloudstack account-name is same as the LDAP uid, then following will be a valid filter: Queryfilter : (&(uid=%u) , Queryfilter: .incase of Active Directory , Email _ID :(&(mail=%e)) , displayName :(&(displayName=%u)', desc: 'Query filter is used to find a mapped user in the external LDAP server.Cloudstack provides some wildchars to represent the unique attributes in its database . Example - If Cloudstack account-name is same as the LDAP uid, then following will be a valid filter: Queryfilter : (&(uid=%u) , Queryfilter: .incase of Active Directory , Email _ID :(&(mail=%e)) , displayName :(&(displayName=%u)',
externalLink:'' externalLink: ''
}, },
//IP Reservation tooltips //IP Reservation tooltips
helpIPReservationCidr: { helpIPReservationCidr: {
desc:'Edit CIDR when you want to configure IP Reservation in isolated guest Network', desc: 'Edit CIDR when you want to configure IP Reservation in isolated guest Network',
externalLink:'' externalLink: ''
}, },
helpIPReservationNetworkCidr:{ helpIPReservationNetworkCidr: {
desc:'The CIDR of the entire network when IP reservation is configured', desc: 'The CIDR of the entire network when IP reservation is configured',
externalLink:' ' externalLink: ' '
}, },
helpReservedIPRange:{ helpReservedIPRange: {
desc:'The IP Range which is not used by CloudStack to allocate to Guest VMs.Can be used for Non Cloudstack purposes.', desc: 'The IP Range which is not used by CloudStack to allocate to Guest VMs.Can be used for Non Cloudstack purposes.',
externalLink:'' externalLink: ''
}, },
// Add account // Add account
@ -119,16 +119,16 @@ cloudStack.docs = {
externalLink: '' externalLink: ''
}, },
helpOverridePublicNetwork:{ helpOverridePublicNetwork: {
desc:'Choose to override zone wide traffic label for guest traffic for this cluster', desc: 'Choose to override zone wide traffic label for guest traffic for this cluster',
externalLink:'' externalLink: ''
}, },
helpOverrideGuestNetwork:{ helpOverrideGuestNetwork: {
desc:'Choose to override zone wide traffic label for guest traffic for this cluster', desc: 'Choose to override zone wide traffic label for guest traffic for this cluster',
externalLink:'' externalLink: ''
}, },

View File

@ -44,7 +44,7 @@
desc: 'message.action.delete.domain', desc: 'message.action.delete.domain',
createLabel: 'label.delete', createLabel: 'label.delete',
preFilter: function(args) { preFilter: function(args) {
if(isAdmin()) { if (isAdmin()) {
args.$form.find('.form-item[rel=isForced]').css('display', 'inline-block'); args.$form.find('.form-item[rel=isForced]').css('display', 'inline-block');
} }
}, },
@ -59,7 +59,7 @@
action: function(args) { action: function(args) {
var array1 = []; var array1 = [];
if(args.$form.find('.form-item[rel=isForced]').css("display") != "none") //uncomment after Brian fix it to include $form in args if (args.$form.find('.form-item[rel=isForced]').css("display") != "none") //uncomment after Brian fix it to include $form in args
array1.push("&cleanup=" + (args.data.isForced == "on")); array1.push("&cleanup=" + (args.data.isForced == "on"));
$.ajax({ $.ajax({
@ -68,11 +68,11 @@
async: false, async: false,
success: function(json) { success: function(json) {
var jid = json.deletedomainresponse.jobid; var jid = json.deletedomainresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid} jobId: jid
} }
); });
// Quick fix for proper UI reaction to delete domain // Quick fix for proper UI reaction to delete domain
var $item = $('.name.selected').closest('li'); var $item = $('.name.selected').closest('li');
@ -103,7 +103,7 @@
networkdomain: args.data.networkdomain networkdomain: args.data.networkdomain
}; };
if(args.data.name != null) { if (args.data.name != null) {
$.extend(data, { $.extend(data, {
name: args.data.name name: args.data.name
}); });
@ -118,7 +118,7 @@
} }
}); });
if(args.data.vmLimit != null) { if (args.data.vmLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=0&max=" + args.data.vmLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=0&max=" + args.data.vmLimit),
dataType: "json", dataType: "json",
@ -129,7 +129,7 @@
}); });
} }
if(args.data.ipLimit != null) { if (args.data.ipLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=1&max=" + args.data.ipLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=1&max=" + args.data.ipLimit),
dataType: "json", dataType: "json",
@ -140,7 +140,7 @@
}); });
} }
if(args.data.volumeLimit != null) { if (args.data.volumeLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=2&max=" + args.data.volumeLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=2&max=" + args.data.volumeLimit),
dataType: "json", dataType: "json",
@ -151,7 +151,7 @@
}); });
} }
if(args.data.snapshotLimit != null) { if (args.data.snapshotLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=3&max=" + args.data.snapshotLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=3&max=" + args.data.snapshotLimit),
dataType: "json", dataType: "json",
@ -162,7 +162,7 @@
}); });
} }
if(args.data.templateLimit != null) { if (args.data.templateLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=4&max=" + args.data.templateLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=4&max=" + args.data.templateLimit),
dataType: "json", dataType: "json",
@ -173,7 +173,7 @@
}); });
} }
if(args.data.vpcLimit != null) { if (args.data.vpcLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=7&max=" + args.data.vpcLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=7&max=" + args.data.vpcLimit),
dataType: "json", dataType: "json",
@ -184,7 +184,7 @@
}); });
} }
if(args.data.cpuLimit != null) { if (args.data.cpuLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=8&max=" + args.data.cpuLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=8&max=" + args.data.cpuLimit),
dataType: "json", dataType: "json",
@ -195,7 +195,7 @@
}); });
} }
if(args.data.memoryLimit != null) { if (args.data.memoryLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=9&max=" + args.data.memoryLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=9&max=" + args.data.memoryLimit),
dataType: "json", dataType: "json",
@ -206,7 +206,7 @@
}); });
} }
if(args.data.primaryStorageLimit != null) { if (args.data.primaryStorageLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=10&max=" + args.data.primaryStorageLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=10&max=" + args.data.primaryStorageLimit),
dataType: "json", dataType: "json",
@ -217,7 +217,7 @@
}); });
} }
if(args.data.secondaryStorageLimit != null) { if (args.data.secondaryStorageLimit != null) {
$.ajax({ $.ajax({
url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=11&max=" + args.data.secondaryStorageLimit), url: createURL("updateResourceLimit&domainid=" + args.context.domains[0].id + "&resourceType=11&max=" + args.data.secondaryStorageLimit),
dataType: "json", dataType: "json",
@ -228,7 +228,9 @@
}); });
} }
args.response.success({data: domainObj}); args.response.success({
data: domainObj
});
} }
}, },
@ -242,7 +244,7 @@
name: args.data.name name: args.data.name
}; };
if(args.data.networkdomain != null && args.data.networkdomain.length > 0) { if (args.data.networkdomain != null && args.data.networkdomain.length > 0) {
$.extend(data, { $.extend(data, {
networkdomain: args.data.networkdomain networkdomain: args.data.networkdomain
}); });
@ -253,7 +255,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.createdomainresponse.domain; var item = json.createdomainresponse.domain;
args.response.success({data: item}); args.response.success({
data: item
});
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse); var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@ -275,12 +279,16 @@
name: { name: {
label: 'label.name', label: 'label.name',
docID: 'helpDomainName', docID: 'helpDomainName',
validation: { required: true } validation: {
required: true
}
}, },
networkdomain: { networkdomain: {
label: 'label.network.domain', label: 'label.network.domain',
docID: 'helpDomainNetworkDomain', docID: 'helpDomainNetworkDomain',
validation: { required: false } validation: {
required: false
}
} }
} }
} }
@ -317,22 +325,24 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{
name: { name: {
label: 'label.name', label: 'label.name',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to change domain name if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to change domain name
return true; return true;
else else
return false; return false;
} }
} }
}, {
id: {
label: 'ID'
}, },
{
id: { label: 'ID' },
path: { label: 'label.full.path' }, path: {
label: 'label.full.path'
},
networkdomain: { networkdomain: {
label: 'label.network.domain', label: 'label.network.domain',
@ -341,7 +351,7 @@
vmLimit: { vmLimit: {
label: 'label.instance.limits', label: 'label.instance.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -350,7 +360,7 @@
ipLimit: { ipLimit: {
label: 'label.ip.limits', label: 'label.ip.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -359,7 +369,7 @@
volumeLimit: { volumeLimit: {
label: 'label.volume.limits', label: 'label.volume.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -368,7 +378,7 @@
snapshotLimit: { snapshotLimit: {
label: 'label.snapshot.limits', label: 'label.snapshot.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -377,7 +387,7 @@
templateLimit: { templateLimit: {
label: 'label.template.limits', label: 'label.template.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -386,7 +396,7 @@
vpcLimit: { vpcLimit: {
label: 'VPC limits', label: 'VPC limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -395,7 +405,7 @@
cpuLimit: { cpuLimit: {
label: 'label.cpu.limits', label: 'label.cpu.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -404,7 +414,7 @@
memoryLimit: { memoryLimit: {
label: 'label.memory.limits', label: 'label.memory.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -413,7 +423,7 @@
primaryStorageLimit: { primaryStorageLimit: {
label: 'label.primary.storage.limits', label: 'label.primary.storage.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
@ -422,21 +432,26 @@
secondaryStorageLimit: { secondaryStorageLimit: {
label: 'label.secondary.storage.limits', label: 'label.secondary.storage.limits',
isEditable: function(context) { isEditable: function(context) {
if(context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits if (context.domains[0].level != 0) //ROOT domain (whose level is 0) is not allowed to updateResourceLimits
return true; return true;
else else
return false; return false;
} }
}, },
accountTotal: { label: 'label.accounts' }, accountTotal: {
vmTotal: { label: 'label.instances' }, label: 'label.accounts'
volumeTotal: { label: 'label.volumes' } },
vmTotal: {
label: 'label.instances'
},
volumeTotal: {
label: 'label.volumes'
} }
], }],
dataProvider: function(args) { dataProvider: function(args) {
var domainObj = args.context.domains[0]; var domainObj = args.context.domains[0];
var totalVMs=0; var totalVMs = 0;
var totalVolumes=0; var totalVolumes = 0;
$.ajax({ $.ajax({
url: createURL("listAccounts&domainid=" + domainObj.id), url: createURL("listAccounts&domainid=" + domainObj.id),
@ -446,14 +461,13 @@
}, },
success: function(json) { success: function(json) {
var items = json.listaccountsresponse.account; var items = json.listaccountsresponse.account;
if(items != null) { if (items != null) {
domainObj["accountTotal"] = items.length; domainObj["accountTotal"] = items.length;
for(var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
totalVMs += items[i].vmtotal; totalVMs += items[i].vmtotal;
totalVolumes += items[i].volumetotal; totalVolumes += items[i].volumetotal;
} }
} } else {
else {
domainObj["accountTotal"] = 0; domainObj["accountTotal"] = 0;
} }
} }
@ -467,8 +481,8 @@
}, },
success: function(json) { success: function(json) {
var items = json.listprojectsresponse.project; var items = json.listprojectsresponse.project;
if(items != null) { if (items != null) {
for(var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
totalVMs += items[i].vmtotal; totalVMs += items[i].vmtotal;
totalVolumes += items[i].volumetotal; totalVolumes += items[i].volumetotal;
} }
@ -566,7 +580,7 @@
labelField: 'name', labelField: 'name',
dataProvider: function(args) { dataProvider: function(args) {
var parentDomain = args.context.parentDomain; var parentDomain = args.context.parentDomain;
if(parentDomain == null) { //draw root node if (parentDomain == null) { //draw root node
$.ajax({ $.ajax({
url: createURL("listDomains&id=" + g_domainid + '&listAll=true'), url: createURL("listDomains&id=" + g_domainid + '&listAll=true'),
dataType: "json", dataType: "json",
@ -579,8 +593,7 @@
}); });
} }
}); });
} } else {
else {
$.ajax({ $.ajax({
url: createURL("listDomainChildren&id=" + parentDomain.id), url: createURL("listDomainChildren&id=" + parentDomain.id),
dataType: "json", dataType: "json",
@ -601,10 +614,10 @@
var domainActionfilter = function(args) { var domainActionfilter = function(args) {
var jsonObj = args.context.item; var jsonObj = args.context.item;
var allowedActions = []; var allowedActions = [];
if(isAdmin()) { if (isAdmin()) {
allowedActions.push("create"); allowedActions.push("create");
allowedActions.push("edit"); //merge updateResourceLimit into edit allowedActions.push("edit"); //merge updateResourceLimit into edit
if(jsonObj.level != 0) { //ROOT domain (whose level is 0) is not allowed to delete if (jsonObj.level != 0) { //ROOT domain (whose level is 0) is not allowed to delete
allowedActions.push("delete"); allowedActions.push("delete");
} }
} }

View File

@ -20,7 +20,7 @@
id: 'events', id: 'events',
sectionSelect: { sectionSelect: {
preFilter: function(args) { preFilter: function(args) {
if(isAdmin()) if (isAdmin())
return ["events", "alerts"]; return ["events", "alerts"];
else else
return ["events"]; return ["events"];
@ -35,12 +35,25 @@
id: 'events', id: 'events',
label: 'label.menu.events', label: 'label.menu.events',
fields: { fields: {
description: { label: 'label.description' }, description: {
level: { label: 'label.level' }, label: 'label.description'
type: {label:'Type'}, },
domain: { label: 'label.domain' }, level: {
account: { label: 'label.account' }, label: 'label.level'
created: { label: 'label.date', converter: cloudStack.converters.toLocalDate } },
type: {
label: 'Type'
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.account'
},
created: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
}
}, },
actions: { actions: {
@ -55,35 +68,42 @@
} }
}, },
createForm: { createForm: {
title:'Delete Events', title: 'Delete Events',
desc: '', desc: '',
fields: { fields: {
type: { label: 'By event type' , docID:'helpEventsDeleteType'}, type: {
label: 'By event type',
docID: 'helpEventsDeleteType'
},
date: { date: {
label: 'By date (older than)', label: 'By date (older than)',
docID:'helpEventsDeleteDate', docID: 'helpEventsDeleteDate',
isDatepicker: true isDatepicker: true
} }
} }
}, },
action: function(args) { action: function(args) {
var data={}; var data = {};
if(args.data.type != "") if (args.data.type != "")
$.extend(data, { type:args.data.type }); $.extend(data, {
type: args.data.type
});
if(args.data.date != "") if (args.data.date != "")
$.extend(data, {olderthan:args.data.date }); $.extend(data, {
olderthan: args.data.date
});
$.ajax({ $.ajax({
url:createURL("deleteEvents"), url: createURL("deleteEvents"),
data:data, data: data,
dataType:'json', dataType: 'json',
async: false, async: false,
success:function(data){ success: function(data) {
args.response.success(); args.response.success();
@ -105,30 +125,41 @@
} }
}, },
createForm: { createForm: {
title:'Archive Events', title: 'Archive Events',
desc: '', desc: '',
fields: { fields: {
type: { label: 'By event type' , docID:'helpEventsArchiveType'}, type: {
date: { label: 'By date (older than)' , docID:'helpEventsArchiveDate', isDatepicker: true }, label: 'By event type',
docID: 'helpEventsArchiveType'
},
date: {
label: 'By date (older than)',
docID: 'helpEventsArchiveDate',
isDatepicker: true
},
} }
}, },
action: function(args) { action: function(args) {
var data={}; var data = {};
if(args.data.type != "") if (args.data.type != "")
$.extend(data, { type:args.data.type }); $.extend(data, {
type: args.data.type
});
if(args.data.date != "") if (args.data.date != "")
$.extend(data, {olderthan:args.data.date }); $.extend(data, {
olderthan: args.data.date
});
$.ajax({ $.ajax({
url:createURL("archiveEvents"), url: createURL("archiveEvents"),
data:data, data: data,
dataType:'json', dataType: 'json',
async: false, async: false,
success:function(data){ success: function(data) {
args.response.success(); args.response.success();
@ -149,12 +180,19 @@
label: 'label.level', label: 'label.level',
select: function(args) { select: function(args) {
args.response.success({ args.response.success({
data: [ data: [{
{id: '', description: ''}, id: '',
{id: 'INFO', description: 'INFO'}, description: ''
{id: 'WARN', description: 'WARN'}, }, {
{id: 'ERROR', description: 'ERROR'} id: 'INFO',
] description: 'INFO'
}, {
id: 'WARN',
description: 'WARN'
}, {
id: 'ERROR',
description: 'ERROR'
}]
}); });
} }
}, },
@ -162,7 +200,7 @@
domainid: { domainid: {
label: 'Domain', label: 'Domain',
select: function(args) { select: function(args) {
if(isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
$.ajax({ $.ajax({
url: createURL('listDomains'), url: createURL('listDomains'),
data: { data: {
@ -170,11 +208,17 @@
details: 'min' details: 'min'
}, },
success: function(json) { success: function(json) {
var array1 = [{id: '', description: ''}]; var array1 = [{
id: '',
description: ''
}];
var domains = json.listdomainsresponse.domain; var domains = json.listdomainsresponse.domain;
if(domains != null && domains.length > 0) { if (domains != null && domains.length > 0) {
for(var i = 0; i < domains.length; i++) { for (var i = 0; i < domains.length; i++) {
array1.push({id: domains[i].id, description: domains[i].path}); array1.push({
id: domains[i].id,
description: domains[i].path
});
} }
} }
args.response.success({ args.response.success({
@ -182,15 +226,14 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
} }
}, },
isHidden: function(args) { isHidden: function(args) {
if(isAdmin() || isDomainAdmin()) if (isAdmin() || isDomainAdmin())
return false; return false;
else else
return true; return true;
@ -200,7 +243,7 @@
account: { account: {
label: 'Account', label: 'Account',
isHidden: function(args) { isHidden: function(args) {
if(isAdmin() || isDomainAdmin()) if (isAdmin() || isDomainAdmin())
return false; return false;
else else
return true; return true;
@ -228,7 +271,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.listeventsresponse.event; var items = json.listeventsresponse.event;
args.response.success({data:items}); args.response.success({
data: items
});
} }
}); });
}, },
@ -250,8 +295,8 @@
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url:createURL("deleteEvents&ids=" +args.context.events[0].id), url: createURL("deleteEvents&ids=" + args.context.events[0].id),
success:function(json){ success: function(json) {
args.response.success(); args.response.success();
@ -275,8 +320,8 @@
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url:createURL("archiveEvents&ids=" +args.context.events[0].id), url: createURL("archiveEvents&ids=" + args.context.events[0].id),
success:function(json){ success: function(json) {
args.response.success(); args.response.success();
@ -293,19 +338,36 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ description: {
description: { label: 'label.description' }, label: 'label.description'
state: { label: 'label.state' }, },
level: { label: 'label.level' }, state: {
type: { label: 'label.type' }, label: 'label.state'
domain: { label: 'label.domain' }, },
account: { label: 'label.account' }, level: {
username: { label: 'label.initiated.by' }, label: 'label.level'
created: { label: 'label.date', converter: cloudStack.converters.toLocalDate }, },
id: { label: 'label.id' } type: {
label: 'label.type'
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.account'
},
username: {
label: 'label.initiated.by'
},
created: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
},
id: {
label: 'label.id'
} }
], }],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL("listEvents&id=" + args.context.events[0].id), url: createURL("listEvents&id=" + args.context.events[0].id),
@ -313,7 +375,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var item = json.listeventsresponse.event[0]; var item = json.listeventsresponse.event[0];
args.response.success({data: item}); args.response.success({
data: item
});
} }
}); });
} }
@ -329,9 +393,16 @@
id: 'alerts', id: 'alerts',
label: 'label.menu.alerts', label: 'label.menu.alerts',
fields: { fields: {
description: { label: 'label.description' }, description: {
type: {label:'Type'}, label: 'label.description'
sent: { label: 'label.date', converter: cloudStack.converters.toLocalDate } },
type: {
label: 'Type'
},
sent: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
}
}, },
actions: { actions: {
@ -346,31 +417,42 @@
} }
}, },
createForm: { createForm: {
title:'Delete Alerts', title: 'Delete Alerts',
desc: '', desc: '',
fields: { fields: {
type: { label: 'By Alert type' , docID:'helpAlertsDeleteType'}, type: {
date: { label: 'By date (older than)' ,docID:'helpAlertsDeleteDate', isDatepicker: true } label: 'By Alert type',
docID: 'helpAlertsDeleteType'
},
date: {
label: 'By date (older than)',
docID: 'helpAlertsDeleteDate',
isDatepicker: true
}
} }
}, },
action: function(args) { action: function(args) {
var data={}; var data = {};
if(args.data.type != "") if (args.data.type != "")
$.extend(data, { type:args.data.type }); $.extend(data, {
type: args.data.type
});
if(args.data.date != "") if (args.data.date != "")
$.extend(data, {olderthan:args.data.date }); $.extend(data, {
olderthan: args.data.date
});
$.ajax({ $.ajax({
url:createURL("deleteAlerts"), url: createURL("deleteAlerts"),
data:data, data: data,
dataType:'json', dataType: 'json',
async: false, async: false,
success:function(data){ success: function(data) {
args.response.success(); args.response.success();
@ -392,30 +474,41 @@
} }
}, },
createForm: { createForm: {
title:'Archive Alerts', title: 'Archive Alerts',
desc: '', desc: '',
fields: { fields: {
type: { label: 'By Alert type', docID:'helpAlertsArchiveType' }, type: {
date: { label: 'By date (older than)' , docID:'helpAlertsArchiveDate', isDatepicker: true } label: 'By Alert type',
docID: 'helpAlertsArchiveType'
},
date: {
label: 'By date (older than)',
docID: 'helpAlertsArchiveDate',
isDatepicker: true
}
} }
}, },
action: function(args) { action: function(args) {
var data={}; var data = {};
if(args.data.type != "") if (args.data.type != "")
$.extend(data, { type:args.data.type }); $.extend(data, {
type: args.data.type
});
if(args.data.date != "") if (args.data.date != "")
$.extend(data, {olderthan:args.data.date }); $.extend(data, {
olderthan: args.data.date
});
$.ajax({ $.ajax({
url:createURL("archiveAlerts"), url: createURL("archiveAlerts"),
data:data, data: data,
dataType:'json', dataType: 'json',
async: false, async: false,
success:function(data){ success: function(data) {
args.response.success(); args.response.success();
@ -439,7 +532,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var items = json.listalertsresponse.alert; var items = json.listalertsresponse.alert;
args.response.success({data:items}); args.response.success({
data: items
});
} }
}); });
}, },
@ -461,8 +556,8 @@
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url:createURL("deleteAlerts&ids=" +args.context.alerts[0].id), url: createURL("deleteAlerts&ids=" + args.context.alerts[0].id),
success:function(json){ success: function(json) {
args.response.success(); args.response.success();
@ -487,8 +582,8 @@
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url:createURL("archiveAlerts&ids=" +args.context.alerts[0].id), url: createURL("archiveAlerts&ids=" + args.context.alerts[0].id),
success:function(json){ success: function(json) {
args.response.success(); args.response.success();
@ -507,13 +602,18 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ id: {
id: { label: 'ID' }, label: 'ID'
description: { label: 'label.description' }, },
sent: { label: 'label.date', converter: cloudStack.converters.toLocalDate } description: {
label: 'label.description'
},
sent: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
} }
], }],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL("listAlerts&id=" + args.context.alerts[0].id), url: createURL("listAlerts&id=" + args.context.alerts[0].id),
@ -521,7 +621,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var item = json.listalertsresponse.alert[0]; var item = json.listalertsresponse.alert[0];
args.response.success({data: item}); args.response.success({
data: item
});
} }
}); });
} }

View File

@ -41,11 +41,17 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.updateconfigurationresponse.configuration; var item = json.updateconfigurationresponse.configuration;
if(item.category == "Usage") if (item.category == "Usage")
cloudStack.dialog.notice({ message: _l('message.restart.mgmt.usage.server') }); cloudStack.dialog.notice({
message: _l('message.restart.mgmt.usage.server')
});
else else
cloudStack.dialog.notice({ message: _l('message.restart.mgmt.server') }); cloudStack.dialog.notice({
args.response.success({data: item}); message: _l('message.restart.mgmt.server')
});
args.response.success({
data: item
});
}, },
error: function(json) { error: function(json) {
args.response.error(parseXMLHttpResponse(json)); args.response.error(parseXMLHttpResponse(json));
@ -55,9 +61,18 @@
} }
}, },
fields: { fields: {
name: { label: 'label.name', id: true }, name: {
description: { label: 'label.description' }, label: 'label.name',
value: { label: 'label.value', editable: true, truncate: true } id: true
},
description: {
label: 'label.description'
},
value: {
label: 'label.value',
editable: true,
truncate: true
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
var data = { var data = {
@ -76,31 +91,41 @@
async: true, async: true,
success: function(json) { success: function(json) {
var items = json.listconfigurationsresponse.configuration; var items = json.listconfigurationsresponse.configuration;
args.response.success({ data: items }); args.response.success({
data: items
});
} }
}); });
} }
} }
}, },
ldapConfiguration:{ ldapConfiguration: {
type:'select', type: 'select',
title:'LDAP Configuration', title: 'LDAP Configuration',
listView:{ listView: {
id:'ldap', id: 'ldap',
label:'LDAP Configuration', label: 'LDAP Configuration',
fields:{ fields: {
hostname: {label: 'Hostname'}, hostname: {
queryfilter: {label: 'Query Filter'}, label: 'Hostname'
searchbase: {label: 'Search Base'}, },
port: {label: 'LDAP Port'}, queryfilter: {
label: 'Query Filter'
},
searchbase: {
label: 'Search Base'
},
port: {
label: 'LDAP Port'
},
ssl: { ssl: {
label: 'SSL' label: 'SSL'
} }
}, },
dataProvider:function(args){ dataProvider: function(args) {
var data = {}; var data = {};
listViewDataProvider(args, data); listViewDataProvider(args, data);
$.ajax({ $.ajax({
@ -108,7 +133,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.ldapconfigresponse.ldapconfig; var items = json.ldapconfigresponse.ldapconfig;
args.response.success({data:items}); args.response.success({
data: items
});
}, },
error: function(data) { error: function(data) {
args.response.error(parseXMLHttpResponse(data)); args.response.error(parseXMLHttpResponse(data));
@ -134,8 +161,8 @@
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url:createURL("ldapRemove"), url: createURL("ldapRemove"),
success:function(json){ success: function(json) {
args.response.success(); args.response.success();
@ -148,25 +175,31 @@
} }
}, },
tabs:{ tabs: {
details: { details: {
title: 'LDAP Configuration Details', title: 'LDAP Configuration Details',
fields: [ fields: [{
{ hostname: {
hostname: { label: 'Hostname' }, label: 'Hostname'
description: { label: 'label.description' }, },
ssl : { label: 'SSL'} description: {
label: 'label.description'
},
ssl: {
label: 'SSL'
} }
], }],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL("ldapConfig&listAll=true" ), url: createURL("ldapConfig&listAll=true"),
dataType: "json", dataType: "json",
async: true, async: true,
success: function(json) { success: function(json) {
var item = json.ldapconfigresponse.ldapconfig; var item = json.ldapconfigresponse.ldapconfig;
args.response.success({data: item}); args.response.success({
data: item
});
} }
}); });
} }
@ -177,7 +210,7 @@
}, },
actions: { actions: {
add:{ add: {
label: 'Configure LDAP', label: 'Configure LDAP',
@ -193,21 +226,65 @@
createForm: { createForm: {
title: 'Configure LDAP', title: 'Configure LDAP',
fields:{ fields: {
name:{label: 'Bind DN' , validation: {required:true} }, name: {
password: {label: 'Bind Password', validation: {required: true },isPassword:true }, label: 'Bind DN',
hostname: {label:'Hostname' , validation:{required:true}}, validation: {
queryfilter: {label:'Query Filter' , validation: {required:true} , docID:'helpLdapQueryFilter'}, required: true
searchbase: {label:'SearchBase',validation:{required:true}}, }
},
password: {
label: 'Bind Password',
validation: {
required: true
},
isPassword: true
},
hostname: {
label: 'Hostname',
validation: {
required: true
}
},
queryfilter: {
label: 'Query Filter',
validation: {
required: true
},
docID: 'helpLdapQueryFilter'
},
searchbase: {
label: 'SearchBase',
validation: {
required: true
}
},
ssl: { ssl: {
label:'SSL' , label: 'SSL',
isBoolean:true, isBoolean: true,
isChecked:false isChecked: false
}, },
port: { label: 'Port' , defaultValue: '389' }, port: {
truststore:{ label:'Trust Store' , isHidden:true , dependsOn:'ssl',validation:{required:true} }, label: 'Port',
truststorepassword:{ label:'Trust Store Password' ,isHidden:true , dependsOn:'ssl', validation:{required:true}} defaultValue: '389'
},
truststore: {
label: 'Trust Store',
isHidden: true,
dependsOn: 'ssl',
validation: {
required: true
}
},
truststorepassword: {
label: 'Trust Store Password',
isHidden: true,
dependsOn: 'ssl',
validation: {
required: true
}
}
} }
@ -215,27 +292,25 @@
}, },
action:function(args) { action: function(args) {
var array = []; var array = [];
array.push("&binddn=" + todb(args.data.name)); array.push("&binddn=" + todb(args.data.name));
array.push("&bindpass=" + todb(args.data.password)); array.push("&bindpass=" + todb(args.data.password));
array.push("&hostname=" + todb(args.data.hostname)); array.push("&hostname=" + todb(args.data.hostname));
array.push("&searchbase=" +todb(args.data.searchbase)); array.push("&searchbase=" + todb(args.data.searchbase));
array.push("&queryfilter=" +todb(args.data.queryfilter)); array.push("&queryfilter=" + todb(args.data.queryfilter));
array.push("&port=" +todb(args.data.port)); array.push("&port=" + todb(args.data.port));
if(args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked')== true) { if (args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked') == true) {
array.push("&ssl=true"); array.push("&ssl=true");
if(args.data.truststore != "") if (args.data.truststore != "")
array.push("&truststore=" +todb(args.data.truststore)); array.push("&truststore=" + todb(args.data.truststore));
if(args.data.truststorepassword !="") if (args.data.truststorepassword != "")
array.push("&truststorepass=" +todb(args.data.truststorepassword)); array.push("&truststorepass=" + todb(args.data.truststorepassword));
} } else
else
array.push("&ssl=false"); array.push("&ssl=false");
$.ajax({ $.ajax({
@ -250,7 +325,7 @@
}, },
error:function(json){ error: function(json) {
args.response.error(parseXMLHttpResponse(json)); args.response.error(parseXMLHttpResponse(json));
} }
@ -278,9 +353,15 @@
id: 'hypervisorCapabilities', id: 'hypervisorCapabilities',
label: 'label.hypervisor.capabilities', label: 'label.hypervisor.capabilities',
fields: { fields: {
hypervisor: { label: 'label.hypervisor' }, hypervisor: {
hypervisorversion: { label: 'label.hypervisor.version' }, label: 'label.hypervisor'
maxguestslimit: { label: 'label.max.guest.limit' } },
hypervisorversion: {
label: 'label.hypervisor.version'
},
maxguestslimit: {
label: 'label.max.guest.limit'
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
var data = {}; var data = {};
@ -291,7 +372,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.listhypervisorcapabilitiesresponse.hypervisorCapabilities; var items = json.listhypervisorcapabilitiesresponse.hypervisorCapabilities;
args.response.success({data:items}); args.response.success({
data: items
});
}, },
error: function(data) { error: function(data) {
args.response.error(parseXMLHttpResponse(data)); args.response.error(parseXMLHttpResponse(data));
@ -315,7 +398,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.updatehypervisorcapabilitiesresponse['null']; var item = json.updatehypervisorcapabilitiesresponse['null'];
args.response.success({data: item}); args.response.success({
data: item
});
}, },
error: function(data) { error: function(data) {
args.response.error(parseXMLHttpResponse(data)); args.response.error(parseXMLHttpResponse(data));
@ -328,23 +413,25 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ id: {
id: { label: 'label.id' }, label: 'label.id'
hypervisor: { label: 'label.hypervisor' }, },
hypervisorversion: { label: 'label.hypervisor.version' }, hypervisor: {
label: 'label.hypervisor'
},
hypervisorversion: {
label: 'label.hypervisor.version'
},
maxguestslimit: { maxguestslimit: {
label: 'label.max.guest.limit', label: 'label.max.guest.limit',
isEditable: true isEditable: true
} }
} }],
],
dataProvider: function(args) { dataProvider: function(args) {
args.response.success( args.response.success({
{ data: args.context.hypervisorCapabilities[0]
data:args.context.hypervisorCapabilities[0] });
}
);
} }
} }
} }

View File

@ -41,7 +41,9 @@
async: true, async: true,
success: function(data) { success: function(data) {
args.response.success({ args.response.success({
data: { newUser: data.updateuserresponse.user } data: {
newUser: data.updateuserresponse.user
}
}); });
} }
}); });
@ -263,7 +265,7 @@
}); });
//pick the network offering including SecurityGroup, but excluding Lb and StaticNat. (bug 13665) //pick the network offering including SecurityGroup, but excluding Lb and StaticNat. (bug 13665)
return (($.inArray('SecurityGroup', services) != -1) && ($.inArray('Lb', services) == -1) && ($.inArray('StaticNat', services) == -1)) ; return (($.inArray('SecurityGroup', services) != -1) && ($.inArray('Lb', services) == -1) && ($.inArray('StaticNat', services) == -1));
} }
)[0]; )[0];
} }

View File

@ -70,23 +70,30 @@
steps: [ steps: [
// Step 1: Setup // Step 1: Setup
function(args) { function(args) {
if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart if (args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart
//populate only one zone to the dropdown, the zone which the VPC is under. //populate only one zone to the dropdown, the zone which the VPC is under.
zoneObjs = [{ zoneObjs = [{
id: args.context.vpc[0].zoneid, id: args.context.vpc[0].zoneid,
name: args.context.vpc[0].zonename, name: args.context.vpc[0].zonename,
networktype: 'Advanced' networktype: 'Advanced'
}]; }];
args.response.success({ data: {zones: zoneObjs}}); args.response.success({
data: {
zones: zoneObjs
} }
else { //from Instance page });
} else { //from Instance page
$.ajax({ $.ajax({
url: createURL("listZones&available=true"), url: createURL("listZones&available=true"),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
zoneObjs = json.listzonesresponse.zone; zoneObjs = json.listzonesresponse.zone;
args.response.success({ data: {zones: zoneObjs}}); args.response.success({
data: {
zones: zoneObjs
}
});
} }
}); });
} }
@ -94,19 +101,19 @@
// Step 2: Select template // Step 2: Select template
function(args) { function(args) {
$(zoneObjs).each(function(){ $(zoneObjs).each(function() {
if(this.id == args.currentData.zoneid) { if (this.id == args.currentData.zoneid) {
selectedZoneObj = this; selectedZoneObj = this;
return false; //break the $.each() loop return false; //break the $.each() loop
} }
}); });
if(selectedZoneObj == null) { if (selectedZoneObj == null) {
alert("error: can't find matched zone object"); alert("error: can't find matched zone object");
return; return;
} }
$.ajax({ $.ajax({
url: createURL("listHypervisors&zoneid="+args.currentData.zoneid), url: createURL("listHypervisors&zoneid=" + args.currentData.zoneid),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
@ -123,48 +130,45 @@
}); });
$.ajax({ $.ajax({
url: createURL("listTemplates&templatefilter=featured&zoneid="+args.currentData.zoneid), url: createURL("listTemplates&templatefilter=featured&zoneid=" + args.currentData.zoneid),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listtemplatesresponse.template == null) { if (json.listtemplatesresponse.template == null) {
featuredTemplateObjs = null; featuredTemplateObjs = null;
} } else {
else {
featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) { featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if($.inArray(item.hypervisor, hypervisorArray) > -1) if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true; return true;
}); });
} }
} }
}); });
$.ajax({ $.ajax({
url: createURL("listTemplates&templatefilter=community&zoneid="+args.currentData.zoneid), url: createURL("listTemplates&templatefilter=community&zoneid=" + args.currentData.zoneid),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listtemplatesresponse.template == null) { if (json.listtemplatesresponse.template == null) {
communityTemplateObjs = null; communityTemplateObjs = null;
} } else {
else {
communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) { communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if($.inArray(item.hypervisor, hypervisorArray) > -1) if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true; return true;
}); });
} }
} }
}); });
$.ajax({ $.ajax({
url: createURL("listTemplates&templatefilter=selfexecutable&zoneid="+args.currentData.zoneid), url: createURL("listTemplates&templatefilter=selfexecutable&zoneid=" + args.currentData.zoneid),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listtemplatesresponse.template == null) { if (json.listtemplatesresponse.template == null) {
myTemplateObjs = null; myTemplateObjs = null;
} } else {
else {
myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) { myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if($.inArray(item.hypervisor, hypervisorArray) > -1) if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true; return true;
}); });
} }
@ -176,10 +180,9 @@
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listisosresponse.iso == null) { if (json.listisosresponse.iso == null) {
featuredIsoObjs = null; featuredIsoObjs = null;
} } else {
else {
featuredIsoObjs = json.listisosresponse.iso; featuredIsoObjs = json.listisosresponse.iso;
} }
} }
@ -189,10 +192,9 @@
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listisosresponse.iso == null) { if (json.listisosresponse.iso == null) {
communityIsoObjs = null; communityIsoObjs = null;
} } else {
else {
communityIsoObjs = json.listisosresponse.iso; communityIsoObjs = json.listisosresponse.iso;
} }
} }
@ -202,10 +204,9 @@
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listisosresponse.iso == null) { if (json.listisosresponse.iso == null) {
myIsoObjs = null; myIsoObjs = null;
} } else {
else {
myIsoObjs = json.listisosresponse.iso; myIsoObjs = json.listisosresponse.iso;
} }
} }
@ -242,41 +243,40 @@
// Step 3: Service offering // Step 3: Service offering
function(args) { function(args) {
if(args.currentData["select-template"] == "select-template") { if (args.currentData["select-template"] == "select-template") {
if(featuredTemplateObjs != null && featuredTemplateObjs.length > 0) { if (featuredTemplateObjs != null && featuredTemplateObjs.length > 0) {
for(var i=0; i < featuredTemplateObjs.length; i++) { for (var i = 0; i < featuredTemplateObjs.length; i++) {
if(featuredTemplateObjs[i].id == args.currentData.templateid) { if (featuredTemplateObjs[i].id == args.currentData.templateid) {
selectedTemplateObj = featuredTemplateObjs[i]; selectedTemplateObj = featuredTemplateObjs[i];
break; break;
} }
} }
} }
if(selectedTemplateObj == null) { if (selectedTemplateObj == null) {
if(communityTemplateObjs != null && communityTemplateObjs.length > 0) { if (communityTemplateObjs != null && communityTemplateObjs.length > 0) {
for(var i=0; i < communityTemplateObjs.length; i++) { for (var i = 0; i < communityTemplateObjs.length; i++) {
if(communityTemplateObjs[i].id == args.currentData.templateid) { if (communityTemplateObjs[i].id == args.currentData.templateid) {
selectedTemplateObj = communityTemplateObjs[i]; selectedTemplateObj = communityTemplateObjs[i];
break; break;
} }
} }
} }
} }
if(selectedTemplateObj == null) { if (selectedTemplateObj == null) {
if(myTemplateObjs != null && myTemplateObjs.length > 0) { if (myTemplateObjs != null && myTemplateObjs.length > 0) {
for(var i=0; i < myTemplateObjs.length; i++) { for (var i = 0; i < myTemplateObjs.length; i++) {
if(myTemplateObjs[i].id == args.currentData.templateid) { if (myTemplateObjs[i].id == args.currentData.templateid) {
selectedTemplateObj = myTemplateObjs[i]; selectedTemplateObj = myTemplateObjs[i];
break; break;
} }
} }
} }
} }
if(selectedTemplateObj == null) if (selectedTemplateObj == null)
alert("unable to find matched template object"); alert("unable to find matched template object");
else else
selectedHypervisor = selectedTemplateObj.hypervisor; selectedHypervisor = selectedTemplateObj.hypervisor;
} } else { //(args.currentData["select-template"] == "select-iso"
else { //(args.currentData["select-template"] == "select-iso"
selectedHypervisor = args.currentData.hypervisorid; selectedHypervisor = args.currentData.hypervisorid;
} }
@ -287,7 +287,9 @@
success: function(json) { success: function(json) {
serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering; serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering;
args.response.success({ args.response.success({
data: {serviceOfferings: serviceOfferingObjs} data: {
serviceOfferings: serviceOfferingObjs
}
}); });
} }
}); });
@ -295,7 +297,7 @@
// Step 4: Data disk offering // Step 4: Data disk offering
function(args) { function(args) {
var isRequred = (args.currentData["select-template"] == "select-iso"? true: false); var isRequred = (args.currentData["select-template"] == "select-iso" ? true : false);
$.ajax({ $.ajax({
url: createURL("listDiskOfferings"), url: createURL("listDiskOfferings"),
dataType: "json", dataType: "json",
@ -305,7 +307,9 @@
args.response.success({ args.response.success({
required: isRequred, required: isRequred,
customFlag: 'iscustomized', // Field determines if custom slider is shown customFlag: 'iscustomized', // Field determines if custom slider is shown
data: {diskOfferings: diskOfferingObjs} data: {
diskOfferings: diskOfferingObjs
}
}); });
} }
}); });
@ -320,21 +324,23 @@
var data = { var data = {
affinityGroups: items affinityGroups: items
}; };
if('affinityGroups' in args.context) { if ('affinityGroups' in args.context) {
$.extend(data, { $.extend(data, {
selectedObj: args.context.affinityGroups[0] selectedObj: args.context.affinityGroups[0]
}); });
} }
args.response.success({data: data}); args.response.success({
data: data
});
} }
}); });
}, },
// Step 6: Network // Step 6: Network
function(args) { function(args) {
if(diskOfferingObjs != null && diskOfferingObjs.length > 0) { if (diskOfferingObjs != null && diskOfferingObjs.length > 0) {
for(var i=0; i < diskOfferingObjs.length; i++) { for (var i = 0; i < diskOfferingObjs.length; i++) {
if(diskOfferingObjs[i].id == args.currentData.diskofferingid) { if (diskOfferingObjs[i].id == args.currentData.diskofferingid) {
selectedDiskOfferingObj = diskOfferingObjs[i]; selectedDiskOfferingObj = diskOfferingObjs[i];
break; break;
} }
@ -345,14 +351,14 @@
var $networkStep = $(".step.network:visible .nothing-to-select"); var $networkStep = $(".step.network:visible .nothing-to-select");
var $networkStepContainer = $('.step.network:visible'); var $networkStepContainer = $('.step.network:visible');
if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart if (args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart
step6ContainerType = 'nothing-to-select'; step6ContainerType = 'nothing-to-select';
$networkStep.find("#from_instance_page_1").hide(); $networkStep.find("#from_instance_page_1").hide();
$networkStep.find("#from_instance_page_2").hide(); $networkStep.find("#from_instance_page_2").hide();
$networkStep.find("#from_vpc_tier").text("tier " + args.context.networks[0].name); $networkStep.find("#from_vpc_tier").text("tier " + args.context.networks[0].name);
$networkStep.find("#from_vpc_tier").show(); $networkStep.find("#from_vpc_tier").show();
} else { //from Instance page } else { //from Instance page
if(selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone if (selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone
step6ContainerType = 'select-network'; step6ContainerType = 'select-network';
$networkStep.find("#from_instance_page_1").show(); $networkStep.find("#from_instance_page_1").show();
$networkStep.find("#from_instance_page_2").show(); $networkStep.find("#from_instance_page_2").show();
@ -368,8 +374,7 @@
step6ContainerType = 'select-security-group'; step6ContainerType = 'select-security-group';
} }
} }
} } else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network)
else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network)
var includingSecurityGroupService = false; var includingSecurityGroupService = false;
$.ajax({ $.ajax({
url: createURL("listNetworks&trafficType=Guest&zoneId=" + selectedZoneObj.id), url: createURL("listNetworks&trafficType=Guest&zoneId=" + selectedZoneObj.id),
@ -378,11 +383,11 @@
success: function(json) { success: function(json) {
//basic zone should have only one guest network returned in this API call //basic zone should have only one guest network returned in this API call
var items = json.listnetworksresponse.network; var items = json.listnetworksresponse.network;
if(items != null && items.length > 0) { if (items != null && items.length > 0) {
var networkObj = items[0]; //basic zone has only one guest network var networkObj = items[0]; //basic zone has only one guest network
var serviceObjArray = networkObj.service; var serviceObjArray = networkObj.service;
for(var k = 0; k < serviceObjArray.length; k++) { for (var k = 0; k < serviceObjArray.length; k++) {
if(serviceObjArray[k].name == "SecurityGroup") { if (serviceObjArray[k].name == "SecurityGroup") {
includingSecurityGroupService = true; includingSecurityGroupService = true;
break; break;
} }
@ -391,23 +396,23 @@
} }
}); });
if(includingSecurityGroupService == false || selectedHypervisor == "VMware") { if (includingSecurityGroupService == false || selectedHypervisor == "VMware") {
step6ContainerType = 'nothing-to-select'; step6ContainerType = 'nothing-to-select';
} } else {
else {
step6ContainerType = 'select-security-group'; step6ContainerType = 'select-security-group';
} }
} }
//step6ContainerType = 'nothing-to-select'; //for testing only, comment it out before checking in //step6ContainerType = 'nothing-to-select'; //for testing only, comment it out before checking in
if(step6ContainerType == 'select-network' || step6ContainerType == 'select-advanced-sg') { if (step6ContainerType == 'select-network' || step6ContainerType == 'select-advanced-sg') {
var defaultNetworkArray = [], optionalNetworkArray = []; var defaultNetworkArray = [],
optionalNetworkArray = [];
var networkData = { var networkData = {
zoneId: args.currentData.zoneid, zoneId: args.currentData.zoneid,
canusefordeploy: true canusefordeploy: true
}; };
if(selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled == true) { if (selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled == true) {
$.extend(networkData, { $.extend(networkData, {
type: 'Shared' type: 'Shared'
}); });
@ -437,13 +442,13 @@
async: false, async: false,
success: function(json) { success: function(json) {
networkObjs = json.listnetworksresponse.network ? json.listnetworksresponse.network : []; networkObjs = json.listnetworksresponse.network ? json.listnetworksresponse.network : [];
if(networkObjs.length > 0) { if (networkObjs.length > 0) {
for(var i = 0; i < networkObjs.length; i++) { for (var i = 0; i < networkObjs.length; i++) {
var networkObj = networkObjs[i]; var networkObj = networkObjs[i];
var includingSecurityGroup = false; var includingSecurityGroup = false;
var serviceObjArray = networkObj.service; var serviceObjArray = networkObj.service;
for(var k = 0; k < serviceObjArray.length; k++) { for (var k = 0; k < serviceObjArray.length; k++) {
if(serviceObjArray[k].name == "SecurityGroup") { if (serviceObjArray[k].name == "SecurityGroup") {
networkObjs[i].type = networkObjs[i].type + ' (sg)'; networkObjs[i].type = networkObjs[i].type + ' (sg)';
includingSecurityGroup = true; includingSecurityGroup = true;
break; break;
@ -455,8 +460,8 @@
} }
//for Advanced SG-enabled zone, list only SG network offerings //for Advanced SG-enabled zone, list only SG network offerings
if(selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled == true) { if (selectedZoneObj.networktype == 'Advanced' && selectedZoneObj.securitygroupsenabled == true) {
if(includingSecurityGroup == false) if (includingSecurityGroup == false)
continue; //skip to next network offering continue; //skip to next network offering
} }
networkObjsToPopulate.push(networkObj); networkObjsToPopulate.push(networkObj);
@ -503,9 +508,7 @@
vpcs: vpcObjs vpcs: vpcObjs
} }
}); });
} } else if (step6ContainerType == 'select-security-group') {
else if(step6ContainerType == 'select-security-group') {
var securityGroupArray = []; var securityGroupArray = [];
var data = { var data = {
domainid: g_domainid, domainid: g_domainid,
@ -535,9 +538,7 @@
vpcs: [] vpcs: []
} }
}); });
} } else if (step6ContainerType == 'nothing-to-select') {
else if(step6ContainerType == 'nothing-to-select') {
args.response.success({ args.response.success({
type: 'nothing-to-select', type: 'nothing-to-select',
data: { data: {
@ -571,26 +572,24 @@
array1.push("&serviceOfferingId=" + args.data.serviceofferingid); array1.push("&serviceOfferingId=" + args.data.serviceofferingid);
//step 4: select disk offering //step 4: select disk offering
if(args.data.diskofferingid != null && args.data.diskofferingid != "0") { if (args.data.diskofferingid != null && args.data.diskofferingid != "0") {
array1.push("&diskOfferingId=" + args.data.diskofferingid); array1.push("&diskOfferingId=" + args.data.diskofferingid);
if(selectedDiskOfferingObj.iscustomized == true) if (selectedDiskOfferingObj.iscustomized == true)
array1.push("&size=" + args.data.size); array1.push("&size=" + args.data.size);
} }
//step 5: select an affinity group //step 5: select an affinity group
var checkedAffinityGroupIdArray; var checkedAffinityGroupIdArray;
if(typeof(args.data["affinity-groups"]) == "object" && args.data["affinity-groups"].length != null) { //args.data["affinity-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"], if (typeof(args.data["affinity-groups"]) == "object" && args.data["affinity-groups"].length != null) { //args.data["affinity-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"],
checkedAffinityGroupIdArray = args.data["affinity-groups"]; checkedAffinityGroupIdArray = args.data["affinity-groups"];
} } else if (typeof(args.data["affinity-groups"]) == "string" && args.data["affinity-groups"].length > 0) { //args.data["affinity-groups"] is a string, e.g. "2375f8cc-8a73-4b8d-9b26-50885a25ffe0"
else if(typeof(args.data["affinity-groups"]) == "string" && args.data["affinity-groups"].length > 0) { //args.data["affinity-groups"] is a string, e.g. "2375f8cc-8a73-4b8d-9b26-50885a25ffe0"
checkedAffinityGroupIdArray = []; checkedAffinityGroupIdArray = [];
checkedAffinityGroupIdArray.push(args.data["affinity-groups"]); checkedAffinityGroupIdArray.push(args.data["affinity-groups"]);
} } else { // typeof(args.data["affinity-groups"]) == null
else { // typeof(args.data["affinity-groups"]) == null
checkedAffinityGroupIdArray = []; checkedAffinityGroupIdArray = [];
} }
if(checkedAffinityGroupIdArray.length > 0) if (checkedAffinityGroupIdArray.length > 0)
array1.push("&affinitygroupids=" + checkedAffinityGroupIdArray.join(",")); array1.push("&affinitygroupids=" + checkedAffinityGroupIdArray.join(","));
//step 6: select network //step 6: select network
@ -599,19 +598,17 @@
var defaultNetworkId = args.data.defaultNetwork; //args.data.defaultNetwork might be equal to string "new-network" or a network ID var defaultNetworkId = args.data.defaultNetwork; //args.data.defaultNetwork might be equal to string "new-network" or a network ID
var checkedNetworkIdArray; var checkedNetworkIdArray;
if(typeof(args.data["my-networks"]) == "object" && args.data["my-networks"].length != null) { //args.data["my-networks"] is an array of string, e.g. ["203", "202"], if (typeof(args.data["my-networks"]) == "object" && args.data["my-networks"].length != null) { //args.data["my-networks"] is an array of string, e.g. ["203", "202"],
checkedNetworkIdArray = args.data["my-networks"]; checkedNetworkIdArray = args.data["my-networks"];
} } else if (typeof(args.data["my-networks"]) == "string" && args.data["my-networks"].length > 0) { //args.data["my-networks"] is a string, e.g. "202"
else if(typeof(args.data["my-networks"]) == "string" && args.data["my-networks"].length > 0) { //args.data["my-networks"] is a string, e.g. "202"
checkedNetworkIdArray = []; checkedNetworkIdArray = [];
checkedNetworkIdArray.push(args.data["my-networks"]); checkedNetworkIdArray.push(args.data["my-networks"]);
} } else { // typeof(args.data["my-networks"]) == null
else { // typeof(args.data["my-networks"]) == null
checkedNetworkIdArray = []; checkedNetworkIdArray = [];
} }
//create new network starts here //create new network starts here
if(args.data["new-network"] == "create-new-network") { if (args.data["new-network"] == "create-new-network") {
var isCreateNetworkSuccessful = true; var isCreateNetworkSuccessful = true;
var data = { var data = {
@ -628,7 +625,7 @@
success: function(json) { success: function(json) {
newNetwork = json.createnetworkresponse.network; newNetwork = json.createnetworkresponse.network;
checkedNetworkIdArray.push(newNetwork.id); checkedNetworkIdArray.push(newNetwork.id);
if(defaultNetworkId == "new-network") if (defaultNetworkId == "new-network")
defaultNetworkId = newNetwork.id; defaultNetworkId = newNetwork.id;
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
@ -638,106 +635,100 @@
args.response.error(errorMsg); //args.response.error(errorMsg) here doesn't show errorMsg. Waiting for Brian to fix it. use alert(errorMsg) to show errorMsg for now. args.response.error(errorMsg); //args.response.error(errorMsg) here doesn't show errorMsg. Waiting for Brian to fix it. use alert(errorMsg) to show errorMsg for now.
} }
}); });
if(isCreateNetworkSuccessful == false) if (isCreateNetworkSuccessful == false)
return; return;
} }
//create new network ends here //create new network ends here
//add default network first //add default network first
if(defaultNetworkId != null && defaultNetworkId.length > 0) if (defaultNetworkId != null && defaultNetworkId.length > 0)
array2.push(defaultNetworkId); array2.push(defaultNetworkId);
//then, add other checked networks //then, add other checked networks
if(checkedNetworkIdArray.length > 0) { if (checkedNetworkIdArray.length > 0) {
for(var i=0; i < checkedNetworkIdArray.length; i++) { for (var i = 0; i < checkedNetworkIdArray.length; i++) {
if(checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2 if (checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2
array2.push(checkedNetworkIdArray[i]); array2.push(checkedNetworkIdArray[i]);
} }
} }
array1.push("&networkIds=" + array2.join(",")); array1.push("&networkIds=" + array2.join(","));
} } else if (step6ContainerType == 'select-security-group') {
else if (step6ContainerType == 'select-security-group') {
var checkedSecurityGroupIdArray; var checkedSecurityGroupIdArray;
if(typeof(args.data["security-groups"]) == "object" && args.data["security-groups"].length != null) { //args.data["security-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"], if (typeof(args.data["security-groups"]) == "object" && args.data["security-groups"].length != null) { //args.data["security-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"],
checkedSecurityGroupIdArray = args.data["security-groups"]; checkedSecurityGroupIdArray = args.data["security-groups"];
} } else if (typeof(args.data["security-groups"]) == "string" && args.data["security-groups"].length > 0) { //args.data["security-groups"] is a string, e.g. "2375f8cc-8a73-4b8d-9b26-50885a25ffe0"
else if(typeof(args.data["security-groups"]) == "string" && args.data["security-groups"].length > 0) { //args.data["security-groups"] is a string, e.g. "2375f8cc-8a73-4b8d-9b26-50885a25ffe0"
checkedSecurityGroupIdArray = []; checkedSecurityGroupIdArray = [];
checkedSecurityGroupIdArray.push(args.data["security-groups"]); checkedSecurityGroupIdArray.push(args.data["security-groups"]);
} } else { // typeof(args.data["security-groups"]) == null
else { // typeof(args.data["security-groups"]) == null
checkedSecurityGroupIdArray = []; checkedSecurityGroupIdArray = [];
} }
if(checkedSecurityGroupIdArray.length > 0) if (checkedSecurityGroupIdArray.length > 0)
array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(",")); array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(","));
if(selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) { // Advanced SG-enabled zone if (selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) { // Advanced SG-enabled zone
var array2 = []; var array2 = [];
var myNetworks = $('.multi-wizard:visible form').data('my-networks'); //widget limitation: If using an advanced security group zone, get the guest networks like this var myNetworks = $('.multi-wizard:visible form').data('my-networks'); //widget limitation: If using an advanced security group zone, get the guest networks like this
var defaultNetworkId = $('.multi-wizard:visible form').find('input[name=defaultNetwork]:checked').val(); var defaultNetworkId = $('.multi-wizard:visible form').find('input[name=defaultNetwork]:checked').val();
var checkedNetworkIdArray; var checkedNetworkIdArray;
if(typeof(myNetworks) == "object" && myNetworks.length != null) { //myNetworks is an array of string, e.g. ["203", "202"], if (typeof(myNetworks) == "object" && myNetworks.length != null) { //myNetworks is an array of string, e.g. ["203", "202"],
checkedNetworkIdArray = myNetworks; checkedNetworkIdArray = myNetworks;
} } else if (typeof(myNetworks) == "string" && myNetworks.length > 0) { //myNetworks is a string, e.g. "202"
else if(typeof(myNetworks) == "string" && myNetworks.length > 0) { //myNetworks is a string, e.g. "202"
checkedNetworkIdArray = []; checkedNetworkIdArray = [];
checkedNetworkIdArray.push(myNetworks); checkedNetworkIdArray.push(myNetworks);
} } else { // typeof(myNetworks) == null
else { // typeof(myNetworks) == null
checkedNetworkIdArray = []; checkedNetworkIdArray = [];
} }
//add default network first //add default network first
if(defaultNetworkId != null && defaultNetworkId.length > 0 && defaultNetworkId != 'new-network') if (defaultNetworkId != null && defaultNetworkId.length > 0 && defaultNetworkId != 'new-network')
array2.push(defaultNetworkId); array2.push(defaultNetworkId);
//then, add other checked networks //then, add other checked networks
if(checkedNetworkIdArray.length > 0) { if (checkedNetworkIdArray.length > 0) {
for(var i=0; i < checkedNetworkIdArray.length; i++) { for (var i = 0; i < checkedNetworkIdArray.length; i++) {
if(checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2 if (checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2
array2.push(checkedNetworkIdArray[i]); array2.push(checkedNetworkIdArray[i]);
} }
} }
array1.push("&networkIds=" + array2.join(",")); array1.push("&networkIds=" + array2.join(","));
} }
} } else if (step6ContainerType == 'nothing-to-select') {
else if (step6ContainerType == 'nothing-to-select') { if (args.context.networks != null) { //from VPC tier
if(args.context.networks != null) { //from VPC tier
array1.push("&networkIds=" + args.context.networks[0].id); array1.push("&networkIds=" + args.context.networks[0].id);
array1.push("&domainid=" + args.context.vpc[0].domainid); array1.push("&domainid=" + args.context.vpc[0].domainid);
if(args.context.vpc[0].account != null) if (args.context.vpc[0].account != null)
array1.push("&account=" + args.context.vpc[0].account); array1.push("&account=" + args.context.vpc[0].account);
else if(args.context.vpc[0].projectid != null) else if (args.context.vpc[0].projectid != null)
array1.push("&projectid=" + args.context.vpc[0].projectid); array1.push("&projectid=" + args.context.vpc[0].projectid);
} }
} }
var displayname = args.data.displayname; var displayname = args.data.displayname;
if(displayname != null && displayname.length > 0) { if (displayname != null && displayname.length > 0) {
array1.push("&displayname="+todb(displayname)); array1.push("&displayname=" + todb(displayname));
array1.push("&name="+todb(displayname)); array1.push("&name=" + todb(displayname));
} }
var group = args.data.groupname; var group = args.data.groupname;
if (group != null && group.length > 0) if (group != null && group.length > 0)
array1.push("&group="+todb(group)); array1.push("&group=" + todb(group));
//array1.push("&startVm=false"); //for testing only, comment it out before checking in //array1.push("&startVm=false"); //for testing only, comment it out before checking in
$.ajax({ $.ajax({
url: createURL("deployVirtualMachine"+array1.join("")), url: createURL("deployVirtualMachine" + array1.join("")),
dataType: "json", dataType: "json",
success: function(json) { success: function(json) {
var jid = json.deployvirtualmachineresponse.jobid; var jid = json.deployvirtualmachineresponse.jobid;
var vmid = json.deployvirtualmachineresponse.id; var vmid = json.deployvirtualmachineresponse.id;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
var item = json.queryasyncjobresultresponse.jobresult.virtualmachine; var item = json.queryasyncjobresultresponse.jobresult.virtualmachine;
if (item.password != null) if (item.password != null)
@ -750,7 +741,7 @@
getUpdatedItemWhenAsyncJobFails: function() { getUpdatedItemWhenAsyncJobFails: function() {
var item; var item;
$.ajax({ $.ajax({
url: createURL("listVirtualMachines&id="+vmid), url: createURL("listVirtualMachines&id=" + vmid),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
@ -760,8 +751,7 @@
return item; return item;
} }
} }
} });
);
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
args.response.error(parseXMLHttpResponse(XMLHttpResponse)); //wait for Brian to implement args.response.error(parseXMLHttpResponse(XMLHttpResponse)); //wait for Brian to implement

File diff suppressed because it is too large Load Diff

View File

@ -23,17 +23,16 @@
var context = args.context; var context = args.context;
var network; var network;
if('vpc' in args.context) { //from VPC section if ('vpc' in args.context) { //from VPC section
var data = { var data = {
listAll: true, listAll: true,
supportedservices: 'Lb' supportedservices: 'Lb'
}; };
if(args.context.ipAddresses[0].associatednetworkid == null) { if (args.context.ipAddresses[0].associatednetworkid == null) {
$.extend(data, { $.extend(data, {
vpcid: args.context.vpc[0].id vpcid: args.context.vpc[0].id
}); });
} } else {
else {
$.extend(data, { $.extend(data, {
id: args.context.ipAddresses[0].associatednetworkid id: args.context.ipAddresses[0].associatednetworkid
}); });
@ -45,13 +44,12 @@
async: false, async: false,
success: function(json) { success: function(json) {
var items = json.listnetworksresponse.network; var items = json.listnetworksresponse.network;
if(items != null && items.length > 0) { if (items != null && items.length > 0) {
network = items[0]; network = items[0];
} }
} }
}); });
} } else { //from Guest Network section
else { //from Guest Network section
network = args.context.networks[0]; network = args.context.networks[0];
} }
@ -69,20 +67,29 @@
)[0].value); )[0].value);
var baseFields = { var baseFields = {
stickyName: { label: 'Sticky Name', validation: { required: true } } stickyName: {
label: 'Sticky Name',
validation: {
required: true
}
}
}; };
$.map( $.map(
$.map( $.map(
stickinessCapabilities, stickinessCapabilities,
function(c) { return c.paramlist; } function(c) {
return c.paramlist;
}
), ),
function(p) { function(p) {
baseFields[p.paramname] = { baseFields[p.paramname] = {
label: _l('label.sticky.' + p.paramname), label: _l('label.sticky.' + p.paramname),
isHidden: true, isHidden: true,
isBoolean: p.isflag, isBoolean: p.isflag,
validation: { required: p.required } validation: {
required: p.required
}
}; };
} }
); );
@ -95,7 +102,10 @@
var $form = $select.closest('form'); var $form = $select.closest('form');
var stickyOptions = []; var stickyOptions = [];
stickinessCapabilities.push({ methodname: 'None', paramlist: [] }); stickinessCapabilities.push({
methodname: 'None',
paramlist: []
});
$(stickinessCapabilities).each(function() { $(stickinessCapabilities).each(function() {
var stickyCapability = this; var stickyCapability = this;
@ -240,8 +250,7 @@
methodname: data.methodname methodname: data.methodname
}, },
success: function(json) { success: function(json) {
cloudStack.ui.notifications.add( cloudStack.ui.notifications.add({
{
desc: 'Add new LB sticky rule', desc: 'Add new LB sticky rule',
section: 'Network', section: 'Network',
poll: pollAsyncJobResult, poll: pollAsyncJobResult,
@ -255,7 +264,9 @@
}, },
error: function(json) { error: function(json) {
complete(); complete();
cloudStack.dialog.notice({ message: parseXMLHttpResponse(json) }); cloudStack.dialog.notice({
message: parseXMLHttpResponse(json)
});
} }
}); });
}, },
@ -266,8 +277,7 @@
id: stickyRuleID id: stickyRuleID
}, },
success: function(json) { success: function(json) {
cloudStack.ui.notifications.add( cloudStack.ui.notifications.add({
{
desc: 'Remove previous LB sticky rule', desc: 'Remove previous LB sticky rule',
section: 'Network', section: 'Network',
poll: pollAsyncJobResult, poll: pollAsyncJobResult,
@ -281,7 +291,9 @@
}, },
error: function(json) { error: function(json) {
complete(); complete();
cloudStack.dialog.notice({ message: parseXMLHttpResponse(json) }); cloudStack.dialog.notice({
message: parseXMLHttpResponse(json)
});
} }
}); });
}, },

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,12 @@
invitationCheck: function(args) { invitationCheck: function(args) {
$.ajax({ $.ajax({
url: createURL('listProjectInvitations'), url: createURL('listProjectInvitations'),
data: { state: 'Pending' }, data: {
state: 'Pending'
},
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
data: json.listprojectinvitationsresponse.projectinvitation ? data: json.listprojectinvitationsresponse.projectinvitation ? json.listprojectinvitationsresponse.projectinvitation : []
json.listprojectinvitationsresponse.projectinvitation : []
}); });
} }
}); });
@ -43,7 +44,9 @@
$.each(args.data, function(key, value) { $.each(args.data, function(key, value) {
$.ajax({ $.ajax({
url: createURL('updateResourceLimit', { ignoreProject: true }), url: createURL('updateResourceLimit', {
ignoreProject: true
}),
data: { data: {
projectid: projectID, projectid: projectID,
resourcetype: key, resourcetype: key,
@ -63,7 +66,9 @@
projectID = projectID ? projectID : cloudStack.context.projects[0].id; projectID = projectID ? projectID : cloudStack.context.projects[0].id;
$.ajax({ $.ajax({
url: createURL('listResourceLimits', { ignoreProject: true }), url: createURL('listResourceLimits', {
ignoreProject: true
}),
data: { data: {
projectid: projectID projectid: projectID
}, },
@ -171,8 +176,7 @@
url: createURL('listVolumes'), url: createURL('listVolumes'),
success: function(json) { success: function(json) {
dataFns.bandwidth($.extend(data, { dataFns.bandwidth($.extend(data, {
totalVolumes: json.listvolumesresponse.volume ? totalVolumes: json.listvolumesresponse.volume ? json.listvolumesresponse.count : 0
json.listvolumesresponse.count : 0
})); }));
} }
}); });
@ -212,8 +216,7 @@
url: createURL('listPublicIpAddresses'), url: createURL('listPublicIpAddresses'),
success: function(json) { success: function(json) {
dataFns.loadBalancingRules($.extend(data, { dataFns.loadBalancingRules($.extend(data, {
totalIPAddresses: json.listpublicipaddressesresponse.count ? totalIPAddresses: json.listpublicipaddressesresponse.count ? json.listpublicipaddressesresponse.count : 0
json.listpublicipaddressesresponse.count : 0
})); }));
} }
}); });
@ -224,8 +227,7 @@
url: createURL('listLoadBalancerRules'), url: createURL('listLoadBalancerRules'),
success: function(json) { success: function(json) {
dataFns.portForwardingRules($.extend(data, { dataFns.portForwardingRules($.extend(data, {
totalLoadBalancers: json.listloadbalancerrulesresponse.count ? totalLoadBalancers: json.listloadbalancerrulesresponse.count ? json.listloadbalancerrulesresponse.count : 0
json.listloadbalancerrulesresponse.count : 0
})); }));
} }
}); });
@ -236,8 +238,7 @@
url: createURL('listPortForwardingRules'), url: createURL('listPortForwardingRules'),
success: function(json) { success: function(json) {
dataFns.users($.extend(data, { dataFns.users($.extend(data, {
totalPortForwards: json.listportforwardingrulesresponse.count ? totalPortForwards: json.listportforwardingrulesresponse.count ? json.listportforwardingrulesresponse.count : 0
json.listportforwardingrulesresponse.count : 0
})); }));
} }
}); });
@ -262,7 +263,9 @@
events: function(data) { events: function(data) {
$.ajax({ $.ajax({
url: createURL('listEvents', { ignoreProject: true }), url: createURL('listEvents', {
ignoreProject: true
}),
data: { data: {
page: 1, page: 1,
pageSize: 8 pageSize: 8
@ -273,9 +276,7 @@
complete($.extend(data, { complete($.extend(data, {
events: $.map(events, function(event) { events: $.map(events, function(event) {
return { return {
date: event.created.substr(5, 2) + date: event.created.substr(5, 2) + '/' + event.created.substr(8, 2) + '/' + event.created.substr(2, 2),
'/' + event.created.substr(8, 2) +
'/' + event.created.substr(2, 2),
desc: event.description desc: event.description
}; };
}) })
@ -297,7 +298,9 @@
add: function(args) { add: function(args) {
setTimeout(function() { setTimeout(function() {
$.ajax({ $.ajax({
url: createURL('createProject', { ignoreProject: true }), url: createURL('createProject', {
ignoreProject: true
}),
data: { data: {
account: args.context.users[0].account, account: args.context.users[0].account,
domainId: args.context.users[0].domainid, domainId: args.context.users[0].domainid,
@ -327,16 +330,30 @@
noHeaderActionsColumn: true, noHeaderActionsColumn: true,
ignoreEmptyFields: true, ignoreEmptyFields: true,
fields: { fields: {
'email': { edit: true, label: 'label.email' }, 'email': {
'account': { edit: true, label: 'label.account' }, edit: true,
'state': { edit: 'ignore', label: 'label.status' }, label: 'label.email'
'add-user': { addButton: true, label: '' } },
'account': {
edit: true,
label: 'label.account'
},
'state': {
edit: 'ignore',
label: 'label.status'
},
'add-user': {
addButton: true,
label: ''
}
}, },
add: { add: {
label: 'label.invite', label: 'label.invite',
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url: createURL('addAccountToProject', { ignoreProject: true }), url: createURL('addAccountToProject', {
ignoreProject: true
}),
data: { data: {
projectId: args.context.projects[0].id, projectId: args.context.projects[0].id,
account: args.data.account, account: args.data.account,
@ -364,8 +381,7 @@
}, },
actionPreFilter: function(args) { actionPreFilter: function(args) {
if (args.context.projects && if (args.context.projects &&
args.context.projects[0] && args.context.projects[0] && !args.context.projects[0].isNew) {
!args.context.projects[0].isNew) {
return args.context.actions; return args.context.actions;
} }
@ -383,7 +399,9 @@
}, },
success: function(data) { success: function(data) {
args.response.success({ args.response.success({
_custom: { jobId: data.deleteprojectinvitationresponse.jobid }, _custom: {
jobId: data.deleteprojectinvitationresponse.jobid
},
notification: { notification: {
label: 'label.revoke.project.invite', label: 'label.revoke.project.invite',
poll: pollAsyncJobResult poll: pollAsyncJobResult
@ -398,7 +416,9 @@
// Project users data provider // Project users data provider
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL('listProjectInvitations', { ignoreProject: true }), url: createURL('listProjectInvitations', {
ignoreProject: true
}),
data: { data: {
state: 'Pending', state: 'Pending',
listAll: true, listAll: true,
@ -429,15 +449,26 @@
return g_capabilities.projectinviterequired; return g_capabilities.projectinviterequired;
}, },
fields: { fields: {
'username': { edit: true, label: 'label.account' }, 'username': {
'role': { edit: 'ignore', label: 'label.role' }, edit: true,
'add-user': { addButton: true, label: '' } label: 'label.account'
},
'role': {
edit: 'ignore',
label: 'label.role'
},
'add-user': {
addButton: true,
label: ''
}
}, },
add: { add: {
label: 'label.add.account', label: 'label.add.account',
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url: createURL('addAccountToProject', { ignoreProject: true }), url: createURL('addAccountToProject', {
ignoreProject: true
}),
data: { data: {
projectId: args.context.projects[0].id, projectId: args.context.projects[0].id,
account: args.data.username account: args.data.username
@ -456,7 +487,9 @@
}); });
if (g_capabilities.projectinviterequired) { if (g_capabilities.projectinviterequired) {
cloudStack.dialog.notice({ message: 'message.project.invite.sent' }); cloudStack.dialog.notice({
message: 'message.project.invite.sent'
});
} }
} }
}); });
@ -495,7 +528,9 @@
label: 'label.remove.project.account', label: 'label.remove.project.account',
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url: createURL('deleteAccountFromProject', { ignoreProject: true }), url: createURL('deleteAccountFromProject', {
ignoreProject: true
}),
data: { data: {
projectId: args.context.projects[0].id, projectId: args.context.projects[0].id,
account: args.context.multiRule[0].username account: args.context.multiRule[0].username
@ -524,7 +559,9 @@
label: 'label.make.project.owner', label: 'label.make.project.owner',
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url: createURL('updateProject', { ignoreProject: true }), url: createURL('updateProject', {
ignoreProject: true
}),
data: { data: {
id: args.context.projects[0].id, id: args.context.projects[0].id,
account: args.context.multiRule[0].username account: args.context.multiRule[0].username
@ -535,7 +572,7 @@
args.response.success({ args.response.success({
_custom: { _custom: {
jobId: data.updateprojectresponse.jobid, jobId: data.updateprojectresponse.jobid,
onComplete: function(){ onComplete: function() {
setTimeout(function() { setTimeout(function() {
$(window).trigger('cloudStack.fullRefresh'); $(window).trigger('cloudStack.fullRefresh');
if (isUser()) { if (isUser()) {
@ -558,7 +595,9 @@
// Project users data provider // Project users data provider
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL('listProjectAccounts', { ignoreProject: true }), url: createURL('listProjectAccounts', {
ignoreProject: true
}),
data: { data: {
projectId: args.context.projects[0].id projectId: args.context.projects[0].id
}, },
@ -572,8 +611,7 @@
return { return {
id: elem.accountid, id: elem.accountid,
role: elem.role, role: elem.role,
username: elem.role == 'Owner' ? username: elem.role == 'Owner' ? elem.account + ' (owner)' : elem.account
elem.account + ' (owner)' : elem.account
}; };
}) })
}); });
@ -595,7 +633,9 @@
} }
$.ajax({ $.ajax({
url: createURL('listProjects', { ignoreProject: true }), url: createURL('listProjects', {
ignoreProject: true
}),
data: data, data: data,
dataType: 'json', dataType: 'json',
async: true, async: true,
@ -628,10 +668,18 @@
title: 'label.projects', title: 'label.projects',
listView: { listView: {
fields: { fields: {
name: { label: 'label.name' }, name: {
displaytext: { label: 'label.display.name' }, label: 'label.name'
domain: { label: 'label.domain' }, },
account: { label: 'label.owner.account' }, displaytext: {
label: 'label.display.name'
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.owner.account'
},
state: { state: {
label: 'label.status', label: 'label.status',
indicator: { indicator: {
@ -644,13 +692,17 @@
}, },
advSearchFields: { advSearchFields: {
name: { label: 'label.name' }, name: {
displaytext: { label: 'label.display.text' }, label: 'label.name'
},
displaytext: {
label: 'label.display.text'
},
domainid: { domainid: {
label: 'Domain', label: 'Domain',
select: function(args) { select: function(args) {
if(isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
$.ajax({ $.ajax({
url: createURL('listDomains'), url: createURL('listDomains'),
data: { data: {
@ -658,11 +710,17 @@
details: 'min' details: 'min'
}, },
success: function(json) { success: function(json) {
var array1 = [{id: '', description: ''}]; var array1 = [{
id: '',
description: ''
}];
var domains = json.listdomainsresponse.domain; var domains = json.listdomainsresponse.domain;
if(domains != null && domains.length > 0) { if (domains != null && domains.length > 0) {
for(var i = 0; i < domains.length; i++) { for (var i = 0; i < domains.length; i++) {
array1.push({id: domains[i].id, description: domains[i].path}); array1.push({
id: domains[i].id,
description: domains[i].path
});
} }
} }
args.response.success({ args.response.success({
@ -670,15 +728,14 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
} }
}, },
isHidden: function(args) { isHidden: function(args) {
if(isAdmin() || isDomainAdmin()) if (isAdmin() || isDomainAdmin())
return false; return false;
else else
return true; return true;
@ -688,7 +745,7 @@
account: { account: {
label: 'Account', label: 'Account',
isHidden: function(args) { isHidden: function(args) {
if(isAdmin() || isDomainAdmin()) if (isAdmin() || isDomainAdmin())
return false; return false;
else else
return true; return true;
@ -707,7 +764,9 @@
} }
$.ajax({ $.ajax({
url: createURL('listProjects', { ignoreProject: true }), url: createURL('listProjects', {
ignoreProject: true
}),
data: data, data: data,
success: function(data) { success: function(data) {
args.response.success({ args.response.success({
@ -730,7 +789,7 @@
}, },
detailView: { detailView: {
updateContext: function (args) { updateContext: function(args) {
var project; var project;
var projectID = args.context.projects[0].id; var projectID = args.context.projects[0].id;
var url = 'listProjects'; var url = 'listProjects';
@ -770,7 +829,9 @@
}); });
}, },
messages: { messages: {
notification: function(args) { return 'label.edit.project.details'; } notification: function(args) {
return 'label.edit.project.details';
}
} }
}, },
disable: { disable: {
@ -786,7 +847,9 @@
_custom: { _custom: {
jobId: json.suspendprojectresponse.jobid, jobId: json.suspendprojectresponse.jobid,
getUpdatedItem: function() { getUpdatedItem: function() {
return { state: 'Suspended' }; return {
state: 'Suspended'
};
} }
} }
}); });
@ -797,10 +860,16 @@
}); });
}, },
messages: { messages: {
confirm: function() { return 'message.suspend.project'; }, confirm: function() {
notification: function() { return 'label.suspend.project'; } return 'message.suspend.project';
}, },
notification: { poll: pollAsyncJobResult } notification: function() {
return 'label.suspend.project';
}
},
notification: {
poll: pollAsyncJobResult
}
}, },
enable: { enable: {
@ -816,7 +885,9 @@
_custom: { _custom: {
jobId: json.activaterojectresponse.jobid, // NOTE: typo jobId: json.activaterojectresponse.jobid, // NOTE: typo
getUpdatedItem: function() { getUpdatedItem: function() {
return { state: 'Active' }; return {
state: 'Active'
};
} }
} }
}); });
@ -827,17 +898,25 @@
}); });
}, },
messages: { messages: {
confirm: function() { return 'message.activate.project'; }, confirm: function() {
notification: function() { return 'label.activate.project'; } return 'message.activate.project';
}, },
notification: { poll: pollAsyncJobResult } notification: function() {
return 'label.activate.project';
}
},
notification: {
poll: pollAsyncJobResult
}
}, },
remove: { remove: {
label: 'label.delete.project', label: 'label.delete.project',
action: function(args) { action: function(args) {
$.ajax({ $.ajax({
url: createURL('deleteProject', { ignoreProject: true }), url: createURL('deleteProject', {
ignoreProject: true
}),
data: { data: {
id: args.data.id id: args.data.id
}, },
@ -847,7 +926,9 @@
args.response.success({ args.response.success({
_custom: { _custom: {
getUpdatedItem: function(data) { getUpdatedItem: function(data) {
return $.extend(data, { state: 'Destroyed' }); return $.extend(data, {
state: 'Destroyed'
});
}, },
onComplete: function(data) { onComplete: function(data) {
$(window).trigger('cloudStack.deleteProject', args); $(window).trigger('cloudStack.deleteProject', args);
@ -903,19 +984,30 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ name: {
name: { label: 'label.name' } label: 'label.name'
},
{
displaytext: { label: 'label.display.name', isEditable: true },
domain: { label: 'label.domain' },
account: { label: 'label.account'},
state: { label: 'label.state' }
} }
], }, {
displaytext: {
label: 'label.display.name',
isEditable: true
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.account'
},
state: {
label: 'label.state'
}
}],
tags: cloudStack.api.tags({ resourceType: 'Project', contextId: 'projects' }), tags: cloudStack.api.tags({
resourceType: 'Project',
contextId: 'projects'
}),
dataProvider: function(args) { dataProvider: function(args) {
var projectID = args.context.projects[0].id; var projectID = args.context.projects[0].id;
@ -933,8 +1025,7 @@
}, },
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
data: json.listprojectsresponse.project ? data: json.listprojectsresponse.project ? json.listprojectsresponse.project[0] : {},
json.listprojectsresponse.project[0] : {},
actionFilter: projectsActionFilter actionFilter: projectsActionFilter
}); });
} }
@ -948,9 +1039,10 @@
var project = args.context.projects[0]; var project = args.context.projects[0];
var multiEditArgs = $.extend( var multiEditArgs = $.extend(
true, {}, true, {},
cloudStack.projects.addUserForm, cloudStack.projects.addUserForm, {
{ context: {
context: { projects: [project] } projects: [project]
}
} }
); );
var $users = $('<div>').multiEdit(multiEditArgs); var $users = $('<div>').multiEdit(multiEditArgs);
@ -965,7 +1057,9 @@
var project = args.context.projects[0]; var project = args.context.projects[0];
var $invites = cloudStack.uiCustom.projectsTabs.userManagement({ var $invites = cloudStack.uiCustom.projectsTabs.userManagement({
useInvites: true, useInvites: true,
context: { projects: [project] } context: {
projects: [project]
}
}); });
return $invites; return $invites;
@ -994,13 +1088,19 @@
title: 'label.invitations', title: 'label.invitations',
listView: { listView: {
fields: { fields: {
project: { label: 'label.project' }, project: {
domain: { label: 'label.domain' }, label: 'label.project'
},
domain: {
label: 'label.domain'
},
state: { state: {
label: 'label.status', label: 'label.status',
indicator: { indicator: {
'Accepted': 'on', 'Completed': 'on', 'Accepted': 'on',
'Pending': 'off', 'Declined': 'off' 'Completed': 'on',
'Pending': 'off',
'Declined': 'off'
} }
} }
}, },
@ -1014,8 +1114,7 @@
success: function(data) { success: function(data) {
args.response.success({ args.response.success({
actionFilter: projectInvitationActionFilter, actionFilter: projectInvitationActionFilter,
data: data.listprojectinvitationsresponse.projectinvitation ? data: data.listprojectinvitationsresponse.projectinvitation ? data.listprojectinvitationsresponse.projectinvitation : []
data.listprojectinvitationsresponse.projectinvitation : []
}); });
} }
}); });
@ -1031,7 +1130,9 @@
$.ajax({ $.ajax({
url: createURL('listProjectInvitations'), url: createURL('listProjectInvitations'),
data: { state: 'Pending' }, data: {
state: 'Pending'
},
async: false, async: false,
success: function(json) { success: function(json) {
if (json.listprojectinvitationsresponse.count) { if (json.listprojectinvitationsresponse.count) {
@ -1045,8 +1146,20 @@
createForm: { createForm: {
desc: 'message.enter.token', desc: 'message.enter.token',
fields: { fields: {
projectid: { label: 'label.project.id', validation: { required: true}, docID: 'helpEnterTokenProjectID' }, projectid: {
token: { label: 'label.token', docID: 'helpEnterTokenToken', validation: { required: true }} label: 'label.project.id',
validation: {
required: true
},
docID: 'helpEnterTokenProjectID'
},
token: {
label: 'label.token',
docID: 'helpEnterTokenToken',
validation: {
required: true
}
}
} }
}, },
action: function(args) { action: function(args) {
@ -1073,7 +1186,9 @@
return 'message.join.project'; return 'message.join.project';
} }
}, },
notification: { poll: pollAsyncJobResult } notification: {
poll: pollAsyncJobResult
}
}, },
accept: { accept: {
@ -1091,17 +1206,27 @@
args.response.success({ args.response.success({
_custom: { _custom: {
jobId: data.updateprojectinvitationresponse.jobid, jobId: data.updateprojectinvitationresponse.jobid,
getUpdatedItem: function() { return { state: 'Accepted' }; } getUpdatedItem: function() {
return {
state: 'Accepted'
};
}
} }
}); });
} }
}); });
}, },
messages: { messages: {
confirm: function() { return 'message.confirm.join.project'; }, confirm: function() {
notification: function() { return 'label.accept.project.invitation'; } return 'message.confirm.join.project';
}, },
notification: { poll: pollAsyncJobResult } notification: function() {
return 'label.accept.project.invitation';
}
},
notification: {
poll: pollAsyncJobResult
}
}, },
decline: { decline: {
@ -1119,16 +1244,26 @@
args.response.success({ args.response.success({
_custom: { _custom: {
jobId: data.updateprojectinvitationresponse.jobid, jobId: data.updateprojectinvitationresponse.jobid,
getUpdatedItem: function() { return { state: 'Declined' }; } getUpdatedItem: function() {
return {
state: 'Declined'
};
}
} }
}); });
} }
}); });
}, },
notification: { poll: pollAsyncJobResult }, notification: {
poll: pollAsyncJobResult
},
messages: { messages: {
confirm: function() { return 'message.decline.invitation'; }, confirm: function() {
notification: function() { return 'label.decline.invitation'; } return 'message.decline.invitation';
},
notification: function() {
return 'label.decline.invitation';
}
} }
} }
} }
@ -1163,4 +1298,4 @@
return ['accept', 'decline']; return ['accept', 'decline'];
}; };
} (cloudStack)); }(cloudStack));

View File

@ -20,7 +20,9 @@
id: 'regions', id: 'regions',
sectionSelect: { sectionSelect: {
label: 'label.select-view', label: 'label.select-view',
preFilter: function() { return ['regions']; } preFilter: function() {
return ['regions'];
}
}, },
regionSelector: { regionSelector: {
dataProvider: function(args) { dataProvider: function(args) {
@ -30,9 +32,10 @@
var regions = json.listregionsresponse.region; var regions = json.listregionsresponse.region;
args.response.success({ args.response.success({
data: regions ? regions : [ data: regions ? regions : [{
{ id: -1, name: _l('label.no.data') } id: -1,
] name: _l('label.no.data')
}]
}); });
} }
}); });
@ -48,29 +51,52 @@
id: 'regions', id: 'regions',
label: 'label.menu.regions', label: 'label.menu.regions',
fields: { fields: {
name: { label: 'label.name' }, name: {
id: { label: 'ID' }, label: 'label.name'
endpoint: { label: 'label.endpoint' } },
id: {
label: 'ID'
},
endpoint: {
label: 'label.endpoint'
}
}, },
actions: { actions: {
add: { add: {
label: 'label.add.region', label: 'label.add.region',
preFilter: function(args) { preFilter: function(args) {
if(isAdmin()) if (isAdmin())
return true; return true;
else else
return false; return false;
}, },
messages: { messages: {
notification: function() { return 'label.add.region'; } notification: function() {
return 'label.add.region';
}
}, },
createForm: { createForm: {
title: 'label.add.region', title: 'label.add.region',
desc: 'message.add.region', desc: 'message.add.region',
fields: { fields: {
id: { label: 'label.id', validation: { required: true } }, id: {
name: { label: 'label.name', validation: { required: true } }, label: 'label.id',
endpoint: { label: 'label.endpoint', validation: { required: true } } validation: {
required: true
}
},
name: {
label: 'label.name',
validation: {
required: true
}
},
endpoint: {
label: 'label.endpoint',
validation: {
required: true
}
}
} }
}, },
action: function(args) { action: function(args) {
@ -85,7 +111,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var item = json.addregionresponse.region; var item = json.addregionresponse.region;
args.response.success({data: item}); args.response.success({
data: item
});
$(window).trigger('cloudStack.refreshRegions'); $(window).trigger('cloudStack.refreshRegions');
}, },
error: function(json) { error: function(json) {
@ -116,12 +144,10 @@
}, },
detailView: { detailView: {
name: 'Region details', name: 'Region details',
viewAll: [ viewAll: [{
{
path: 'regions.GSLB', path: 'regions.GSLB',
label: 'GSLB' label: 'GSLB'
}, }, {
{
path: 'regions.portableIpRanges', path: 'regions.portableIpRanges',
label: 'Portable IP', label: 'Portable IP',
preFilter: function(args) { preFilter: function(args) {
@ -130,8 +156,7 @@
return false; return false;
} }
} }],
],
actions: { actions: {
edit: { edit: {
label: 'label.edit.region', label: 'label.edit.region',
@ -158,8 +183,12 @@
remove: { remove: {
label: 'label.remove.region', label: 'label.remove.region',
messages: { messages: {
notification: function() { return 'label.remove.region'; }, notification: function() {
confirm: function() { return 'message.remove.region'; } return 'label.remove.region';
},
confirm: function() {
return 'message.remove.region';
}
}, },
preAction: function(args) { preAction: function(args) {
var region = args.context.regions[0]; var region = args.context.regions[0];
@ -181,7 +210,9 @@
$.ajax({ $.ajax({
url: createURL('removeRegion'), url: createURL('removeRegion'),
data: { id: region.id }, data: {
id: region.id
},
success: function(json) { success: function(json) {
args.response.success(); args.response.success();
$(window).trigger('cloudStack.refreshRegions'); $(window).trigger('cloudStack.refreshRegions');
@ -196,19 +227,26 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ id: {
id: { label: 'label.id' } label: 'label.id'
},
{
name: { label: 'label.name', isEditable: true },
endpoint: { label: 'label.endpoint', isEditable: true }
} }
], }, {
name: {
label: 'label.name',
isEditable: true
},
endpoint: {
label: 'label.endpoint',
isEditable: true
}
}],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL('listRegions&listAll=true'), url: createURL('listRegions&listAll=true'),
data: { id: args.context.regions[0].id }, data: {
id: args.context.regions[0].id
},
success: function(json) { success: function(json) {
var region = json.listregionsresponse.region var region = json.listregionsresponse.region
@ -235,9 +273,15 @@
id: 'GSLB', id: 'GSLB',
label: 'GSLB', label: 'GSLB',
fields: { fields: {
name: { label: 'label.name' }, name: {
gslbdomainname: { label: 'GSLB Domain Name' }, label: 'label.name'
gslblbmethod: { label: 'Algorithm' } },
gslbdomainname: {
label: 'GSLB Domain Name'
},
gslblbmethod: {
label: 'Algorithm'
}
}, },
actions: { actions: {
add: { add: {
@ -257,19 +301,32 @@
fields: { fields: {
name: { name: {
label: 'label.name', label: 'label.name',
validation: { required: true } validation: {
required: true
}
}, },
description: { description: {
label: 'label.description' label: 'label.description'
}, },
gslbdomainname: { gslbdomainname: {
label: 'GSLB Domain Name', label: 'GSLB Domain Name',
validation: { required: true } validation: {
required: true
}
}, },
gslblbmethod: { gslblbmethod: {
label: 'Algorithm', label: 'Algorithm',
select: function(args) { select: function(args) {
var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 'leastconn', description: 'leastconn'}, {id: 'proximity', description: 'proximity'}]; var array1 = [{
id: 'roundrobin',
description: 'roundrobin'
}, {
id: 'leastconn',
description: 'leastconn'
}, {
id: 'proximity',
description: 'proximity'
}];
args.response.success({ args.response.success({
data: array1 data: array1
}); });
@ -278,17 +335,25 @@
gslbservicetype: { gslbservicetype: {
label: 'Service Type', label: 'Service Type',
select: function(args) { select: function(args) {
var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 'udp'}]; var array1 = [{
id: 'tcp',
description: 'tcp'
}, {
id: 'udp',
description: 'udp'
}];
args.response.success({ args.response.success({
data: array1 data: array1
}); });
}, },
validation: { required: true } validation: {
required: true
}
}, },
domainid: { domainid: {
label: 'Domain', label: 'Domain',
select: function(args) { select: function(args) {
if(isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
$.ajax({ $.ajax({
url: createURL('listDomains'), url: createURL('listDomains'),
data: { data: {
@ -296,11 +361,17 @@
details: 'min' details: 'min'
}, },
success: function(json) { success: function(json) {
var array1 = [{id: '', description: ''}]; var array1 = [{
id: '',
description: ''
}];
var domains = json.listdomainsresponse.domain; var domains = json.listdomainsresponse.domain;
if(domains != null && domains.length > 0) { if (domains != null && domains.length > 0) {
for(var i = 0; i < domains.length; i++) { for (var i = 0; i < domains.length; i++) {
array1.push({id: domains[i].id, description: domains[i].path}); array1.push({
id: domains[i].id,
description: domains[i].path
});
} }
} }
args.response.success({ args.response.success({
@ -308,15 +379,14 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
} }
}, },
isHidden: function(args) { isHidden: function(args) {
if(isAdmin() || isDomainAdmin()) if (isAdmin() || isDomainAdmin())
return false; return false;
else else
return true; return true;
@ -325,7 +395,7 @@
account: { account: {
label: 'Account', label: 'Account',
isHidden: function(args) { isHidden: function(args) {
if(isAdmin() || isDomainAdmin()) if (isAdmin() || isDomainAdmin())
return false; return false;
else else
return true; return true;
@ -342,27 +412,32 @@
gslbdomainname: args.data.gslbdomainname, gslbdomainname: args.data.gslbdomainname,
gslbservicetype: args.data.gslbservicetype gslbservicetype: args.data.gslbservicetype
}; };
if(args.data.description != null && args.data.description.length > 0) if (args.data.description != null && args.data.description.length > 0)
$.extend(data, { description: args.data.description }); $.extend(data, {
if(args.data.domainid != null && args.data.domainid.length > 0) description: args.data.description
$.extend(data, { domainid: args.data.domainid }); });
if(args.data.account != null && args.data.account.length > 0) if (args.data.domainid != null && args.data.domainid.length > 0)
$.extend(data, { account: args.data.account }); $.extend(data, {
domainid: args.data.domainid
});
if (args.data.account != null && args.data.account.length > 0)
$.extend(data, {
account: args.data.account
});
$.ajax({ $.ajax({
url: createURL('createGlobalLoadBalancerRule'), url: createURL('createGlobalLoadBalancerRule'),
data: data, data: data,
success: function(json) { success: function(json) {
var jid = json.creategloballoadbalancerruleresponse.jobid; var jid = json.creategloballoadbalancerruleresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.globalloadbalancer; return json.queryasyncjobresultresponse.jobresult.globalloadbalancer;
} }
} }
} });
);
} }
}); });
}, },
@ -373,7 +448,7 @@
}, },
dataProvider: function(args) { dataProvider: function(args) {
if('regions' in args.context) { if ('regions' in args.context) {
var data = { var data = {
regionid: args.context.regions[0].id regionid: args.context.regions[0].id
}; };
@ -387,8 +462,7 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
@ -397,7 +471,10 @@
detailView: { detailView: {
name: 'GSLB details', name: 'GSLB details',
viewAll: { path: 'regions.lbUnderGSLB', label: 'assigned load balancing' }, viewAll: {
path: 'regions.lbUnderGSLB',
label: 'assigned load balancing'
},
actions: { actions: {
remove: { remove: {
label: 'delete GSLB', label: 'delete GSLB',
@ -434,18 +511,27 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ name: {
name: { label: 'label.name' } label: 'label.name'
},
{
description: { label: 'label.description' },
gslbdomainname: { label: 'GSLB Domain Name' },
gslblbmethod: { label: 'Algorithm' },
gslbservicetype: { label: 'Service Type' },
id: { label: 'ID' }
} }
], }, {
description: {
label: 'label.description'
},
gslbdomainname: {
label: 'GSLB Domain Name'
},
gslblbmethod: {
label: 'Algorithm'
},
gslbservicetype: {
label: 'Service Type'
},
id: {
label: 'ID'
}
}],
dataProvider: function(args) { dataProvider: function(args) {
var data = { var data = {
id: args.context.GSLB[0].id id: args.context.GSLB[0].id
@ -475,11 +561,21 @@
id: 'portableIpRanges', id: 'portableIpRanges',
label: 'Portable IP Ranges', label: 'Portable IP Ranges',
fields: { fields: {
startip: { label: 'label.start.IP' }, startip: {
endip: { label: 'label.end.IP' }, label: 'label.start.IP'
gateway: { label: 'label.gateway' }, },
netmask: { label: 'label.netmask' }, endip: {
vlan: { label: 'label.vlan' } label: 'label.end.IP'
},
gateway: {
label: 'label.gateway'
},
netmask: {
label: 'label.netmask'
},
vlan: {
label: 'label.vlan'
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
@ -511,23 +607,33 @@
fields: { fields: {
startip: { startip: {
label: 'label.start.IP', label: 'label.start.IP',
validation: { required: true } validation: {
required: true
}
}, },
endip: { endip: {
label: 'label.end.IP', label: 'label.end.IP',
validation: { required: true } validation: {
required: true
}
}, },
gateway: { gateway: {
label: 'label.gateway', label: 'label.gateway',
validation: { required: true } validation: {
required: true
}
}, },
netmask: { netmask: {
label: 'label.netmask', label: 'label.netmask',
validation: { required: true } validation: {
required: true
}
}, },
vlan: { vlan: {
label: 'label.vlan', label: 'label.vlan',
validation: { required: false } validation: {
required: false
}
} }
} }
}, },
@ -539,7 +645,7 @@
gateway: args.data.gateway, gateway: args.data.gateway,
netmask: args.data.netmask netmask: args.data.netmask
}; };
if(args.data.vlan != null && args.data.vlan.length > 0) { if (args.data.vlan != null && args.data.vlan.length > 0) {
$.extend(data, { $.extend(data, {
vlan: args.data.vlan vlan: args.data.vlan
}) })
@ -611,23 +717,33 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ id: {
id: { label: 'label.id' } label: 'label.id'
}
}, {
startip: {
label: 'label.start.IP'
},
endip: {
label: 'label.end.IP'
},
gateway: {
label: 'label.gateway'
},
netmask: {
label: 'label.netmask'
},
vlan: {
label: 'label.vlan'
}, },
{
startip: { label: 'label.start.IP' },
endip: { label: 'label.end.IP' },
gateway: { label: 'label.gateway' },
netmask: { label: 'label.netmask' },
vlan: { label: 'label.vlan' },
portableipaddress: { portableipaddress: {
label: 'Portable IPs', label: 'Portable IPs',
converter: function(args) { converter: function(args) {
var text1 = ''; var text1 = '';
if(args != null) { if (args != null) {
for(var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
if(i > 0) { if (i > 0) {
text1 += ', '; text1 += ', ';
} }
text1 += args[i].ipaddress; text1 += args[i].ipaddress;
@ -636,8 +752,7 @@
return text1; return text1;
} }
} }
} }],
],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL('listPortableIpRanges'), url: createURL('listPortableIpRanges'),
@ -670,10 +785,18 @@
id: 'lbUnderGSLB', id: 'lbUnderGSLB',
label: 'assigned load balancing', label: 'assigned load balancing',
fields: { fields: {
name: { label: 'label.name' }, name: {
publicport: { label: 'label.public.port' }, label: 'label.name'
privateport: { label: 'label.private.port' }, },
algorithm: { label: 'label.algorithm' } publicport: {
label: 'label.public.port'
},
privateport: {
label: 'label.private.port'
},
algorithm: {
label: 'label.algorithm'
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
var data = { var data = {
@ -715,18 +838,18 @@
var allLbRules = json.listloadbalancerrulesresponse.loadbalancerrule; var allLbRules = json.listloadbalancerrulesresponse.loadbalancerrule;
var assignedLbRules = args.context.GSLB[0].loadbalancerrule; var assignedLbRules = args.context.GSLB[0].loadbalancerrule;
var items = []; var items = [];
if(allLbRules != null) { if (allLbRules != null) {
for(var i = 0; i < allLbRules.length; i++) { for (var i = 0; i < allLbRules.length; i++) {
var isAssigned = false; var isAssigned = false;
if(assignedLbRules != null) { if (assignedLbRules != null) {
for(var k = 0; k < assignedLbRules.length; k++) { for (var k = 0; k < assignedLbRules.length; k++) {
if(allLbRules[i].id == assignedLbRules[k].id) { if (allLbRules[i].id == assignedLbRules[k].id) {
isAssigned = true; isAssigned = true;
break; break;
} }
} }
} }
if(isAssigned == false) { if (isAssigned == false) {
items.push(allLbRules[i]); items.push(allLbRules[i]);
} }
} }
@ -751,15 +874,14 @@
data: data, data: data,
success: function(json) { success: function(json) {
var jid = json.assigntogloballoadbalancerruleresponse.jobid; var jid = json.assigntogloballoadbalancerruleresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule; return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
} }
} }
} });
);
} }
}); });
}, },
@ -806,22 +928,39 @@
tabs: { tabs: {
details: { details: {
title: 'label.details', title: 'label.details',
fields: [ fields: [{
{ name: {
name: { label: 'label.name' } label: 'label.name'
},
{
publicport: { label: 'label.public.port' },
privateport: { label: 'label.private.port' },
algorithm: { label: 'label.algorithm' },
publicip: { label: 'label.public.ip' },
state: { label: 'label.state' },
id: { label: 'label.id' },
cidrlist: { label: 'label.cidr' },
domain: { label: 'label.domain' },
account: { label: 'label.account' }
} }
], }, {
publicport: {
label: 'label.public.port'
},
privateport: {
label: 'label.private.port'
},
algorithm: {
label: 'label.algorithm'
},
publicip: {
label: 'label.public.ip'
},
state: {
label: 'label.state'
},
id: {
label: 'label.id'
},
cidrlist: {
label: 'label.cidr'
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.account'
}
}],
dataProvider: function(args) { dataProvider: function(args) {
$.ajax({ $.ajax({
url: createURL('listLoadBalancerRules'), url: createURL('listLoadBalancerRules'),
@ -846,7 +985,7 @@
var regionActionfilter = function(args) { var regionActionfilter = function(args) {
var allowedActions = []; var allowedActions = [];
if(isAdmin()) { if (isAdmin()) {
allowedActions.push("edit"); allowedActions.push("edit");
allowedActions.push("remove"); allowedActions.push("remove");
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -70,13 +70,14 @@
dialogClass: 'multi-edit-add-list panel', dialogClass: 'multi-edit-add-list panel',
width: 825, width: 825,
title: _l('label.affinity.groups'), title: _l('label.affinity.groups'),
buttons: [ buttons: [{
{
text: _l('label.apply'), text: _l('label.apply'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
if ($dataList.find('.tier-select select').val() == -1) { if ($dataList.find('.tier-select select').val() == -1) {
cloudStack.dialog.notice({ message: ('Please select a tier')}); cloudStack.dialog.notice({
message: ('Please select a tier')
});
return false; return false;
} }
@ -108,7 +109,9 @@
}); });
}, },
error: function(args) { error: function(args) {
cloudStack.dialog.notice({ message: args }); cloudStack.dialog.notice({
message: args
});
} }
} }
}); });
@ -120,8 +123,7 @@
$(':ui-dialog').dialog('destroy'); $(':ui-dialog').dialog('destroy');
}); });
} }
}, }, {
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
@ -133,8 +135,7 @@
$(':ui-dialog').dialog('destroy'); $(':ui-dialog').dialog('destroy');
}); });
} }
} }]
]
}).parent('.ui-dialog').overlay(); }).parent('.ui-dialog').overlay();
// Add tier select dialog // Add tier select dialog

View File

@ -40,10 +40,10 @@
var $scaleUpPolicy = $('<div>').addClass('scale-up-policy'); var $scaleUpPolicy = $('<div>').addClass('scale-up-policy');
var $slideScaleUp = $('<div></div>').addClass('expand'); var $slideScaleUp = $('<div></div>').addClass('expand');
var $hideScaleUp = $('<div></div>').addClass('hide'); var $hideScaleUp = $('<div></div>').addClass('hide');
var $scaleUpLabel= $('<div>Show</div>').addClass('slide-label'); var $scaleUpLabel = $('<div>Show</div>').addClass('slide-label');
var $scaleUpHideLabel=$('<div>Hide</div>').addClass('slide-label'); var $scaleUpHideLabel = $('<div>Hide</div>').addClass('slide-label');
var $scaleDownHideLabel=$('<div>Hide</div>').addClass('slide-label'); var $scaleDownHideLabel = $('<div>Hide</div>').addClass('slide-label');
var $scaleDownLabel=$('<div>Show</div>').addClass('slide-label'); var $scaleDownLabel = $('<div>Show</div>').addClass('slide-label');
var $slideScaleDown = $('<div></div>').addClass('expand'); var $slideScaleDown = $('<div></div>').addClass('expand');
var $hideScaleDown = $('<div></div>').addClass('hide'); var $hideScaleDown = $('<div></div>').addClass('hide');
var $scaleUpDivider = $('<hr></hr>').addClass('policy-divider'); var $scaleUpDivider = $('<hr></hr>').addClass('policy-divider');
@ -74,7 +74,9 @@
originalAutoscaleData: data ? [data] : null originalAutoscaleData: data ? [data] : null
}) })
}) : }) :
$.map(actions, function(value, key) { return key; }); $.map(actions, function(value, key) {
return key;
});
$detailActions.append($buttons); $detailActions.append($buttons);
$actionsTable.find('tr').append($detailActions); $actionsTable.find('tr').append($detailActions);
@ -85,7 +87,10 @@
var label = _l(action.label); var label = _l(action.label);
var $action = $('<div>').addClass('action').addClass(actionID); var $action = $('<div>').addClass('action').addClass(actionID);
var $icon = $('<a>') var $icon = $('<a>')
.attr({ href: '#', title: label }) .attr({
href: '#',
title: label
})
.append($('<span>').addClass('icon')); .append($('<span>').addClass('icon'));
if (visibleActions.length == 1) $action.addClass('single'); if (visibleActions.length == 1) $action.addClass('single');
@ -102,7 +107,7 @@
}); });
// Reload actions // Reload actions
if(data != null) { //data is originalAutoscaleData in \ui\scripts\autoscaler.js if (data != null) { //data is originalAutoscaleData in \ui\scripts\autoscaler.js
data['afterActionIsComplete'] = args.data; data['afterActionIsComplete'] = args.data;
} }
@ -117,7 +122,9 @@
}; };
var error = function(message) { var error = function(message) {
$loading.remove(); $loading.remove();
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
}; };
action.action({ action.action({
@ -190,7 +197,12 @@
form: { form: {
title: '', title: '',
fields: { fields: {
scaleUpDuration: { label: 'Duration(in sec)', validation: { required: true } } scaleUpDuration: {
label: 'Duration(in sec)',
validation: {
required: true
}
}
} }
} }
}); });
@ -204,7 +216,12 @@
form: { form: {
title: '', title: '',
fields: { fields: {
scaleDownDuration: { label: 'Duration(in sec)', validation: { required: true } } scaleDownDuration: {
label: 'Duration(in sec)',
validation: {
required: true
}
}
} }
} }
}); });
@ -303,7 +320,9 @@
$scaleDownLabel = $('div.ui-dialog div.autoscaler div.scale-down-policy div.slide-label').replaceWith($scaleDownLabel); $scaleDownLabel = $('div.ui-dialog div.autoscaler div.scale-down-policy div.slide-label').replaceWith($scaleDownLabel);
}); });
$('div.ui-dialog div.autoscaler div.scale-down-policy div.multi-edit div.data div.expand').click(function() { $('div.ui-dialog div.autoscaler div.scale-down-policy div.multi-edit div.data div.data-item').slideToggle(); }); $('div.ui-dialog div.autoscaler div.scale-down-policy div.multi-edit div.data div.expand').click(function() {
$('div.ui-dialog div.autoscaler div.scale-down-policy div.multi-edit div.data div.data-item').slideToggle();
});
$autoscalerDialog.dialog('option', 'position', 'center'); $autoscalerDialog.dialog('option', 'position', 'center');
$autoscalerDialog.dialog('option', 'height', 'auto'); $autoscalerDialog.dialog('option', 'height', 'auto');
@ -319,22 +338,20 @@
height: 600, height: 600,
draggable: true, draggable: true,
closeonEscape: false, closeonEscape: false,
overflow:'auto', overflow: 'auto',
open:function() { open: function() {
$("button").each(function(){ $("button").each(function() {
$(this).attr("style", "left: 600px; position: relative; margin-right: 5px; "); $(this).attr("style", "left: 600px; position: relative; margin-right: 5px; ");
}); });
}, },
buttons: [ buttons: [{
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
$autoscalerDialog.dialog('destroy'); $autoscalerDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
} }
}, }, {
{
text: _l('Apply'), text: _l('Apply'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
@ -361,14 +378,15 @@
}); });
}, },
error: function(message) { error: function(message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
$loading.remove(); $loading.remove();
} }
} }
}); });
} }
} }]
]
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
dataProvider({ dataProvider({
@ -382,13 +400,12 @@
$autoscalerDialog.find('select[name=serviceOfferingId]').removeAttr('disabled'); $autoscalerDialog.find('select[name=serviceOfferingId]').removeAttr('disabled');
$autoscalerDialog.find('select[name=securityGroups]').removeAttr('disabled'); $autoscalerDialog.find('select[name=securityGroups]').removeAttr('disabled');
$autoscalerDialog.find('select[name=diskOfferingId]').removeAttr('disabled'); $autoscalerDialog.find('select[name=diskOfferingId]').removeAttr('disabled');
} } else { //from an existing LB rule
else { //from an existing LB rule
$autoscalerDialog.find('select[name=serviceOfferingId]').attr('disabled', true); $autoscalerDialog.find('select[name=serviceOfferingId]').attr('disabled', true);
$autoscalerDialog.find('select[name=securityGroups]').attr('disabled', true); $autoscalerDialog.find('select[name=securityGroups]').attr('disabled', true);
$autoscalerDialog.find('select[name=diskOfferingId]').attr('disabled', true); $autoscalerDialog.find('select[name=diskOfferingId]').attr('disabled', true);
if(args.data.isAdvanced != null) { if (args.data.isAdvanced != null) {
$autoscalerDialog.find('input[type=checkbox]').trigger('click'); $autoscalerDialog.find('input[type=checkbox]').trigger('click');
$autoscalerDialog.find('input[type=checkbox]').attr('checked', 'checked'); $autoscalerDialog.find('input[type=checkbox]').attr('checked', 'checked');
} }

View File

@ -48,11 +48,12 @@
maximizeIfSelected: true, maximizeIfSelected: true,
complete: function($newPanel) { complete: function($newPanel) {
$newPanel.detailView($.extend(true, {}, $newPanel.detailView($.extend(true, {},
cloudStack.sections.dashboard.admin.zoneDetailView, cloudStack.sections.dashboard.admin.zoneDetailView, {
{
$browser: $browser, $browser: $browser,
context: $.extend(true, {}, cloudStack.context, { context: $.extend(true, {}, cloudStack.context, {
physicalResources: [{ id: item.zoneID }] physicalResources: [{
id: item.zoneID
}]
}) })
} }
)); ));
@ -73,10 +74,17 @@
// Generate pie chart // Generate pie chart
// -- values above 80 have a red color // -- values above 80 have a red color
setTimeout(function() { setTimeout(function() {
pieChart($arrayElem, [ pieChart($arrayElem, [{
{ data: [[1, 100 - arrayValue]], color: '#54697e' }, data: [
{ data: [[1, arrayValue]], color: arrayValue < 80 ? 'orange' : 'red' } [1, 100 - arrayValue]
]); ],
color: '#54697e'
}, {
data: [
[1, arrayValue]
],
color: arrayValue < 80 ? 'orange' : 'red'
}]);
}); });
} else { } else {
if ($li.attr('concat-value')) { if ($li.attr('concat-value')) {
@ -98,7 +106,9 @@
}); });
}); });
$li.attr({ title: _s(_l(item.description)) }); $li.attr({
title: _s(_l(item.description))
});
$li.fadeIn(); $li.fadeIn();
}); });
@ -106,7 +116,9 @@
$elem.each(function() { $elem.each(function() {
var $item = $(this); var $item = $(this);
if ($item.hasClass('chart-line')) { if ($item.hasClass('chart-line')) {
$item.show().animate({ width: value + '%' }); $item.show().animate({
width: value + '%'
});
} else { } else {
$item.hide().html(_s(value)).fadeIn(); $item.hide().html(_s(value)).fadeIn();
} }
@ -122,7 +134,10 @@
* Render circular pie chart, without labels * Render circular pie chart, without labels
*/ */
var pieChart = function($container, data) { var pieChart = function($container, data) {
$container.css({ width: 70, height: 66 }); $container.css({
width: 70,
height: 66
});
$.plot($container, data, { $.plot($container, data, {
width: 100, width: 100,
height: 100, height: 100,
@ -168,9 +183,7 @@
$newPanel.listView({ $newPanel.listView({
$browser: $browser, $browser: $browser,
context: cloudStack.context, context: cloudStack.context,
listView: $dashboard.hasClass('admin') ? listView: $dashboard.hasClass('admin') ? cloudStack.sections.events.sections.alerts.listView : cloudStack.sections.events.sections.events.listView // Users cannot see events
cloudStack.sections.events.sections.alerts.listView :
cloudStack.sections.events.sections.events.listView // Users cannot see events
}); });
} }
}); });

View File

@ -70,20 +70,23 @@
dialogClass: 'multi-edit-add-list panel', dialogClass: 'multi-edit-add-list panel',
width: 825, width: 825,
title: _l('label.select.vm.for.static.nat'), title: _l('label.select.vm.for.static.nat'),
buttons: [ buttons: [{
{
text: _l('label.apply'), text: _l('label.apply'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
if ($dataList.find('.tier-select select').val() == -1) { if ($dataList.find('.tier-select select').val() == -1) {
cloudStack.dialog.notice({ message: ('Please select a tier')}); cloudStack.dialog.notice({
message: ('Please select a tier')
});
return false; return false;
} }
if (!$dataList.find( if (!$dataList.find(
'input[type=radio]:checked, input[type=checkbox]:checked' 'input[type=radio]:checked, input[type=checkbox]:checked'
).size()) { ).size()) {
cloudStack.dialog.notice({ message: _l('message.select.instance')}); cloudStack.dialog.notice({
message: _l('message.select.instance')
});
return false; return false;
} }
@ -108,7 +111,9 @@
}); });
}, },
error: function(args) { error: function(args) {
cloudStack.dialog.notice({ message: args }); cloudStack.dialog.notice({
message: args
});
} }
} }
}); });
@ -119,8 +124,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
}); });
} }
}, }, {
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
@ -131,8 +135,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
}); });
} }
} }]
]
}).parent('.ui-dialog').overlay(); }).parent('.ui-dialog').overlay();
// Add tier select dialog // Add tier select dialog

View File

@ -26,8 +26,13 @@
var listView = { var listView = {
id: 'settings', id: 'settings',
fields: { fields: {
name: { label: 'label.name' }, name: {
value: { label: 'label.value', editable: true } label: 'label.name'
},
value: {
label: 'label.value',
editable: true
}
}, },
actions: { actions: {
edit: { edit: {
@ -38,7 +43,10 @@
dataProvider: dataProvider dataProvider: dataProvider
}; };
var $listView = $('<div>').listView({ context: context, listView: listView }); var $listView = $('<div>').listView({
context: context,
listView: listView
});
return $listView; return $listView;
} }

View File

@ -22,15 +22,17 @@
// Place outer args here as local variables // Place outer args here as local variables
// i.e, -- var dataProvider = args.dataProvider // i.e, -- var dataProvider = args.dataProvider
return function(args){ return function(args) {
if(args.context.multiRules == undefined) { //LB rule is not created yet if (args.context.multiRules == undefined) { //LB rule is not created yet
cloudStack.dialog.notice({ message: _l('Health Check can only be configured on a created LB rule') }); cloudStack.dialog.notice({
message: _l('Health Check can only be configured on a created LB rule')
});
return; return;
} }
var formData = args.formData; var formData = args.formData;
var forms = $.extend(true, {}, args.forms); var forms = $.extend(true, {}, args.forms);
var topFieldForm, bottomFieldForm , $topFieldForm , $bottomFieldForm; var topFieldForm, bottomFieldForm, $topFieldForm, $bottomFieldForm;
var topfields = forms.topFields; var topfields = forms.topFields;
var $healthCheckDesc = $('<div>Your load balancer will automatically perform health checks on your cloudstack instances and only route traffic to instances that pass the health check </div>').addClass('health-check-description'); var $healthCheckDesc = $('<div>Your load balancer will automatically perform health checks on your cloudstack instances and only route traffic to instances that pass the health check </div>').addClass('health-check-description');
@ -56,7 +58,7 @@
}, },
async: false, async: false,
success: function(json) { success: function(json) {
if(json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0] != undefined) { if (json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0] != undefined) {
policyObj = json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0]; policyObj = json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0];
pingpath1 = policyObj.pingpath; //API bug: API doesn't return it pingpath1 = policyObj.pingpath; //API bug: API doesn't return it
responsetimeout1 = policyObj.responsetime; responsetimeout1 = policyObj.responsetime;
@ -72,8 +74,14 @@
noDialog: true, // Don't render a dialog, just return $formContainer noDialog: true, // Don't render a dialog, just return $formContainer
form: { form: {
title: '', title: '',
fields:{ fields: {
pingpath: {label: 'Ping Path', validation: {required: false}, defaultValue: pingpath1} pingpath: {
label: 'Ping Path',
validation: {
required: false
},
defaultValue: pingpath1
}
} }
} }
}); });
@ -83,16 +91,40 @@
$healthCheckDialog.append($healthCheckAdvancedTitle); $healthCheckDialog.append($healthCheckAdvancedTitle);
bottomFieldForm = cloudStack.dialog.createForm ({ bottomFieldForm = cloudStack.dialog.createForm({
context:args.context, context: args.context,
noDialog:true, noDialog: true,
form:{ form: {
title:'', title: '',
fields:{ fields: {
responsetimeout: {label: 'Response Timeout (in sec)' , validation:{required:false}, defaultValue: responsetimeout1}, responsetimeout: {
healthinterval: {label: 'Health Check Interval (in sec)', validation:{required:false}, defaultValue: healthinterval1}, label: 'Response Timeout (in sec)',
healthythreshold: {label: 'Healthy Threshold', validation: {required:false}, defaultValue: healthythreshold1}, validation: {
unhealthythreshold: {label: 'Unhealthy Threshold' , validation: { required:false}, defaultValue: unhealthythreshold1} required: false
},
defaultValue: responsetimeout1
},
healthinterval: {
label: 'Health Check Interval (in sec)',
validation: {
required: false
},
defaultValue: healthinterval1
},
healthythreshold: {
label: 'Healthy Threshold',
validation: {
required: false
},
defaultValue: healthythreshold1
},
unhealthythreshold: {
label: 'Unhealthy Threshold',
validation: {
required: false
},
defaultValue: unhealthythreshold1
}
} }
} }
}); });
@ -101,20 +133,17 @@
$bottomFieldForm.appendTo($healthCheckDialog); $bottomFieldForm.appendTo($healthCheckDialog);
var buttons = [ var buttons = [{
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
} }
} }];
];
if(policyObj == null) { //policy is not created yet if (policyObj == null) { //policy is not created yet
buttons.push( buttons.push({
{
text: _l('Create'), text: _l('Create'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
@ -134,7 +163,7 @@
data: data, data: data,
success: function(json) { success: function(json) {
var jobId = json.createlbhealthcheckpolicyresponse.jobid; var jobId = json.createlbhealthcheckpolicyresponse.jobid;
var createLBHealthCheckPolicyIntervalId = setInterval(function(){ var createLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({ $.ajax({
url: createURL('queryAsyncJobResult'), url: createURL('queryAsyncJobResult'),
data: { data: {
@ -144,18 +173,20 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; //Job has not completed return; //Job has not completed
} } else {
else {
clearInterval(createLBHealthCheckPolicyIntervalId); clearInterval(createLBHealthCheckPolicyIntervalId);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
cloudStack.dialog.notice({ message: _l('Health Check Policy has been created') }); cloudStack.dialog.notice({
message: _l('Health Check Policy has been created')
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) { cloudStack.dialog.notice({
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) }); message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
@ -166,19 +197,19 @@
}, g_queryAsyncJobResultInterval); }, g_queryAsyncJobResultInterval);
}, },
error:function(json){ error: function(json) {
cloudStack.dialog.notice({message: _s(json.responseText)}); //Error message in the API needs to be improved cloudStack.dialog.notice({
message: _s(json.responseText)
}); //Error message in the API needs to be improved
$healthCheckDialog.dialog('close'); $healthCheckDialog.dialog('close');
$('.overlay').remove(); $('.overlay').remove();
} }
}); });
} }
} });
); } else { //policy exists already
}
else { //policy exists already
buttons.push( buttons.push(
//Update Button (begin) - call delete API first, then create API //Update Button (begin) - call delete API first, then create API
{ {
@ -190,11 +221,11 @@
$.ajax({ $.ajax({
url: createURL('deleteLBHealthCheckPolicy'), url: createURL('deleteLBHealthCheckPolicy'),
data: { data: {
id : policyObj.id id: policyObj.id
}, },
success: function(json) { success: function(json) {
var jobId = json.deletelbhealthcheckpolicyresponse.jobid; var jobId = json.deletelbhealthcheckpolicyresponse.jobid;
var deleteLBHealthCheckPolicyIntervalId = setInterval(function(){ var deleteLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({ $.ajax({
url: createURL('queryAsyncJobResult'), url: createURL('queryAsyncJobResult'),
data: { data: {
@ -204,8 +235,7 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; //Job has not completed return; //Job has not completed
} } else {
else {
clearInterval(deleteLBHealthCheckPolicyIntervalId); clearInterval(deleteLBHealthCheckPolicyIntervalId);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
@ -224,7 +254,7 @@
data: data, data: data,
success: function(json) { success: function(json) {
var jobId = json.createlbhealthcheckpolicyresponse.jobid; var jobId = json.createlbhealthcheckpolicyresponse.jobid;
var createLBHealthCheckPolicyIntervalId = setInterval(function(){ var createLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({ $.ajax({
url: createURL('queryAsyncJobResult'), url: createURL('queryAsyncJobResult'),
data: { data: {
@ -234,18 +264,20 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; //Job has not completed return; //Job has not completed
} } else {
else {
clearInterval(createLBHealthCheckPolicyIntervalId); clearInterval(createLBHealthCheckPolicyIntervalId);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
cloudStack.dialog.notice({ message: _l('Health Check Policy has been updated') }); cloudStack.dialog.notice({
message: _l('Health Check Policy has been updated')
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) { cloudStack.dialog.notice({
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) }); message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
@ -256,9 +288,10 @@
}, g_queryAsyncJobResultInterval); }, g_queryAsyncJobResultInterval);
} }
}); });
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) { cloudStack.dialog.notice({
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) }); message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
@ -283,11 +316,11 @@
$.ajax({ $.ajax({
url: createURL('deleteLBHealthCheckPolicy'), url: createURL('deleteLBHealthCheckPolicy'),
data: { data: {
id : policyObj.id id: policyObj.id
}, },
success: function(json) { success: function(json) {
var jobId = json.deletelbhealthcheckpolicyresponse.jobid; var jobId = json.deletelbhealthcheckpolicyresponse.jobid;
var deleteLBHealthCheckPolicyIntervalId = setInterval(function(){ var deleteLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({ $.ajax({
url: createURL('queryAsyncJobResult'), url: createURL('queryAsyncJobResult'),
data: { data: {
@ -297,18 +330,20 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; //Job has not completed return; //Job has not completed
} } else {
else {
clearInterval(deleteLBHealthCheckPolicyIntervalId); clearInterval(deleteLBHealthCheckPolicyIntervalId);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
cloudStack.dialog.notice({ message: _l('Health Check Policy has been deleted') }); cloudStack.dialog.notice({
message: _l('Health Check Policy has been deleted')
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) { cloudStack.dialog.notice({
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) }); message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove(); $loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy'); $healthCheckDialog.dialog('destroy');
$('.overlay').remove(); $('.overlay').remove();
@ -331,13 +366,13 @@
height: 600, height: 600,
draggable: true, draggable: true,
closeonEscape: false, closeonEscape: false,
overflow:'auto', overflow: 'auto',
open:function() { open: function() {
$("button").each(function(){ $("button").each(function() {
$(this).attr("style", "left: 400px; position: relative; margin-right: 5px; "); $(this).attr("style", "left: 400px; position: relative; margin-right: 5px; ");
}); });
$('.ui-dialog .delete').css('left','140px'); $('.ui-dialog .delete').css('left', '140px');
}, },
buttons: buttons buttons: buttons
@ -345,6 +380,4 @@
} }
} }
}(jQuery, cloudStack)); }(jQuery, cloudStack));

View File

@ -65,7 +65,9 @@
} }
$body.children().fadeOut('fast', function() { $body.children().fadeOut('fast', function() {
var $nextStep = steps[stepID]({ nextStep: options.nextStep }); var $nextStep = steps[stepID]({
nextStep: options.nextStep
});
$body.children().detach(); $body.children().detach();
$nextStep.appendTo($body).hide(); $nextStep.appendTo($body).hide();
@ -136,7 +138,9 @@
var $container = $('<div></div>').addClass(id); var $container = $('<div></div>').addClass(id);
var $form = $('<div>').addClass('setup-form'); var $form = $('<div>').addClass('setup-form');
var $save = elems.nextButton(_l('label.continue'), { type: 'submit' }); var $save = elems.nextButton(_l('label.continue'), {
type: 'submit'
});
var $prev = elems.prevButton(_l('label.back')); var $prev = elems.prevButton(_l('label.back'));
var $title = $('<div></div>').addClass('title').html(_l(title)); var $title = $('<div></div>').addClass('title').html(_l(title));
@ -236,7 +240,9 @@
nextButton: function(label, options) { nextButton: function(label, options) {
var $button = options && !options.type ? var $button = options && !options.type ?
$('<div>').addClass('button goTo').html(label) : $('<div>').addClass('button goTo').html(label) :
$('<input>').attr({ type: 'submit' }).addClass('button goTo').val(label); $('<input>').attr({
type: 'submit'
}).addClass('button goTo').val(label);
return $button; return $button;
}, },
@ -350,7 +356,9 @@
type: 'password', type: 'password',
name: 'password-confirm' name: 'password-confirm'
}); });
var $save = elems.nextButton(_l('label.save.and.continue'), { type: 'submit' }); var $save = elems.nextButton(_l('label.save.and.continue'), {
type: 'submit'
});
$form.append( $form.append(
$('<div></div>').addClass('title').html(_l('message.change.password')), $('<div></div>').addClass('title').html(_l('message.change.password')),
@ -423,11 +431,30 @@
prevStepID: 'addZoneIntro', prevStepID: 'addZoneIntro',
nextStepID: 'addPodIntro', nextStepID: 'addPodIntro',
form: { form: {
name: { label: 'label.name', validation: { required: true } }, name: {
ip4dns1: { label: 'label.dns.1', validation: { required: true } }, label: 'label.name',
ip4dns2: { label: 'label.dns.2' }, validation: {
internaldns1: { label: 'label.internal.dns.1', validation: { required: true } }, required: true
internaldns2: { label: 'label.internal.dns.2' } }
},
ip4dns1: {
label: 'label.dns.1',
validation: {
required: true
}
},
ip4dns2: {
label: 'label.dns.2'
},
internaldns1: {
label: 'label.internal.dns.1',
validation: {
required: true
}
},
internaldns2: {
label: 'label.internal.dns.2'
}
} }
}), }),
@ -457,13 +484,30 @@
prevStepID: 'addPodIntro', prevStepID: 'addPodIntro',
nextStepID: 'configureGuestTraffic', nextStepID: 'configureGuestTraffic',
form: { form: {
name: { label: 'label.name', validation: { required: true }}, name: {
reservedSystemGateway: { label: 'label.gateway', validation: { required: true }}, label: 'label.name',
reservedSystemNetmask: { label: 'label.netmask', validation: { required: true }}, validation: {
required: true
}
},
reservedSystemGateway: {
label: 'label.gateway',
validation: {
required: true
}
},
reservedSystemNetmask: {
label: 'label.netmask',
validation: {
required: true
}
},
ipRange: { ipRange: {
label: 'label.ip.range', label: 'label.ip.range',
range: ['reservedSystemStartIp', 'reservedSystemEndIp'], range: ['reservedSystemStartIp', 'reservedSystemEndIp'],
validation: { required: true } validation: {
required: true
}
} }
} }
}), }),
@ -480,9 +524,25 @@
prevStepID: 'addPod', prevStepID: 'addPod',
nextStepID: 'addClusterIntro', nextStepID: 'addClusterIntro',
form: { form: {
guestGateway: { label: 'label.gateway', validation: { required: true } }, guestGateway: {
guestNetmask: { label: 'label.netmask', validation: { required: true } }, label: 'label.gateway',
guestIPRange: { label: 'label.ip.range', range: ['guestStartIp', 'guestEndIp'], validation: { required: true } } validation: {
required: true
}
},
guestNetmask: {
label: 'label.netmask',
validation: {
required: true
}
},
guestIPRange: {
label: 'label.ip.range',
range: ['guestStartIp', 'guestEndIp'],
validation: {
required: true
}
}
} }
}), }),
@ -515,13 +575,23 @@
hypervisor: { hypervisor: {
label: 'label.hypervisor', label: 'label.hypervisor',
select: function(args) { select: function(args) {
args.response.success({ data: [ args.response.success({
{ id: 'XenServer', description: 'XenServer' }, data: [{
{ id: 'KVM', description: 'KVM'} id: 'XenServer',
]}); description: 'XenServer'
}, {
id: 'KVM',
description: 'KVM'
}]
});
} }
}, },
name: { label: 'label.name', validation: { required: true }} name: {
label: 'label.name',
validation: {
required: true
}
}
} }
}), }),
@ -553,17 +623,23 @@
form: { form: {
hostname: { hostname: {
label: 'label.host.name', label: 'label.host.name',
validation: { required: true } validation: {
required: true
}
}, },
username: { username: {
label: 'label.username', label: 'label.username',
validation: { required: true } validation: {
required: true
}
}, },
password: { password: {
label: 'label.password', label: 'label.password',
validation: { required: true }, validation: {
required: true
},
isPassword: true isPassword: true
} }
} }
@ -597,29 +673,40 @@
form: { form: {
name: { name: {
label: 'label.name', label: 'label.name',
validation: { required: true } validation: {
required: true
}
}, },
protocol: { protocol: {
label: 'label.protocol', label: 'label.protocol',
select: function(args) { select: function(args) {
args.response.success({ args.response.success({
data: { id: 'nfs', description: 'NFS' } data: {
id: 'nfs',
description: 'NFS'
}
}); });
} }
}, },
scope:{ scope: {
label:'label.scope', label: 'label.scope',
select:function(args){ select: function(args) {
var scopeData=[]; var scopeData = [];
//intelligence to handle different hypervisors to be added here //intelligence to handle different hypervisors to be added here
/* if( selectedHypervisor == 'XenServer'){ /* if( selectedHypervisor == 'XenServer'){
scopeData.push({ id: 'cluster', description: _l('label.cluster') }); scopeData.push({ id: 'cluster', description: _l('label.cluster') });
}*/ }*/
// else if (selectedHypervisor == 'KVM'){ // else if (selectedHypervisor == 'KVM'){
scopeData.push({ id: 'cluster', description: _l('label.cluster') }); scopeData.push({
scopeData.push({ id: 'zone', description: _l('label.zone.wide') }); id: 'cluster',
description: _l('label.cluster')
});
scopeData.push({
id: 'zone',
description: _l('label.zone.wide')
});
args.response.success({ args.response.success({
@ -630,12 +717,16 @@
server: { server: {
label: 'label.server', label: 'label.server',
validation: { required: true } validation: {
required: true
}
}, },
path: { path: {
label: 'label.path', label: 'label.path',
validation: { required: true } validation: {
required: true
}
} }
} }
}), }),
@ -668,11 +759,15 @@
form: { form: {
nfsServer: { nfsServer: {
label: 'label.nfs.server', label: 'label.nfs.server',
validation: { required: true } validation: {
required: true
}
}, },
path: { path: {
label: 'label.path', label: 'label.path',
validation: { required: true } validation: {
required: true
}
} }
} }
}), }),
@ -765,8 +860,7 @@
$subtitle.append( $subtitle.append(
$('<p>').html( $('<p>').html(
_l('error.installWizard.message') + ':<br/>' _l('error.installWizard.message') + ':<br/>' + message
+ message
), ),
$('<div>').addClass('button').append( $('<div>').addClass('button').append(
$('<span>').html(_l('label.back')) $('<span>').html(_l('label.back'))

View File

@ -35,7 +35,9 @@
// Close instance wizard // Close instance wizard
var close = function() { var close = function() {
$wizard.dialog('destroy'); $wizard.dialog('destroy');
$('div.overlay').fadeOut(function() { $('div.overlay').remove(); }); $('div.overlay').fadeOut(function() {
$('div.overlay').remove();
});
}; };
// Save instance and close wizard // Save instance and close wizard
@ -53,23 +55,23 @@
if ($listView.size()) { if ($listView.size()) {
var $loading = $('.list-view.instances').listView('prependItem', { var $loading = $('.list-view.instances').listView('prependItem', {
data: [ data: [{
{
name: data.displayname ? data.displayname : _l('label.new.vm'), name: data.displayname ? data.displayname : _l('label.new.vm'),
zonename: $wizard.find('select[name=zoneid] option').filter(function() { zonename: $wizard.find('select[name=zoneid] option').filter(function() {
return $(this).val() == data.zoneid; return $(this).val() == data.zoneid;
}).html(), }).html(),
state: 'Creating' state: 'Creating'
}],
actionFilter: function(args) {
return [];
} }
],
actionFilter: function(args) { return []; }
}); });
} }
listViewArgs.complete({ listViewArgs.complete({
_custom: args._custom, _custom: args._custom,
messageArgs: cloudStack.serializeForm($form), messageArgs: cloudStack.serializeForm($form),
$item: $listView.size()? $loading : $('<div>') $item: $listView.size() ? $loading : $('<div>')
}); });
close(); close();
@ -79,7 +81,9 @@
$('div.overlay').remove(); $('div.overlay').remove();
if (message) { if (message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
} }
} }
} }
@ -152,7 +156,7 @@
) )
.data('json-obj', this); .data('json-obj', this);
if(selectedObj != null && selectedObj.id == item.id) { if (selectedObj != null && selectedObj.id == item.id) {
$select.find('input[type=checkbox]').attr('checked', 'checked'); $select.find('input[type=checkbox]').attr('checked', 'checked');
} }
@ -320,7 +324,9 @@
$select.addClass('selected').append( $select.addClass('selected').append(
$('<div>').addClass('hypervisor') $('<div>').addClass('hypervisor')
.append($('<label>').html('Hypervisor:')) .append($('<label>').html('Hypervisor:'))
.append($('<select>').attr({ name: 'hypervisorid' })) .append($('<select>').attr({
name: 'hypervisorid'
}))
); );
// Get hypervisor data // Get hypervisor data
@ -502,13 +508,11 @@
$step.find('.select-container').append( $step.find('.select-container').append(
makeSelects( makeSelects(
'affinity-groups', 'affinity-groups',
args.data.affinityGroups, args.data.affinityGroups, {
{
name: 'name', name: 'name',
desc: 'description', desc: 'description',
id: 'id' id: 'id'
}, }, {
{
type: 'checkbox', type: 'checkbox',
'wizard-field': 'affinity-groups' 'wizard-field': 'affinity-groups'
}, },
@ -777,7 +781,7 @@
var conditionalFieldFrom = $(this).attr('conditional-field'); var conditionalFieldFrom = $(this).attr('conditional-field');
if (conditionalFieldFrom) { if (conditionalFieldFrom) {
if ($wizard.find('.'+conditionalFieldFrom).css('display') == 'block') { if ($wizard.find('.' + conditionalFieldFrom).css('display') == 'block') {
$(this).closest('div.select').show(); $(this).closest('div.select').show();
} else { } else {
$(this).closest('div.select').hide(); $(this).closest('div.select').hide();
@ -817,8 +821,7 @@
) )
); );
if (!$targetStep.hasClass('repeat') && if (!$targetStep.hasClass('repeat') && !$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
!$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
} }
// Show launch vm button if last step // Show launch vm button if last step
@ -863,14 +866,15 @@
// Next button // Next button
if ($target.closest('div.button.next').size()) { if ($target.closest('div.button.next').size()) {
// Make sure ISO or template is selected // Make sure ISO or template is selected
if ($activeStep.hasClass('select-iso') && if ($activeStep.hasClass('select-iso') && !$activeStep.find('.content:visible input:checked').size()) {
!$activeStep.find('.content:visible input:checked').size()) { cloudStack.dialog.notice({
cloudStack.dialog.notice({ message: 'message.step.1.continue' }); message: 'message.step.1.continue'
});
return false; return false;
} }
//step 5 - select network //step 5 - select network
if($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) { if ($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) {
var data = $activeStep.data('my-networks'); var data = $activeStep.data('my-networks');
if (!data) { if (!data) {
@ -879,8 +883,10 @@
)['my-networks']); )['my-networks']);
} }
if($activeStep.find('input[type=checkbox]:checked').size() == 0) { //if no checkbox is checked if ($activeStep.find('input[type=checkbox]:checked').size() == 0) { //if no checkbox is checked
cloudStack.dialog.notice({ message: 'message.step.4.continue' }); cloudStack.dialog.notice({
message: 'message.step.4.continue'
});
return false; return false;
} }
@ -891,10 +897,11 @@
if (advSGFilter == 0) { //when total number of selected sg networks is 0, then 'Select Security Group' is skipped, go to step 6 directly if (advSGFilter == 0) { //when total number of selected sg networks is 0, then 'Select Security Group' is skipped, go to step 6 directly
showStep(6); showStep(6);
} } else { //when total number of selected sg networks > 0
else { //when total number of selected sg networks > 0 if ($activeStep.find('input[type=checkbox]:checked').size() > 1) { //when total number of selected networks > 1
if($activeStep.find('input[type=checkbox]:checked').size() > 1) { //when total number of selected networks > 1 cloudStack.dialog.notice({
cloudStack.dialog.notice({ message: "Can't create a vm with multiple networks one of which is Security Group enabled" }); message: "Can't create a vm with multiple networks one of which is Security Group enabled"
});
return false; return false;
} }
} }
@ -903,10 +910,10 @@
//step 6 - review (spcifiy displyname, group as well) //step 6 - review (spcifiy displyname, group as well)
if ($activeStep.hasClass('review')) { if ($activeStep.hasClass('review')) {
if($activeStep.find('input[name=displayname]').size() > 0 && $activeStep.find('input[name=displayname]').val().length > 0) { if ($activeStep.find('input[name=displayname]').size() > 0 && $activeStep.find('input[name=displayname]').val().length > 0) {
//validate //validate
var b = cloudStack.validate.vmHostName($activeStep.find('input[name=displayname]').val()); var b = cloudStack.validate.vmHostName($activeStep.find('input[name=displayname]').val());
if(b == false) if (b == false)
return false; return false;
} }
} }
@ -1002,7 +1009,7 @@
} }
}); });
$wizard.find('div.data-disk-offering div.custom-size input[type=text]').bind('change',function() { $wizard.find('div.data-disk-offering div.custom-size input[type=text]').bind('change', function() {
var old = $wizard.find('div.data-disk-offering div.custom-size input[type=text]').val(); var old = $wizard.find('div.data-disk-offering div.custom-size input[type=text]').val();
$wizard.find('div.data-disk-offering span.custom-disk-size').html(_s(old)); $wizard.find('div.data-disk-offering span.custom-disk-size').html(_s(old));
}); });

View File

@ -110,13 +110,12 @@
} }
}); });
if(includingFirewall == true) { if (includingFirewall == true) {
$chart.find('li.firewall .view-details').click(function() { $chart.find('li.firewall .view-details').click(function() {
//makeMultiEditPanel($(this), { title: _l('label.nat.port.range')}); //makeMultiEditPanel($(this), { title: _l('label.nat.port.range')});
makeMultiEditPanel($(this)); makeMultiEditPanel($(this));
}); });
} } else {
else {
$chart.find('li.firewall').hide(); $chart.find('li.firewall').hide();
} }
@ -133,15 +132,13 @@
// 1. choose between staticNAT chart and non-staticNAT chart 2. filter disabled tabs // 1. choose between staticNAT chart and non-staticNAT chart 2. filter disabled tabs
if (preFilter.length) { if (preFilter.length) {
if($.inArray('nonStaticNATChart', preFilter) != -1) { //choose static NAT chart if ($.inArray('nonStaticNATChart', preFilter) != -1) { //choose static NAT chart
if($.inArray('firewall', preFilter) == -1) { if ($.inArray('firewall', preFilter) == -1) {
return staticNATChart(args, true); //static NAT including Firewall return staticNATChart(args, true); //static NAT including Firewall
} } else {
else {
return staticNATChart(args, false); //static NAT excluding Firewall return staticNATChart(args, false); //static NAT excluding Firewall
} }
} } else { //choose non-static NAT chart
else { //choose non-static NAT chart
$(preFilter).each(function() { $(preFilter).each(function() {
var id = this; var id = this;

View File

@ -110,7 +110,9 @@
}); });
}, },
error: function(args) { error: function(args) {
cloudStack.dialog.notice({ message: args }); cloudStack.dialog.notice({
message: args
});
} }
} }
}); });
@ -121,7 +123,7 @@
// Select language // Select language
var $languageSelect = $login.find('select[name=language]'); var $languageSelect = $login.find('select[name=language]');
$languageSelect.change(function() { $languageSelect.change(function() {
if($(this).val() != '') //language dropdown is not blank if ($(this).val() != '') //language dropdown is not blank
$.cookie('lang', $(this).val()); //the selected option in language dropdown will be used (instead of browser's default language) $.cookie('lang', $(this).val()); //the selected option in language dropdown will be used (instead of browser's default language)
else //language dropdown is blank else //language dropdown is blank
$.cookie('lang', null); //null $.cookie('lang'), so browser's default language will be used. $.cookie('lang', null); //null $.cookie('lang'), so browser's default language will be used.

View File

@ -21,7 +21,9 @@
var listViewArgs = $.isFunction(target) ? target() : target; var listViewArgs = $.isFunction(target) ? target() : target;
return $('<div>').listView( return $('<div>').listView(
(listViewArgs.listView || listViewArgs.sections) ? listViewArgs : { listView: listViewArgs } (listViewArgs.listView || listViewArgs.sections) ? listViewArgs : {
listView: listViewArgs
}
); );
}; };
var $dashboard = $('#template').find('.system-dashboard-view').clone(); var $dashboard = $('#template').find('.system-dashboard-view').clone();
@ -71,9 +73,17 @@
title: 'label.update.ssl', title: 'label.update.ssl',
desc: 'message.update.ssl', desc: 'message.update.ssl',
fields: { fields: {
certificate: { label: 'label.certificate', isTextarea: true }, certificate: {
privatekey: { label: 'label.privatekey', isTextarea: true }, label: 'label.certificate',
domainsuffix: { label: 'label.domain.suffix' } isTextarea: true
},
privatekey: {
label: 'label.privatekey',
isTextarea: true
},
domainsuffix: {
label: 'label.domain.suffix'
}
} }
}, },
after: function(args) { after: function(args) {
@ -98,27 +108,33 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; //Job has not completed return; //Job has not completed
} } else {
else {
clearInterval(uploadCustomCertificateIntervalID); clearInterval(uploadCustomCertificateIntervalID);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
cloudStack.dialog.notice({ message: 'Update SSL Certiciate succeeded' }); cloudStack.dialog.notice({
} message: 'Update SSL Certiciate succeeded'
else if (result.jobstatus == 2) { });
cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + _s(result.jobresult.errortext) }); } else if (result.jobstatus == 2) {
cloudStack.dialog.notice({
message: 'Failed to update SSL Certificate. ' + _s(result.jobresult.errortext)
});
} }
$loading.remove(); $loading.remove();
} }
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + parseXMLHttpResponse(XMLHttpResponse) }); cloudStack.dialog.notice({
message: 'Failed to update SSL Certificate. ' + parseXMLHttpResponse(XMLHttpResponse)
});
$loading.remove(); $loading.remove();
} }
}); });
}, g_queryAsyncJobResultInterval); }, g_queryAsyncJobResultInterval);
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + parseXMLHttpResponse(XMLHttpResponse) }); cloudStack.dialog.notice({
message: 'Failed to update SSL Certificate. ' + parseXMLHttpResponse(XMLHttpResponse)
});
$loading.remove(); $loading.remove();
} }
}); });

View File

@ -25,7 +25,9 @@
var $title = $('<span>').addClass('title').html(title); var $title = $('<span>').addClass('title').html(title);
var $desc = $('<span>').addClass('desc').html(desc); var $desc = $('<span>').addClass('desc').html(desc);
var $icon = $('<span>').addClass('icon').append( var $icon = $('<span>').addClass('icon').append(
$('<img>').attr({ src: iconURL }) $('<img>').attr({
src: iconURL
})
); );
$pluginItem.append( $pluginItem.append(
@ -59,25 +61,33 @@
tabs: { tabs: {
details: { details: {
title: 'label.plugin.details', title: 'label.plugin.details',
fields: [ fields: [{
{ name: {
name: { label: 'label.name' } label: 'label.name'
}
}, {
desc: {
label: 'label.description'
}, },
{
desc: { label: 'label.description' },
externalLink: { externalLink: {
isExternalLink: true, isExternalLink: true,
label: 'label.external.link' label: 'label.external.link'
} }
}, {
authorName: {
label: 'label.author.name'
}, },
{ authorEmail: {
authorName: { label: 'label.author.name' }, label: 'label.author.email'
authorEmail: { label: 'label.author.email' }, },
id: { label: 'label.id' } id: {
label: 'label.id'
} }
], }],
dataProvider: function(args) { dataProvider: function(args) {
args.response.success({ data: plugin }); args.response.success({
data: plugin
});
} }
} }
} }
@ -102,7 +112,9 @@
plugins: $(plugins).map(function(index, pluginID) { plugins: $(plugins).map(function(index, pluginID) {
var plugin = cloudStack.plugins[pluginID].config; var plugin = cloudStack.plugins[pluginID].config;
return $.extend(plugin, { id: pluginID }); return $.extend(plugin, {
id: pluginID
});
}) })
}); });
}; };

View File

@ -54,7 +54,9 @@
id: projectID id: projectID
}]; }];
cloudStack.uiCustom.projects({ alreadySelected: true }); cloudStack.uiCustom.projects({
alreadySelected: true
});
} else { } else {
cloudStack.context.projects = null; cloudStack.context.projects = null;
$('#cloudStack3-container').removeClass('project-view'); $('#cloudStack3-container').removeClass('project-view');
@ -63,4 +65,3 @@
}); });
}); });
}(jQuery, cloudStack)); }(jQuery, cloudStack));

View File

@ -109,7 +109,9 @@
$arrayElem.html(_s(arrayValue)); $arrayElem.html(_s(arrayValue));
}); });
$li.attr({ title: item.description }); $li.attr({
title: item.description
});
$li.fadeIn(); $li.fadeIn();
}); });
@ -117,7 +119,9 @@
$elem.each(function() { $elem.each(function() {
var $item = $(this); var $item = $(this);
if ($item.hasClass('chart-line')) { if ($item.hasClass('chart-line')) {
$item.show().animate({ width: value + '%' }); $item.show().animate({
width: value + '%'
});
} else { } else {
$item.hide().html(_s(value)).fadeIn(); $item.hide().html(_s(value)).fadeIn();
} }
@ -249,12 +253,16 @@
var $tab = $('<li>').appendTo($tabs.find('ul:first')); var $tab = $('<li>').appendTo($tabs.find('ul:first'));
var $tabContent = tab(); var $tabContent = tab();
var $tabLink = $('<a>') var $tabLink = $('<a>')
.attr({ href: '#project-view-dashboard-' + tabName }) .attr({
href: '#project-view-dashboard-' + tabName
})
.html($tabContent.data('tab-title')) .html($tabContent.data('tab-title'))
.appendTo($tab); .appendTo($tab);
var $content = $('<div>') var $content = $('<div>')
.appendTo($tabs) .appendTo($tabs)
.attr({ id: 'project-view-dashboard-' + tabName }) .attr({
id: 'project-view-dashboard-' + tabName
})
.append($tabContent); .append($tabContent);
}); });
@ -316,7 +324,9 @@
name: 'project-display-text', name: 'project-display-text',
id: 'project-desc' id: 'project-desc'
})); }));
var $submit = $('<input>').attr({ type: 'submit' }).val(_l('label.create.project')); var $submit = $('<input>').attr({
type: 'submit'
}).val(_l('label.create.project'));
var $cancel = $('<div>').addClass('button cancel').html(_l('label.cancel')); var $cancel = $('<div>').addClass('button cancel').html(_l('label.cancel'));
var $loading = $('<div>').addClass('loading-overlay'); var $loading = $('<div>').addClass('loading-overlay');
@ -407,7 +417,9 @@
.append( .append(
// Users tab // Users tab
$('<li>').addClass('first').append( $('<li>').addClass('first').append(
$('<a>').attr({ href: '#new-project-review-tabs-users'}).html( $('<a>').attr({
href: '#new-project-review-tabs-users'
}).html(
cloudStack.projects.requireInvitation() ? cloudStack.projects.requireInvitation() ?
_l('label.invitations') : _l('label.accounts') _l('label.invitations') : _l('label.accounts')
) )
@ -418,18 +430,24 @@
$ul.append( $ul.append(
// Resources tab // Resources tab
$('<li>').addClass('last').append( $('<li>').addClass('last').append(
$('<a>').attr({ href: '#new-project-review-tabs-resouces'}).html(_l('label.resources')) $('<a>').attr({
href: '#new-project-review-tabs-resouces'
}).html(_l('label.resources'))
) )
); );
} }
var $users = $('<div>').attr({ id: 'new-project-review-tabs-users' }).appendTo($tabs); var $users = $('<div>').attr({
id: 'new-project-review-tabs-users'
}).appendTo($tabs);
cloudStack.context.projects = [project]; cloudStack.context.projects = [project];
var $resources; var $resources;
if (isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
$resouces = $('<div>') $resouces = $('<div>')
.attr({ id: 'new-project-review-tabs-resouces' }) .attr({
id: 'new-project-review-tabs-resouces'
})
.appendTo($tabs) .appendTo($tabs)
.append(pageElems.dashboardTabs.resources); .append(pageElems.dashboardTabs.resources);
} }
@ -441,9 +459,13 @@
id: 'project-accounts', id: 'project-accounts',
disableInfiniteScrolling: true, disableInfiniteScrolling: true,
fields: !cloudStack.projects.requireInvitation() ? { fields: !cloudStack.projects.requireInvitation() ? {
username: { label: _l('label.account') } username: {
label: _l('label.account')
}
} : { } : {
account: { label: _l('label.invited.accounts') } account: {
label: _l('label.invited.accounts')
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
setTimeout(function() { setTimeout(function() {
@ -542,8 +564,12 @@
var $search = $('<div>').appendTo($toolbar).addClass('search') var $search = $('<div>').appendTo($toolbar).addClass('search')
.append( .append(
$searchForm $searchForm
.append($('<input>').attr({ type: 'text' })) .append($('<input>').attr({
.append($('<input>').attr({ type: 'submit' }).val('')) type: 'text'
}))
.append($('<input>').attr({
type: 'submit'
}).val(''))
); );
var $projectSelect = args.$projectSelect; var $projectSelect = args.$projectSelect;
var $cancel = $('<div>').addClass('button cancel').html(_l('label.cancel')); var $cancel = $('<div>').addClass('button cancel').html(_l('label.cancel'));
@ -610,9 +636,7 @@
loadData(function() { loadData(function() {
if (!$list.find('li').size()) { if (!$list.find('li').size()) {
cloudStack.dialog.notice({ cloudStack.dialog.notice({
message: isAdmin() || isDomainAdmin() || g_userProjectsEnabled ? message: isAdmin() || isDomainAdmin() || g_userProjectsEnabled ? _l('message.no.projects') : _l('message.no.projects.adminOnly')
_l('message.no.projects') :
_l('message.no.projects.adminOnly')
}).closest('.ui-dialog'); }).closest('.ui-dialog');
$.merge($selector, $('.overlay')).remove(); $.merge($selector, $('.overlay')).remove();
$('.select.default-view').click(); $('.select.default-view').click();
@ -620,7 +644,7 @@
$selector.dialog({ $selector.dialog({
title: _l('label.select.project'), title: _l('label.select.project'),
dialogClass: 'project-selector-dialog', dialogClass: 'project-selector-dialog',
closeOnEscape: false , closeOnEscape: false,
width: 420 width: 420
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
} }
@ -692,10 +716,10 @@
var $projectSwitcher = $('div.project-switcher'); var $projectSwitcher = $('div.project-switcher');
var contextProjectId = cloudStack.context.projects ? cloudStack.context.projects[0].id : -1; var contextProjectId = cloudStack.context.projects ? cloudStack.context.projects[0].id : -1;
$projectSwitcher.find('option[value="'+projectId+'"]').remove(); $projectSwitcher.find('option[value="' + projectId + '"]').remove();
//return to default view if current project is deleted //return to default view if current project is deleted
if(contextProjectId == projectId) { if (contextProjectId == projectId) {
$projectSwitcher.find('select').trigger('change'); $projectSwitcher.find('select').trigger('change');
} }
return false; return false;
@ -764,6 +788,8 @@
$(window).bind('cloudStack.deleteProject', function(event, args) { $(window).bind('cloudStack.deleteProject', function(event, args) {
deleteProject({id: args.data.id}); deleteProject({
id: args.data.id
});
}); });
})(cloudStack, jQuery); })(cloudStack, jQuery);

View File

@ -117,8 +117,11 @@
return $(this).index() == index; return $(this).index() == index;
}); });
if ($tr.size() && $tr.hasClass('active')) { $(this).addClass('disabled ui-state-disabled'); } if ($tr.size() && $tr.hasClass('active')) {
else { $(this).removeClass('disabled ui-state-disabled'); } $(this).addClass('disabled ui-state-disabled');
} else {
$(this).removeClass('disabled ui-state-disabled');
}
if ($(this).is('.ui-tabs-selected.ui-state-disabled')) { if ($(this).is('.ui-tabs-selected.ui-state-disabled')) {
$snapshots.find('form').show(); $snapshots.find('form').show();
@ -189,10 +192,9 @@
var $dialog = $snapshots.dialog({ var $dialog = $snapshots.dialog({
title: _l('label.action.recurring.snapshot'), title: _l('label.action.recurring.snapshot'),
dialogClass: 'recurring-snapshots', dialogClass: 'recurring-snapshots',
closeOnEscape:false, closeOnEscape: false,
width: 600, width: 600,
buttons: [ buttons: [{
{
text: _l('label.done'), text: _l('label.done'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
@ -204,8 +206,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
}); });
} }
} }]
]
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
return $dialog; return $dialog;

View File

@ -40,7 +40,7 @@
region.endpoint == "http://localhost:8080/client/" region.endpoint == "http://localhost:8080/client/"
document.location.href == "http://localhost:8080/client/#" document.location.href == "http://localhost:8080/client/#"
*/ */
if(document.location.href.indexOf(region.endpoint) != -1) { if (document.location.href.indexOf(region.endpoint) != -1) {
currentRegion = region; currentRegion = region;
$li.addClass('active'); $li.addClass('active');
} }
@ -48,10 +48,9 @@
$regionList.append($li); $regionList.append($li);
}); });
if(currentRegion != null) { if (currentRegion != null) {
$regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name)); $regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name));
} } else {
else {
$regionSwitcherButton.find('.title').html('').attr('title', ''); $regionSwitcherButton.find('.title').html('').attr('title', '');
} }
} }
@ -82,7 +81,9 @@
var closeRegionSelector = function(args) { var closeRegionSelector = function(args) {
$regionSwitcherButton.removeClass('active'); $regionSwitcherButton.removeClass('active');
$regionSelector.fadeOut(args ? args.complete : null); $regionSelector.fadeOut(args ? args.complete : null);
$('body > .overlay').fadeOut(function() { $('body > .overlay').remove() }); $('body > .overlay').fadeOut(function() {
$('body > .overlay').remove()
});
}; };
var switchRegion = function(url) { var switchRegion = function(url) {
@ -115,7 +116,9 @@
closeRegionSelector(); closeRegionSelector();
} else { } else {
$regionSwitcherButton.addClass('active'); $regionSwitcherButton.addClass('active');
$regionSelector.fadeIn('fast').overlay({ closeAction: closeRegionSelector }); $regionSelector.fadeIn('fast').overlay({
closeAction: closeRegionSelector
});
} }
}); });
@ -127,4 +130,3 @@
refreshRegions(); refreshRegions();
}); });
}(jQuery, cloudStack)); }(jQuery, cloudStack));

View File

@ -21,7 +21,9 @@
var validate = function($uploadVolume) { var validate = function($uploadVolume) {
if (!$uploadVolume.find('input[type=text]').val()) { if (!$uploadVolume.find('input[type=text]').val()) {
cloudStack.dialog.notice({ message: _l('message.specify.url')}); cloudStack.dialog.notice({
message: _l('message.specify.url')
});
return false; return false;
} }
@ -29,7 +31,9 @@
if (!$uploadVolume.find( if (!$uploadVolume.find(
'input[type=radio]:checked, input[type=checkbox]:checked' 'input[type=radio]:checked, input[type=checkbox]:checked'
).size()) { ).size()) {
cloudStack.dialog.notice({ message: _l('message.select.instance')}); cloudStack.dialog.notice({
message: _l('message.select.instance')
});
return false; return false;
} }
@ -105,15 +109,16 @@
topFields, topFields,
$('<div>').addClass('desc').html(_l('label.select.instance.to.attach.volume.to') + ':'), $('<div>').addClass('desc').html(_l('label.select.instance.to.attach.volume.to') + ':'),
$('<div>').addClass('listView-container').append( $('<div>').addClass('listView-container').append(
vmList({ listView: listView }) vmList({
listView: listView
})
) )
); );
$uploadVolume.dialog({ $uploadVolume.dialog({
dialogClass: 'multi-edit-add-list panel', dialogClass: 'multi-edit-add-list panel',
width: 900, width: 900,
title: _l('label.upload.volume'), title: _l('label.upload.volume'),
buttons: [ buttons: [{
{
text: _l('label.upload'), text: _l('label.upload'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
@ -146,13 +151,14 @@
}, },
error: function(args) { error: function(args) {
$loading.remove(); $loading.remove();
cloudStack.dialog.notice({ message: args }); cloudStack.dialog.notice({
message: args
});
} }
} }
}); });
} }
}, }, {
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
@ -163,8 +169,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
}); });
} }
} }]
]
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
}; };
}; };

View File

@ -107,8 +107,9 @@
return detailView; return detailView;
} }
} }
}), }), {
{ context: acl.context } context: acl.context
}
); );
} }
}); });
@ -120,20 +121,26 @@
maximizeIfSelected: true, maximizeIfSelected: true,
complete: function($panel) { complete: function($panel) {
//ipAddresses.listView is a function //ipAddresses.listView is a function
$panel.listView(ipAddresses.listView(), {context: ipAddresses.context}); $panel.listView(ipAddresses.listView(), {
context: ipAddresses.context
});
} }
}); });
break; break;
case 'gateways': case 'gateways':
//siteToSiteVPN is an object //siteToSiteVPN is an object
var addAction = gateways.add; var addAction = gateways.add;
var isGatewayPresent = addAction.preCheck({ context: gateways.context }); var isGatewayPresent = addAction.preCheck({
context: gateways.context
});
var showGatewayListView = function() { var showGatewayListView = function() {
$browser.cloudBrowser('addPanel', { $browser.cloudBrowser('addPanel', {
title: _l('label.private.Gateway'), title: _l('label.private.Gateway'),
maximizeIfSelected: true, maximizeIfSelected: true,
complete: function($panel) { complete: function($panel) {
$panel.listView(gateways.listView(), { context: gateways.context }); $panel.listView(gateways.listView(), {
context: gateways.context
});
} }
}); });
}; };
@ -147,12 +154,14 @@
after: function(args) { after: function(args) {
var data = args.data; var data = args.data;
var error = function(message) { var error = function(message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
}; };
addAction.action({ addAction.action({
data: data, data: data,
$form:args.$form, $form: args.$form,
context: gateways.context, context: gateways.context,
response: { response: {
success: function(args) { success: function(args) {
@ -191,13 +200,17 @@
case 'site-to-site-vpn': case 'site-to-site-vpn':
//siteToSiteVPN is an object //siteToSiteVPN is an object
var addAction = siteToSiteVPN.add; var addAction = siteToSiteVPN.add;
var isVPNPresent = addAction.preCheck({ context: siteToSiteVPN.context }); var isVPNPresent = addAction.preCheck({
context: siteToSiteVPN.context
});
var showVPNListView = function() { var showVPNListView = function() {
$browser.cloudBrowser('addPanel', { $browser.cloudBrowser('addPanel', {
title: _l('label.site.to.site.VPN'), title: _l('label.site.to.site.VPN'),
maximizeIfSelected: true, maximizeIfSelected: true,
complete: function($panel) { complete: function($panel) {
$panel.listView(siteToSiteVPN, {context: siteToSiteVPN.context}); $panel.listView(siteToSiteVPN, {
context: siteToSiteVPN.context
});
} }
}); });
}; };
@ -209,7 +222,9 @@
message: 'Please confirm that you want to add a Site-to-Site VPN gateway.', message: 'Please confirm that you want to add a Site-to-Site VPN gateway.',
action: function() { action: function() {
var error = function(message) { var error = function(message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
}; };
addAction.action({ addAction.action({
@ -299,7 +314,9 @@
}); });
// Make sure tooltip is center aligned with icon // Make sure tooltip is center aligned with icon
$tooltip.css({ left: $configIcon.position().left }); $tooltip.css({
left: $configIcon.position().left
});
$tooltip.appendTo($config).hide(); $tooltip.appendTo($config).hide();
$tooltip.stop().fadeIn('fast'); $tooltip.stop().fadeIn('fast');
}); });
@ -416,7 +433,7 @@
$title.attr('title', name); $title.attr('title', name);
$cidr.html(cidr); $cidr.html(cidr);
$vmCount.append( $vmCount.append(
$('<span>').addClass('total').html(virtualMachines != null? virtualMachines.length: 0), $('<span>').addClass('total').html(virtualMachines != null ? virtualMachines.length : 0),
_l('label.vms') _l('label.vms')
); );
$tier.append($actions); $tier.append($actions);
@ -493,9 +510,9 @@
var $router; var $router;
$router = elems.router({ $router = elems.router({
$browser:$browser, $browser: $browser,
detailView:$.extend(true, {}, args.routerDetailView(), { detailView: $.extend(true, {}, args.routerDetailView(), {
context:context context: context
}) })
}); });
@ -508,52 +525,60 @@
) )
.append( .append(
elems.vpcConfigureArea({ elems.vpcConfigureArea({
context:context, context: context,
$browser:$browser, $browser: $browser,
$chart:$chart, $chart: $chart,
ipAddresses:$.extend(ipAddresses, {context:context}), ipAddresses: $.extend(ipAddresses, {
gateways:$.extend(gateways, {context:context}), context: context
siteToSiteVPN:$.extend(siteToSiteVPN, {context:context}), }),
acl:$.extend(acl, {context:context}), gateways: $.extend(gateways, {
tierDetailView:tierDetailView context: context
}),
siteToSiteVPN: $.extend(siteToSiteVPN, {
context: context
}),
acl: $.extend(acl, {
context: context
}),
tierDetailView: tierDetailView
}) })
); );
var showAddTierDialog = function () { var showAddTierDialog = function() {
if ($(this).find('.loading-overlay').size()) { if ($(this).find('.loading-overlay').size()) {
return false; return false;
} }
addTierDialog({ addTierDialog({
ipAddresses:ipAddresses, ipAddresses: ipAddresses,
$browser:$browser, $browser: $browser,
tierDetailView:tierDetailView, tierDetailView: tierDetailView,
$tiers:$tiers, $tiers: $tiers,
acl:acl, acl: acl,
context:context, context: context,
actions:actions, actions: actions,
vmListView:vmListView, vmListView: vmListView,
actionPreFilter:actionPreFilter actionPreFilter: actionPreFilter
}); });
return true; return true;
}; };
if (tiers != null && tiers.length > 0) { if (tiers != null && tiers.length > 0) {
$(tiers).map(function (index, tier) { $(tiers).map(function(index, tier) {
var $tier = elems.tier({ var $tier = elems.tier({
ipAddresses:ipAddresses, ipAddresses: ipAddresses,
acl:acl, acl: acl,
$browser:$browser, $browser: $browser,
detailView:tierDetailView, detailView: tierDetailView,
name:tier.name, name: tier.name,
cidr:tier.cidr, cidr: tier.cidr,
virtualMachines:tier.virtualMachines, virtualMachines: tier.virtualMachines,
vmListView:vmListView, vmListView: vmListView,
actions:actions, actions: actions,
actionPreFilter:actionPreFilter, actionPreFilter: actionPreFilter,
context:$.extend(true, {}, context, { context: $.extend(true, {}, context, {
networks:[tier] networks: [tier]
}) })
}); });
@ -562,7 +587,9 @@
} }
elems.tier({ isPlaceholder:true }).appendTo($tiers) elems.tier({
isPlaceholder: true
}).appendTo($tiers)
.click(showAddTierDialog); .click(showAddTierDialog);
$tiers.prepend($router); $tiers.prepend($router);
$chart.append($title, $tiers); $chart.append($title, $tiers);
@ -637,6 +664,7 @@
}, },
// Success // Success
function(args) { function(args) {
if (actionID == 'addVM') { if (actionID == 'addVM') {
// Increment VM total // Increment VM total
@ -669,6 +697,7 @@
{}, {},
// Error // Error
function(args) { function(args) {
if (actionID == 'addVM') { if (actionID == 'addVM') {
updateVMLoadingState(); updateVMLoadingState();
@ -679,7 +708,7 @@
); );
}; };
switch(actionID) { switch (actionID) {
case 'addVM': case 'addVM':
action({ action({
context: context, context: context,
@ -720,7 +749,9 @@
complete: success, complete: success,
response: { response: {
success: success, success: success,
error: function(args) { $loading.remove(); } error: function(args) {
$loading.remove();
}
} }
}); });
} }
@ -788,6 +819,7 @@
}, },
// Success // Success
function(args) { function(args) {
$loading.remove(); $loading.remove();
addNewTier({ addNewTier({
@ -809,13 +841,16 @@
{}, {},
// Error // Error
function(args) { function(args) {
$loading.remove(); $loading.remove();
} }
); );
}, },
error: function(errorMsg) { error: function(errorMsg) {
cloudStack.dialog.notice({ message: _s(errorMsg) }); cloudStack.dialog.notice({
message: _s(errorMsg)
});
$loading.remove(); $loading.remove();
} }
} }
@ -868,8 +903,9 @@
}, },
ipAddresses: { ipAddresses: {
custom: function(args) { custom: function(args) {
return $('<div>').listView(ipAddresses.listView(), return $('<div>').listView(ipAddresses.listView(), {
{context: args.context}); context: args.context
});
} }
} }
} }
@ -893,8 +929,7 @@
}).appendTo($panel); }).appendTo($panel);
$loading.remove(); $loading.remove();
$chart.fadeIn(function() { $chart.fadeIn(function() {});
});
} }
} }
}); });

View File

@ -38,7 +38,9 @@
maximizeIfSelected: true, maximizeIfSelected: true,
complete: function($newPanel) { complete: function($newPanel) {
$viewAll.data('multiple-click', false); $viewAll.data('multiple-click', false);
action({ $panel: $newPanel }); action({
$panel: $newPanel
});
} }
}); });
}); });
@ -256,13 +258,12 @@
// Make traffic type elems // Make traffic type elems
$.each(trafficTypes, function(id, trafficType) { $.each(trafficTypes, function(id, trafficType) {
if ($.inArray(id, validTrafficTypes) == -1) { //if it is not a valid traffic type if ($.inArray(id, validTrafficTypes) == -1) { //if it is not a valid traffic type
if(trafficType.dependsOn != null && trafficType.dependsOn.length > 0) { //if it has dependsOn if (trafficType.dependsOn != null && trafficType.dependsOn.length > 0) { //if it has dependsOn
if($.inArray(trafficType.dependsOn, validTrafficTypes) == -1) { //if its dependsOn is not a valid traffic type, either if ($.inArray(trafficType.dependsOn, validTrafficTypes) == -1) { //if its dependsOn is not a valid traffic type, either
return true; //skip this item return true; //skip this item
} }
//else, if its dependsOn is a valid traffic type, continue to Make list item (e.g. providers.dependsOn is 'guest') //else, if its dependsOn is a valid traffic type, continue to Make list item (e.g. providers.dependsOn is 'guest')
} } else {
else {
return true; //if it doesn't have dependsOn, skip this item return true; //if it doesn't have dependsOn, skip this item
} }
} }
@ -310,7 +311,10 @@
$chart.listView({ $chart.listView({
listView: $.extend(true, {}, cloudStack.sections.system.naas.networks.listView, { listView: $.extend(true, {}, cloudStack.sections.system.naas.networks.listView, {
dataProvider: function(args) { dataProvider: function(args) {
args.response.success({ actionFilter: actionFilter, data: data }); args.response.success({
actionFilter: actionFilter,
data: data
});
}, },
detailView: { detailView: {
noCompact: true, noCompact: true,
@ -350,16 +354,36 @@
var chartItems = { var chartItems = {
// The keys are based on the internal type ID associated with each capacity // The keys are based on the internal type ID associated with each capacity
0: { name: _l('label.memory') }, 0: {
1: { name: _l('label.cpu') }, name: _l('label.memory')
2: { name: _l('label.storage') }, },
3: { name: _l('label.primary.allocated') }, 1: {
6: { name: _l('label.secondary.storage') }, name: _l('label.cpu')
9: { name: _l('label.local.storage') }, },
4: { name: _l('label.public.ips') }, 2: {
5: { name: _l('label.management.ips') }, name: _l('label.storage')
8: { name: _l('label.direct.ips') }, },
7: { name: _l('label.vlan') } 3: {
name: _l('label.primary.allocated')
},
6: {
name: _l('label.secondary.storage')
},
9: {
name: _l('label.local.storage')
},
4: {
name: _l('label.public.ips')
},
5: {
name: _l('label.management.ips')
},
8: {
name: _l('label.direct.ips')
},
7: {
name: _l('label.vlan')
}
}; };
$top.append($title); $top.append($title);
@ -386,8 +410,12 @@
var $totalValue = $('<span>').addClass('total').html(data.total); var $totalValue = $('<span>').addClass('total').html(data.total);
var $chart = $('<div>').addClass('chart'); var $chart = $('<div>').addClass('chart');
var $chartLine = $('<div>').addClass('chart-line') var $chartLine = $('<div>').addClass('chart-line')
.css({ width: '0%' }) .css({
.animate({ width: data.percent + '%' }); width: '0%'
})
.animate({
width: data.percent + '%'
});
var $percent = $('<div>').addClass('percentage'); var $percent = $('<div>').addClass('percentage');
var $percentValue = $('<soan>').addClass('value').html(data.percent); var $percentValue = $('<soan>').addClass('value').html(data.percent);

View File

@ -36,4 +36,3 @@
}); });
}); });
}(jQuery, cloudStack)); }(jQuery, cloudStack));

View File

@ -40,7 +40,9 @@
} }
if (options.all) { if (options.all) {
return cloudStack.serializeForm($forms, { escapeSlashes: true }); return cloudStack.serializeForm($forms, {
escapeSlashes: true
});
} }
// Group form fields together, by form ID // Group form fields together, by form ID
@ -50,7 +52,9 @@
if (!id) return true; if (!id) return true;
groupedForms[id] = cloudStack.serializeForm($form, { escapeSlashes: true }); groupedForms[id] = cloudStack.serializeForm($form, {
escapeSlashes: true
});
return true; return true;
}); });
@ -89,8 +93,7 @@
// Traffic type configuration data // Traffic type configuration data
trafficTypeConfiguration: trafficTypeConfiguration, trafficTypeConfiguration: trafficTypeConfiguration,
guestConfiguration: $guestForm.size() ? guestConfiguration: $guestForm.size() ? cloudStack.serializeForm($guestForm) : null
cloudStack.serializeForm($guestForm) : null
}; };
} }
); );
@ -225,7 +228,9 @@
}; };
var isAdvancedNetwork = function($wizard) { var isAdvancedNetwork = function($wizard) {
return getData($wizard, { all: true })['network-model'] == 'Advanced'; return getData($wizard, {
all: true
})['network-model'] == 'Advanced';
}; };
/** /**
@ -258,7 +263,7 @@
}); });
// Setup required traffic types // Setup required traffic types
$(physicalNetwork.requiredTrafficTypes($wizard)).each(function () { $(physicalNetwork.requiredTrafficTypes($wizard)).each(function() {
var trafficTypeID = this; var trafficTypeID = this;
var $firstPhysicalNetwork = physicalNetwork.getNetworks($wizard).filter(':first'); var $firstPhysicalNetwork = physicalNetwork.getNetworks($wizard).filter(':first');
@ -296,7 +301,10 @@
title: _l('label.edit.traffic.type'), title: _l('label.edit.traffic.type'),
desc: _l('message.edit.traffic.type'), desc: _l('message.edit.traffic.type'),
fields: { fields: {
label: { label: hypervisor + ' ' + _l('label.traffic.label'), defaultValue: trafficData.label } label: {
label: hypervisor + ' ' + _l('label.traffic.label'),
defaultValue: trafficData.label
}
} }
}, },
@ -567,7 +575,9 @@
var $container = $wizard.find('.setup-physical-network .content.input-area form'); var $container = $wizard.find('.setup-physical-network .content.input-area form');
var $physicalNetworkItem = $('<div>').addClass('select-container multi'); var $physicalNetworkItem = $('<div>').addClass('select-container multi');
var $deleteButton = $('<div>').addClass('button remove physical-network') var $deleteButton = $('<div>').addClass('button remove physical-network')
.attr({ title: 'Remove this physical network' }) .attr({
title: 'Remove this physical network'
})
.append('<span>').addClass('icon').html('&nbsp;'); .append('<span>').addClass('icon').html('&nbsp;');
var $icon = $('<div>').addClass('physical-network-icon'); var $icon = $('<div>').addClass('physical-network-icon');
@ -576,7 +586,9 @@
$('<label>').html('Physical network name') $('<label>').html('Physical network name')
), ),
$('<div>').addClass('value').append( $('<div>').addClass('value').append(
$('<input>').attr({ type: 'text' }).addClass('required') $('<input>').attr({
type: 'text'
}).addClass('required')
) )
); );
@ -591,9 +603,9 @@
async: false, async: false,
success: function(json) { success: function(json) {
var items = json.listconfigurationsresponse.configuration; //2 entries returned: 'sdn.ovs.controller', 'sdn.ovs.controller.default.label' var items = json.listconfigurationsresponse.configuration; //2 entries returned: 'sdn.ovs.controller', 'sdn.ovs.controller.default.label'
$(items).each(function(){ $(items).each(function() {
if(this.name == 'sdn.ovs.controller') { if (this.name == 'sdn.ovs.controller') {
if(this.value == 'true' || this.value == true) { if (this.value == 'true' || this.value == true) {
ovsTunnelManager = true; ovsTunnelManager = true;
} }
return false; //break each loop return false; //break each loop
@ -604,7 +616,7 @@
//when OVS tunnel manager is used //when OVS tunnel manager is used
//if(ovsTunnelManager == true) { //if(ovsTunnelManager == true) {
//Advanced zone supports 2 isolation method(VLAN, GRE), so show dropdown including the 2 options //Advanced zone supports 2 isolation method(VLAN, GRE), so show dropdown including the 2 options
if($wizard.find('.select-network-model input:radio[name=network-model]:checked').val() == 'Advanced') { if ($wizard.find('.select-network-model input:radio[name=network-model]:checked').val() == 'Advanced') {
$nameField.append( $nameField.append(
$('<div>').append( $('<div>').append(
$('<span style=\"font-size:11px;padding-right:5px;padding-left:40px\">').html('Isolation method'), $('<span style=\"font-size:11px;padding-right:5px;padding-left:40px\">').html('Isolation method'),
@ -630,7 +642,7 @@
); );
} }
//Basic zone supports only 1 isolation method (L3), so there is no point showing dropdown. //Basic zone supports only 1 isolation method (L3), so there is no point showing dropdown.
// } // }
//when OVS tunnel manager is not used, isolationmethods parameter in createPhysicalNetwork API is ignored. So no showing dropdown. //when OVS tunnel manager is not used, isolationmethods parameter in createPhysicalNetwork API is ignored. So no showing dropdown.
//isolationmethods parameter has not been used by network gurus so far. By default(i.e. when OVS tunnel manager is not used), networks are isolated with VLANs in Advanced zone, with L3 in basic zone. //isolationmethods parameter has not been used by network gurus so far. By default(i.e. when OVS tunnel manager is not used), networks are isolated with VLANs in Advanced zone, with L3 in basic zone.
//No longer the case, as the Nicira stuff also depends on this now //No longer the case, as the Nicira stuff also depends on this now
@ -789,14 +801,18 @@
$tabs.append($('<li></li>').append( $tabs.append($('<li></li>').append(
$('<a></a>') $('<a></a>')
.attr({ href: '#' + networkID }) .attr({
href: '#' + networkID
})
.html($network.find('.field.name input').val()) .html($network.find('.field.name input').val())
)); ));
$.merge( $.merge(
$content, $content,
$('<div></div>') $('<div></div>')
.addClass('physical-network-item') .addClass('physical-network-item')
.attr({ id: networkID }) .attr({
id: networkID
})
.append($form) .append($form)
); );
@ -868,7 +884,9 @@
// Close wizard // Close wizard
var close = function() { var close = function() {
$wizard.dialog('destroy'); $wizard.dialog('destroy');
$('div.overlay').fadeOut(function() { $('div.overlay').remove(); }); $('div.overlay').fadeOut(function() {
$('div.overlay').remove();
});
}; };
// Save and close wizard // Save and close wizard
@ -935,7 +953,9 @@
}, },
error: function(message) { error: function(message) {
cloudStack.dialog.notice({ message: dictionary['error.could.not.enable.zone'] + ':</br>' + message }); cloudStack.dialog.notice({
message: dictionary['error.could.not.enable.zone'] + ':</br>' + message
});
} }
} }
}); });
@ -954,7 +974,9 @@
error: function(stepID, message, start) { error: function(stepID, message, start) {
var goNextOverride = function(event) { var goNextOverride = function(event) {
$(this).unbind('click', goNextOverride); $(this).unbind('click', goNextOverride);
showStep(stepID, false, { nextStep: 'launch' }); showStep(stepID, false, {
nextStep: 'launch'
});
return false; return false;
}; };
@ -993,7 +1015,9 @@
var $targetStep = $($steps[targetIndex]).show(); var $targetStep = $($steps[targetIndex]).show();
var $uiCustom = $targetStep.find('[ui-custom]'); var $uiCustom = $targetStep.find('[ui-custom]');
var formState = getData($wizard, { all: true }); var formState = getData($wizard, {
all: true
});
var groupedFormState = getData($wizard); var groupedFormState = getData($wizard);
var formID = $targetStep.attr('zone-wizard-form'); var formID = $targetStep.attr('zone-wizard-form');
var stepPreFilter = cloudStack.zoneWizard.preFilters[ var stepPreFilter = cloudStack.zoneWizard.preFilters[
@ -1001,9 +1025,11 @@
]; ];
// Bypass step check // Bypass step check
if (stepPreFilter && !stepPreFilter({ data: formState, groupedData: groupedFormState })) { if (stepPreFilter && !stepPreFilter({
return showStep( data: formState,
!goBack ? index + 1 : index - 1, groupedData: groupedFormState
})) {
return showStep(!goBack ? index + 1 : index - 1,
goBack goBack
); );
} }
@ -1049,7 +1075,7 @@
} }
// Custom UI manipulations for specific steps // Custom UI manipulations for specific steps
switch($targetStep.attr('zone-wizard-step-id')) { switch ($targetStep.attr('zone-wizard-step-id')) {
case 'configureGuestTraffic': case 'configureGuestTraffic':
if (formState['network-model'] == 'Advanced' && formState['zone-advanced-sg-enabled'] == undefined) { if (formState['network-model'] == 'Advanced' && formState['zone-advanced-sg-enabled'] == undefined) {
guestTraffic.init($wizard, args); //initialize multiple tabs (tabs is as many as Guest Traffic types in multiple physical networks in Advanced Zone without SG) guestTraffic.init($wizard, args); //initialize multiple tabs (tabs is as many as Guest Traffic types in multiple physical networks in Advanced Zone without SG)
@ -1091,7 +1117,9 @@
$nextButton.find('span').html(options.nextStep ? 'Save changes' : 'Launch zone'); $nextButton.find('span').html(options.nextStep ? 'Save changes' : 'Launch zone');
$nextButton.addClass('final'); $nextButton.addClass('final');
if (options.nextStep) { $nextButton.addClass('post-launch'); } if (options.nextStep) {
$nextButton.addClass('post-launch');
}
} }
// Update progress bar // Update progress bar
@ -1125,8 +1153,7 @@
if ($target.val() == 'tagged') { if ($target.val() == 'tagged') {
$untagged.hide(); $untagged.hide();
$tagged.show(); $tagged.show();
} } else if ($target.val() == 'untagged') {
else if ($target.val() == 'untagged') {
$tagged.hide(); $tagged.hide();
$untagged.show(); $untagged.show();
} }
@ -1134,8 +1161,14 @@
$.merge($tagged, $untagged).find('select:visible').trigger('change'); $.merge($tagged, $untagged).find('select:visible').trigger('change');
cloudStack.evenOdd($wizard, '.field:visible', { cloudStack.evenOdd($wizard, '.field:visible', {
even: function($elem) { $elem.removeClass('odd'); $elem.addClass('even'); }, even: function($elem) {
odd: function($elem) { $elem.removeClass('even'); $elem.addClass('odd'); } $elem.removeClass('odd');
$elem.addClass('even');
},
odd: function($elem) {
$elem.removeClass('even');
$elem.addClass('odd');
}
}); });
return true; return true;
@ -1147,8 +1180,14 @@
if ($target.val() == 'account-specific') $accountSpecific.show(); if ($target.val() == 'account-specific') $accountSpecific.show();
cloudStack.evenOdd($wizard, '.field:visible', { cloudStack.evenOdd($wizard, '.field:visible', {
even: function($elem) { $elem.removeClass('odd'); $elem.addClass('even'); }, even: function($elem) {
odd: function($elem) { $elem.removeClass('even'); $elem.addClass('odd'); } $elem.removeClass('odd');
$elem.addClass('even');
},
odd: function($elem) {
$elem.removeClass('even');
$elem.addClass('odd');
}
}); });
} }
@ -1210,8 +1249,8 @@
//when hypervisor is BareMetal (begin) //when hypervisor is BareMetal (begin)
var data = getData($wizard); var data = getData($wizard);
if(('zone' in data) && (data.zone.hypervisor == 'BareMetal')) { if (('zone' in data) && (data.zone.hypervisor == 'BareMetal')) {
if($('.zone-wizard:visible').find('#add_zone_guest_traffic_desc:visible').size() > 0) { //$steps.filter(':visible').index() == 6 if ($('.zone-wizard:visible').find('#add_zone_guest_traffic_desc:visible').size() > 0) { //$steps.filter(':visible').index() == 6
showStep('launch'); showStep('launch');
completeAction(); completeAction();
return false; return false;

View File

@ -55,7 +55,9 @@
if (args.customIcon) { if (args.customIcon) {
$li.addClass('custom-icon').find('span.icon').html('').append( $li.addClass('custom-icon').find('span.icon').html('').append(
$('<img>').attr({ src: args.customIcon }) $('<img>').attr({
src: args.customIcon
})
); );
} }
@ -105,9 +107,13 @@
if (data.show) if (data.show)
$panel.append(data.show(data)); $panel.append(data.show(data));
else if (data.treeView) else if (data.treeView)
$panel.treeView(data, { context: args.context }); $panel.treeView(data, {
context: args.context
});
else else
$panel.listView(data, { context: args.context }); $panel.listView(data, {
context: args.context
});
} }
}); });
@ -202,7 +208,9 @@
// User status area // User status area
var userLabel = args.context.users[0].name ? var userLabel = args.context.users[0].name ?
args.context.users[0].name : args.context.users[0].login; args.context.users[0].name : args.context.users[0].login;
var $userInfo = $('<div>').attr({ id: 'user' }).addClass('button') var $userInfo = $('<div>').attr({
id: 'user'
}).addClass('button')
.append( .append(
$('<div>').addClass('name').html( $('<div>').addClass('name').html(
args.context && args.context.users ? args.context && args.context.users ?
@ -228,11 +236,17 @@
}, },
'main-area': function(args) { 'main-area': function(args) {
var $navigation = $('<div>').attr({ id: 'navigation' }); var $navigation = $('<div>').attr({
var $browser = $('<div>').attr({ id: 'browser' }) id: 'navigation'
});
var $browser = $('<div>').attr({
id: 'browser'
})
.append( .append(
// Home breadcrumb // Home breadcrumb
$('<div>').attr({ id: 'breadcrumbs' }) $('<div>').attr({
id: 'breadcrumbs'
})
.append($('<div>').addClass('home')) .append($('<div>').addClass('home'))
.append($('<div>').addClass('end')) .append($('<div>').addClass('end'))
) )
@ -262,7 +276,9 @@
// Create pageElems // Create pageElems
$.each(pageElems, function(id, fn) { $.each(pageElems, function(id, fn) {
var $elem = $('<div>').attr({ id: id }); var $elem = $('<div>').attr({
id: id
});
$(fn(args)).each(function() { $(fn(args)).each(function() {
$elem.append($(this)); $elem.append($(this));
@ -272,12 +288,16 @@
}); });
// User options // User options
var $options = $('<div>').attr({ id: 'user-options' }) var $options = $('<div>').attr({
id: 'user-options'
})
.appendTo($('#header')); .appendTo($('#header'));
$(['label.logout', 'label.help', 'label.about']).each(function() { $(['label.logout', 'label.help', 'label.about']).each(function() {
var $link = $('<a>') var $link = $('<a>')
.attr({ href: '#' }) .attr({
href: '#'
})
.html(_l(this.toString())) .html(_l(this.toString()))
.appendTo($options); .appendTo($options);
@ -303,7 +323,7 @@
dialogClass: 'dialog-about', dialogClass: 'dialog-about',
buttons: { buttons: {
'Close': function() { 'Close': function() {
$( this ).dialog( "close" ); $(this).dialog("close");
$(':ui-dialog, .overlay').remove(); $(':ui-dialog, .overlay').remove();
} }
} }
@ -323,7 +343,9 @@
.click(); .click();
// Validation // Validation
$.extend($.validator.messages, { required: _l('label.required') }); $.extend($.validator.messages, {
required: _l('label.required')
});
$.validator.addMethod( $.validator.addMethod(
"disallowSpecialCharacters", "disallowSpecialCharacters",
@ -346,9 +368,7 @@
}).join(''); }).join('');
cloudStack.dialog.notice({ cloudStack.dialog.notice({
message: _l('message.pending.projects.1') + message: _l('message.pending.projects.1') + '<ul>' + projectList + '</ul>' + '<p>' + _l('message.pending.projects.2') + '</p>'
'<ul>' + projectList + '</ul>' +
'<p>' + _l('message.pending.projects.2') + '</p>'
}); });
} }
} }
@ -386,8 +406,7 @@
} }
if ($target.closest('#user, #user-options').size()) { if ($target.closest('#user, #user-options').size()) {
return false; return false;
} } else $('#user-options').hide();
else $('#user-options').hide();
return false; return false;
}); });

View File

@ -24,7 +24,9 @@
error: function(callback) { error: function(callback) {
return function(args) { return function(args) {
var message = args.message ? args.message : args; var message = args.message ? args.message : args;
if (message) cloudStack.dialog.notice({ message: message }); if (message) cloudStack.dialog.notice({
message: message
});
if (callback) callback(); if (callback) callback();
}; };
@ -69,15 +71,19 @@
title: _l(args.form.title), title: _l(args.form.title),
open: function() { open: function() {
if (args.form.preFilter) { if (args.form.preFilter) {
args.form.preFilter({ $form: $form, context: args.context }); args.form.preFilter({
$form: $form,
context: args.context
});
} }
}, },
buttons: [ buttons: [{
{
text: createLabel ? createLabel : _l('label.ok'), text: createLabel ? createLabel : _l('label.ok'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
if (!complete($formContainer)) { return false; } if (!complete($formContainer)) {
return false;
}
$('div.overlay').remove(); $('div.overlay').remove();
$('.tooltip-box').remove(); $('.tooltip-box').remove();
@ -88,8 +94,7 @@
return true; return true;
} }
}, }, {
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
@ -100,15 +105,14 @@
$('.hovered-elem').hide(); $('.hovered-elem').hide();
} }
} }]
]
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
}; };
var isLastAsync = function(idx) { var isLastAsync = function(idx) {
for(var i = idx+1; i < $(fields).length ; i++) { for (var i = idx + 1; i < $(fields).length; i++) {
var f = args.form.fields[$(fields).get(i)]; var f = args.form.fields[$(fields).get(i)];
if(f.select || f.dynamic){ if (f.select || f.dynamic) {
return false; return false;
} }
} }
@ -124,9 +128,11 @@
var $formItem = $('<div>') var $formItem = $('<div>')
.addClass('form-item') .addClass('form-item')
.attr({ rel: key }); .attr({
rel: key
});
if(field.isHidden != null) { if (field.isHidden != null) {
if (typeof(field.isHidden) == 'boolean' && field.isHidden == true) if (typeof(field.isHidden) == 'boolean' && field.isHidden == true)
$formItem.hide(); $formItem.hide();
else if (typeof(field.isHidden) == 'function' && field.isHidden() == true) else if (typeof(field.isHidden) == 'function' && field.isHidden() == true)
@ -173,7 +179,9 @@
// Tooltip description // Tooltip description
if (field.desc) { if (field.desc) {
$formItem.attr({ title: _l(field.desc) }); $formItem.attr({
title: _l(field.desc)
});
} }
// Input area // Input area
@ -256,7 +264,7 @@
$input.trigger('change'); $input.trigger('change');
if((!isNoDialog) && isLastAsync(idx)) { if ((!isNoDialog) && isLastAsync(idx)) {
ret(); ret();
} }
} }
@ -265,14 +273,20 @@
selectFn = field.select; selectFn = field.select;
$input = $('<select>') $input = $('<select>')
.attr({ name: key }) .attr({
name: key
})
.data('dialog-select-fn', function(args) { .data('dialog-select-fn', function(args) {
selectFn(args ? $.extend(true, {}, selectArgs, args) : selectArgs); selectFn(args ? $.extend(true, {}, selectArgs, args) : selectArgs);
}) })
.appendTo($value); .appendTo($value);
// Pass form item to provider for additional manipulation // Pass form item to provider for additional manipulation
$.extend(selectArgs, { $select: $input, $form: $form, type: 'createForm' }); $.extend(selectArgs, {
$select: $input,
$form: $form,
type: 'createForm'
});
if (dependsOn) { if (dependsOn) {
$dependsOn = $input.closest('form').find('input, select').filter(function() { $dependsOn = $input.closest('form').find('input, select').filter(function() {
@ -315,7 +329,10 @@
$.merge( $.merge(
$('<div>').addClass('name').html(_l(itemValue.label)), $('<div>').addClass('name').html(_l(itemValue.label)),
$('<div>').addClass('value').append( $('<div>').addClass('value').append(
$('<input>').attr({ name: itemKey, type: 'checkbox' }).appendTo($value) $('<input>').attr({
name: itemKey,
type: 'checkbox'
}).appendTo($value)
) )
) )
) )
@ -323,7 +340,10 @@
}); });
} else { } else {
$input = $('<input>').attr({ name: key, type: 'checkbox' }).appendTo($value); $input = $('<input>').attr({
name: key,
type: 'checkbox'
}).appendTo($value);
if (field.isChecked) { if (field.isChecked) {
$input.attr('checked', 'checked'); $input.attr('checked', 'checked');
} else { } else {
@ -363,14 +383,17 @@
$form.show(); $form.show();
// Form should be slightly wider // Form should be slightly wider
$form.closest(':ui-dialog').dialog('option', { position: 'center',closeOnEscape: false }); $form.closest(':ui-dialog').dialog('option', {
if((!isNoDialog) && isLastAsync(idx)) { position: 'center',
closeOnEscape: false
});
if ((!isNoDialog) && isLastAsync(idx)) {
ret(); ret();
} }
} }
} }
}); });
} else if(field.isTextarea) { } else if (field.isTextarea) {
$input = $('<textarea>').attr({ $input = $('<textarea>').attr({
name: key name: key
}).appendTo($value); }).appendTo($value);
@ -391,9 +414,11 @@
$input.attr('id', field.id); $input.attr('id', field.id);
} }
$input.addClass("disallowSpecialCharacters"); $input.addClass("disallowSpecialCharacters");
$input.datepicker({dateFormat: 'yy-mm-dd'}); $input.datepicker({
dateFormat: 'yy-mm-dd'
});
} else if(field.range) {//2 text fields on the same line (e.g. port range: startPort - endPort) } else if (field.range) { //2 text fields on the same line (e.g. port range: startPort - endPort)
$input = $.merge( $input = $.merge(
// Range start // Range start
$('<input>').attr({ $('<input>').attr({
@ -427,27 +452,27 @@
$input.addClass("disallowSpecialCharacters"); $input.addClass("disallowSpecialCharacters");
} }
if(field.validation != null) if (field.validation != null)
$input.data('validation-rules', field.validation); $input.data('validation-rules', field.validation);
else else
$input.data('validation-rules', {}); $input.data('validation-rules', {});
var fieldLabel = field.label; var fieldLabel = field.label;
var inputId = $input.attr('id') ? $input.attr('id') : fieldLabel.replace(/\./g,'_'); var inputId = $input.attr('id') ? $input.attr('id') : fieldLabel.replace(/\./g, '_');
$input.attr('id', inputId); $input.attr('id', inputId);
$name.find('label').attr('for', inputId); $name.find('label').attr('for', inputId);
if(field.isDisabled) if (field.isDisabled)
$input.attr("disabled","disabled"); $input.attr("disabled", "disabled");
// Tooltip // Tooltip
if (field.docID) { if (field.docID) {
$input.toolTip({ $input.toolTip({
docID: field.docID, docID: field.docID,
tooltip:'.tooltip-box', tooltip: '.tooltip-box',
mode:'focus', mode: 'focus',
attachTo: '.form-item' attachTo: '.form-item'
}); });
} }
@ -469,8 +494,7 @@
$formContainer.find('input, select').each(function() { $formContainer.find('input, select').each(function() {
if ($(this).data('validation-rules')) { if ($(this).data('validation-rules')) {
$(this).rules('add', $(this).data('validation-rules')); $(this).rules('add', $(this).data('validation-rules'));
} } else {
else {
$(this).rules('add', {}); $(this).rules('add', {});
} }
}); });
@ -552,15 +576,16 @@
dialogClass: 'multi-edit-add-list panel', dialogClass: 'multi-edit-add-list panel',
width: 825, width: 825,
title: _l('Select VM'), title: _l('Select VM'),
buttons: [ buttons: [{
{
text: _l('label.apply'), text: _l('label.apply'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
if (!$listView.find( if (!$listView.find(
'input[type=radio]:checked, input[type=checkbox]:checked' 'input[type=radio]:checked, input[type=checkbox]:checked'
).size()) { ).size()) {
cloudStack.dialog.notice({ message: _l('message.select.instance')}); cloudStack.dialog.notice({
message: _l('message.select.instance')
});
return false; return false;
} }
@ -579,8 +604,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
} }
}, }, {
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
@ -591,8 +615,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
}); });
} }
} }]
]
}).parent('.ui-dialog').overlay(); }).parent('.ui-dialog').overlay();
}, },
@ -606,21 +629,23 @@
var $input = $formField.find('input, select'); var $input = $formField.find('input, select');
var validationRules = $input.data('validation-rules'); var validationRules = $input.data('validation-rules');
if(validationRules == null || validationRules.required == null || validationRules.required == false) { if (validationRules == null || validationRules.required == null || validationRules.required == false) {
$formField.find('.name').find('label').find('span.field-required').css('display', 'inline'); //show red asterisk $formField.find('.name').find('label').find('span.field-required').css('display', 'inline'); //show red asterisk
if(validationRules == null) if (validationRules == null)
validationRules = {}; validationRules = {};
validationRules.required = true; validationRules.required = true;
$input.data('validation-rules', validationRules); $input.data('validation-rules', validationRules);
$input.rules('add', { required: true }); $input.rules('add', {
required: true
});
} }
}, },
remove: function($formField) { remove: function($formField) {
var $input = $formField.find('input, select'); var $input = $formField.find('input, select');
var validationRules = $input.data('validation-rules'); var validationRules = $input.data('validation-rules');
if(validationRules != null && validationRules.required != null && validationRules.required == true) { if (validationRules != null && validationRules.required != null && validationRules.required == true) {
$formField.find('.name').find('label').find('span.field-required').hide(); //hide red asterisk $formField.find('.name').find('label').find('span.field-required').hide(); //hide red asterisk
delete validationRules.required; delete validationRules.required;
$input.data('validation-rules', validationRules); $input.data('validation-rules', validationRules);
@ -646,18 +671,18 @@
dialogClass: 'confirm', dialogClass: 'confirm',
closeOnEscape: false, closeOnEscape: false,
zIndex: 5000, zIndex: 5000,
buttons: [ buttons: [{
{
text: _l('label.no'), text: _l('label.no'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
$(this).dialog('destroy'); $(this).dialog('destroy');
$('div.overlay').remove(); $('div.overlay').remove();
if (args.cancelAction) { args.cancelAction(); } if (args.cancelAction) {
args.cancelAction();
}
$('.hovered-elem').hide(); $('.hovered-elem').hide();
} }
}, }, {
{
text: _l('label.yes'), text: _l('label.yes'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
@ -666,8 +691,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
$('.hovered-elem').hide(); $('.hovered-elem').hide();
} }
} }]
]
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
}, },
@ -685,8 +709,7 @@
dialogClass: 'notice', dialogClass: 'notice',
closeOnEscape: false, closeOnEscape: false,
zIndex: 5000, zIndex: 5000,
buttons: [ buttons: [{
{
text: _l('Close'), text: _l('Close'),
'class': 'close', 'class': 'close',
click: function() { click: function() {
@ -694,8 +717,7 @@
if (args.clickAction) args.clickAction(); if (args.clickAction) args.clickAction();
$('.hovered-elem').hide(); $('.hovered-elem').hide();
} }
} }]
]
}); });
} }

View File

@ -19,7 +19,9 @@
// Attach element to specific event type // Attach element to specific event type
elem: function(widget, elem, $elem, extraData) { elem: function(widget, elem, $elem, extraData) {
// Setup DOM metadata // Setup DOM metadata
var data = { cloudStack: {} }; var data = {
cloudStack: {}
};
data.cloudStack[widget] = { data.cloudStack[widget] = {
elem: elem elem: elem
}; };

View File

@ -33,7 +33,7 @@
data[this.name] = value; data[this.name] = value;
} else if (dataItem && !$.isArray(dataItem)) { } else if (dataItem && !$.isArray(dataItem)) {
data[this.name] = [dataItem, value]; data[this.name] = [dataItem, value];
} else if($.isArray(dataItem)){ } else if ($.isArray(dataItem)) {
dataItem.push(value); dataItem.push(value);
} }
}); });
@ -77,19 +77,16 @@
* Strip unwanted characters from user-based input * Strip unwanted characters from user-based input
*/ */
cloudStack.sanitize = window._s = function(value) { cloudStack.sanitize = window._s = function(value) {
if(typeof(value) == "number") { if (typeof(value) == "number") {
//alert("number does not need to be sanitized. Only string needs to be sanitized."); //alert("number does not need to be sanitized. Only string needs to be sanitized.");
return value; return value;
} } else if (typeof(value) == "boolean") {
else if(typeof(value) == "boolean") {
//alert("boolean does not need to be sanitized. Only string needs to be sanitized."); //alert("boolean does not need to be sanitized. Only string needs to be sanitized.");
return value; return value;
} } else if (typeof(value) == "object") {
else if(typeof(value) == "object") {
//alert("object cant not be sanitized. Only string can be sanitized."); //alert("object cant not be sanitized. Only string can be sanitized.");
return value; return value;
} } else if (typeof(value) == null || typeof(value) == "undefined") {
else if(typeof(value) == null || typeof(value) == "undefined") {
return ''; return '';
} }

View File

@ -39,8 +39,7 @@
) )
) )
.append($('<div>').addClass('end')) .append($('<div>').addClass('end'))
.children(), .children(), {
{
panel: $panel panel: $panel
} }
); );
@ -158,13 +157,13 @@
* Generate new panel * Generate new panel
*/ */
create: function($container, options) { create: function($container, options) {
var $panel = $('<div>').addClass('panel').css( var $panel = $('<div>').addClass('panel').css({
{
position: 'absolute', position: 'absolute',
width: _panel.width($container, { maximized: options.maximized }), width: _panel.width($container, {
maximized: options.maximized
}),
zIndex: _panel.topIndex($container) zIndex: _panel.topIndex($container)
} }).append(
).append(
// Shadow // Shadow
$('<div>').addClass('shadow') $('<div>').addClass('shadow')
).append(options.data); ).append(options.data);
@ -211,8 +210,7 @@
).removeClass('active maximized'); ).removeClass('active maximized');
$toRemove.animate( $toRemove.animate(
_panel.initialState($container), _panel.initialState($container), {
{
duration: 500, duration: 500,
complete: function() { complete: function() {
$(this).remove(); $(this).remove();
@ -223,7 +221,9 @@
); );
$toShow.show(); $toShow.show();
$panel.animate({ $panel.animate({
left: _panel.position($container, { maximized: $panel.hasClass('always-maximized') }) left: _panel.position($container, {
maximized: $panel.hasClass('always-maximized')
})
}); });
$panel.show().removeClass('reduced'); $panel.show().removeClass('reduced');
}, },
@ -241,17 +241,25 @@
_breadcrumb.filter($panel).removeClass('maximized'); _breadcrumb.filter($panel).removeClass('maximized');
$panel.removeClass('maximized'); $panel.removeClass('maximized');
$panel.addClass('reduced'); $panel.addClass('reduced');
_breadcrumb.filter($panel.siblings()).find('span').animate({ opacity: 1 }); _breadcrumb.filter($panel.siblings()).find('span').animate({
$toHide.animate({ left: _panel.position($container, {}) }, opacity: 1
{ duration: 500 }); });
$toHide.animate({
left: _panel.position($container, {})
}, {
duration: 500
});
$shadow.show(); $shadow.show();
} else { } else {
_breadcrumb.filter($panel).addClass('maximized'); _breadcrumb.filter($panel).addClass('maximized');
$panel.removeClass('reduced'); $panel.removeClass('reduced');
$panel.addClass('maximized'); $panel.addClass('maximized');
_breadcrumb.filter($panel.siblings()).find('span').animate({ opacity: 0.5 }); _breadcrumb.filter($panel.siblings()).find('span').animate({
$toHide.animate(_panel.initialState($container), opacity: 0.5
{ duration: 500 }); });
$toHide.animate(_panel.initialState($container), {
duration: 500
});
$shadow.hide(); $shadow.hide();
} }
}, },
@ -311,13 +319,15 @@
}); });
if (!$panel.index()) { if (!$panel.index()) {
// Just show immediately if this is the first panel // Just show immediately if this is the first panel
$panel.css( $panel.css({
{ left: targetPosition } left: targetPosition
); });
if (args.complete) args.complete($panel, _breadcrumb.filter($panel)); if (args.complete) args.complete($panel, _breadcrumb.filter($panel));
} else { } else {
// Animate slide-in // Animate slide-in
$panel.animate({ left: targetPosition }, { $panel.animate({
left: targetPosition
}, {
duration: duration, duration: duration,
easing: 'easeOutCirc', easing: 'easeOutCirc',
complete: function() { complete: function() {
@ -346,25 +356,25 @@
}); });
$('#breadcrumbs li').live('click', cloudStack.ui.event.bind( $('#breadcrumbs li').live('click', cloudStack.ui.event.bind(
'cloudBrowser', 'cloudBrowser', {
{
'breadcrumb': function($target, $browser, data) { 'breadcrumb': function($target, $browser, data) {
if ($ ('#browser').hasClass('panel-highlight')) { if ($('#browser').hasClass('panel-highlight')) {
return false; return false;
} }
$browser.cloudBrowser('selectPanel', { panel: data.panel }); $browser.cloudBrowser('selectPanel', {
panel: data.panel
});
} }
} }
)); ));
// Breadcrumb hovering // Breadcrumb hovering
$('#breadcrumbs li').live('mouseover', cloudStack.ui.event.bind( $('#breadcrumbs li').live('mouseover', cloudStack.ui.event.bind(
'cloudBrowser', 'cloudBrowser', {
{
'breadcrumb': function($target, $browser, data) { 'breadcrumb': function($target, $browser, data) {
var $hiddenPanels = data.panel.siblings().filter(function(){ var $hiddenPanels = data.panel.siblings().filter(function() {
return $(this).index() > data.panel.index(); return $(this).index() > data.panel.index();
}); });
var $targetPanel = data.panel.filter(':first'); var $targetPanel = data.panel.filter(':first');
@ -402,9 +412,8 @@
} }
)); ));
$('#breadcrumbs li').live('mouseout',cloudStack.ui.event.bind( $('#breadcrumbs li').live('mouseout', cloudStack.ui.event.bind(
'cloudBrowser', 'cloudBrowser', {
{
'breadcrumb': function($target, $browser, data) { 'breadcrumb': function($target, $browser, data) {
var $getHiddenPanels = $browser.find('.panel.mouseover-hidden'); var $getHiddenPanels = $browser.find('.panel.mouseover-hidden');
var $visiblePanels = $getHiddenPanels.siblings(); var $visiblePanels = $getHiddenPanels.siblings();

View File

@ -28,7 +28,7 @@
var $newRow; var $newRow;
var jsonObj = $row.data('json-obj'); var jsonObj = $row.data('json-obj');
if($listView.length > 0 ) { //$listView.length is 0 after calling $(window).trigger('cloudStack.fullRefresh') if ($listView.length > 0) { //$listView.length is 0 after calling $(window).trigger('cloudStack.fullRefresh')
$listView.listView('replaceItem', { $listView.listView('replaceItem', {
$row: $row, $row: $row,
data: $.extend(jsonObj, newData), data: $.extend(jsonObj, newData),
@ -83,7 +83,9 @@
// Handle pre-action (occurs before any other behavior happens) // Handle pre-action (occurs before any other behavior happens)
if (preAction) { if (preAction) {
if (!preAction({ context: context })) return false; if (!preAction({
context: context
})) return false;
} }
var updateTabContent = function(newData) { var updateTabContent = function(newData) {
@ -101,8 +103,7 @@
makeTabs( makeTabs(
$detailView, $detailView,
$detailView.data('view-args').tabs, $detailView.data('view-args').tabs, {
{
context: context, context: context,
tabFilter: $detailView.data('view-args').tabFilter, tabFilter: $detailView.data('view-args').tabFilter,
newData: newData newData: newData
@ -152,13 +153,16 @@
notification, notification,
// Success // Success
function(args) { function(args) {
if (viewArgs && viewArgs.onActionComplete) { if (viewArgs && viewArgs.onActionComplete) {
viewArgs.onActionComplete(); viewArgs.onActionComplete();
} }
if (!$detailView.parents('html').size()) { if (!$detailView.parents('html').size()) {
replaceListViewItem(null, args.data, { $row: $row }); replaceListViewItem(null, args.data, {
$row: $row
});
return; return;
} }
@ -174,6 +178,7 @@
{}, {},
// Error // Error
function(args) { function(args) {
$loading.remove(); $loading.remove();
} }
@ -211,7 +216,7 @@
if (isMultiple) { if (isMultiple) {
$detailView.find('.refresh').click(); $detailView.find('.refresh').click();
} else { } else {
updateTabContent(args.data? args.data : args2.data); updateTabContent(args.data ? args.data : args2.data);
} }
} }
} }
@ -235,6 +240,7 @@
{}, {},
// Error // Error
function(args) { function(args) {
$loading.remove(); $loading.remove();
} }
@ -243,7 +249,7 @@
return true; return true;
}, },
error: function(args) { //args here is parsed errortext from API response error: function(args) { //args here is parsed errortext from API response
if(args != null & args.length > 0) { if (args != null & args.length > 0) {
cloudStack.dialog.notice({ cloudStack.dialog.notice({
message: args message: args
}); });
@ -274,9 +280,7 @@
}), }),
// Window options // Window options
'menubar=0,resizable=0,' 'menubar=0,resizable=0,' + 'width=' + externalLinkAction.width + ',' + 'height=' + externalLinkAction.height
+ 'width=' + externalLinkAction.width + ','
+ 'height=' + externalLinkAction.height
); );
} else { } else {
notification.desc = messages.notification(messageArgs); notification.desc = messages.notification(messageArgs);
@ -293,7 +297,9 @@
} }
}); });
} else { } else {
performAction({ id: id }); performAction({
id: id
});
} }
} else if (action.createForm) { } else if (action.createForm) {
cloudStack.dialog.createForm({ cloudStack.dialog.createForm({
@ -342,12 +348,12 @@
}); });
} }
if($detailView.data("list-view-row") != null) { if ($detailView.data("list-view-row") != null) {
var $row = $detailView.data('list-view-row'); var $row = $detailView.data('list-view-row');
var $tbody = $row.closest('tbody'); var $tbody = $row.closest('tbody');
$row.remove(); $row.remove();
if(!$tbody.find('tr').size()) { if (!$tbody.find('tr').size()) {
$("<tr>").addClass('empty').append( $("<tr>").addClass('empty').append(
$("<td>").html(_l('label.no.data')) $("<td>").html(_l('label.no.data'))
).appendTo($tbody); ).appendTo($tbody);
@ -387,7 +393,11 @@
$detailView.find('.tagger').find('input[type=text]').val(''); $detailView.find('.tagger').find('input[type=text]').val('');
$('div.container div.panel div.detail-group .details .main-groups').find('.cidr').toolTip({ docID:'helpIPReservationCidr' , mode:'hover' , tooltip:'.tooltip-box' }); $('div.container div.panel div.detail-group .details .main-groups').find('.cidr').toolTip({
docID: 'helpIPReservationCidr',
mode: 'hover',
tooltip: '.tooltip-box'
});
var convertInputs = function($inputs) { var convertInputs = function($inputs) {
// Save and turn back into labels // Save and turn back into labels
@ -406,8 +416,7 @@
$value.data('detail-view-boolean-value', _s(val)); $value.data('detail-view-boolean-value', _s(val));
$value.html(_s(val) ? _l('label.yes') : _l('label.no')); $value.html(_s(val) ? _l('label.yes') : _l('label.no'));
} } else if ($input.is('select')) {
else if ($input.is('select')) {
$value.html(_s( $value.html(_s(
$input.find('option:selected').html() $input.find('option:selected').html()
)); ));
@ -453,7 +462,9 @@
var applyEdits = function($inputs, $editButton) { var applyEdits = function($inputs, $editButton) {
if ($inputs.size()) { if ($inputs.size()) {
$inputs.animate({ opacity: 0.5 }, 500); $inputs.animate({
opacity: 0.5
}, 500);
var data = {}; var data = {};
$inputs.each(function() { $inputs.each(function() {
@ -511,7 +522,9 @@
}, },
error: function(message) { error: function(message) {
cancelEdits($inputs, $editButton); cancelEdits($inputs, $editButton);
if (message) cloudStack.dialog.notice({ message: message }); if (message) cloudStack.dialog.notice({
message: message
});
} }
} }
}); });
@ -541,8 +554,16 @@
return true; return true;
}); });
$('div.container div.panel div.detail-group .details .main-groups').find('.reservediprange').toolTip({ docID:'helpReservedIPRange' , mode:'hover' , tooltip:'.tooltip-box' }); $('div.container div.panel div.detail-group .details .main-groups').find('.reservediprange').toolTip({
$('div.container div.panel div.detail-group .details .main-groups').find('.networkcidr').toolTip({ docID:'helpIPReservationNetworkCidr' , mode:'hover' , tooltip:'.tooltip-box' }); docID: 'helpReservedIPRange',
mode: 'hover',
tooltip: '.tooltip-box'
});
$('div.container div.panel div.detail-group .details .main-groups').find('.networkcidr').toolTip({
docID: 'helpIPReservationNetworkCidr',
mode: 'hover',
tooltip: '.tooltip-box'
});
$detailView.find('td.value span').each(function() { $detailView.find('td.value span').each(function() {
@ -653,8 +674,7 @@
viewAllID.custom({ viewAllID.custom({
$browser: $browser, $browser: $browser,
context: $detailView.data('view-args').context, context: $detailView.data('view-args').context,
listViewArgs: $detailView.data('list-view') ? listViewArgs: $detailView.data('list-view') ? $detailView.data('list-view').data('view-args') : null
$detailView.data('list-view').data('view-args') : null
}) })
); );
} }
@ -674,8 +694,7 @@
listViewArgs = cloudStackArgs.sections.system listViewArgs = cloudStackArgs.sections.system
.subsections[viewAllPath[1]]; .subsections[viewAllPath[1]];
} }
} } else
else
listViewArgs = cloudStackArgs.sections[viewAllPath[0]]; listViewArgs = cloudStackArgs.sections[viewAllPath[0]];
// Make list view // Make list view
@ -695,17 +714,23 @@
var context = $.extend(true, {}, $detailView.data('view-args').context); var context = $.extend(true, {}, $detailView.data('view-args').context);
if (updateContext) { if (updateContext) {
$.extend(context, updateContext({ context: context })); $.extend(context, updateContext({
context: context
}));
} }
// Make panel // Make panel
var $panel = $browser.cloudBrowser('addPanel', { var $panel = $browser.cloudBrowser('addPanel', {
title: customTitle ? customTitle({ context: context }) : _l(listViewArgs.title), title: customTitle ? customTitle({
context: context
}) : _l(listViewArgs.title),
data: '', data: '',
noSelectPanel: true, noSelectPanel: true,
maximizeIfSelected: true, maximizeIfSelected: true,
complete: function($newPanel) { complete: function($newPanel) {
return $('<div>').listView(listViewArgs, { context: context }).appendTo($newPanel); return $('<div>').listView(listViewArgs, {
context: context
}).appendTo($newPanel);
} }
}); });
}; };
@ -833,7 +858,9 @@
hiddenFields = tabData.preFilter({ hiddenFields = tabData.preFilter({
context: context, context: context,
fields: $.map(fields, function(fieldGroup) { fields: $.map(fields, function(fieldGroup) {
return $.map(fieldGroup, function(value, key) { return key; }); return $.map(fieldGroup, function(value, key) {
return key;
});
}) })
}); });
} }
@ -895,7 +922,7 @@
$value.data('validation-rules', value.validation); $value.data('validation-rules', value.validation);
// Set up editable metadata // Set up editable metadata
if(typeof(value.isEditable) == 'function') if (typeof(value.isEditable) == 'function')
$value.data('detail-view-is-editable', value.isEditable(context)); $value.data('detail-view-is-editable', value.isEditable(context));
else //typeof(value.isEditable) == 'boolean' or 'undefined' else //typeof(value.isEditable) == 'boolean' or 'undefined'
$value.data('detail-view-is-editable', value.isEditable); $value.data('detail-view-is-editable', value.isEditable);
@ -911,7 +938,7 @@
return option.id == value.selected; return option.id == value.selected;
})[0]; })[0];
if(matchedSelectValue != null) { if (matchedSelectValue != null) {
$value.html(_s(matchedSelectValue.description)); $value.html(_s(matchedSelectValue.description));
$value.data('detail-view-selected-option', matchedSelectValue.id); $value.data('detail-view-selected-option', matchedSelectValue.id);
} }
@ -963,7 +990,9 @@
.addClass('view-all') .addClass('view-all')
.append( .append(
$('<a>') $('<a>')
.attr({ href: '#' }) .attr({
href: '#'
})
.data('detail-view-link-view-all', detailViewArgs.viewAll) .data('detail-view-link-view-all', detailViewArgs.viewAll)
.append( .append(
$('<span>').html(_l('label.view') + ' ' + _l(detailViewArgs.viewAll.label)) $('<span>').html(_l('label.view') + ' ' + _l(detailViewArgs.viewAll.label))
@ -981,8 +1010,9 @@
$(detailViewArgs.viewAll).each(function() { $(detailViewArgs.viewAll).each(function() {
var viewAllItem = this; var viewAllItem = this;
if (viewAllItem.preFilter && if (viewAllItem.preFilter && !viewAllItem.preFilter({
!viewAllItem.preFilter({ context: context })) { context: context
})) {
return true; return true;
} }
@ -990,7 +1020,9 @@
.addClass('view-all') .addClass('view-all')
.append( .append(
$('<a>') $('<a>')
.attr({ href: '#' }) .attr({
href: '#'
})
.data('detail-view-link-view-all', viewAllItem) .data('detail-view-link-view-all', viewAllItem)
.append( .append(
$('<span>').html(_l('label.view') + ' ' + _l(viewAllItem.label)) $('<span>').html(_l('label.view') + ' ' + _l(viewAllItem.label))
@ -1052,8 +1084,9 @@
} }
$.extend( $.extend(
$detailView.data('view-args'), $detailView.data('view-args'), {
{ activeTab: targetTabID } activeTab: targetTabID
}
); );
if (!$detailView.data('view-args').compact) { if (!$detailView.data('view-args').compact) {
@ -1112,8 +1145,7 @@
$('<div>').addClass('end') $('<div>').addClass('end')
).click(function() { ).click(function() {
viewAll( viewAll(
tabData.viewAll.path, tabData.viewAll.path, {
{
updateContext: function(args) { updateContext: function(args) {
var obj = {}; var obj = {};
@ -1151,8 +1183,7 @@
$('<span>').html(_l(tabData.actions.add.label)) $('<span>').html(_l(tabData.actions.add.label))
).click(function() { ).click(function() {
uiActions.standard( uiActions.standard(
$detailView, $detailView, {
{
tabs: tabList, tabs: tabList,
activeTab: targetTabID, activeTab: targetTabID,
actions: tabData.actions, actions: tabData.actions,
@ -1182,8 +1213,7 @@
}).appendTo($tabContent); }).appendTo($tabContent);
if (tabs.tags && if (tabs.tags &&
$detailView.data('view-args') && $detailView.data('view-args') && !$detailView.data('view-args').compact) {
!$detailView.data('view-args').compact) {
$('<div>').tagger( $('<div>').tagger(
$.extend(true, {}, tabs.tags, { $.extend(true, {}, tabs.tags, {
context: $detailView.data('view-args').context, context: $detailView.data('view-args').context,
@ -1222,7 +1252,7 @@
})); }));
} }
if(options.newData && if (options.newData &&
($detailView.data('view-args').section != null && context[$detailView.data('view-args').section] != null && context[$detailView.data('view-args').section].length > 0)) { ($detailView.data('view-args').section != null && context[$detailView.data('view-args').section] != null && context[$detailView.data('view-args').section].length > 0)) {
$.extend( $.extend(
context[$detailView.data('view-args').section][0], context[$detailView.data('view-args').section][0],
@ -1238,8 +1268,12 @@
removedTabs = $.grep( removedTabs = $.grep(
$.map( $.map(
tabs, tabs,
function(value, key) { return key; } function(value, key) {
), function(tab, index) { return index > 0; } return key;
}
), function(tab, index) {
return index > 0;
}
); );
} }
@ -1354,8 +1388,7 @@
viewAll( viewAll(
viewAllArgs.custom ? viewAllArgs.custom ?
viewAllArgs : viewAllArgs :
viewAllArgs.path, viewAllArgs.path, {
{
updateContext: viewAllArgs.updateContext updateContext: viewAllArgs.updateContext
} }
); );

View File

@ -53,7 +53,9 @@
listViewArgs.activeSection listViewArgs.activeSection
] = [$instanceRow.data('jsonObj')]; ] = [$instanceRow.data('jsonObj')];
if (!preAction({ context: preActionContext })) return false; if (!preAction({
context: preActionContext
})) return false;
} }
var performAction = function(data, options) { var performAction = function(data, options) {
@ -84,9 +86,7 @@
}), }),
// Window options // Window options
'menubar=0,resizable=0,' 'menubar=0,resizable=0,' + 'width=' + externalLinkAction.width + ',' + 'height=' + externalLinkAction.height
+ 'width=' + externalLinkAction.width + ','
+ 'height=' + externalLinkAction.height
); );
} else if (action.custom && !action.noAdd) { } else if (action.custom && !action.noAdd) {
action.custom({ action.custom({
@ -122,6 +122,7 @@
{}, {},
// Error // Error
function(args) { function(args) {
if (args && args.updatedData) { if (args && args.updatedData) {
if ($item.is(':visible') && !isHeader) { if ($item.is(':visible') && !isHeader) {
@ -180,7 +181,9 @@
if (options.$item) $instanceRow.data('list-view-new-item', true); if (options.$item) $instanceRow.data('list-view-new-item', true);
// Disable any clicking/actions for row // Disable any clicking/actions for row
$instanceRow.bind('click', function() { return false; }); $instanceRow.bind('click', function() {
return false;
});
notification._custom = args._custom; notification._custom = args._custom;
@ -194,6 +197,7 @@
notification, notification,
// Success // Success
function(args) { function(args) {
if (!args) args = {}; if (!args) args = {};
@ -206,8 +210,7 @@
$newRow = replaceItem($instanceRow, $newRow = replaceItem($instanceRow,
$.extend($instanceRow.data('json-obj'), args.data), $.extend($instanceRow.data('json-obj'), args.data),
actionFilter); actionFilter);
} } else {
else {
// Nothing new, so just put in existing data // Nothing new, so just put in existing data
$newRow = replaceItem($instanceRow, $newRow = replaceItem($instanceRow,
$instanceRow.data('json-obj'), $instanceRow.data('json-obj'),
@ -246,6 +249,7 @@
{}, {},
// Error // Error
function(args) { function(args) {
if (!isHeader) { if (!isHeader) {
if ($instanceRow.data('list-view-new-item')) { if ($instanceRow.data('list-view-new-item')) {
@ -279,7 +283,9 @@
if (options.error) options.error(message); if (options.error) options.error(message);
if (message) cloudStack.dialog.notice({ message: message }); if (message) cloudStack.dialog.notice({
message: message
});
} }
} }
}; };
@ -306,11 +312,8 @@
messageArgs.context = context; messageArgs.context = context;
if (!args.action.action.externalLink && if (!args.action.action.externalLink && !args.action.createForm &&
!args.action.createForm && args.action.addRow != 'true' && !action.custom && !action.uiCustom && !args.action.listView) {
args.action.addRow != 'true' &&
!action.custom && !action.uiCustom &&
!args.action.listView) {
cloudStack.dialog.confirm({ cloudStack.dialog.confirm({
message: messages.confirm(messageArgs), message: messages.confirm(messageArgs),
action: function() { action: function() {
@ -328,7 +331,9 @@
context: context, context: context,
listView: args.action.listView, listView: args.action.listView,
after: function(args) { after: function(args) {
performAction(null, { context: args.context }); performAction(null, {
context: args.context
});
} }
}); });
} else { } else {
@ -351,9 +356,7 @@
}), }),
// Window options // Window options
'menubar=0,resizable=0,' 'menubar=0,resizable=0,' + 'width=' + externalLinkAction.width + ',' + 'height=' + externalLinkAction.height
+ 'width=' + externalLinkAction.width + ','
+ 'height=' + externalLinkAction.height
); );
} else if (args.action.createForm) { } else if (args.action.createForm) {
cloudStack.dialog.createForm({ cloudStack.dialog.createForm({
@ -455,7 +458,9 @@
// Hide label, show edit field // Hide label, show edit field
var showEditField = function() { var showEditField = function() {
$edit.css({ opacity: 1 }); $edit.css({
opacity: 1
});
$label.fadeOut('fast', function() { $label.fadeOut('fast', function() {
$edit.fadeIn(); $edit.fadeIn();
$editInput.focus(); $editInput.focus();
@ -469,7 +474,7 @@
var oldVal = $label.html(); var oldVal = $label.html();
if(val != null ) if (val != null)
$label.html(_s(val)); $label.html(_s(val));
var data = { var data = {
@ -497,7 +502,9 @@
}, },
error: function(message) { error: function(message) {
if (message) { if (message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
$edit.hide(), $edit.hide(),
$label.html(_s(oldVal)).fadeIn(); $label.html(_s(oldVal)).fadeIn();
$instanceRow.closest('div.data-table').dataTable('refresh'); $instanceRow.closest('div.data-table').dataTable('refresh');
@ -521,32 +528,26 @@
if (!$editInput.is(':visible') || !(typeof(args.action) == 'undefined')) { //click Edit button if (!$editInput.is(':visible') || !(typeof(args.action) == 'undefined')) { //click Edit button
showEditField(); showEditField();
} } else if ($editInput.val() != $label.html()) { //click Save button with changed value
else if ($editInput.val() != $label.html()) { //click Save button with changed value $edit.animate({
$edit.animate({ opacity: 0.5 }); opacity: 0.5
});
var originalName = $label.html(); var originalName = $label.html();
var newName = $editInput.val(); var newName = $editInput.val();
showLabel(newName, { showLabel(newName, {
success: function() { success: function() {
cloudStack.ui.notifications.add( cloudStack.ui.notifications.add({
{
section: $instanceRow.closest('div.view').data('view-args').id, section: $instanceRow.closest('div.view').data('view-args').id,
desc: newName ? desc: newName ? _l('Set value of') + ' ' + $instanceRow.find('td.name span').html() + ' ' + _l('to') + ' ' + _s(newName) : _l('Unset value for') + ' ' + $instanceRow.find('td.name span').html()
_l('Set value of') +
' ' + $instanceRow.find('td.name span').html() +
' ' + _l('to') +
' ' + _s(newName) :
_l('Unset value for') +
' ' + $instanceRow.find('td.name span').html()
}, },
function(args) {}, function(args) {}, [{
[{ name: newName }] name: newName
}]
); );
} }
}); });
} } else { //click Save button with unchanged value
else { //click Save button with unchanged value
showLabel(); showLabel();
} }
@ -568,14 +569,18 @@
moveTop: function($tr) { moveTop: function($tr) {
rowActions._std($tr, function() { rowActions._std($tr, function() {
$tr.closest('tbody').prepend($tr); $tr.closest('tbody').prepend($tr);
$tr.closest('.list-view').animate({ scrollTop: 0 }); $tr.closest('.list-view').animate({
scrollTop: 0
});
}); });
}, },
moveBottom: function($tr) { moveBottom: function($tr) {
rowActions._std($tr, function() { rowActions._std($tr, function() {
$tr.closest('tbody').append($tr); $tr.closest('tbody').append($tr);
$tr.closest('.list-view').animate({ scrollTop: 0 }); $tr.closest('.list-view').animate({
scrollTop: 0
});
}); });
}, },
@ -647,7 +652,9 @@
$.map(actions, function(value, key) { $.map(actions, function(value, key) {
return key; return key;
}), }),
function(elem) { return elem != 'add'; } function(elem) {
return elem != 'add';
}
).length; ).length;
}; };
@ -665,7 +672,7 @@
hiddenFields = preFilter(); hiddenFields = preFilter();
$.each(fields, function(key) { $.each(fields, function(key) {
if($.inArray(key, hiddenFields) != -1) if ($.inArray(key, hiddenFields) != -1)
return true; return true;
var field = this; var field = this;
var $th = $('<th>').addClass(key).appendTo($thead.find('tr')); var $th = $('<th>').addClass(key).appendTo($thead.find('tr'));
@ -708,9 +715,7 @@
} }
// Quick view // Quick view
if (detailView && if (detailView && !$.isFunction(detailView) && !detailView.noCompact && !uiCustom) {
!$.isFunction(detailView) &&
!detailView.noCompact && !uiCustom) {
$thead.find('tr').append( $thead.find('tr').append(
$('<th></th>') $('<th></th>')
.html(_l('label.quickview')) .html(_l('label.quickview'))
@ -731,7 +736,7 @@
if (filters) if (filters)
$.each(filters, function(key) { $.each(filters, function(key) {
if(this.preFilter != null && this.preFilter() == false) { if (this.preFilter != null && this.preFilter() == false) {
return true; //skip to next item in each loop return true; //skip to next item in each loop
} }
var $option = $('<option>').attr({ var $option = $('<option>').attr({
@ -806,8 +811,7 @@
$('<input>').attr({ $('<input>').attr({
type: 'checkbox', type: 'checkbox',
name: actionName, name: actionName,
checked: data && data._isSelected ? checked: data && data._isSelected ? 'checked' : false
'checked' : false
}) })
) )
.attr({ .attr({
@ -935,12 +939,12 @@
} }
var hiddenFields = []; var hiddenFields = [];
if(preFilter != null) if (preFilter != null)
hiddenFields = preFilter(); hiddenFields = preFilter();
// Add field data // Add field data
$.each(fields, function(key) { $.each(fields, function(key) {
if($.inArray(key, hiddenFields) != -1) if ($.inArray(key, hiddenFields) != -1)
return true; return true;
var field = this; var field = this;
var $td = $('<td>') var $td = $('<td>')
@ -971,8 +975,7 @@
if (field.editable) { if (field.editable) {
$td.html(_s(content)); $td.html(_s(content));
createEditField($td).appendTo($td); createEditField($td).appendTo($td);
} } else {
else {
$td.html(''); $td.html('');
$td.append( $td.append(
$('<span></span>').html(_s(content)) $('<span></span>').html(_s(content))
@ -1110,13 +1113,14 @@
makeActionIcons( makeActionIcons(
$('<td></td>').addClass('actions reduced-hide') $('<td></td>').addClass('actions reduced-hide')
.appendTo($tr), .appendTo($tr),
actions, actions, {
{
allowedActions: allowedActions allowedActions: allowedActions
} }
); );
$listView.trigger('cloudStack.listView.addRow', { $tr: $tr }); $listView.trigger('cloudStack.listView.addRow', {
$tr: $tr
});
} }
// Add sub-select // Add sub-select
@ -1171,10 +1175,7 @@
} }
// Add quick view // Add quick view
if (detailView && if (detailView && !$.isFunction(detailView) && !detailView.noCompact && !uiCustom) {
!$.isFunction(detailView) &&
!detailView.noCompact &&
!uiCustom) {
$quickView = $('<td>').addClass('quick-view reduced-hide') $quickView = $('<td>').addClass('quick-view reduced-hide')
.append( .append(
$('<span>').addClass('icon').html('&nbsp;') $('<span>').addClass('icon').html('&nbsp;')
@ -1182,6 +1183,7 @@
.appendTo($tr); .appendTo($tr);
$quickView.mouseover( $quickView.mouseover(
// Show quick view // Show quick view
function() { function() {
var $quickViewTooltip = $('<div>').addClass('quick-view-tooltip hovered-elem'); var $quickViewTooltip = $('<div>').addClass('quick-view-tooltip hovered-elem');
var $tr = $quickView.closest('tr'); var $tr = $quickView.closest('tr');
@ -1216,8 +1218,7 @@
// Init detail view // Init detail view
context[activeSection] = [jsonObj]; context[activeSection] = [jsonObj];
createDetailView( createDetailView({
{
data: $.extend(true, {}, detailView, { data: $.extend(true, {}, detailView, {
onLoad: function($detailView) { onLoad: function($detailView) {
$loading.remove(); $loading.remove();
@ -1244,8 +1245,7 @@
}, },
function($detailView) { //complete(), callback funcion function($detailView) { //complete(), callback funcion
$detailView.data('list-view', $listView); $detailView.data('list-view', $listView);
}, $tr, }, $tr, {
{
compact: true, compact: true,
noPanel: true noPanel: true
} }
@ -1329,9 +1329,11 @@
reorder: reorder, reorder: reorder,
detailView: options.detailView detailView: options.detailView
}); });
$table.dataTable(null, { noSelect: uiCustom }); $table.dataTable(null, {
noSelect: uiCustom
});
if(args.data && if (args.data &&
args.data.length < pageSize && args.data.length < pageSize &&
options.setEndTable) { options.setEndTable) {
options.setEndTable(); options.setEndTable();
@ -1345,7 +1347,9 @@
setLoadingArgs.loadingCompleted(); setLoadingArgs.loadingCompleted();
addTableRows(preFilter, fields, [], $tbody, actions); addTableRows(preFilter, fields, [], $tbody, actions);
$table.find('td:first').html(_l('ERROR')); $table.find('td:first').html(_l('ERROR'));
$table.dataTable(null, { noSelect: uiCustom }); $table.dataTable(null, {
noSelect: uiCustom
});
} }
} }
}); });
@ -1402,7 +1406,9 @@
.append( .append(
$('<a>') $('<a>')
.addClass(key) .addClass(key)
.attr({ href: '#' }) .attr({
href: '#'
})
.data('list-view-section-id', key) .data('list-view-section-id', key)
.html(_l(this.title)) .html(_l(this.title))
); );
@ -1515,8 +1521,7 @@
if (listViewData.actions && listViewData.actions.add) { if (listViewData.actions && listViewData.actions.add) {
var showAdd = listViewData.actions.add.preFilter ? var showAdd = listViewData.actions.add.preFilter ?
listViewData.actions.add.preFilter({ listViewData.actions.add.preFilter({
context: listViewData.context ? context: listViewData.context ? listViewData.context : args.context
listViewData.context : args.context
}) : true; }) : true;
if (showAdd) { if (showAdd) {
@ -1559,8 +1564,7 @@
createHeader(listViewData.preFilter, createHeader(listViewData.preFilter,
listViewData.fields, listViewData.fields,
$table, $table,
listViewData.actions, listViewData.actions, {
{
reorder: reorder, reorder: reorder,
detailView: listViewData.detailView detailView: listViewData.detailView
}); });
@ -1572,8 +1576,7 @@
listViewData.dataProvider, listViewData.dataProvider,
listViewData.preFilter, listViewData.preFilter,
listViewData.fields, listViewData.fields,
false, false, {
{
page: page, page: page,
filterBy: { filterBy: {
kind: $listView.find('select[id=filterBy]').val(), kind: $listView.find('select[id=filterBy]').val(),
@ -1584,8 +1587,7 @@
}, },
ref: args.ref ref: args.ref
}, },
listViewData.actions, listViewData.actions, {
{
context: args.context, context: args.context,
reorder: reorder, reorder: reorder,
detailView: listViewData.detailView, detailView: listViewData.detailView,
@ -1627,8 +1629,7 @@
listViewData.dataProvider, listViewData.dataProvider,
listViewData.preFilter, listViewData.preFilter,
listViewData.fields, listViewData.fields,
false, false, {
{
page: page, page: page,
filterBy: { filterBy: {
kind: $listView.find('select[id=filterBy]').val(), kind: $listView.find('select[id=filterBy]').val(),
@ -1638,8 +1639,7 @@
} }
} }
}, },
listViewData.actions, listViewData.actions, {
{
context: $listView.data('view-args').context, context: $listView.data('view-args').context,
reorder: listViewData.reorder, reorder: listViewData.reorder,
detailView: listViewData.detailView, detailView: listViewData.detailView,
@ -1649,7 +1649,7 @@
}; };
$listView.find('.search-bar input[type=text]').keyup(function(event) { $listView.find('.search-bar input[type=text]').keyup(function(event) {
if(event.keyCode == 13) //13 is keycode of Enter key if (event.keyCode == 13) //13 is keycode of Enter key
basicSearch(); basicSearch();
return true; return true;
}); });
@ -1681,16 +1681,14 @@
listViewData.dataProvider, listViewData.dataProvider,
listViewData.preFilter, listViewData.preFilter,
listViewData.fields, listViewData.fields,
false, false, {
{
page: page, page: page,
filterBy: { filterBy: {
kind: $listView.find('select[id=filterBy]').val(), kind: $listView.find('select[id=filterBy]').val(),
advSearch: args.data advSearch: args.data
} }
}, },
listViewData.actions, listViewData.actions, {
{
context: $listView.data('view-args').context, context: $listView.data('view-args').context,
reorder: listViewData.reorder, reorder: listViewData.reorder,
detailView: listViewData.detailView, detailView: listViewData.detailView,
@ -1762,15 +1760,14 @@
page = page + 1; page = page + 1;
var filterBy = { var filterBy = {
kind: $listView.find('select[id=filterBy]').length > 0? $listView.find('select[id=filterBy]').val(): 'all' kind: $listView.find('select[id=filterBy]').length > 0 ? $listView.find('select[id=filterBy]').val() : 'all'
}; };
if($listView.data('advSearch') == null) { if ($listView.data('advSearch') == null) {
filterBy.search = { filterBy.search = {
value: $listView.find('input[type=text]').length > 0? $listView.find('input[type=text]').val(): '', value: $listView.find('input[type=text]').length > 0 ? $listView.find('input[type=text]').val() : '',
by: 'name' by: 'name'
}; };
} } else {
else {
filterBy.advSearch = $listView.data('advSearch'); filterBy.advSearch = $listView.data('advSearch');
} }
@ -1802,8 +1799,12 @@
}); });
if (actionName == 'destroy') { if (actionName == 'destroy') {
$tr.animate({ opacity: 0.5 }); $tr.animate({
$tr.bind('click', function() { return false; }); opacity: 0.5
});
$tr.bind('click', function() {
return false;
});
} }
}); });
@ -1944,8 +1945,7 @@
targetArgs.fields, targetArgs.fields,
data, data,
listView.find('table tbody'), listView.find('table tbody'),
targetArgs.actions, targetArgs.actions, {
{
prepend: true, prepend: true,
actionFilter: actionFilter, actionFilter: actionFilter,
reorder: reorder, reorder: reorder,
@ -1977,8 +1977,7 @@
targetArgs.fields, targetArgs.fields,
data, data,
$listView.find('table tbody'), $listView.find('table tbody'),
targetArgs.actions, targetArgs.actions, {
{
actionFilter: actionFilter ? actionFilter : defaultActionFilter, actionFilter: actionFilter ? actionFilter : defaultActionFilter,
reorder: reorder, reorder: reorder,
detailView: targetArgs.detailView detailView: targetArgs.detailView
@ -1998,7 +1997,7 @@
if (!options) options = {}; if (!options) options = {};
if (args == 'prependItem') { if (args == 'prependItem') {
return prependItem(this, options.data, options.actionFilter); return prependItem(this, options.data, options.actionFilter);
} else if (args =='replaceItem') { } else if (args == 'replaceItem') {
replaceItem(options.$row, options.data, options.actionFilter, options.after); replaceItem(options.$row, options.data, options.actionFilter, options.after);
} else if (args.sections) { } else if (args.sections) {
var targetSection; var targetSection;
@ -2006,7 +2005,9 @@
targetSection = key; targetSection = key;
return false; return false;
}); });
makeListView(this, $.extend(true, {}, args, { context: options.context }), targetSection); makeListView(this, $.extend(true, {}, args, {
context: options.context
}), targetSection);
} else if (args == 'refresh') { } else if (args == 'refresh') {
var activeSection = this.data('view-args').activeSection; var activeSection = this.data('view-args').activeSection;
var listViewArgs = this.data('view-args').sections ? var listViewArgs = this.data('view-args').sections ?
@ -2020,8 +2021,7 @@
listViewArgs.fields, listViewArgs.fields,
false, false,
null, null,
listViewArgs.actions, listViewArgs.actions, {
{
context: this.data('view-args').context, context: this.data('view-args').context,
detailView: listViewArgs.detailView detailView: listViewArgs.detailView
} }

View File

@ -196,8 +196,7 @@
options.listView, options.listView,
options.context, options.context,
options.multipleAdd, _l('label.add.vms'), options.multipleAdd, _l('label.add.vms'),
addItemAction, addItemAction, {
{
multiRule: multiRule multiRule: multiRule
}); });
@ -216,7 +215,8 @@
_medit.multiItem.details(itemData, $browser); _medit.multiItem.details(itemData, $browser);
} else { } else {
_medit.details(itemData[0], $browser, { _medit.details(itemData[0], $browser, {
context: options.context, itemName: itemName context: options.context,
itemName: itemName
}); });
} }
}); });
@ -281,10 +281,14 @@
// Action filter // Action filter
var allowedActions = options.preFilter ? options.preFilter({ var allowedActions = options.preFilter ? options.preFilter({
actions: $.map(actions, function(value, key) { return key; }), actions: $.map(actions, function(value, key) {
return key;
}),
context: $.extend(true, {}, options.context, { context: $.extend(true, {}, options.context, {
multiRule: [data], multiRule: [data],
actions: $.map(actions, function(value, key) { return key; }) actions: $.map(actions, function(value, key) {
return key;
})
}) })
}) : null; }) : null;
@ -296,7 +300,9 @@
$('<div>').addClass('action') $('<div>').addClass('action')
.addClass(actionID) .addClass(actionID)
.append($('<span>').addClass('icon')) .append($('<span>').addClass('icon'))
.attr({ title: _l(action.label) }) .attr({
title: _l(action.label)
})
.click(function() { .click(function() {
var performAction = function(actionOptions) { var performAction = function(actionOptions) {
if (!actionOptions) actionOptions = {}; if (!actionOptions) actionOptions = {};
@ -351,7 +357,9 @@
} }
}, },
error: function(message) { error: function(message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
$item.show(); $item.show();
$dataItem.find('.loading-overlay').remove(); $dataItem.find('.loading-overlay').remove();
} }
@ -388,9 +396,12 @@
form: createForm, form: createForm,
after: function(args) { after: function(args) {
var $loading = $('<div>').addClass('loading-overlay').prependTo($dataItem); var $loading = $('<div>').addClass('loading-overlay').prependTo($dataItem);
performAction({ data: args.data, complete: function() { performAction({
data: args.data,
complete: function() {
$multi.trigger('refresh'); $multi.trigger('refresh');
} }); }
});
} }
}); });
} else { } else {
@ -416,9 +427,12 @@
}, },
after: function(args) { after: function(args) {
var $loading = $('<div>').addClass('loading-overlay').prependTo($dataItem); var $loading = $('<div>').addClass('loading-overlay').prependTo($dataItem);
performAction({ data: args.data, complete: function() { performAction({
data: args.data,
complete: function() {
$multi.trigger('refresh'); $multi.trigger('refresh');
} }); }
});
} }
}); });
} }
@ -439,8 +453,7 @@
dialogClass: 'editTags', dialogClass: 'editTags',
title: _l('label.edit.tags'), title: _l('label.edit.tags'),
width: 400, width: 400,
buttons: [ buttons: [{
{
text: _l('label.done'), text: _l('label.done'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
@ -449,8 +462,7 @@
return true; return true;
} }
} }]
]
}) })
.append( .append(
$('<div></div>').addClass('multi-edit-tags').tagger($.extend(true, {}, options.tags, { $('<div></div>').addClass('multi-edit-tags').tagger($.extend(true, {}, options.tags, {
@ -529,13 +541,14 @@
dialogClass: 'multi-edit-add-list panel', dialogClass: 'multi-edit-add-list panel',
width: 825, width: 825,
title: label, title: label,
buttons: [ buttons: [{
{
text: _l('label.apply'), text: _l('label.apply'),
'class': 'ok', 'class': 'ok',
click: function() { click: function() {
if (!$listView.find('input[type=radio]:checked, input[type=checkbox]:checked').size()) { if (!$listView.find('input[type=radio]:checked, input[type=checkbox]:checked').size()) {
cloudStack.dialog.notice({ message: _l('message.select.item')}); cloudStack.dialog.notice({
message: _l('message.select.item')
});
return false; return false;
} }
@ -545,6 +558,7 @@
$listView.find('tr.multi-edit-selected'), $listView.find('tr.multi-edit-selected'),
// Attach VM data to row // Attach VM data to row
function(elem) { function(elem) {
var itemData = $(elem).data('json-obj'); var itemData = $(elem).data('json-obj');
var $subselect = $(elem).find('.subselect select'); var $subselect = $(elem).find('.subselect select');
@ -568,8 +582,7 @@
return true; return true;
} }
}, }, {
{
text: _l('label.cancel'), text: _l('label.cancel'),
'class': 'cancel', 'class': 'cancel',
click: function() { click: function() {
@ -580,8 +593,7 @@
$('div.overlay').remove(); $('div.overlay').remove();
}); });
} }
} }]
]
}).parent('.ui-dialog').overlay(); }).parent('.ui-dialog').overlay();
}, },
@ -696,7 +708,7 @@
}); });
}); });
var itemState=multiRule._itemState ? item[multiRule._itemState] :item.state; var itemState = multiRule._itemState ? item[multiRule._itemState] : item.state;
var $itemState = $('<span>').html(_s(itemState)); var $itemState = $('<span>').html(_s(itemState));
$tr.append($('<td>').addClass('state').appendTo($tr).append("Application State - ").append($itemState)); $tr.append($('<td>').addClass('state').appendTo($tr).append("Application State - ").append($itemState));
@ -708,7 +720,7 @@
if (itemActionID == 'add') if (itemActionID == 'add')
return true; return true;
if(item._hideActions != null && $.inArray(itemActionID, item._hideActions) > -1) if (item._hideActions != null && $.inArray(itemActionID, item._hideActions) > -1)
return true; return true;
var $itemAction = $('<div>').addClass('action').addClass(itemActionID); var $itemAction = $('<div>').addClass('action').addClass(itemActionID);
@ -721,7 +733,9 @@
success: function(args) { success: function(args) {
if (itemActionID == 'destroy') { if (itemActionID == 'destroy') {
var notification = args.notification; var notification = args.notification;
var success = function(args) { $tr.remove(); }; var success = function(args) {
$tr.remove();
};
var successArgs = {}; var successArgs = {};
var error = function(args) { var error = function(args) {
$tr.show(); $tr.show();
@ -756,7 +770,9 @@
}, },
error: function(message) { error: function(message) {
if (message) { if (message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
} }
} }
} }
@ -795,9 +811,9 @@
return $expandable.hide(); return $expandable.hide();
} }
} }
}; };
$.fn.multiEdit = function(args) { $.fn.multiEdit = function(args) {
var dataProvider = args.dataProvider; var dataProvider = args.dataProvider;
var multipleAdd = args.multipleAdd; var multipleAdd = args.multipleAdd;
var tags = args.tags; var tags = args.tags;
@ -893,7 +909,7 @@ $.fn.multiEdit = function(args) {
_medit.refreshItemWidths($multi); _medit.refreshItemWidths($multi);
}, },
error: function(args) { } error: function(args) {}
} }
}); });
} else if (field.edit && field.edit != 'ignore') { } else if (field.edit && field.edit != 'ignore') {
@ -939,8 +955,7 @@ $.fn.multiEdit = function(args) {
$('<div>').addClass('button add-vm custom-action') $('<div>').addClass('button add-vm custom-action')
.html(_l(field.custom.buttonLabel)) .html(_l(field.custom.buttonLabel))
.click(function() { .click(function() {
if (field.custom.requireValidation && if (field.custom.requireValidation && !$multiForm.valid()) return false;
!$multiForm.valid()) return false;
var formData = getMultiData($multi); var formData = getMultiData($multi);
@ -1125,8 +1140,7 @@ $.fn.multiEdit = function(args) {
fields, fields,
$multi, $multi,
itemData, itemData,
actions, actions, {
{
multipleAdd: multipleAdd, multipleAdd: multipleAdd,
itemActions: itemActions, itemActions: itemActions,
noSelect: noSelect, noSelect: noSelect,
@ -1157,12 +1171,14 @@ $.fn.multiEdit = function(args) {
}); });
}; };
if (args.hideForm && args.hideForm()){ if (args.hideForm && args.hideForm()) {
$multiForm.find('tbody').detach(); $multiForm.find('tbody').detach();
} }
// Get existing data // Get existing data
setTimeout(function() { getData(); }); setTimeout(function() {
getData();
});
var fullRefreshEvent = function(event) { var fullRefreshEvent = function(event) {
if ($multi.is(':visible')) { if ($multi.is(':visible')) {

View File

@ -101,7 +101,9 @@
complete: function(args) { complete: function(args) {
clearInterval(pollTimer); clearInterval(pollTimer);
notifications.cornerAlert({ message: $item.html() }); notifications.cornerAlert({
message: $item.html()
});
notifications.activeTasks.pop(pollTimer); notifications.activeTasks.pop(pollTimer);
$item.removeClass('pending'); $item.removeClass('pending');
@ -110,12 +112,16 @@
incomplete: function(args) {}, incomplete: function(args) {},
error: function(args) { error: function(args) {
if (args.message) { if (args.message) {
cloudStack.dialog.notice({ message: _s(args.message) }); cloudStack.dialog.notice({
message: _s(args.message)
});
} }
clearInterval(pollTimer); clearInterval(pollTimer);
notifications.activeTasks.pop(pollTimer); notifications.activeTasks.pop(pollTimer);
notifications.cornerAlert({ message: $item.html() }, { notifications.cornerAlert({
message: $item.html()
}, {
error: _l('label.error') error: _l('label.error')
}); });
$item.removeClass('pending').addClass('error'); $item.removeClass('pending').addClass('error');
@ -203,7 +209,9 @@
) )
) )
) )
.css({ position: 'absolute' }) .css({
position: 'absolute'
})
.data('notifications-attach-to', $attachTo) .data('notifications-attach-to', $attachTo)
.hide(); .hide();
@ -275,7 +283,10 @@
section: notification.section, section: notification.section,
desc: notification.desc, desc: notification.desc,
interval: 0, interval: 0,
poll: function(args) { success(successArgs); args.complete(); } poll: function(args) {
success(successArgs);
args.complete();
}
}); });
} else { } else {
cloudStack.ui.event.call('addNotification', { cloudStack.ui.event.call('addNotification', {

View File

@ -45,6 +45,6 @@
}; };
$(window).bind('resize scroll', function() { $(window).bind('resize scroll', function() {
$('.overlay').css( 'top', $(window).scrollTop()); $('.overlay').css('top', $(window).scrollTop());
}); });
})(window.jQuery); })(window.jQuery);

View File

@ -21,11 +21,13 @@
var value = $form.find('input[name=value]').val(); var value = $form.find('input[name=value]').val();
if (!key || !value) { if (!key || !value) {
cloudStack.dialog.notice({ message: 'Please specify a tag key and value' }); cloudStack.dialog.notice({
message: 'Please specify a tag key and value'
});
return false; return false;
} }
if($form.find('div.field.key').find('label.error').css('display') == 'block' || $form.find('div.field.value').find('label.error').css('display') == 'block') if ($form.find('div.field.key').find('label.error').css('display') == 'block' || $form.find('div.field.value').find('label.error').css('display') == 'block')
return false; return false;
return true; return true;
@ -65,7 +67,8 @@
$value.attr('disabled', false); $value.attr('disabled', false);
// Clear out old data // Clear out old data
$key.val(''); $value.val(''); $key.val('');
$value.val('');
$key.focus(); $key.focus();
}, },
error: function() { error: function() {
@ -83,7 +86,9 @@
return false; return false;
} : } :
function() { return false; } function() {
return false;
}
); );
return $form; return $form;
@ -131,7 +136,7 @@
}), }),
response: { response: {
success: function(args) { success: function(args) {
var notification = $.extend(true, {} , args.notification, { var notification = $.extend(true, {}, args.notification, {
interval: 500, interval: 500,
_custom: args._custom _custom: args._custom
}); });
@ -140,12 +145,14 @@
notification, notification,
// Success // Success
function() { function() {
$loading.remove(); $loading.remove();
$item.remove(); $item.remove();
}, {}, }, {},
// Error // Error
function() { function() {
$loading.remove(); $loading.remove();
}, {} }, {}
@ -153,7 +160,9 @@
}, },
error: function(message) { error: function(message) {
$loading.remove(); $loading.remove();
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
} }
} }
}); });
@ -172,7 +181,7 @@
context: context, context: context,
response: { response: {
success: function(args) { success: function(args) {
var notification = $.extend(true, {} , args.notification, { var notification = $.extend(true, {}, args.notification, {
interval: 500, interval: 500,
_custom: args._custom _custom: args._custom
}); });
@ -181,6 +190,7 @@
notification, notification,
// Success // Success
function() { function() {
$loading.remove(); $loading.remove();
elems.tagItem(title, onRemoveItem, data).appendTo($tagArea); elems.tagItem(title, onRemoveItem, data).appendTo($tagArea);
@ -188,6 +198,7 @@
}, {}, }, {},
// Error // Error
function() { function() {
$loading.remove(); $loading.remove();
error(); error();
@ -197,7 +208,9 @@
error: function(message) { error: function(message) {
$loading.remove(); $loading.remove();
error(); error();
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
} }
} }
}); });
@ -219,7 +232,10 @@
$(data).map(function(index, item) { $(data).map(function(index, item) {
var key = item.key; var key = item.key;
var value = item.value; var value = item.value;
var data = { key: key, value: value }; var data = {
key: key,
value: value
};
elems.tagItem(key + ' = ' + value, onRemoveItem, data).appendTo($tagArea); elems.tagItem(key + ' = ' + value, onRemoveItem, data).appendTo($tagArea);
}); });

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
(function($,cloudStack) { (function($, cloudStack) {
$.widget("cloudStack.toolTip", { $.widget("cloudStack.toolTip", {
_init: function(args) { _init: function(args) {
var context = this.options.context; var context = this.options.context;
@ -28,12 +28,12 @@
$tooltip.appendTo($container); $tooltip.appendTo($container);
if (this.options.mode == 'hover'){ if (this.options.mode == 'hover') {
$(this.element).hover(hoverHandler,outHandler); $(this.element).hover(hoverHandler, outHandler);
} else if (this.options.mode == 'focus'){ } else if (this.options.mode == 'focus') {
$(this.element).focus(hoverHandler); $(this.element).focus(hoverHandler);
$(this.element).blur(outHandler); $(this.element).blur(outHandler);
} else if (this.options.mode == 'manual'){} } else if (this.options.mode == 'manual') {}
$(this.element).data('$tooltip', $tooltip); $(this.element).data('$tooltip', $tooltip);
@ -43,17 +43,17 @@
$tooltip.hide(); $tooltip.hide();
}, },
show: function(){ show: function() {
var o = this.options; var o = this.options;
if(o.mode=='manual'){ if (o.mode == 'manual') {
prepare(this.element,o); prepare(this.element, o);
} }
$(o.toolTip).show(); $(o.toolTip).show();
}, },
hide: function(){ hide: function() {
var o = this.options; var o = this.options;
$(o.toolTip).hide(); $(o.toolTip).hide();
} }
@ -62,22 +62,21 @@
$.extend($.cloudStack.toolTip, { $.extend($.cloudStack.toolTip, {
defaults: { defaults: {
toolTip: '', toolTip: '',
onShow: function(sender){ onShow: function(sender) {
//Flipping arrow and text //Flipping arrow and text
var $tooltip = $('.tooltip-box'); var $tooltip = $('.tooltip-box');
//Switch styles based on how close to viewport border //Switch styles based on how close to viewport border
if($(window).width()-sender.target.offset().left <= $tooltip.width()) { if ($(window).width() - sender.target.offset().left <= $tooltip.width()) {
$('.tooltiptextleft',$tooltip).removeClass('tooltiptextleft').addClass('tooltiptextright'); $('.tooltiptextleft', $tooltip).removeClass('tooltiptextleft').addClass('tooltiptextright');
$('.tooltiparrowleft',$tooltip).removeClass('tooltiparrowleft').addClass('tooltiparrowright'); $('.tooltiparrowleft', $tooltip).removeClass('tooltiparrowleft').addClass('tooltiparrowright');
} } else {
else{ $('.tooltiptextright', $tooltip).removeClass('tooltiptextright').addClass('tooltiptextleft');
$('.tooltiptextright',$tooltip).removeClass('tooltiptextright').addClass('tooltiptextleft'); $('.tooltiparrowright', $tooltip).removeClass('tooltiparrowright').addClass('tooltiparrowleft');
$('.tooltiparrowright',$tooltip).removeClass('tooltiparrowright').addClass('tooltiparrowleft');
} }
}, },
@ -88,7 +87,7 @@
// provide a period for the popup to keep showing // provide a period for the popup to keep showing
period: 2000, period: 2000,
// default the animation algorithm to the basic slide // default the animation algorithm to the basic slide
animation:'slide' animation: 'slide'
}, },
animations: { animations: {
slide: function(e, options) { slide: function(e, options) {
@ -100,65 +99,72 @@
} }
}); });
function hoverHandler(event) function hoverHandler(event) {
{
//Fetch Options //Fetch Options
var o = $.data(this,'toolTip').options; var o = $.data(this, 'toolTip').options;
//Element who raised the event //Element who raised the event
var $this = $(this); var $this = $(this);
//Helper functon for Positioning and Calling Callback function //Helper functon for Positioning and Calling Callback function
prepare($this,o); prepare($this, o);
//Call Show method of the tooltip Widget, //Call Show method of the tooltip Widget,
//Show method should play on any required animations //Show method should play on any required animations
$.data(this,'$tooltip').show(); $.data(this, '$tooltip').show();
}; };
function outHandler(event)
{ function outHandler(event) {
//Fetch Options //Fetch Options
var o = $.data(this,'toolTip').options; var o = $.data(this, 'toolTip').options;
//Get tooptip Element //Get tooptip Element
var $tooltip = $(o.toolTip); var $tooltip = $(o.toolTip);
//If call back method defined, initiate the call //If call back method defined, initiate the call
if($.data(this,'toolTip').options.onHide){ if ($.data(this, 'toolTip').options.onHide) {
$.data(this,'toolTip').options.onHide.call(this, {target:$(this)}); $.data(this, 'toolTip').options.onHide.call(this, {
target: $(this)
});
} }
//Call Hide method of the tooltip Widget, //Call Hide method of the tooltip Widget,
//Hide method should play on any required animations //Hide method should play on any required animations
$.data(this,'$tooltip').hide(); $.data(this, '$tooltip').hide();
}; };
function prepare(jObj, options)
{ function prepare(jObj, options) {
var $tooltip = $(options.tooltip); var $tooltip = $(options.tooltip);
var element = options.attachTo ? var element = options.attachTo ?
jObj.closest(options.attachTo) : jObj; jObj.closest(options.attachTo) : jObj;
var offset = element.offset(); var offset = element.offset();
var left = offset.left + element.width(); var left = offset.left + element.width();
var top = offset.top-5; var top = offset.top - 5;
if(options.onShow){ if (options.onShow) {
options.onShow.call(this, {target:jObj}); options.onShow.call(this, {
target: jObj
});
} }
if($(window).width()-offset.left <= $tooltip.width()) { if ($(window).width() - offset.left <= $tooltip.width()) {
left = offset.left - $tooltip.width(); left = offset.left - $tooltip.width();
} } else {
else{
left += 35; left += 35;
} }
$tooltip.css({position:'absolute', top:top+'px', left:left+'px'}); $tooltip.css({
position: 'absolute',
top: top + 'px',
left: left + 'px'
});
// Fix overlay // Fix overlay
setTimeout(function() { setTimeout(function() {
$('.tooltip-box').zIndex($(':ui-dialog').zIndex() + 10); }); $('.tooltip-box').zIndex($(':ui-dialog').zIndex() + 10);
});
}; };
})(jQuery,cloudStack); })(jQuery, cloudStack);

View File

@ -117,7 +117,9 @@
$panel.detailView($.extend(treeViewArgs.detailView, { $panel.detailView($.extend(treeViewArgs.detailView, {
id: $li.data('tree-view-item-id'), id: $li.data('tree-view-item-id'),
$browser: $browser, $browser: $browser,
context: { domains: [ $li.data('tree-view-item-obj') ] } context: {
domains: [$li.data('tree-view-item-obj')]
}
})); }));
} }
}); });
@ -134,8 +136,12 @@
}); });
if (actionName == 'destroy') { if (actionName == 'destroy') {
$li.animate({ opacity: 0.5 }); $li.animate({
$li.bind('click', function() { return false; }); opacity: 0.5
});
$li.bind('click', function() {
return false;
});
} }
}); });

View File

@ -32,14 +32,14 @@
'Error': 'off' 'Error': 'off'
} }
}, },
type:{ type: {
label: 'label.vmsnapshot.type' label: 'label.vmsnapshot.type'
}, },
current:{ current: {
label: 'label.vmsnapshot.current', label: 'label.vmsnapshot.current',
converter: cloudStack.converters.toBooleanText converter: cloudStack.converters.toBooleanText
}, },
parentName:{ parentName: {
label: 'label.vmsnapshot.parentname' label: 'label.vmsnapshot.parentname'
}, },
created: { created: {
@ -124,7 +124,10 @@
} }
}); });
}, },
tags: cloudStack.api.tags({ resourceType: 'VMSnapshot', contextId: 'vmsnapshots' }) tags: cloudStack.api.tags({
resourceType: 'VMSnapshot',
contextId: 'vmsnapshots'
})
} }
}, },
actions: { actions: {
@ -146,11 +149,11 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.deletevmsnapshotresponse.jobid; var jid = json.deletevmsnapshotresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid} jobId: jid
} }
); });
} }
}); });
}, },

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff