Add project detail view

This commit is contained in:
bfederle 2012-02-06 12:32:39 -08:00
parent 98a528e12d
commit ce7656674c
1 changed files with 68 additions and 14 deletions

View File

@ -526,20 +526,20 @@
state: { label: 'Status', indicator: { 'Active': 'on', 'Destroyed': 'off', 'Disabled': 'off', 'Left Project': 'off' } }
},
dataProvider: function(args) {
var array1 = [];
if(args.filterBy != null) {
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
switch(args.filterBy.search.by) {
case "name":
if(args.filterBy.search.value.length > 0)
array1.push("&keyword=" + args.filterBy.search.value);
break;
}
}
}
var apiCmd = "listProjects&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + '&listAll=true';
dataProvider: function(args) {
var array1 = [];
if(args.filterBy != null) {
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
switch(args.filterBy.search.by) {
case "name":
if(args.filterBy.search.value.length > 0)
array1.push("&keyword=" + args.filterBy.search.value);
break;
}
}
}
var apiCmd = "listProjects&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + '&listAll=true';
$.ajax({
url: createURL(apiCmd, { ignoreProject: true }),
dataType: 'json',
@ -726,6 +726,60 @@
poll: pollAsyncJobResult
}
}
},
detailView: {
actions: {
edit: {
label: 'Edit',
action: function(args) {
$.ajax({
url: createURL('updateProject'),
data: $.extend(true, {}, args.context.projects[0], args.data),
success: function(json) {
args.response.success();
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
});
},
messages: {
notification: function(args) { return 'Edited project details'; }
}
}
},
tabs: {
details: {
title: 'Details',
fields: [
{
name: { label: 'Name' }
},
{
displaytext: { label: 'Display text', isEditable: true },
domain: { label: 'Domain' },
account: { label: 'Account'},
state: { label: 'State' }
}
],
dataProvider: function(args) {
var projectID = args.context.projects[0].id;
$.ajax({
url: createURL('listProjects'),
data: {
id: projectID
},
success: function(json) {
args.response.success({
data: json.listprojectsresponse.project[0]
});
}
});
}
}
}
}
}
},