Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(explore_page): Explore 2.0 #6821

Merged
merged 29 commits into from Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c01ace6
feat(explore_page): Modules and Module Detail views
pratu16x7 Jan 24, 2019
466764e
fix(style): modules page
pratu16x7 Jan 27, 2019
8fd13bc
feat(desk): Load desk as a module list
pratu16x7 Jan 27, 2019
d315c8d
fix(desktop): recategorize modules
pratu16x7 Jan 28, 2019
59ea5c7
feat(desk): Make desk early on in pageview, use Container
pratu16x7 Jan 28, 2019
aeebf1e
feat(desk): Make all desk modules links, make Detail view dumb
pratu16x7 Jan 28, 2019
2c55c65
feat(desk): Responsive 3-2-1 col, skeleton divs
pratu16x7 Jan 29, 2019
20ae040
fix(modules): fix modules detail page title
pratu16x7 Jan 29, 2019
77b9fb4
refactor(desk): delete desk and modules pages
pratu16x7 Jan 29, 2019
2f334ba
remove(add_to_desktop): remove from all views
pratu16x7 Jan 29, 2019
e93cea1
refactor(desktop_icons): Remove references and repurpose bootinfo
pratu16x7 Jan 29, 2019
14bdf84
fix(formatting): Spaces to Tabs
pratu16x7 Jan 29, 2019
9680573
refactor(dependencies): bundle Vue by default
pratu16x7 Jan 29, 2019
de3ce70
fix(domains): Active domains
pratu16x7 Jan 29, 2019
9f2d7a2
fix(Vue): route from node_modules
pratu16x7 Jan 29, 2019
34fd318
refactor(desk_icon): remove patches and references to desk icons
pratu16x7 Jan 30, 2019
c19893e
feat(module_links): add dummy indicators
pratu16x7 Jan 30, 2019
466de4f
refactor(allowed_modules): use the new modules API
pratu16x7 Jan 30, 2019
67c32d2
feat(module_links): onboarding cues for starting doctypes
pratu16x7 Jan 30, 2019
8f62c85
fix(module_links): element heirarchy for popover
pratu16x7 Jan 30, 2019
5a5cf53
feat(module_link): ModuleLinkItem with a popover for disabled cue
pratu16x7 Jan 31, 2019
0ee2700
feat(module_links): indicators reflect status
pratu16x7 Jan 31, 2019
df96ce4
feat(module_links): doctypes as dependencies
pratu16x7 Feb 6, 2019
09dd85d
feat(modules): popover timeout, rearrange modules links
pratu16x7 Feb 7, 2019
b5a9105
feat(module_links): add condition for modules, show label in title
pratu16x7 Feb 7, 2019
83c0e31
feat(module_links): show onboard untouches points
pratu16x7 Feb 7, 2019
c8bc68e
fix(code_style): minor
pratu16x7 Feb 7, 2019
a6499c4
fix(test): remove test for explore page
pratu16x7 Feb 7, 2019
043e290
fix(domains): remove desktop icons from domainification
pratu16x7 Feb 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -120,6 +120,7 @@
"md5": true,
"$": true,
"jQuery": true,
"Vue": true,
"moment": true,
"hljs": true,
"Awesomplete": true,
Expand Down
7 changes: 0 additions & 7 deletions cypress/integration/awesome_bar.js
Expand Up @@ -8,13 +8,6 @@ context('Awesome Bar', () => {
cy.get('.navbar-home').click();
});

it('navigates to modules', () => {
cy.get('#navbar-search')
.type('modules{downarrow}{enter}', { delay: 100 });

cy.location('hash').should('eq', '#modules');
});

it('navigates to doctype list', () => {
cy.get('#navbar-search')
.type('todo{downarrow}{enter}', { delay: 100 });
Expand Down
4 changes: 2 additions & 2 deletions frappe/boot.py
Expand Up @@ -96,8 +96,8 @@ def load_conf_settings(bootinfo):
if key in conf: bootinfo[key] = conf.get(key)

def load_desktop_icons(bootinfo):
from frappe.desk.doctype.desktop_icon.desktop_icon import get_desktop_icons
bootinfo.desktop_icons = get_desktop_icons()
from frappe.config import get_modules_from_all_apps_for_user
bootinfo.allowed_modules = get_modules_from_all_apps_for_user()

def get_allowed_pages():
return get_user_pages_or_reports('Page')
Expand Down
85 changes: 85 additions & 0 deletions frappe/config/__init__.py
@@ -0,0 +1,85 @@
from __future__ import unicode_literals
from frappe import _
import frappe
from frappe.desk.moduleview import get_data
from six import iteritems

def get_modules_from_all_apps_for_user(user=None):
if not user:
user = frappe.session.user

all_modules = get_modules_from_all_apps()
user_blocked_modules = frappe.get_doc('User', user).get_blocked_modules()

allowed_modules_list = [m for m in all_modules if m.get("module_name") not in user_blocked_modules]

return allowed_modules_list

def get_modules_from_all_apps():
modules_list = []
for app in frappe.get_installed_apps():
modules_list += get_modules_from_app(app)
return modules_list

def get_modules_from_app(app):
try:
modules = frappe.get_attr(app + '.config.desktop.get_data')() or {}
except ImportError:
return []

# Only newly formatted modules that have a category to be shown on desk
modules = [m for m in modules if m.get("category")]

active_domains = frappe.get_active_domains()

if isinstance(modules, dict):
active_modules_list = []
for m, module in iteritems(modules):
module['module_name'] = m
active_modules_list.append(module)
else:
active_modules_list = []
for m in modules:
to_add = True
module_name = m.get("module_name")

# Check Domain
if is_domain(m):
if module_name not in active_domains:
to_add = False

if "condition" in m and not m["condition"]:
to_add = False

if to_add:
onboard_present = is_onboard_present(m) if show_onboard(m) else False
m["onboard_present"] = onboard_present
active_modules_list.append(m)

return active_modules_list

def show_onboard(module):
return module.get("type") == "module" and module.get("category") in ["Modules", "Domains"]

def is_onboard_present(module):
print(module["module_name"])
exists_cache = {}
def exists(name, link_type):
exists = exists_cache.get(name)
if not exists:
if link_type == "doctype" and not frappe.db.get_value('DocType', name, 'issingle'):
exists = frappe.db.count(name)
else:
exists = True
exists_cache[name] = exists
return exists

sections = get_data(module["module_name"], False)
for section in sections:
for item in section["items"]:
if exists(item.get("name"), item.get("type")):
return True
return False

def is_domain(module):
return module.get("category") == "Domains"
24 changes: 14 additions & 10 deletions frappe/config/desk.py
Expand Up @@ -12,18 +12,26 @@ def get_data():
"name": "ToDo",
"label": _("To Do"),
"description": _("Documents assigned to you and by you."),
},
{
"type": "doctype",
"name": "File",
"label": _("Files"),
"onboard": 1,
},
{
"type": "doctype",
"name": "Event",
"label": _("Calendar"),
"link": "List/Event/Calendar",
"description": _("Event and other calendars."),
"onboard": 1,
},
{
"type": "doctype",
"name": "Note",
"description": _("Private and public Notes."),
"onboard": 1,
},
{
"type": "doctype",
"name": "File",
"label": _("Files"),
},
{
"type": "page",
Expand All @@ -32,11 +40,6 @@ def get_data():
"description": _("Chat messages and other notifications."),
"data_doctype": "Communication"
},
{
"type": "doctype",
"name": "Note",
"description": _("Private and public Notes."),
},
{
"type": "page",
"label": _("Activity"),
Expand All @@ -52,6 +55,7 @@ def get_data():
"type": "doctype",
"name": "Newsletter",
"description": _("Newsletters to contacts, leads."),
"onboard": 1,
},
{
"type": "doctype",
Expand Down
92 changes: 44 additions & 48 deletions frappe/config/desktop.py
@@ -1,91 +1,87 @@
from __future__ import unicode_literals
import frappe
from frappe import _

def get_data():
return [
# Administration
{
"module_name": "Desk",
"category": "Administration",
"label": _("Tools"),
"color": "#FFF5A7",
"reverse": 1,
"icon": "octicon octicon-calendar",
"type": "module"
},
{
"module_name": "File Manager",
"color": "#AA784D",
"doctype": "File",
"icon": "octicon octicon-file-directory",
"label": _("File Manager"),
"link": "List/File",
"type": "list",
"hidden": 1
"type": "module",
"description": "Todos, Notes and other basic tools to help you track your work."
},
{
"module_name": "Website",
"color": "#16a085",
"icon": "octicon octicon-globe",
"module_name": "Settings",
"category": "Administration",
"label": _("Settings"),
"color": "#bdc3c7",
"reverse": 1,
"icon": "octicon octicon-settings",
"type": "module",
"hidden": 1
"hidden": 1,
"description": "Configure your ERPNext account."
},
{
"module_name": "Integrations",
"category": "Administration",
"label": _("Integrations"),
"color": "#16a085",
"icon": "octicon octicon-globe",
"type": "module",
"hidden": 1
},
{
"module_name": "Setup",
"color": "#bdc3c7",
"reverse": 1,
"icon": "octicon octicon-settings",
"type": "module",
"hidden": 1
"hidden": 1,
"description": "DropBox, Woocomerce, AWS, Shopify and GoCardless."
},
{
"module_name": 'Email Inbox',
"type": 'list',
"label": 'Email Inbox',
"_label": _('Email Inbox'),
"_id": 'Email Inbox',
"_doctype": 'Communication',
"icon": 'fa fa-envelope-o',
"color": '#589494',
"link": 'List/Communication/Inbox'
"module_name": 'Contacts',
"category": "Administration",
"label": _("Contacts"),
"type": 'module',
"icon": "octicon octicon-book",
"color": '#ffaedb',
"hidden": 1,
"description": "People Contacts and Address Book."
},
{
"module_name": "Core",
"label": "Developer",
"category": "Administration",
"_label": _("Developer"),
"label": "Developer",
"color": "#589494",
"icon": "octicon octicon-circuit-board",
"type": "module",
"system_manager": 1,
"hidden": 1
"condition": getattr(frappe.local.conf, 'developer_mode', 0),
"hidden": 1,
"description": "The Frappe innards of ERPNext. (Only active when developer mode is enabled)"
},

# Places
{
"module_name": 'Contacts',
"type": 'module',
"icon": "octicon octicon-book",
"color": '#FFAEDB',
"module_name": "Website",
"category": "Places",
"label": _("Website"),
"_label": _("Website"),
"color": "#16a085",
"icon": "octicon octicon-globe",
"type": "module",
"hidden": 1,
"description": "Webpages and the Portal Side of Things."
},
{
"module_name": 'Social',
"category": "Places",
"label": _('Social'),
"icon": "octicon octicon-heart",
"type": 'link',
"link": 'social/home',
"link": '#social/home',
"color": '#FF4136',
'standard': 1,
'idx': 15
'idx': 15,
"description": "Build your profile and share posts on the feed with other users."
},
{
"module_name": 'Settings',
"color": "#bdc3c7",
"reverse": 1,
"icon": "octicon octicon-settings",
"type": "module"
}
]
51 changes: 0 additions & 51 deletions frappe/config/settings.py

This file was deleted.