Bläddra i källkod

[setup] [feature] Update Manager for self hosted applications based on wnframework

version-14
Anand Doshi 12 år sedan
förälder
incheckning
3aaea724b2
6 ändrade filer med 113 tillägg och 5 borttagningar
  1. +0
    -0
      core/page/update_this_app/__init__.py
  2. +51
    -0
      core/page/update_this_app/update_this_app.js
  3. +17
    -0
      core/page/update_this_app/update_this_app.py
  4. +36
    -0
      core/page/update_this_app/update_this_app.txt
  5. +8
    -4
      public/js/wn/ui/appframe.js
  6. +1
    -1
      webnotes/__init__.py

+ 0
- 0
core/page/update_this_app/__init__.py Visa fil


+ 51
- 0
core/page/update_this_app/update_this_app.js Visa fil

@@ -0,0 +1,51 @@
wn.pages['update-this-app'].onload = function(wrapper) {
wn.ui.make_app_page({
parent: wrapper,
title: 'Update This Application',
single_column: true
});
wrapper.update_this_app = new wn.UpdateThisApp(wrapper);
};

wn.UpdateThisApp = Class.extend({
init: function(wrapper) {
this.wrapper = wrapper;
this.body = $(this.wrapper).find(".layout-main");
this.wrapper.appframe.add_home_breadcrumb();
this.wrapper.appframe.add_module_breadcrumb("Setup");
this.wrapper.appframe.add_breadcrumb("icon-magnet");
this.make();
},
make: function() {
var me = this;
if(wn.boot && wn.boot.expires_on) {
wn.utils.set_intro(this.wrapper, $("<div></div>").appendTo(this.body),
wn._('This feature is only applicable to self hosted instances'));
} else {
this.wrapper.appframe.add_button("Get Latest Updates",
function() { me.update_this_app(this); }, "icon-rss");

this.wrapper.update_output = $('<pre class="well update-output"></pre>')
.appendTo(this.body.append("<div></div>"));
this.wrapper.update_output.text("Click - Get Latest Updates");
}
},
update_this_app: function(btn) {
var me = this;
wn.call({
module: "core",
page: "update_this_app",
method: "update_this_app",
callback: function(r) {
me.wrapper.update_output.text(r.message);
},
btn: btn,
});
},
});

+ 17
- 0
core/page/update_this_app/update_this_app.py Visa fil

@@ -0,0 +1,17 @@
# For license information, please see license.txt

from __future__ import unicode_literals
import webnotes
from webnotes import _

@webnotes.whitelist(allow_roles=["System Manager", "Administrator"])
def update_this_app():
import conf
if hasattr(conf, "expires_on"):
return _("This feature is only applicable to self hosted instances")
from webnotes.utils import execute_in_shell, cstr, get_base_path
err, out = execute_in_shell("cd %s && exec ssh-agent lib/wnf.py --update origin master" % \
(get_base_path(),))

return "\n".join(filter(None, [cstr(err), cstr(out)]))

+ 36
- 0
core/page/update_this_app/update_this_app.txt Visa fil

@@ -0,0 +1,36 @@
[
{
"creation": "2013-04-01 11:07:42",
"docstatus": 0,
"modified": "2013-04-01 11:07:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Page",
"module": "Core",
"name": "__common__",
"page_name": "update-this-app",
"standard": "Yes",
"title": "Update This Application"
},
{
"doctype": "Page Role",
"name": "__common__",
"parent": "update-this-app",
"parentfield": "roles",
"parenttype": "Page"
},
{
"doctype": "Page",
"name": "update-this-app"
},
{
"doctype": "Page Role",
"role": "System Manager"
},
{
"doctype": "Page Role",
"role": "Administrator"
}
]

+ 8
- 4
public/js/wn/ui/appframe.js Visa fil

@@ -83,28 +83,32 @@ wn.ui.AppFrame = Class.extend({
new_doc(doctype);
}
}
}]
}];
if(!locals.DocType[doctype].issingle) {
views.push({
icon: "icon-list",
route: "List/" + doctype,
type: "list"
});
};
}
if(locals.DocType[doctype].__calendar_js) {
views.push({
icon: "icon-calendar",
route: "Calendar/" + doctype,
type: "calendar"
})
});
}
if(wn.model.can_get_report(doctype)) {
views.push({
icon: "icon-table",
route: "Report2/" + doctype,
type: "report"
})
});
}
this.set_views(views, active_view);
},


+ 1
- 1
webnotes/__init__.py Visa fil

@@ -182,7 +182,7 @@ def get_db_password(db_name):

whitelisted = []
guest_methods = []
def whitelist(allow_guest=False, allow_roles=[]):
def whitelist(allow_guest=False, allow_roles=None):
"""
decorator for whitelisting a function


Laddar…
Avbryt
Spara