Pārlūkot izejas kodu

Merge branch 'hotfix'

version-14
Nabin Hait pirms 8 gadiem
vecāks
revīzija
a86c543d73
7 mainītis faili ar 59 papildinājumiem un 34 dzēšanām
  1. +1
    -1
      frappe/__init__.py
  2. +1
    -1
      frappe/boot.py
  3. +39
    -20
      frappe/build.js
  4. +1
    -1
      frappe/public/js/frappe/socketio_client.js
  5. +7
    -5
      frappe/public/js/frappe/upload.js
  6. +1
    -1
      frappe/public/js/frappe/views/reports/query_report.js
  7. +9
    -5
      frappe/utils/global_search.py

+ 1
- 1
frappe/__init__.py Parādīt failu

@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template

__version__ = '8.0.58'
__version__ = '8.0.59'
__title__ = "Frappe Framework"

local = Local()


+ 1
- 1
frappe/boot.py Parādīt failu

@@ -83,7 +83,7 @@ def get_letter_heads():
def load_conf_settings(bootinfo):
from frappe import conf
bootinfo.max_file_size = conf.get('max_file_size') or 10485760
for key in ('developer_mode', 'socketio_port'):
for key in ('developer_mode', 'socketio_port', 'file_watcher_port'):
if key in conf: bootinfo[key] = conf.get(key)

def load_desktop_icons(bootinfo):


+ 39
- 20
frappe/build.js Parādīt failu

@@ -3,23 +3,22 @@ const fs = require('fs');
const babel = require('babel-core');
const less = require('less');
const chokidar = require('chokidar');
const path_join = path.resolve;

// for file watcher
const app = require('express')();
const http = require('http').Server(app);
const io = require('socket.io')(http);
const file_watcher_port = 6787;

const p = path.resolve;

// basic setup
const sites_path = p(__dirname, '..', '..', '..', 'sites');
const apps_path = p(__dirname, '..', '..', '..', 'apps'); // the apps folder
const apps_contents = fs.readFileSync(p(sites_path, 'apps.txt'), 'utf8');
const sites_path = path_join(__dirname, '..', '..', '..', 'sites');
const apps_path = path_join(__dirname, '..', '..', '..', 'apps'); // the apps folder
const apps_contents = fs.readFileSync(path_join(sites_path, 'apps.txt'), 'utf8');
const apps = apps_contents.split('\n');
const app_paths = apps.map(app => p(apps_path, app, app)) // base_path of each app
const assets_path = p(sites_path, 'assets');
const app_paths = apps.map(app => path_join(apps_path, app, app)) // base_path of each app
const assets_path = path_join(sites_path, 'assets');
const build_map = make_build_map();
const file_watcher_port = get_conf().file_watcher_port;

// command line args
const action = process.argv[2] || '--build';
@@ -107,7 +106,7 @@ function pack(output_path, inputs, minify) {
output_txt = output_txt.replace(/['"]use strict['"];/, '');
}

const target = p(assets_path, output_path);
const target = path_join(assets_path, output_path);

try {
fs.writeFileSync(target, output_txt);
@@ -151,7 +150,7 @@ function minify_js(content, path) {
function make_build_map() {
const build_map = {};
for (const app_path of app_paths) {
const build_json_path = p(app_path, 'public', 'build.json');
const build_json_path = path_join(app_path, 'public', 'build.json');
if (!fs.existsSync(build_json_path)) continue;

let build_json = fs.readFileSync(build_json_path);
@@ -167,7 +166,7 @@ function make_build_map() {

const new_sources = [];
for (const source of sources) {
const s = p(app_path, source);
const s = path_join(app_path, source);
new_sources.push(s);
}

@@ -186,8 +185,8 @@ function compile_less() {
return new Promise(function (resolve) {
const promises = [];
for (const app_path of app_paths) {
const public_path = p(app_path, 'public');
const less_path = p(public_path, 'less');
const public_path = path_join(app_path, 'public');
const less_path = path_join(public_path, 'less');
if (!fs.existsSync(less_path)) continue;

const files = fs.readdirSync(less_path);
@@ -205,7 +204,7 @@ function compile_less() {
}

function compile_less_file(file, less_path, public_path) {
const file_content = fs.readFileSync(p(less_path, file), 'utf8');
const file_content = fs.readFileSync(path_join(less_path, file), 'utf8');
const output_file = file.split('.')[0] + '.css';
console.log('compiling', file);

@@ -214,7 +213,7 @@ function compile_less_file(file, less_path, public_path) {
filename: file,
sourceMap: false
}).then(output => {
const out_css = p(public_path, 'css', output_file);
const out_css = path_join(public_path, 'css', output_file);
fs.writeFileSync(out_css, output.css);
return out_css;
}).catch(e => {
@@ -224,7 +223,7 @@ function compile_less_file(file, less_path, public_path) {
}

function watch_less(ondirty) {
const less_paths = app_paths.map(path => p(path, 'public', 'less'));
const less_paths = app_paths.map(path => path_join(path, 'public', 'less'));

const to_watch = [];
for (const less_path of less_paths) {
@@ -235,7 +234,7 @@ function watch_less(ondirty) {
console.log(filename, 'dirty');
var last_index = filename.lastIndexOf('/');
const less_path = filename.slice(0, last_index);
const public_path = p(less_path, '..');
const public_path = path_join(less_path, '..');
filename = filename.split('/').pop();

compile_less_file(filename, less_path, public_path)
@@ -254,7 +253,7 @@ function watch_less(ondirty) {
}

function watch_js(ondirty) {
const js_paths = app_paths.map(path => p(path, 'public', 'js'));
const js_paths = app_paths.map(path => path_join(path, 'public', 'js'));

const to_watch = [];
for (const js_path of js_paths) {
@@ -265,7 +264,7 @@ function watch_js(ondirty) {
console.log(filename, 'dirty');
var last_index = filename.lastIndexOf('/');
const js_path = filename.slice(0, last_index);
const public_path = p(js_path, '..');
const public_path = path_join(js_path, '..');

// build the target js file for which this js/html file is input
for (const target in build_map) {
@@ -300,4 +299,24 @@ function get_file_size(filepath) {
// convert it to humanly readable format.
const i = Math.floor(Math.log(size) / Math.log(1024));
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'KB', 'MB', 'GB', 'TB'][i];
}
}

function get_conf() {
// defaults
var conf = {
file_watcher_port: 6787
};

var read_config = function(path) {
if (!fs.existsSync(path)) return;
var bench_config = JSON.parse(fs.readFileSync(path));
for (var key in bench_config) {
if (bench_config[key]) {
conf[key] = bench_config[key];
}
}
}

read_config(path_join(sites_path, 'common_site_config.json'));
return conf;
}

+ 1
- 1
frappe/public/js/frappe/socketio_client.js Parādīt failu

@@ -200,7 +200,7 @@ frappe.socket = {
return;
}

var port = '6787';
var port = frappe.boot.file_watcher_port || 6787;
var parts = host.split(":");
// remove the port number from string if exists
if (parts.length > 2) {


+ 7
- 5
frappe/public/js/frappe/upload.js Parādīt failu

@@ -194,15 +194,17 @@ frappe.upload = {
$(document).on('upload_complete', on_upload);

function upload_next() {
i += 1;
var file = files[i];
args.is_private = file.is_private;
if(files) {
i += 1;
var file = files[i];
args.is_private = file.is_private;
frappe.show_progress(__('Uploading'), i+1, files.length);
}
frappe.upload.upload_file(file, args, opts);
frappe.show_progress(__('Uploading'), i+1, files.length);
}

function on_upload(e, attachment) {
if (i === files.length - 1) {
if (!files || i === files.length - 1) {
$(document).off('upload_complete', on_upload);
frappe.hide_progress();
return;


+ 1
- 1
frappe/public/js/frappe/views/reports/query_report.js Parādīt failu

@@ -821,7 +821,7 @@ frappe.views.QueryReport = Class.extend({
options:"Excel\nCSV", default:"Excel", reqd: 1},
function(data) {
var view_data = frappe.slickgrid_tools.get_view_data(me.columns, me.dataView);
var result = view_data.map(row => [row.splice(1)]);
var result = view_data.map(row => row.splice(1));

// rows filtered by inline_filter of slickgrid
var visible_idx = view_data.map(row => row[0]).filter(sr_no => sr_no !== 'Sr No');


+ 9
- 5
frappe/utils/global_search.py Parādīt failu

@@ -104,11 +104,15 @@ def rebuild_for_doctype(doctype):
# if doctype published in website, push title, route etc.
published = 0
title, route = "", ""
if hasattr(get_controller(doctype), "is_website_published") and meta.allow_guest_to_view:
d = frappe.get_doc(doctype, doc.name)
published = 1 if d.is_website_published() else 0
title = d.get_title()
route = d.get("route")
try:
if hasattr(get_controller(doctype), "is_website_published") and meta.allow_guest_to_view:
d = frappe.get_doc(doctype, doc.name)
published = 1 if d.is_website_published() else 0
title = d.get_title()
route = d.get("route")
except ImportError:
# some doctypes has been deleted via future patch, hence controller does not exists
pass

all_contents.append({
"doctype": frappe.db.escape(doctype),


Notiek ielāde…
Atcelt
Saglabāt