diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index c5b3a44f0d..ba65454ef6 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -7,8 +7,8 @@ context("Folder Navigation", () => { it("Adding Folders", () => { //Adding filter to go into the home folder - cy.get(".filter-selector > .btn").findByText("1 filter").click(); - cy.findByRole("button", { name: "Clear Filters" }).click(); + cy.get(".filter-x-button").click(); + cy.click_filter_button(); cy.get(".filter-action-buttons > .text-muted").findByText("+ Add a Filter").click(); cy.get(".fieldname-select-area > .awesomplete > .form-control:last").type("Fol{enter}"); cy.get( @@ -47,9 +47,13 @@ context("Folder Navigation", () => { //Adding a file inside the Test Folder cy.findByRole("button", { name: "Add File" }).eq(0).click({ force: true }); cy.get(".file-uploader").findByText("Link").click(); - cy.get(".input-group > .form-control").type( - "https://wallpaperplay.com/walls/full/8/2/b/72402.jpg" - ); + cy.get(".input-group > input.form-control:visible").as("upload_input"); + cy.get("@upload_input").type("https://wallpaperplay.com/walls/full/8/2/b/72402.jpg", { + waitForAnimations: false, + parseSpecialCharSequences: false, + force: true, + delay: 100, + }); cy.click_modal_primary_button("Upload"); //To check if the added file is present in the Test Folder diff --git a/cypress/integration/list_paging.js b/cypress/integration/list_paging.js index 3071950260..5195d0b3ae 100644 --- a/cypress/integration/list_paging.js +++ b/cypress/integration/list_paging.js @@ -12,7 +12,7 @@ context("List Paging", () => { it("test load more with count selection buttons", () => { cy.visit("/app/todo/view/report"); - cy.clear_filters(); + cy.get(".filter-x-button").click(); cy.get(".list-paging-area .list-count").should("contain.text", "20 of"); cy.get(".list-paging-area .btn-more").click(); diff --git a/cypress/integration/list_view_drag_select.js b/cypress/integration/list_view_drag_select.js index d481390d89..2dcb31372c 100644 --- a/cypress/integration/list_view_drag_select.js +++ b/cypress/integration/list_view_drag_select.js @@ -5,6 +5,7 @@ context("List View", () => { }); it("List view check rows on drag", () => { + cy.get(".filter-x-button").click(); cy.get(".list-row-checkbox").then(($checkbox) => { cy.wrap($checkbox).first().trigger("mousedown"); cy.get(".level.list-row").each(($ele) => { diff --git a/cypress/integration/sidebar.js b/cypress/integration/sidebar.js index 0b2a21aa4f..0f97cdc7fe 100644 --- a/cypress/integration/sidebar.js +++ b/cypress/integration/sidebar.js @@ -53,7 +53,7 @@ context("Sidebar", () => { ); //To check if there is no filter added to the listview - cy.get(".filter-selector > .btn").should("contain", "Filter"); + cy.get(".filter-button").should("contain", "Filter"); //To add a filter to display data into the listview cy.get(".group-by-field.show > .dropdown-menu > .group-by-item > .dropdown-item").click(); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index c067974d9f..4b44a24598 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -479,7 +479,7 @@ Cypress.Commands.add("click_listview_row_item_with_text", (text) => { }); Cypress.Commands.add("click_filter_button", () => { - cy.get(".filter-selector > .btn").click(); + cy.get(".filter-button").click(); }); Cypress.Commands.add("click_listview_primary_button", (btn_name) => { diff --git a/frappe/public/icons/timeless/icons.svg b/frappe/public/icons/timeless/icons.svg index cfaf3ba1d7..aeef96ccfe 100644 --- a/frappe/public/icons/timeless/icons.svg +++ b/frappe/public/icons/timeless/icons.svg @@ -237,8 +237,14 @@ - - + + + + + + + + diff --git a/frappe/public/js/frappe/list/base_list.js b/frappe/public/js/frappe/list/base_list.js index ab0ca87b0d..e6ed0df7f4 100644 --- a/frappe/public/js/frappe/list/base_list.js +++ b/frappe/public/js/frappe/list/base_list.js @@ -831,22 +831,31 @@ class FilterArea { make_filter_list() { $(`
- + + + +
`).appendTo(this.$filter_list_wrapper); this.filter_button = this.$filter_list_wrapper.find(".filter-button"); + this.filter_x_button = this.$filter_list_wrapper.find(".filter-x-button"); this.filter_list = new frappe.ui.FilterGroup({ base_list: this.list_view, parent: this.$filter_list_wrapper, doctype: this.list_view.doctype, filter_button: this.filter_button, + filter_x_button: this.filter_x_button, default_filters: [], on_change: () => this.refresh_list_view(), }); diff --git a/frappe/public/js/frappe/ui/filters/filter_list.js b/frappe/public/js/frappe/ui/filters/filter_list.js index 3119ee4b68..5a8d14e09f 100644 --- a/frappe/public/js/frappe/ui/filters/filter_list.js +++ b/frappe/public/js/frappe/ui/filters/filter_list.js @@ -14,9 +14,29 @@ frappe.ui.FilterGroup = class { make_popover() { this.init_filter_popover(); + this.set_clear_all_filters_event(); this.set_popover_events(); } + set_clear_all_filters_event() { + this.filter_x_button.on("click", () => { + this.toggle_empty_filters(true); + if (typeof this.base_list !== "undefined") { + // It's a list view. Clear all the filters, also the ones in the + // FilterArea outside this FilterGroup + this.base_list.filter_area.clear(); + } else { + // Not a list view, just clear the filters in this FilterGroup + this.clear_filters(); + } + this.update_filter_button(); + }); + } + + hide_popover() { + this.filter_button.popover("hide"); + } + init_filter_popover() { this.filter_button.popover({ content: this.get_filter_area_template(), @@ -54,7 +74,7 @@ frappe.ui.FilterGroup = class { !$(e.target).is(this.filter_button) && !in_datepicker ) { - this.wrapper && this.filter_button.popover("hide"); + this.wrapper && this.hide_popover(); } } }); @@ -85,7 +105,7 @@ frappe.ui.FilterGroup = class { // REDESIGN-TODO: (Temporary) Review and find best solution for this frappe.router.on("change", () => { if (this.wrapper && this.wrapper.is(":visible")) { - this.filter_button.popover("hide"); + this.hide_popover(); } }); } @@ -130,11 +150,10 @@ frappe.ui.FilterGroup = class { this.toggle_empty_filters(true); this.clear_filters(); this.on_change(); + this.hide_popover(); }); - this.wrapper.find(".apply-filters").on("click", () => { - this.filter_button.popover("hide"); - }); + this.wrapper.find(".apply-filters").on("click", () => this.hide_popover()); } add_filters(filters) { diff --git a/frappe/public/scss/desk/filters.scss b/frappe/public/scss/desk/filters.scss index ffaea7a9bd..3f197e8278 100644 --- a/frappe/public/scss/desk/filters.scss +++ b/frappe/public/scss/desk/filters.scss @@ -1,7 +1,5 @@ .filter-icon.active { - use { - stroke: var(--text-on-blue); - } + --icon-stroke: var(--text-on-blue); } .filter-popover { diff --git a/frappe/public/scss/desk/list.scss b/frappe/public/scss/desk/list.scss index 30bf1d6499..d464e6dec1 100644 --- a/frappe/public/scss/desk/list.scss +++ b/frappe/public/scss/desk/list.scss @@ -378,13 +378,14 @@ input.list-check-all { padding: 0 var(--padding-xs); } - .filter-button { - margin: 5px; - // padding: 4px 8px; + .filter-selector .btn-group { + margin: var(--margin-xs); } .filter-button.btn-primary-light { color: var(--text-on-blue); + outline: 1px solid var(--bg-dark-blue); + z-index: 1; } .sort-selector {