Compare commits

...

14 Commits

Author SHA1 Message Date
contributor
22c5428c42
Merge d51a0d415bb552ff7dc35547e06dbe83d9df4b8a into a867a25d5f09e410d0c73b7fbeab18b4641f484a 2025-12-02 12:11:35 +00:00
contributor
d51a0d415b fix auto generated data-list-item-id attributes in docs 2025-11-26 10:25:51 +02:00
contributor
a79c8b4add add autoExecuteSearch user guide docs 2025-11-26 10:25:51 +02:00
contributor
b359b48ec3 add attribute autoExecuteSearch help string 2025-11-26 10:25:51 +02:00
contributor
a0e1cc4154 add autoExecuteSearch label typing 2025-11-26 10:21:10 +02:00
contributor
625c0ed7dc do not activate collections tab for empty search result 2025-11-26 00:45:47 +02:00
contributor
1ac241ad1b tidy up code 2025-11-26 00:45:47 +02:00
contributor
2c447a4293 use module level var instead of sessionStorage 2025-11-26 00:45:47 +02:00
contributor
6c1886c5ca do not activate collections tab for mobile 2025-11-26 00:45:47 +02:00
contributor
9c86145ff8 use session storage for state
f2
2025-11-26 00:45:46 +02:00
contributor
6dcc3a7e81 only exec for search note type 2025-11-26 00:45:46 +02:00
contributor
921b56a89e use search results for state 2025-11-26 00:45:46 +02:00
contributor
9d0b532aeb fixing first tab cannot be open 2025-11-26 00:45:46 +02:00
contributor
cc468d964f add ability to auto execute search note 2025-11-26 00:45:46 +02:00
5 changed files with 34 additions and 2 deletions

View File

@ -386,6 +386,7 @@
"workspace_template": "This note will appear in the selection of available template when creating new note, but only when hoisted into a workspace containing this template",
"search_home": "new search notes will be created as children of this note",
"workspace_search_home": "new search notes will be created as children of this note when hoisted to some ancestor of this workspace note",
"auto_execute_search": "Automatically executes the search defined in a saved search note and switches to the Collection Properties tab if any notes match the query",
"inbox": "default inbox location for new notes - when you create a note using \"new note\" button in the sidebar, notes will be created as child notes in the note marked as with <code>#inbox</code> label.",
"workspace_inbox": "default inbox location for new notes when hoisted to some ancestor of this workspace note",
"sql_console_home": "default location of SQL console notes",

View File

@ -236,6 +236,7 @@ const ATTR_HELP: Record<string, Record<string, string>> = {
workspaceTemplate: t("attribute_detail.workspace_template"),
searchHome: t("attribute_detail.search_home"),
workspaceSearchHome: t("attribute_detail.workspace_search_home"),
autoExecuteSearch: t("attribute_detail.auto_execute_search"),
inbox: t("attribute_detail.inbox"),
workspaceInbox: t("attribute_detail.workspace_inbox"),
sqlConsoleHome: t("attribute_detail.sql_console_home"),

View File

@ -22,7 +22,7 @@ import RenameNoteBulkAction from "../bulk_actions/note/rename_note";
import { getErrorMessage } from "../../services/utils";
import "./SearchDefinitionTab.css";
export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext) {
export default function SearchDefinitionTab({ note, ntxId, hidden, noteContext }: TabContext) {
const parentComponent = useContext(ParentComponent);
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
const [ error, setError ] = useState<{ message: string }>();
@ -73,6 +73,27 @@ export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext)
}
});
useEffect(() => {
async function autoExecute() {
if (!note || note.type !== "search" || !note.hasLabel("autoExecuteSearch")) {
executionState.save("");
return;
}
const lastExecutedNoteId = executionState.load();
if (lastExecutedNoteId !== note.noteId) {
executionState.save(note.noteId);
await refreshResults();
if (noteContext?.viewScope?.viewMode === "default" && note.children.length > 0) {
parentComponent?.triggerCommand("toggleRibbonTabBookProperties", {});
}
}
}
autoExecute();
}, [note]);
return (
<div className="search-definition-widget">
<div className="search-settings">
@ -160,6 +181,14 @@ export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext)
)
}
const executionState = function() {
let lastAutoExecutedSearchNoteId = "";
return {
load: () => lastAutoExecutedSearchNoteId,
save: (noteId: string) => lastAutoExecutedSearchNoteId = noteId,
};
}();
function BulkActionsList({ note }: { note: FNote }) {
const [ bulkActions, setBulkActions ] = useState<RenameNoteBulkAction[]>();

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@ type Labels = {
ancestorDepth: string;
orderBy: string;
orderDirection: string;
autoExecuteSearch: boolean;
// Collection-specific
viewType: string;