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<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| all.find_property_catalogue(entry.as_str()))
|
||||
.filter(Option::is_some)
|
||||
.map(|entry| Requirement::PropertyCatalogue(entry.unwrap()))
|
||||
.map(|entry| match all.find_property_catalogue(entry.as_str()) {
|
||||
Some(contained) => Requirement::PropertyCatalogue(contained),
|
||||
None => Requirement::ExternalPropertyCatalogue(entry),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
@ -125,8 +126,11 @@ impl Requires for DataCatalogue {
|
||||
self.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|entry| match entry {
|
||||
Requirement::PropertyCatalogue(x) => {
|
||||
Some(format!(" + {}\n", x.to_listed_string()))
|
||||
Requirement::PropertyCatalogue(_) => {
|
||||
Some(format!(" + {}\n", entry.to_string()))
|
||||
}
|
||||
Requirement::ExternalPropertyCatalogue(_) => {
|
||||
Some(format!(" + {}\n", entry.to_string()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
|
@ -242,9 +242,10 @@ impl Requires for DataForm {
|
||||
.iter()
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| all.find_data_catalogue(entry.as_str()))
|
||||
.filter(Option::is_some)
|
||||
.map(|entry| Requirement::DataCatalogue(entry.unwrap()))
|
||||
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataCatalogue(contained),
|
||||
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
@ -261,6 +262,10 @@ impl Requires for DataForm {
|
||||
.iter()
|
||||
.map(|inner_entry| match inner_entry {
|
||||
Requirement::PropertyCatalogue(y) => Some(y.to_listed_string()),
|
||||
Requirement::ExternalPropertyCatalogue(name) => Some(format!(
|
||||
"Merkmalskatalog (-) '{}' - hier nicht enthalten",
|
||||
style(name).yellow()
|
||||
)),
|
||||
_ => None,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
@ -274,6 +279,9 @@ impl Requires for DataForm {
|
||||
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||
}
|
||||
}
|
||||
Requirement::ExternalDataCatalogue(_) => {
|
||||
Some(format!(" + {}\n", entry.to_string()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
|
@ -25,10 +25,29 @@
|
||||
use crate::model::data_catalogue::DataCatalogue;
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::property_catalogue::PropertyCatalogue;
|
||||
use crate::model::Listable;
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub enum Requirement<'a> {
|
||||
PropertyCatalogue(&'a PropertyCatalogue),
|
||||
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 {
|
||||
|
@ -265,9 +265,10 @@ impl Requires for Unterformular {
|
||||
.iter()
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| all.find_data_catalogue(entry.as_str()))
|
||||
.filter(Option::is_some)
|
||||
.map(|entry| Requirement::DataCatalogue(entry.unwrap()))
|
||||
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataCatalogue(contained),
|
||||
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
@ -283,7 +284,10 @@ impl Requires for Unterformular {
|
||||
.get_required_entries(all)
|
||||
.iter()
|
||||
.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,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
@ -297,6 +301,9 @@ impl Requires for Unterformular {
|
||||
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||
}
|
||||
}
|
||||
Requirement::ExternalDataCatalogue(_) => {
|
||||
Some(format!(" + {}\n", entry.to_string()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
|
Loading…
x
Reference in New Issue
Block a user