component_parameter = {};
function component_listAll() {
$('#content').html('');
$('#result').html('');
$.ajax({
type : 'get',
dataType : 'json',
contentType : 'application/json; charset=utf-8',
url : '../jaxrs/component/list/all',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
if (json.type == 'success') {
if (json.data) {
var str = '
';
str += '| name | title | widgetName | widgetTitle | path | operate |
';
$.each(json.data, function(index, o) {
str += '';
str += '| ' + o.name + ' | ';
str += '' + o.title + ' | ';
str += '' + o.widgetName + ' | ';
str += '' + o.widgetTitle + ' | ';
str += '' + o.path + ' | ';
str += '';
str += 'edit ';
str += 'delete';
str += ' | ';
str += '
';
});
str += '
';
$('#content').html(str);
}
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function component_create(id) {
$('#content').html('');
$('#result').html('');
var str = '';
$('#content').html(str);
$('#post').click(function() {
component_post();
});
}
function component_post() {
$('#result').html('');
$.ajax({
type : 'post',
dataType : 'json',
url : '../jaxrs/component',
contentType : 'application/json; charset=utf-8',
data : JSON.stringify({
name : $('#name').val(),
title : $('#title').val(),
path : $('#path').val(),
iconPath : $('#iconPath').val(),
widgetName : $('#widgetName').val(),
widgetTitle : $('#widgetTitle').val(),
widgetIconPath : $('#widgetIconPath').val(),
widgetStart : $('#widgetStart').val(),
widgetVisible : $('#widgetVisible').val(),
visible : $('#visible').val(),
order : $('#order').val(),
allowList : splitValue($('#allowList').val()),
denyList : splitValue($('#denyList').val()),
controllerList : splitValue($('#controllerList').val())
}),
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function component_edit(id) {
$('#content').html('');
$('#result').html('');
var str = '';
$('#content').html(str);
$('#put').click(function() {
component_put(id);
});
$.ajax({
type : 'get',
dataType : 'json',
contentType : 'application/json; charset=utf-8',
url : '../jaxrs/component/' + id,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
if (json.type == 'success') {
if (json.data) {
$('#id').html(json.data.id);
$('#name').val(json.data.name);
$('#title').val(json.data.title);
$('#path').val(json.data.path);
$('#iconPath').val(json.data.iconPath);
$('#widgetName').val(json.data.widgetName);
$('#widgetTitle').val(json.data.widgetTitle);
$('#widgetIconPath').val(json.data.widgetIconPath);
$('#widgetStart').val(json.data.widgetStart + '');
$('#widgetVisible').val(json.data.widgetVisible + '');
$('#visible').val(json.data.visible + '');
$('#order').val(json.data.order);
$('#allowList').val(joinValue(json.data.allowList));
$('#denyList').val(joinValue(json.data.denyList));
$('#controllerList').val(joinValue(json.data.controllerList));
}
}
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function component_put(id) {
$('#result').html('');
$.ajax({
type : 'put',
dataType : 'json',
url : '../jaxrs/component/' + id,
contentType : 'application/json; charset=utf-8',
data : JSON.stringify({
name : $('#name').val(),
title : $('#title').val(),
path : $('#path').val(),
iconPath : $('#iconPath').val(),
widgetName : $('#widgetName').val(),
widgetTitle : $('#widgetTitle').val(),
widgetIconPath : $('#widgetIconPath').val(),
widgetStart : $('#widgetStart').val(),
widgetVisible : $('#widgetVisible').val(),
visible : $('#visible').val(),
order : $('#order').val(),
allowList : splitValue($('#allowList').val()),
denyList : splitValue($('#denyList').val()),
controllerList : splitValue($('#controllerList').val())
}),
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function component_delete(id) {
$('#result').html('');
$.ajax({
type : 'delete',
dataType : 'json',
url : '../jaxrs/component/' + id,
contentType : 'application/json; charset=utf-8',
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).always(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}