mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 19:56:50 +00:00
Show required dependencies not included in OSC file
This commit is contained in:
parent
af4ec8898a
commit
f507893b4d
@ -112,9 +112,10 @@ impl Requires for DataCatalogue {
|
|||||||
})
|
})
|
||||||
.collect::<HashSet<_>>()
|
.collect::<HashSet<_>>()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|entry| all.find_property_catalogue(entry.as_str()))
|
.map(|entry| match all.find_property_catalogue(entry.as_str()) {
|
||||||
.filter(Option::is_some)
|
Some(contained) => Requirement::PropertyCatalogue(contained),
|
||||||
.map(|entry| Requirement::PropertyCatalogue(entry.unwrap()))
|
None => Requirement::ExternalPropertyCatalogue(entry),
|
||||||
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,8 +126,11 @@ impl Requires for DataCatalogue {
|
|||||||
self.get_required_entries(all)
|
self.get_required_entries(all)
|
||||||
.iter()
|
.iter()
|
||||||
.map(|entry| match entry {
|
.map(|entry| match entry {
|
||||||
Requirement::PropertyCatalogue(x) => {
|
Requirement::PropertyCatalogue(_) => {
|
||||||
Some(format!(" + {}\n", x.to_listed_string()))
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
|
Requirement::ExternalPropertyCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
|
@ -242,9 +242,10 @@ impl Requires for DataForm {
|
|||||||
.iter()
|
.iter()
|
||||||
.collect::<HashSet<_>>()
|
.collect::<HashSet<_>>()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|entry| all.find_data_catalogue(entry.as_str()))
|
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||||
.filter(Option::is_some)
|
Some(contained) => Requirement::DataCatalogue(contained),
|
||||||
.map(|entry| Requirement::DataCatalogue(entry.unwrap()))
|
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||||
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +262,10 @@ impl Requires for DataForm {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|inner_entry| match inner_entry {
|
.map(|inner_entry| match inner_entry {
|
||||||
Requirement::PropertyCatalogue(y) => Some(y.to_listed_string()),
|
Requirement::PropertyCatalogue(y) => Some(y.to_listed_string()),
|
||||||
|
Requirement::ExternalPropertyCatalogue(name) => Some(format!(
|
||||||
|
"Merkmalskatalog (-) '{}' - hier nicht enthalten",
|
||||||
|
style(name).yellow()
|
||||||
|
)),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.filter(Option::is_some)
|
.filter(Option::is_some)
|
||||||
@ -274,6 +279,9 @@ impl Requires for DataForm {
|
|||||||
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Requirement::ExternalDataCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.filter(Option::is_some)
|
.filter(Option::is_some)
|
||||||
|
@ -25,10 +25,29 @@
|
|||||||
use crate::model::data_catalogue::DataCatalogue;
|
use crate::model::data_catalogue::DataCatalogue;
|
||||||
use crate::model::onkostar_editor::OnkostarEditor;
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
use crate::model::property_catalogue::PropertyCatalogue;
|
use crate::model::property_catalogue::PropertyCatalogue;
|
||||||
|
use crate::model::Listable;
|
||||||
|
|
||||||
|
#[allow(clippy::enum_variant_names)]
|
||||||
pub enum Requirement<'a> {
|
pub enum Requirement<'a> {
|
||||||
PropertyCatalogue(&'a PropertyCatalogue),
|
PropertyCatalogue(&'a PropertyCatalogue),
|
||||||
DataCatalogue(&'a DataCatalogue),
|
DataCatalogue(&'a DataCatalogue),
|
||||||
|
ExternalPropertyCatalogue(String),
|
||||||
|
ExternalDataCatalogue(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToString for Requirement<'_> {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
Requirement::PropertyCatalogue(item) => item.to_listed_string(),
|
||||||
|
Requirement::DataCatalogue(item) => item.to_listed_string(),
|
||||||
|
Requirement::ExternalPropertyCatalogue(name) => {
|
||||||
|
format!("Merkmalskatalog (-) '{}' - hier nicht enthalten", name)
|
||||||
|
}
|
||||||
|
Requirement::ExternalDataCatalogue(name) => {
|
||||||
|
format!("Datenkatalog (-) '{}' - hier nicht enthalten", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Requires {
|
pub trait Requires {
|
||||||
|
@ -265,9 +265,10 @@ impl Requires for Unterformular {
|
|||||||
.iter()
|
.iter()
|
||||||
.collect::<HashSet<_>>()
|
.collect::<HashSet<_>>()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|entry| all.find_data_catalogue(entry.as_str()))
|
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||||
.filter(Option::is_some)
|
Some(contained) => Requirement::DataCatalogue(contained),
|
||||||
.map(|entry| Requirement::DataCatalogue(entry.unwrap()))
|
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||||
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +284,10 @@ impl Requires for Unterformular {
|
|||||||
.get_required_entries(all)
|
.get_required_entries(all)
|
||||||
.iter()
|
.iter()
|
||||||
.map(|inner_entry| match inner_entry {
|
.map(|inner_entry| match inner_entry {
|
||||||
Requirement::PropertyCatalogue(y) => Some(y.to_listed_string()),
|
Requirement::PropertyCatalogue(_) => Some(inner_entry.to_string()),
|
||||||
|
Requirement::ExternalPropertyCatalogue(_) => {
|
||||||
|
Some(inner_entry.to_string())
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.filter(Option::is_some)
|
.filter(Option::is_some)
|
||||||
@ -297,6 +301,9 @@ impl Requires for Unterformular {
|
|||||||
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Requirement::ExternalDataCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.filter(Option::is_some)
|
.filter(Option::is_some)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user