You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

66 lines
1.9 KiB

  1. wn.pages['update-manager'].onload = function(wrapper) {
  2. wn.ui.make_app_page({
  3. parent: wrapper,
  4. title: 'Update This Application',
  5. single_column: true
  6. });
  7. wrapper.update_this_app = new wn.UpdateThisApp(wrapper);
  8. };
  9. wn.UpdateThisApp = Class.extend({
  10. init: function(wrapper) {
  11. this.wrapper = wrapper;
  12. this.body = $(this.wrapper).find(".layout-main");
  13. this.wrapper.appframe.add_home_breadcrumb();
  14. this.wrapper.appframe.add_module_icon("Setup");
  15. this.wrapper.appframe.add_breadcrumb("icon-magnet");
  16. this.make();
  17. },
  18. make: function() {
  19. var me = this;
  20. if(wn.boot && wn.boot.expires_on) {
  21. wn.utils.set_intro(this.wrapper, $("<div></div>").appendTo(this.body),
  22. wn._('This feature is only applicable to self hosted instances'));
  23. } else {
  24. this.wrapper.appframe.add_button(wn._("Get Latest Updates"),
  25. function() { me.update_this_app(this); }, "icon-rss");
  26. this.wrapper.update_output = $('<pre class="update-output"></pre>')
  27. .appendTo(this.body);
  28. this.wrapper.update_output.toggle(false);
  29. this.wrapper.progress_bar = $('<div class="app-update-progress-bar well"></div>')
  30. .appendTo(this.body);
  31. this.wrapper.progress_bar.text(wn._('Click on "Get Latest Updates"'));
  32. }
  33. },
  34. update_this_app: function(btn) {
  35. var me = this;
  36. me.wrapper.update_output.toggle(false);
  37. me.wrapper.progress_bar.empty().toggle(true);
  38. this.wrapper.progress_bar.html('<div class="progress progress-striped active"> \
  39. <div class="bar" style="width: 100%;"></div> \
  40. </div> \
  41. <div>' + wn._("Update is in progress. This may take some time.") + '</div>');
  42. wn.call({
  43. module: "core",
  44. page: "update_manager",
  45. method: "update_this_app",
  46. callback: function(r) {
  47. me.wrapper.update_output.toggle(true);
  48. me.wrapper.progress_bar.empty().toggle(false);
  49. me.wrapper.update_output.text(r.message);
  50. },
  51. btn: btn,
  52. });
  53. },
  54. });