feat: [v10] Deprecate In App Help (#6834)

* [feat] Removed help from global search

* [feat] redirected search in help to docs website

[] Url needs to be configurable from hooks

* [Feat] Removed search functions for help

* [fix] Help links not redirecting

* [feat] Modified "Help" menu on desk toolbar

* [feat] Removed docs search from desk toolbar

* Removed Search from toolbar.js

* Removed help from migrate

* Deprecated help from command utils

* Removed help setup from travis.yml

* [fix] Fixed formatting issues

* [fix] Deleted commented code from toolbar.js

* [fix] Minor link fix

* [fix] Removed accidentally added autodeploy
This commit is contained in:
Shivam Mishra 2019-01-28 12:20:24 +05:30 committed by Rushabh Mehta
parent 94d0489674
commit d3b4a165f2
8 changed files with 14 additions and 143 deletions

View file

@ -32,8 +32,6 @@ before_script:
- cd ~/frappe-bench
- bench use test_site
- bench reinstall --yes
- bench setup-help
- bench setup-global-help --mariadb_root_password travis
- bench scheduler disable
- sed -i 's/9000/9001/g' sites/common_site_config.json
- bench start &

View file

@ -1,2 +1,2 @@
### User Permissions
- User Permission is now a DocType, a new UX for the existing Role and User Permission managers to make it easy to enter permissions. For more details please check <a href="https://erpnext.org/docs/user/manual/en/setting-up/users-and-permissions/user-permissions">User Permissions</a>
- User Permission is now a DocType, a new UX for the existing Role and User Permission managers to make it easy to enter permissions. For more details please check <a href="https://erpnext.com/docs/user/manual/en/setting-up/users-and-permissions/user-permissions">User Permissions</a>

View file

@ -455,40 +455,16 @@ def get_version():
@click.command('setup-global-help')
@click.option('--mariadb_root_password')
def setup_global_help(mariadb_root_password=None):
'''setup help table in a separate database that will be
'''Deprecated: setup help table in a separate database that will be
shared by the whole bench and set `global_help_setup` as 1 in
common_site_config.json'''
from frappe.installer import update_site_config
frappe.local.flags = frappe._dict()
frappe.local.flags.in_setup_help = True
frappe.local.flags.in_install = True
frappe.local.lang = 'en'
frappe.local.conf = frappe.get_site_config(sites_path='.')
update_site_config('global_help_setup', 1,
site_config_path=os.path.join('.', 'common_site_config.json'))
if mariadb_root_password:
frappe.local.conf.root_password = mariadb_root_password
from frappe.utils.help import sync
sync()
print_in_an_help_deprecation()
@click.command('setup-help')
@pass_context
def setup_help(context):
'''Setup help table in the current site (called after migrate)'''
from frappe.utils.help import sync
for site in context.sites:
try:
frappe.init(site)
frappe.connect()
sync()
finally:
frappe.destroy()
'''Deprecated: Setup help table in the current site (called after migrate)'''
print_in_an_help_deprecation()
@click.command('rebuild-global-search')
@pass_context
@ -509,6 +485,10 @@ def rebuild_global_search(context):
frappe.destroy()
def print_in_an_help_deprecation():
print("In app help has been deprectated.\nYou can access the documentation on erpnext.com/docs or frappe.io/docs")
return
commands = [
build,
clear_cache,
@ -535,7 +515,5 @@ commands = [
watch,
_bulk_rename,
add_to_email_queue,
setup_global_help,
setup_help,
rebuild_global_search
]

View file

@ -14,7 +14,6 @@ from frappe.website import render, router
from frappe.desk.doctype.desktop_icon.desktop_icon import sync_desktop_icons
from frappe.core.doctype.language.language import sync_languages
from frappe.modules.utils import sync_customizations
import frappe.utils.help
def migrate(verbose=True, rebuild_website=False):
'''Migrate all apps to the latest version, will:
@ -47,10 +46,6 @@ def migrate(verbose=True, rebuild_website=False):
frappe.db.commit()
if not frappe.conf.get('global_help_setup'):
# sync help if not set as global
frappe.utils.help.sync()
clear_notifications()
frappe.publish_realtime("version-update")

View file

@ -53,16 +53,12 @@
style="padding: 50% 7px; font-size: 17px; background-color: #fafbfc; font-weight: 100;">?</span>
</a>
<ul class="dropdown-menu" role="menu">
<div class="input-group" style="border-bottom: 1px solid #d1d8dd;">
<!-- <div class="input-group" style="border-bottom: 1px solid #d1d8dd;">
<input id="input-help" type="text" placeholder="{{ __("What do you need help with?") }}" autofocus>
<span class="input-group-btn"><button class="btn btn-default">{{ __("Go") }}</button></span>
</div>
</div> -->
<li id="help-links"></li>
<li class="divider"></li>
<li>
<a data-link-type="documentation"
data-path="/documentation/index" target="_blank" rel="noopener noreferrer">{{ __("Documentation") }}</a>
</li>
<li class="divider documentation-links"></li>
<li><a href="#" onclick="return frappe.ui.toolbar.show_about();">
{%= __("About") %}</a></li>

View file

@ -122,7 +122,7 @@ frappe.search.SearchDialog = Class.extend({
});
// Help results
this.$modal_body.on('click', 'a[data-path]', frappe.help.show_results);
// this.$modal_body.on('click', 'a[data-path]', frappe.help.show_results);
this.bind_keyboard_events();
},
@ -362,35 +362,12 @@ frappe.search.SearchDialog = Class.extend({
frappe.search.utils.get_global_results(keywords, start, limit)
.then(function(global_results) {
results = results.concat(global_results);
return frappe.search.utils.get_help_results(keywords);
}).then(function(help_results) {
results = results.concat(help_results);
callback(results, keywords);
}, function (err) {
console.error(err);
});
}
},
help: {
input_placeholder: __("Search Help"),
empty_state_text: __("Search the docs"),
no_results_status: (keyword) => __("<p>No results found for '" + keyword +
"' in Help</p><p>Would you like to search <a class='switch-to-global-search text-muted' "+
"style='text-decoration: underline;'>globally</a>" +
" or the <a href='https://discuss.erpnext.com' class='forum-link text-muted' " +
"style='text-decoration: underline;'>forums</a> instead?</p>"),
get_results: function(keywords, callback) {
var results = [];
frappe.search.utils.get_help_results(keywords)
.then(function(help_results) {
results = results.concat(help_results);
callback(results, keywords);
}, function (err) {
console.error(err);
});
}
}
},
});

View file

@ -399,46 +399,6 @@ frappe.search.utils = {
});
},
get_help_results: function(keywords) {
function get_results_set(data) {
var result;
var set = {
title: "Help",
fetch_type: "Help",
results: []
}
data.forEach(function(d) {
// more properties
result = {
label: d[0],
value: d[0],
description: d[1],
data_path: d[2],
onclick: function() {
}
}
set.results.push(result);
});
return [set];
}
return new Promise(function(resolve, reject) {
frappe.call({
method: "frappe.utils.help.get_help",
args: {
text: keywords
},
callback: function(r) {
if(r.message) {
resolve(get_results_set(r.message));
} else {
resolve([]);
}
}
});
});
},
get_nav_results: function(keywords) {
function sort_uniques(array) {
var routes = [], out = [];

View file

@ -101,17 +101,11 @@ frappe.ui.toolbar.Toolbar = Class.extend({
$("#input-help").on("keydown", function (e) {
if(e.which == 13) {
var keywords = $(this).val();
show_help_results(keywords);
// show_help_results(keywords);
$(this).val("");
}
});
$("#input-help + span").on("click", function () {
var keywords = $("#input-help").val();
show_help_results(keywords);
$(this).val("");
});
$(document).on("page-change", function () {
var $help_links = $(".dropdown-help #help-links");
$help_links.html("");
@ -137,18 +131,10 @@ frappe.ui.toolbar.Toolbar = Class.extend({
for (var i = 0; i < links.length; i++) {
var link = links[i];
var url = link.url;
var app_name = url.split('//', 2)[1].split('/', 2)[1];
var data_path = url.slice(url.indexOf('/user'));
if(data_path.lastIndexOf('.')){
data_path = data_path.slice(0, data_path.lastIndexOf('.'));
}
data_path = data_path.replace('user', app_name);
$("<a>", {
href: link.url,
text: link.label,
target: "_blank",
"data-path": data_path
target: "_blank"
}).appendTo($help_links);
}
@ -160,11 +146,6 @@ frappe.ui.toolbar.Toolbar = Class.extend({
$(document).on("click", ".help-modal a", show_results);
var me = this;
function show_help_results(keywords) {
me.search.init_search(keywords, "help");
}
function show_results(e) {
//edit links
var href = e.target.href;
@ -175,20 +156,6 @@ frappe.ui.toolbar.Toolbar = Class.extend({
var path = $(e.target).attr("data-path");
if(path) {
e.preventDefault();
frappe.call({
method: "frappe.utils.help.get_help_content",
args: {
path: path
},
callback: function (r) {
if(r.message && r.message.title) {
$result_modal.find('.modal-title').html("<span>"
+ r.message.title + "</span>");
$result_modal.find('.modal-body').html(r.message.content);
$result_modal.modal('show');
}
}
});
}
}
},