fix: Workspace not found error that happens when a workspace which was deleted when still in use and hence won't let the user to use the desk page
This commit is contained in:
parent
e4744724a0
commit
cd4fff5daf
2 changed files with 17 additions and 11 deletions
|
|
@ -359,15 +359,18 @@ def get_desktop_page(page):
|
|||
Returns:
|
||||
dict: dictionary of cards, charts and shortcuts to be displayed on website
|
||||
"""
|
||||
wspace = Workspace(page)
|
||||
wspace.build_workspace()
|
||||
return {
|
||||
'charts': wspace.charts,
|
||||
'shortcuts': wspace.shortcuts,
|
||||
'cards': wspace.cards,
|
||||
'onboarding': wspace.onboarding,
|
||||
'allow_customization': not wspace.doc.disable_user_customization
|
||||
}
|
||||
try:
|
||||
wspace = Workspace(page)
|
||||
wspace.build_workspace()
|
||||
return {
|
||||
'charts': wspace.charts,
|
||||
'shortcuts': wspace.shortcuts,
|
||||
'cards': wspace.cards,
|
||||
'onboarding': wspace.onboarding,
|
||||
'allow_customization': not wspace.doc.disable_user_customization
|
||||
}
|
||||
except DoesNotExistError:
|
||||
return {}
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_desk_sidebar_items():
|
||||
|
|
@ -608,3 +611,4 @@ def merge_cards_based_on_label(cards):
|
|||
cards_dict[label] = card
|
||||
|
||||
return list(cards_dict.values())
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ class DesktopPage {
|
|||
this.page.appendTo(this.container);
|
||||
|
||||
this.get_data().then(() => {
|
||||
if (!this.data) {
|
||||
if (Object.keys(this.data).length == 0) {
|
||||
delete localStorage.current_workspace;
|
||||
frappe.set_route("workspace");
|
||||
return;
|
||||
|
|
@ -274,7 +274,7 @@ class DesktopPage {
|
|||
page: this.page_name
|
||||
}).then(data => {
|
||||
this.data = data;
|
||||
if (!this.data) return;
|
||||
if (Object.keys(this.data).length == 0) return;
|
||||
|
||||
return frappe.dashboard_utils.get_dashboard_settings().then(settings => {
|
||||
let chart_config = settings.chart_config ? JSON.parse(settings.chart_config) : {};
|
||||
|
|
@ -410,3 +410,5 @@ class DesktopPage {
|
|||
this.sections["cards"] = cards;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue