feat(UX): refresh URL when updating filters
This commit is contained in:
parent
bd2f2bcae9
commit
23bd9749f6
1 changed files with 5 additions and 29 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue