mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 19:56:50 +00:00
chore: code cleanup
This commit is contained in:
parent
b4e1113f3d
commit
efa2dc68d6
@ -138,7 +138,7 @@ pub trait Fixable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub fn check_file(file: &Path, password: Option<String>) -> Result<Vec<CheckNotice>, CheckNotice> {
|
pub fn check_file(file: &Path, password: &Option<String>) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
match file.extension() {
|
match file.extension() {
|
||||||
Some(ex) => match ex.to_str() {
|
Some(ex) => match ex.to_str() {
|
||||||
#[cfg(feature = "unzip-osb")]
|
#[cfg(feature = "unzip-osb")]
|
||||||
@ -163,13 +163,6 @@ pub fn check_file(file: &Path, password: Option<String>) -> Result<Vec<CheckNoti
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_checks() {
|
pub fn print_checks() {
|
||||||
println!(
|
|
||||||
"{}",
|
|
||||||
style("Die folgenden Probleme sind bekannt\n")
|
|
||||||
.yellow()
|
|
||||||
.bold()
|
|
||||||
);
|
|
||||||
|
|
||||||
struct Problem<'a> {
|
struct Problem<'a> {
|
||||||
code: &'a str,
|
code: &'a str,
|
||||||
name: &'a str,
|
name: &'a str,
|
||||||
@ -184,15 +177,23 @@ pub fn print_checks() {
|
|||||||
"{} {} {}\n\n{}",
|
"{} {} {}\n\n{}",
|
||||||
style(self.code).bold(),
|
style(self.code).bold(),
|
||||||
style(self.name).underlined(),
|
style(self.name).underlined(),
|
||||||
match self.fixable {
|
if self.fixable {
|
||||||
true => style("(Behebbar)").green(),
|
style("(Behebbar)").green()
|
||||||
false => style("(Nicht behebbar)").red(),
|
} else {
|
||||||
|
style("(Nicht behebbar)").red()
|
||||||
},
|
},
|
||||||
self.description
|
self.description
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"{}",
|
||||||
|
style("Die folgenden Probleme sind bekannt\n")
|
||||||
|
.yellow()
|
||||||
|
.bold()
|
||||||
|
);
|
||||||
|
|
||||||
vec![
|
vec![
|
||||||
Problem {
|
Problem {
|
||||||
code: "2023-0001",
|
code: "2023-0001",
|
||||||
@ -247,5 +248,5 @@ pub fn print_checks() {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|problem| println!("{}\n", problem))
|
.for_each(|problem| println!("{problem}\n"));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ use crate::model::onkostar_editor::OnkostarEditor;
|
|||||||
|
|
||||||
pub fn check_file(file: &Path) -> Result<Vec<CheckNotice>, CheckNotice> {
|
pub fn check_file(file: &Path) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
match fs::read_to_string(file) {
|
match fs::read_to_string(file) {
|
||||||
Ok(content) => check(content),
|
Ok(content) => check(&content),
|
||||||
_ => Err(CheckNotice::Error {
|
_ => Err(CheckNotice::Error {
|
||||||
description: "Kann Datei nicht lesen".to_string(),
|
description: "Kann Datei nicht lesen".to_string(),
|
||||||
line: None,
|
line: None,
|
||||||
@ -35,18 +35,18 @@ pub fn check_file(file: &Path) -> Result<Vec<CheckNotice>, CheckNotice> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check(content: String) -> Result<Vec<CheckNotice>, CheckNotice> {
|
pub fn check(content: &str) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
let mut result = content
|
let mut result = content
|
||||||
.lines()
|
.lines()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.flat_map(|(line, content)| check_line(line, content.to_string()))
|
.flat_map(|(line, content)| check_line(line, content))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let inner_checks = &mut match OnkostarEditor::from_str(content.as_str()) {
|
let inner_checks = &mut match OnkostarEditor::from_str(content) {
|
||||||
Ok(data) => data.check(),
|
Ok(data) => data.check(),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(CheckNotice::Error {
|
return Err(CheckNotice::Error {
|
||||||
description: format!("Interner Fehler: {}", err),
|
description: format!("Interner Fehler: {err}"),
|
||||||
line: None,
|
line: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ pub fn check(content: String) -> Result<Vec<CheckNotice>, CheckNotice> {
|
|||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_line(line: usize, content: String) -> Vec<CheckNotice> {
|
fn check_line(line: usize, content: &str) -> Vec<CheckNotice> {
|
||||||
let mut result = vec![];
|
let mut result = vec![];
|
||||||
|
|
||||||
if content.contains(" </Bezeichnung>") {
|
if content.contains(" </Bezeichnung>") {
|
||||||
@ -67,7 +67,7 @@ fn check_line(line: usize, content: String) -> Vec<CheckNotice> {
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
line: Some(line),
|
line: Some(line),
|
||||||
example: Some(content.trim().to_string()),
|
example: Some(content.trim().to_string()),
|
||||||
}])
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
|
@ -69,7 +69,7 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
osc @ InputFile::Osc { .. } => {
|
osc @ InputFile::Osc { .. } => {
|
||||||
let mut content: OnkostarEditor = osc.try_into()?;
|
let mut content: OnkostarEditor = osc.try_into()?;
|
||||||
if sorted {
|
if sorted {
|
||||||
content.sorted()
|
content.sorted();
|
||||||
}
|
}
|
||||||
if let Some(name) = filter {
|
if let Some(name) = filter {
|
||||||
OnkostarEditor::print_list_filtered(&mut content, name.as_str());
|
OnkostarEditor::print_list_filtered(&mut content, name.as_str());
|
||||||
@ -90,20 +90,20 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
let mut content: OnkostarEditor = match file.try_into() {
|
let mut content: OnkostarEditor = match file.try_into() {
|
||||||
Ok(oe) => oe,
|
Ok(oe) => oe,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
println!("{}", err);
|
println!("{err}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if sorted {
|
if sorted {
|
||||||
content.sorted()
|
content.sorted();
|
||||||
}
|
}
|
||||||
if let Some(name) = filter {
|
if let Some(name) = filter {
|
||||||
OnkostarEditor::print_list_filtered(&mut content, name.as_str());
|
OnkostarEditor::print_list_filtered(&mut content, name.as_str());
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
content.print_list();
|
content.print_list();
|
||||||
println!()
|
println!();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
println!(
|
println!(
|
||||||
@ -131,7 +131,7 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
osc @ InputFile::Osc { .. } => {
|
osc @ InputFile::Osc { .. } => {
|
||||||
let mut content: OnkostarEditor = osc.try_into()?;
|
let mut content: OnkostarEditor = osc.try_into()?;
|
||||||
if sorted {
|
if sorted {
|
||||||
content.sorted()
|
content.sorted();
|
||||||
}
|
}
|
||||||
if let Some(name) = filter {
|
if let Some(name) = filter {
|
||||||
OnkostarEditor::print_tree_filtered(&mut content, name.as_str());
|
OnkostarEditor::print_tree_filtered(&mut content, name.as_str());
|
||||||
@ -165,9 +165,9 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
if let Some(profile) = profile {
|
if let Some(profile) = profile {
|
||||||
let profile = if profile.contains('.') {
|
let profile = if profile.contains('.') {
|
||||||
FileReader::<Profile>::read(profile)?
|
FileReader::<Profile>::read(&profile)?
|
||||||
} else {
|
} else {
|
||||||
Profile::embedded_profile(profile.as_str())?
|
Profile::embedded_profile(&profile)?
|
||||||
};
|
};
|
||||||
|
|
||||||
data.apply_profile(&profile);
|
data.apply_profile(&profile);
|
||||||
@ -243,7 +243,7 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
match outputfile {
|
match outputfile {
|
||||||
Some(filename) => write_outputfile(filename, output)?,
|
Some(filename) => write_outputfile(filename, output)?,
|
||||||
None => {
|
None => {
|
||||||
println!("{}", output)
|
println!("{output}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,8 +258,8 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
style(&inputfile_b).yellow()
|
style(&inputfile_b).yellow()
|
||||||
);
|
);
|
||||||
|
|
||||||
let data_a = &mut FileReader::<OnkostarEditor>::read(inputfile_a)?;
|
let data_a = &mut FileReader::<OnkostarEditor>::read(&inputfile_a)?;
|
||||||
let data_b = &mut FileReader::<OnkostarEditor>::read(inputfile_b)?;
|
let data_b = &mut FileReader::<OnkostarEditor>::read(&inputfile_b)?;
|
||||||
|
|
||||||
data_a.print_diff(data_b, strict);
|
data_a.print_diff(data_b, strict);
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.to_str()
|
.to_str()
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("{}", FileError::Reading(inputfile, err.to_string()));
|
eprintln!("{}", FileError::Reading(inputfile, err.to_string()));
|
||||||
@ -287,7 +287,7 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
if list {
|
if list {
|
||||||
print_checks();
|
print_checks();
|
||||||
} else {
|
} else {
|
||||||
match check_file(Path::new(file.unwrap_or_default().as_str()), password) {
|
match check_file(Path::new(file.unwrap_or_default().as_str()), &password) {
|
||||||
Ok(notices) => {
|
Ok(notices) => {
|
||||||
println!(
|
println!(
|
||||||
"Es wurden {} Probleme gefunden\n",
|
"Es wurden {} Probleme gefunden\n",
|
||||||
@ -301,10 +301,10 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
);
|
);
|
||||||
notices
|
notices
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|check_notice| println!("{}", check_notice));
|
.for_each(|check_notice| println!("{check_notice}"));
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
println!("{}", err)
|
println!("{err}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,10 @@ impl Display for FileError {
|
|||||||
f,
|
f,
|
||||||
"{}",
|
"{}",
|
||||||
match &self {
|
match &self {
|
||||||
FileError::Reading(filename, err) => format!("Kann Datei '{}' nicht lesen: {}", filename, err),
|
FileError::Reading(filename, err) => format!("Kann Datei '{filename}' nicht lesen: {err}"),
|
||||||
FileError::Writing(filename, err) => format!("Kann Datei '{}' nicht schreiben: {}", filename, err),
|
FileError::Writing(filename, err) => format!("Kann Datei '{filename}' nicht schreiben: {err}"),
|
||||||
FileError::Parsing(filename, err) => format!(
|
FileError::Parsing(filename, err) => format!(
|
||||||
"Die Datei '{}' wird nicht unterstützt, ist fehlerhaft oder enthält zusätzliche Inhalte\n{}",
|
"Die Datei '{filename}' wird nicht unterstützt, ist fehlerhaft oder enthält zusätzliche Inhalte\n{err}"
|
||||||
filename,
|
|
||||||
err
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -83,10 +81,10 @@ pub enum InputFile {
|
|||||||
impl InputFile {
|
impl InputFile {
|
||||||
pub fn filename(&self) -> String {
|
pub fn filename(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
InputFile::Osc { filename, .. } => filename,
|
InputFile::Osb { filename, .. }
|
||||||
InputFile::Osb { filename, .. } => filename,
|
| InputFile::Osc { filename, .. }
|
||||||
InputFile::Yaml { filename, .. } => filename,
|
| InputFile::Yaml { filename, .. }
|
||||||
InputFile::Other { filename, .. } => filename,
|
| InputFile::Other { filename, .. } => filename,
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
@ -148,7 +146,7 @@ impl InputFile {
|
|||||||
content: result,
|
content: result,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Some("yml") | Some("yaml") => match fs::read_to_string(filename.clone()) {
|
Some("yml" | "yaml") => match fs::read_to_string(filename.clone()) {
|
||||||
Ok(content) => Ok(InputFile::Yaml { filename, content }),
|
Ok(content) => Ok(InputFile::Yaml { filename, content }),
|
||||||
Err(err) => Err(FileError::Reading(filename, err.to_string())),
|
Err(err) => Err(FileError::Reading(filename, err.to_string())),
|
||||||
},
|
},
|
||||||
@ -208,13 +206,13 @@ pub struct FileReader<FileType> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FileReader<OnkostarEditor> {
|
impl FileReader<OnkostarEditor> {
|
||||||
pub fn read(filename: String) -> Result<OnkostarEditor, FileError> {
|
pub fn read(filename: &str) -> Result<OnkostarEditor, FileError> {
|
||||||
TryInto::<OnkostarEditor>::try_into(InputFile::read(filename.to_string(), None)?)
|
TryInto::<OnkostarEditor>::try_into(InputFile::read(filename.to_string(), None)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileReader<Profile> {
|
impl FileReader<Profile> {
|
||||||
pub fn read(filename: String) -> Result<Profile, FileError> {
|
pub fn read(filename: &str) -> Result<Profile, FileError> {
|
||||||
TryInto::<Profile>::try_into(InputFile::read(filename.to_string(), None)?)
|
TryInto::<Profile>::try_into(InputFile::read(filename.to_string(), None)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,10 @@ impl Listable for DataCatalogue {
|
|||||||
fn to_listed_string(&self) -> String {
|
fn to_listed_string(&self) -> String {
|
||||||
format!(
|
format!(
|
||||||
"Datenkatalog ({}) '{}' in Revision '{}'",
|
"Datenkatalog ({}) '{}' in Revision '{}'",
|
||||||
match self.is_system_library_content() {
|
if self.is_system_library_content() {
|
||||||
true => style("S").yellow(),
|
style("S").yellow()
|
||||||
_ => style("u"),
|
} else {
|
||||||
|
style("u")
|
||||||
},
|
},
|
||||||
style(&self.name).yellow(),
|
style(&self.name).yellow(),
|
||||||
style(&self.revision).yellow()
|
style(&self.revision).yellow()
|
||||||
@ -129,11 +130,9 @@ 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(_) => {
|
Requirement::PropertyCatalogue(_)
|
||||||
Some(format!(" - {}\n", entry))
|
| Requirement::ExternalPropertyCatalogue(_) => {
|
||||||
}
|
Some(format!(" - {entry}\n"))
|
||||||
Requirement::ExternalPropertyCatalogue(_) => {
|
|
||||||
Some(format!(" - {}\n", entry))
|
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
@ -231,7 +230,7 @@ impl Sortable for Entry {
|
|||||||
{
|
{
|
||||||
if let Some(ref mut use_) = self.use_ {
|
if let Some(ref mut use_) = self.use_ {
|
||||||
use_.program_module
|
use_.program_module
|
||||||
.sort_unstable_by_key(|item| item.sorting_key())
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ impl<Type: 'static> FormEntryContainer for Form<Type> {
|
|||||||
.form_references
|
.form_references
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|form_reference| {
|
.for_each(|form_reference| {
|
||||||
apply_profile_to_form_entry(entry, form_reference)
|
apply_profile_to_form_entry(entry, form_reference);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide form field using filter set to "false" if requested and change default value
|
// Hide form field using filter set to "false" if requested and change default value
|
||||||
@ -226,7 +226,7 @@ impl<Type: 'static> FormEntryContainer for Form<Type> {
|
|||||||
column: menu_category.column.clone(),
|
column: menu_category.column.clone(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -241,9 +241,10 @@ impl<Type: 'static> Listable for Form<Type> {
|
|||||||
} else {
|
} else {
|
||||||
"Unterformular"
|
"Unterformular"
|
||||||
},
|
},
|
||||||
match self.is_system_library_content() {
|
if self.is_system_library_content() {
|
||||||
true => style("S").yellow(),
|
style("S").yellow()
|
||||||
_ => style("u"),
|
} else {
|
||||||
|
style("u")
|
||||||
},
|
},
|
||||||
style(&self.name).yellow(),
|
style(&self.name).yellow(),
|
||||||
style(&self.revision).yellow()
|
style(&self.revision).yellow()
|
||||||
|
@ -323,7 +323,7 @@ where
|
|||||||
entry.update_scripts_code(scripts_code.clone());
|
entry.update_scripts_code(scripts_code.clone());
|
||||||
}
|
}
|
||||||
if form_reference.remove_filter {
|
if form_reference.remove_filter {
|
||||||
entry.remove_filter()
|
entry.remove_filter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,16 +334,16 @@ where
|
|||||||
{
|
{
|
||||||
if entry.get_name() == form_field.name {
|
if entry.get_name() == form_field.name {
|
||||||
if form_field.hide {
|
if form_field.hide {
|
||||||
entry.hide()
|
entry.hide();
|
||||||
}
|
}
|
||||||
if let Some(new_default_value) = &form_field.default_value {
|
if let Some(new_default_value) = &form_field.default_value {
|
||||||
entry.update_default_value(new_default_value.to_string())
|
entry.update_default_value(new_default_value.to_string());
|
||||||
}
|
}
|
||||||
if let Some(scripts_code) = &form_field.escaped_scripts_code() {
|
if let Some(scripts_code) = &form_field.escaped_scripts_code() {
|
||||||
entry.update_scripts_code(scripts_code.clone());
|
entry.update_scripts_code(scripts_code.clone());
|
||||||
}
|
}
|
||||||
if form_field.remove_filter {
|
if form_field.remove_filter {
|
||||||
entry.remove_filter()
|
entry.remove_filter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ pub trait Comparable: Debug {
|
|||||||
fn get_revision(&self) -> u16;
|
fn get_revision(&self) -> u16;
|
||||||
fn get_hash(&self) -> String {
|
fn get_hash(&self) -> String {
|
||||||
let mut h = DefaultHasher::new();
|
let mut h = DefaultHasher::new();
|
||||||
format!("{:?}", self).hash(&mut h);
|
format!("{self:?}").hash(&mut h);
|
||||||
h.finish().to_string()
|
h.finish().to_string()
|
||||||
}
|
}
|
||||||
fn compare_by_requirement(_: &Self, _: &Self) -> Ordering
|
fn compare_by_requirement(_: &Self, _: &Self) -> Ordering
|
||||||
|
@ -381,7 +381,7 @@ impl OnkostarEditor {
|
|||||||
);
|
);
|
||||||
has_diff = true;
|
has_diff = true;
|
||||||
} else if strict {
|
} else if strict {
|
||||||
println!("{}: {}", entry_a.get_name(), style("Identisch").green())
|
println!("{}: {}", entry_a.get_name(), style("Identisch").green());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,7 +390,7 @@ impl OnkostarEditor {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if !has_diff {
|
if !has_diff {
|
||||||
println!("Keine Unterschiede")
|
println!("Keine Unterschiede");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,12 +464,12 @@ impl Checkable for OnkostarEditor {
|
|||||||
.for_each(|entry| match entry {
|
.for_each(|entry| match entry {
|
||||||
Requirement::DataFormReference(item) => {
|
Requirement::DataFormReference(item) => {
|
||||||
if !requirement_checked_forms.contains(&item.get_name()) {
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
result.push(requirement_error(form, *item, "Formular"))
|
result.push(requirement_error(form, *item, "Formular"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Requirement::UnterformularReference(item) => {
|
Requirement::UnterformularReference(item) => {
|
||||||
if !requirement_checked_forms.contains(&item.get_name()) {
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
result.push(requirement_error(form, *item, "Unterformular"))
|
result.push(requirement_error(form, *item, "Unterformular"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -483,12 +483,12 @@ impl Checkable for OnkostarEditor {
|
|||||||
.for_each(|entry| match entry {
|
.for_each(|entry| match entry {
|
||||||
Requirement::DataFormReference(item) => {
|
Requirement::DataFormReference(item) => {
|
||||||
if !requirement_checked_forms.contains(&item.get_name()) {
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
result.push(requirement_error(form, *item, "Formular"))
|
result.push(requirement_error(form, *item, "Formular"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Requirement::UnterformularReference(item) => {
|
Requirement::UnterformularReference(item) => {
|
||||||
if !requirement_checked_forms.contains(&item.get_name()) {
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
result.push(requirement_error(form, *item, "Unterformular"))
|
result.push(requirement_error(form, *item, "Unterformular"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -528,7 +528,7 @@ impl FormEntry for Entry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn update_default_value(&mut self, value: String) {
|
fn update_default_value(&mut self, value: String) {
|
||||||
self.default_value = value
|
self.default_value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hide(&mut self) {
|
fn hide(&mut self) {
|
||||||
@ -537,7 +537,7 @@ impl FormEntry for Entry {
|
|||||||
valid: true,
|
valid: true,
|
||||||
ref_entries: Some(RefEntries { ref_entry: None }),
|
ref_entries: Some(RefEntries { ref_entry: None }),
|
||||||
});
|
});
|
||||||
self.speichern = "0".into()
|
self.speichern = "0".into();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_filter(&mut self) {
|
fn remove_filter(&mut self) {
|
||||||
@ -557,7 +557,7 @@ impl Sortable for Entry {
|
|||||||
if let Some(ref mut filter) = self.filter {
|
if let Some(ref mut filter) = self.filter {
|
||||||
if let Some(ref mut ref_entries) = filter.ref_entries {
|
if let Some(ref mut ref_entries) = filter.ref_entries {
|
||||||
if let Some(ref mut ref_entry) = ref_entries.ref_entry {
|
if let Some(ref mut ref_entry) = ref_entries.ref_entry {
|
||||||
ref_entry.sort_unstable()
|
ref_entry.sort_unstable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,21 +73,21 @@ impl Display for Requirement<'_> {
|
|||||||
Requirement::DataFormSubform(item) => item.to_listed_string(),
|
Requirement::DataFormSubform(item) => item.to_listed_string(),
|
||||||
Requirement::UnterformularSubform(item) => item.to_listed_string(),
|
Requirement::UnterformularSubform(item) => item.to_listed_string(),
|
||||||
Requirement::ExternalPropertyCatalogue(name) => {
|
Requirement::ExternalPropertyCatalogue(name) => {
|
||||||
format!("Merkmalskatalog (-) '{}' - hier nicht enthalten", name)
|
format!("Merkmalskatalog (-) '{name}' - hier nicht enthalten")
|
||||||
}
|
}
|
||||||
Requirement::ExternalDataCatalogue(name) => {
|
Requirement::ExternalDataCatalogue(name) => {
|
||||||
format!("Datenkatalog (-) '{}' - hier nicht enthalten", name)
|
format!("Datenkatalog (-) '{name}' - hier nicht enthalten")
|
||||||
}
|
}
|
||||||
Requirement::ExternalDataFormReference(name)
|
Requirement::ExternalDataFormReference(name)
|
||||||
| Requirement::ExternalDataFormSubform(name) => {
|
| Requirement::ExternalDataFormSubform(name) => {
|
||||||
format!("Formular (-) '{}' - hier nicht enthalten", name)
|
format!("Formular (-) '{name}' - hier nicht enthalten")
|
||||||
}
|
}
|
||||||
Requirement::ExternalUnterformularReference(name)
|
Requirement::ExternalUnterformularReference(name)
|
||||||
| Requirement::ExternalUnterformularSubform(name) => {
|
| Requirement::ExternalUnterformularSubform(name) => {
|
||||||
format!("Unterformular (-) '{}' - hier nicht enthalten", name)
|
format!("Unterformular (-) '{name}' - hier nicht enthalten")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
write!(f, "{}", str)
|
write!(f, "{str}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,19 +134,19 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Requirement::ExternalDataCatalogue(_) => {
|
Requirement::ExternalDataCatalogue(_) => {
|
||||||
Some(format!(" + {}\n", entry))
|
Some(format!(" + {entry}\n"))
|
||||||
}
|
}
|
||||||
Requirement::DataFormReference(_)
|
Requirement::DataFormReference(_)
|
||||||
| Requirement::ExternalDataFormReference(_)
|
| Requirement::ExternalDataFormReference(_)
|
||||||
| Requirement::UnterformularReference(_)
|
| Requirement::UnterformularReference(_)
|
||||||
| Requirement::ExternalUnterformularReference(_) => {
|
| Requirement::ExternalUnterformularReference(_) => {
|
||||||
Some(format!(" > {}\n", entry))
|
Some(format!(" > {entry}\n"))
|
||||||
}
|
}
|
||||||
Requirement::DataFormSubform(_)
|
Requirement::DataFormSubform(_)
|
||||||
| Requirement::ExternalDataFormSubform(_)
|
| Requirement::ExternalDataFormSubform(_)
|
||||||
| Requirement::UnterformularSubform(_)
|
| Requirement::UnterformularSubform(_)
|
||||||
| Requirement::ExternalUnterformularSubform(_) => {
|
| Requirement::ExternalUnterformularSubform(_) => {
|
||||||
Some(format!(" * {}\n", entry))
|
Some(format!(" * {entry}\n"))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user