[fix](trx-frontend-http): add Default impl for BookmarkStoreMap, merge bookmarks in scheduler
Fix clippy warning by adding Default impl for BookmarkStoreMap. Scheduler bookmark picker now fetches both general and rig-specific bookmarks and merges them so all available bookmarks are shown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -106,9 +106,18 @@
|
||||
}
|
||||
|
||||
function apiGetBookmarks() {
|
||||
return fetch("/bookmarks").then(function (r) {
|
||||
if (!r.ok) throw new Error("HTTP " + r.status);
|
||||
return r.json();
|
||||
// Fetch general bookmarks and rig-specific bookmarks, then merge.
|
||||
// Rig-specific entries win on duplicate IDs.
|
||||
var urls = ["/bookmarks"];
|
||||
if (currentRigId) urls.push("/bookmarks?scope=" + encodeURIComponent(currentRigId));
|
||||
return Promise.all(urls.map(function (u) {
|
||||
return fetch(u).then(function (r) { return r.ok ? r.json() : []; });
|
||||
})).then(function (results) {
|
||||
var byId = {};
|
||||
results.forEach(function (list) {
|
||||
(Array.isArray(list) ? list : []).forEach(function (bm) { byId[bm.id] = bm; });
|
||||
});
|
||||
return Object.values(byId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,12 @@ pub struct BookmarkStoreMap {
|
||||
rig_stores: Mutex<HashMap<String, Arc<BookmarkStore>>>,
|
||||
}
|
||||
|
||||
impl Default for BookmarkStoreMap {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl BookmarkStoreMap {
|
||||
pub fn new() -> Self {
|
||||
let general_path = BookmarkStore::general_path();
|
||||
|
||||
Reference in New Issue
Block a user