function server_list() { $('#content').html(''); $('#result').html(''); $.ajax({ type : 'get', dataType : 'json', contentType : 'application/json; charset=utf-8', url : '../jaxrs/server/list', xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(data) { if (data.type == 'success') { var str = ''; str += ''; if (data.data) { $.each(data.data, function(typeIndex, item) { str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; }); } str += '
hostportusernameoperate
' + item.host + '' + item.port + '' + item.username + ''; str += 'edit '; str += 'delete'; str += '
'; $('#content').html(str); $('#result').html(JSON.stringify(data.data, null, 4)); } else { failure(data); } }); } function server_edit(order) { $('#result').html(''); $('#content').html(''); var str = ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
put
host:
port:
username:
password:
containerType:
order:
'; $('#content').html(str); $.ajax({ type : 'get', dataType : 'json', contentType : 'application/json; charset=utf-8', url : '../jaxrs/server/order/' + order, xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(data) { if (data.type == 'success') { $('#host', '#content').val(data.data.host); $('#port', '#content').val(data.data.port); $('#username', '#content').val(data.data.username); $('#password', '#content').val(data.data.password); $('#containerType', '#content').val(data.data.containerType); $('#order', '#content').val(data.data.order); } else { failure(data); } $('#result').html(JSON.stringify(data.data, null, 4)); }); $('#put', '#content').click(function() { server_put(order); }); } function server_put(order) { $('#result').html(''); $.ajax({ type : 'put', dataType : 'json', url : '../jaxrs/server/order/' + order, contentType : 'application/json; charset=utf-8', data : JSON.stringify({ host : $('#host', '#content').val(), port : $('#port', '#content').val(), username : $('#username', '#content').val(), password : $('#password', '#content').val(), containerType : $('#containerType', '#content').val(), order : $('#order', '#content').val() }), xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(data) { if (data.type == 'success') { } else { failure(data); } $('#result').html(JSON.stringify(data.data, null, 4)); }); } function server_create_init() { $('#result').html(''); var str = ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
post
host:
port:
username:
password:
containerType:
'; $('#content').html(str); $('#post', '#content').click(function() { server_post(); }); } function server_post() { $.ajax({ type : 'post', dataType : 'json', url : '../jaxrs/server', contentType : 'application/json; charset=utf-8', data : JSON.stringify({ host : $('#host', '#content').val(), port : $('#port', '#content').val(), username : $('#username', '#content').val(), password : $('#password', '#content').val(), containerType : $('#containerType', '#content').val() }), xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(data) { if (data.type == 'success') { } else { failure(data); } $('#result').html(JSON.stringify(data.data, null, 4)); }); } function server_delete(order) { $.ajax({ type : 'delete', dataType : 'json', url : '../jaxrs/server/order/' + order, contentType : 'application/json; charset=utf-8', xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(data) { if (data.type == 'success') { } else { failure(data); } $('#result').html(JSON.stringify(data.data, null, 4)); }); }