(
&mut self,
collection_id: Uuid,
node_id: Uuid,
cx: &mut Context<Self>,
)
| 563 | |
| 564 | pub fn rename_collection(&mut self, id: Uuid, new_name: &str, cx: &mut Context<Self>) { |
| 565 | if let Some(collection) = self.collections.iter_mut().find(|c| c.id == id) { |
| 566 | collection.name = new_name.to_string(); |
| 567 | self.bump_revision(); |
| 568 | self.save_to_file(); |
| 569 | cx.emit(CollectionsEvent::CollectionUpdated(id)); |
| 570 | cx.notify(); |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | pub fn rename_node( |
| 575 | &mut self, |
| 576 | collection_id: Uuid, |
| 577 | node_id: Uuid, |
| 578 | new_name: &str, |
| 579 | cx: &mut Context<Self>, |
| 580 | ) -> bool { |
| 581 | let Some(collection) = self.collections.iter_mut().find(|c| c.id == collection_id) else { |
| 582 | return false; |
| 583 | }; |
| 584 | |
| 585 | let Some(node) = find_node_mut(&mut collection.nodes, node_id) else { |
| 586 | return false; |
no test coverage detected