mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-24 06:56:26 +00:00
dots-viewer: Remove containing div when removing last dot file from a folder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8521>
This commit is contained in:
parent
0155655854
commit
ce912c6320
2 changed files with 22 additions and 11 deletions
|
@ -304,17 +304,18 @@ impl GstDots {
|
||||||
let path = path.to_path_buf();
|
let path = path.to_path_buf();
|
||||||
let clients = app_clone.viewer_clients.lock().unwrap();
|
let clients = app_clone.viewer_clients.lock().unwrap();
|
||||||
let clients = clients.clone();
|
let clients = clients.clone();
|
||||||
|
let path = path.to_path_buf();
|
||||||
for client in clients.iter() {
|
let name = app_clone.relative_dot_path(&path);
|
||||||
debug!("Sending to client: {:?}", client);
|
let value =
|
||||||
client.do_send(TextMessage(
|
|
||||||
json!({
|
json!({
|
||||||
"type": "DotRemoved",
|
"type": "DotRemoved",
|
||||||
"name": path.file_name().unwrap().to_str().unwrap(),
|
"name": name,
|
||||||
"creation_time": app_clone.modify_time(&event.paths[0]),
|
"creation_time": app_clone.modify_time(&path),
|
||||||
})
|
});
|
||||||
.to_string(),
|
|
||||||
));
|
for client in clients.iter() {
|
||||||
|
debug!("Sending {value:?} to client: {client:?}");
|
||||||
|
client.do_send(TextMessage(value.to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,11 +214,21 @@ export function connectWs() {
|
||||||
updateSearch();
|
updateSearch();
|
||||||
});
|
});
|
||||||
} else if (obj.type == "DotRemoved") {
|
} else if (obj.type == "DotRemoved") {
|
||||||
|
console.debug(`Trying to remove: ${obj.name}`);
|
||||||
let dot_id = dotId(obj);
|
let dot_id = dotId(obj);
|
||||||
let dot_div = document.getElementById(dot_id);
|
let dot_div = document.getElementById(dot_id);
|
||||||
if (dot_div) {
|
if (dot_div) {
|
||||||
|
let parent = dot_div.parentElement;
|
||||||
|
if (obj.name.includes('/') && parent.childElementCount == 1) {
|
||||||
|
console.info(`Last element in folder, removing parent div for ${dot_id}`);
|
||||||
|
const wrapperDiv = parent.closest('.wrap-collabsible');
|
||||||
|
if (wrapperDiv) {
|
||||||
|
wrapperDiv.remove();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
console.info(`Removing dot_div ${dot_id}`);
|
console.info(`Removing dot_div ${dot_id}`);
|
||||||
dot_div.remove();
|
dot_div.remove();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error(`dot_div ${dot_id} not found`);
|
console.error(`dot_div ${dot_id} not found`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue