feat(module_links): onboarding cues for starting doctypes
This commit is contained in:
parent
466de4f19b
commit
67c32d2850
2 changed files with 48 additions and 4 deletions
|
|
@ -42,6 +42,34 @@ def get_data(module):
|
|||
|
||||
#set_last_modified(data)
|
||||
|
||||
exists_cache = {}
|
||||
|
||||
def exists(name):
|
||||
exists = exists_cache.get(name)
|
||||
if not exists:
|
||||
exists = frappe.db.exists(name)
|
||||
exists_cache[name] = exists
|
||||
return exists
|
||||
|
||||
for section in data:
|
||||
for item in section["items"]:
|
||||
# Onboarding
|
||||
|
||||
# First disable based on exists of depends_on list
|
||||
dependencies = item.get("dependencies") or None
|
||||
if dependencies:
|
||||
incomplete_dependencies = [d for d in dependencies if not exists(d)]
|
||||
if len(incomplete_dependencies):
|
||||
item["incomplete_dependencies"] = incomplete_dependencies
|
||||
|
||||
if item.get("onboard"):
|
||||
# Mark Spotlights for initial
|
||||
if item.get("type") == "doctype":
|
||||
name = item.get("name")
|
||||
count = exists(name)
|
||||
|
||||
item["count"] = count
|
||||
|
||||
return data
|
||||
|
||||
def build_config_from_file(module):
|
||||
|
|
|
|||
|
|
@ -10,11 +10,23 @@
|
|||
:key="section.label + item.label"
|
||||
:data-youtube-id="item.type==='help' ? item.youtube_id : false"
|
||||
>
|
||||
<a class="indicator grey"
|
||||
:href="item.route"
|
||||
<span v-if="item.dependencies && item.incomplete_dependencies"
|
||||
class="text-muted indicator grey"
|
||||
>
|
||||
{{ item.label || __(item.name) }}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<span v-else>
|
||||
<a class="indicator"
|
||||
:class="item.onboard && !item.count ? 'orange' : 'grey'"
|
||||
:href="item.route"
|
||||
>
|
||||
{{ item.label || __(item.name) }}
|
||||
</a>
|
||||
<span class="open-notification global hide"
|
||||
@click="item.doctype || item.name ? frappe.ui.notifications.show_open_count_list(item.doctype || item.name) : false"
|
||||
:data-doctype="item.doctype || item.name"></span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -30,7 +42,7 @@ export default {
|
|||
props: ['module_name', 'sections'],
|
||||
updated() {
|
||||
frappe.app.update_notification_count_in_modules();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
|
@ -70,4 +82,8 @@ a:hover, a:focus {
|
|||
color: inherit;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue