mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 19:56:50 +00:00
Mark system library content
This commit is contained in:
parent
0b0188bd30
commit
a8851c5e4f
@ -29,7 +29,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::requirements::{Requirement, Requires};
|
||||
use crate::model::{Comparable, Listable, Ordner, Sortable};
|
||||
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@ -63,7 +63,11 @@ pub struct DataCatalogue {
|
||||
impl Listable for DataCatalogue {
|
||||
fn to_listed_string(&self) -> String {
|
||||
format!(
|
||||
"Datenkatalog '{}' in Revision '{}'",
|
||||
"Datenkatalog ({}) '{}' in Revision '{}'",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
@ -116,9 +120,8 @@ impl Requires for DataCatalogue {
|
||||
|
||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||
format!(
|
||||
"Datenkatalog '{}' in Revision '{}'\n{}",
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow(),
|
||||
"{}\n{}",
|
||||
self.to_listed_string(),
|
||||
self.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|entry| match entry {
|
||||
@ -135,6 +138,12 @@ impl Requires for DataCatalogue {
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for DataCatalogue {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Entries {
|
||||
|
@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::requirements::{Requirement, Requires};
|
||||
use crate::model::{
|
||||
apply_profile_to_form_entry, Ansichten, Comparable, Entries, Filter, FormEntry,
|
||||
apply_profile_to_form_entry, Ansichten, Comparable, Entries, Filter, FolderContent, FormEntry,
|
||||
FormEntryContainer, Listable, MenuCategory, PlausibilityRules, Script, Sortable,
|
||||
};
|
||||
use crate::model::{Haeufigkeiten, Ordner};
|
||||
@ -185,7 +185,11 @@ impl FormEntryContainer for DataForm {
|
||||
impl Listable for DataForm {
|
||||
fn to_listed_string(&self) -> String {
|
||||
format!(
|
||||
"Formular '{}' in Revision '{}'",
|
||||
"Formular ({}) '{}' in Revision '{}'",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
@ -246,9 +250,8 @@ impl Requires for DataForm {
|
||||
|
||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||
format!(
|
||||
"Formular '{}' in Revision '{}'\n{}",
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow(),
|
||||
"{}\n{}",
|
||||
self.to_listed_string(),
|
||||
self.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|entry| match entry {
|
||||
@ -281,6 +284,12 @@ impl Requires for DataForm {
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for DataForm {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct DataCatalogues {
|
||||
|
@ -268,3 +268,11 @@ pub trait FormEntry {
|
||||
fn update_anzeige_auswahl(&mut self, value: String);
|
||||
fn update_scripts_code(&mut self, value: String);
|
||||
}
|
||||
|
||||
pub trait FolderContent {
|
||||
fn get_library_folder(&self) -> String;
|
||||
|
||||
fn is_system_library_content(&self) -> bool {
|
||||
"ONKOSTAR Bibliothek" == self.get_library_folder()
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,11 @@ impl OnkostarEditor {
|
||||
}
|
||||
|
||||
fn print_items(title: &str, list: &[impl Listable]) {
|
||||
println!("\n{} {}", list.len(), style(title).underlined());
|
||||
print!("\n{} {}", list.len(), style(title).underlined());
|
||||
println!(
|
||||
" - Inhalte der Systembibliothek sind mit ({}) markiert",
|
||||
style("S").yellow()
|
||||
);
|
||||
list.iter()
|
||||
.for_each(|entry| println!("{}", entry.to_listed_string()));
|
||||
}
|
||||
@ -117,7 +121,11 @@ impl OnkostarEditor {
|
||||
}
|
||||
|
||||
fn print_items_tree(&self, title: &str, list: &[impl Requires]) {
|
||||
println!("\n{} {}", list.len(), style(title).underlined());
|
||||
print!("\n{} {}", list.len(), style(title).underlined());
|
||||
println!(
|
||||
" - Inhalte der Systembibliothek sind mit ({}) markiert",
|
||||
style("S").yellow()
|
||||
);
|
||||
list.iter()
|
||||
.for_each(|entry| println!("{}", entry.to_requirement_string(self)));
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
use console::style;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::model::{Comparable, Listable, Ordner, Sortable};
|
||||
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@ -56,7 +56,11 @@ pub struct PropertyCatalogue {
|
||||
impl Listable for PropertyCatalogue {
|
||||
fn to_listed_string(&self) -> String {
|
||||
format!(
|
||||
"Merkmalskatalog '{}' in Revision '{}'",
|
||||
"Merkmalskatalog ({}) '{}' in Revision '{}'",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
@ -89,6 +93,12 @@ impl Comparable for PropertyCatalogue {
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for PropertyCatalogue {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Versions {
|
||||
|
@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::requirements::{Requirement, Requires};
|
||||
use crate::model::{
|
||||
apply_profile_to_form_entry, Ansichten, Comparable, Entries, Filter, FormEntry,
|
||||
apply_profile_to_form_entry, Ansichten, Comparable, Entries, Filter, FolderContent, FormEntry,
|
||||
FormEntryContainer, Listable, MenuCategory, PlausibilityRules, Script, Sortable,
|
||||
};
|
||||
use crate::model::{Haeufigkeiten, Ordner};
|
||||
@ -197,14 +197,22 @@ impl Listable for Unterformular {
|
||||
fn to_listed_string(&self) -> String {
|
||||
if self.hat_unterformulare {
|
||||
return format!(
|
||||
"Unterformular '{}' in Revision '{}' {}",
|
||||
"Unterformular ({}) '{}' in Revision '{}' {}",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow(),
|
||||
style("Unterformular mit Markierung 'hat Unterformulare'!").red()
|
||||
);
|
||||
}
|
||||
format!(
|
||||
"Unterformular '{}' in Revision '{}'",
|
||||
"Unterformular ({}) '{}' in Revision '{}'",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
@ -265,9 +273,8 @@ impl Requires for Unterformular {
|
||||
|
||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||
format!(
|
||||
"Unterformular '{}' in Revision '{}'\n{}",
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow(),
|
||||
"{}\n{}",
|
||||
self.to_listed_string(),
|
||||
self.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|entry| match entry {
|
||||
@ -300,6 +307,12 @@ impl Requires for Unterformular {
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for Unterformular {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct DataCatalogues {
|
||||
|
Loading…
x
Reference in New Issue
Block a user