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
@ -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({
id: "",
description: ""
});
for (var p in timezoneMap) for (var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]}); items.push({
args.response.success({data: items}); 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
}
} }
} }
}, },
@ -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));
@ -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: {
@ -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
@ -723,7 +779,8 @@
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
} });
);
} }
}); });
} }
@ -905,7 +963,11 @@
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: {
page: args.page,
pageSize: pageSize,
listAll: true
},
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
data: json.listconfigurationsresponse.configuration data: json.listconfigurationsresponse.configuration
@ -934,7 +996,9 @@
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,9 +1022,16 @@
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];
@ -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
@ -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({
id: "",
description: ""
});
for (var p in timezoneMap) for (var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]}); items.push({
args.response.success({data: items}); id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
} }
} }
} }
@ -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,41 +1431,60 @@
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',
@ -1378,14 +1497,21 @@
isEditable: true, isEditable: true,
select: function(args) { select: function(args) {
var items = []; var items = [];
items.push({id: "", description: ""}); items.push({
id: "",
description: ""
});
for (var p in timezoneMap) for (var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]}); items.push({
args.response.success({data: items}); id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
} }
} }
} }],
],
dataProvider: function(args) { dataProvider: function(args) {
if (isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
@ -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]

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'
@ -71,10 +79,15 @@
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
})
} }
}); });
} }
@ -88,22 +101,23 @@
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;
} }
} }
} });
);
} }
}); });
}, },
@ -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
});
} }
}); });
} }

View File

@ -85,15 +85,13 @@
var allowedActions = []; var allowedActions = [];
if (args.context.originalAutoscaleData == null) { //new LB rule if (args.context.originalAutoscaleData == null) { //new LB rule
//no actions for new LB rule //no actions for new LB rule
} } else { //existing LB rule
else { //existing LB rule
if (args.context.originalAutoscaleData[0].afterActionIsComplete == null) { if (args.context.originalAutoscaleData[0].afterActionIsComplete == null) {
if (args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'disabled') if (args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'disabled')
allowedActions.push('enable'); allowedActions.push('enable');
else if (args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'enabled') else if (args.context.originalAutoscaleData[0].context.autoscaleVmGroup.state == 'enabled')
allowedActions.push('disable'); allowedActions.push('disable');
} } else {
else {
if (args.context.originalAutoscaleData[0].afterActionIsComplete.state == 'disabled') if (args.context.originalAutoscaleData[0].afterActionIsComplete.state == 'disabled')
allowedActions.push('enable'); allowedActions.push('enable');
else if (args.context.originalAutoscaleData[0].afterActionIsComplete.state == 'enabled') else if (args.context.originalAutoscaleData[0].afterActionIsComplete.state == 'enabled')
@ -110,9 +108,10 @@
totalScaleDownCondition = 0; totalScaleDownCondition = 0;
if (!('multiRules' in args.context)) { //from a new LB if (!('multiRules' in args.context)) { //from a new LB
args.response.success({ data: null }); args.response.success({
} data: null
else { //from an existing LB });
} else { //from an existing LB
$.ajax({ $.ajax({
url: createURL('listAutoScaleVmGroups'), url: createURL('listAutoScaleVmGroups'),
data: { data: {
@ -196,7 +195,9 @@
//isAdvanced: false // Set this to true if any advanced field data is present //isAdvanced: false // Set this to true if any advanced field data is present
}; };
args.response.success({ data: originalAutoscaleData }); args.response.success({
data: originalAutoscaleData
});
} }
}); });
} }
@ -346,7 +347,10 @@
}, },
bottomFields: { bottomFields: {
isAdvanced: { isBoolean: true, label: 'Show advanced settings' }, isAdvanced: {
isBoolean: true,
label: 'Show advanced settings'
},
interval: { interval: {
label: 'Polling Interval (in sec)', label: 'Polling Interval (in sec)',
defaultValue: '30', defaultValue: '30',
@ -387,11 +391,19 @@
success: function(json) { success: function(json) {
var securitygroups = json.listsecuritygroupsresponse.securitygroup; var securitygroups = json.listsecuritygroupsresponse.securitygroup;
var items = []; var items = [];
items.push({id: "", description: ""}); items.push({
$(securitygroups).each(function(){ id: "",
items.push({id: this.id, description: this.name}); description: ""
});
$(securitygroups).each(function() {
items.push({
id: this.id,
description: this.name
});
});
args.response.success({
data: items
}); });
args.response.success({ data: items });
} }
}); });
} }
@ -409,11 +421,19 @@
success: function(json) { success: function(json) {
var diskofferings = json.listdiskofferingsresponse.diskoffering; var diskofferings = json.listdiskofferingsresponse.diskoffering;
var items = []; var items = [];
items.push({id: "", description: ""}); items.push({
$(diskofferings).each(function(){ id: "",
items.push({id: this.id, description: this.name}); description: ""
});
$(diskofferings).each(function() {
items.push({
id: this.id,
description: this.name
});
});
args.response.success({
data: items
}); });
args.response.success({ data: items });
} }
}); });
} }
@ -424,7 +444,9 @@
dependsOn: 'isAdvanced', dependsOn: 'isAdvanced',
label: 'SNMP Community', label: 'SNMP Community',
defaultValue: 'public', defaultValue: 'public',
validation: { required: true } validation: {
required: true
}
}, },
snmpPort: { snmpPort: {
@ -455,18 +477,26 @@
success: function(json) { success: function(json) {
var users = json.listusersresponse.user; var users = json.listusersresponse.user;
$(users).each(function() { $(users).each(function() {
items.push({id: this.id, description: this.username}); items.push({
id: this.id,
description: this.username
}); });
args.response.success({ data: items }); });
} args.response.success({
data: items
}); });
} }
else { //regular user doesn't have access to listUers API call. });
items.push({id: "", description: ""}); } else { //regular user doesn't have access to listUers API call.
args.response.success({ data: items }); items.push({
id: "",
description: ""
});
args.response.success({
data: items
});
} }
} } else { //existing LB rule
else { //existing LB rule
if (isAdmin() || isDomainAdmin()) { if (isAdmin() || isDomainAdmin()) {
$.ajax({ $.ajax({
url: createURL('listUsers'), url: createURL('listUsers'),
@ -477,15 +507,24 @@
success: function(json) { success: function(json) {
var users = json.listusersresponse.user; var users = json.listusersresponse.user;
$(users).each(function() { $(users).each(function() {
items.push({id: this.id, description: this.username}); items.push({
id: this.id,
description: this.username
}); });
args.response.success({ data: items }); });
} args.response.success({
data: items
}); });
} }
else { //regular user doesn't have access to listUers API call. });
items.push({id: "", description: ""}); } else { //regular user doesn't have access to listUers API call.
args.response.success({ data: items }); items.push({
id: "",
description: ""
});
args.response.success({
data: items
});
} }
} }
} }
@ -524,17 +563,29 @@
label: 'Operator', label: 'Operator',
select: function(args) { select: function(args) {
args.response.success({ args.response.success({
data: [ data: [{
{ name: 'GT', description: 'greater-than' }, name: 'GT',
{ name: 'GE', description: 'greater-than or equals to' }, description: 'greater-than'
{ name: 'LT', description: 'less-than' }, }, {
{ name: 'LE', description: 'less-than or equals to' }, name: 'GE',
{ name: 'EQ', description: 'equals-to' } description: 'greater-than or equals to'
] }, {
name: 'LT',
description: 'less-than'
}, {
name: 'LE',
description: 'less-than or equals to'
}, {
name: 'EQ',
description: 'equals-to'
}]
}); });
} }
}, },
'threshold': { edit: true, label: 'Threshold' }, 'threshold': {
edit: true,
label: 'Threshold'
},
'add-scaleUpcondition': { 'add-scaleUpcondition': {
label: 'label.add', label: 'label.add',
addButton: true addButton: true
@ -616,17 +667,29 @@
label: 'Operator', label: 'Operator',
select: function(args) { select: function(args) {
args.response.success({ args.response.success({
data: [ data: [{
{ name: 'GT', description: 'greater-than' }, name: 'GT',
{ name: 'GE', description: 'greater-than or equals to' }, description: 'greater-than'
{ name: 'LT', description: 'less-than' }, }, {
{ name: 'LE', description: 'less-than or equals to' }, name: 'GE',
{ name: 'EQ', description: 'equals-to' } description: 'greater-than or equals to'
] }, {
name: 'LT',
description: 'less-than'
}, {
name: 'LE',
description: 'less-than or equals to'
}, {
name: 'EQ',
description: 'equals-to'
}]
}); });
} }
}, },
'threshold': { edit: true, label: 'Threshold'}, 'threshold': {
edit: true,
label: 'Threshold'
},
'add-scaleDowncondition': { 'add-scaleDowncondition': {
label: 'label.add', label: 'label.add',
addButton: true addButton: true
@ -684,15 +747,13 @@
args.response.error('Name, Public Port, Private Port of Load Balancing are required. Please close this dialog box and fill Name, Public Port, Private Port first.'); args.response.error('Name, Public Port, Private Port of Load Balancing are required. Please close this dialog box and fill Name, Public Port, Private Port first.');
return; return;
} }
} } else { //from an existing LB
else { //from an existing LB
if (args.context.originalAutoscaleData.afterActionIsComplete == null) { if (args.context.originalAutoscaleData.afterActionIsComplete == null) {
if (args.context.originalAutoscaleData.context.autoscaleVmGroup.state != 'disabled') { if (args.context.originalAutoscaleData.context.autoscaleVmGroup.state != 'disabled') {
args.response.error('An Autoscale VM Group can be updated only if it is in disabled state. Please disable the Autoscale VM Group first.'); args.response.error('An Autoscale VM Group can be updated only if it is in disabled state. Please disable the Autoscale VM Group first.');
return; return;
} }
} } else {
else {
if (args.context.originalAutoscaleData.afterActionIsComplete.state != 'disabled') { if (args.context.originalAutoscaleData.afterActionIsComplete.state != 'disabled') {
args.response.error('An Autoscale VM Group can be updated only if it is in disabled state. Please disable the Autoscale VM Group first.'); args.response.error('An Autoscale VM Group can be updated only if it is in disabled state. Please disable the Autoscale VM Group first.');
return; return;
@ -805,8 +866,7 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; return;
} } else {
else {
clearInterval(createConditionIntervalID); clearInterval(createConditionIntervalID);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
var item = json.queryasyncjobresultresponse.jobresult.condition; var item = json.queryasyncjobresultresponse.jobresult.condition;
@ -832,16 +892,14 @@
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(createAutoScalePolicyInterval); clearInterval(createAutoScalePolicyInterval);
if (result.jobstatus == 1) { //AutoScalePolicy successfully created if (result.jobstatus == 1) { //AutoScalePolicy successfully created
var item = result.jobresult.autoscalepolicy; var item = result.jobresult.autoscalepolicy;
scaleDown($.extend(args, { scaleDown($.extend(args, {
scaleUpPolicyResponse: item scaleUpPolicyResponse: item
})); }));
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -853,8 +911,7 @@
args.response.error(parseXMLHttpResponse(XMLHttpResponse)); args.response.error(parseXMLHttpResponse(XMLHttpResponse));
} }
}); });
} } else { //from an existing LB
else { //from an existing LB
var data = { var data = {
id: args.context.originalAutoscaleData.scaleUpPolicy.id, id: args.context.originalAutoscaleData.scaleUpPolicy.id,
conditionids: scaleUpConditionIds.join(","), conditionids: scaleUpConditionIds.join(","),
@ -874,8 +931,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(updateAutoScalePolicyInterval); clearInterval(updateAutoScalePolicyInterval);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
var item = result.jobresult.autoscalepolicy; var item = result.jobresult.autoscalepolicy;
@ -893,8 +949,7 @@
scaleDown($.extend(args, { scaleDown($.extend(args, {
scaleUpPolicyResponse: item scaleUpPolicyResponse: item
})); }));
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -908,8 +963,7 @@
}); });
} }
} }
} } else if (result.jobstatus == 2) {
else if(result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -944,8 +998,7 @@
var result = json.queryasyncjobresultresponse; var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) { if (result.jobstatus == 0) {
return; return;
} } else {
else {
clearInterval(createConditionIntervalID); clearInterval(createConditionIntervalID);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
var item = json.queryasyncjobresultresponse.jobresult.condition; var item = json.queryasyncjobresultresponse.jobresult.condition;
@ -971,16 +1024,14 @@
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(createAutoScalePolicyInterval); clearInterval(createAutoScalePolicyInterval);
if (result.jobstatus == 1) { //AutoScalePolicy successfully created if (result.jobstatus == 1) { //AutoScalePolicy successfully created
var item = result.jobresult.autoscalepolicy; var item = result.jobresult.autoscalepolicy;
createOrUpdateVmProfile($.extend(args, { createOrUpdateVmProfile($.extend(args, {
scaleDownPolicyResponse: item scaleDownPolicyResponse: item
})); }));
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -992,8 +1043,7 @@
args.response.error(parseXMLHttpResponse(XMLHttpResponse)); args.response.error(parseXMLHttpResponse(XMLHttpResponse));
} }
}); });
} } else { //from an existing LB
else { //from an existing LB
var data = { var data = {
id: args.context.originalAutoscaleData.scaleDownPolicy.id, id: args.context.originalAutoscaleData.scaleDownPolicy.id,
conditionids: scaleDownConditionIds.join(","), conditionids: scaleDownConditionIds.join(","),
@ -1014,8 +1064,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(updateAutoScalePolicyInterval); clearInterval(updateAutoScalePolicyInterval);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
var item = result.jobresult.autoscalepolicy; var item = result.jobresult.autoscalepolicy;
@ -1033,8 +1082,7 @@
createOrUpdateVmProfile($.extend(args, { createOrUpdateVmProfile($.extend(args, {
scaleDownPolicyResponse: item scaleDownPolicyResponse: item
})); }));
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1048,8 +1096,7 @@
}); });
} }
} }
} } else if (result.jobstatus == 2) {
else if(result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1131,14 +1178,12 @@
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(autoscaleVmProfileTimer); clearInterval(autoscaleVmProfileTimer);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
scaleVmProfileResponse = result.jobresult.autoscalevmprofile; scaleVmProfileResponse = result.jobresult.autoscalevmprofile;
loadBalancer(args); //create a load balancer rule loadBalancer(args); //create a load balancer rule
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1150,8 +1195,7 @@
args.response.error(parseXMLHttpResponse(XMLHttpResponse)); args.response.error(parseXMLHttpResponse(XMLHttpResponse));
} }
}); });
} } else { //from an existing LB
else { //from an existing LB
var data = { var data = {
id: args.context.originalAutoscaleData.context.autoscaleVmProfile.id, id: args.context.originalAutoscaleData.context.autoscaleVmProfile.id,
templateid: args.data.templateNames, templateid: args.data.templateNames,
@ -1201,14 +1245,12 @@
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(autoscaleVmProfileTimer); clearInterval(autoscaleVmProfileTimer);
if (result.jobstatus == 1) { if (result.jobstatus == 1) {
scaleVmProfileResponse = result.jobresult.autoscalevmprofile; scaleVmProfileResponse = result.jobresult.autoscalevmprofile;
autoScaleVmGroup(args); //update autoScaleVmGroup autoScaleVmGroup(args); //update autoScaleVmGroup
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1227,12 +1269,13 @@
var networkid; var networkid;
if ('vpc' in args.context) { //from VPC section if ('vpc' in args.context) { //from VPC section
if (args.data.tier == null) { if (args.data.tier == null) {
cloudStack.dialog.notice({ message: 'Tier is required' }); cloudStack.dialog.notice({
message: 'Tier is required'
});
return; return;
} }
networkid = args.data.tier; networkid = args.data.tier;
} } else if ('networks' in args.context) { //from Guest Network section
else if('networks' in args.context) { //from Guest Network section
networkid = args.context.networks[0].id; networkid = args.context.networks[0].id;
} }
var data = { var data = {
@ -1247,8 +1290,7 @@
data = $.extend(data, { data = $.extend(data, {
publicipid: args.context.ipAddresses[0].id publicipid: args.context.ipAddresses[0].id
}); });
} } else {
else {
data = $.extend(data, { data = $.extend(data, {
domainid: g_domainid, domainid: g_domainid,
account: g_account account: g_account
@ -1270,14 +1312,12 @@
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(loadBalancerTimer); clearInterval(loadBalancerTimer);
if (result.jobstatus == 1) { //LoadBalancerRule successfully created if (result.jobstatus == 1) { //LoadBalancerRule successfully created
loadBalancerResponse = result.jobresult.loadbalancer; loadBalancerResponse = result.jobresult.loadbalancer;
autoScaleVmGroup(args); autoScaleVmGroup(args);
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1315,14 +1355,12 @@
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(scaleVmGroupTimer); clearInterval(scaleVmGroupTimer);
if (result.jobstatus == 1) { //autoscale Vm group successfully created if (result.jobstatus == 1) { //autoscale Vm group successfully created
scaleVmGroupResponse = result.jobresult.autoscalevmgroup; scaleVmGroupResponse = result.jobresult.autoscalevmgroup;
args.response.success(); args.response.success();
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1334,8 +1372,7 @@
args.response.error(parseXMLHttpResponse(XMLHttpResponse)); args.response.error(parseXMLHttpResponse(XMLHttpResponse));
} }
}); });
} } else { //from an existing LB
else { //from an existing LB
var data = { var data = {
id: args.context.originalAutoscaleData.context.autoscaleVmGroup.id, id: args.context.originalAutoscaleData.context.autoscaleVmGroup.id,
minmembers: args.data.minInstance, minmembers: args.data.minInstance,
@ -1358,13 +1395,11 @@
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(updateAutoScaleVmGroupTimer); clearInterval(updateAutoScaleVmGroupTimer);
if (result.jobstatus == 1) { //autoscale Vm group successfully created if (result.jobstatus == 1) { //autoscale Vm group successfully created
args.response.success(); args.response.success();
} } else if (result.jobstatus == 2) {
else if (result.jobstatus == 2) {
args.response.error(_s(result.jobresult.errortext)); args.response.error(_s(result.jobresult.errortext));
} }
} }
@ -1420,7 +1455,9 @@
$(this).attr('style', 'float: right'); $(this).attr('style', 'float: right');
}); });
var $field = $('<div>').addClass('field username'); var $field = $('<div>').addClass('field username');
var $input = $('<input>').attr({ name: 'username' }); var $input = $('<input>').attr({
name: 'username'
});
var $inputLabel = $('<label>').html('Username'); var $inputLabel = $('<label>').html('Username');
$field.append($input, $inputLabel); $field.append($input, $inputLabel);

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
@ -74,5 +81,3 @@ $(document).ready(function() {
}); });
} }
}); });

View File

@ -23,14 +23,11 @@
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"];
} }
@ -92,17 +89,22 @@
} }
} }
} }
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;
} }
} }
@ -134,8 +136,7 @@
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;
@ -158,18 +159,26 @@
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;
@ -255,8 +264,7 @@
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,18 +323,26 @@
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;
@ -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 : []
})); }));
} }
}); });
@ -143,15 +142,12 @@
}, },
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

@ -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');
@ -228,7 +228,9 @@
}); });
} }
args.response.success({data: domainObj}); args.response.success({
data: domainObj
});
} }
}, },
@ -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,8 +325,7 @@
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) {
@ -328,11 +335,14 @@
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',
@ -428,11 +438,16 @@
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;
@ -452,8 +467,7 @@
totalVMs += items[i].vmtotal; totalVMs += items[i].vmtotal;
totalVolumes += items[i].volumetotal; totalVolumes += items[i].volumetotal;
} }
} } else {
else {
domainObj["accountTotal"] = 0; domainObj["accountTotal"] = 0;
} }
} }
@ -579,8 +593,7 @@
}); });
} }
}); });
} } else {
else {
$.ajax({ $.ajax({
url: createURL("listDomainChildren&id=" + parentDomain.id), url: createURL("listDomainChildren&id=" + parentDomain.id),
dataType: "json", dataType: "json",

View File

@ -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: {
@ -58,7 +71,10 @@
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',
@ -71,10 +87,14 @@
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({
@ -108,18 +128,29 @@
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({
@ -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'
}]
}); });
} }
}, },
@ -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,8 +226,7 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
@ -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
});
} }
}); });
}, },
@ -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: {
@ -349,8 +420,15 @@
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) {
@ -358,10 +436,14 @@
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({
@ -395,18 +477,29 @@
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({
@ -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
});
} }
}); });
}, },
@ -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

@ -42,10 +42,16 @@
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,7 +91,9 @@
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
});
} }
}); });
} }
@ -90,10 +107,18 @@
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'
@ -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));
@ -152,13 +179,17 @@
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"),
@ -166,7 +197,9 @@
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
});
} }
}); });
} }
@ -194,20 +227,64 @@
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
}
}
} }
@ -233,9 +310,7 @@
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({
@ -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
}
}); });
} }
}); });

View File

@ -77,16 +77,23 @@
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
}
});
} }
}); });
} }
@ -129,8 +136,7 @@
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;
@ -145,8 +151,7 @@
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;
@ -161,8 +166,7 @@
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;
@ -178,8 +182,7 @@
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;
} }
} }
@ -191,8 +194,7 @@
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;
} }
} }
@ -204,8 +206,7 @@
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;
} }
} }
@ -275,8 +276,7 @@
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
}
}); });
} }
}); });
@ -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
}
}); });
} }
}); });
@ -325,7 +329,9 @@
selectedObj: args.context.affinityGroups[0] selectedObj: args.context.affinityGroups[0]
}); });
} }
args.response.success({data: data}); args.response.success({
data: data
});
} }
}); });
}, },
@ -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),
@ -393,15 +398,15 @@
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
@ -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: {
@ -581,12 +582,10 @@
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 = [];
} }
@ -601,12 +600,10 @@
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 = [];
} }
@ -656,17 +653,14 @@
} }
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 = [];
} }
@ -681,12 +675,10 @@
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 = [];
} }
@ -704,8 +696,7 @@
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);
@ -735,9 +726,9 @@
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)
@ -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

@ -32,8 +32,7 @@
$.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
}); });
@ -50,8 +49,7 @@
} }
} }
}); });
} } 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
@ -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,8 +692,12 @@
}, },
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',
@ -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,8 +728,7 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
@ -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({
@ -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';
}
} }
} }
} }

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,9 +51,15 @@
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: {
@ -62,15 +71,32 @@
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,12 +335,20 @@
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',
@ -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,8 +379,7 @@
}); });
} }
}); });
} } else {
else {
args.response.success({ args.response.success({
data: null data: null
}); });
@ -343,26 +413,31 @@
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, {
description: args.data.description
});
if (args.data.domainid != null && args.data.domainid.length > 0) if (args.data.domainid != null && args.data.domainid.length > 0)
$.extend(data, { domainid: args.data.domainid }); $.extend(data, {
domainid: args.data.domainid
});
if (args.data.account != null && args.data.account.length > 0) if (args.data.account != null && args.data.account.length > 0)
$.extend(data, { account: args.data.account }); $.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;
} }
} }
} });
);
} }
}); });
}, },
@ -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
}
} }
} }
}, },
@ -611,16 +717,26 @@
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) {
@ -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 = {
@ -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'),

View File

@ -59,22 +59,21 @@ var pollAsyncJobResult = function(args) {
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 {
if (result.jobstatus == 1) { // Succeeded if (result.jobstatus == 1) { // Succeeded
if (args._custom.getUpdatedItem != null && args._custom.getActionFilter != null) { if (args._custom.getUpdatedItem != null && args._custom.getActionFilter != null) {
args.complete({ args.complete({
data: args._custom.getUpdatedItem(json), data: args._custom.getUpdatedItem(json),
actionFilter: args._custom.getActionFilter() actionFilter: args._custom.getActionFilter()
}); });
} } else if (args._custom.getUpdatedItem != null && args._custom.getActionFilter == null) {
else if(args._custom.getUpdatedItem != null && args._custom.getActionFilter == null) {
args.complete({ args.complete({
data: args._custom.getUpdatedItem(json) data: args._custom.getUpdatedItem(json)
}); });
} } else {
else { args.complete({
args.complete({ data: json.queryasyncjobresultresponse.jobresult }); data: json.queryasyncjobresultresponse.jobresult
});
} }
if (args._custom.fullRefreshAfterComplete == true) { if (args._custom.fullRefreshAfterComplete == true) {
@ -86,16 +85,23 @@ var pollAsyncJobResult = function(args) {
if (args._custom.onComplete) { if (args._custom.onComplete) {
args._custom.onComplete(json, args._custom); args._custom.onComplete(json, args._custom);
} }
} } else if (result.jobstatus == 2) { // Failed
else if (result.jobstatus == 2) { // Failed
var msg = (result.jobresult.errortext == null) ? "" : result.jobresult.errortext; var msg = (result.jobresult.errortext == null) ? "" : result.jobresult.errortext;
if (args._custom.getUpdatedItemWhenAsyncJobFails != null && args._custom.getActionFilter != null) { if (args._custom.getUpdatedItemWhenAsyncJobFails != null && args._custom.getActionFilter != null) {
args.error({message: msg, updatedData: args._custom.getUpdatedItemWhenAsyncJobFails(), actionFilter: args._custom.getActionFilter()}); args.error({
message: msg,
updatedData: args._custom.getUpdatedItemWhenAsyncJobFails(),
actionFilter: args._custom.getActionFilter()
});
} else if (args._custom.getUpdatedItemWhenAsyncJobFails != null && args._custom.getActionFilter == null) { } else if (args._custom.getUpdatedItemWhenAsyncJobFails != null && args._custom.getActionFilter == null) {
args.error({message: msg, updatedData: args._custom.getUpdatedItemWhenAsyncJobFails()}); args.error({
} message: msg,
else { updatedData: args._custom.getUpdatedItemWhenAsyncJobFails()
args.error({message: msg}); });
} else {
args.error({
message: msg
});
} }
} }
} }
@ -107,6 +113,7 @@ var pollAsyncJobResult = function(args) {
} }
//API calls //API calls
function createURL(apiName, options) { function createURL(apiName, options) {
if (!options) options = {}; if (!options) options = {};
var urlString = clientApiUrl + "?" + "command=" + apiName + "&response=json&sessionkey=" + g_sessionKey; var urlString = clientApiUrl + "?" + "command=" + apiName + "&response=json&sessionkey=" + g_sessionKey;
@ -162,8 +169,7 @@ var addGuestNetworkDialog = {
if ('zones' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog if ('zones' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog
args.$form.find('.form-item[rel=zoneId]').hide(); args.$form.find('.form-item[rel=zoneId]').hide();
args.$form.find('.form-item[rel=physicalNetworkId]').hide(); args.$form.find('.form-item[rel=physicalNetworkId]').hide();
} } else { //Network menu > guest network section > add guest network dialog
else {//Network menu > guest network section > add guest network dialog
args.$form.find('.form-item[rel=zoneId]').css('display', 'inline-block'); args.$form.find('.form-item[rel=zoneId]').css('display', 'inline-block');
args.$form.find('.form-item[rel=physicalNetworkId]').css('display', 'inline-block'); args.$form.find('.form-item[rel=physicalNetworkId]').css('display', 'inline-block');
} }
@ -173,23 +179,28 @@ var addGuestNetworkDialog = {
name: { name: {
docID: 'helpGuestNetworkZoneName', docID: 'helpGuestNetworkZoneName',
label: 'label.name', label: 'label.name',
validation: { required: true } validation: {
required: true
}
}, },
description: { description: {
label: 'label.description', label: 'label.description',
docID: 'helpGuestNetworkZoneDescription', docID: 'helpGuestNetworkZoneDescription',
validation: { required: true } validation: {
required: true
}
}, },
zoneId: { zoneId: {
label: 'label.zone', label: 'label.zone',
validation: { required: true }, validation: {
required: true
},
docID: 'helpGuestNetworkZone', docID: 'helpGuestNetworkZone',
select: function(args) { select: function(args) {
if ('zones' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog if ('zones' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog
addGuestNetworkDialog.zoneObjs = args.context.zones; //i.e. only one zone entry addGuestNetworkDialog.zoneObjs = args.context.zones; //i.e. only one zone entry
} } else { //Network menu > guest network section > add guest network dialog
else {//Network menu > guest network section > add guest network dialog
$.ajax({ $.ajax({
url: createURL('listZones'), url: createURL('listZones'),
async: false, async: false,
@ -224,8 +235,7 @@ var addGuestNetworkDialog = {
select: function(args) { select: function(args) {
if ('physicalNetworks' in args.context) { if ('physicalNetworks' in args.context) {
addGuestNetworkDialog.physicalNetworkObjs = args.context.physicalNetworks; addGuestNetworkDialog.physicalNetworkObjs = args.context.physicalNetworks;
} } else {
else {
var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val(); var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();
$.ajax({ $.ajax({
url: createURL('listPhysicalNetworks'), url: createURL('listPhysicalNetworks'),
@ -241,10 +251,15 @@ var addGuestNetworkDialog = {
var items = []; var items = [];
if (addGuestNetworkDialog.physicalNetworkObjs != null) { if (addGuestNetworkDialog.physicalNetworkObjs != null) {
for (var i = 0; i < addGuestNetworkDialog.physicalNetworkObjs.length; i++) { for (var i = 0; i < addGuestNetworkDialog.physicalNetworkObjs.length; i++) {
items.push({ id: addGuestNetworkDialog.physicalNetworkObjs[i].id, description: addGuestNetworkDialog.physicalNetworkObjs[i].name }); items.push({
id: addGuestNetworkDialog.physicalNetworkObjs[i].id,
description: addGuestNetworkDialog.physicalNetworkObjs[i].name
});
} }
} }
args.response.success({data: items}); args.response.success({
data: items
});
}, },
isHidden: true isHidden: true
}, },
@ -274,15 +289,31 @@ var addGuestNetworkDialog = {
var array1 = []; var array1 = [];
if (selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) { if (selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) {
array1.push({id: 'zone-wide', description: 'All'}); array1.push({
id: 'zone-wide',
description: 'All'
});
} else {
array1.push({
id: 'zone-wide',
description: 'All'
});
array1.push({
id: 'domain-specific',
description: 'Domain'
});
array1.push({
id: 'account-specific',
description: 'Account'
});
array1.push({
id: 'project-specific',
description: 'Project'
});
} }
else { args.response.success({
array1.push({id: 'zone-wide', description: 'All'}); data: array1
array1.push({id: 'domain-specific', description: 'Domain'}); });
array1.push({id: 'account-specific', description: 'Account'});
array1.push({id: 'project-specific', description: 'Project'});
}
args.response.success({data: array1});
args.$select.change(function() { args.$select.change(function() {
var $form = $(this).closest('form'); var $form = $(this).closest('form');
@ -291,20 +322,17 @@ var addGuestNetworkDialog = {
$form.find('.form-item[rel=subdomainaccess]').hide(); $form.find('.form-item[rel=subdomainaccess]').hide();
$form.find('.form-item[rel=account]').hide(); $form.find('.form-item[rel=account]').hide();
$form.find('.form-item[rel=projectId]').hide(); $form.find('.form-item[rel=projectId]').hide();
} } else if ($(this).val() == "domain-specific") {
else if ($(this).val() == "domain-specific") {
$form.find('.form-item[rel=domainId]').css('display', 'inline-block'); $form.find('.form-item[rel=domainId]').css('display', 'inline-block');
$form.find('.form-item[rel=subdomainaccess]').css('display', 'inline-block'); $form.find('.form-item[rel=subdomainaccess]').css('display', 'inline-block');
$form.find('.form-item[rel=account]').hide(); $form.find('.form-item[rel=account]').hide();
$form.find('.form-item[rel=projectId]').hide(); $form.find('.form-item[rel=projectId]').hide();
} } else if ($(this).val() == "account-specific") {
else if($(this).val() == "account-specific") {
$form.find('.form-item[rel=domainId]').css('display', 'inline-block'); $form.find('.form-item[rel=domainId]').css('display', 'inline-block');
$form.find('.form-item[rel=subdomainaccess]').hide(); $form.find('.form-item[rel=subdomainaccess]').hide();
$form.find('.form-item[rel=account]').css('display', 'inline-block'); $form.find('.form-item[rel=account]').css('display', 'inline-block');
$form.find('.form-item[rel=projectId]').hide(); $form.find('.form-item[rel=projectId]').hide();
} } else if ($(this).val() == "project-specific") {
else if($(this).val() == "project-specific") {
$form.find('.form-item[rel=domainId]').css('display', 'inline-block'); $form.find('.form-item[rel=domainId]').css('display', 'inline-block');
$form.find('.form-item[rel=subdomainaccess]').hide(); $form.find('.form-item[rel=subdomainaccess]').hide();
$form.find('.form-item[rel=account]').hide(); $form.find('.form-item[rel=account]').hide();
@ -315,7 +343,9 @@ var addGuestNetworkDialog = {
}, },
domainId: { domainId: {
label: 'label.domain', label: 'label.domain',
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
var items = []; var items = [];
var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val(); var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();
@ -336,7 +366,10 @@ var addGuestNetworkDialog = {
success: function(json) { success: function(json) {
var domainObjs = json.listdomainchildrenresponse.domain; var domainObjs = json.listdomainchildrenresponse.domain;
$(domainObjs).each(function() { $(domainObjs).each(function() {
items.push({id: this.id, description: this.path}); items.push({
id: this.id,
description: this.path
});
}); });
} }
}); });
@ -347,12 +380,14 @@ var addGuestNetworkDialog = {
success: function(json) { success: function(json) {
var domainObjs = json.listdomainsresponse.domain; var 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
});
}); });
} }
}); });
} } else { //list all domains
else { //list all domains
$.ajax({ $.ajax({
url: createURL("listDomains&listAll=true"), url: createURL("listDomains&listAll=true"),
dataType: "json", dataType: "json",
@ -360,22 +395,33 @@ var addGuestNetworkDialog = {
success: function(json) { success: function(json) {
var domainObjs = json.listdomainsresponse.domain; var 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
});
}); });
} }
}); });
} }
args.response.success({data: items}); args.response.success({
data: items
});
} }
}, },
subdomainaccess: { subdomainaccess: {
label: 'label.subdomain.access', isBoolean: true, isHidden: true, label: 'label.subdomain.access',
isBoolean: true,
isHidden: true,
},
account: {
label: 'label.account'
}, },
account: { label: 'label.account' },
projectId: { projectId: {
label: 'label.project', label: 'label.project',
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
var items = []; var items = [];
$.ajax({ $.ajax({
@ -385,11 +431,16 @@ var addGuestNetworkDialog = {
success: function(json) { success: function(json) {
projectObjs = json.listprojectsresponse.project; projectObjs = json.listprojectsresponse.project;
$(projectObjs).each(function() { $(projectObjs).each(function() {
items.push({id: this.id, description: this.name}); items.push({
id: this.id,
description: this.name
});
}); });
} }
}); });
args.response.success({data: items}); args.response.success({
data: items
});
} }
}, },
@ -461,12 +512,17 @@ var addGuestNetworkDialog = {
continue; //skip to next network offering continue; //skip to next network offering
} }
} }
items.push({id: addGuestNetworkDialog.networkOfferingObjs[i].id, description: addGuestNetworkDialog.networkOfferingObjs[i].displaytext}); items.push({
id: addGuestNetworkDialog.networkOfferingObjs[i].id,
description: addGuestNetworkDialog.networkOfferingObjs[i].displaytext
});
} }
} }
} }
}); });
args.response.success({data: items}); args.response.success({
data: items
});
args.$select.change(function() { args.$select.change(function() {
var $form = $(this).closest("form"); var $form = $(this).closest("form");
@ -478,8 +534,7 @@ var addGuestNetworkDialog = {
cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=vlanId]')); //make vlanId optional cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=vlanId]')); //make vlanId optional
$form.find('.form-item[rel=isolatedpvlanId]').hide(); $form.find('.form-item[rel=isolatedpvlanId]').hide();
} } else {
else {
$form.find('.form-item[rel=vlanId]').css('display', 'inline-block'); $form.find('.form-item[rel=vlanId]').css('display', 'inline-block');
cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=vlanId]')); //make vlanId required cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=vlanId]')); //make vlanId required
@ -538,11 +593,9 @@ var addGuestNetworkDialog = {
action: function(args) { //Add guest network in advanced zone action: function(args) { //Add guest network in advanced zone
if ( if (
((args.data.ip4gateway.length == 0) && (args.data.ip4Netmask.length == 0) && (args.data.startipv4.length == 0) && (args.data.endipv4.length == 0)) ((args.data.ip4gateway.length == 0) && (args.data.ip4Netmask.length == 0) && (args.data.startipv4.length == 0) && (args.data.endipv4.length == 0)) &&
&&
((args.data.ip6gateway.length == 0) && (args.data.ip6cidr.length == 0) && (args.data.startipv6.length == 0) && (args.data.endipv6.length == 0)) ((args.data.ip6gateway.length == 0) && (args.data.ip6cidr.length == 0) && (args.data.startipv6.length == 0) && (args.data.endipv6.length == 0))
) ) {
{
args.response.error("Either IPv4 fields or IPv6 fields need to be filled when adding a guest network"); args.response.error("Either IPv4 fields or IPv6 fields need to be filled when adding a guest network");
return; return;
} }
@ -582,12 +635,10 @@ var addGuestNetworkDialog = {
if ($form.find('.form-item[rel=account]').css("display") != "none") { //account-specific if ($form.find('.form-item[rel=account]').css("display") != "none") { //account-specific
array1.push("&account=" + args.data.account); array1.push("&account=" + args.data.account);
array1.push("&acltype=account"); array1.push("&acltype=account");
} } else if ($form.find('.form-item[rel=projectId]').css("display") != "none") { //project-specific
else if($form.find('.form-item[rel=projectId]').css("display") != "none") { //project-specific
array1.push("&projectid=" + args.data.projectId); array1.push("&projectid=" + args.data.projectId);
array1.push("&acltype=account"); array1.push("&acltype=account");
} } else { //domain-specific
else { //domain-specific
array1.push("&acltype=domain"); array1.push("&acltype=domain");
if ($form.find('.form-item[rel=subdomainaccess]:visible input:checked').size()) if ($form.find('.form-item[rel=subdomainaccess]:visible input:checked').size())
@ -595,8 +646,7 @@ var addGuestNetworkDialog = {
else else
array1.push("&subdomainaccess=false"); array1.push("&subdomainaccess=false");
} }
} } else { //zone-wide
else { //zone-wide
array1.push("&acltype=domain"); //server-side will make it Root domain (i.e. domainid=1) array1.push("&acltype=domain"); //server-side will make it Root domain (i.e. domainid=1)
} }
@ -630,7 +680,9 @@ var addGuestNetworkDialog = {
dataType: "json", dataType: "json",
success: function(json) { success: function(json) {
var item = json.createnetworkresponse.network; var item = json.createnetworkresponse.network;
args.response.success({data:item}); args.response.success({
data: item
});
}, },
error: function(XMLHttpResponse) { error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse); var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@ -648,6 +700,7 @@ var addGuestNetworkDialog = {
// Role Functions // Role Functions
function isAdmin() { function isAdmin() {
return (g_role == 1); return (g_role == 1);
} }
@ -663,13 +716,9 @@ function isUser() {
function isSelfOrChildDomainUser(username, useraccounttype, userdomainid, iscallerchilddomain) { function isSelfOrChildDomainUser(username, useraccounttype, userdomainid, iscallerchilddomain) {
if (username == g_username) { //is self if (username == g_username) { //is self
return true; return true;
} else if(isDomainAdmin() } else if (isDomainAdmin() && iscallerchilddomain && (useraccounttype == 0)) { //domain admin to user
&& iscallerchilddomain
&& (useraccounttype == 0)) { //domain admin to user
return true; return true;
} else if(isDomainAdmin() } else if (isDomainAdmin() && iscallerchilddomain && (userdomainid != g_domainid)) { //domain admin to subdomain admin and user
&& iscallerchilddomain
&& (userdomainid != g_domainid) ) { //domain admin to subdomain admin and user
return true; return true;
} else { } else {
return false; return false;
@ -678,24 +727,20 @@ function isSelfOrChildDomainUser(username, useraccounttype, userdomainid, iscall
// FUNCTION: Handles AJAX error callbacks. You can pass in an optional function to // FUNCTION: Handles AJAX error callbacks. You can pass in an optional function to
// handle errors that are not already handled by this method. // handle errors that are not already handled by this method.
function handleError(XMLHttpResponse, handleErrorCallback) { function handleError(XMLHttpResponse, handleErrorCallback) {
// User Not authenticated // User Not authenticated
if (XMLHttpResponse.status == ERROR_ACCESS_DENIED_DUE_TO_UNAUTHORIZED) { if (XMLHttpResponse.status == ERROR_ACCESS_DENIED_DUE_TO_UNAUTHORIZED) {
$("#dialog_session_expired").dialog("open"); $("#dialog_session_expired").dialog("open");
} } else if (XMLHttpResponse.status == ERROR_INTERNET_NAME_NOT_RESOLVED) {
else if (XMLHttpResponse.status == ERROR_INTERNET_NAME_NOT_RESOLVED) {
$("#dialog_error_internet_not_resolved").dialog("open"); $("#dialog_error_internet_not_resolved").dialog("open");
} } else if (XMLHttpResponse.status == ERROR_INTERNET_CANNOT_CONNECT) {
else if (XMLHttpResponse.status == ERROR_INTERNET_CANNOT_CONNECT) {
$("#dialog_error_management_server_not_accessible").dialog("open"); $("#dialog_error_management_server_not_accessible").dialog("open");
} } else if (XMLHttpResponse.status == ERROR_VMOPS_ACCOUNT_ERROR && handleErrorCallback != undefined) {
else if (XMLHttpResponse.status == ERROR_VMOPS_ACCOUNT_ERROR && handleErrorCallback != undefined) {
handleErrorCallback(); handleErrorCallback();
} } else if (handleErrorCallback != undefined) {
else if (handleErrorCallback != undefined) {
handleErrorCallback(); handleErrorCallback();
} } else {
else {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse); var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
$("#dialog_error").text(_s(errorMsg)).dialog("open"); $("#dialog_error").text(_s(errorMsg)).dialog("open");
} }
@ -717,8 +762,7 @@ function parseXMLHttpResponse(XMLHttpResponse) {
else else
return _s(errorObj.errortext); return _s(errorObj.errortext);
} }
} } else {
else {
return ""; return "";
} }
} }
@ -726,8 +770,7 @@ function parseXMLHttpResponse(XMLHttpResponse) {
function isValidJsonString(str) { function isValidJsonString(str) {
try { try {
JSON.parse(str); JSON.parse(str);
} } catch (e) {
catch (e) {
return false; return false;
} }
return true; return true;
@ -742,7 +785,9 @@ cloudStack.validate = {
var regexp = /^[a-zA-Z]{1}[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]{0,1}$/; var regexp = /^[a-zA-Z]{1}[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]{0,1}$/;
var b = regexp.test(args); //true or false var b = regexp.test(args); //true or false
if (b == false) if (b == false)
cloudStack.dialog.notice({ message: 'message.validate.instance.name' }); cloudStack.dialog.notice({
message: 'message.validate.instance.name'
});
return b; return b;
} }
} }
@ -752,12 +797,10 @@ cloudStack.preFilter = {
if (isAdmin()) { if (isAdmin()) {
args.$form.find('.form-item[rel=isPublic]').css('display', 'inline-block'); args.$form.find('.form-item[rel=isPublic]').css('display', 'inline-block');
args.$form.find('.form-item[rel=isFeatured]').css('display', 'inline-block'); args.$form.find('.form-item[rel=isFeatured]').css('display', 'inline-block');
} } else {
else {
if (g_userPublicTemplateEnabled == "true") { if (g_userPublicTemplateEnabled == "true") {
args.$form.find('.form-item[rel=isPublic]').css('display', 'inline-block'); args.$form.find('.form-item[rel=isPublic]').css('display', 'inline-block');
} } else {
else {
args.$form.find('.form-item[rel=isPublic]').hide(); args.$form.find('.form-item[rel=isPublic]').hide();
} }
args.$form.find('.form-item[rel=isFeatured]').hide(); args.$form.find('.form-item[rel=isFeatured]').hide();
@ -770,8 +813,7 @@ cloudStack.preFilter = {
if ($dedicated.find('input[type=checkbox]:checked').length > 0) { if ($dedicated.find('input[type=checkbox]:checked').length > 0) {
$capacity.hide(); $capacity.hide();
$capacity.find('input[type=text]').val('1'); $capacity.find('input[type=text]').val('1');
} } else if ($dedicated.find('input[type=checkbox]:unchecked').length > 0) {
else if($dedicated.find('input[type=checkbox]:unchecked').length > 0) {
$capacity.css('display', 'inline-block'); $capacity.css('display', 'inline-block');
$capacity.find('input[type=text]').val(''); $capacity.find('input[type=text]').val('');
} }
@ -789,8 +831,7 @@ cloudStack.actionFilter = {
allowedActions.push('edit'); //only Isolated network is allowed to upgrade to a different network offering (Shared network is not allowed to) allowedActions.push('edit'); //only Isolated network is allowed to upgrade to a different network offering (Shared network is not allowed to)
allowedActions.push('restart'); allowedActions.push('restart');
allowedActions.push('remove'); allowedActions.push('remove');
} } else if (jsonObj.type == 'Shared') {
else if(jsonObj.type == 'Shared') {
if (isAdmin()) { if (isAdmin()) {
allowedActions.push('restart'); allowedActions.push('restart');
allowedActions.push('remove'); allowedActions.push('remove');
@ -895,71 +936,124 @@ cloudStack.converters = {
}, },
toAlertType: function(alertCode) { toAlertType: function(alertCode) {
switch (alertCode) { switch (alertCode) {
case 0 : return _l('label.memory'); case 0:
case 1 : return _l('label.cpu'); return _l('label.memory');
case 2 : return _l('label.storage'); case 1:
case 3 : return _l('label.primary.storage'); return _l('label.cpu');
case 4 : return _l('label.public.ips'); case 2:
case 5 : return _l('label.management.ips'); return _l('label.storage');
case 6 : return _l('label.secondary.storage'); case 3:
case 7 : return _l('label.host'); return _l('label.primary.storage');
case 9 : return _l('label.domain.router'); case 4:
case 10 : return _l('label.console.proxy'); return _l('label.public.ips');
case 5:
return _l('label.management.ips');
case 6:
return _l('label.secondary.storage');
case 7:
return _l('label.host');
case 9:
return _l('label.domain.router');
case 10:
return _l('label.console.proxy');
// These are old values -- can be removed in the future // These are old values -- can be removed in the future
case 8 : return "User VM"; case 8:
case 11 : return "Routing Host"; return "User VM";
case 12 : return "Storage"; case 11:
case 13 : return "Usage Server"; return "Routing Host";
case 14 : return "Management Server"; case 12:
case 15 : return "Domain Router"; return "Storage";
case 16 : return "Console Proxy"; case 13:
case 17 : return "User VM"; return "Usage Server";
case 18 : return "VLAN"; case 14:
case 19 : return "Secondary Storage VM"; return "Management Server";
case 20 : return "Usage Server"; case 15:
case 21 : return "Storage"; return "Domain Router";
case 22 : return "Update Resource Count"; case 16:
case 23 : return "Usage Sanity Result"; return "Console Proxy";
case 24 : return "Direct Attached Public IP"; case 17:
case 25 : return "Local Storage"; return "User VM";
case 26 : return "Resource Limit Exceeded"; case 18:
return "VLAN";
case 19:
return "Secondary Storage VM";
case 20:
return "Usage Server";
case 21:
return "Storage";
case 22:
return "Update Resource Count";
case 23:
return "Usage Sanity Result";
case 24:
return "Direct Attached Public IP";
case 25:
return "Local Storage";
case 26:
return "Resource Limit Exceeded";
} }
}, },
toCapacityCountType: function(capacityCode) { toCapacityCountType: function(capacityCode) {
switch (capacityCode) { switch (capacityCode) {
case 0 : return _l('label.memory'); case 0:
case 1 : return _l('label.cpu'); return _l('label.memory');
case 2 : return _l('label.storage'); case 1:
case 3 : return _l('label.primary.storage'); return _l('label.cpu');
case 4 : return _l('label.public.ips'); case 2:
case 5 : return _l('label.management.ips'); return _l('label.storage');
case 6 : return _l('label.secondary.storage'); case 3:
case 7 : return _l('label.vlan'); return _l('label.primary.storage');
case 8 : return _l('label.direct.ips'); case 4:
case 9 : return _l('label.local.storage'); return _l('label.public.ips');
case 10 : return "Routing Host"; case 5:
case 11 : return "Storage"; return _l('label.management.ips');
case 12 : return "Usage Server"; case 6:
case 13 : return "Management Server"; return _l('label.secondary.storage');
case 14 : return "Domain Router"; case 7:
case 15 : return "Console Proxy"; return _l('label.vlan');
case 16 : return "User VM"; case 8:
case 17 : return "VLAN"; return _l('label.direct.ips');
case 18 : return "Secondary Storage VM"; case 9:
return _l('label.local.storage');
case 10:
return "Routing Host";
case 11:
return "Storage";
case 12:
return "Usage Server";
case 13:
return "Management Server";
case 14:
return "Domain Router";
case 15:
return "Console Proxy";
case 16:
return "User VM";
case 17:
return "VLAN";
case 18:
return "Secondary Storage VM";
} }
}, },
convertByType: function(alertCode, value) { convertByType: function(alertCode, value) {
switch (alertCode) { switch (alertCode) {
case 0: return cloudStack.converters.convertBytes(value); case 0:
case 1: return cloudStack.converters.convertHz(value); return cloudStack.converters.convertBytes(value);
case 2: return cloudStack.converters.convertBytes(value); case 1:
case 3: return cloudStack.converters.convertBytes(value); return cloudStack.converters.convertHz(value);
case 6: return cloudStack.converters.convertBytes(value); case 2:
case 9: return cloudStack.converters.convertBytes(value); return cloudStack.converters.convertBytes(value);
case 11: return cloudStack.converters.convertBytes(value); case 3:
return cloudStack.converters.convertBytes(value);
case 6:
return cloudStack.converters.convertBytes(value);
case 9:
return cloudStack.converters.convertBytes(value);
case 11:
return cloudStack.converters.convertBytes(value);
} }
return value; return value;
@ -967,6 +1061,7 @@ cloudStack.converters = {
} }
//data parameter passed to API call in listView //data parameter passed to API call in listView
function listViewDataProvider(args, data) { function listViewDataProvider(args, data) {
//search //search
if (args.filterBy != null) { if (args.filterBy != null) {
@ -976,18 +1071,15 @@ function listViewDataProvider(args, data) {
$.extend(data, { $.extend(data, {
'tags[0].key': args.filterBy.advSearch[key] 'tags[0].key': args.filterBy.advSearch[key]
}); });
} } else if (key == 'tagValue' && args.filterBy.advSearch[key].length > 0) {
else if(key == 'tagValue' && args.filterBy.advSearch[key].length > 0) {
$.extend(data, { $.extend(data, {
'tags[0].value': args.filterBy.advSearch[key] 'tags[0].value': args.filterBy.advSearch[key]
}); });
} } else if (args.filterBy.advSearch[key] != null && args.filterBy.advSearch[key].length > 0) {
else if(args.filterBy.advSearch[key] != null && args.filterBy.advSearch[key].length > 0) {
data[key] = args.filterBy.advSearch[key]; //do NOT use $.extend(data, { key: args.filterBy.advSearch[key] }); which will treat key variable as "key" string data[key] = args.filterBy.advSearch[key]; //do NOT use $.extend(data, { key: args.filterBy.advSearch[key] }); which will treat key variable as "key" string
} }
} }
} } else if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { //basic search
else if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { //basic search
switch (args.filterBy.search.by) { switch (args.filterBy.search.by) {
case "name": case "name":
if (args.filterBy.search.value.length > 0) { if (args.filterBy.search.value.length > 0) {
@ -1018,8 +1110,7 @@ var addExtraPropertiesToGuestNetworkObject = function(jsonObj) {
jsonObj.scope = "All"; jsonObj.scope = "All";
else else
jsonObj.scope = "Domain (" + jsonObj.domain + ")"; jsonObj.scope = "Domain (" + jsonObj.domain + ")";
} } else if (jsonObj.acltype == "Account") {
else if (jsonObj.acltype == "Account"){
if (jsonObj.project != null) if (jsonObj.project != null)
jsonObj.scope = "Account (" + jsonObj.domain + ", " + jsonObj.project + ")"; jsonObj.scope = "Account (" + jsonObj.domain + ", " + jsonObj.project + ")";
else else
@ -1032,6 +1123,7 @@ var addExtraPropertiesToGuestNetworkObject = function(jsonObj) {
} }
//find service object in network object //find service object in network object
function ipFindNetworkServiceByName(pName, networkObj) { function ipFindNetworkServiceByName(pName, networkObj) {
if (networkObj == null) if (networkObj == null)
return null; return null;
@ -1045,6 +1137,7 @@ function ipFindNetworkServiceByName(pName, networkObj) {
return null; return null;
} }
//find capability object in service object in network object //find capability object in service object in network object
function ipFindCapabilityByName(pName, networkServiceObj) { function ipFindCapabilityByName(pName, networkServiceObj) {
if (networkServiceObj == null) if (networkServiceObj == null)
return null; return null;
@ -1059,6 +1152,7 @@ function ipFindCapabilityByName(pName, networkServiceObj) {
} }
//compose URL for adding primary storage //compose URL for adding primary storage
function nfsURL(server, path) { function nfsURL(server, path) {
var url; var url;
if (server.indexOf("://") == -1) if (server.indexOf("://") == -1)
@ -1149,6 +1243,7 @@ function iscsiURL(server, iqn, lun) {
//VM Instance //VM Instance
function getVmName(p_vmName, p_vmDisplayname) { function getVmName(p_vmName, p_vmDisplayname) {
if (p_vmDisplayname == null) if (p_vmDisplayname == null)
return _s(p_vmName); return _s(p_vmName);
@ -1284,7 +1379,9 @@ cloudStack.api = {
}, },
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
_custom: { jobId: json.createtagsresponse.jobid }, _custom: {
jobId: json.createtagsresponse.jobid
},
notification: { notification: {
desc: 'Add tag for ' + resourceType, desc: 'Add tag for ' + resourceType,
poll: pollAsyncJobResult poll: pollAsyncJobResult
@ -1308,7 +1405,9 @@ cloudStack.api = {
}, },
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
_custom: { jobId: json.deletetagsresponse.jobid }, _custom: {
jobId: json.deletetagsresponse.jobid
},
notification: { notification: {
desc: 'Remove tag for ' + resourceType, desc: 'Remove tag for ' + resourceType,
poll: pollAsyncJobResult poll: pollAsyncJobResult
@ -1342,8 +1441,7 @@ cloudStack.api = {
data: data, data: data,
success: function(json) { success: function(json) {
args.response.success({ args.response.success({
data: json.listtagsresponse ? data: json.listtagsresponse ? json.listtagsresponse.tag : []
json.listtagsresponse.tag : []
}); });
}, },
error: function(json) { error: function(json) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,18 +39,32 @@
}, },
label: 'ui.listView.filters.all' label: 'ui.listView.filters.all'
}, },
mine: { label: 'ui.listView.filters.mine' }, mine: {
featured: { label: 'label.featured' }, label: 'ui.listView.filters.mine'
community: { label: 'label.community' } },
featured: {
label: 'label.featured'
},
community: {
label: 'label.community'
}
}, },
fields: { fields: {
name: { label: 'label.name' }, name: {
zonename: { label: 'label.zone' }, label: 'label.name'
hypervisor: { label: 'label.hypervisor' } },
zonename: {
label: 'label.zone'
},
hypervisor: {
label: 'label.hypervisor'
}
}, },
advSearchFields: { advSearchFields: {
name: { label: 'Name' }, name: {
label: 'Name'
},
zoneid: { zoneid: {
label: 'Zone', label: 'Zone',
select: function(args) { select: function(args) {
@ -74,8 +88,12 @@
}); });
} }
}, },
tagKey: { label: 'Tag Key' }, tagKey: {
tagValue: { label: 'Tag Value' } label: 'Tag Key'
},
tagValue: {
label: 'Tag Value'
}
}, },
reorder: cloudStack.api.actions.sort('updateTemplate', 'templates'), reorder: cloudStack.api.actions.sort('updateTemplate', 'templates'),
@ -95,17 +113,23 @@
name: { name: {
label: 'label.name', label: 'label.name',
docID: 'helpRegisterTemplateName', docID: 'helpRegisterTemplateName',
validation: { required: true } validation: {
required: true
}
}, },
description: { description: {
label: 'label.description', label: 'label.description',
docID: 'helpRegisterTemplateDescription', docID: 'helpRegisterTemplateDescription',
validation: { required: true } validation: {
required: true
}
}, },
url: { url: {
label: 'URL', label: 'URL',
docID: 'helpRegisterTemplateURL', docID: 'helpRegisterTemplateURL',
validation: { required: true } validation: {
required: true
}
}, },
zone: { zone: {
label: 'label.zone', label: 'label.zone',
@ -120,13 +144,21 @@
var items = json.listzonesresponse.zone; var items = json.listzonesresponse.zone;
if (items != null) { if (items != null) {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
zoneObjs.push({id: items[i].id, description: items[i].name}); zoneObjs.push({
id: items[i].id,
description: items[i].name
});
} }
} }
if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])) { if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])) {
zoneObjs.unshift({id: -1, description: "All Zones"}); zoneObjs.unshift({
id: -1,
description: "All Zones"
});
} }
args.response.success({data: zoneObjs}); args.response.success({
data: zoneObjs
});
} }
}); });
} }
@ -153,9 +185,14 @@
var hypervisorObjs = json.listhypervisorsresponse.hypervisor; var hypervisorObjs = json.listhypervisorsresponse.hypervisor;
var items = []; var items = [];
$(hypervisorObjs).each(function() { $(hypervisorObjs).each(function() {
items.push({id: this.name, description: this.name}); items.push({
id: this.name,
description: this.name
});
});
args.response.success({
data: items
}); });
args.response.success({data: items});
} }
}); });
@ -165,8 +202,7 @@
$form.find('.form-item[rel=rootDiskControllerType]').css('display', 'inline-block'); $form.find('.form-item[rel=rootDiskControllerType]').css('display', 'inline-block');
$form.find('.form-item[rel=nicAdapterType]').css('display', 'inline-block'); $form.find('.form-item[rel=nicAdapterType]').css('display', 'inline-block');
$form.find('.form-item[rel=keyboardType]').css('display', 'inline-block'); $form.find('.form-item[rel=keyboardType]').css('display', 'inline-block');
} } else {
else {
$form.find('.form-item[rel=rootDiskControllerType]').hide(); $form.find('.form-item[rel=rootDiskControllerType]').hide();
$form.find('.form-item[rel=nicAdapterType]').hide(); $form.find('.form-item[rel=nicAdapterType]').hide();
$form.find('.form-item[rel=keyboardType]').hide(); $form.find('.form-item[rel=keyboardType]').hide();
@ -181,10 +217,21 @@
isHidden: true, isHidden: true,
select: function(args) { select: function(args) {
var items = [] var items = []
items.push({id: "", description: ""}); items.push({
items.push({id: "scsi", description: "scsi"}); id: "",
items.push({id: "ide", description: "ide"}); description: ""
args.response.success({data: items}); });
items.push({
id: "scsi",
description: "scsi"
});
items.push({
id: "ide",
description: "ide"
});
args.response.success({
data: items
});
} }
}, },
nicAdapterType: { nicAdapterType: {
@ -192,12 +239,29 @@
isHidden: true, isHidden: true,
select: function(args) { select: function(args) {
var items = [] var items = []
items.push({id: "", description: ""}); items.push({
items.push({id: "E1000", description: "E1000"}); id: "",
items.push({id: "PCNet32", description: "PCNet32"}); description: ""
items.push({id: "Vmxnet2", description: "Vmxnet2"}); });
items.push({id: "Vmxnet3", description: "Vmxnet3"}); items.push({
args.response.success({data: items}); id: "E1000",
description: "E1000"
});
items.push({
id: "PCNet32",
description: "PCNet32"
});
items.push({
id: "Vmxnet2",
description: "Vmxnet2"
});
items.push({
id: "Vmxnet3",
description: "Vmxnet3"
});
args.response.success({
data: items
});
} }
}, },
keyboardType: { keyboardType: {
@ -205,10 +269,21 @@
isHidden: true, isHidden: true,
select: function(args) { select: function(args) {
var items = [] var items = []
items.push({id: "", description: ""}); items.push({
items.push({id: "us", description: "US"}); id: "",
items.push({id: "jp", description: "Japanese"}); description: ""
args.response.success({data: items}); });
items.push({
id: "us",
description: "US"
});
items.push({
id: "jp",
description: "Japanese"
});
args.response.success({
data: items
});
} }
}, },
//fields for hypervisor == "VMware" (ends here) //fields for hypervisor == "VMware" (ends here)
@ -221,29 +296,44 @@
var items = []; var items = [];
if (args.hypervisor == "XenServer") { if (args.hypervisor == "XenServer") {
//formatSelect.append("<option value='VHD'>VHD</option>"); //formatSelect.append("<option value='VHD'>VHD</option>");
items.push({id:'VHD', description: 'VHD'}); items.push({
} id: 'VHD',
else if(args.hypervisor == "VMware") { description: 'VHD'
});
} else if (args.hypervisor == "VMware") {
//formatSelect.append("<option value='OVA'>OVA</option>"); //formatSelect.append("<option value='OVA'>OVA</option>");
items.push({id:'OVA', description: 'OVA'}); items.push({
} id: 'OVA',
else if(args.hypervisor == "KVM") { description: 'OVA'
});
} else if (args.hypervisor == "KVM") {
//formatSelect.append("<option value='QCOW2'>QCOW2</option>"); //formatSelect.append("<option value='QCOW2'>QCOW2</option>");
items.push({id:'QCOW2', description: 'QCOW2'}); items.push({
} id: 'QCOW2',
else if(args.hypervisor == "BareMetal") { description: 'QCOW2'
});
} else if (args.hypervisor == "BareMetal") {
//formatSelect.append("<option value='BareMetal'>BareMetal</option>"); //formatSelect.append("<option value='BareMetal'>BareMetal</option>");
items.push({id:'BareMetal', description: 'BareMetal'}); items.push({
} id: 'BareMetal',
else if(args.hypervisor == "Ovm") { description: 'BareMetal'
});
} else if (args.hypervisor == "Ovm") {
//formatSelect.append("<option value='RAW'>RAW</option>"); //formatSelect.append("<option value='RAW'>RAW</option>");
items.push({id:'RAW', description: 'RAW'}); items.push({
} id: 'RAW',
else if(args.hypervisor == "LXC") { description: 'RAW'
});
} else if (args.hypervisor == "LXC") {
//formatSelect.append("<option value='TAR'>TAR</option>"); //formatSelect.append("<option value='TAR'>TAR</option>");
items.push({id:'TAR', description: 'TAR'}); items.push({
id: 'TAR',
description: 'TAR'
});
} }
args.response.success({data: items}); args.response.success({
data: items
});
} }
}, },
@ -257,7 +347,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var items = json.listostypesresponse.ostype; var items = json.listostypesresponse.ostype;
args.response.success({data: items}); args.response.success({
data: items
});
} }
}); });
} }
@ -345,7 +437,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.registertemplateresponse.template; //items might have more than one array element if it's create templates for all zones. var items = json.registertemplateresponse.template; //items might have more than one array element if it's create templates for all zones.
args.response.success({data:items[0]}); args.response.success({
data: items[0]
});
/* /*
if(items.length > 1) { if(items.length > 1) {
for(var i=1; i<items.length; i++) { for(var i=1; i<items.length; i++) {
@ -408,7 +502,9 @@
} }
$.ajax({ $.ajax({
url: createURL('listTemplates', { ignoreProject: ignoreProject }), url: createURL('listTemplates', {
ignoreProject: ignoreProject
}),
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.listtemplatesresponse.template; var items = json.listtemplatesresponse.template;
@ -457,8 +553,7 @@
$.extend(data, { $.extend(data, {
ispublic: true ispublic: true
}); });
} } else if (args.data.ispublic == "off") {
else if(args.data.ispublic == "off") {
$.extend(data, { $.extend(data, {
ispublic: false ispublic: false
}); });
@ -468,18 +563,17 @@
$.extend(data, { $.extend(data, {
isfeatured: true isfeatured: true
}); });
} } else if (args.data.isfeatured == "off") {
else if(args.data.isfeatured == "off") {
$.extend(data, { $.extend(data, {
isfeatured: false isfeatured: false
}); } });
}
//if args.data.isextractable is undefined, do not pass isextractable to API call. //if args.data.isextractable is undefined, do not pass isextractable to API call.
if (args.data.isextractable == "on") { if (args.data.isextractable == "on") {
$.extend(data, { $.extend(data, {
isextractable: true isextractable: true
}); });
} } else if (args.data.isextractable == "off") {
else if(args.data.isextractable == "off") {
$.extend(data, { $.extend(data, {
isextractable: false isextractable: false
}); });
@ -507,7 +601,9 @@
async: false, async: false,
success: function(json) { success: function(json) {
var item = json.listtemplatesresponse.template; var item = json.listtemplatesresponse.template;
args.response.success({data: item}); args.response.success({
data: item
});
} }
}); });
} }
@ -533,7 +629,9 @@
destinationZoneId: { destinationZoneId: {
label: 'label.destination.zone', label: 'label.destination.zone',
docID: 'helpCopyTemplateDestination', docID: 'helpCopyTemplateDestination',
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
$.ajax({ $.ajax({
url: createURL("listZones&available=true"), url: createURL("listZones&available=true"),
@ -545,11 +643,16 @@
if (items != null) { if (items != null) {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
if (items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone if (items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone
zoneObjs.push({id: items[i].id, description: items[i].name}); zoneObjs.push({
id: items[i].id,
description: items[i].name
});
} }
} }
} }
args.response.success({data: zoneObjs}); args.response.success({
data: zoneObjs
});
} }
}); });
} }
@ -563,9 +666,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.copytemplateresponse.jobid; var jid = json.copytemplateresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return {}; //nothing in this template needs to be updated return {}; //nothing in this template needs to be updated
}, },
@ -573,8 +676,7 @@
return templateActionfilter; return templateActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -610,9 +712,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.extracttemplateresponse.jobid; var jid = json.extracttemplateresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.template; return json.queryasyncjobresultresponse.jobresult.template;
}, },
@ -620,8 +722,7 @@
return templateActionfilter; return templateActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -651,12 +752,11 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.deletetemplateresponse.jobid; var jid = json.deletetemplateresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid jobId: jid
} }
} });
);
} }
}); });
}, },
@ -674,34 +774,50 @@
var hiddenFields; var hiddenFields;
if (isAdmin()) { if (isAdmin()) {
hiddenFields = []; hiddenFields = [];
} } else {
else {
hiddenFields = ["hypervisor"]; hiddenFields = ["hypervisor"];
} }
return hiddenFields; return hiddenFields;
}, },
fields: [ fields: [{
{
name: { name: {
label: 'label.name', label: 'label.name',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
} }
}
}, {
id: {
label: 'ID'
},
zonename: {
label: 'label.zone.name'
},
zoneid: {
label: 'label.zone.id'
}, },
{
id: { label: 'ID' },
zonename: { label: 'label.zone.name' },
zoneid: { label: 'label.zone.id' },
displaytext: { displaytext: {
label: 'label.description', label: 'label.description',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
}
},
hypervisor: {
label: 'label.hypervisor'
},
templatetype: {
label: 'label.type'
},
isready: {
label: 'state.ready',
converter: cloudStack.converters.toBooleanText
},
status: {
label: 'label.status'
}, },
hypervisor: { label: 'label.hypervisor' },
templatetype: { label: 'label.type' },
isready: { label: 'state.ready', converter:cloudStack.converters.toBooleanText },
status: { label: 'label.status' },
size: { size: {
label: 'label.size', label: 'label.size',
converter: function(args) { converter: function(args) {
@ -740,8 +856,7 @@
isEditable: function() { isEditable: function() {
if (isAdmin()) { if (isAdmin()) {
return true; return true;
} } else {
else {
if (g_userPublicTemplateEnabled == "true") if (g_userPublicTemplateEnabled == "true")
return true; return true;
else else
@ -778,21 +893,35 @@
var ostypes = json.listostypesresponse.ostype; var ostypes = json.listostypesresponse.ostype;
var items = []; var items = [];
$(ostypes).each(function() { $(ostypes).each(function() {
items.push({id: this.id, description: this.description}); items.push({
id: this.id,
description: this.description
});
});
args.response.success({
data: items
}); });
args.response.success({data: items});
} }
}); });
} }
}, },
domain: { label: 'label.domain' }, domain: {
account: { label: 'label.account' }, label: 'label.domain'
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate } },
account: {
label: 'label.account'
},
created: {
label: 'label.created',
converter: cloudStack.converters.toLocalDate
} }
], }],
tags: cloudStack.api.tags({ resourceType: 'Template', contextId: 'templates' }), tags: cloudStack.api.tags({
resourceType: 'Template',
contextId: 'templates'
}),
dataProvider: function(args) { dataProvider: function(args) {
@ -833,13 +962,23 @@
}, },
label: 'ui.listView.filters.all' label: 'ui.listView.filters.all'
}, },
mine: { label: 'ui.listView.filters.mine' }, mine: {
featured: { label: 'label.featured' }, label: 'ui.listView.filters.mine'
community: { label: 'label.community' } },
featured: {
label: 'label.featured'
},
community: {
label: 'label.community'
}
}, },
fields: { fields: {
name: { label: 'label.name' }, name: {
zonename: { label: 'label.zone' } label: 'label.name'
},
zonename: {
label: 'label.zone'
}
}, },
reorder: cloudStack.api.actions.sort('updateIso', 'isos'), reorder: cloudStack.api.actions.sort('updateIso', 'isos'),
@ -859,17 +998,23 @@
name: { name: {
label: 'label.name', label: 'label.name',
docID: 'helpRegisterISOName', docID: 'helpRegisterISOName',
validation: { required: true } validation: {
required: true
}
}, },
description: { description: {
label: 'label.description', label: 'label.description',
docID: 'helpRegisterISODescription', docID: 'helpRegisterISODescription',
validation: { required: true } validation: {
required: true
}
}, },
url: { url: {
label: 'URL', label: 'URL',
docID: 'helpRegisterISOURL', docID: 'helpRegisterISOURL',
validation: { required: true } validation: {
required: true
}
}, },
zone: { zone: {
label: 'label.zone', label: 'label.zone',
@ -884,13 +1029,21 @@
var items = json.listzonesresponse.zone; var items = json.listzonesresponse.zone;
if (items != null) { if (items != null) {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
zoneObjs.push({id: items[i].id, description: items[i].name}); zoneObjs.push({
id: items[i].id,
description: items[i].name
});
} }
} }
if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])) { if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])) {
zoneObjs.unshift({id: -1, description: "All Zones"}); zoneObjs.unshift({
id: -1,
description: "All Zones"
});
} }
args.response.success({data: zoneObjs}); args.response.success({
data: zoneObjs
});
} }
}); });
} }
@ -908,7 +1061,9 @@
docID: 'helpRegisterISOOSType', docID: 'helpRegisterISOOSType',
dependsOn: 'isBootable', dependsOn: 'isBootable',
isHidden: false, isHidden: false,
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
$.ajax({ $.ajax({
url: createURL("listOsTypes"), url: createURL("listOsTypes"),
@ -919,9 +1074,14 @@
var items = []; var items = [];
//items.push({id: "", description: "None"}); //shouldn't have None option when bootable is checked //items.push({id: "", description: "None"}); //shouldn't have None option when bootable is checked
$(osTypeObjs).each(function() { $(osTypeObjs).each(function() {
items.push({id: this.id, description: this.description}); items.push({
id: this.id,
description: this.description
});
});
args.response.success({
data: items
}); });
args.response.success({data: items});
} }
}); });
} }
@ -981,7 +1141,9 @@
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.registerisoresponse.iso; //items might have more than one array element if it's create ISOs for all zones. var items = json.registerisoresponse.iso; //items might have more than one array element if it's create ISOs for all zones.
args.response.success({data:items[0]}); args.response.success({
data: items[0]
});
/* /*
if(items.length > 1) { if(items.length > 1) {
@ -1009,7 +1171,9 @@
}, },
advSearchFields: { advSearchFields: {
name: { label: 'Name' }, name: {
label: 'Name'
},
zoneid: { zoneid: {
label: 'Zone', label: 'Zone',
select: function(args) { select: function(args) {
@ -1033,8 +1197,12 @@
}); });
} }
}, },
tagKey: { label: 'Tag Key' }, tagKey: {
tagValue: { label: 'Tag Value' } label: 'Tag Key'
},
tagValue: {
label: 'Tag Value'
}
}, },
dataProvider: function(args) { dataProvider: function(args) {
@ -1073,7 +1241,9 @@
} }
$.ajax({ $.ajax({
url: createURL('listIsos', { ignoreProject: ignoreProject }), url: createURL('listIsos', {
ignoreProject: ignoreProject
}),
data: data, data: data,
success: function(json) { success: function(json) {
var items = json.listisosresponse.iso; var items = json.listisosresponse.iso;
@ -1119,8 +1289,7 @@
$.extend(data, { $.extend(data, {
ispublic: true ispublic: true
}); });
} } else if (args.data.ispublic == "off") {
else if(args.data.ispublic == "off") {
$.extend(data, { $.extend(data, {
ispublic: false ispublic: false
}); });
@ -1130,18 +1299,17 @@
$.extend(data, { $.extend(data, {
isfeatured: true isfeatured: true
}); });
} } else if (args.data.isfeatured == "off") {
else if(args.data.isfeatured == "off") {
$.extend(data, { $.extend(data, {
isfeatured: false isfeatured: false
}); } });
}
//if args.data.isextractable is undefined, do not pass isextractable to API call. //if args.data.isextractable is undefined, do not pass isextractable to API call.
if (args.data.isextractable == "on") { if (args.data.isextractable == "on") {
$.extend(data, { $.extend(data, {
isextractable: true isextractable: true
}); });
} } else if (args.data.isextractable == "off") {
else if(args.data.isextractable == "off") {
$.extend(data, { $.extend(data, {
isextractable: false isextractable: false
}); });
@ -1169,7 +1337,9 @@
async: false, async: false,
success: function(json) { success: function(json) {
var item = json.listisosresponse.iso; var item = json.listisosresponse.iso;
args.response.success({data: item}); args.response.success({
data: item
});
} }
}); });
} }
@ -1188,7 +1358,9 @@
fields: { fields: {
destinationZoneId: { destinationZoneId: {
label: 'label.destination.zone', label: 'label.destination.zone',
validation: { required: true }, validation: {
required: true
},
select: function(args) { select: function(args) {
$.ajax({ $.ajax({
url: createURL("listZones&available=true"), url: createURL("listZones&available=true"),
@ -1200,11 +1372,16 @@
if (items != null) { if (items != null) {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
if (items[i].id != args.context.isos[0].zoneid) { //destination zone must be different from source zone if (items[i].id != args.context.isos[0].zoneid) { //destination zone must be different from source zone
zoneObjs.push({id: items[i].id, description: items[i].name}); zoneObjs.push({
id: items[i].id,
description: items[i].name
});
} }
} }
} }
args.response.success({data: zoneObjs}); args.response.success({
data: zoneObjs
});
} }
}); });
} }
@ -1218,9 +1395,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.copytemplateresponse.jobid; var jid = json.copytemplateresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return {}; //nothing in this ISO needs to be updated return {}; //nothing in this ISO needs to be updated
}, },
@ -1228,8 +1405,7 @@
return isoActionfilter; return isoActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -1265,9 +1441,9 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.extractisoresponse.jobid; var jid = json.extractisoresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid, jobId: jid,
getUpdatedItem: function(json) { getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.iso; return json.queryasyncjobresultresponse.jobresult.iso;
}, },
@ -1275,8 +1451,7 @@
return isoActionfilter; return isoActionfilter;
} }
} }
} });
);
} }
}); });
}, },
@ -1306,12 +1481,11 @@
async: true, async: true,
success: function(json) { success: function(json) {
var jid = json.deleteisosresponse.jobid; var jid = json.deleteisosresponse.jobid;
args.response.success( args.response.success({
{_custom: _custom: {
{jobId: jid jobId: jid
} }
} });
);
} }
}); });
}, },
@ -1326,25 +1500,38 @@
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'
},
zonename: {
label: 'label.zone.name'
},
zoneid: {
label: 'label.zone.id'
}, },
{
id: { label: 'ID' },
zonename: { label: 'label.zone.name' },
zoneid: { label: 'label.zone.id' },
displaytext: { displaytext: {
label: 'label.description', label: 'label.description',
isEditable: true, isEditable: true,
validation: { required: true } validation: {
required: true
}
},
isready: {
label: 'state.Ready',
converter: cloudStack.converters.toBooleanText
},
status: {
label: 'label.status'
}, },
isready: { label: 'state.Ready', converter:cloudStack.converters.toBooleanText },
status: { label: 'label.status' },
size: { size: {
label: 'label.size', label: 'label.size',
converter: function(args) { converter: function(args) {
@ -1393,21 +1580,35 @@
var ostypes = json.listostypesresponse.ostype; var ostypes = json.listostypesresponse.ostype;
var items = []; var items = [];
$(ostypes).each(function() { $(ostypes).each(function() {
items.push({id: this.id, description: this.description}); items.push({
id: this.id,
description: this.description
});
});
args.response.success({
data: items
}); });
args.response.success({data: items});
} }
}); });
} }
}, },
domain: { label: 'label.domain' }, domain: {
account: { label: 'label.account' }, label: 'label.domain'
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate } },
account: {
label: 'label.account'
},
created: {
label: 'label.created',
converter: cloudStack.converters.toLocalDate
} }
], }],
tags: cloudStack.api.tags({ resourceType: 'ISO', contextId: 'isos' }), tags: cloudStack.api.tags({
resourceType: 'ISO',
contextId: 'isos'
}),
dataProvider: function(args) { dataProvider: function(args) {
var jsonObj = args.context.isos[0]; var jsonObj = args.context.isos[0];
@ -1443,8 +1644,7 @@
if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project
|| jsonObj.templatetype == "SYSTEM" || jsonObj.isready == false) { || jsonObj.templatetype == "SYSTEM" || jsonObj.isready == false) {
//do nothing //do nothing
} } else {
else {
allowedActions.push("edit"); allowedActions.push("edit");
if (havingSwift == false && havingS3 == false) if (havingSwift == false && havingS3 == false)
@ -1457,19 +1657,16 @@
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project
|| (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") { || (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") {
//do nothing //do nothing
} } else {
else {
allowedActions.push("downloadTemplate"); allowedActions.push("downloadTemplate");
} }
// "Delete Template" // "Delete Template"
//if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) //if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)))
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project
|| (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) || (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) || (jsonObj.account == "system")) {
|| (jsonObj.account == "system")) {
//do nothing //do nothing
} } else {
else {
allowedActions.push("remove"); allowedActions.push("remove");
} }
@ -1481,12 +1678,10 @@
var allowedActions = []; var allowedActions = [];
if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project if ((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id)) //if neither root-admin, nor the same account, nor the same project
|| (jsonObj.isready == false) || (jsonObj.isready == false) || (jsonObj.domainid == 1 && jsonObj.account == "system")
|| (jsonObj.domainid == 1 && jsonObj.account == "system")
) { ) {
//do nothing //do nothing
} } else {
else {
allowedActions.push("edit"); allowedActions.push("edit");
if (havingSwift == false) if (havingSwift == false)
@ -1512,24 +1707,20 @@
// "Download ISO" // "Download ISO"
//if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) //if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)))
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project
|| (jsonObj.isready == false) || (jsonObj.isready == false) || (jsonObj.domainid == 1 && jsonObj.account == "system")
|| (jsonObj.domainid == 1 && jsonObj.account == "system")
) { ) {
//do nothing //do nothing
} } else {
else {
allowedActions.push("downloadISO"); allowedActions.push("downloadISO");
} }
// "Delete ISO" // "Delete ISO"
//if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) //if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account)))
if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project if (((isAdmin() == false && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account) && !(jsonObj.domainid == g_domainid && cloudStack.context.projects && jsonObj.projectid == cloudStack.context.projects[0].id))) //if neither root-admin, nor the same account, nor the same project
|| (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) || (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) || (jsonObj.account == "system")
|| (jsonObj.account == "system")
) { ) {
//do nothing //do nothing
} } else {
else {
allowedActions.push("remove"); allowedActions.push("remove");
} }

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

@ -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');
@ -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');
@ -325,16 +344,14 @@
$(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,8 +400,7 @@
$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);

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

@ -24,7 +24,9 @@
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;
} }
@ -73,7 +75,13 @@
form: { form: {
title: '', title: '',
fields: { fields: {
pingpath: {label: 'Ping Path', validation: {required: false}, defaultValue: pingpath1} pingpath: {
label: 'Ping Path',
validation: {
required: false
},
defaultValue: pingpath1
}
} }
} }
}); });
@ -89,10 +97,34 @@
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() {
@ -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();
@ -168,17 +199,17 @@
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
{ {
@ -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) {
@ -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();
@ -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();
@ -346,5 +381,3 @@
} }
} }
}(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,14 +673,19 @@
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'
}
}); });
} }
}, },
@ -618,8 +699,14 @@
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,16 +55,16 @@
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 []; }
}); });
} }
@ -79,7 +81,9 @@
$('div.overlay').remove(); $('div.overlay').remove();
if (message) { if (message) {
cloudStack.dialog.notice({ message: message }); cloudStack.dialog.notice({
message: message
});
} }
} }
} }
@ -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'
}, },
@ -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,9 +866,10 @@
// 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;
} }
@ -880,7 +884,9 @@
} }
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({ message: "Can't create a vm with multiple networks one of which is Security Group enabled" }); cloudStack.dialog.notice({
message: "Can't create a vm with multiple networks one of which is Security Group enabled"
});
return false; return false;
} }
} }

View File

@ -115,8 +115,7 @@
//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();
} }
@ -136,12 +135,10 @@
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
});
} }
} }
}); });

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();
@ -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();
@ -191,8 +194,7 @@
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

@ -50,8 +50,7 @@
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,7 +154,9 @@
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({
@ -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');
}); });
@ -511,10 +528,18 @@
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, {
context: context
}),
siteToSiteVPN: $.extend(siteToSiteVPN, {
context: context
}),
acl: $.extend(acl, {
context: context
}),
tierDetailView: tierDetailView tierDetailView: tierDetailView
}) })
); );
@ -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();
@ -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
});
} }
}); });
}); });
@ -261,8 +263,7 @@
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';
}; };
/** /**
@ -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')
) )
); );
@ -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
); );
} }
@ -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');
}
}); });
} }

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);
@ -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,8 +105,7 @@
$('.hovered-elem').hide(); $('.hovered-elem').hide();
} }
} }]
]
}).closest('.ui-dialog').overlay(); }).closest('.ui-dialog').overlay();
}; };
@ -124,7 +128,9 @@
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)
@ -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
@ -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,7 +383,10 @@
$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', {
position: 'center',
closeOnEscape: false
});
if ((!isNoDialog) && isLastAsync(idx)) { if ((!isNoDialog) && isLastAsync(idx)) {
ret(); ret();
} }
@ -391,7 +414,9 @@
$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(
@ -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();
}, },
@ -613,7 +636,9 @@
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) {
@ -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

@ -80,16 +80,13 @@
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,23 +356,23 @@
}); });
$('#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();
@ -403,8 +413,7 @@
)); ));
$('#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

@ -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();
} }
@ -235,6 +240,7 @@
{}, {},
// Error // Error
function(args) { function(args) {
$loading.remove(); $loading.remove();
} }
@ -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({
@ -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;
});
}) })
}); });
} }
@ -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,
@ -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();
@ -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;
}; };
@ -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'))
@ -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({
@ -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,7 +1329,9 @@
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 &&
@ -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,
@ -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,
@ -1769,8 +1767,7 @@
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
@ -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();
}, },
@ -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
});
} }
} }
} }
@ -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,
@ -1162,7 +1176,9 @@ $.fn.multiEdit = function(args) {
} }
// 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

@ -21,7 +21,9 @@
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;
} }
@ -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;
@ -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
});
} }
} }
}); });
@ -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

@ -74,8 +74,7 @@
$('.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');
} }
@ -100,8 +99,7 @@
} }
}); });
function hoverHandler(event) function hoverHandler(event) {
{
//Fetch Options //Fetch Options
var o = $.data(this, 'toolTip').options; var o = $.data(this, 'toolTip').options;
@ -115,8 +113,8 @@
//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;
@ -125,15 +123,17 @@
//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;
@ -143,20 +143,26 @@
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);
});
}; };

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

@ -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