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: {
id: 'accounts',
fields: {
name: { label: 'label.name' },
name: {
label: 'label.name'
},
accounttype: {
label: 'label.role',
converter: function(args) {
return cloudStack.converters.toRole(args);
}
},
domain: { label: 'label.domain' },
domain: {
label: 'label.domain'
},
state: {
converter: function(str) {
// For localization
@ -79,12 +83,16 @@
fields: {
username: {
label: 'label.username',
validation: { required: true },
validation: {
required: true
},
docID: 'helpAccountUsername'
},
password: {
label: 'label.password',
validation: { required: true },
validation: {
required: true
},
isPassword: true,
id: 'password',
docID: 'helpAccountPassword'
@ -100,23 +108,32 @@
},
email: {
label: 'label.email',
validation: { required: true, email:true },
validation: {
required: true,
email: true
},
docID: 'helpAccountEmail'
},
firstname: {
label: 'label.first.name',
validation: { required: true },
validation: {
required: true
},
docID: 'helpAccountFirstName'
},
lastname: {
label: 'label.last.name',
validation: { required: true },
validation: {
required: true
},
docID: 'helpAccountLastName'
},
domainid: {
label: 'label.domain',
docID: 'helpAccountDomain',
validation: { required: true },
validation: {
required: true
},
select: function(args) {
var data = {};
@ -135,12 +152,17 @@
var items = [];
domainObjs = json.listdomainsresponse.domain;
$(domainObjs).each(function() {
items.push({ id: this.id, description: this.path });
items.push({
id: this.id,
description: this.path
});
if (this.level == 0)
rootDomainId = this.id;
});
args.response.success({ data: items });
args.response.success({
data: items
});
}
});
}
@ -152,12 +174,22 @@
accounttype: {
label: 'label.type',
docID: 'helpAccountType',
validation: { required: true },
validation: {
required: true
},
select: function(args) {
var items = [];
items.push({id:0, description: "User"}); //regular-user
items.push({id:1, description: "Admin"}); //root-admin
args.response.success({data: items});
items.push({
id: 0,
description: "User"
}); //regular-user
items.push({
id: 1,
description: "Admin"
}); //root-admin
args.response.success({
data: items
});
}
},
timezone: {
@ -165,16 +197,26 @@
docID: 'helpAccountTimezone',
select: function(args) {
var items = [];
items.push({id: "", description: ""});
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]});
args.response.success({data: items});
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
}
},
networkdomain: {
label: 'label.network.domain',
docID: 'helpAccountNetworkDomain',
validation: { required: false }
validation: {
required: false
}
}
}
},
@ -233,7 +275,9 @@
data: data,
success: function(json) {
var item = json.createaccountresponse.account;
args.response.success({data:item});
args.response.success({
data: item
});
},
error: function(XMLHttpResponse) {
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
@ -278,7 +322,10 @@
detailView: {
name: 'Account details',
isMaximized: true,
viewAll: { path: 'accounts.users', label: 'label.users' },
viewAll: {
path: 'accounts.users',
label: 'label.users'
},
actions: {
edit: {
@ -481,7 +528,9 @@
}
});
}
args.response.success({data: accountObj});
args.response.success({
data: accountObj
});
}
},
@ -546,9 +595,9 @@
async: true,
success: function(json) {
var jid = json.disableaccountresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.account;
},
@ -556,8 +605,7 @@
return accountActionfilter;
}
}
}
);
});
}
});
},
@ -590,9 +638,9 @@
async: true,
success: function(json) {
var jid = json.disableaccountresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.account;
},
@ -600,8 +648,7 @@
return accountActionfilter;
}
}
}
);
});
}
});
},
@ -631,14 +678,18 @@
data: data,
async: true,
success: function(json) {
args.response.success({data: json.enableaccountresponse.account});
args.response.success({
data: json.enableaccountresponse.account
});
}
});
},
notification: {
poll: function(args) {
args.complete({
data: { state: 'enabled' }
data: {
state: 'enabled'
}
});
}
}
@ -664,9 +715,9 @@
async: true,
success: function(json) {
var jid = json.deleteaccountresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return {}; //nothing in this account needs to be updated, in fact, this whole account has being deleted
},
@ -674,8 +725,7 @@
return accountActionfilter;
}
}
}
);
});
}
});
},
@ -690,24 +740,30 @@
details: {
title: 'label.details',
fields: [
{
fields: [{
name: {
label: 'label.name',
isEditable: true,
validation: { required: true }
validation: {
required: true
}
}
}, {
id: {
label: 'ID'
},
{
id: { label: 'ID' },
accounttype: {
label: 'label.role',
converter: function(args) {
return cloudStack.converters.toRole(args);
}
},
domain: { label: 'label.domain' },
state: { label: 'label.state' },
domain: {
label: 'label.domain'
},
state: {
label: 'label.state'
},
networkdomain: {
label: 'label.network.domain',
isEditable: true
@ -723,7 +779,8 @@
return true;
else
return false;
} }
}
}
},
ipLimit: {
label: 'label.ip.limits',
@ -807,8 +864,12 @@
}
},
vmtotal: { label: 'label.total.of.vm' },
iptotal: { label: 'label.total.of.ip' },
vmtotal: {
label: 'label.total.of.vm'
},
iptotal: {
label: 'label.total.of.ip'
},
receivedbytes: {
label: 'label.bytes.received',
converter: function(args) {
@ -827,8 +888,7 @@
return cloudStack.converters.convertBytes(args);
}
}
}
],
}],
dataProvider: function(args) {
var data = {
@ -885,12 +945,10 @@
}
}
}
args.response.success(
{
args.response.success({
actionFilter: accountActionfilter,
data: accountObj
}
);
});
}
});
}
@ -905,7 +963,11 @@
dataProvider: function(args) {
$.ajax({
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) {
args.response.success({
data: json.listconfigurationsresponse.configuration
@ -934,7 +996,9 @@
data: data,
success: function(json) {
var item = json.updateconfigurationresponse.configuration;
args.response.success({data:item});
args.response.success({
data: item
});
},
error: function(json) {
@ -958,9 +1022,16 @@
listView: {
id: 'users',
fields: {
username: { label: 'label.username', editable: true },
firstname: { label: 'label.first.name' },
lastname: { label: 'label.last.name' }
username: {
label: 'label.username',
editable: true
},
firstname: {
label: 'label.first.name'
},
lastname: {
label: 'label.last.name'
}
},
dataProvider: function(args) {
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({
actionFilter: userActionfilter,
data: accountObj.user
@ -1012,13 +1082,17 @@
fields: {
username: {
label: 'label.username',
validation: { required: true },
validation: {
required: true
},
docID: 'helpUserUsername'
},
password: {
label: 'label.password',
isPassword: true,
validation: { required: true },
validation: {
required: true
},
id: 'password',
docID: 'helpUserPassword'
},
@ -1034,27 +1108,42 @@
email: {
label: 'label.email',
docID: 'helpUserEmail',
validation: { required: true, email: true }
validation: {
required: true,
email: true
}
},
firstname: {
label: 'label.first.name',
docID: 'helpUserFirstName',
validation: { required: true }
validation: {
required: true
}
},
lastname: {
label: 'label.last.name',
docID: 'helpUserLastName',
validation: { required: true }
validation: {
required: true
}
},
timezone: {
label: 'label.timezone',
docID: 'helpUserTimezone',
select: function(args) {
var items = [];
items.push({id: "", description: ""});
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]});
args.response.success({data: items});
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
}
}
}
@ -1099,7 +1188,9 @@
data: data,
success: function(json) {
var item = json.createuserresponse.user;
args.response.success({data: item});
args.response.success({
data: item
});
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@ -1136,7 +1227,9 @@
data: data,
success: function(json) {
var item = json.updateuserresponse.user;
args.response.success({data:item});
args.response.success({
data: item
});
},
error: function(data) {
args.response.error(parseXMLHttpResponse(data));
@ -1159,7 +1252,9 @@
newPassword: {
label: 'label.new.password',
isPassword: true,
validation: { required: true },
validation: {
required: true
},
id: 'newPassword'
},
'password-confirm': {
@ -1187,7 +1282,9 @@
data: data,
async: true,
success: function(json) {
args.response.success({data: json.updateuserresponse.user});
args.response.success({
data: json.updateuserresponse.user
});
}
});
},
@ -1216,7 +1313,9 @@
url: createURL('registerUserKeys'),
data: data,
success: function(json) {
args.response.success({data: json.registeruserkeysresponse.userkeys});
args.response.success({
data: json.registeruserkeysresponse.userkeys
});
}
});
},
@ -1246,9 +1345,9 @@
data: data,
success: function(json) {
var jid = json.disableuserresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.user;
},
@ -1256,8 +1355,7 @@
return userActionfilter;
}
}
}
);
});
}
});
},
@ -1284,7 +1382,9 @@
url: createURL('enableUser'),
data: data,
success: function(json) {
args.response.success({data: json.enableuserresponse.user});
args.response.success({
data: json.enableuserresponse.user
});
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
@ -1331,41 +1431,60 @@
details: {
title: 'label.details',
fields: [
{
fields: [{
username: {
label: 'label.name',
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: {
label: 'label.role',
converter: function(args) {
return cloudStack.converters.toRole(args);
}
},
domain: { label: 'label.domain' },
domain: {
label: 'label.domain'
},
email: {
label: 'label.email',
isEditable: true,
validation: { required: true, email: true }
validation: {
required: true,
email: true
}
},
firstname: {
label: 'label.first.name',
isEditable: true,
validation: { required: true }
validation: {
required: true
}
},
lastname: {
label: 'label.last.name',
isEditable: true,
validation: { required: true }
validation: {
required: true
}
},
timezone: {
label: 'label.timezone',
@ -1378,14 +1497,21 @@
isEditable: true,
select: function(args) {
var items = [];
items.push({id: "", description: ""});
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]});
args.response.success({data: items});
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
}
}
}
],
}],
dataProvider: function(args) {
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({
actionFilter: userActionfilter,
data: args.context.users[0]

View File

@ -20,8 +20,12 @@
listView: {
id: 'affinityGroups',
fields: {
name: { label: 'label.name' },
type: { label: 'label.type' }
name: {
label: 'label.name'
},
type: {
label: 'label.type'
}
},
dataProvider: function(args) {
var data = {};
@ -37,7 +41,9 @@
data: data,
success: function(json) {
var items = json.listaffinitygroupsresponse.affinitygroup;
args.response.success({data: items});
args.response.success({
data: items
});
}
});
},
@ -56,7 +62,9 @@
fields: {
name: {
label: 'label.name',
validation: { required: true }
validation: {
required: true
}
},
description: {
label: 'label.description'
@ -71,10 +79,15 @@
var items = json.listaffinitygrouptypesresponse.affinityGroupType;
if (items != null) {
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
};
if (args.data.description != null && args.data.description.length > 0)
$.extend(data, {description: args.data.description});
$.extend(data, {
description: args.data.description
});
$.ajax({
url: createURL('createAffinityGroup'),
data: data,
success: function(json) {
var jid = json.createaffinitygroupresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.affinitygroup;
}
}
}
);
});
}
});
},
@ -147,21 +161,29 @@
}
},
viewAll: { path: 'instances', label: 'label.instances' },
viewAll: {
path: 'instances',
label: 'label.instances'
},
tabs: {
details: {
title: 'label.details',
fields: [
{
name: { label: 'label.name' }
},
{
description: { label: 'label.description' },
type: { label: 'label.type' },
id: { label: 'label.id' }
fields: [{
name: {
label: 'label.name'
}
],
}, {
description: {
label: 'label.description'
},
type: {
label: 'label.type'
},
id: {
label: 'label.id'
}
}],
dataProvider: function(args) {
$.ajax({
@ -171,7 +193,9 @@
},
success: function(json) {
var item = json.listaffinitygroupsresponse.affinitygroup[0];
args.response.success({data: item});
args.response.success({
data: item
});
}
});
}

View File

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

View File

@ -14,7 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// 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
@ -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),
or it's the first time the user has come to this page.
*/
function onLogoutCallback() {
g_loginResponse = null; //clear single signon variable g_loginResponse
@ -74,5 +81,3 @@ $(document).ready(function() {
});
}
});

View File

@ -23,14 +23,11 @@
if (isAdmin()) {
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"];
}
else if (g_userProjectsEnabled) {
} else if (g_userProjectsEnabled) {
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"];
}
@ -92,17 +89,22 @@
}
}
}
cloudStack.dialog.notice({ message: parseXMLHttpResponse(data), clickAction: clickAction });
cloudStack.dialog.notice({
message: parseXMLHttpResponse(data),
clickAction: clickAction
});
},
beforeSend: function(XMLHttpRequest) {
if (g_mySession == $.cookie("JSESSIONID")) {
return true;
}
else {
} else {
var clickAction = function() {
$('#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;
}
}
@ -134,8 +136,7 @@
g_timezoneoffset = isNaN($.cookie('timezoneoffset')) ? null : parseFloat($.cookie('timezoneoffset'));
else
g_timezoneoffset = null;
}
else { //single-sign-on (bypass login screen)
} else { //single-sign-on (bypass login screen)
g_mySession = $.cookie('JSESSIONID');
g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey);
g_role = g_loginResponse.type;
@ -158,18 +159,26 @@
async: false,
success: function(json) {
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
$.cookie('supportELB', g_supportELB, { expires: 1});
$.cookie('supportELB', g_supportELB, {
expires: 1
});
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
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;
$.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
$.cookie('userProjectsEnabled', g_userProjectsEnabled, {
expires: 1
});
g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
@ -255,8 +264,7 @@
else
domain = args.data.domain;
array1.push("&domain=" + encodeURIComponent(domain));
}
else {
} else {
array1.push("&domain=" + encodeURIComponent("/"));
}
@ -281,15 +289,33 @@
g_timezoneoffset = loginresponse.timezoneoffset;
g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname;
$.cookie('sessionKey', g_sessionKey, { expires: 1});
$.cookie('username', g_username, { expires: 1});
$.cookie('account', g_account, { 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 });
$.cookie('sessionKey', g_sessionKey, {
expires: 1
});
$.cookie('username', g_username, {
expires: 1
});
$.cookie('account', g_account, {
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({
url: createURL("listCapabilities"),
@ -297,18 +323,26 @@
async: false,
success: function(json) {
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
$.cookie('supportELB', g_supportELB, { expires: 1});
$.cookie('supportELB', g_supportELB, {
expires: 1
});
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
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;
$.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
$.cookie('userProjectsEnabled', g_userProjectsEnabled, {
expires: 1
});
g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion;
@ -447,7 +481,9 @@
context: context,
complete: function() {
// Show cloudStack main UI
$container.cloudStack($.extend(cloudStackArgs, { hasLogo: false }));
$container.cloudStack($.extend(cloudStackArgs, {
hasLogo: false
}));
}
});
};
@ -455,7 +491,9 @@
initInstallWizard();
} else {
// 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) {
dataFns.ipAddresses($.extend(data, {
events: json.listeventsresponse.event ?
json.listeventsresponse.event : []
events: json.listeventsresponse.event ? json.listeventsresponse.event : []
}));
}
});
@ -143,15 +142,12 @@
},
capacity: function(data) {
var latestData = null;
if(window.fetchLatestflag == 1)
{
if (window.fetchLatestflag == 1) {
latestData = {
fetchLatest: true
}
}
else
{
} else {
latestData = {
fetchLatest: false
}

View File

@ -68,11 +68,11 @@
async: false,
success: function(json) {
var jid = json.deletedomainresponse.jobid;
args.response.success(
{_custom:
{jobId: jid}
args.response.success({
_custom: {
jobId: jid
}
);
});
// Quick fix for proper UI reaction to delete domain
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,
success: function(json) {
var item = json.createdomainresponse.domain;
args.response.success({data: item});
args.response.success({
data: item
});
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@ -275,12 +279,16 @@
name: {
label: 'label.name',
docID: 'helpDomainName',
validation: { required: true }
validation: {
required: true
}
},
networkdomain: {
label: 'label.network.domain',
docID: 'helpDomainNetworkDomain',
validation: { required: false }
validation: {
required: false
}
}
}
}
@ -317,8 +325,7 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
fields: [{
name: {
label: 'label.name',
isEditable: function(context) {
@ -328,11 +335,14 @@
return false;
}
}
}, {
id: {
label: 'ID'
},
{
id: { label: 'ID' },
path: { label: 'label.full.path' },
path: {
label: 'label.full.path'
},
networkdomain: {
label: 'label.network.domain',
@ -428,11 +438,16 @@
return false;
}
},
accountTotal: { label: 'label.accounts' },
vmTotal: { label: 'label.instances' },
volumeTotal: { label: 'label.volumes' }
accountTotal: {
label: 'label.accounts'
},
vmTotal: {
label: 'label.instances'
},
volumeTotal: {
label: 'label.volumes'
}
],
}],
dataProvider: function(args) {
var domainObj = args.context.domains[0];
var totalVMs = 0;
@ -452,8 +467,7 @@
totalVMs += items[i].vmtotal;
totalVolumes += items[i].volumetotal;
}
}
else {
} else {
domainObj["accountTotal"] = 0;
}
}
@ -579,8 +593,7 @@
});
}
});
}
else {
} else {
$.ajax({
url: createURL("listDomainChildren&id=" + parentDomain.id),
dataType: "json",

View File

@ -35,12 +35,25 @@
id: 'events',
label: 'label.menu.events',
fields: {
description: { label: 'label.description' },
level: { label: 'label.level' },
type: {label:'Type'},
domain: { label: 'label.domain' },
account: { label: 'label.account' },
created: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
description: {
label: 'label.description'
},
level: {
label: 'label.level'
},
type: {
label: 'Type'
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.account'
},
created: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
}
},
actions: {
@ -58,7 +71,10 @@
title: 'Delete Events',
desc: '',
fields: {
type: { label: 'By event type' , docID:'helpEventsDeleteType'},
type: {
label: 'By event type',
docID: 'helpEventsDeleteType'
},
date: {
label: 'By date (older than)',
docID: 'helpEventsDeleteDate',
@ -71,10 +87,14 @@
var data = {};
if (args.data.type != "")
$.extend(data, { type:args.data.type });
$.extend(data, {
type: args.data.type
});
if (args.data.date != "")
$.extend(data, {olderthan:args.data.date });
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
@ -108,18 +128,29 @@
title: 'Archive Events',
desc: '',
fields: {
type: { label: 'By event type' , docID:'helpEventsArchiveType'},
date: { label: 'By date (older than)' , docID:'helpEventsArchiveDate', isDatepicker: true },
type: {
label: 'By event type',
docID: 'helpEventsArchiveType'
},
date: {
label: 'By date (older than)',
docID: 'helpEventsArchiveDate',
isDatepicker: true
},
}
},
action: function(args) {
var data = {};
if (args.data.type != "")
$.extend(data, { type:args.data.type });
$.extend(data, {
type: args.data.type
});
if (args.data.date != "")
$.extend(data, {olderthan:args.data.date });
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
@ -149,12 +180,19 @@
label: 'label.level',
select: function(args) {
args.response.success({
data: [
{id: '', description: ''},
{id: 'INFO', description: 'INFO'},
{id: 'WARN', description: 'WARN'},
{id: 'ERROR', description: 'ERROR'}
]
data: [{
id: '',
description: ''
}, {
id: 'INFO',
description: 'INFO'
}, {
id: 'WARN',
description: 'WARN'
}, {
id: 'ERROR',
description: 'ERROR'
}]
});
}
},
@ -170,11 +208,17 @@
details: 'min'
},
success: function(json) {
var array1 = [{id: '', description: ''}];
var array1 = [{
id: '',
description: ''
}];
var domains = json.listdomainsresponse.domain;
if (domains != null && domains.length > 0) {
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({
@ -182,8 +226,7 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
@ -228,7 +271,9 @@
data: data,
success: function(json) {
var items = json.listeventsresponse.event;
args.response.success({data:items});
args.response.success({
data: items
});
}
});
},
@ -293,19 +338,36 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
description: { label: 'label.description' },
state: { label: 'label.state' },
level: { label: 'label.level' },
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' }
fields: [{
description: {
label: 'label.description'
},
state: {
label: 'label.state'
},
level: {
label: 'label.level'
},
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) {
$.ajax({
url: createURL("listEvents&id=" + args.context.events[0].id),
@ -313,7 +375,9 @@
async: true,
success: function(json) {
var item = json.listeventsresponse.event[0];
args.response.success({data: item});
args.response.success({
data: item
});
}
});
}
@ -329,9 +393,16 @@
id: 'alerts',
label: 'label.menu.alerts',
fields: {
description: { label: 'label.description' },
type: {label:'Type'},
sent: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
description: {
label: 'label.description'
},
type: {
label: 'Type'
},
sent: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
}
},
actions: {
@ -349,8 +420,15 @@
title: 'Delete Alerts',
desc: '',
fields: {
type: { label: 'By Alert type' , docID:'helpAlertsDeleteType'},
date: { label: 'By date (older than)' ,docID:'helpAlertsDeleteDate', isDatepicker: true }
type: {
label: 'By Alert type',
docID: 'helpAlertsDeleteType'
},
date: {
label: 'By date (older than)',
docID: 'helpAlertsDeleteDate',
isDatepicker: true
}
}
},
action: function(args) {
@ -358,10 +436,14 @@
var data = {};
if (args.data.type != "")
$.extend(data, { type:args.data.type });
$.extend(data, {
type: args.data.type
});
if (args.data.date != "")
$.extend(data, {olderthan:args.data.date });
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
@ -395,18 +477,29 @@
title: 'Archive Alerts',
desc: '',
fields: {
type: { label: 'By Alert type', docID:'helpAlertsArchiveType' },
date: { label: 'By date (older than)' , docID:'helpAlertsArchiveDate', isDatepicker: true }
type: {
label: 'By Alert type',
docID: 'helpAlertsArchiveType'
},
date: {
label: 'By date (older than)',
docID: 'helpAlertsArchiveDate',
isDatepicker: true
}
}
},
action: function(args) {
var data = {};
if (args.data.type != "")
$.extend(data, { type:args.data.type });
$.extend(data, {
type: args.data.type
});
if (args.data.date != "")
$.extend(data, {olderthan:args.data.date });
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
@ -439,7 +532,9 @@
async: true,
success: function(json) {
var items = json.listalertsresponse.alert;
args.response.success({data:items});
args.response.success({
data: items
});
}
});
},
@ -507,13 +602,18 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
id: { label: 'ID' },
description: { label: 'label.description' },
sent: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
fields: [{
id: {
label: 'ID'
},
description: {
label: 'label.description'
},
sent: {
label: 'label.date',
converter: cloudStack.converters.toLocalDate
}
],
}],
dataProvider: function(args) {
$.ajax({
url: createURL("listAlerts&id=" + args.context.alerts[0].id),
@ -521,7 +621,9 @@
async: true,
success: function(json) {
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) {
var item = json.updateconfigurationresponse.configuration;
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
cloudStack.dialog.notice({ message: _l('message.restart.mgmt.server') });
args.response.success({data: item});
cloudStack.dialog.notice({
message: _l('message.restart.mgmt.server')
});
args.response.success({
data: item
});
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
@ -55,9 +61,18 @@
}
},
fields: {
name: { label: 'label.name', id: true },
description: { label: 'label.description' },
value: { label: 'label.value', editable: true, truncate: true }
name: {
label: 'label.name',
id: true
},
description: {
label: 'label.description'
},
value: {
label: 'label.value',
editable: true,
truncate: true
}
},
dataProvider: function(args) {
var data = {
@ -76,7 +91,9 @@
async: true,
success: function(json) {
var items = json.listconfigurationsresponse.configuration;
args.response.success({ data: items });
args.response.success({
data: items
});
}
});
}
@ -90,10 +107,18 @@
id: 'ldap',
label: 'LDAP Configuration',
fields: {
hostname: {label: 'Hostname'},
queryfilter: {label: 'Query Filter'},
searchbase: {label: 'Search Base'},
port: {label: 'LDAP Port'},
hostname: {
label: 'Hostname'
},
queryfilter: {
label: 'Query Filter'
},
searchbase: {
label: 'Search Base'
},
port: {
label: 'LDAP Port'
},
ssl: {
label: 'SSL'
@ -108,7 +133,9 @@
data: data,
success: function(json) {
var items = json.ldapconfigresponse.ldapconfig;
args.response.success({data:items});
args.response.success({
data: items
});
},
error: function(data) {
args.response.error(parseXMLHttpResponse(data));
@ -152,13 +179,17 @@
details: {
title: 'LDAP Configuration Details',
fields: [
{
hostname: { label: 'Hostname' },
description: { label: 'label.description' },
ssl : { label: 'SSL'}
fields: [{
hostname: {
label: 'Hostname'
},
description: {
label: 'label.description'
},
ssl: {
label: 'SSL'
}
],
}],
dataProvider: function(args) {
$.ajax({
url: createURL("ldapConfig&listAll=true"),
@ -166,7 +197,9 @@
async: true,
success: function(json) {
var item = json.ldapconfigresponse.ldapconfig;
args.response.success({data: item});
args.response.success({
data: item
});
}
});
}
@ -194,20 +227,64 @@
title: 'Configure LDAP',
fields: {
name:{label: 'Bind DN' , 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}},
name: {
label: 'Bind DN',
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: {
label: 'SSL',
isBoolean: true,
isChecked: false
},
port: { label: 'Port' , 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}}
port: {
label: 'Port',
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 != "")
array.push("&truststorepass=" + todb(args.data.truststorepassword));
}
else
} else
array.push("&ssl=false");
$.ajax({
@ -278,9 +353,15 @@
id: 'hypervisorCapabilities',
label: 'label.hypervisor.capabilities',
fields: {
hypervisor: { label: 'label.hypervisor' },
hypervisorversion: { label: 'label.hypervisor.version' },
maxguestslimit: { label: 'label.max.guest.limit' }
hypervisor: {
label: 'label.hypervisor'
},
hypervisorversion: {
label: 'label.hypervisor.version'
},
maxguestslimit: {
label: 'label.max.guest.limit'
}
},
dataProvider: function(args) {
var data = {};
@ -291,7 +372,9 @@
data: data,
success: function(json) {
var items = json.listhypervisorcapabilitiesresponse.hypervisorCapabilities;
args.response.success({data:items});
args.response.success({
data: items
});
},
error: function(data) {
args.response.error(parseXMLHttpResponse(data));
@ -315,7 +398,9 @@
data: data,
success: function(json) {
var item = json.updatehypervisorcapabilitiesresponse['null'];
args.response.success({data: item});
args.response.success({
data: item
});
},
error: function(data) {
args.response.error(parseXMLHttpResponse(data));
@ -328,23 +413,25 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
id: { label: 'label.id' },
hypervisor: { label: 'label.hypervisor' },
hypervisorversion: { label: 'label.hypervisor.version' },
fields: [{
id: {
label: 'label.id'
},
hypervisor: {
label: 'label.hypervisor'
},
hypervisorversion: {
label: 'label.hypervisor.version'
},
maxguestslimit: {
label: 'label.max.guest.limit',
isEditable: true
}
}
],
}],
dataProvider: function(args) {
args.response.success(
{
args.response.success({
data: args.context.hypervisorCapabilities[0]
}
);
});
}
}
}

View File

@ -41,7 +41,9 @@
async: true,
success: function(data) {
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,
networktype: 'Advanced'
}];
args.response.success({ data: {zones: zoneObjs}});
args.response.success({
data: {
zones: zoneObjs
}
else { //from Instance page
});
} else { //from Instance page
$.ajax({
url: createURL("listZones&available=true"),
dataType: "json",
async: false,
success: function(json) {
zoneObjs = json.listzonesresponse.zone;
args.response.success({ data: {zones: zoneObjs}});
args.response.success({
data: {
zones: zoneObjs
}
});
}
});
}
@ -129,8 +136,7 @@
success: function(json) {
if (json.listtemplatesresponse.template == null) {
featuredTemplateObjs = null;
}
else {
} else {
featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true;
@ -145,8 +151,7 @@
success: function(json) {
if (json.listtemplatesresponse.template == null) {
communityTemplateObjs = null;
}
else {
} else {
communityTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true;
@ -161,8 +166,7 @@
success: function(json) {
if (json.listtemplatesresponse.template == null) {
myTemplateObjs = null;
}
else {
} else {
myTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
if ($.inArray(item.hypervisor, hypervisorArray) > -1)
return true;
@ -178,8 +182,7 @@
success: function(json) {
if (json.listisosresponse.iso == null) {
featuredIsoObjs = null;
}
else {
} else {
featuredIsoObjs = json.listisosresponse.iso;
}
}
@ -191,8 +194,7 @@
success: function(json) {
if (json.listisosresponse.iso == null) {
communityIsoObjs = null;
}
else {
} else {
communityIsoObjs = json.listisosresponse.iso;
}
}
@ -204,8 +206,7 @@
success: function(json) {
if (json.listisosresponse.iso == null) {
myIsoObjs = null;
}
else {
} else {
myIsoObjs = json.listisosresponse.iso;
}
}
@ -275,8 +276,7 @@
alert("unable to find matched template object");
else
selectedHypervisor = selectedTemplateObj.hypervisor;
}
else { //(args.currentData["select-template"] == "select-iso"
} else { //(args.currentData["select-template"] == "select-iso"
selectedHypervisor = args.currentData.hypervisorid;
}
@ -287,7 +287,9 @@
success: function(json) {
serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering;
args.response.success({
data: {serviceOfferings: serviceOfferingObjs}
data: {
serviceOfferings: serviceOfferingObjs
}
});
}
});
@ -305,7 +307,9 @@
args.response.success({
required: isRequred,
customFlag: 'iscustomized', // Field determines if custom slider is shown
data: {diskOfferings: diskOfferingObjs}
data: {
diskOfferings: diskOfferingObjs
}
});
}
});
@ -325,7 +329,9 @@
selectedObj: args.context.affinityGroups[0]
});
}
args.response.success({data: data});
args.response.success({
data: data
});
}
});
},
@ -368,8 +374,7 @@
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;
$.ajax({
url: createURL("listNetworks&trafficType=Guest&zoneId=" + selectedZoneObj.id),
@ -393,15 +398,15 @@
if (includingSecurityGroupService == false || selectedHypervisor == "VMware") {
step6ContainerType = 'nothing-to-select';
}
else {
} else {
step6ContainerType = 'select-security-group';
}
}
//step6ContainerType = 'nothing-to-select'; //for testing only, comment it out before checking in
if (step6ContainerType == 'select-network' || step6ContainerType == 'select-advanced-sg') {
var defaultNetworkArray = [], optionalNetworkArray = [];
var defaultNetworkArray = [],
optionalNetworkArray = [];
var networkData = {
zoneId: args.currentData.zoneid,
canusefordeploy: true
@ -503,9 +508,7 @@
vpcs: vpcObjs
}
});
}
else if(step6ContainerType == 'select-security-group') {
} else if (step6ContainerType == 'select-security-group') {
var securityGroupArray = [];
var data = {
domainid: g_domainid,
@ -535,9 +538,7 @@
vpcs: []
}
});
}
else if(step6ContainerType == 'nothing-to-select') {
} else if (step6ContainerType == 'nothing-to-select') {
args.response.success({
type: 'nothing-to-select',
data: {
@ -581,12 +582,10 @@
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"],
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.push(args.data["affinity-groups"]);
}
else { // typeof(args.data["affinity-groups"]) == null
} else { // typeof(args.data["affinity-groups"]) == null
checkedAffinityGroupIdArray = [];
}
@ -601,12 +600,10 @@
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"],
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.push(args.data["my-networks"]);
}
else { // typeof(args.data["my-networks"]) == null
} else { // typeof(args.data["my-networks"]) == null
checkedNetworkIdArray = [];
}
@ -656,17 +653,14 @@
}
array1.push("&networkIds=" + array2.join(","));
}
else if (step6ContainerType == 'select-security-group') {
} else if (step6ContainerType == 'select-security-group') {
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"],
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.push(args.data["security-groups"]);
}
else { // typeof(args.data["security-groups"]) == null
} else { // typeof(args.data["security-groups"]) == null
checkedSecurityGroupIdArray = [];
}
@ -681,12 +675,10 @@
var checkedNetworkIdArray;
if (typeof(myNetworks) == "object" && myNetworks.length != null) { //myNetworks is an array of string, e.g. ["203", "202"],
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.push(myNetworks);
}
else { // typeof(myNetworks) == null
} else { // typeof(myNetworks) == null
checkedNetworkIdArray = [];
}
@ -704,8 +696,7 @@
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
array1.push("&networkIds=" + args.context.networks[0].id);
array1.push("&domainid=" + args.context.vpc[0].domainid);
@ -735,9 +726,9 @@
success: function(json) {
var jid = json.deployvirtualmachineresponse.jobid;
var vmid = json.deployvirtualmachineresponse.id;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
var item = json.queryasyncjobresultresponse.jobresult.virtualmachine;
if (item.password != null)
@ -760,8 +751,7 @@
return item;
}
}
}
);
});
},
error: function(XMLHttpResponse) {
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, {
vpcid: args.context.vpc[0].id
});
}
else {
} else {
$.extend(data, {
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];
}
@ -69,20 +67,29 @@
)[0].value);
var baseFields = {
stickyName: { label: 'Sticky Name', validation: { required: true } }
stickyName: {
label: 'Sticky Name',
validation: {
required: true
}
}
};
$.map(
$.map(
stickinessCapabilities,
function(c) { return c.paramlist; }
function(c) {
return c.paramlist;
}
),
function(p) {
baseFields[p.paramname] = {
label: _l('label.sticky.' + p.paramname),
isHidden: true,
isBoolean: p.isflag,
validation: { required: p.required }
validation: {
required: p.required
}
};
}
);
@ -95,7 +102,10 @@
var $form = $select.closest('form');
var stickyOptions = [];
stickinessCapabilities.push({ methodname: 'None', paramlist: [] });
stickinessCapabilities.push({
methodname: 'None',
paramlist: []
});
$(stickinessCapabilities).each(function() {
var stickyCapability = this;
@ -240,8 +250,7 @@
methodname: data.methodname
},
success: function(json) {
cloudStack.ui.notifications.add(
{
cloudStack.ui.notifications.add({
desc: 'Add new LB sticky rule',
section: 'Network',
poll: pollAsyncJobResult,
@ -255,7 +264,9 @@
},
error: function(json) {
complete();
cloudStack.dialog.notice({ message: parseXMLHttpResponse(json) });
cloudStack.dialog.notice({
message: parseXMLHttpResponse(json)
});
}
});
},
@ -266,8 +277,7 @@
id: stickyRuleID
},
success: function(json) {
cloudStack.ui.notifications.add(
{
cloudStack.ui.notifications.add({
desc: 'Remove previous LB sticky rule',
section: 'Network',
poll: pollAsyncJobResult,
@ -281,7 +291,9 @@
},
error: function(json) {
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) {
$.ajax({
url: createURL('listProjectInvitations'),
data: { state: 'Pending' },
data: {
state: 'Pending'
},
success: function(json) {
args.response.success({
data: json.listprojectinvitationsresponse.projectinvitation ?
json.listprojectinvitationsresponse.projectinvitation : []
data: json.listprojectinvitationsresponse.projectinvitation ? json.listprojectinvitationsresponse.projectinvitation : []
});
}
});
@ -43,7 +44,9 @@
$.each(args.data, function(key, value) {
$.ajax({
url: createURL('updateResourceLimit', { ignoreProject: true }),
url: createURL('updateResourceLimit', {
ignoreProject: true
}),
data: {
projectid: projectID,
resourcetype: key,
@ -63,7 +66,9 @@
projectID = projectID ? projectID : cloudStack.context.projects[0].id;
$.ajax({
url: createURL('listResourceLimits', { ignoreProject: true }),
url: createURL('listResourceLimits', {
ignoreProject: true
}),
data: {
projectid: projectID
},
@ -171,8 +176,7 @@
url: createURL('listVolumes'),
success: function(json) {
dataFns.bandwidth($.extend(data, {
totalVolumes: json.listvolumesresponse.volume ?
json.listvolumesresponse.count : 0
totalVolumes: json.listvolumesresponse.volume ? json.listvolumesresponse.count : 0
}));
}
});
@ -212,8 +216,7 @@
url: createURL('listPublicIpAddresses'),
success: function(json) {
dataFns.loadBalancingRules($.extend(data, {
totalIPAddresses: json.listpublicipaddressesresponse.count ?
json.listpublicipaddressesresponse.count : 0
totalIPAddresses: json.listpublicipaddressesresponse.count ? json.listpublicipaddressesresponse.count : 0
}));
}
});
@ -224,8 +227,7 @@
url: createURL('listLoadBalancerRules'),
success: function(json) {
dataFns.portForwardingRules($.extend(data, {
totalLoadBalancers: json.listloadbalancerrulesresponse.count ?
json.listloadbalancerrulesresponse.count : 0
totalLoadBalancers: json.listloadbalancerrulesresponse.count ? json.listloadbalancerrulesresponse.count : 0
}));
}
});
@ -236,8 +238,7 @@
url: createURL('listPortForwardingRules'),
success: function(json) {
dataFns.users($.extend(data, {
totalPortForwards: json.listportforwardingrulesresponse.count ?
json.listportforwardingrulesresponse.count : 0
totalPortForwards: json.listportforwardingrulesresponse.count ? json.listportforwardingrulesresponse.count : 0
}));
}
});
@ -262,7 +263,9 @@
events: function(data) {
$.ajax({
url: createURL('listEvents', { ignoreProject: true }),
url: createURL('listEvents', {
ignoreProject: true
}),
data: {
page: 1,
pageSize: 8
@ -273,9 +276,7 @@
complete($.extend(data, {
events: $.map(events, function(event) {
return {
date: event.created.substr(5, 2) +
'/' + event.created.substr(8, 2) +
'/' + event.created.substr(2, 2),
date: event.created.substr(5, 2) + '/' + event.created.substr(8, 2) + '/' + event.created.substr(2, 2),
desc: event.description
};
})
@ -297,7 +298,9 @@
add: function(args) {
setTimeout(function() {
$.ajax({
url: createURL('createProject', { ignoreProject: true }),
url: createURL('createProject', {
ignoreProject: true
}),
data: {
account: args.context.users[0].account,
domainId: args.context.users[0].domainid,
@ -327,16 +330,30 @@
noHeaderActionsColumn: true,
ignoreEmptyFields: true,
fields: {
'email': { edit: true, label: 'label.email' },
'account': { edit: true, label: 'label.account' },
'state': { edit: 'ignore', label: 'label.status' },
'add-user': { addButton: true, label: '' }
'email': {
edit: true,
label: 'label.email'
},
'account': {
edit: true,
label: 'label.account'
},
'state': {
edit: 'ignore',
label: 'label.status'
},
'add-user': {
addButton: true,
label: ''
}
},
add: {
label: 'label.invite',
action: function(args) {
$.ajax({
url: createURL('addAccountToProject', { ignoreProject: true }),
url: createURL('addAccountToProject', {
ignoreProject: true
}),
data: {
projectId: args.context.projects[0].id,
account: args.data.account,
@ -364,8 +381,7 @@
},
actionPreFilter: function(args) {
if (args.context.projects &&
args.context.projects[0] &&
!args.context.projects[0].isNew) {
args.context.projects[0] && !args.context.projects[0].isNew) {
return args.context.actions;
}
@ -383,7 +399,9 @@
},
success: function(data) {
args.response.success({
_custom: { jobId: data.deleteprojectinvitationresponse.jobid },
_custom: {
jobId: data.deleteprojectinvitationresponse.jobid
},
notification: {
label: 'label.revoke.project.invite',
poll: pollAsyncJobResult
@ -398,7 +416,9 @@
// Project users data provider
dataProvider: function(args) {
$.ajax({
url: createURL('listProjectInvitations', { ignoreProject: true }),
url: createURL('listProjectInvitations', {
ignoreProject: true
}),
data: {
state: 'Pending',
listAll: true,
@ -429,15 +449,26 @@
return g_capabilities.projectinviterequired;
},
fields: {
'username': { edit: true, label: 'label.account' },
'role': { edit: 'ignore', label: 'label.role' },
'add-user': { addButton: true, label: '' }
'username': {
edit: true,
label: 'label.account'
},
'role': {
edit: 'ignore',
label: 'label.role'
},
'add-user': {
addButton: true,
label: ''
}
},
add: {
label: 'label.add.account',
action: function(args) {
$.ajax({
url: createURL('addAccountToProject', { ignoreProject: true }),
url: createURL('addAccountToProject', {
ignoreProject: true
}),
data: {
projectId: args.context.projects[0].id,
account: args.data.username
@ -456,7 +487,9 @@
});
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',
action: function(args) {
$.ajax({
url: createURL('deleteAccountFromProject', { ignoreProject: true }),
url: createURL('deleteAccountFromProject', {
ignoreProject: true
}),
data: {
projectId: args.context.projects[0].id,
account: args.context.multiRule[0].username
@ -524,7 +559,9 @@
label: 'label.make.project.owner',
action: function(args) {
$.ajax({
url: createURL('updateProject', { ignoreProject: true }),
url: createURL('updateProject', {
ignoreProject: true
}),
data: {
id: args.context.projects[0].id,
account: args.context.multiRule[0].username
@ -558,7 +595,9 @@
// Project users data provider
dataProvider: function(args) {
$.ajax({
url: createURL('listProjectAccounts', { ignoreProject: true }),
url: createURL('listProjectAccounts', {
ignoreProject: true
}),
data: {
projectId: args.context.projects[0].id
},
@ -572,8 +611,7 @@
return {
id: elem.accountid,
role: elem.role,
username: elem.role == 'Owner' ?
elem.account + ' (owner)' : elem.account
username: elem.role == 'Owner' ? elem.account + ' (owner)' : elem.account
};
})
});
@ -595,7 +633,9 @@
}
$.ajax({
url: createURL('listProjects', { ignoreProject: true }),
url: createURL('listProjects', {
ignoreProject: true
}),
data: data,
dataType: 'json',
async: true,
@ -628,10 +668,18 @@
title: 'label.projects',
listView: {
fields: {
name: { label: 'label.name' },
displaytext: { label: 'label.display.name' },
domain: { label: 'label.domain' },
account: { label: 'label.owner.account' },
name: {
label: 'label.name'
},
displaytext: {
label: 'label.display.name'
},
domain: {
label: 'label.domain'
},
account: {
label: 'label.owner.account'
},
state: {
label: 'label.status',
indicator: {
@ -644,8 +692,12 @@
},
advSearchFields: {
name: { label: 'label.name' },
displaytext: { label: 'label.display.text' },
name: {
label: 'label.name'
},
displaytext: {
label: 'label.display.text'
},
domainid: {
label: 'Domain',
@ -658,11 +710,17 @@
details: 'min'
},
success: function(json) {
var array1 = [{id: '', description: ''}];
var array1 = [{
id: '',
description: ''
}];
var domains = json.listdomainsresponse.domain;
if (domains != null && domains.length > 0) {
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({
@ -670,8 +728,7 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
@ -707,7 +764,9 @@
}
$.ajax({
url: createURL('listProjects', { ignoreProject: true }),
url: createURL('listProjects', {
ignoreProject: true
}),
data: data,
success: function(data) {
args.response.success({
@ -770,7 +829,9 @@
});
},
messages: {
notification: function(args) { return 'label.edit.project.details'; }
notification: function(args) {
return 'label.edit.project.details';
}
}
},
disable: {
@ -786,7 +847,9 @@
_custom: {
jobId: json.suspendprojectresponse.jobid,
getUpdatedItem: function() {
return { state: 'Suspended' };
return {
state: 'Suspended'
};
}
}
});
@ -797,10 +860,16 @@
});
},
messages: {
confirm: function() { return 'message.suspend.project'; },
notification: function() { return 'label.suspend.project'; }
confirm: function() {
return 'message.suspend.project';
},
notification: { poll: pollAsyncJobResult }
notification: function() {
return 'label.suspend.project';
}
},
notification: {
poll: pollAsyncJobResult
}
},
enable: {
@ -816,7 +885,9 @@
_custom: {
jobId: json.activaterojectresponse.jobid, // NOTE: typo
getUpdatedItem: function() {
return { state: 'Active' };
return {
state: 'Active'
};
}
}
});
@ -827,17 +898,25 @@
});
},
messages: {
confirm: function() { return 'message.activate.project'; },
notification: function() { return 'label.activate.project'; }
confirm: function() {
return 'message.activate.project';
},
notification: { poll: pollAsyncJobResult }
notification: function() {
return 'label.activate.project';
}
},
notification: {
poll: pollAsyncJobResult
}
},
remove: {
label: 'label.delete.project',
action: function(args) {
$.ajax({
url: createURL('deleteProject', { ignoreProject: true }),
url: createURL('deleteProject', {
ignoreProject: true
}),
data: {
id: args.data.id
},
@ -847,7 +926,9 @@
args.response.success({
_custom: {
getUpdatedItem: function(data) {
return $.extend(data, { state: 'Destroyed' });
return $.extend(data, {
state: 'Destroyed'
});
},
onComplete: function(data) {
$(window).trigger('cloudStack.deleteProject', args);
@ -903,19 +984,30 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
name: { label: 'label.name' }
},
{
displaytext: { label: 'label.display.name', isEditable: true },
domain: { label: 'label.domain' },
account: { label: 'label.account'},
state: { label: 'label.state' }
fields: [{
name: {
label: 'label.name'
}
],
}, {
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) {
var projectID = args.context.projects[0].id;
@ -933,8 +1025,7 @@
},
success: function(json) {
args.response.success({
data: json.listprojectsresponse.project ?
json.listprojectsresponse.project[0] : {},
data: json.listprojectsresponse.project ? json.listprojectsresponse.project[0] : {},
actionFilter: projectsActionFilter
});
}
@ -948,9 +1039,10 @@
var project = args.context.projects[0];
var multiEditArgs = $.extend(
true, {},
cloudStack.projects.addUserForm,
{
context: { projects: [project] }
cloudStack.projects.addUserForm, {
context: {
projects: [project]
}
}
);
var $users = $('<div>').multiEdit(multiEditArgs);
@ -965,7 +1057,9 @@
var project = args.context.projects[0];
var $invites = cloudStack.uiCustom.projectsTabs.userManagement({
useInvites: true,
context: { projects: [project] }
context: {
projects: [project]
}
});
return $invites;
@ -994,13 +1088,19 @@
title: 'label.invitations',
listView: {
fields: {
project: { label: 'label.project' },
domain: { label: 'label.domain' },
project: {
label: 'label.project'
},
domain: {
label: 'label.domain'
},
state: {
label: 'label.status',
indicator: {
'Accepted': 'on', 'Completed': 'on',
'Pending': 'off', 'Declined': 'off'
'Accepted': 'on',
'Completed': 'on',
'Pending': 'off',
'Declined': 'off'
}
}
},
@ -1014,8 +1114,7 @@
success: function(data) {
args.response.success({
actionFilter: projectInvitationActionFilter,
data: data.listprojectinvitationsresponse.projectinvitation ?
data.listprojectinvitationsresponse.projectinvitation : []
data: data.listprojectinvitationsresponse.projectinvitation ? data.listprojectinvitationsresponse.projectinvitation : []
});
}
});
@ -1031,7 +1130,9 @@
$.ajax({
url: createURL('listProjectInvitations'),
data: { state: 'Pending' },
data: {
state: 'Pending'
},
async: false,
success: function(json) {
if (json.listprojectinvitationsresponse.count) {
@ -1045,8 +1146,20 @@
createForm: {
desc: 'message.enter.token',
fields: {
projectid: { label: 'label.project.id', validation: { required: true}, docID: 'helpEnterTokenProjectID' },
token: { label: 'label.token', docID: 'helpEnterTokenToken', validation: { required: true }}
projectid: {
label: 'label.project.id',
validation: {
required: true
},
docID: 'helpEnterTokenProjectID'
},
token: {
label: 'label.token',
docID: 'helpEnterTokenToken',
validation: {
required: true
}
}
}
},
action: function(args) {
@ -1073,7 +1186,9 @@
return 'message.join.project';
}
},
notification: { poll: pollAsyncJobResult }
notification: {
poll: pollAsyncJobResult
}
},
accept: {
@ -1091,17 +1206,27 @@
args.response.success({
_custom: {
jobId: data.updateprojectinvitationresponse.jobid,
getUpdatedItem: function() { return { state: 'Accepted' }; }
getUpdatedItem: function() {
return {
state: 'Accepted'
};
}
}
});
}
});
},
messages: {
confirm: function() { return 'message.confirm.join.project'; },
notification: function() { return 'label.accept.project.invitation'; }
confirm: function() {
return 'message.confirm.join.project';
},
notification: { poll: pollAsyncJobResult }
notification: function() {
return 'label.accept.project.invitation';
}
},
notification: {
poll: pollAsyncJobResult
}
},
decline: {
@ -1119,16 +1244,26 @@
args.response.success({
_custom: {
jobId: data.updateprojectinvitationresponse.jobid,
getUpdatedItem: function() { return { state: 'Declined' }; }
getUpdatedItem: function() {
return {
state: 'Declined'
};
}
}
});
}
});
},
notification: { poll: pollAsyncJobResult },
notification: {
poll: pollAsyncJobResult
},
messages: {
confirm: function() { return 'message.decline.invitation'; },
notification: function() { return 'label.decline.invitation'; }
confirm: function() {
return 'message.decline.invitation';
},
notification: function() {
return 'label.decline.invitation';
}
}
}
}

View File

@ -20,7 +20,9 @@
id: 'regions',
sectionSelect: {
label: 'label.select-view',
preFilter: function() { return ['regions']; }
preFilter: function() {
return ['regions'];
}
},
regionSelector: {
dataProvider: function(args) {
@ -30,9 +32,10 @@
var regions = json.listregionsresponse.region;
args.response.success({
data: regions ? regions : [
{ id: -1, name: _l('label.no.data') }
]
data: regions ? regions : [{
id: -1,
name: _l('label.no.data')
}]
});
}
});
@ -48,9 +51,15 @@
id: 'regions',
label: 'label.menu.regions',
fields: {
name: { label: 'label.name' },
id: { label: 'ID' },
endpoint: { label: 'label.endpoint' }
name: {
label: 'label.name'
},
id: {
label: 'ID'
},
endpoint: {
label: 'label.endpoint'
}
},
actions: {
add: {
@ -62,15 +71,32 @@
return false;
},
messages: {
notification: function() { return 'label.add.region'; }
notification: function() {
return 'label.add.region';
}
},
createForm: {
title: 'label.add.region',
desc: 'message.add.region',
fields: {
id: { label: 'label.id', validation: { required: true } },
name: { label: 'label.name', validation: { required: true } },
endpoint: { label: 'label.endpoint', validation: { required: true } }
id: {
label: 'label.id',
validation: {
required: true
}
},
name: {
label: 'label.name',
validation: {
required: true
}
},
endpoint: {
label: 'label.endpoint',
validation: {
required: true
}
}
}
},
action: function(args) {
@ -85,7 +111,9 @@
data: data,
success: function(json) {
var item = json.addregionresponse.region;
args.response.success({data: item});
args.response.success({
data: item
});
$(window).trigger('cloudStack.refreshRegions');
},
error: function(json) {
@ -116,12 +144,10 @@
},
detailView: {
name: 'Region details',
viewAll: [
{
viewAll: [{
path: 'regions.GSLB',
label: 'GSLB'
},
{
}, {
path: 'regions.portableIpRanges',
label: 'Portable IP',
preFilter: function(args) {
@ -130,8 +156,7 @@
return false;
}
}
],
}],
actions: {
edit: {
label: 'label.edit.region',
@ -158,8 +183,12 @@
remove: {
label: 'label.remove.region',
messages: {
notification: function() { return 'label.remove.region'; },
confirm: function() { return 'message.remove.region'; }
notification: function() {
return 'label.remove.region';
},
confirm: function() {
return 'message.remove.region';
}
},
preAction: function(args) {
var region = args.context.regions[0];
@ -181,7 +210,9 @@
$.ajax({
url: createURL('removeRegion'),
data: { id: region.id },
data: {
id: region.id
},
success: function(json) {
args.response.success();
$(window).trigger('cloudStack.refreshRegions');
@ -196,19 +227,26 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
id: { label: 'label.id' }
},
{
name: { label: 'label.name', isEditable: true },
endpoint: { label: 'label.endpoint', isEditable: true }
fields: [{
id: {
label: 'label.id'
}
],
}, {
name: {
label: 'label.name',
isEditable: true
},
endpoint: {
label: 'label.endpoint',
isEditable: true
}
}],
dataProvider: function(args) {
$.ajax({
url: createURL('listRegions&listAll=true'),
data: { id: args.context.regions[0].id },
data: {
id: args.context.regions[0].id
},
success: function(json) {
var region = json.listregionsresponse.region
@ -235,9 +273,15 @@
id: 'GSLB',
label: 'GSLB',
fields: {
name: { label: 'label.name' },
gslbdomainname: { label: 'GSLB Domain Name' },
gslblbmethod: { label: 'Algorithm' }
name: {
label: 'label.name'
},
gslbdomainname: {
label: 'GSLB Domain Name'
},
gslblbmethod: {
label: 'Algorithm'
}
},
actions: {
add: {
@ -257,19 +301,32 @@
fields: {
name: {
label: 'label.name',
validation: { required: true }
validation: {
required: true
}
},
description: {
label: 'label.description'
},
gslbdomainname: {
label: 'GSLB Domain Name',
validation: { required: true }
validation: {
required: true
}
},
gslblbmethod: {
label: 'Algorithm',
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({
data: array1
});
@ -278,12 +335,20 @@
gslbservicetype: {
label: 'Service Type',
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({
data: array1
});
},
validation: { required: true }
validation: {
required: true
}
},
domainid: {
label: 'Domain',
@ -296,11 +361,17 @@
details: 'min'
},
success: function(json) {
var array1 = [{id: '', description: ''}];
var array1 = [{
id: '',
description: ''
}];
var domains = json.listdomainsresponse.domain;
if (domains != null && domains.length > 0) {
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({
@ -308,8 +379,7 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
@ -343,26 +413,31 @@
gslbservicetype: args.data.gslbservicetype
};
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)
$.extend(data, { domainid: args.data.domainid });
$.extend(data, {
domainid: args.data.domainid
});
if (args.data.account != null && args.data.account.length > 0)
$.extend(data, { account: args.data.account });
$.extend(data, {
account: args.data.account
});
$.ajax({
url: createURL('createGlobalLoadBalancerRule'),
data: data,
success: function(json) {
var jid = json.creategloballoadbalancerruleresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.globalloadbalancer;
}
}
}
);
});
}
});
},
@ -387,8 +462,7 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
@ -397,7 +471,10 @@
detailView: {
name: 'GSLB details',
viewAll: { path: 'regions.lbUnderGSLB', label: 'assigned load balancing' },
viewAll: {
path: 'regions.lbUnderGSLB',
label: 'assigned load balancing'
},
actions: {
remove: {
label: 'delete GSLB',
@ -434,18 +511,27 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
name: { label: 'label.name' }
},
{
description: { label: 'label.description' },
gslbdomainname: { label: 'GSLB Domain Name' },
gslblbmethod: { label: 'Algorithm' },
gslbservicetype: { label: 'Service Type' },
id: { label: 'ID' }
fields: [{
name: {
label: 'label.name'
}
],
}, {
description: {
label: 'label.description'
},
gslbdomainname: {
label: 'GSLB Domain Name'
},
gslblbmethod: {
label: 'Algorithm'
},
gslbservicetype: {
label: 'Service Type'
},
id: {
label: 'ID'
}
}],
dataProvider: function(args) {
var data = {
id: args.context.GSLB[0].id
@ -475,11 +561,21 @@
id: 'portableIpRanges',
label: 'Portable IP Ranges',
fields: {
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'
}
},
dataProvider: function(args) {
$.ajax({
@ -511,23 +607,33 @@
fields: {
startip: {
label: 'label.start.IP',
validation: { required: true }
validation: {
required: true
}
},
endip: {
label: 'label.end.IP',
validation: { required: true }
validation: {
required: true
}
},
gateway: {
label: 'label.gateway',
validation: { required: true }
validation: {
required: true
}
},
netmask: {
label: 'label.netmask',
validation: { required: true }
validation: {
required: true
}
},
vlan: {
label: 'label.vlan',
validation: { required: false }
validation: {
required: false
}
}
}
},
@ -611,16 +717,26 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
id: { label: 'label.id' }
fields: [{
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: {
label: 'Portable IPs',
converter: function(args) {
@ -636,8 +752,7 @@
return text1;
}
}
}
],
}],
dataProvider: function(args) {
$.ajax({
url: createURL('listPortableIpRanges'),
@ -670,10 +785,18 @@
id: 'lbUnderGSLB',
label: 'assigned load balancing',
fields: {
name: { label: 'label.name' },
publicport: { label: 'label.public.port' },
privateport: { label: 'label.private.port' },
algorithm: { label: 'label.algorithm' }
name: {
label: 'label.name'
},
publicport: {
label: 'label.public.port'
},
privateport: {
label: 'label.private.port'
},
algorithm: {
label: 'label.algorithm'
}
},
dataProvider: function(args) {
var data = {
@ -751,15 +874,14 @@
data: data,
success: function(json) {
var jid = json.assigntogloballoadbalancerruleresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
}
}
}
);
});
}
});
},
@ -806,22 +928,39 @@
tabs: {
details: {
title: 'label.details',
fields: [
{
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' }
fields: [{
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'
}
}],
dataProvider: function(args) {
$.ajax({
url: createURL('listLoadBalancerRules'),

View File

@ -59,22 +59,21 @@ var pollAsyncJobResult = function(args) {
var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) {
return; //Job has not completed
}
else {
} else {
if (result.jobstatus == 1) { // Succeeded
if (args._custom.getUpdatedItem != null && args._custom.getActionFilter != null) {
args.complete({
data: args._custom.getUpdatedItem(json),
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({
data: args._custom.getUpdatedItem(json)
});
}
else {
args.complete({ data: json.queryasyncjobresultresponse.jobresult });
} else {
args.complete({
data: json.queryasyncjobresultresponse.jobresult
});
}
if (args._custom.fullRefreshAfterComplete == true) {
@ -86,16 +85,23 @@ var pollAsyncJobResult = function(args) {
if (args._custom.onComplete) {
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;
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) {
args.error({message: msg, updatedData: args._custom.getUpdatedItemWhenAsyncJobFails()});
}
else {
args.error({message: msg});
args.error({
message: msg,
updatedData: args._custom.getUpdatedItemWhenAsyncJobFails()
});
} else {
args.error({
message: msg
});
}
}
}
@ -107,6 +113,7 @@ var pollAsyncJobResult = function(args) {
}
//API calls
function createURL(apiName, options) {
if (!options) options = {};
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
args.$form.find('.form-item[rel=zoneId]').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=physicalNetworkId]').css('display', 'inline-block');
}
@ -173,23 +179,28 @@ var addGuestNetworkDialog = {
name: {
docID: 'helpGuestNetworkZoneName',
label: 'label.name',
validation: { required: true }
validation: {
required: true
}
},
description: {
label: 'label.description',
docID: 'helpGuestNetworkZoneDescription',
validation: { required: true }
validation: {
required: true
}
},
zoneId: {
label: 'label.zone',
validation: { required: true },
validation: {
required: true
},
docID: 'helpGuestNetworkZone',
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
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({
url: createURL('listZones'),
async: false,
@ -224,8 +235,7 @@ var addGuestNetworkDialog = {
select: function(args) {
if ('physicalNetworks' in args.context) {
addGuestNetworkDialog.physicalNetworkObjs = args.context.physicalNetworks;
}
else {
} else {
var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();
$.ajax({
url: createURL('listPhysicalNetworks'),
@ -241,10 +251,15 @@ var addGuestNetworkDialog = {
var items = [];
if (addGuestNetworkDialog.physicalNetworkObjs != null) {
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
},
@ -274,15 +289,31 @@ var addGuestNetworkDialog = {
var array1 = [];
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 {
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'});
}
args.response.success({data: array1});
args.response.success({
data: array1
});
args.$select.change(function() {
var $form = $(this).closest('form');
@ -291,20 +322,17 @@ var addGuestNetworkDialog = {
$form.find('.form-item[rel=subdomainaccess]').hide();
$form.find('.form-item[rel=account]').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=subdomainaccess]').css('display', 'inline-block');
$form.find('.form-item[rel=account]').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=subdomainaccess]').hide();
$form.find('.form-item[rel=account]').css('display', 'inline-block');
$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=subdomainaccess]').hide();
$form.find('.form-item[rel=account]').hide();
@ -315,7 +343,9 @@ var addGuestNetworkDialog = {
},
domainId: {
label: 'label.domain',
validation: { required: true },
validation: {
required: true
},
select: function(args) {
var items = [];
var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();
@ -336,7 +366,10 @@ var addGuestNetworkDialog = {
success: function(json) {
var domainObjs = json.listdomainchildrenresponse.domain;
$(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) {
var domainObjs = json.listdomainsresponse.domain;
$(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({
url: createURL("listDomains&listAll=true"),
dataType: "json",
@ -360,22 +395,33 @@ var addGuestNetworkDialog = {
success: function(json) {
var domainObjs = json.listdomainsresponse.domain;
$(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: {
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: {
label: 'label.project',
validation: { required: true },
validation: {
required: true
},
select: function(args) {
var items = [];
$.ajax({
@ -385,11 +431,16 @@ var addGuestNetworkDialog = {
success: function(json) {
projectObjs = json.listprojectsresponse.project;
$(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
}
}
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() {
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
$form.find('.form-item[rel=isolatedpvlanId]').hide();
}
else {
} else {
$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
@ -538,11 +593,9 @@ var addGuestNetworkDialog = {
action: function(args) { //Add guest network in advanced zone
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.response.error("Either IPv4 fields or IPv6 fields need to be filled when adding a guest network");
return;
}
@ -582,12 +635,10 @@ var addGuestNetworkDialog = {
if ($form.find('.form-item[rel=account]').css("display") != "none") { //account-specific
array1.push("&account=" + args.data.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("&acltype=account");
}
else { //domain-specific
} else { //domain-specific
array1.push("&acltype=domain");
if ($form.find('.form-item[rel=subdomainaccess]:visible input:checked').size())
@ -595,8 +646,7 @@ var addGuestNetworkDialog = {
else
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)
}
@ -630,7 +680,9 @@ var addGuestNetworkDialog = {
dataType: "json",
success: function(json) {
var item = json.createnetworkresponse.network;
args.response.success({data:item});
args.response.success({
data: item
});
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
@ -648,6 +700,7 @@ var addGuestNetworkDialog = {
// Role Functions
function isAdmin() {
return (g_role == 1);
}
@ -663,13 +716,9 @@ function isUser() {
function isSelfOrChildDomainUser(username, useraccounttype, userdomainid, iscallerchilddomain) {
if (username == g_username) { //is self
return true;
} else if(isDomainAdmin()
&& iscallerchilddomain
&& (useraccounttype == 0)) { //domain admin to user
} else if (isDomainAdmin() && iscallerchilddomain && (useraccounttype == 0)) { //domain admin to user
return true;
} else if(isDomainAdmin()
&& iscallerchilddomain
&& (userdomainid != g_domainid) ) { //domain admin to subdomain admin and user
} else if (isDomainAdmin() && iscallerchilddomain && (userdomainid != g_domainid)) { //domain admin to subdomain admin and user
return true;
} else {
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
// handle errors that are not already handled by this method.
function handleError(XMLHttpResponse, handleErrorCallback) {
// User Not authenticated
if (XMLHttpResponse.status == ERROR_ACCESS_DENIED_DUE_TO_UNAUTHORIZED) {
$("#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");
}
else if (XMLHttpResponse.status == ERROR_INTERNET_CANNOT_CONNECT) {
} else if (XMLHttpResponse.status == ERROR_INTERNET_CANNOT_CONNECT) {
$("#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();
}
else if (handleErrorCallback != undefined) {
} else if (handleErrorCallback != undefined) {
handleErrorCallback();
}
else {
} else {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
$("#dialog_error").text(_s(errorMsg)).dialog("open");
}
@ -717,8 +762,7 @@ function parseXMLHttpResponse(XMLHttpResponse) {
else
return _s(errorObj.errortext);
}
}
else {
} else {
return "";
}
}
@ -726,8 +770,7 @@ function parseXMLHttpResponse(XMLHttpResponse) {
function isValidJsonString(str) {
try {
JSON.parse(str);
}
catch (e) {
} catch (e) {
return false;
}
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 b = regexp.test(args); //true or false
if (b == false)
cloudStack.dialog.notice({ message: 'message.validate.instance.name' });
cloudStack.dialog.notice({
message: 'message.validate.instance.name'
});
return b;
}
}
@ -752,12 +797,10 @@ cloudStack.preFilter = {
if (isAdmin()) {
args.$form.find('.form-item[rel=isPublic]').css('display', 'inline-block');
args.$form.find('.form-item[rel=isFeatured]').css('display', 'inline-block');
}
else {
} else {
if (g_userPublicTemplateEnabled == "true") {
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=isFeatured]').hide();
@ -770,8 +813,7 @@ cloudStack.preFilter = {
if ($dedicated.find('input[type=checkbox]:checked').length > 0) {
$capacity.hide();
$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.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('restart');
allowedActions.push('remove');
}
else if(jsonObj.type == 'Shared') {
} else if (jsonObj.type == 'Shared') {
if (isAdmin()) {
allowedActions.push('restart');
allowedActions.push('remove');
@ -895,71 +936,124 @@ cloudStack.converters = {
},
toAlertType: function(alertCode) {
switch (alertCode) {
case 0 : return _l('label.memory');
case 1 : return _l('label.cpu');
case 2 : return _l('label.storage');
case 3 : return _l('label.primary.storage');
case 4 : 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');
case 0:
return _l('label.memory');
case 1:
return _l('label.cpu');
case 2:
return _l('label.storage');
case 3:
return _l('label.primary.storage');
case 4:
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
case 8 : return "User VM";
case 11 : return "Routing Host";
case 12 : return "Storage";
case 13 : return "Usage Server";
case 14 : return "Management Server";
case 15 : return "Domain Router";
case 16 : return "Console Proxy";
case 17 : return "User VM";
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";
case 8:
return "User VM";
case 11:
return "Routing Host";
case 12:
return "Storage";
case 13:
return "Usage Server";
case 14:
return "Management Server";
case 15:
return "Domain Router";
case 16:
return "Console Proxy";
case 17:
return "User VM";
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) {
switch (capacityCode) {
case 0 : return _l('label.memory');
case 1 : return _l('label.cpu');
case 2 : return _l('label.storage');
case 3 : return _l('label.primary.storage');
case 4 : return _l('label.public.ips');
case 5 : return _l('label.management.ips');
case 6 : return _l('label.secondary.storage');
case 7 : return _l('label.vlan');
case 8 : return _l('label.direct.ips');
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";
case 0:
return _l('label.memory');
case 1:
return _l('label.cpu');
case 2:
return _l('label.storage');
case 3:
return _l('label.primary.storage');
case 4:
return _l('label.public.ips');
case 5:
return _l('label.management.ips');
case 6:
return _l('label.secondary.storage');
case 7:
return _l('label.vlan');
case 8:
return _l('label.direct.ips');
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) {
switch (alertCode) {
case 0: return cloudStack.converters.convertBytes(value);
case 1: return cloudStack.converters.convertHz(value);
case 2: 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);
case 0:
return cloudStack.converters.convertBytes(value);
case 1:
return cloudStack.converters.convertHz(value);
case 2:
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;
@ -967,6 +1061,7 @@ cloudStack.converters = {
}
//data parameter passed to API call in listView
function listViewDataProvider(args, data) {
//search
if (args.filterBy != null) {
@ -976,18 +1071,15 @@ function listViewDataProvider(args, data) {
$.extend(data, {
'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, {
'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
}
}
}
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) {
case "name":
if (args.filterBy.search.value.length > 0) {
@ -1018,8 +1110,7 @@ var addExtraPropertiesToGuestNetworkObject = function(jsonObj) {
jsonObj.scope = "All";
else
jsonObj.scope = "Domain (" + jsonObj.domain + ")";
}
else if (jsonObj.acltype == "Account"){
} else if (jsonObj.acltype == "Account") {
if (jsonObj.project != null)
jsonObj.scope = "Account (" + jsonObj.domain + ", " + jsonObj.project + ")";
else
@ -1032,6 +1123,7 @@ var addExtraPropertiesToGuestNetworkObject = function(jsonObj) {
}
//find service object in network object
function ipFindNetworkServiceByName(pName, networkObj) {
if (networkObj == null)
return null;
@ -1045,6 +1137,7 @@ function ipFindNetworkServiceByName(pName, networkObj) {
return null;
}
//find capability object in service object in network object
function ipFindCapabilityByName(pName, networkServiceObj) {
if (networkServiceObj == null)
return null;
@ -1059,6 +1152,7 @@ function ipFindCapabilityByName(pName, networkServiceObj) {
}
//compose URL for adding primary storage
function nfsURL(server, path) {
var url;
if (server.indexOf("://") == -1)
@ -1149,6 +1243,7 @@ function iscsiURL(server, iqn, lun) {
//VM Instance
function getVmName(p_vmName, p_vmDisplayname) {
if (p_vmDisplayname == null)
return _s(p_vmName);
@ -1284,7 +1379,9 @@ cloudStack.api = {
},
success: function(json) {
args.response.success({
_custom: { jobId: json.createtagsresponse.jobid },
_custom: {
jobId: json.createtagsresponse.jobid
},
notification: {
desc: 'Add tag for ' + resourceType,
poll: pollAsyncJobResult
@ -1308,7 +1405,9 @@ cloudStack.api = {
},
success: function(json) {
args.response.success({
_custom: { jobId: json.deletetagsresponse.jobid },
_custom: {
jobId: json.deletetagsresponse.jobid
},
notification: {
desc: 'Remove tag for ' + resourceType,
poll: pollAsyncJobResult
@ -1342,8 +1441,7 @@ cloudStack.api = {
data: data,
success: function(json) {
args.response.success({
data: json.listtagsresponse ?
json.listtagsresponse.tag : []
data: json.listtagsresponse ? json.listtagsresponse.tag : []
});
},
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'
},
mine: { label: 'ui.listView.filters.mine' },
featured: { label: 'label.featured' },
community: { label: 'label.community' }
mine: {
label: 'ui.listView.filters.mine'
},
featured: {
label: 'label.featured'
},
community: {
label: 'label.community'
}
},
fields: {
name: { label: 'label.name' },
zonename: { label: 'label.zone' },
hypervisor: { label: 'label.hypervisor' }
name: {
label: 'label.name'
},
zonename: {
label: 'label.zone'
},
hypervisor: {
label: 'label.hypervisor'
}
},
advSearchFields: {
name: { label: 'Name' },
name: {
label: 'Name'
},
zoneid: {
label: 'Zone',
select: function(args) {
@ -74,8 +88,12 @@
});
}
},
tagKey: { label: 'Tag Key' },
tagValue: { label: 'Tag Value' }
tagKey: {
label: 'Tag Key'
},
tagValue: {
label: 'Tag Value'
}
},
reorder: cloudStack.api.actions.sort('updateTemplate', 'templates'),
@ -95,17 +113,23 @@
name: {
label: 'label.name',
docID: 'helpRegisterTemplateName',
validation: { required: true }
validation: {
required: true
}
},
description: {
label: 'label.description',
docID: 'helpRegisterTemplateDescription',
validation: { required: true }
validation: {
required: true
}
},
url: {
label: 'URL',
docID: 'helpRegisterTemplateURL',
validation: { required: true }
validation: {
required: true
}
},
zone: {
label: 'label.zone',
@ -120,13 +144,21 @@
var items = json.listzonesresponse.zone;
if (items != null) {
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])) {
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 items = [];
$(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=nicAdapterType]').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=nicAdapterType]').hide();
$form.find('.form-item[rel=keyboardType]').hide();
@ -181,10 +217,21 @@
isHidden: true,
select: function(args) {
var items = []
items.push({id: "", description: ""});
items.push({id: "scsi", description: "scsi"});
items.push({id: "ide", description: "ide"});
args.response.success({data: items});
items.push({
id: "",
description: ""
});
items.push({
id: "scsi",
description: "scsi"
});
items.push({
id: "ide",
description: "ide"
});
args.response.success({
data: items
});
}
},
nicAdapterType: {
@ -192,12 +239,29 @@
isHidden: true,
select: function(args) {
var items = []
items.push({id: "", description: ""});
items.push({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});
items.push({
id: "",
description: ""
});
items.push({
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: {
@ -205,10 +269,21 @@
isHidden: true,
select: function(args) {
var items = []
items.push({id: "", description: ""});
items.push({id: "us", description: "US"});
items.push({id: "jp", description: "Japanese"});
args.response.success({data: items});
items.push({
id: "",
description: ""
});
items.push({
id: "us",
description: "US"
});
items.push({
id: "jp",
description: "Japanese"
});
args.response.success({
data: items
});
}
},
//fields for hypervisor == "VMware" (ends here)
@ -221,29 +296,44 @@
var items = [];
if (args.hypervisor == "XenServer") {
//formatSelect.append("<option value='VHD'>VHD</option>");
items.push({id:'VHD', description: 'VHD'});
}
else if(args.hypervisor == "VMware") {
items.push({
id: 'VHD',
description: 'VHD'
});
} else if (args.hypervisor == "VMware") {
//formatSelect.append("<option value='OVA'>OVA</option>");
items.push({id:'OVA', description: 'OVA'});
}
else if(args.hypervisor == "KVM") {
items.push({
id: 'OVA',
description: 'OVA'
});
} else if (args.hypervisor == "KVM") {
//formatSelect.append("<option value='QCOW2'>QCOW2</option>");
items.push({id:'QCOW2', description: 'QCOW2'});
}
else if(args.hypervisor == "BareMetal") {
items.push({
id: 'QCOW2',
description: 'QCOW2'
});
} else if (args.hypervisor == "BareMetal") {
//formatSelect.append("<option value='BareMetal'>BareMetal</option>");
items.push({id:'BareMetal', description: 'BareMetal'});
}
else if(args.hypervisor == "Ovm") {
items.push({
id: 'BareMetal',
description: 'BareMetal'
});
} else if (args.hypervisor == "Ovm") {
//formatSelect.append("<option value='RAW'>RAW</option>");
items.push({id:'RAW', description: 'RAW'});
}
else if(args.hypervisor == "LXC") {
items.push({
id: 'RAW',
description: 'RAW'
});
} else if (args.hypervisor == "LXC") {
//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,
success: function(json) {
var items = json.listostypesresponse.ostype;
args.response.success({data: items});
args.response.success({
data: items
});
}
});
}
@ -345,7 +437,9 @@
data: data,
success: function(json) {
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) {
for(var i=1; i<items.length; i++) {
@ -408,7 +502,9 @@
}
$.ajax({
url: createURL('listTemplates', { ignoreProject: ignoreProject }),
url: createURL('listTemplates', {
ignoreProject: ignoreProject
}),
data: data,
success: function(json) {
var items = json.listtemplatesresponse.template;
@ -457,8 +553,7 @@
$.extend(data, {
ispublic: true
});
}
else if(args.data.ispublic == "off") {
} else if (args.data.ispublic == "off") {
$.extend(data, {
ispublic: false
});
@ -468,18 +563,17 @@
$.extend(data, {
isfeatured: true
});
}
else if(args.data.isfeatured == "off") {
} else if (args.data.isfeatured == "off") {
$.extend(data, {
isfeatured: false
}); }
});
}
//if args.data.isextractable is undefined, do not pass isextractable to API call.
if (args.data.isextractable == "on") {
$.extend(data, {
isextractable: true
});
}
else if(args.data.isextractable == "off") {
} else if (args.data.isextractable == "off") {
$.extend(data, {
isextractable: false
});
@ -507,7 +601,9 @@
async: false,
success: function(json) {
var item = json.listtemplatesresponse.template;
args.response.success({data: item});
args.response.success({
data: item
});
}
});
}
@ -533,7 +629,9 @@
destinationZoneId: {
label: 'label.destination.zone',
docID: 'helpCopyTemplateDestination',
validation: { required: true },
validation: {
required: true
},
select: function(args) {
$.ajax({
url: createURL("listZones&available=true"),
@ -545,11 +643,16 @@
if (items != null) {
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
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,
success: function(json) {
var jid = json.copytemplateresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return {}; //nothing in this template needs to be updated
},
@ -573,8 +676,7 @@
return templateActionfilter;
}
}
}
);
});
}
});
},
@ -610,9 +712,9 @@
async: true,
success: function(json) {
var jid = json.extracttemplateresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.template;
},
@ -620,8 +722,7 @@
return templateActionfilter;
}
}
}
);
});
}
});
},
@ -651,12 +752,11 @@
async: true,
success: function(json) {
var jid = json.deletetemplateresponse.jobid;
args.response.success(
{_custom:
{jobId: jid
args.response.success({
_custom: {
jobId: jid
}
}
);
});
}
});
},
@ -674,34 +774,50 @@
var hiddenFields;
if (isAdmin()) {
hiddenFields = [];
}
else {
} else {
hiddenFields = ["hypervisor"];
}
return hiddenFields;
},
fields: [
{
fields: [{
name: {
label: 'label.name',
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: {
label: 'label.description',
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: {
label: 'label.size',
converter: function(args) {
@ -740,8 +856,7 @@
isEditable: function() {
if (isAdmin()) {
return true;
}
else {
} else {
if (g_userPublicTemplateEnabled == "true")
return true;
else
@ -778,21 +893,35 @@
var ostypes = json.listostypesresponse.ostype;
var items = [];
$(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' },
account: { label: 'label.account' },
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }
domain: {
label: 'label.domain'
},
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) {
@ -833,13 +962,23 @@
},
label: 'ui.listView.filters.all'
},
mine: { label: 'ui.listView.filters.mine' },
featured: { label: 'label.featured' },
community: { label: 'label.community' }
mine: {
label: 'ui.listView.filters.mine'
},
featured: {
label: 'label.featured'
},
community: {
label: 'label.community'
}
},
fields: {
name: { label: 'label.name' },
zonename: { label: 'label.zone' }
name: {
label: 'label.name'
},
zonename: {
label: 'label.zone'
}
},
reorder: cloudStack.api.actions.sort('updateIso', 'isos'),
@ -859,17 +998,23 @@
name: {
label: 'label.name',
docID: 'helpRegisterISOName',
validation: { required: true }
validation: {
required: true
}
},
description: {
label: 'label.description',
docID: 'helpRegisterISODescription',
validation: { required: true }
validation: {
required: true
}
},
url: {
label: 'URL',
docID: 'helpRegisterISOURL',
validation: { required: true }
validation: {
required: true
}
},
zone: {
label: 'label.zone',
@ -884,13 +1029,21 @@
var items = json.listzonesresponse.zone;
if (items != null) {
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])) {
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',
dependsOn: 'isBootable',
isHidden: false,
validation: { required: true },
validation: {
required: true
},
select: function(args) {
$.ajax({
url: createURL("listOsTypes"),
@ -919,9 +1074,14 @@
var items = [];
//items.push({id: "", description: "None"}); //shouldn't have None option when bootable is checked
$(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,
success: function(json) {
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) {
@ -1009,7 +1171,9 @@
},
advSearchFields: {
name: { label: 'Name' },
name: {
label: 'Name'
},
zoneid: {
label: 'Zone',
select: function(args) {
@ -1033,8 +1197,12 @@
});
}
},
tagKey: { label: 'Tag Key' },
tagValue: { label: 'Tag Value' }
tagKey: {
label: 'Tag Key'
},
tagValue: {
label: 'Tag Value'
}
},
dataProvider: function(args) {
@ -1073,7 +1241,9 @@
}
$.ajax({
url: createURL('listIsos', { ignoreProject: ignoreProject }),
url: createURL('listIsos', {
ignoreProject: ignoreProject
}),
data: data,
success: function(json) {
var items = json.listisosresponse.iso;
@ -1119,8 +1289,7 @@
$.extend(data, {
ispublic: true
});
}
else if(args.data.ispublic == "off") {
} else if (args.data.ispublic == "off") {
$.extend(data, {
ispublic: false
});
@ -1130,18 +1299,17 @@
$.extend(data, {
isfeatured: true
});
}
else if(args.data.isfeatured == "off") {
} else if (args.data.isfeatured == "off") {
$.extend(data, {
isfeatured: false
}); }
});
}
//if args.data.isextractable is undefined, do not pass isextractable to API call.
if (args.data.isextractable == "on") {
$.extend(data, {
isextractable: true
});
}
else if(args.data.isextractable == "off") {
} else if (args.data.isextractable == "off") {
$.extend(data, {
isextractable: false
});
@ -1169,7 +1337,9 @@
async: false,
success: function(json) {
var item = json.listisosresponse.iso;
args.response.success({data: item});
args.response.success({
data: item
});
}
});
}
@ -1188,7 +1358,9 @@
fields: {
destinationZoneId: {
label: 'label.destination.zone',
validation: { required: true },
validation: {
required: true
},
select: function(args) {
$.ajax({
url: createURL("listZones&available=true"),
@ -1200,11 +1372,16 @@
if (items != null) {
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
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,
success: function(json) {
var jid = json.copytemplateresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return {}; //nothing in this ISO needs to be updated
},
@ -1228,8 +1405,7 @@
return isoActionfilter;
}
}
}
);
});
}
});
},
@ -1265,9 +1441,9 @@
async: true,
success: function(json) {
var jid = json.extractisoresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.iso;
},
@ -1275,8 +1451,7 @@
return isoActionfilter;
}
}
}
);
});
}
});
},
@ -1306,12 +1481,11 @@
async: true,
success: function(json) {
var jid = json.deleteisosresponse.jobid;
args.response.success(
{_custom:
{jobId: jid
args.response.success({
_custom: {
jobId: jid
}
}
);
});
}
});
},
@ -1326,25 +1500,38 @@
details: {
title: 'label.details',
fields: [
{
fields: [{
name: {
label: 'label.name',
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: {
label: 'label.description',
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: {
label: 'label.size',
converter: function(args) {
@ -1393,21 +1580,35 @@
var ostypes = json.listostypesresponse.ostype;
var items = [];
$(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' },
account: { label: 'label.account' },
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }
domain: {
label: 'label.domain'
},
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) {
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
|| jsonObj.templatetype == "SYSTEM" || jsonObj.isready == false) {
//do nothing
}
else {
} else {
allowedActions.push("edit");
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
|| (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") {
//do nothing
}
else {
} else {
allowedActions.push("downloadTemplate");
}
// "Delete Template"
//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
|| (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1)
|| (jsonObj.account == "system")) {
|| (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) || (jsonObj.account == "system")) {
//do nothing
}
else {
} else {
allowedActions.push("remove");
}
@ -1481,12 +1678,10 @@
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
|| (jsonObj.isready == false)
|| (jsonObj.domainid == 1 && jsonObj.account == "system")
|| (jsonObj.isready == false) || (jsonObj.domainid == 1 && jsonObj.account == "system")
) {
//do nothing
}
else {
} else {
allowedActions.push("edit");
if (havingSwift == false)
@ -1512,24 +1707,20 @@
// "Download ISO"
//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
|| (jsonObj.isready == false)
|| (jsonObj.domainid == 1 && jsonObj.account == "system")
|| (jsonObj.isready == false) || (jsonObj.domainid == 1 && jsonObj.account == "system")
) {
//do nothing
}
else {
} else {
allowedActions.push("downloadISO");
}
// "Delete ISO"
//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
|| (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1)
|| (jsonObj.account == "system")
|| (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) || (jsonObj.account == "system")
) {
//do nothing
}
else {
} else {
allowedActions.push("remove");
}

View File

@ -70,13 +70,14 @@
dialogClass: 'multi-edit-add-list panel',
width: 825,
title: _l('label.affinity.groups'),
buttons: [
{
buttons: [{
text: _l('label.apply'),
'class': 'ok',
click: function() {
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;
}
@ -108,7 +109,9 @@
});
},
error: function(args) {
cloudStack.dialog.notice({ message: args });
cloudStack.dialog.notice({
message: args
});
}
}
});
@ -120,8 +123,7 @@
$(':ui-dialog').dialog('destroy');
});
}
},
{
}, {
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
@ -133,8 +135,7 @@
$(':ui-dialog').dialog('destroy');
});
}
}
]
}]
}).parent('.ui-dialog').overlay();
// Add tier select dialog

View File

@ -74,7 +74,9 @@
originalAutoscaleData: data ? [data] : null
})
}) :
$.map(actions, function(value, key) { return key; });
$.map(actions, function(value, key) {
return key;
});
$detailActions.append($buttons);
$actionsTable.find('tr').append($detailActions);
@ -85,7 +87,10 @@
var label = _l(action.label);
var $action = $('<div>').addClass('action').addClass(actionID);
var $icon = $('<a>')
.attr({ href: '#', title: label })
.attr({
href: '#',
title: label
})
.append($('<span>').addClass('icon'));
if (visibleActions.length == 1) $action.addClass('single');
@ -117,7 +122,9 @@
};
var error = function(message) {
$loading.remove();
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
};
action.action({
@ -190,7 +197,12 @@
form: {
title: '',
fields: {
scaleUpDuration: { label: 'Duration(in sec)', validation: { required: true } }
scaleUpDuration: {
label: 'Duration(in sec)',
validation: {
required: true
}
}
}
}
});
@ -204,7 +216,12 @@
form: {
title: '',
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);
});
$('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', 'height', 'auto');
@ -325,16 +344,14 @@
$(this).attr("style", "left: 600px; position: relative; margin-right: 5px; ");
});
},
buttons: [
{
buttons: [{
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
$autoscalerDialog.dialog('destroy');
$('.overlay').remove();
}
},
{
}, {
text: _l('Apply'),
'class': 'ok',
click: function() {
@ -361,14 +378,15 @@
});
},
error: function(message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
$loading.remove();
}
}
});
}
}
]
}]
}).closest('.ui-dialog').overlay();
dataProvider({
@ -382,8 +400,7 @@
$autoscalerDialog.find('select[name=serviceOfferingId]').removeAttr('disabled');
$autoscalerDialog.find('select[name=securityGroups]').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=securityGroups]').attr('disabled', true);
$autoscalerDialog.find('select[name=diskOfferingId]').attr('disabled', true);

View File

@ -48,11 +48,12 @@
maximizeIfSelected: true,
complete: function($newPanel) {
$newPanel.detailView($.extend(true, {},
cloudStack.sections.dashboard.admin.zoneDetailView,
{
cloudStack.sections.dashboard.admin.zoneDetailView, {
$browser: $browser,
context: $.extend(true, {}, cloudStack.context, {
physicalResources: [{ id: item.zoneID }]
physicalResources: [{
id: item.zoneID
}]
})
}
));
@ -73,10 +74,17 @@
// Generate pie chart
// -- values above 80 have a red color
setTimeout(function() {
pieChart($arrayElem, [
{ data: [[1, 100 - arrayValue]], color: '#54697e' },
{ data: [[1, arrayValue]], color: arrayValue < 80 ? 'orange' : 'red' }
]);
pieChart($arrayElem, [{
data: [
[1, 100 - arrayValue]
],
color: '#54697e'
}, {
data: [
[1, arrayValue]
],
color: arrayValue < 80 ? 'orange' : 'red'
}]);
});
} else {
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();
});
@ -106,7 +116,9 @@
$elem.each(function() {
var $item = $(this);
if ($item.hasClass('chart-line')) {
$item.show().animate({ width: value + '%' });
$item.show().animate({
width: value + '%'
});
} else {
$item.hide().html(_s(value)).fadeIn();
}
@ -122,7 +134,10 @@
* Render circular pie chart, without labels
*/
var pieChart = function($container, data) {
$container.css({ width: 70, height: 66 });
$container.css({
width: 70,
height: 66
});
$.plot($container, data, {
width: 100,
height: 100,
@ -168,9 +183,7 @@
$newPanel.listView({
$browser: $browser,
context: cloudStack.context,
listView: $dashboard.hasClass('admin') ?
cloudStack.sections.events.sections.alerts.listView :
cloudStack.sections.events.sections.events.listView // Users cannot see events
listView: $dashboard.hasClass('admin') ? 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',
width: 825,
title: _l('label.select.vm.for.static.nat'),
buttons: [
{
buttons: [{
text: _l('label.apply'),
'class': 'ok',
click: function() {
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;
}
if (!$dataList.find(
'input[type=radio]:checked, input[type=checkbox]:checked'
).size()) {
cloudStack.dialog.notice({ message: _l('message.select.instance')});
cloudStack.dialog.notice({
message: _l('message.select.instance')
});
return false;
}
@ -108,7 +111,9 @@
});
},
error: function(args) {
cloudStack.dialog.notice({ message: args });
cloudStack.dialog.notice({
message: args
});
}
}
});
@ -119,8 +124,7 @@
$('div.overlay').remove();
});
}
},
{
}, {
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
@ -131,8 +135,7 @@
$('div.overlay').remove();
});
}
}
]
}]
}).parent('.ui-dialog').overlay();
// Add tier select dialog

View File

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

View File

@ -24,7 +24,9 @@
return function(args) {
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;
}
@ -73,7 +75,13 @@
form: {
title: '',
fields: {
pingpath: {label: 'Ping Path', validation: {required: false}, defaultValue: pingpath1}
pingpath: {
label: 'Ping Path',
validation: {
required: false
},
defaultValue: pingpath1
}
}
}
});
@ -89,10 +97,34 @@
form: {
title: '',
fields: {
responsetimeout: {label: 'Response Timeout (in sec)' , validation:{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}
responsetimeout: {
label: 'Response Timeout (in sec)',
validation: {
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);
var buttons = [
{
var buttons = [{
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
}
}
];
}];
if (policyObj == null) { //policy is not created yet
buttons.push(
{
buttons.push({
text: _l('Create'),
'class': 'ok',
click: function() {
@ -144,18 +173,20 @@
var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) {
return; //Job has not completed
}
else {
} else {
clearInterval(createLBHealthCheckPolicyIntervalId);
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();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
}
else if (result.jobstatus == 2) {
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
} else if (result.jobstatus == 2) {
cloudStack.dialog.notice({
message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
@ -168,17 +199,17 @@
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');
$('.overlay').remove();
}
});
}
}
);
}
else { //policy exists already
});
} else { //policy exists already
buttons.push(
//Update Button (begin) - call delete API first, then create API
{
@ -204,8 +235,7 @@
var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) {
return; //Job has not completed
}
else {
} else {
clearInterval(deleteLBHealthCheckPolicyIntervalId);
if (result.jobstatus == 1) {
@ -234,18 +264,20 @@
var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) {
return; //Job has not completed
}
else {
} else {
clearInterval(createLBHealthCheckPolicyIntervalId);
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();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
}
else if (result.jobstatus == 2) {
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
} else if (result.jobstatus == 2) {
cloudStack.dialog.notice({
message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
@ -256,9 +288,10 @@
}, g_queryAsyncJobResultInterval);
}
});
}
else if (result.jobstatus == 2) {
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
} else if (result.jobstatus == 2) {
cloudStack.dialog.notice({
message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
@ -297,18 +330,20 @@
var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) {
return; //Job has not completed
}
else {
} else {
clearInterval(deleteLBHealthCheckPolicyIntervalId);
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();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
}
else if (result.jobstatus == 2) {
cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) });
} else if (result.jobstatus == 2) {
cloudStack.dialog.notice({
message: _s(result.jobresult.errortext)
});
$loadingOnDialog.remove();
$healthCheckDialog.dialog('destroy');
$('.overlay').remove();
@ -346,5 +381,3 @@
}
}
}(jQuery, cloudStack));

View File

@ -65,7 +65,9 @@
}
$body.children().fadeOut('fast', function() {
var $nextStep = steps[stepID]({ nextStep: options.nextStep });
var $nextStep = steps[stepID]({
nextStep: options.nextStep
});
$body.children().detach();
$nextStep.appendTo($body).hide();
@ -136,7 +138,9 @@
var $container = $('<div></div>').addClass(id);
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 $title = $('<div></div>').addClass('title').html(_l(title));
@ -236,7 +240,9 @@
nextButton: function(label, options) {
var $button = options && !options.type ?
$('<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;
},
@ -350,7 +356,9 @@
type: 'password',
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(
$('<div></div>').addClass('title').html(_l('message.change.password')),
@ -423,11 +431,30 @@
prevStepID: 'addZoneIntro',
nextStepID: 'addPodIntro',
form: {
name: { label: 'label.name', validation: { required: true } },
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' }
name: {
label: 'label.name',
validation: {
required: true
}
},
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',
nextStepID: 'configureGuestTraffic',
form: {
name: { label: 'label.name', validation: { required: true }},
reservedSystemGateway: { label: 'label.gateway', validation: { required: true }},
reservedSystemNetmask: { label: 'label.netmask', validation: { required: true }},
name: {
label: 'label.name',
validation: {
required: true
}
},
reservedSystemGateway: {
label: 'label.gateway',
validation: {
required: true
}
},
reservedSystemNetmask: {
label: 'label.netmask',
validation: {
required: true
}
},
ipRange: {
label: 'label.ip.range',
range: ['reservedSystemStartIp', 'reservedSystemEndIp'],
validation: { required: true }
validation: {
required: true
}
}
}
}),
@ -480,9 +524,25 @@
prevStepID: 'addPod',
nextStepID: 'addClusterIntro',
form: {
guestGateway: { label: 'label.gateway', validation: { required: true } },
guestNetmask: { label: 'label.netmask', validation: { required: true } },
guestIPRange: { label: 'label.ip.range', range: ['guestStartIp', 'guestEndIp'], validation: { required: true } }
guestGateway: {
label: 'label.gateway',
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: {
label: 'label.hypervisor',
select: function(args) {
args.response.success({ data: [
{ id: 'XenServer', description: 'XenServer' },
{ id: 'KVM', description: 'KVM'}
]});
args.response.success({
data: [{
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: {
hostname: {
label: 'label.host.name',
validation: { required: true }
validation: {
required: true
}
},
username: {
label: 'label.username',
validation: { required: true }
validation: {
required: true
}
},
password: {
label: 'label.password',
validation: { required: true },
validation: {
required: true
},
isPassword: true
}
}
@ -597,14 +673,19 @@
form: {
name: {
label: 'label.name',
validation: { required: true }
validation: {
required: true
}
},
protocol: {
label: 'label.protocol',
select: function(args) {
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') });
}*/
// else if (selectedHypervisor == 'KVM'){
scopeData.push({ id: 'cluster', description: _l('label.cluster') });
scopeData.push({ id: 'zone', description: _l('label.zone.wide') });
scopeData.push({
id: 'cluster',
description: _l('label.cluster')
});
scopeData.push({
id: 'zone',
description: _l('label.zone.wide')
});
args.response.success({
@ -630,12 +717,16 @@
server: {
label: 'label.server',
validation: { required: true }
validation: {
required: true
}
},
path: {
label: 'label.path',
validation: { required: true }
validation: {
required: true
}
}
}
}),
@ -668,11 +759,15 @@
form: {
nfsServer: {
label: 'label.nfs.server',
validation: { required: true }
validation: {
required: true
}
},
path: {
label: 'label.path',
validation: { required: true }
validation: {
required: true
}
}
}
}),
@ -765,8 +860,7 @@
$subtitle.append(
$('<p>').html(
_l('error.installWizard.message') + ':<br/>'
+ message
_l('error.installWizard.message') + ':<br/>' + message
),
$('<div>').addClass('button').append(
$('<span>').html(_l('label.back'))

View File

@ -35,7 +35,9 @@
// Close instance wizard
var close = function() {
$wizard.dialog('destroy');
$('div.overlay').fadeOut(function() { $('div.overlay').remove(); });
$('div.overlay').fadeOut(function() {
$('div.overlay').remove();
});
};
// Save instance and close wizard
@ -53,16 +55,16 @@
if ($listView.size()) {
var $loading = $('.list-view.instances').listView('prependItem', {
data: [
{
data: [{
name: data.displayname ? data.displayname : _l('label.new.vm'),
zonename: $wizard.find('select[name=zoneid] option').filter(function() {
return $(this).val() == data.zoneid;
}).html(),
state: 'Creating'
}],
actionFilter: function(args) {
return [];
}
],
actionFilter: function(args) { return []; }
});
}
@ -79,7 +81,9 @@
$('div.overlay').remove();
if (message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
}
}
}
@ -320,7 +324,9 @@
$select.addClass('selected').append(
$('<div>').addClass('hypervisor')
.append($('<label>').html('Hypervisor:'))
.append($('<select>').attr({ name: 'hypervisorid' }))
.append($('<select>').attr({
name: 'hypervisorid'
}))
);
// Get hypervisor data
@ -502,13 +508,11 @@
$step.find('.select-container').append(
makeSelects(
'affinity-groups',
args.data.affinityGroups,
{
args.data.affinityGroups, {
name: 'name',
desc: 'description',
id: 'id'
},
{
}, {
type: 'checkbox',
'wizard-field': 'affinity-groups'
},
@ -817,8 +821,7 @@
)
);
if (!$targetStep.hasClass('repeat') &&
!$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
if (!$targetStep.hasClass('repeat') && !$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
}
// Show launch vm button if last step
@ -863,9 +866,10 @@
// Next button
if ($target.closest('div.button.next').size()) {
// Make sure ISO or template is selected
if ($activeStep.hasClass('select-iso') &&
!$activeStep.find('.content:visible input:checked').size()) {
cloudStack.dialog.notice({ message: 'message.step.1.continue' });
if ($activeStep.hasClass('select-iso') && !$activeStep.find('.content:visible input:checked').size()) {
cloudStack.dialog.notice({
message: 'message.step.1.continue'
});
return false;
}
@ -880,7 +884,9 @@
}
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;
}
@ -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
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
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;
}
}

View File

@ -115,8 +115,7 @@
//makeMultiEditPanel($(this), { title: _l('label.nat.port.range')});
makeMultiEditPanel($(this));
});
}
else {
} else {
$chart.find('li.firewall').hide();
}
@ -136,12 +135,10 @@
if ($.inArray('nonStaticNATChart', preFilter) != -1) { //choose static NAT chart
if ($.inArray('firewall', preFilter) == -1) {
return staticNATChart(args, true); //static NAT including Firewall
}
else {
} else {
return staticNATChart(args, false); //static NAT excluding Firewall
}
}
else { //choose non-static NAT chart
} else { //choose non-static NAT chart
$(preFilter).each(function() {
var id = this;

View File

@ -110,7 +110,9 @@
});
},
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;
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();
@ -71,9 +73,17 @@
title: 'label.update.ssl',
desc: 'message.update.ssl',
fields: {
certificate: { label: 'label.certificate', isTextarea: true },
privatekey: { label: 'label.privatekey', isTextarea: true },
domainsuffix: { label: 'label.domain.suffix' }
certificate: {
label: 'label.certificate',
isTextarea: true
},
privatekey: {
label: 'label.privatekey',
isTextarea: true
},
domainsuffix: {
label: 'label.domain.suffix'
}
}
},
after: function(args) {
@ -98,27 +108,33 @@
var result = json.queryasyncjobresultresponse;
if (result.jobstatus == 0) {
return; //Job has not completed
}
else {
} else {
clearInterval(uploadCustomCertificateIntervalID);
if (result.jobstatus == 1) {
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) });
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)
});
}
$loading.remove();
}
},
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();
}
});
}, g_queryAsyncJobResultInterval);
},
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();
}
});

View File

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

View File

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

View File

@ -109,7 +109,9 @@
$arrayElem.html(_s(arrayValue));
});
$li.attr({ title: item.description });
$li.attr({
title: item.description
});
$li.fadeIn();
});
@ -117,7 +119,9 @@
$elem.each(function() {
var $item = $(this);
if ($item.hasClass('chart-line')) {
$item.show().animate({ width: value + '%' });
$item.show().animate({
width: value + '%'
});
} else {
$item.hide().html(_s(value)).fadeIn();
}
@ -249,12 +253,16 @@
var $tab = $('<li>').appendTo($tabs.find('ul:first'));
var $tabContent = tab();
var $tabLink = $('<a>')
.attr({ href: '#project-view-dashboard-' + tabName })
.attr({
href: '#project-view-dashboard-' + tabName
})
.html($tabContent.data('tab-title'))
.appendTo($tab);
var $content = $('<div>')
.appendTo($tabs)
.attr({ id: 'project-view-dashboard-' + tabName })
.attr({
id: 'project-view-dashboard-' + tabName
})
.append($tabContent);
});
@ -316,7 +324,9 @@
name: 'project-display-text',
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 $loading = $('<div>').addClass('loading-overlay');
@ -407,7 +417,9 @@
.append(
// Users tab
$('<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() ?
_l('label.invitations') : _l('label.accounts')
)
@ -418,18 +430,24 @@
$ul.append(
// Resources tab
$('<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];
var $resources;
if (isAdmin() || isDomainAdmin()) {
$resouces = $('<div>')
.attr({ id: 'new-project-review-tabs-resouces' })
.attr({
id: 'new-project-review-tabs-resouces'
})
.appendTo($tabs)
.append(pageElems.dashboardTabs.resources);
}
@ -441,9 +459,13 @@
id: 'project-accounts',
disableInfiniteScrolling: true,
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) {
setTimeout(function() {
@ -542,8 +564,12 @@
var $search = $('<div>').appendTo($toolbar).addClass('search')
.append(
$searchForm
.append($('<input>').attr({ type: 'text' }))
.append($('<input>').attr({ type: 'submit' }).val(''))
.append($('<input>').attr({
type: 'text'
}))
.append($('<input>').attr({
type: 'submit'
}).val(''))
);
var $projectSelect = args.$projectSelect;
var $cancel = $('<div>').addClass('button cancel').html(_l('label.cancel'));
@ -610,9 +636,7 @@
loadData(function() {
if (!$list.find('li').size()) {
cloudStack.dialog.notice({
message: isAdmin() || isDomainAdmin() || g_userProjectsEnabled ?
_l('message.no.projects') :
_l('message.no.projects.adminOnly')
message: isAdmin() || isDomainAdmin() || g_userProjectsEnabled ? _l('message.no.projects') : _l('message.no.projects.adminOnly')
}).closest('.ui-dialog');
$.merge($selector, $('.overlay')).remove();
$('.select.default-view').click();
@ -764,6 +788,8 @@
$(window).bind('cloudStack.deleteProject', function(event, args) {
deleteProject({id: args.data.id});
deleteProject({
id: args.data.id
});
});
})(cloudStack, jQuery);

View File

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

View File

@ -50,8 +50,7 @@
if (currentRegion != null) {
$regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name));
}
else {
} else {
$regionSwitcherButton.find('.title').html('').attr('title', '');
}
}
@ -82,7 +81,9 @@
var closeRegionSelector = function(args) {
$regionSwitcherButton.removeClass('active');
$regionSelector.fadeOut(args ? args.complete : null);
$('body > .overlay').fadeOut(function() { $('body > .overlay').remove() });
$('body > .overlay').fadeOut(function() {
$('body > .overlay').remove()
});
};
var switchRegion = function(url) {
@ -115,7 +116,9 @@
closeRegionSelector();
} else {
$regionSwitcherButton.addClass('active');
$regionSelector.fadeIn('fast').overlay({ closeAction: closeRegionSelector });
$regionSelector.fadeIn('fast').overlay({
closeAction: closeRegionSelector
});
}
});
@ -127,4 +130,3 @@
refreshRegions();
});
}(jQuery, cloudStack));

View File

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

View File

@ -107,8 +107,9 @@
return detailView;
}
}
}),
{ context: acl.context }
}), {
context: acl.context
}
);
}
});
@ -120,20 +121,26 @@
maximizeIfSelected: true,
complete: function($panel) {
//ipAddresses.listView is a function
$panel.listView(ipAddresses.listView(), {context: ipAddresses.context});
$panel.listView(ipAddresses.listView(), {
context: ipAddresses.context
});
}
});
break;
case 'gateways':
//siteToSiteVPN is an object
var addAction = gateways.add;
var isGatewayPresent = addAction.preCheck({ context: gateways.context });
var isGatewayPresent = addAction.preCheck({
context: gateways.context
});
var showGatewayListView = function() {
$browser.cloudBrowser('addPanel', {
title: _l('label.private.Gateway'),
maximizeIfSelected: true,
complete: function($panel) {
$panel.listView(gateways.listView(), { context: gateways.context });
$panel.listView(gateways.listView(), {
context: gateways.context
});
}
});
};
@ -147,7 +154,9 @@
after: function(args) {
var data = args.data;
var error = function(message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
};
addAction.action({
@ -191,13 +200,17 @@
case 'site-to-site-vpn':
//siteToSiteVPN is an object
var addAction = siteToSiteVPN.add;
var isVPNPresent = addAction.preCheck({ context: siteToSiteVPN.context });
var isVPNPresent = addAction.preCheck({
context: siteToSiteVPN.context
});
var showVPNListView = function() {
$browser.cloudBrowser('addPanel', {
title: _l('label.site.to.site.VPN'),
maximizeIfSelected: true,
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.',
action: function() {
var error = function(message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
};
addAction.action({
@ -299,7 +314,9 @@
});
// 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.stop().fadeIn('fast');
});
@ -511,10 +528,18 @@
context: context,
$browser: $browser,
$chart: $chart,
ipAddresses:$.extend(ipAddresses, {context:context}),
gateways:$.extend(gateways, {context:context}),
siteToSiteVPN:$.extend(siteToSiteVPN, {context:context}),
acl:$.extend(acl, {context:context}),
ipAddresses: $.extend(ipAddresses, {
context: context
}),
gateways: $.extend(gateways, {
context: context
}),
siteToSiteVPN: $.extend(siteToSiteVPN, {
context: context
}),
acl: $.extend(acl, {
context: context
}),
tierDetailView: tierDetailView
})
);
@ -562,7 +587,9 @@
}
elems.tier({ isPlaceholder:true }).appendTo($tiers)
elems.tier({
isPlaceholder: true
}).appendTo($tiers)
.click(showAddTierDialog);
$tiers.prepend($router);
$chart.append($title, $tiers);
@ -637,6 +664,7 @@
},
// Success
function(args) {
if (actionID == 'addVM') {
// Increment VM total
@ -669,6 +697,7 @@
{},
// Error
function(args) {
if (actionID == 'addVM') {
updateVMLoadingState();
@ -720,7 +749,9 @@
complete: success,
response: {
success: success,
error: function(args) { $loading.remove(); }
error: function(args) {
$loading.remove();
}
}
});
}
@ -788,6 +819,7 @@
},
// Success
function(args) {
$loading.remove();
addNewTier({
@ -809,13 +841,16 @@
{},
// Error
function(args) {
$loading.remove();
}
);
},
error: function(errorMsg) {
cloudStack.dialog.notice({ message: _s(errorMsg) });
cloudStack.dialog.notice({
message: _s(errorMsg)
});
$loading.remove();
}
}
@ -868,8 +903,9 @@
},
ipAddresses: {
custom: function(args) {
return $('<div>').listView(ipAddresses.listView(),
{context: args.context});
return $('<div>').listView(ipAddresses.listView(), {
context: args.context
});
}
}
}
@ -893,8 +929,7 @@
}).appendTo($panel);
$loading.remove();
$chart.fadeIn(function() {
});
$chart.fadeIn(function() {});
}
}
});

View File

@ -38,7 +38,9 @@
maximizeIfSelected: true,
complete: function($newPanel) {
$viewAll.data('multiple-click', false);
action({ $panel: $newPanel });
action({
$panel: $newPanel
});
}
});
});
@ -261,8 +263,7 @@
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 {
} else {
return true; //if it doesn't have dependsOn, skip this item
}
}
@ -310,7 +311,10 @@
$chart.listView({
listView: $.extend(true, {}, cloudStack.sections.system.naas.networks.listView, {
dataProvider: function(args) {
args.response.success({ actionFilter: actionFilter, data: data });
args.response.success({
actionFilter: actionFilter,
data: data
});
},
detailView: {
noCompact: true,
@ -350,16 +354,36 @@
var chartItems = {
// The keys are based on the internal type ID associated with each capacity
0: { name: _l('label.memory') },
1: { name: _l('label.cpu') },
2: { name: _l('label.storage') },
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') }
0: {
name: _l('label.memory')
},
1: {
name: _l('label.cpu')
},
2: {
name: _l('label.storage')
},
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);
@ -386,8 +410,12 @@
var $totalValue = $('<span>').addClass('total').html(data.total);
var $chart = $('<div>').addClass('chart');
var $chartLine = $('<div>').addClass('chart-line')
.css({ width: '0%' })
.animate({ width: data.percent + '%' });
.css({
width: '0%'
})
.animate({
width: data.percent + '%'
});
var $percent = $('<div>').addClass('percentage');
var $percentValue = $('<soan>').addClass('value').html(data.percent);

View File

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

View File

@ -40,7 +40,9 @@
}
if (options.all) {
return cloudStack.serializeForm($forms, { escapeSlashes: true });
return cloudStack.serializeForm($forms, {
escapeSlashes: true
});
}
// Group form fields together, by form ID
@ -50,7 +52,9 @@
if (!id) return true;
groupedForms[id] = cloudStack.serializeForm($form, { escapeSlashes: true });
groupedForms[id] = cloudStack.serializeForm($form, {
escapeSlashes: true
});
return true;
});
@ -89,8 +93,7 @@
// Traffic type configuration data
trafficTypeConfiguration: trafficTypeConfiguration,
guestConfiguration: $guestForm.size() ?
cloudStack.serializeForm($guestForm) : null
guestConfiguration: $guestForm.size() ? cloudStack.serializeForm($guestForm) : null
};
}
);
@ -225,7 +228,9 @@
};
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'),
desc: _l('message.edit.traffic.type'),
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 $physicalNetworkItem = $('<div>').addClass('select-container multi');
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;');
var $icon = $('<div>').addClass('physical-network-icon');
@ -576,7 +586,9 @@
$('<label>').html('Physical network name')
),
$('<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(
$('<a></a>')
.attr({ href: '#' + networkID })
.attr({
href: '#' + networkID
})
.html($network.find('.field.name input').val())
));
$.merge(
$content,
$('<div></div>')
.addClass('physical-network-item')
.attr({ id: networkID })
.attr({
id: networkID
})
.append($form)
);
@ -868,7 +884,9 @@
// Close wizard
var close = function() {
$wizard.dialog('destroy');
$('div.overlay').fadeOut(function() { $('div.overlay').remove(); });
$('div.overlay').fadeOut(function() {
$('div.overlay').remove();
});
};
// Save and close wizard
@ -935,7 +953,9 @@
},
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) {
var goNextOverride = function(event) {
$(this).unbind('click', goNextOverride);
showStep(stepID, false, { nextStep: 'launch' });
showStep(stepID, false, {
nextStep: 'launch'
});
return false;
};
@ -993,7 +1015,9 @@
var $targetStep = $($steps[targetIndex]).show();
var $uiCustom = $targetStep.find('[ui-custom]');
var formState = getData($wizard, { all: true });
var formState = getData($wizard, {
all: true
});
var groupedFormState = getData($wizard);
var formID = $targetStep.attr('zone-wizard-form');
var stepPreFilter = cloudStack.zoneWizard.preFilters[
@ -1001,9 +1025,11 @@
];
// Bypass step check
if (stepPreFilter && !stepPreFilter({ data: formState, groupedData: groupedFormState })) {
return showStep(
!goBack ? index + 1 : index - 1,
if (stepPreFilter && !stepPreFilter({
data: formState,
groupedData: groupedFormState
})) {
return showStep(!goBack ? index + 1 : index - 1,
goBack
);
}
@ -1091,7 +1117,9 @@
$nextButton.find('span').html(options.nextStep ? 'Save changes' : 'Launch zone');
$nextButton.addClass('final');
if (options.nextStep) { $nextButton.addClass('post-launch'); }
if (options.nextStep) {
$nextButton.addClass('post-launch');
}
}
// Update progress bar
@ -1125,8 +1153,7 @@
if ($target.val() == 'tagged') {
$untagged.hide();
$tagged.show();
}
else if ($target.val() == 'untagged') {
} else if ($target.val() == 'untagged') {
$tagged.hide();
$untagged.show();
}
@ -1134,8 +1161,14 @@
$.merge($tagged, $untagged).find('select:visible').trigger('change');
cloudStack.evenOdd($wizard, '.field:visible', {
even: function($elem) { $elem.removeClass('odd'); $elem.addClass('even'); },
odd: function($elem) { $elem.removeClass('even'); $elem.addClass('odd'); }
even: function($elem) {
$elem.removeClass('odd');
$elem.addClass('even');
},
odd: function($elem) {
$elem.removeClass('even');
$elem.addClass('odd');
}
});
return true;
@ -1147,8 +1180,14 @@
if ($target.val() == 'account-specific') $accountSpecific.show();
cloudStack.evenOdd($wizard, '.field:visible', {
even: function($elem) { $elem.removeClass('odd'); $elem.addClass('even'); },
odd: function($elem) { $elem.removeClass('even'); $elem.addClass('odd'); }
even: function($elem) {
$elem.removeClass('odd');
$elem.addClass('even');
},
odd: function($elem) {
$elem.removeClass('even');
$elem.addClass('odd');
}
});
}

View File

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

View File

@ -24,7 +24,9 @@
error: function(callback) {
return function(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();
};
@ -69,15 +71,19 @@
title: _l(args.form.title),
open: function() {
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'),
'class': 'ok',
click: function() {
if (!complete($formContainer)) { return false; }
if (!complete($formContainer)) {
return false;
}
$('div.overlay').remove();
$('.tooltip-box').remove();
@ -88,8 +94,7 @@
return true;
}
},
{
}, {
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
@ -100,8 +105,7 @@
$('.hovered-elem').hide();
}
}
]
}]
}).closest('.ui-dialog').overlay();
};
@ -124,7 +128,9 @@
var $formItem = $('<div>')
.addClass('form-item')
.attr({ rel: key });
.attr({
rel: key
});
if (field.isHidden != null) {
if (typeof(field.isHidden) == 'boolean' && field.isHidden == true)
@ -173,7 +179,9 @@
// Tooltip description
if (field.desc) {
$formItem.attr({ title: _l(field.desc) });
$formItem.attr({
title: _l(field.desc)
});
}
// Input area
@ -265,14 +273,20 @@
selectFn = field.select;
$input = $('<select>')
.attr({ name: key })
.attr({
name: key
})
.data('dialog-select-fn', function(args) {
selectFn(args ? $.extend(true, {}, selectArgs, args) : selectArgs);
})
.appendTo($value);
// 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) {
$dependsOn = $input.closest('form').find('input, select').filter(function() {
@ -315,7 +329,10 @@
$.merge(
$('<div>').addClass('name').html(_l(itemValue.label)),
$('<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 {
$input = $('<input>').attr({ name: key, type: 'checkbox' }).appendTo($value);
$input = $('<input>').attr({
name: key,
type: 'checkbox'
}).appendTo($value);
if (field.isChecked) {
$input.attr('checked', 'checked');
} else {
@ -363,7 +383,10 @@
$form.show();
// 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)) {
ret();
}
@ -391,7 +414,9 @@
$input.attr('id', field.id);
}
$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)
$input = $.merge(
@ -469,8 +494,7 @@
$formContainer.find('input, select').each(function() {
if ($(this).data('validation-rules')) {
$(this).rules('add', $(this).data('validation-rules'));
}
else {
} else {
$(this).rules('add', {});
}
});
@ -552,15 +576,16 @@
dialogClass: 'multi-edit-add-list panel',
width: 825,
title: _l('Select VM'),
buttons: [
{
buttons: [{
text: _l('label.apply'),
'class': 'ok',
click: function() {
if (!$listView.find(
'input[type=radio]:checked, input[type=checkbox]:checked'
).size()) {
cloudStack.dialog.notice({ message: _l('message.select.instance')});
cloudStack.dialog.notice({
message: _l('message.select.instance')
});
return false;
}
@ -579,8 +604,7 @@
$('div.overlay').remove();
}
},
{
}, {
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
@ -591,8 +615,7 @@
$('div.overlay').remove();
});
}
}
]
}]
}).parent('.ui-dialog').overlay();
},
@ -613,7 +636,9 @@
validationRules = {};
validationRules.required = true;
$input.data('validation-rules', validationRules);
$input.rules('add', { required: true });
$input.rules('add', {
required: true
});
}
},
remove: function($formField) {
@ -646,18 +671,18 @@
dialogClass: 'confirm',
closeOnEscape: false,
zIndex: 5000,
buttons: [
{
buttons: [{
text: _l('label.no'),
'class': 'cancel',
click: function() {
$(this).dialog('destroy');
$('div.overlay').remove();
if (args.cancelAction) { args.cancelAction(); }
if (args.cancelAction) {
args.cancelAction();
}
$('.hovered-elem').hide();
}
},
{
}, {
text: _l('label.yes'),
'class': 'ok',
click: function() {
@ -666,8 +691,7 @@
$('div.overlay').remove();
$('.hovered-elem').hide();
}
}
]
}]
}).closest('.ui-dialog').overlay();
},
@ -685,8 +709,7 @@
dialogClass: 'notice',
closeOnEscape: false,
zIndex: 5000,
buttons: [
{
buttons: [{
text: _l('Close'),
'class': 'close',
click: function() {
@ -694,8 +717,7 @@
if (args.clickAction) args.clickAction();
$('.hovered-elem').hide();
}
}
]
}]
});
}

