Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
  • Loading branch information
luca-della-vedova committed Jul 25, 2023
1 parent cc84c6d commit 452b884
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
7 changes: 5 additions & 2 deletions rmf_site_editor/src/site/deletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct DeletionParams<'w, 's> {
levels: Query<'w, 's, Entity, With<LevelProperties>>,
select: EventWriter<'w, 's, Select>,
log: EventWriter<'w, 's, Log>,
issues: Query<'w, 's, &'static mut Issue>,
issues: Query<'w, 's, (Entity, &'static mut Issue)>,
}

pub struct DeletionPlugin;
Expand Down Expand Up @@ -224,8 +224,11 @@ fn cautious_delete(element: Entity, params: &mut DeletionParams) {
}
}

for mut issue in &mut params.issues {
for (e, mut issue) in &mut params.issues {
issue.key.entities.remove(&element);
if issue.key.entities.is_empty() {
params.commands.entity(e).despawn_recursive();
}
}

// Fetch the parent and delete this dependent
Expand Down
2 changes: 1 addition & 1 deletion rmf_site_editor/src/site/lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ pub fn handle_consider_associated_graph(
}
}

/// Unique UUID to identify issue of duplicated door names
/// Unique UUID to identify issue of duplicated dock names
pub const DUPLICATED_DOCK_NAME_ISSUE_UUID: Uuid =
Uuid::from_u128(0xca210e1025014ac2a4072bc956d76151u128);

Expand Down
14 changes: 4 additions & 10 deletions rmf_site_editor/src/widgets/diagnostic_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use bevy::ecs::system::SystemParam;
use bevy::prelude::*;
use bevy_egui::egui::{Button, Checkbox, Context, Grid, ImageButton, ScrollArea, Window};

#[derive(Resource, Debug, Clone)]
#[derive(Resource, Debug, Clone, Default)]
pub struct DiagnosticWindowState {
pub show: bool,
pub selected: Option<IssueKey<Entity>>,
Expand All @@ -39,15 +39,6 @@ pub struct DiagnosticParams<'w, 's> {
pub issues: Query<'w, 's, (&'static Issue, &'static Parent)>,
}

impl Default for DiagnosticWindowState {
fn default() -> Self {
Self {
show: true,
selected: None,
}
}
}

pub struct DiagnosticWindow<'a, 'w1, 's1, 'w2, 's2> {
events: &'a mut AppEvents<'w1, 's1>,
params: &'a mut DiagnosticParams<'w2, 's2>,
Expand Down Expand Up @@ -134,6 +125,9 @@ impl<'a, 'w1, 's1, 'w2, 's2> DiagnosticWindow<'a, 'w1, 's1, 'w2, 's2> {
.auto_shrink([false, false])
.show(ui, |ui| {
let mut issue_still_exists = false;
if self.params.issues.is_empty() {
ui.label("No issues found");
}
for (issue, parent) in &self.params.issues {
if props.filtered_issue_kinds.contains(&issue.key.kind)
|| props.filtered_issues.contains(&issue.key)
Expand Down

0 comments on commit 452b884

Please sign in to comment.