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){
converter: function(args) {
return cloudStack.converters.toRole(args);
}
},
domain: { label: 'label.domain' },
domain: {
label: 'label.domain'
},
state: {
converter: function(str) {
// For localization
@ -62,7 +66,7 @@
add: {
label: 'label.add.account',
preFilter: function(args) {
if(isAdmin())
if (isAdmin())
return true;
else
return false;
@ -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)
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: ""});
for(var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]});
args.response.success({data: items});
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
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
}
}
}
},
@ -200,7 +242,7 @@
});
var account = args.data.account;
if(account == null || account.length == 0) {
if (account == null || account.length == 0) {
account = args.data.username;
}
$.extend(data, {
@ -215,13 +257,13 @@
accounttype: accountType
});
if(args.data.timezone != null && args.data.timezone.length > 0) {
if (args.data.timezone != null && args.data.timezone.length > 0) {
$.extend(data, {
timezone: args.data.timezone
});
}
if(args.data.networkdomain != null && args.data.networkdomain.length > 0) {
if (args.data.networkdomain != null && args.data.networkdomain.length > 0) {
$.extend(data, {
networkdomain: args.data.networkdomain
});
@ -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));
@ -255,7 +299,7 @@
var data = {};
listViewDataProvider(args, data);
if("domains" in args.context) {
if ("domains" in args.context) {
$.extend(data, {
domainid: args.context.domains[0].id
});
@ -269,7 +313,7 @@
var items = json.listaccountsresponse.account;
args.response.success({
actionFilter: accountActionfilter,
data:items
data: items
});
}
});
@ -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: {
@ -307,7 +354,7 @@
}
});
if(args.data.vmLimit != null) {
if (args.data.vmLimit != null) {
var data = {
resourceType: 0,
max: args.data.vmLimit,
@ -324,7 +371,7 @@
});
}
if(args.data.ipLimit != null) {
if (args.data.ipLimit != null) {
var data = {
resourceType: 1,
max: args.data.ipLimit,
@ -341,7 +388,7 @@
});
}
if(args.data.volumeLimit != null) {
if (args.data.volumeLimit != null) {
var data = {
resourceType: 2,
max: args.data.volumeLimit,
@ -358,7 +405,7 @@
});
}
if(args.data.snapshotLimit != null) {
if (args.data.snapshotLimit != null) {
var data = {
resourceType: 3,
max: args.data.snapshotLimit,
@ -375,7 +422,7 @@
});
}
if(args.data.templateLimit != null) {
if (args.data.templateLimit != null) {
var data = {
resourceType: 4,
max: args.data.templateLimit,
@ -392,7 +439,7 @@
});
}
if(args.data.vpcLimit != null) {
if (args.data.vpcLimit != null) {
var data = {
resourceType: 7,
max: args.data.vpcLimit,
@ -410,7 +457,7 @@
});
}
if(args.data.cpuLimit != null) {
if (args.data.cpuLimit != null) {
var data = {
resourceType: 8,
max: args.data.cpuLimit,
@ -428,7 +475,7 @@
});
}
if(args.data.memoryLimit != null) {
if (args.data.memoryLimit != null) {
var data = {
resourceType: 9,
max: args.data.memoryLimit,
@ -446,7 +493,7 @@
});
}
if(args.data.primaryStorageLimit != null) {
if (args.data.primaryStorageLimit != null) {
var data = {
resourceType: 10,
max: args.data.primaryStorageLimit,
@ -464,7 +511,7 @@
});
}
if(args.data.secondaryStorageLimit != null) {
if (args.data.secondaryStorageLimit != null) {
var data = {
resourceType: 11,
max: args.data.secondaryStorageLimit,
@ -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){
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
@ -716,14 +772,15 @@
label: 'label.instance.limits',
isEditable: function(context) {
if(context.accounts == undefined)
if (context.accounts == undefined)
return false;
else {
if (context.accounts[0].accounttype == roleTypeUser || context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits is only allowed on account whose type is user or domain-admin
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
}
);
});
}
});
}
@ -904,17 +962,21 @@
custom: cloudStack.uiCustom.granularSettings({
dataProvider: function(args) {
$.ajax({
url:createURL('listConfigurations&accountid=' + args.context.accounts[0].id),
data: { page: args.page, pageSize: pageSize, listAll: true },
success:function(json){
url: createURL('listConfigurations&accountid=' + args.context.accounts[0].id),
data: {
page: args.page,
pageSize: pageSize,
listAll: true
},
success: function(json) {
args.response.success({
data:json.listconfigurationsresponse.configuration
data: json.listconfigurationsresponse.configuration
});
},
error:function(json){
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
@ -930,11 +992,13 @@
};
$.ajax({
url:createURL('updateConfiguration&accountid=' + args.context.accounts[0].id),
data:data,
success:function(json){
url: createURL('updateConfiguration&accountid=' + args.context.accounts[0].id),
data: data,
success: function(json) {
var item = json.updateconfigurationresponse.configuration;
args.response.success({data:item});
args.response.success({
data: item
});
},
error: function(json) {
@ -958,14 +1022,21 @@
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];
if(isAdmin() || isDomainAdmin()) {
if (isAdmin() || isDomainAdmin()) {
var data = {
domainid: accountObj.domainid,
account: accountObj.name
@ -982,8 +1053,7 @@
});
}
})
}
else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
} else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
args.response.success({
actionFilter: userActionfilter,
data: accountObj.user
@ -995,7 +1065,7 @@
label: 'label.add.user',
preFilter: function(args) {
if(isAdmin())
if (isAdmin())
return true;
else
return false;
@ -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: ""});
for(var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]});
args.response.success({data: items});
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
}
}
}
@ -1081,7 +1170,7 @@
lastname: args.data.lastname
});
if(args.data.timezone != null && args.data.timezone.length > 0) {
if (args.data.timezone != null && args.data.timezone.length > 0) {
$.extend(data, {
timezone: args.data.timezone
});
@ -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,46 +1431,65 @@
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',
converter: function(args) {
if(args == null || args.length == 0)
if (args == null || args.length == 0)
return "";
else
return args;
@ -1378,17 +1497,24 @@
isEditable: true,
select: function(args) {
var items = [];
items.push({id: "", description: ""});
for(var p in timezoneMap)
items.push({id: p, description: timezoneMap[p]});
args.response.success({data: items});
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
}
}
}
],
}],
dataProvider: function(args) {
if(isAdmin() || isDomainAdmin()) {
if (isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listUsers'),
data: {
@ -1401,8 +1527,7 @@
});
}
});
}
else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
} else { //normal user doesn't have access listUsers API until Bug 14127 is fixed.
args.response.success({
actionFilter: userActionfilter,
data: args.context.users[0]
@ -1423,22 +1548,22 @@
if (jsonObj.state == 'Destroyed') return [];
if( isAdmin() && jsonObj.isdefault == false)
if (isAdmin() && jsonObj.isdefault == false)
allowedActions.push("remove");
if(isAdmin()) {
if (isAdmin()) {
allowedActions.push("edit"); //updating networkdomain is allowed on any account, including system-generated default admin account
if(!(jsonObj.domain == "ROOT" && jsonObj.name == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account
if(jsonObj.state == "enabled") {
if (!(jsonObj.domain == "ROOT" && jsonObj.name == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account
if (jsonObj.state == "enabled") {
allowedActions.push("disable");
allowedActions.push("lock");
} else if(jsonObj.state == "disabled" || jsonObj.state == "locked") {
} else if (jsonObj.state == "disabled" || jsonObj.state == "locked") {
allowedActions.push("enable");
}
allowedActions.push("remove");
}
allowedActions.push("updateResourceCount");
} else if(isDomainAdmin()) {
} else if (isDomainAdmin()) {
allowedActions.push("updateResourceCount");
}
return allowedActions;
@ -1448,22 +1573,22 @@
var jsonObj = args.context.item;
var allowedActions = [];
if( isAdmin() && jsonObj.isdefault == false)
if (isAdmin() && jsonObj.isdefault == false)
allowedActions.push("remove");
if(isAdmin()) {
if (isAdmin()) {
allowedActions.push("edit");
allowedActions.push("changePassword");
allowedActions.push("generateKeys");
if(!(jsonObj.domain == "ROOT" && jsonObj.account == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account user
if(jsonObj.state == "enabled")
if (!(jsonObj.domain == "ROOT" && jsonObj.account == "admin" && jsonObj.accounttype == 1)) { //if not system-generated default admin account user
if (jsonObj.state == "enabled")
allowedActions.push("disable");
if(jsonObj.state == "disabled")
if (jsonObj.state == "disabled")
allowedActions.push("enable");
allowedActions.push("remove");
}
} else {
if(isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) {
if (isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) {
allowedActions.push("changePassword");
allowedActions.push("generateKeys");
}

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'
@ -69,12 +77,17 @@
success: function(json) {
var types = [];
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});
if (items != null) {
for (var i = 0; i < items.length; i++) {
types.push({
id: items[i].type,
description: items[i].type
});
}
}
args.response.success({data: types})
args.response.success({
data: types
})
}
});
}
@ -87,23 +100,24 @@
name: args.data.name,
type: args.data.type
};
if(args.data.description != null && args.data.description.length > 0)
$.extend(data, {description: args.data.description});
if (args.data.description != null && args.data.description.length > 0)
$.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;
}
}
}
);
});
}
});
},
@ -134,7 +148,7 @@
success: function(json) {
var jid = json.deleteaffinitygroupresponse.jobid;
args.response.success({
_custom:{
_custom: {
jobId: jid
}
});
@ -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
});
}
});
}

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,13 @@
// KIND, either express or implied. See the License for the
// 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
@ -56,7 +63,7 @@ $(document).ready(function() {
var url = $.urlParam("loginUrl");
if (url != undefined && url != null && url.length > 0) {
url = unescape(clientApiUrl+"?"+url);
url = unescape(clientApiUrl + "?" + url);
$.ajax({
url: url,
dataType: "json",
@ -74,5 +81,3 @@ $(document).ready(function() {
});
}
});

View File

@ -21,16 +21,13 @@
sectionPreFilter: function(args) {
var sections = [];
if(isAdmin()) {
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"];
}
@ -83,26 +80,31 @@
var json = JSON.parse(data.responseText);
if (json != null) {
var property;
for(property in json) {}
for (property in json) {}
var errorObj = json[property];
if(errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature") {
if (errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature") {
clickAction = function() {
$('#user-options a').eq(0).trigger('click');
};
}
}
}
cloudStack.dialog.notice({ message: parseXMLHttpResponse(data), clickAction: clickAction });
cloudStack.dialog.notice({
message: parseXMLHttpResponse(data),
clickAction: clickAction
});
},
beforeSend: function(XMLHttpRequest) {
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;
}
}
@ -130,12 +132,11 @@
g_domainid = $.cookie('domainid');
g_userfullname = $.cookie('userfullname');
g_timezone = $.cookie('timezone');
if($.cookie('timezoneoffset') != null)
g_timezoneoffset = isNaN($.cookie('timezoneoffset'))? null: parseFloat($.cookie('timezoneoffset'));
if ($.cookie('timezoneoffset') != null)
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;
@ -145,8 +146,8 @@
g_domainid = g_loginResponse.domainid;
g_userfullname = g_loginResponse.firstname + ' ' + g_loginResponse.lastname;
g_timezone = g_loginResponse.timezone;
if(g_loginResponse.timezoneoffset != null)
g_timezoneoffset = isNaN(g_loginResponse.timezoneoffset)? null: parseFloat(g_loginResponse.timezoneoffset);
if (g_loginResponse.timezoneoffset != null)
g_timezoneoffset = isNaN(g_loginResponse.timezoneoffset) ? null : parseFloat(g_loginResponse.timezoneoffset);
else
g_timezoneoffset = null;
}
@ -158,25 +159,33 @@
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;
if(json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax ) * 3; //multiply 3 to be on safe side
if (json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax) * 3; //multiply 3 to be on safe side
//intervalLimit = 9999; //this line is for testing only, comment it before check in
if(intervalLimit > g_queryAsyncJobResultInterval)
if (intervalLimit > g_queryAsyncJobResultInterval)
g_queryAsyncJobResultInterval = intervalLimit;
}
@ -184,7 +193,7 @@
},
error: function(xmlHTTP) { //override default error handling, do nothing instead of showing error "unable to verify user credentials" on login screen
},
beforeSend : function(XMLHttpResponse) {
beforeSend: function(XMLHttpResponse) {
return true;
}
});
@ -198,7 +207,7 @@
async: false,
success: function(json) {
var items = json.listimagestoreresponse.imagestore;
if(items != null && items.length > 0)
if (items != null && items.length > 0)
havingSwift = true;
}
});
@ -249,14 +258,13 @@
array1.push("&password=" + password);
var domain;
if(args.data.domain != null && args.data.domain.length > 0) {
if (args.data.domain != null && args.data.domain.length > 0) {
if (args.data.domain.charAt(0) != "/")
domain = "/" + args.data.domain;
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,25 +323,33 @@
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;
if(json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax ) * 3; //multiply 3 to be on safe side
if (json.listcapabilitiesresponse.capability.apilimitinterval != null && json.listcapabilitiesresponse.capability.apilimitmax != null) {
var intervalLimit = ((json.listcapabilitiesresponse.capability.apilimitinterval * 1000) / json.listcapabilitiesresponse.capability.apilimitmax) * 3; //multiply 3 to be on safe side
//intervalLimit = 8888; //this line is for testing only, comment it before check in
if(intervalLimit > g_queryAsyncJobResultInterval)
if (intervalLimit > g_queryAsyncJobResultInterval)
g_queryAsyncJobResultInterval = intervalLimit;
}
@ -337,13 +371,13 @@
if (isAdmin()) {
$.ajax({
url: createURL("listImageStores"),
data:{
data: {
provider: 'Swift'
},
async: false,
success: function(json) {
var items = json.listimagestoreresponse.imagestore;
if(items != null && items.length > 0)
if (items != null && items.length > 0)
havingSwift = true;
}
});
@ -373,13 +407,13 @@
},
error: function(XMLHttpRequest) {
var errorMsg = parseXMLHttpResponse(XMLHttpRequest);
if(errorMsg.length == 0 && XMLHttpRequest.status == 0)
if (errorMsg.length == 0 && XMLHttpRequest.status == 0)
errorMsg = dictionary['error.unable.to.reach.management.server'];
else
errorMsg = _l('error.invalid.username.password'); //override error message
args.response.error(errorMsg);
},
beforeSend : function(XMLHttpResponse) {
beforeSend: function(XMLHttpResponse) {
return true;
}
});
@ -411,16 +445,16 @@
$.cookie('timezone', null);
$.cookie('supportELB', null);
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
if (onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document.
}
},
error: function() {
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
if (onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document.
}
},
beforeSend : function(XMLHttpResponse) {
beforeSend: function(XMLHttpResponse) {
return true;
}
});
@ -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 : []
}));
}
});
@ -142,18 +141,15 @@
});
},
capacity: function(data) {
var latestData =null;
if(window.fetchLatestflag == 1)
{
var latestData = null;
if (window.fetchLatestflag == 1) {
latestData = {
fetchLatest:true
fetchLatest: true
}
}
else
{
} else {
latestData = {
fetchLatest:false
fetchLatest: false
}
}

View File

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

View File

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

View File

@ -20,7 +20,7 @@
id: 'events',
sectionSelect: {
preFilter: function(args) {
if(isAdmin())
if (isAdmin())
return ["events", "alerts"];
else
return ["events"];
@ -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: {
@ -55,35 +68,42 @@
}
},
createForm: {
title:'Delete Events',
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',
docID: 'helpEventsDeleteDate',
isDatepicker: true
}
}
},
action: function(args) {
var data={};
var data = {};
if(args.data.type != "")
$.extend(data, { type:args.data.type });
if (args.data.type != "")
$.extend(data, {
type: args.data.type
});
if(args.data.date != "")
$.extend(data, {olderthan:args.data.date });
if (args.data.date != "")
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
url:createURL("deleteEvents"),
data:data,
dataType:'json',
url: createURL("deleteEvents"),
data: data,
dataType: 'json',
async: false,
success:function(data){
success: function(data) {
args.response.success();
@ -105,30 +125,41 @@
}
},
createForm: {
title:'Archive Events',
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={};
var data = {};
if(args.data.type != "")
$.extend(data, { type:args.data.type });
if (args.data.type != "")
$.extend(data, {
type: args.data.type
});
if(args.data.date != "")
$.extend(data, {olderthan:args.data.date });
if (args.data.date != "")
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
url:createURL("archiveEvents"),
data:data,
dataType:'json',
url: createURL("archiveEvents"),
data: data,
dataType: 'json',
async: false,
success:function(data){
success: function(data) {
args.response.success();
@ -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'
}]
});
}
},
@ -162,7 +200,7 @@
domainid: {
label: 'Domain',
select: function(args) {
if(isAdmin() || isDomainAdmin()) {
if (isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listDomains'),
data: {
@ -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});
if (domains != null && domains.length > 0) {
for (var i = 0; i < domains.length; i++) {
array1.push({
id: domains[i].id,
description: domains[i].path
});
}
}
args.response.success({
@ -182,15 +226,14 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
}
},
isHidden: function(args) {
if(isAdmin() || isDomainAdmin())
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
@ -200,7 +243,7 @@
account: {
label: 'Account',
isHidden: function(args) {
if(isAdmin() || isDomainAdmin())
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
@ -228,7 +271,9 @@
data: data,
success: function(json) {
var items = json.listeventsresponse.event;
args.response.success({data:items});
args.response.success({
data: items
});
}
});
},
@ -250,8 +295,8 @@
action: function(args) {
$.ajax({
url:createURL("deleteEvents&ids=" +args.context.events[0].id),
success:function(json){
url: createURL("deleteEvents&ids=" + args.context.events[0].id),
success: function(json) {
args.response.success();
@ -275,8 +320,8 @@
action: function(args) {
$.ajax({
url:createURL("archiveEvents&ids=" +args.context.events[0].id),
success:function(json){
url: createURL("archiveEvents&ids=" + args.context.events[0].id),
success: function(json) {
args.response.success();
@ -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: {
@ -346,31 +417,42 @@
}
},
createForm: {
title:'Delete Alerts',
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) {
var data={};
var data = {};
if(args.data.type != "")
$.extend(data, { type:args.data.type });
if (args.data.type != "")
$.extend(data, {
type: args.data.type
});
if(args.data.date != "")
$.extend(data, {olderthan:args.data.date });
if (args.data.date != "")
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
url:createURL("deleteAlerts"),
data:data,
dataType:'json',
url: createURL("deleteAlerts"),
data: data,
dataType: 'json',
async: false,
success:function(data){
success: function(data) {
args.response.success();
@ -392,30 +474,41 @@
}
},
createForm: {
title:'Archive Alerts',
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={};
var data = {};
if(args.data.type != "")
$.extend(data, { type:args.data.type });
if (args.data.type != "")
$.extend(data, {
type: args.data.type
});
if(args.data.date != "")
$.extend(data, {olderthan:args.data.date });
if (args.data.date != "")
$.extend(data, {
olderthan: args.data.date
});
$.ajax({
url:createURL("archiveAlerts"),
data:data,
dataType:'json',
url: createURL("archiveAlerts"),
data: data,
dataType: 'json',
async: false,
success:function(data){
success: function(data) {
args.response.success();
@ -439,7 +532,9 @@
async: true,
success: function(json) {
var items = json.listalertsresponse.alert;
args.response.success({data:items});
args.response.success({
data: items
});
}
});
},
@ -461,8 +556,8 @@
action: function(args) {
$.ajax({
url:createURL("deleteAlerts&ids=" +args.context.alerts[0].id),
success:function(json){
url: createURL("deleteAlerts&ids=" + args.context.alerts[0].id),
success: function(json) {
args.response.success();
@ -487,8 +582,8 @@
action: function(args) {
$.ajax({
url:createURL("archiveAlerts&ids=" +args.context.alerts[0].id),
success:function(json){
url: createURL("archiveAlerts&ids=" + args.context.alerts[0].id),
success: function(json) {
args.response.success();
@ -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

@ -41,11 +41,17 @@
data: data,
success: function(json) {
var item = json.updateconfigurationresponse.configuration;
if(item.category == "Usage")
cloudStack.dialog.notice({ message: _l('message.restart.mgmt.usage.server') });
if (item.category == "Usage")
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,31 +91,41 @@
async: true,
success: function(json) {
var items = json.listconfigurationsresponse.configuration;
args.response.success({ data: items });
args.response.success({
data: items
});
}
});
}
}
},
ldapConfiguration:{
type:'select',
title:'LDAP Configuration',
listView:{
id:'ldap',
label:'LDAP Configuration',
fields:{
hostname: {label: 'Hostname'},
queryfilter: {label: 'Query Filter'},
searchbase: {label: 'Search Base'},
port: {label: 'LDAP Port'},
ldapConfiguration: {
type: 'select',
title: 'LDAP Configuration',
listView: {
id: 'ldap',
label: 'LDAP Configuration',
fields: {
hostname: {
label: 'Hostname'
},
queryfilter: {
label: 'Query Filter'
},
searchbase: {
label: 'Search Base'
},
port: {
label: 'LDAP Port'
},
ssl: {
label: 'SSL'
}
},
dataProvider:function(args){
dataProvider: function(args) {
var data = {};
listViewDataProvider(args, data);
$.ajax({
@ -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));
@ -134,8 +161,8 @@
action: function(args) {
$.ajax({
url:createURL("ldapRemove"),
success:function(json){
url: createURL("ldapRemove"),
success: function(json) {
args.response.success();
@ -148,25 +175,31 @@
}
},
tabs:{
tabs: {
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" ),
url: createURL("ldapConfig&listAll=true"),
dataType: "json",
async: true,
success: function(json) {
var item = json.ldapconfigresponse.ldapconfig;
args.response.success({data: item});
args.response.success({
data: item
});
}
});
}
@ -177,7 +210,7 @@
},
actions: {
add:{
add: {
label: 'Configure LDAP',
@ -193,21 +226,65 @@
createForm: {
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}},
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
}
},
ssl: {
label:'SSL' ,
isBoolean:true,
isChecked:false
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
}
}
}
@ -215,27 +292,25 @@
},
action:function(args) {
action: function(args) {
var array = [];
array.push("&binddn=" + todb(args.data.name));
array.push("&bindpass=" + todb(args.data.password));
array.push("&hostname=" + todb(args.data.hostname));
array.push("&searchbase=" +todb(args.data.searchbase));
array.push("&queryfilter=" +todb(args.data.queryfilter));
array.push("&port=" +todb(args.data.port));
array.push("&searchbase=" + todb(args.data.searchbase));
array.push("&queryfilter=" + todb(args.data.queryfilter));
array.push("&port=" + todb(args.data.port));
if(args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked')== true) {
if (args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked') == true) {
array.push("&ssl=true");
if(args.data.truststore != "")
array.push("&truststore=" +todb(args.data.truststore));
if (args.data.truststore != "")
array.push("&truststore=" + todb(args.data.truststore));
if(args.data.truststorepassword !="")
array.push("&truststorepass=" +todb(args.data.truststorepassword));
if (args.data.truststorepassword != "")
array.push("&truststorepass=" + todb(args.data.truststorepassword));
}
else
} else
array.push("&ssl=false");
$.ajax({
@ -250,7 +325,7 @@
},
error:function(json){
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
@ -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(
{
data:args.context.hypervisorCapabilities[0]
}
);
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
}
});
}
});
@ -263,7 +265,7 @@
});
//pick the network offering including SecurityGroup, but excluding Lb and StaticNat. (bug 13665)
return (($.inArray('SecurityGroup', services) != -1) && ($.inArray('Lb', services) == -1) && ($.inArray('StaticNat', services) == -1)) ;
return (($.inArray('SecurityGroup', services) != -1) && ($.inArray('Lb', services) == -1) && ($.inArray('StaticNat', services) == -1));
}
)[0];
}

View File

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

@ -23,17 +23,16 @@
var context = args.context;
var network;
if('vpc' in args.context) { //from VPC section
if ('vpc' in args.context) { //from VPC section
var data = {
listAll: true,
supportedservices: 'Lb'
};
if(args.context.ipAddresses[0].associatednetworkid == null) {
if (args.context.ipAddresses[0].associatednetworkid == null) {
$.extend(data, {
vpcid: args.context.vpc[0].id
});
}
else {
} else {
$.extend(data, {
id: args.context.ipAddresses[0].associatednetworkid
});
@ -45,13 +44,12 @@
async: false,
success: function(json) {
var items = json.listnetworksresponse.network;
if(items != null && items.length > 0) {
if (items != null && items.length > 0) {
network = items[0];
}
}
});
}
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
@ -535,7 +572,7 @@
args.response.success({
_custom: {
jobId: data.updateprojectresponse.jobid,
onComplete: function(){
onComplete: function() {
setTimeout(function() {
$(window).trigger('cloudStack.fullRefresh');
if (isUser()) {
@ -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,13 +692,17 @@
},
advSearchFields: {
name: { label: 'label.name' },
displaytext: { label: 'label.display.text' },
name: {
label: 'label.name'
},
displaytext: {
label: 'label.display.text'
},
domainid: {
label: 'Domain',
select: function(args) {
if(isAdmin() || isDomainAdmin()) {
if (isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listDomains'),
data: {
@ -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});
if (domains != null && domains.length > 0) {
for (var i = 0; i < domains.length; i++) {
array1.push({
id: domains[i].id,
description: domains[i].path
});
}
}
args.response.success({
@ -670,15 +728,14 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
}
},
isHidden: function(args) {
if(isAdmin() || isDomainAdmin())
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
@ -688,7 +745,7 @@
account: {
label: 'Account',
isHidden: function(args) {
if(isAdmin() || isDomainAdmin())
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
@ -707,7 +764,9 @@
}
$.ajax({
url: createURL('listProjects', { ignoreProject: true }),
url: createURL('listProjects', {
ignoreProject: true
}),
data: data,
success: function(data) {
args.response.success({
@ -730,7 +789,7 @@
},
detailView: {
updateContext: function (args) {
updateContext: function(args) {
var project;
var projectID = args.context.projects[0].id;
var url = 'listProjects';
@ -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';
}
}
}
}
@ -1163,4 +1298,4 @@
return ['accept', 'decline'];
};
} (cloudStack));
}(cloudStack));

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,29 +51,52 @@
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: {
label: 'label.add.region',
preFilter: function(args) {
if(isAdmin())
if (isAdmin())
return true;
else
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,17 +335,25 @@
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',
select: function(args) {
if(isAdmin() || isDomainAdmin()) {
if (isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listDomains'),
data: {
@ -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});
if (domains != null && domains.length > 0) {
for (var i = 0; i < domains.length; i++) {
array1.push({
id: domains[i].id,
description: domains[i].path
});
}
}
args.response.success({
@ -308,15 +379,14 @@
});
}
});
}
else {
} else {
args.response.success({
data: null
});
}
},
isHidden: function(args) {
if(isAdmin() || isDomainAdmin())
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
@ -325,7 +395,7 @@
account: {
label: 'Account',
isHidden: function(args) {
if(isAdmin() || isDomainAdmin())
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
@ -342,27 +412,32 @@
gslbdomainname: args.data.gslbdomainname,
gslbservicetype: args.data.gslbservicetype
};
if(args.data.description != null && args.data.description.length > 0)
$.extend(data, { description: args.data.description });
if(args.data.domainid != null && args.data.domainid.length > 0)
$.extend(data, { domainid: args.data.domainid });
if(args.data.account != null && args.data.account.length > 0)
$.extend(data, { account: args.data.account });
if (args.data.description != null && args.data.description.length > 0)
$.extend(data, {
description: args.data.description
});
if (args.data.domainid != null && args.data.domainid.length > 0)
$.extend(data, {
domainid: args.data.domainid
});
if (args.data.account != null && args.data.account.length > 0)
$.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;
}
}
}
);
});
}
});
},
@ -373,7 +448,7 @@
},
dataProvider: function(args) {
if('regions' in args.context) {
if ('regions' in args.context) {
var data = {
regionid: args.context.regions[0].id
};
@ -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
}
}
}
},
@ -539,7 +645,7 @@
gateway: args.data.gateway,
netmask: args.data.netmask
};
if(args.data.vlan != null && args.data.vlan.length > 0) {
if (args.data.vlan != null && args.data.vlan.length > 0) {
$.extend(data, {
vlan: args.data.vlan
})
@ -611,23 +717,33 @@
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) {
var text1 = '';
if(args != null) {
for(var i = 0; i < args.length; i++) {
if(i > 0) {
if (args != null) {
for (var i = 0; i < args.length; i++) {
if (i > 0) {
text1 += ', ';
}
text1 += args[i].ipaddress;
@ -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 = {
@ -715,18 +838,18 @@
var allLbRules = json.listloadbalancerrulesresponse.loadbalancerrule;
var assignedLbRules = args.context.GSLB[0].loadbalancerrule;
var items = [];
if(allLbRules != null) {
for(var i = 0; i < allLbRules.length; i++) {
if (allLbRules != null) {
for (var i = 0; i < allLbRules.length; i++) {
var isAssigned = false;
if(assignedLbRules != null) {
for(var k = 0; k < assignedLbRules.length; k++) {
if(allLbRules[i].id == assignedLbRules[k].id) {
if (assignedLbRules != null) {
for (var k = 0; k < assignedLbRules.length; k++) {
if (allLbRules[i].id == assignedLbRules[k].id) {
isAssigned = true;
break;
}
}
}
if(isAssigned == false) {
if (isAssigned == false) {
items.push(allLbRules[i]);
}
}
@ -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'),
@ -846,7 +985,7 @@
var regionActionfilter = function(args) {
var allowedActions = [];
if(isAdmin()) {
if (isAdmin()) {
allowedActions.push("edit");
allowedActions.push("remove");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -70,13 +70,14 @@
dialogClass: 'multi-edit-add-list panel',
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

@ -40,10 +40,10 @@
var $scaleUpPolicy = $('<div>').addClass('scale-up-policy');
var $slideScaleUp = $('<div></div>').addClass('expand');
var $hideScaleUp = $('<div></div>').addClass('hide');
var $scaleUpLabel= $('<div>Show</div>').addClass('slide-label');
var $scaleUpHideLabel=$('<div>Hide</div>').addClass('slide-label');
var $scaleDownHideLabel=$('<div>Hide</div>').addClass('slide-label');
var $scaleDownLabel=$('<div>Show</div>').addClass('slide-label');
var $scaleUpLabel = $('<div>Show</div>').addClass('slide-label');
var $scaleUpHideLabel = $('<div>Hide</div>').addClass('slide-label');
var $scaleDownHideLabel = $('<div>Hide</div>').addClass('slide-label');
var $scaleDownLabel = $('<div>Show</div>').addClass('slide-label');
var $slideScaleDown = $('<div></div>').addClass('expand');
var $hideScaleDown = $('<div></div>').addClass('hide');
var $scaleUpDivider = $('<hr></hr>').addClass('policy-divider');
@ -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');
@ -102,7 +107,7 @@
});
// Reload actions
if(data != null) { //data is originalAutoscaleData in \ui\scripts\autoscaler.js
if (data != null) { //data is originalAutoscaleData in \ui\scripts\autoscaler.js
data['afterActionIsComplete'] = args.data;
}
@ -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');
@ -319,22 +338,20 @@
height: 600,
draggable: true,
closeonEscape: false,
overflow:'auto',
open:function() {
$("button").each(function(){
overflow: 'auto',
open: function() {
$("button").each(function() {
$(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,13 +400,12 @@
$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);
if(args.data.isAdvanced != null) {
if (args.data.isAdvanced != null) {
$autoscalerDialog.find('input[type=checkbox]').trigger('click');
$autoscalerDialog.find('input[type=checkbox]').attr('checked', 'checked');
}

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

@ -22,15 +22,17 @@
// Place outer args here as local variables
// i.e, -- var dataProvider = args.dataProvider
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') });
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')
});
return;
}
var formData = args.formData;
var forms = $.extend(true, {}, args.forms);
var topFieldForm, bottomFieldForm , $topFieldForm , $bottomFieldForm;
var topFieldForm, bottomFieldForm, $topFieldForm, $bottomFieldForm;
var topfields = forms.topFields;
var $healthCheckDesc = $('<div>Your load balancer will automatically perform health checks on your cloudstack instances and only route traffic to instances that pass the health check </div>').addClass('health-check-description');
@ -56,7 +58,7 @@
},
async: false,
success: function(json) {
if(json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0] != undefined) {
if (json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0] != undefined) {
policyObj = json.listlbhealthcheckpoliciesresponse.healthcheckpolicies[0].healthcheckpolicy[0];
pingpath1 = policyObj.pingpath; //API bug: API doesn't return it
responsetimeout1 = policyObj.responsetime;
@ -72,8 +74,14 @@
noDialog: true, // Don't render a dialog, just return $formContainer
form: {
title: '',
fields:{
pingpath: {label: 'Ping Path', validation: {required: false}, defaultValue: pingpath1}
fields: {
pingpath: {
label: 'Ping Path',
validation: {
required: false
},
defaultValue: pingpath1
}
}
}
});
@ -83,16 +91,40 @@
$healthCheckDialog.append($healthCheckAdvancedTitle);
bottomFieldForm = cloudStack.dialog.createForm ({
context:args.context,
noDialog:true,
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}
bottomFieldForm = cloudStack.dialog.createForm({
context: args.context,
noDialog: true,
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
}
}
}
});
@ -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(
{
if (policyObj == null) { //policy is not created yet
buttons.push({
text: _l('Create'),
'class': 'ok',
click: function() {
@ -134,7 +163,7 @@
data: data,
success: function(json) {
var jobId = json.createlbhealthcheckpolicyresponse.jobid;
var createLBHealthCheckPolicyIntervalId = setInterval(function(){
var createLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({
url: createURL('queryAsyncJobResult'),
data: {
@ -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();
@ -166,19 +197,19 @@
}, g_queryAsyncJobResultInterval);
},
error:function(json){
error: function(json) {
cloudStack.dialog.notice({message: _s(json.responseText)}); //Error message in the API needs to be improved
cloudStack.dialog.notice({
message: _s(json.responseText)
}); //Error message in the API needs to be improved
$healthCheckDialog.dialog('close');
$('.overlay').remove();
}
});
}
}
);
}
else { //policy exists already
});
} else { //policy exists already
buttons.push(
//Update Button (begin) - call delete API first, then create API
{
@ -190,11 +221,11 @@
$.ajax({
url: createURL('deleteLBHealthCheckPolicy'),
data: {
id : policyObj.id
id: policyObj.id
},
success: function(json) {
var jobId = json.deletelbhealthcheckpolicyresponse.jobid;
var deleteLBHealthCheckPolicyIntervalId = setInterval(function(){
var deleteLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({
url: createURL('queryAsyncJobResult'),
data: {
@ -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) {
@ -224,7 +254,7 @@
data: data,
success: function(json) {
var jobId = json.createlbhealthcheckpolicyresponse.jobid;
var createLBHealthCheckPolicyIntervalId = setInterval(function(){
var createLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({
url: createURL('queryAsyncJobResult'),
data: {
@ -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();
@ -283,11 +316,11 @@
$.ajax({
url: createURL('deleteLBHealthCheckPolicy'),
data: {
id : policyObj.id
id: policyObj.id
},
success: function(json) {
var jobId = json.deletelbhealthcheckpolicyresponse.jobid;
var deleteLBHealthCheckPolicyIntervalId = setInterval(function(){
var deleteLBHealthCheckPolicyIntervalId = setInterval(function() {
$.ajax({
url: createURL('queryAsyncJobResult'),
data: {
@ -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();
@ -331,13 +366,13 @@
height: 600,
draggable: true,
closeonEscape: false,
overflow:'auto',
open:function() {
$("button").each(function(){
overflow: 'auto',
open: function() {
$("button").each(function() {
$(this).attr("style", "left: 400px; position: relative; margin-right: 5px; ");
});
$('.ui-dialog .delete').css('left','140px');
$('.ui-dialog .delete').css('left', '140px');
},
buttons: buttons
@ -345,6 +380,4 @@
}
}
}(jQuery, cloudStack));
}(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,29 +673,40 @@
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'
}
});
}
},
scope:{
label:'label.scope',
select:function(args){
var scopeData=[];
scope: {
label: 'label.scope',
select: function(args) {
var scopeData = [];
//intelligence to handle different hypervisors to be added here
/* if( selectedHypervisor == 'XenServer'){
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,23 +55,23 @@
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 []; }
});
}
listViewArgs.complete({
_custom: args._custom,
messageArgs: cloudStack.serializeForm($form),
$item: $listView.size()? $loading : $('<div>')
$item: $listView.size() ? $loading : $('<div>')
});
close();
@ -79,7 +81,9 @@
$('div.overlay').remove();
if (message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
}
}
}
@ -152,7 +156,7 @@
)
.data('json-obj', this);
if(selectedObj != null && selectedObj.id == item.id) {
if (selectedObj != null && selectedObj.id == item.id) {
$select.find('input[type=checkbox]').attr('checked', 'checked');
}
@ -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'
},
@ -777,7 +781,7 @@
var conditionalFieldFrom = $(this).attr('conditional-field');
if (conditionalFieldFrom) {
if ($wizard.find('.'+conditionalFieldFrom).css('display') == 'block') {
if ($wizard.find('.' + conditionalFieldFrom).css('display') == 'block') {
$(this).closest('div.select').show();
} else {
$(this).closest('div.select').hide();
@ -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,14 +866,15 @@
// 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;
}
//step 5 - select network
if($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) {
if ($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) {
var data = $activeStep.data('my-networks');
if (!data) {
@ -879,8 +883,10 @@
)['my-networks']);
}
if($activeStep.find('input[type=checkbox]:checked').size() == 0) { //if no checkbox is checked
cloudStack.dialog.notice({ message: 'message.step.4.continue' });
if ($activeStep.find('input[type=checkbox]:checked').size() == 0) { //if no checkbox is checked
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
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" });
} 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"
});
return false;
}
}
@ -903,10 +910,10 @@
//step 6 - review (spcifiy displyname, group as well)
if ($activeStep.hasClass('review')) {
if($activeStep.find('input[name=displayname]').size() > 0 && $activeStep.find('input[name=displayname]').val().length > 0) {
if ($activeStep.find('input[name=displayname]').size() > 0 && $activeStep.find('input[name=displayname]').val().length > 0) {
//validate
var b = cloudStack.validate.vmHostName($activeStep.find('input[name=displayname]').val());
if(b == false)
if (b == false)
return false;
}
}
@ -1002,7 +1009,7 @@
}
});
$wizard.find('div.data-disk-offering div.custom-size input[type=text]').bind('change',function() {
$wizard.find('div.data-disk-offering div.custom-size input[type=text]').bind('change', function() {
var old = $wizard.find('div.data-disk-offering div.custom-size input[type=text]').val();
$wizard.find('div.data-disk-offering span.custom-disk-size').html(_s(old));
});

View File

@ -110,13 +110,12 @@
}
});
if(includingFirewall == true) {
if (includingFirewall == true) {
$chart.find('li.firewall .view-details').click(function() {
//makeMultiEditPanel($(this), { title: _l('label.nat.port.range')});
makeMultiEditPanel($(this));
});
}
else {
} else {
$chart.find('li.firewall').hide();
}
@ -133,15 +132,13 @@
// 1. choose between staticNAT chart and non-staticNAT chart 2. filter disabled tabs
if (preFilter.length) {
if($.inArray('nonStaticNATChart', preFilter) != -1) { //choose static NAT chart
if($.inArray('firewall', preFilter) == -1) {
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
});
}
}
});
@ -121,7 +123,7 @@
// Select language
var $languageSelect = $login.find('select[name=language]');
$languageSelect.change(function() {
if($(this).val() != '') //language dropdown is not blank
if ($(this).val() != '') //language dropdown is not blank
$.cookie('lang', $(this).val()); //the selected option in language dropdown will be used (instead of browser's default language)
else //language dropdown is blank
$.cookie('lang', null); //null $.cookie('lang'), so browser's default language will be used.

View File

@ -21,7 +21,9 @@
var listViewArgs = $.isFunction(target) ? target() : target;
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();
@ -620,7 +644,7 @@
$selector.dialog({
title: _l('label.select.project'),
dialogClass: 'project-selector-dialog',
closeOnEscape: false ,
closeOnEscape: false,
width: 420
}).closest('.ui-dialog').overlay();
}
@ -692,10 +716,10 @@
var $projectSwitcher = $('div.project-switcher');
var contextProjectId = cloudStack.context.projects ? cloudStack.context.projects[0].id : -1;
$projectSwitcher.find('option[value="'+projectId+'"]').remove();
$projectSwitcher.find('option[value="' + projectId + '"]').remove();
//return to default view if current project is deleted
if(contextProjectId == projectId) {
if (contextProjectId == projectId) {
$projectSwitcher.find('select').trigger('change');
}
return false;
@ -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();
@ -189,10 +192,9 @@
var $dialog = $snapshots.dialog({
title: _l('label.action.recurring.snapshot'),
dialogClass: 'recurring-snapshots',
closeOnEscape:false,
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

@ -40,7 +40,7 @@
region.endpoint == "http://localhost:8080/client/"
document.location.href == "http://localhost:8080/client/#"
*/
if(document.location.href.indexOf(region.endpoint) != -1) {
if (document.location.href.indexOf(region.endpoint) != -1) {
currentRegion = region;
$li.addClass('active');
}
@ -48,10 +48,9 @@
$regionList.append($li);
});
if(currentRegion != null) {
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,12 +154,14 @@
after: function(args) {
var data = args.data;
var error = function(message) {
cloudStack.dialog.notice({ message: message });
cloudStack.dialog.notice({
message: message
});
};
addAction.action({
data: data,
$form:args.$form,
$form: args.$form,
context: gateways.context,
response: {
success: function(args) {
@ -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');
});
@ -416,7 +433,7 @@
$title.attr('title', name);
$cidr.html(cidr);
$vmCount.append(
$('<span>').addClass('total').html(virtualMachines != null? virtualMachines.length: 0),
$('<span>').addClass('total').html(virtualMachines != null ? virtualMachines.length : 0),
_l('label.vms')
);
$tier.append($actions);
@ -493,9 +510,9 @@
var $router;
$router = elems.router({
$browser:$browser,
detailView:$.extend(true, {}, args.routerDetailView(), {
context:context
$browser: $browser,
detailView: $.extend(true, {}, args.routerDetailView(), {
context: context
})
});
@ -508,52 +525,60 @@
)
.append(
elems.vpcConfigureArea({
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}),
tierDetailView:tierDetailView
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
}),
tierDetailView: tierDetailView
})
);
var showAddTierDialog = function () {
var showAddTierDialog = function() {
if ($(this).find('.loading-overlay').size()) {
return false;
}
addTierDialog({
ipAddresses:ipAddresses,
$browser:$browser,
tierDetailView:tierDetailView,
$tiers:$tiers,
acl:acl,
context:context,
actions:actions,
vmListView:vmListView,
actionPreFilter:actionPreFilter
ipAddresses: ipAddresses,
$browser: $browser,
tierDetailView: tierDetailView,
$tiers: $tiers,
acl: acl,
context: context,
actions: actions,
vmListView: vmListView,
actionPreFilter: actionPreFilter
});
return true;
};
if (tiers != null && tiers.length > 0) {
$(tiers).map(function (index, tier) {
$(tiers).map(function(index, tier) {
var $tier = elems.tier({
ipAddresses:ipAddresses,
acl:acl,
$browser:$browser,
detailView:tierDetailView,
name:tier.name,
cidr:tier.cidr,
virtualMachines:tier.virtualMachines,
vmListView:vmListView,
actions:actions,
actionPreFilter:actionPreFilter,
context:$.extend(true, {}, context, {
networks:[tier]
ipAddresses: ipAddresses,
acl: acl,
$browser: $browser,
detailView: tierDetailView,
name: tier.name,
cidr: tier.cidr,
virtualMachines: tier.virtualMachines,
vmListView: vmListView,
actions: actions,
actionPreFilter: actionPreFilter,
context: $.extend(true, {}, context, {
networks: [tier]
})
});
@ -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();
@ -679,7 +708,7 @@
);
};
switch(actionID) {
switch (actionID) {
case 'addVM':
action({
context: context,
@ -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
});
}
});
});
@ -256,13 +258,12 @@
// Make traffic type elems
$.each(trafficTypes, function(id, trafficType) {
if ($.inArray(id, validTrafficTypes) == -1) { //if it is not a valid traffic type
if(trafficType.dependsOn != null && trafficType.dependsOn.length > 0) { //if it has dependsOn
if($.inArray(trafficType.dependsOn, validTrafficTypes) == -1) { //if its dependsOn is not a valid traffic type, either
if (trafficType.dependsOn != null && trafficType.dependsOn.length > 0) { //if it has dependsOn
if ($.inArray(trafficType.dependsOn, validTrafficTypes) == -1) { //if its dependsOn is not a valid traffic type, either
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';
};
/**
@ -258,7 +263,7 @@
});
// Setup required traffic types
$(physicalNetwork.requiredTrafficTypes($wizard)).each(function () {
$(physicalNetwork.requiredTrafficTypes($wizard)).each(function() {
var trafficTypeID = this;
var $firstPhysicalNetwork = physicalNetwork.getNetworks($wizard).filter(':first');
@ -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')
)
);
@ -591,9 +603,9 @@
async: false,
success: function(json) {
var items = json.listconfigurationsresponse.configuration; //2 entries returned: 'sdn.ovs.controller', 'sdn.ovs.controller.default.label'
$(items).each(function(){
if(this.name == 'sdn.ovs.controller') {
if(this.value == 'true' || this.value == true) {
$(items).each(function() {
if (this.name == 'sdn.ovs.controller') {
if (this.value == 'true' || this.value == true) {
ovsTunnelManager = true;
}
return false; //break each loop
@ -604,7 +616,7 @@
//when OVS tunnel manager is used
//if(ovsTunnelManager == true) {
//Advanced zone supports 2 isolation method(VLAN, GRE), so show dropdown including the 2 options
if($wizard.find('.select-network-model input:radio[name=network-model]:checked').val() == 'Advanced') {
if ($wizard.find('.select-network-model input:radio[name=network-model]:checked').val() == 'Advanced') {
$nameField.append(
$('<div>').append(
$('<span style=\"font-size:11px;padding-right:5px;padding-left:40px\">').html('Isolation method'),
@ -630,7 +642,7 @@
);
}
//Basic zone supports only 1 isolation method (L3), so there is no point showing dropdown.
// }
// }
//when OVS tunnel manager is not used, isolationmethods parameter in createPhysicalNetwork API is ignored. So no showing dropdown.
//isolationmethods parameter has not been used by network gurus so far. By default(i.e. when OVS tunnel manager is not used), networks are isolated with VLANs in Advanced zone, with L3 in basic zone.
//No longer the case, as the Nicira stuff also depends on this now
@ -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
);
}
@ -1049,7 +1075,7 @@
}
// Custom UI manipulations for specific steps
switch($targetStep.attr('zone-wizard-step-id')) {
switch ($targetStep.attr('zone-wizard-step-id')) {
case 'configureGuestTraffic':
if (formState['network-model'] == 'Advanced' && formState['zone-advanced-sg-enabled'] == undefined) {
guestTraffic.init($wizard, args); //initialize multiple tabs (tabs is as many as Guest Traffic types in multiple physical networks in Advanced Zone without SG)
@ -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');
}
});
}
@ -1210,8 +1249,8 @@
//when hypervisor is BareMetal (begin)
var data = getData($wizard);
if(('zone' in data) && (data.zone.hypervisor == 'BareMetal')) {
if($('.zone-wizard:visible').find('#add_zone_guest_traffic_desc:visible').size() > 0) { //$steps.filter(':visible').index() == 6
if (('zone' in data) && (data.zone.hypervisor == 'BareMetal')) {
if ($('.zone-wizard:visible').find('#add_zone_guest_traffic_desc:visible').size() > 0) { //$steps.filter(':visible').index() == 6
showStep('launch');
completeAction();
return false;

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);
@ -303,7 +323,7 @@
dialogClass: 'dialog-about',
buttons: {
'Close': function() {
$( this ).dialog( "close" );
$(this).dialog("close");
$(':ui-dialog, .overlay').remove();
}
}
@ -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,15 +105,14 @@
$('.hovered-elem').hide();
}
}
]
}]
}).closest('.ui-dialog').overlay();
};
var isLastAsync = function(idx) {
for(var i = idx+1; i < $(fields).length ; i++) {
for (var i = idx + 1; i < $(fields).length; i++) {
var f = args.form.fields[$(fields).get(i)];
if(f.select || f.dynamic){
if (f.select || f.dynamic) {
return false;
}
}
@ -124,9 +128,11 @@
var $formItem = $('<div>')
.addClass('form-item')
.attr({ rel: key });
.attr({
rel: key
});
if(field.isHidden != null) {
if (field.isHidden != null) {
if (typeof(field.isHidden) == 'boolean' && field.isHidden == true)
$formItem.hide();
else if (typeof(field.isHidden) == 'function' && 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
@ -256,7 +264,7 @@
$input.trigger('change');
if((!isNoDialog) && isLastAsync(idx)) {
if ((!isNoDialog) && isLastAsync(idx)) {
ret();
}
}
@ -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,14 +383,17 @@
$form.show();
// Form should be slightly wider
$form.closest(':ui-dialog').dialog('option', { position: 'center',closeOnEscape: false });
if((!isNoDialog) && isLastAsync(idx)) {
$form.closest(':ui-dialog').dialog('option', {
position: 'center',
closeOnEscape: false
});
if ((!isNoDialog) && isLastAsync(idx)) {
ret();
}
}
}
});
} else if(field.isTextarea) {
} else if (field.isTextarea) {
$input = $('<textarea>').attr({
name: key
}).appendTo($value);
@ -391,9 +414,11 @@
$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)
} else if (field.range) { //2 text fields on the same line (e.g. port range: startPort - endPort)
$input = $.merge(
// Range start
$('<input>').attr({
@ -427,27 +452,27 @@
$input.addClass("disallowSpecialCharacters");
}
if(field.validation != null)
if (field.validation != null)
$input.data('validation-rules', field.validation);
else
$input.data('validation-rules', {});
var fieldLabel = field.label;
var inputId = $input.attr('id') ? $input.attr('id') : fieldLabel.replace(/\./g,'_');
var inputId = $input.attr('id') ? $input.attr('id') : fieldLabel.replace(/\./g, '_');
$input.attr('id', inputId);
$name.find('label').attr('for', inputId);
if(field.isDisabled)
$input.attr("disabled","disabled");
if (field.isDisabled)
$input.attr("disabled", "disabled");
// Tooltip
if (field.docID) {
$input.toolTip({
docID: field.docID,
tooltip:'.tooltip-box',
mode:'focus',
tooltip: '.tooltip-box',
mode: 'focus',
attachTo: '.form-item'
});
}
@ -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();
},
@ -606,21 +629,23 @@
var $input = $formField.find('input, select');
var validationRules = $input.data('validation-rules');
if(validationRules == null || validationRules.required == null || validationRules.required == false) {
if (validationRules == null || validationRules.required == null || validationRules.required == false) {
$formField.find('.name').find('label').find('span.field-required').css('display', 'inline'); //show red asterisk
if(validationRules == null)
if (validationRules == null)
validationRules = {};
validationRules.required = true;
$input.data('validation-rules', validationRules);
$input.rules('add', { required: true });
$input.rules('add', {
required: true
});
}
},
remove: function($formField) {
var $input = $formField.find('input, select');
var validationRules = $input.data('validation-rules');
if(validationRules != null && validationRules.required != null && validationRules.required == true) {
if (validationRules != null && validationRules.required != null && validationRules.required == true) {
$formField.find('.name').find('label').find('span.field-required').hide(); //hide red asterisk
delete validationRules.required;
$input.data('validation-rules', validationRules);
@ -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

@ -33,7 +33,7 @@
data[this.name] = value;
} else if (dataItem && !$.isArray(dataItem)) {
data[this.name] = [dataItem, value];
} else if($.isArray(dataItem)){
} else if ($.isArray(dataItem)) {
dataItem.push(value);
}
});
@ -77,19 +77,16 @@
* Strip unwanted characters from user-based input
*/
cloudStack.sanitize = window._s = function(value) {
if(typeof(value) == "number") {
if (typeof(value) == "number") {
//alert("number does not need to be sanitized. Only string needs to be sanitized.");
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,25 +356,25 @@
});
$('#breadcrumbs li').live('click', cloudStack.ui.event.bind(
'cloudBrowser',
{
'cloudBrowser', {
'breadcrumb': function($target, $browser, data) {
if ($ ('#browser').hasClass('panel-highlight')) {
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(){
var $hiddenPanels = data.panel.siblings().filter(function() {
return $(this).index() > data.panel.index();
});
var $targetPanel = data.panel.filter(':first');
@ -402,9 +412,8 @@
}
));
$('#breadcrumbs li').live('mouseout',cloudStack.ui.event.bind(
'cloudBrowser',
{
$('#breadcrumbs li').live('mouseout', cloudStack.ui.event.bind(
'cloudBrowser', {
'breadcrumb': function($target, $browser, data) {
var $getHiddenPanels = $browser.find('.panel.mouseover-hidden');
var $visiblePanels = $getHiddenPanels.siblings();

View File

@ -28,7 +28,7 @@
var $newRow;
var jsonObj = $row.data('json-obj');
if($listView.length > 0 ) { //$listView.length is 0 after calling $(window).trigger('cloudStack.fullRefresh')
if ($listView.length > 0) { //$listView.length is 0 after calling $(window).trigger('cloudStack.fullRefresh')
$listView.listView('replaceItem', {
$row: $row,
data: $.extend(jsonObj, newData),
@ -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();
}
@ -211,7 +216,7 @@
if (isMultiple) {
$detailView.find('.refresh').click();
} else {
updateTabContent(args.data? args.data : args2.data);
updateTabContent(args.data ? args.data : args2.data);
}
}
}
@ -235,6 +240,7 @@
{},
// Error
function(args) {
$loading.remove();
}
@ -243,7 +249,7 @@
return true;
},
error: function(args) { //args here is parsed errortext from API response
if(args != null & args.length > 0) {
if (args != null & args.length > 0) {
cloudStack.dialog.notice({
message: args
});
@ -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({
@ -342,12 +348,12 @@
});
}
if($detailView.data("list-view-row") != null) {
if ($detailView.data("list-view-row") != null) {
var $row = $detailView.data('list-view-row');
var $tbody = $row.closest('tbody');
$row.remove();
if(!$tbody.find('tr').size()) {
if (!$tbody.find('tr').size()) {
$("<tr>").addClass('empty').append(
$("<td>").html(_l('label.no.data'))
).appendTo($tbody);
@ -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;
});
})
});
}
@ -895,7 +922,7 @@
$value.data('validation-rules', value.validation);
// Set up editable metadata
if(typeof(value.isEditable) == 'function')
if (typeof(value.isEditable) == 'function')
$value.data('detail-view-is-editable', value.isEditable(context));
else //typeof(value.isEditable) == 'boolean' or 'undefined'
$value.data('detail-view-is-editable', value.isEditable);
@ -911,7 +938,7 @@
return option.id == value.selected;
})[0];
if(matchedSelectValue != null) {
if (matchedSelectValue != null) {
$value.html(_s(matchedSelectValue.description));
$value.data('detail-view-selected-option', matchedSelectValue.id);
}
@ -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,
@ -1222,7 +1252,7 @@
}));
}
if(options.newData &&
if (options.newData &&
($detailView.data('view-args').section != null && context[$detailView.data('view-args').section] != null && context[$detailView.data('view-args').section].length > 0)) {
$.extend(
context[$detailView.data('view-args').section][0],
@ -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();
@ -469,7 +474,7 @@
var oldVal = $label.html();
if(val != null )
if (val != null)
$label.html(_s(val));
var data = {
@ -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;
};
@ -665,7 +672,7 @@
hiddenFields = preFilter();
$.each(fields, function(key) {
if($.inArray(key, hiddenFields) != -1)
if ($.inArray(key, hiddenFields) != -1)
return true;
var field = this;
var $th = $('<th>').addClass(key).appendTo($thead.find('tr'));
@ -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'))
@ -731,7 +736,7 @@
if (filters)
$.each(filters, function(key) {
if(this.preFilter != null && this.preFilter() == false) {
if (this.preFilter != null && this.preFilter() == false) {
return true; //skip to next item in each loop
}
var $option = $('<option>').attr({
@ -806,8 +811,7 @@
$('<input>').attr({
type: 'checkbox',
name: actionName,
checked: data && data._isSelected ?
'checked' : false
checked: data && data._isSelected ? 'checked' : false
})
)
.attr({
@ -935,12 +939,12 @@
}
var hiddenFields = [];
if(preFilter != null)
if (preFilter != null)
hiddenFields = preFilter();
// Add field data
$.each(fields, function(key) {
if($.inArray(key, hiddenFields) != -1)
if ($.inArray(key, hiddenFields) != -1)
return true;
var field = this;
var $td = $('<td>')
@ -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,9 +1329,11 @@
reorder: reorder,
detailView: options.detailView
});
$table.dataTable(null, { noSelect: uiCustom });
$table.dataTable(null, {
noSelect: uiCustom
});
if(args.data &&
if (args.data &&
args.data.length < pageSize &&
options.setEndTable) {
options.setEndTable();
@ -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,
@ -1649,7 +1649,7 @@
};
$listView.find('.search-bar input[type=text]').keyup(function(event) {
if(event.keyCode == 13) //13 is keycode of Enter key
if (event.keyCode == 13) //13 is keycode of Enter key
basicSearch();
return true;
});
@ -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,
@ -1762,15 +1760,14 @@
page = page + 1;
var filterBy = {
kind: $listView.find('select[id=filterBy]').length > 0? $listView.find('select[id=filterBy]').val(): 'all'
kind: $listView.find('select[id=filterBy]').length > 0 ? $listView.find('select[id=filterBy]').val() : 'all'
};
if($listView.data('advSearch') == null) {
if ($listView.data('advSearch') == null) {
filterBy.search = {
value: $listView.find('input[type=text]').length > 0? $listView.find('input[type=text]').val(): '',
value: $listView.find('input[type=text]').length > 0 ? $listView.find('input[type=text]').val() : '',
by: 'name'
};
}
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
@ -1998,7 +1997,7 @@
if (!options) options = {};
if (args == 'prependItem') {
return prependItem(this, options.data, options.actionFilter);
} else if (args =='replaceItem') {
} else if (args == 'replaceItem') {
replaceItem(options.$row, options.data, options.actionFilter, options.after);
} else if (args.sections) {
var targetSection;
@ -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();
},
@ -696,7 +708,7 @@
});
});
var itemState=multiRule._itemState ? item[multiRule._itemState] :item.state;
var itemState = multiRule._itemState ? item[multiRule._itemState] : item.state;
var $itemState = $('<span>').html(_s(itemState));
$tr.append($('<td>').addClass('state').appendTo($tr).append("Application State - ").append($itemState));
@ -708,7 +720,7 @@
if (itemActionID == 'add')
return true;
if(item._hideActions != null && $.inArray(itemActionID, item._hideActions) > -1)
if (item._hideActions != null && $.inArray(itemActionID, item._hideActions) > -1)
return true;
var $itemAction = $('<div>').addClass('action').addClass(itemActionID);
@ -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
});
}
}
}
@ -795,9 +811,9 @@
return $expandable.hide();
}
}
};
};
$.fn.multiEdit = function(args) {
$.fn.multiEdit = function(args) {
var dataProvider = args.dataProvider;
var multipleAdd = args.multipleAdd;
var tags = args.tags;
@ -893,7 +909,7 @@ $.fn.multiEdit = function(args) {
_medit.refreshItemWidths($multi);
},
error: function(args) { }
error: function(args) {}
}
});
} else if (field.edit && field.edit != 'ignore') {
@ -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,
@ -1157,12 +1171,14 @@ $.fn.multiEdit = function(args) {
});
};
if (args.hideForm && args.hideForm()){
if (args.hideForm && args.hideForm()) {
$multiForm.find('tbody').detach();
}
// 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

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

View File

@ -21,11 +21,13 @@
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;
}
if($form.find('div.field.key').find('label.error').css('display') == 'block' || $form.find('div.field.value').find('label.error').css('display') == 'block')
if ($form.find('div.field.key').find('label.error').css('display') == 'block' || $form.find('div.field.value').find('label.error').css('display') == 'block')
return false;
return true;
@ -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;
@ -131,7 +136,7 @@
}),
response: {
success: function(args) {
var notification = $.extend(true, {} , args.notification, {
var notification = $.extend(true, {}, args.notification, {
interval: 500,
_custom: args._custom
});
@ -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
});
}
}
});
@ -172,7 +181,7 @@
context: context,
response: {
success: function(args) {
var notification = $.extend(true, {} , args.notification, {
var notification = $.extend(true, {}, args.notification, {
interval: 500,
_custom: args._custom
});
@ -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

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

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

@ -32,14 +32,14 @@
'Error': 'off'
}
},
type:{
type: {
label: 'label.vmsnapshot.type'
},
current:{
current: {
label: 'label.vmsnapshot.current',
converter: cloudStack.converters.toBooleanText
},
parentName:{
parentName: {
label: 'label.vmsnapshot.parentname'
},
created: {
@ -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