View File

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

View File

@ -80,16 +80,13 @@
if (typeof(value) == "number") {
//alert("number does not need to be sanitized. Only string needs to be sanitized.");
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.");
return value;
}
else if(typeof(value) == "object") {
} else if (typeof(value) == "object") {
//alert("object cant not be sanitized. Only string can be sanitized.");
return value;
}
else if(typeof(value) == null || typeof(value) == "undefined") {
} else if (typeof(value) == null || typeof(value) == "undefined") {
return '';
}

View File

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

View File

@ -83,7 +83,9 @@
// Handle pre-action (occurs before any other behavior happens)
if (preAction) {
if (!preAction({ context: context })) return false;
if (!preAction({
context: context
})) return false;
}
var updateTabContent = function(newData) {
@ -101,8 +103,7 @@
makeTabs(
$detailView,
$detailView.data('view-args').tabs,
{
$detailView.data('view-args').tabs, {
context: context,
tabFilter: $detailView.data('view-args').tabFilter,
newData: newData
@ -152,13 +153,16 @@
notification,
// Success
function(args) {
if (viewArgs && viewArgs.onActionComplete) {
viewArgs.onActionComplete();
}
if (!$detailView.parents('html').size()) {
replaceListViewItem(null, args.data, { $row: $row });
replaceListViewItem(null, args.data, {
$row: $row
});
return;
}
@ -174,6 +178,7 @@
{},
// Error
function(args) {
$loading.remove();
}
@ -235,6 +240,7 @@
{},
// Error
function(args) {
$loading.remove();
}
@ -274,9 +280,7 @@
}),
// Window options
'menubar=0,resizable=0,'
+ 'width=' + externalLinkAction.width + ','
+ 'height=' + externalLinkAction.height
'menubar=0,resizable=0,' + 'width=' + externalLinkAction.width + ',' + 'height=' + externalLinkAction.height
);
} else {
notification.desc = messages.notification(messageArgs);
@ -293,7 +297,9 @@
}
});
} else {
performAction({ id: id });
performAction({
id: id
});
}
} else if (action.createForm) {
cloudStack.dialog.createForm({
@ -387,7 +393,11 @@
$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) {
// Save and turn back into labels
@ -406,8 +416,7 @@
$value.data('detail-view-boolean-value', _s(val));
$value.html(_s(val) ? _l('label.yes') : _l('label.no'));
}
else if ($input.is('select')) {
} else if ($input.is('select')) {
$value.html(_s(
$input.find('option:selected').html()
));
@ -453,7 +462,9 @@
var applyEdits = function($inputs, $editButton) {
if ($inputs.size()) {
$inputs.animate({ opacity: 0.5 }, 500);
$inputs.animate({
opacity: 0.5
}, 500);
var data = {};
$inputs.each(function() {
@ -511,7 +522,9 @@
},
error: function(message) {
cancelEdits($inputs, $editButton);
if (message) cloudStack.dialog.notice({ message: message });
if (message) cloudStack.dialog.notice({
message: message
});
}
}
});
@ -541,8 +554,16 @@
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('.networkcidr').toolTip({ docID:'helpIPReservationNetworkCidr' , mode:'hover' , tooltip:'.tooltip-box' });
$('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('.networkcidr').toolTip({
docID: 'helpIPReservationNetworkCidr',
mode: 'hover',
tooltip: '.tooltip-box'
});
$detailView.find('td.value span').each(function() {
@ -653,8 +674,7 @@
viewAllID.custom({
$browser: $browser,
context: $detailView.data('view-args').context,
listViewArgs: $detailView.data('list-view') ?
$detailView.data('list-view').data('view-args') : null
listViewArgs: $detailView.data('list-view') ? $detailView.data('list-view').data('view-args') : null
})
);
}
@ -674,8 +694,7 @@
listViewArgs = cloudStackArgs.sections.system
.subsections[viewAllPath[1]];
}
}
else
} else
listViewArgs = cloudStackArgs.sections[viewAllPath[0]];
// Make list view
@ -695,17 +714,23 @@
var context = $.extend(true, {}, $detailView.data('view-args').context);
if (updateContext) {
$.extend(context, updateContext({ context: context }));
$.extend(context, updateContext({
context: context
}));
}
// Make panel
var $panel = $browser.cloudBrowser('addPanel', {
title: customTitle ? customTitle({ context: context }) : _l(listViewArgs.title),
title: customTitle ? customTitle({
context: context
}) : _l(listViewArgs.title),
data: '',
noSelectPanel: true,
maximizeIfSelected: true,
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({
context: context,
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')
.append(
$('<a>')
.attr({ href: '#' })
.attr({
href: '#'
})
.data('detail-view-link-view-all', detailViewArgs.viewAll)
.append(
$('<span>').html(_l('label.view') + ' ' + _l(detailViewArgs.viewAll.label))
@ -981,8 +1010,9 @@
$(detailViewArgs.viewAll).each(function() {
var viewAllItem = this;
if (viewAllItem.preFilter &&
!viewAllItem.preFilter({ context: context })) {
if (viewAllItem.preFilter && !viewAllItem.preFilter({
context: context
})) {
return true;
}
@ -990,7 +1020,9 @@
.addClass('view-all')
.append(
$('<a>')
.attr({ href: '#' })
.attr({
href: '#'
})
.data('detail-view-link-view-all', viewAllItem)
.append(
$('<span>').html(_l('label.view') + ' ' + _l(viewAllItem.label))
@ -1052,8 +1084,9 @@
}
$.extend(
$detailView.data('view-args'),
{ activeTab: targetTabID }
$detailView.data('view-args'), {
activeTab: targetTabID
}
);
if (!$detailView.data('view-args').compact) {
@ -1112,8 +1145,7 @@
$('<div>').addClass('end')
).click(function() {
viewAll(
tabData.viewAll.path,
{
tabData.viewAll.path, {
updateContext: function(args) {
var obj = {};
@ -1151,8 +1183,7 @@
$('<span>').html(_l(tabData.actions.add.label))
).click(function() {
uiActions.standard(
$detailView,
{
$detailView, {
tabs: tabList,
activeTab: targetTabID,
actions: tabData.actions,
@ -1182,8 +1213,7 @@
}).appendTo($tabContent);
if (tabs.tags &&
$detailView.data('view-args') &&
!$detailView.data('view-args').compact) {
$detailView.data('view-args') && !$detailView.data('view-args').compact) {
$('<div>').tagger(
$.extend(true, {}, tabs.tags, {
context: $detailView.data('view-args').context,
@ -1238,8 +1268,12 @@
removedTabs = $.grep(
$.map(
tabs,
function(value, key) { return key; }
), function(tab, index) { return index > 0; }
function(value, key) {
return key;
}
), function(tab, index) {
return index > 0;
}
);
}
@ -1354,8 +1388,7 @@
viewAll(
viewAllArgs.custom ?
viewAllArgs :
viewAllArgs.path,
{
viewAllArgs.path, {
updateContext: viewAllArgs.updateContext
}
);

View File

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

View File

@ -196,8 +196,7 @@
options.listView,
options.context,
options.multipleAdd, _l('label.add.vms'),
addItemAction,
{
addItemAction, {
multiRule: multiRule
});
@ -216,7 +215,8 @@
_medit.multiItem.details(itemData, $browser);
} else {
_medit.details(itemData[0], $browser, {
context: options.context, itemName: itemName
context: options.context,
itemName: itemName
});
}
});
@ -281,10 +281,14 @@
// Action filter
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, {
multiRule: [data],
actions: $.map(actions, function(value, key) { return key; })
actions: $.map(actions, function(value, key) {
return key;
})
})
}) : null;
@ -296,7 +300,9 @@
$('<div>').addClass('action')
.addClass(actionID)
.append($('<span>').addClass('icon'))
.attr({ title: _l(action.label) })
.attr({
title: _l(action.label)
})
.click(function() {
var performAction = function(actionOptions) {
if (!actionOptions) actionOptions = {};
@ -351,7 +357,9 @@
}
},
error: function(message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
$item.show();
$dataItem.find('.loading-overlay').remove();
}
@ -388,9 +396,12 @@
form: createForm,
after: function(args) {
var $loading = $('<div>').addClass('loading-overlay').prependTo($dataItem);
performAction({ data: args.data, complete: function() {
performAction({
data: args.data,
complete: function() {
$multi.trigger('refresh');
} });
}
});
}
});
} else {
@ -416,9 +427,12 @@
},
after: function(args) {
var $loading = $('<div>').addClass('loading-overlay').prependTo($dataItem);
performAction({ data: args.data, complete: function() {
performAction({
data: args.data,
complete: function() {
$multi.trigger('refresh');
} });
}
});
}
});
}
@ -439,8 +453,7 @@
dialogClass: 'editTags',
title: _l('label.edit.tags'),
width: 400,
buttons: [
{
buttons: [{
text: _l('label.done'),
'class': 'ok',
click: function() {
@ -449,8 +462,7 @@
return true;
}
}
]
}]
})
.append(
$('<div></div>').addClass('multi-edit-tags').tagger($.extend(true, {}, options.tags, {
@ -529,13 +541,14 @@
dialogClass: 'multi-edit-add-list panel',
width: 825,
title: label,
buttons: [
{
buttons: [{
text: _l('label.apply'),
'class': 'ok',
click: function() {
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;
}
@ -545,6 +558,7 @@
$listView.find('tr.multi-edit-selected'),
// Attach VM data to row
function(elem) {
var itemData = $(elem).data('json-obj');
var $subselect = $(elem).find('.subselect select');
@ -568,8 +582,7 @@
return true;
}
},
{
}, {
text: _l('label.cancel'),
'class': 'cancel',
click: function() {
@ -580,8 +593,7 @@
$('div.overlay').remove();
});
}
}
]
}]
}).parent('.ui-dialog').overlay();
},
@ -721,7 +733,9 @@
success: function(args) {
if (itemActionID == 'destroy') {
var notification = args.notification;
var success = function(args) { $tr.remove(); };
var success = function(args) {
$tr.remove();
};
var successArgs = {};
var error = function(args) {
$tr.show();
@ -756,7 +770,9 @@
},
error: function(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')
.html(_l(field.custom.buttonLabel))
.click(function() {
if (field.custom.requireValidation &&
!$multiForm.valid()) return false;
if (field.custom.requireValidation && !$multiForm.valid()) return false;
var formData = getMultiData($multi);
@ -1125,8 +1140,7 @@ $.fn.multiEdit = function(args) {
fields,
$multi,
itemData,
actions,
{
actions, {
multipleAdd: multipleAdd,
itemActions: itemActions,
noSelect: noSelect,
@ -1162,7 +1176,9 @@ $.fn.multiEdit = function(args) {
}
// Get existing data
setTimeout(function() { getData(); });
setTimeout(function() {
getData();
});
var fullRefreshEvent = function(event) {
if ($multi.is(':visible')) {

View File

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

View File

@ -21,7 +21,9 @@
var value = $form.find('input[name=value]').val();
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;
}
@ -65,7 +67,8 @@
$value.attr('disabled', false);
// Clear out old data
$key.val(''); $value.val('');
$key.val('');
$value.val('');
$key.focus();
},
error: function() {
@ -83,7 +86,9 @@
return false;
} :
function() { return false; }
function() {
return false;
}
);
return $form;
@ -140,12 +145,14 @@
notification,
// Success
function() {
$loading.remove();
$item.remove();
}, {},
// Error
function() {
$loading.remove();
}, {}
@ -153,7 +160,9 @@
},
error: function(message) {
$loading.remove();
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
}
}
});
@ -181,6 +190,7 @@
notification,
// Success
function() {
$loading.remove();
elems.tagItem(title, onRemoveItem, data).appendTo($tagArea);
@ -188,6 +198,7 @@
}, {},
// Error
function() {
$loading.remove();
error();
@ -197,7 +208,9 @@
error: function(message) {
$loading.remove();
error();
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
}
}
});
@ -219,7 +232,10 @@
$(data).map(function(index, item) {
var key = item.key;
var value = item.value;
var data = { key: key, value: value };
var data = {
key: key,
value: value
};
elems.tagItem(key + ' = ' + value, onRemoveItem, data).appendTo($tagArea);
});

View File

@ -74,8 +74,7 @@
$('.tooltiptextleft', $tooltip).removeClass('tooltiptextleft').addClass('tooltiptextright');
$('.tooltiparrowleft', $tooltip).removeClass('tooltiparrowleft').addClass('tooltiparrowright');
}
else{
} else {
$('.tooltiptextright', $tooltip).removeClass('tooltiptextright').addClass('tooltiptextleft');
$('.tooltiparrowright', $tooltip).removeClass('tooltiparrowright').addClass('tooltiparrowleft');
}
@ -100,8 +99,7 @@
}
});
function hoverHandler(event)
{
function hoverHandler(event) {
//Fetch Options
var o = $.data(this, 'toolTip').options;
@ -115,8 +113,8 @@
//Show method should play on any required animations
$.data(this, '$tooltip').show();
};
function outHandler(event)
{
function outHandler(event) {
//Fetch Options
var o = $.data(this, 'toolTip').options;
@ -125,15 +123,17 @@
//If call back method defined, initiate the call
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,
//Hide method should play on any required animations
$.data(this, '$tooltip').hide();
};
function prepare(jObj, options)
{
function prepare(jObj, options) {
var $tooltip = $(options.tooltip);
var element = options.attachTo ?
jObj.closest(options.attachTo) : jObj;
@ -143,20 +143,26 @@
var top = offset.top - 5;
if (options.onShow) {
options.onShow.call(this, {target:jObj});
options.onShow.call(this, {
target: jObj
});
}
if ($(window).width() - offset.left <= $tooltip.width()) {
left = offset.left - $tooltip.width();
}
else{
} else {
left += 35;
}
$tooltip.css({position:'absolute', top:top+'px', left:left+'px'});
$tooltip.css({
position: 'absolute',
top: top + 'px',
left: left + 'px'
});
// Fix overlay
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, {
id: $li.data('tree-view-item-id'),
$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') {
$li.animate({ opacity: 0.5 });
$li.bind('click', function() { return false; });
$li.animate({
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: {
@ -146,11 +149,11 @@
async: true,
success: function(json) {
var jid = json.deletevmsnapshotresponse.jobid;
args.response.success(
{_custom:
{jobId: jid}
args.response.success({
_custom: {
jobId: jid
}
);
});
}
});
},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff