ソースを参照

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

version-14
nikhilponnuru 4年前
コミット
cd4fff5daf
2個のファイルの変更17行の追加11行の削除
  1. +13
    -9
      frappe/desk/desktop.py
  2. +4
    -2
      frappe/public/js/frappe/views/workspace/workspace.js

+ 13
- 9
frappe/desk/desktop.py ファイルの表示

@@ -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())


+ 4
- 2
frappe/public/js/frappe/views/workspace/workspace.js ファイルの表示

@@ -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;
}
}



読み込み中…
キャンセル
保存