added @read_only to a few calls and converted a few read only calls to GET (#6299)

This commit is contained in:
Himanshu Mishra 2018-10-30 11:13:25 +05:30 committed by Rushabh Mehta
parent a8342b1c8a
commit e53c72a627
5 changed files with 23 additions and 18 deletions

View file

@ -10,6 +10,7 @@ from six import string_types
import json
@frappe.whitelist()
@frappe.read_only()
def get_notifications():
if frappe.flags.in_install:
return
@ -233,6 +234,7 @@ def get_filters_for(doctype):
return config.get('for_doctype').get(doctype, {})
@frappe.whitelist()
@frappe.read_only()
def get_open_count(doctype, name, items=[]):
'''Get open count for given transactions and filters

View file

@ -111,6 +111,7 @@ def save_report():
return d.name
@frappe.whitelist()
@frappe.read_only()
def export_query():
"""export from report builder"""
form_params = get_form_params()
@ -241,6 +242,7 @@ def get_sidebar_stats(stats, doctype, filters=[]):
return {"defined_cat":cat_tags, "stats":get_stats(stats, doctype, filters)}
@frappe.whitelist()
@frappe.read_only()
def get_stats(stats, doctype, filters=[]):
"""get tag info"""
import json

View file

@ -252,6 +252,7 @@ frappe.Application = Class.extend({
var me = this;
if(frappe.session_alive && frappe.boot && frappe.boot.home_page !== 'setup-wizard') {
return frappe.call({
type: 'GET',
method: "frappe.desk.notifications.get_notifications",
callback: function(r) {
if(r.message) {

View file

@ -257,6 +257,7 @@ frappe.views.ListSidebar = class ListSidebar {
var me = this;
frappe.call({
method: 'frappe.desk.reportview.get_sidebar_stats',
type: 'GET',
args: {
stats: me.stats,
doctype: me.doctype,

View file

@ -48,7 +48,7 @@ frappe.ui.toolbar.Toolbar = Class.extend({
});
//focus search-modal on show in mobile view
$('#search-modal').on('shown.bs.modal', function () {
$('#search-modal').on('shown.bs.modal', function() {
var search_modal = $(this);
setTimeout(function() {
search_modal.find('#modal-search').focus();
@ -56,9 +56,9 @@ frappe.ui.toolbar.Toolbar = Class.extend({
});
},
setup_sidebar: function () {
setup_sidebar: function() {
var header = $('header');
header.find(".toggle-sidebar").on("click", function () {
header.find(".toggle-sidebar").on("click", function() {
var layout_side_section = $('.layout-side-section');
var overlay_sidebar = layout_side_section.find('.overlay-sidebar');
@ -92,7 +92,7 @@ frappe.ui.toolbar.Toolbar = Class.extend({
});
},
setup_help: function () {
setup_help: function() {
frappe.provide('frappe.help');
frappe.help.show_results = show_results;
@ -100,15 +100,15 @@ frappe.ui.toolbar.Toolbar = Class.extend({
frappe.provide('frappe.searchdialog');
frappe.searchdialog.search = this.search;
$(".dropdown-help .dropdown-toggle").on("click", function () {
$(".dropdown-help .dropdown-toggle").on("click", function() {
$(".dropdown-help input").focus();
});
$(".dropdown-help .dropdown-menu").on("click", "input, button", function (e) {
$(".dropdown-help .dropdown-menu").on("click", "input, button", function(e) {
e.stopPropagation();
});
$("#input-help").on("keydown", function (e) {
$("#input-help").on("keydown", function(e) {
if(e.which == 13) {
var keywords = $(this).val();
show_help_results(keywords);
@ -116,13 +116,13 @@ frappe.ui.toolbar.Toolbar = Class.extend({
}
});
$("#input-help + span").on("click", function () {
$("#input-help + span").on("click", function() {
var keywords = $("#input-help").val();
show_help_results(keywords);
$(this).val("");
});
$(document).on("page-change", function () {
$(document).on("page-change", function() {
var $help_links = $(".dropdown-help #help-links");
$help_links.html("");
@ -139,8 +139,7 @@ frappe.ui.toolbar.Toolbar = Class.extend({
if(links.length === 0) {
$help_links.next().hide();
}
else {
} else {
$help_links.next().show();
}
@ -189,7 +188,7 @@ frappe.ui.toolbar.Toolbar = Class.extend({
args: {
path: path
},
callback: function (r) {
callback: function(r) {
if(r.message && r.message.title) {
$result_modal.find('.modal-title').html("<span>"
+ r.message.title + "</span>");
@ -206,6 +205,7 @@ frappe.ui.toolbar.Toolbar = Class.extend({
var me = this;
frappe.call({
method: "frappe.desk.user_progress.get_user_progress_slides",
type: 'GET',
callback: function(r) {
if(r.message) {
let slides = r.message;
@ -273,22 +273,21 @@ frappe.ui.toolbar.clear_cache = function() {
location.reload(true);
}
}
})
});
return false;
}
};
frappe.ui.toolbar.download_backup = function() {
frappe.msgprint(__("Your download is being built, this may take a few moments..."));
$c('frappe.utils.backups.get_backup',{},function(r,rt) {});
return false;
}
};
frappe.ui.toolbar.show_about = function() {
try {
frappe.ui.misc.about();
}
catch(e) {
} catch(e) {
console.log(e);
}
return false;
}
};