applicationServers.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. applicationServers_parameter = {};
  2. function applicationServers_list() {
  3. $('#content').html('');
  4. $('#result').html('');
  5. $.ajax({
  6. type : 'get',
  7. dataType : 'json',
  8. contentType : 'application/json; charset=utf-8',
  9. url : '../jaxrs/applicationservers',
  10. xhrFields : {
  11. 'withCredentials' : true
  12. },
  13. crossDomain : true
  14. }).done(function(json) {
  15. $('#result').html(JSON.stringify(json, null, 4));
  16. if (json.type == 'success') {
  17. if (json.data) {
  18. var str = '<table border="1" width="100%">';
  19. str += '<tr><th>order</th><th>name</th><th>host</th><th>port</th><th>username</th><th>operate</th></tr>';
  20. $.each(json.data, function(index, o) {
  21. str += '<tr>';
  22. str += '<td>' + o.order + '</td>';
  23. str += '<td>' + o.name + '</td>';
  24. str += '<td>' + o.host + '</td>';
  25. str += '<td>' + o.port + '</td>';
  26. str += '<td>' + o.username + '</td>';
  27. str += '<td><a href="#" onclick="applicationServer_edit(\'' + o.name + '\')">edit</a>&nbsp;';
  28. str += '<a href="#" onclick="applicationServer_delete(\'' + o.name + '\')">delete</a>';
  29. str += '</td>';
  30. str += '</tr><tr>'
  31. str += '<td>' + o.status + '</td>';
  32. str += '<td colspan="5">';
  33. if (o.message) {
  34. str += o.message;
  35. } else {
  36. str += '&nbsp';
  37. }
  38. str += '</td>';
  39. str += '</tr><tr>'
  40. str += '<td>planList</td>';
  41. str += '<td colspan="4"><table border="0"><tr><th>name</th><th>weight</th></tr>';
  42. if (o.planList) {
  43. $.each(o.planList, function(idx, p) {
  44. str += '<tr><td>' + p.name + '</td><td>' + p.weight + '</td></tr>';
  45. })
  46. }
  47. str += '</table></td>';
  48. str += '<td>';
  49. str += '<a href="#" onclick="applicationServer_deploy(\'' + o.name + '\', false)">deploy</a>&nbsp;';
  50. str += '<a href="#" onclick="applicationServer_deploy(\'' + o.name + '\', true)">redeploy</a>';
  51. str += '</td>';
  52. str += '</tr>';
  53. });
  54. str += '</table>';
  55. $('#content').html(str);
  56. }
  57. } else {
  58. failure(json);
  59. }
  60. });
  61. }