From 8c6d266fad4a99103a45125987ff21d260457a3a Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 17 Jun 2022 14:14:44 +0530 Subject: [PATCH 01/22] fix: can't select dynamic link on address doctype --- frappe/contacts/address_and_contact.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py index a0f742c55a..1461690378 100644 --- a/frappe/contacts/address_and_contact.py +++ b/frappe/contacts/address_and_contact.py @@ -170,7 +170,9 @@ def delete_contact_and_address(doctype, docname): @frappe.whitelist() @frappe.validate_and_sanitize_search_inputs -def filter_dynamic_link_doctypes(txt: str, filters: Dict) -> List[List[str]]: +def filter_dynamic_link_doctypes( + doctype, txt: str, searchfield, start, page_len, filters: Dict +) -> List[List[str]]: from frappe.permissions import get_doctypes_with_read txt = txt or "" From 05ea37c779c9b9e80bc6b2fc0a5a480b7b595ae8 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 17 Jun 2022 16:16:58 +0530 Subject: [PATCH 02/22] fix: Set first visible tab as active --- frappe/public/js/frappe/form/form.js | 2 -- frappe/public/js/frappe/form/layout.js | 10 ++++++---- frappe/public/js/frappe/form/tab.js | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js index eefc629b4d..98a02850c1 100644 --- a/frappe/public/js/frappe/form/form.js +++ b/frappe/public/js/frappe/form/form.js @@ -575,8 +575,6 @@ frappe.ui.form.Form = class FrappeForm { this.$wrapper.trigger('render_complete'); - this.layout.set_first_tab_as_active(switched || this.cscript.is_onload); - if(!this.hidden) { this.layout.show_empty_form_message(); } diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index 080f8e0180..b808bdc7dc 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -123,7 +123,7 @@ frappe.ui.form.Layout = class Layout { if (this.is_tabbed_layout()) { // add a tab without `fieldname` to avoid conflicts - let default_tab = {label: __('Details'), fieldtype: "Tab Break"}; + let default_tab = {label: __('Details'), fieldtype: "Tab Break", fieldname: "__details"}; let first_tab = this.fields[1].fieldtype === "Tab Break" ? this.fields[1] : null; if (!first_tab) { this.fields.splice(1, 0, default_tab); @@ -336,12 +336,14 @@ frappe.ui.form.Layout = class Layout { if (visible_tabs && visible_tabs.length == 1) { visible_tabs[0].parent.toggleClass('hide show'); } + this.set_first_tab_as_active(); } - set_first_tab_as_active(switched) { - if (this.tabs.length && (switched || !this.frm.active_tab)) { + set_first_tab_as_active() { + if (this.tabs.length && !this.frm.active_tab) { // set first tab as active when opening for first time, or new doc - this.tabs[0].set_active(); + let first_visible_tab = this.tabs.find(tab => !tab.is_hidden()); + first_visible_tab.set_active(); } } diff --git a/frappe/public/js/frappe/form/tab.js b/frappe/public/js/frappe/form/tab.js index 69c573186b..5c95fad582 100644 --- a/frappe/public/js/frappe/form/tab.js +++ b/frappe/public/js/frappe/form/tab.js @@ -87,7 +87,6 @@ export default class Tab { } is_hidden() { - this.wrapper.hasClass('hide') - && this.parent.hasClass('hide'); + return this.wrapper.hasClass('hide'); } } From 3f2901d837d6aabbb28aafc8c9ea4f121848f9ca Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 17 Jun 2022 16:56:11 +0530 Subject: [PATCH 03/22] fix: Check if visible tab exists --- frappe/public/js/frappe/form/layout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index b808bdc7dc..f46f70ca48 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -343,7 +343,7 @@ frappe.ui.form.Layout = class Layout { if (this.tabs.length && !this.frm.active_tab) { // set first tab as active when opening for first time, or new doc let first_visible_tab = this.tabs.find(tab => !tab.is_hidden()); - first_visible_tab.set_active(); + first_visible_tab && first_visible_tab.set_active(); } } From ee7cb22cd64e2614b05ed5a83db6756ad71e982c Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 17 Jun 2022 18:17:54 +0530 Subject: [PATCH 04/22] fix: Remember active tab for a document in a browsing session --- frappe/public/js/frappe/form/form.js | 9 +++++++++ frappe/public/js/frappe/form/layout.js | 9 ++++++--- frappe/public/js/frappe/form/tab.js | 8 +++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js index 98a02850c1..13d61d689b 100644 --- a/frappe/public/js/frappe/form/form.js +++ b/frappe/public/js/frappe/form/form.js @@ -1840,6 +1840,15 @@ frappe.ui.form.Form = class FrappeForm { }); }); } + set_active_tab(tab) { + if (!this.active_tab_map) { + this.active_tab_map = {}; + } + this.active_tab_map[this.docname] = tab; + } + get_active_tab() { + return this.active_tab_map && this.active_tab_map[this.docname]; + } }; frappe.validated = 0; diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js index f46f70ca48..add9ce7b8b 100644 --- a/frappe/public/js/frappe/form/layout.js +++ b/frappe/public/js/frappe/form/layout.js @@ -336,11 +336,14 @@ frappe.ui.form.Layout = class Layout { if (visible_tabs && visible_tabs.length == 1) { visible_tabs[0].parent.toggleClass('hide show'); } - this.set_first_tab_as_active(); + this.set_tab_as_active(); } - set_first_tab_as_active() { - if (this.tabs.length && !this.frm.active_tab) { + set_tab_as_active() { + let frm_active_tab = this?.frm.get_active_tab?.(); + if (frm_active_tab) { + frm_active_tab.set_active(); + } else if (this.tabs.length) { // set first tab as active when opening for first time, or new doc let first_visible_tab = this.tabs.find(tab => !tab.is_hidden()); first_visible_tab && first_visible_tab.set_active(); diff --git a/frappe/public/js/frappe/form/tab.js b/frappe/public/js/frappe/form/tab.js index 5c95fad582..324d0c50c8 100644 --- a/frappe/public/js/frappe/form/tab.js +++ b/frappe/public/js/frappe/form/tab.js @@ -10,6 +10,7 @@ export default class Tab { this.fields_list = []; this.fields_dict = {}; this.make(); + this.setup_listeners(); this.refresh(); } @@ -79,7 +80,6 @@ export default class Tab { set_active() { this.parent.find('.nav-link').tab('show'); this.wrapper.addClass('active'); - this.frm.active_tab = this; } is_active() { @@ -89,4 +89,10 @@ export default class Tab { is_hidden() { return this.wrapper.hasClass('hide'); } + + setup_listeners() { + this.parent.find('.nav-link').on('shown.bs.tab', () => { + this?.frm.set_active_tab?.(this); + }); + } } From 23bd9749f670dcc26692faa9dd31e8fe870cb82e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 19:36:38 +0530 Subject: [PATCH 05/22] feat(UX): refresh URL when updating filters --- frappe/public/js/frappe/list/list_view.js | 34 ++++------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index d57c57a0b6..1ca37e1138 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -1454,7 +1454,11 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { on_update() {} - get_share_url() { + on_filter_change() { + window.history.replaceState(null, null, this.get_url_with_filters()); + } + + get_url_with_filters() { const query_params = this.get_filters_for_args() .map((filter) => { filter[3] = encodeURIComponent(filter[3]); @@ -1476,27 +1480,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { return full_url; } - share_url() { - const d = new frappe.ui.Dialog({ - title: __("Share URL"), - fields: [ - { - fieldtype: "Code", - fieldname: "url", - label: "URL", - default: this.get_share_url(), - read_only: 1, - }, - ], - primary_action_label: __("Copy to clipboard"), - primary_action: () => { - frappe.utils.copy_to_clipboard(this.get_share_url()); - d.hide(); - }, - }); - d.show(); - } - get_menu_items() { const doctype = this.doctype; const items = []; @@ -1561,13 +1544,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { shortcut: "Ctrl+K", }); - items.push({ - label: __("Share URL", null, "Button in list view menu"), - action: () => this.share_url(), - standard: true, - shortcut: "Ctrl+L", - }); - if ( frappe.user.has_role("System Manager") && frappe.boot.developer_mode === 1 From e0e0c6f219c057119ba0afd3abb25caa9c0f96f7 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 19:41:48 +0530 Subject: [PATCH 06/22] fix: remove query params from existing URL --- frappe/public/js/frappe/list/list_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index 1ca37e1138..68d4b9417b 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -1473,7 +1473,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { }) .join("&"); - let full_url = window.location.href; + let full_url = window.location.href.replace(window.location.search, ""); if (query_params) { full_url += "?" + query_params; } From 813793a70074c59e81e102d449114071484c3192 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 20:29:06 +0530 Subject: [PATCH 07/22] fix: view routing from URL query paramters --- frappe/public/js/frappe/router.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/frappe/public/js/frappe/router.js b/frappe/public/js/frappe/router.js index 39e6555654..a6bff4d72f 100644 --- a/frappe/public/js/frappe/router.js +++ b/frappe/public/js/frappe/router.js @@ -121,7 +121,7 @@ frappe.router = { route = this.get_sub_path_string(route).split('/'); if (!route) return []; route = $.map(route, this.decode_component); - this.set_route_options_from_url(route); + this.set_route_options_from_url(); return this.convert_to_standard_route(route); }, @@ -410,18 +410,17 @@ frappe.router = { return route; }, - set_route_options_from_url(route) { + set_route_options_from_url() { // set query parameters as frappe.route_options - var last_part = route[route.length - 1]; - if (last_part.indexOf("?") < last_part.indexOf("=")) { - // has ? followed by = - let parts = last_part.split("?"); + let query_string = window.location.search; - // route should not contain string after ? - route[route.length - 1] = parts[0]; + if (!frappe.route_options) { + frappe.route_options = {}; + } - let query_params = frappe.utils.get_query_params(parts[1]); - frappe.route_options = $.extend(frappe.route_options || {}, query_params); + let params = new URLSearchParams(query_string); + for (const [key, value] of params) { + frappe.route_options[key] = value; } }, From f4e8dee669e7922d27618e3c66fa10836e49326a Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 22:19:20 +0530 Subject: [PATCH 08/22] fix: double urlencoding of values This was breaking URLs for complex filters --- frappe/public/js/frappe/list/list_view.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index 68d4b9417b..da6d2a78f6 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -1461,9 +1461,8 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { get_url_with_filters() { const query_params = this.get_filters_for_args() .map((filter) => { - filter[3] = encodeURIComponent(filter[3]); if (filter[2] === "=") { - return `${filter[1]}=${filter[3]}`; + return `${filter[1]}=${encodeURIComponent(filter[3])}`; } return [ filter[1], From b3b382991293e683301b8180462e7d9b95d36c35 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 23:04:47 +0530 Subject: [PATCH 09/22] fix: don't forget 'like' filters Currently like filters get reset if field is part of standard filters --- frappe/public/js/frappe/list/base_list.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/list/base_list.js b/frappe/public/js/frappe/list/base_list.js index b91693257a..bbee90048b 100644 --- a/frappe/public/js/frappe/list/base_list.js +++ b/frappe/public/js/frappe/list/base_list.js @@ -621,6 +621,8 @@ class FilterArea { filters = filters.filter(f => !this.exists(f)); + // standard filters = filters visible on list view + // non-standard filters = filters set by filter button const { non_standard_filters, promise } = this.set_standard_filter( filters ); @@ -680,9 +682,14 @@ class FilterArea { out.promise = out.promise || Promise.resolve(); out.non_standard_filters = out.non_standard_filters || []; + // set in list view area if filters are present + // don't set like filter on link fields (gets reset) if ( fields_dict[fieldname] && - (condition === "=" || condition === "like") + ( + condition === "=" || + (condition === "like" && fields_dict[fieldname]?.df?.fieldtype != "Link") + ) ) { // standard filter out.promise = out.promise.then(() => From 69b7c72be86d5eca72fea269d1308804f22bca7e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 5 Jun 2022 23:34:15 +0530 Subject: [PATCH 10/22] fix: kanban board from shared links - Apply filter from URL - Update URL in browser when filters change --- frappe/public/js/frappe/views/kanban/kanban_view.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/public/js/frappe/views/kanban/kanban_view.js b/frappe/public/js/frappe/views/kanban/kanban_view.js index b546365fd9..02acfef278 100644 --- a/frappe/public/js/frappe/views/kanban/kanban_view.js +++ b/frappe/public/js/frappe/views/kanban/kanban_view.js @@ -64,10 +64,6 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView { }); } - before_refresh() { - - } - setup_page() { this.hide_sidebar = true; this.hide_page_form = true; @@ -105,6 +101,7 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView { } else { this.page.clear_indicator(); } + super.on_filter_change(); } save_kanban_board_filters() { @@ -154,7 +151,10 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView { get_card_meta() { var meta = frappe.get_meta(this.doctype); + // preserve route options erased by new doc + let route_options = {...frappe.route_options}; var doc = frappe.model.get_new_doc(this.doctype); + frappe.route_options = route_options; var title_field = null; var quick_entry = false; From 37999ea17e773fe07326310888ab4491727f3c5a Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 6 Jun 2022 01:12:05 +0530 Subject: [PATCH 11/22] fix: handle multiselect report options --- frappe/public/js/frappe/views/reports/query_report.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 7d00f3ed13..a4da6c84c3 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -538,7 +538,11 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { const promises = filters_to_set.map(f => { return () => { - const value = route_options[f.df.fieldname]; + let value = route_options[f.df.fieldname]; + if (typeof value === 'string' && value[0] === '[') { + // multiselect array + value = JSON.parse(value); + } f.set_value(value); }; }); From 90bcbe46f12d1d78eb70f88f735d26f2b2147e05 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 6 Jun 2022 01:12:27 +0530 Subject: [PATCH 12/22] feat(ux): Always sharable query report URLs --- .../js/frappe/views/reports/query_report.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index a4da6c84c3..8f1cecb965 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -57,6 +57,30 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { this.menu_items = []; } + on_filter_change() { + window.history.replaceState(null, null, this.get_url_with_filters()); + } + + get_url_with_filters() { + const query_params = Object.entries(this.get_filter_values()) + .map(([field, value], _idx) => { + // multiselects + if (Array.isArray(value)) { + if (!value.length) return ''; + value = JSON.stringify(value); + } + return `${field}=${encodeURIComponent(value)}`; + }) + .filter(Boolean) + .join("&"); + + let full_url = window.location.href.replace(window.location.search, ""); + if (query_params) { + full_url += "?" + query_params; + } + return full_url; + } + set_default_secondary_action() { this.refresh_button && this.refresh_button.remove(); this.refresh_button = this.page.add_action_icon("refresh", () => { @@ -482,6 +506,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { if (df.on_change) f.on_change = df.on_change; df.onchange = () => { + this.on_filter_change(); this.refresh_filters_dependency(); let current_filters = this.get_filter_values(); From 61c895c2fc9488abdbccbe1f17ac73705ade24b2 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 16 Jun 2022 15:17:48 +0530 Subject: [PATCH 13/22] refactor: update listview URL on all refresh Previous changes only made it refresh on change of filters, this change now updates URL ALWAYS. Co-Auhtored-By: Suraj Shetty --- frappe/public/js/frappe/list/list_view.js | 3 ++- frappe/public/js/frappe/views/kanban/kanban_view.js | 1 - frappe/public/js/frappe/views/reports/query_report.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js index da6d2a78f6..3a39a949c9 100644 --- a/frappe/public/js/frappe/list/list_view.js +++ b/frappe/public/js/frappe/list/list_view.js @@ -291,6 +291,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { super.refresh().then(() => { this.render_header(refresh_header); this.update_checkbox(); + this.update_url_with_filters(); }); } @@ -1454,7 +1455,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList { on_update() {} - on_filter_change() { + update_url_with_filters() { window.history.replaceState(null, null, this.get_url_with_filters()); } diff --git a/frappe/public/js/frappe/views/kanban/kanban_view.js b/frappe/public/js/frappe/views/kanban/kanban_view.js index 02acfef278..129db13b07 100644 --- a/frappe/public/js/frappe/views/kanban/kanban_view.js +++ b/frappe/public/js/frappe/views/kanban/kanban_view.js @@ -101,7 +101,6 @@ frappe.views.KanbanView = class KanbanView extends frappe.views.ListView { } else { this.page.clear_indicator(); } - super.on_filter_change(); } save_kanban_board_filters() { diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 8f1cecb965..ac7f8327ab 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -57,7 +57,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { this.menu_items = []; } - on_filter_change() { + update_url_with_filters() { window.history.replaceState(null, null, this.get_url_with_filters()); } @@ -506,7 +506,6 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { if (df.on_change) f.on_change = df.on_change; df.onchange = () => { - this.on_filter_change(); this.refresh_filters_dependency(); let current_filters = this.get_filter_values(); @@ -681,6 +680,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList { frappe.hide_progress(); }).finally(() => { this.hide_loading_screen(); + this.update_url_with_filters(); }); } From 54824071c2f9b80c0d75b056dc39bba7cf95bea9 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 17 Jun 2022 20:47:55 +0530 Subject: [PATCH 14/22] test: simple test for URL routing with params --- cypress/integration/routing.js | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cypress/integration/routing.js diff --git a/cypress/integration/routing.js b/cypress/integration/routing.js new file mode 100644 index 0000000000..ad07754010 --- /dev/null +++ b/cypress/integration/routing.js @@ -0,0 +1,36 @@ +const list_view = "/app/todo"; + +// test round trip with filter types + +const test_queries = [ + "?status=Open", + `?date=%5B"Between"%2C%5B"2022-06-01"%2C"2022-06-30"%5D%5D`, + `?date=%5B">"%2C"2022-06-01"%5D`, + `?name=%5B"like"%2C"%2542%25"%5D`, + `?status=%5B"not%20in"%2C%5B"Open"%2C"Closed"%5D%5D`, +]; + +describe("SPA Routing", { scrollBehavior: false }, () => { + before(() => { + cy.login(); + cy.go_to_list("ToDo"); + }); + + it("should apply filter on list view from route", () => { + test_queries.forEach((query) => { + const full_url = `${list_view}${query}`; + cy.visit(full_url); + cy.findByTitle("To Do").should("exist"); + + const expected = new URLSearchParams(query); + cy.location().then((loc) => { + const actual = new URLSearchParams(loc.search); + // This might appear like a dumb test checking visited URL to itself + // but it's actually doing a round trip + // URL with params -> parsed filters -> new URL + // if it's same that means everything worked in between. + expect(actual.toString()).to.eq(expected.toString()); + }); + }); + }); +}); From 7b67e1f847121f255c3262811bc54493a2563342 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Mon, 20 Jun 2022 07:05:57 +0200 Subject: [PATCH 15/22] fix: translate doctype in error messages (#17239) --- frappe/__init__.py | 2 +- frappe/client.py | 4 ++-- frappe/model/db_query.py | 2 +- frappe/share.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 76888c1824..1cf3526b45 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -926,7 +926,7 @@ def has_permission( if throw and not out: # mimics frappe.throw - document_label = f"{doc.doctype} {doc.name}" if doc else doctype + document_label = f"{_(doc.doctype)} {doc.name}" if doc else _(doctype) msgprint( _("No permission for {0}").format(document_label), raise_exception=ValidationError, diff --git a/frappe/client.py b/frappe/client.py index 4afe0898bc..154fcf31e2 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -101,7 +101,7 @@ def get_value(doctype, fieldname, filters=None, as_dict=True, debug=False, paren check_parent_permission(parent, doctype) if not frappe.has_permission(doctype, parent_doctype=parent): - frappe.throw(_("No permission for {0}").format(doctype), frappe.PermissionError) + frappe.throw(_("No permission for {0}").format(_(doctype)), frappe.PermissionError) filters = get_safe_filters(filters) if isinstance(filters, str): @@ -143,7 +143,7 @@ def get_value(doctype, fieldname, filters=None, as_dict=True, debug=False, paren @frappe.whitelist() def get_single_value(doctype, field): if not frappe.has_permission(doctype): - frappe.throw(_("No permission for {0}").format(doctype), frappe.PermissionError) + frappe.throw(_("No permission for {0}").format(_(doctype)), frappe.PermissionError) value = frappe.db.get_single_value(doctype, field) return value diff --git a/frappe/model/db_query.py b/frappe/model/db_query.py index 82913db98d..7fb38848e2 100644 --- a/frappe/model/db_query.py +++ b/frappe/model/db_query.py @@ -743,7 +743,7 @@ class DatabaseQuery(object): ): only_if_shared = True if not self.shared: - frappe.throw(_("No permission to read {0}").format(self.doctype), frappe.PermissionError) + frappe.throw(_("No permission to read {0}").format(_(self.doctype)), frappe.PermissionError) else: self.conditions.append(self.get_share_condition()) diff --git a/frappe/share.py b/frappe/share.py index 3edcb1be38..dfb4836995 100644 --- a/frappe/share.py +++ b/frappe/share.py @@ -175,7 +175,7 @@ def check_share_permission(doctype, name): """Check if the user can share with other users""" if not frappe.has_permission(doctype, ptype="share", doc=name): frappe.throw( - _("No permission to {0} {1} {2}").format("share", doctype, name), frappe.PermissionError + _("No permission to {0} {1} {2}").format("share", _(doctype), name), frappe.PermissionError ) @@ -190,7 +190,7 @@ def notify_assignment(shared_by, doctype, doc_name, everyone, notify=0): reference_user = get_fullname(frappe.session.user) notification_message = _("{0} shared a document {1} {2} with you").format( - frappe.bold(reference_user), frappe.bold(doctype), get_title_html(title) + frappe.bold(reference_user), frappe.bold(_(doctype)), get_title_html(title) ) notification_doc = { From e0e452bdcc1c8dd03e4261e24a48abc8bdf095ad Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Jun 2022 11:11:10 +0530 Subject: [PATCH 16/22] fix: incorrect filtering on address doctype (#17241) [skip ci] --- frappe/contacts/address_and_contact.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py index 1461690378..8d078196e0 100644 --- a/frappe/contacts/address_and_contact.py +++ b/frappe/contacts/address_and_contact.py @@ -177,7 +177,6 @@ def filter_dynamic_link_doctypes( txt = txt or "" filters = filters or {} - TXT_PATTERN = re.compile(f"{txt}.*") _doctypes_from_df = frappe.get_all( "DocField", @@ -186,13 +185,13 @@ def filter_dynamic_link_doctypes( distinct=True, order_by=None, ) - doctypes_from_df = {d for d in _doctypes_from_df if TXT_PATTERN.search(_(d), re.IGNORECASE)} + doctypes_from_df = {d for d in _doctypes_from_df if txt.lower() in d.lower()} filters.update({"dt": ("not in", doctypes_from_df)}) _doctypes_from_cdf = frappe.get_all( "Custom Field", filters=filters, pluck="dt", distinct=True, order_by=None ) - doctypes_from_cdf = {d for d in _doctypes_from_cdf if TXT_PATTERN.search(_(d), re.IGNORECASE)} + doctypes_from_cdf = {d for d in _doctypes_from_cdf if txt.lower() in d.lower()} all_doctypes = doctypes_from_df.union(doctypes_from_cdf) allowed_doctypes = set(get_doctypes_with_read()) From 28fd355f247d169fe656c7610b034e69777c3543 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Jun 2022 11:16:24 +0530 Subject: [PATCH 17/22] chore: translate before searching doctype --- frappe/contacts/address_and_contact.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py index 8d078196e0..1c5803ffea 100644 --- a/frappe/contacts/address_and_contact.py +++ b/frappe/contacts/address_and_contact.py @@ -185,13 +185,13 @@ def filter_dynamic_link_doctypes( distinct=True, order_by=None, ) - doctypes_from_df = {d for d in _doctypes_from_df if txt.lower() in d.lower()} + doctypes_from_df = {d for d in _doctypes_from_df if txt.lower() in _(d).lower()} filters.update({"dt": ("not in", doctypes_from_df)}) _doctypes_from_cdf = frappe.get_all( "Custom Field", filters=filters, pluck="dt", distinct=True, order_by=None ) - doctypes_from_cdf = {d for d in _doctypes_from_cdf if txt.lower() in d.lower()} + doctypes_from_cdf = {d for d in _doctypes_from_cdf if txt.lower() in _(d).lower()} all_doctypes = doctypes_from_df.union(doctypes_from_cdf) allowed_doctypes = set(get_doctypes_with_read()) From dd8aabcc2f7225be6f055b16df304936c2805efa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 11:48:06 +0530 Subject: [PATCH 18/22] build(deps): bump actions/setup-python from 2 to 4 (#17218) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 4. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/docs-checker.yml | 2 +- .github/workflows/linters.yml | 2 +- .github/workflows/patch-mariadb-tests.yml | 2 +- .github/workflows/publish-assets-develop.yml | 2 +- .github/workflows/publish-assets-releases.yml | 2 +- .github/workflows/server-mariadb-tests.yml | 2 +- .github/workflows/server-postgres-tests.yml | 2 +- .github/workflows/ui-tests.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docs-checker.yml b/.github/workflows/docs-checker.yml index a0f77b43fd..80b2469c0c 100644 --- a/.github/workflows/docs-checker.yml +++ b/.github/workflows/docs-checker.yml @@ -13,7 +13,7 @@ jobs: steps: - name: 'Setup Environment' - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 443ee45bf7..7a17648ff0 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 diff --git a/.github/workflows/patch-mariadb-tests.yml b/.github/workflows/patch-mariadb-tests.yml index 7dffc30dc0..8f787a145b 100644 --- a/.github/workflows/patch-mariadb-tests.yml +++ b/.github/workflows/patch-mariadb-tests.yml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.9' diff --git a/.github/workflows/publish-assets-develop.yml b/.github/workflows/publish-assets-develop.yml index f56d1460b5..161f410d87 100644 --- a/.github/workflows/publish-assets-develop.yml +++ b/.github/workflows/publish-assets-develop.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 14 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: '3.9' - name: Set up bench and build assets diff --git a/.github/workflows/publish-assets-releases.yml b/.github/workflows/publish-assets-releases.yml index faf41ed23e..a18b70e717 100644 --- a/.github/workflows/publish-assets-releases.yml +++ b/.github/workflows/publish-assets-releases.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-node@v1 with: python-version: '12.x' - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: '3.9' - name: Set up bench and build assets diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index 33fc221e80..a231808120 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.9' diff --git a/.github/workflows/server-postgres-tests.yml b/.github/workflows/server-postgres-tests.yml index 2b4a2edae0..169630da70 100644 --- a/.github/workflows/server-postgres-tests.yml +++ b/.github/workflows/server-postgres-tests.yml @@ -43,7 +43,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.9' diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 3518608f33..4a18cda02d 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.9' From 7570c0e2a158b7923e6f826b674a080ae4526813 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 11:48:32 +0530 Subject: [PATCH 19/22] build(deps): bump actions/setup-node from 2 to 3 (#17222) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2 to 3. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/patch-mariadb-tests.yml | 2 +- .github/workflows/publish-assets-develop.yml | 2 +- .github/workflows/publish-assets-releases.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/server-mariadb-tests.yml | 2 +- .github/workflows/server-postgres-tests.yml | 2 +- .github/workflows/ui-tests.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/patch-mariadb-tests.yml b/.github/workflows/patch-mariadb-tests.yml index 8f787a145b..982577a085 100644 --- a/.github/workflows/patch-mariadb-tests.yml +++ b/.github/workflows/patch-mariadb-tests.yml @@ -36,7 +36,7 @@ jobs: python-version: '3.9' - name: Setup Node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 14 check-latest: true diff --git a/.github/workflows/publish-assets-develop.yml b/.github/workflows/publish-assets-develop.yml index 161f410d87..6cd3af78f2 100644 --- a/.github/workflows/publish-assets-develop.yml +++ b/.github/workflows/publish-assets-develop.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 with: path: 'frappe' - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: node-version: 14 - uses: actions/setup-python@v4 diff --git a/.github/workflows/publish-assets-releases.yml b/.github/workflows/publish-assets-releases.yml index a18b70e717..f242a363b4 100644 --- a/.github/workflows/publish-assets-releases.yml +++ b/.github/workflows/publish-assets-releases.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v2 with: path: 'frappe' - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: python-version: '12.x' - uses: actions/setup-python@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e9936482b0..32c5d53831 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: fetch-depth: 0 persist-credentials: false - name: Setup Node.js v14 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 14 - name: Setup dependencies diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index a231808120..b9c79db1e6 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -53,7 +53,7 @@ jobs: PR_NUMBER: ${{ github.event.number }} REPO_NAME: ${{ github.repository }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} with: node-version: 14 diff --git a/.github/workflows/server-postgres-tests.yml b/.github/workflows/server-postgres-tests.yml index 169630da70..f4aa756181 100644 --- a/.github/workflows/server-postgres-tests.yml +++ b/.github/workflows/server-postgres-tests.yml @@ -56,7 +56,7 @@ jobs: PR_NUMBER: ${{ github.event.number }} REPO_NAME: ${{ github.repository }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} with: node-version: '14' diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 4a18cda02d..49426f5ad5 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -52,7 +52,7 @@ jobs: PR_NUMBER: ${{ github.event.number }} REPO_NAME: ${{ github.repository }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} with: node-version: 14 From dd5a9e0d9c0ad390b4c87327954320b3600a5193 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 11:49:09 +0530 Subject: [PATCH 20/22] build(deps): bump actions/cache from 2 to 3 (#17220) Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/patch-mariadb-tests.yml | 6 +++--- .github/workflows/server-mariadb-tests.yml | 6 +++--- .github/workflows/server-postgres-tests.yml | 6 +++--- .github/workflows/ui-tests.yml | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/patch-mariadb-tests.yml b/.github/workflows/patch-mariadb-tests.yml index 982577a085..ae5802a8e1 100644 --- a/.github/workflows/patch-mariadb-tests.yml +++ b/.github/workflows/patch-mariadb-tests.yml @@ -56,7 +56,7 @@ jobs: - name: Cache pip if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} @@ -66,7 +66,7 @@ jobs: - name: Cache node modules if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -82,7 +82,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} id: yarn-cache with: diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index b9c79db1e6..b14f4bb0b4 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -67,7 +67,7 @@ jobs: - name: Cache pip if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} @@ -77,7 +77,7 @@ jobs: - name: Cache node modules if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -93,7 +93,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} id: yarn-cache with: diff --git a/.github/workflows/server-postgres-tests.yml b/.github/workflows/server-postgres-tests.yml index f4aa756181..e7e614f3e8 100644 --- a/.github/workflows/server-postgres-tests.yml +++ b/.github/workflows/server-postgres-tests.yml @@ -70,7 +70,7 @@ jobs: - name: Cache pip if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} @@ -80,7 +80,7 @@ jobs: - name: Cache node modules if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -96,7 +96,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} id: yarn-cache with: diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 49426f5ad5..816085aa64 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -66,7 +66,7 @@ jobs: - name: Cache pip if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} @@ -76,7 +76,7 @@ jobs: - name: Cache node modules if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: cache-node-modules with: @@ -92,7 +92,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{ steps.check-build.outputs.build == 'strawberry' }} id: yarn-cache with: @@ -103,7 +103,7 @@ jobs: - name: Cache cypress binary if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache key: ${{ runner.os }}-cypress- From b04bffe439213ae6e6406a58377c269456153653 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 11:50:10 +0530 Subject: [PATCH 21/22] build(deps): bump codecov/codecov-action from 2 to 3 (#17219) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2...v3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/server-mariadb-tests.yml | 2 +- .github/workflows/server-postgres-tests.yml | 2 +- .github/workflows/ui-tests.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index b14f4bb0b4..f7f3aae8d0 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -126,7 +126,7 @@ jobs: - name: Upload coverage data if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: name: MariaDB fail_ci_if_error: true diff --git a/.github/workflows/server-postgres-tests.yml b/.github/workflows/server-postgres-tests.yml index e7e614f3e8..5116d4198e 100644 --- a/.github/workflows/server-postgres-tests.yml +++ b/.github/workflows/server-postgres-tests.yml @@ -129,7 +129,7 @@ jobs: - name: Upload coverage data if: ${{ steps.check-build.outputs.build == 'strawberry' }} - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: name: Postgres fail_ci_if_error: true diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 816085aa64..72fe3e67bb 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -158,7 +158,7 @@ jobs: - name: Upload Coverage Data if: ${{ steps.check-build.outputs.build == 'strawberry' && steps.check_coverage.outputs.files_exists == 'true' }} - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: name: Cypress fail_ci_if_error: true @@ -168,7 +168,7 @@ jobs: - name: Upload Server Coverage Data if: ${{ steps.check-build.outputs.build-server == 'strawberry' }} - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: name: MariaDB fail_ci_if_error: true From 6350406305f9445513b6db1d4c55e53a2dd251b2 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Jun 2022 14:28:38 +0530 Subject: [PATCH 22/22] perf: remove duplicate control assets (#17237) * test: flaky tests due to uncleared filters * perf: remove duplicate code in assets Remove controls which are separately bundled too, saves ~1.1MB of network transfer. Co-authored-by: Suraj Shetty --- cypress/integration/awesome_bar.js | 1 + cypress/integration/routing.js | 4 ++++ frappe/public/js/form.bundle.js | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cypress/integration/awesome_bar.js b/cypress/integration/awesome_bar.js index e62ba6bec5..938034a34a 100644 --- a/cypress/integration/awesome_bar.js +++ b/cypress/integration/awesome_bar.js @@ -28,6 +28,7 @@ context('Awesome Bar', () => { cy.findByPlaceholderText('ID') .should('have.value', '%test%'); + cy.clear_filters(); }); it('navigates to new form', () => { diff --git a/cypress/integration/routing.js b/cypress/integration/routing.js index ad07754010..0822dd9b7d 100644 --- a/cypress/integration/routing.js +++ b/cypress/integration/routing.js @@ -16,6 +16,10 @@ describe("SPA Routing", { scrollBehavior: false }, () => { cy.go_to_list("ToDo"); }); + after(() => { + cy.clear_filters(); // avoid flake in future tests + }); + it("should apply filter on list view from route", () => { test_queries.forEach((query) => { const full_url = `${list_view}${query}`; diff --git a/frappe/public/js/form.bundle.js b/frappe/public/js/form.bundle.js index 2719535599..38d76f1f26 100644 --- a/frappe/public/js/form.bundle.js +++ b/frappe/public/js/form.bundle.js @@ -10,7 +10,6 @@ import "./frappe/form/templates/set_sharing.html"; import "./frappe/form/templates/timeline_message_box.html"; import "./frappe/form/templates/users_in_sidebar.html"; -import "./frappe/form/controls/control.js"; import "./frappe/views/formview.js"; import "./frappe/form/form.js"; import "./frappe/meta_tag.js";