(
&mut self,
collection_id: Uuid,
parent_folder_id: Option<Uuid>,
name: &str,
cx: &mut Context<Self>,
)
| 514 | /// to rebuild their virtualized snapshots only when the source data changes. |
| 515 | pub fn revision(&self) -> u64 { |
| 516 | self.revision |
| 517 | } |
| 518 | |
| 519 | pub fn create_collection(&mut self, name: &str, cx: &mut Context<Self>) -> Uuid { |
| 520 | let collection = Collection::new(name); |
| 521 | let id = collection.id; |
| 522 | self.collections.push(collection); |
| 523 | self.bump_revision(); |
| 524 | self.save_to_file(); |
| 525 | cx.emit(CollectionsEvent::CollectionAdded(id)); |
| 526 | cx.notify(); |
| 527 | id |
| 528 | } |
| 529 | |
| 530 | pub fn import_collection( |
| 531 | &mut self, |
| 532 | imported: ImportedCollection, |
| 533 | cx: &mut Context<Self>, |
| 534 | ) -> Uuid { |
| 535 | let collection = Collection { |
| 536 | id: Uuid::new_v4(), |
| 537 | name: imported.name, |
| 538 | nodes: imported |
| 539 | .nodes |
| 540 | .into_iter() |
| 541 | .map(CollectionNode::from_imported_node) |
| 542 | .collect(), |
no test coverage detected