forked from Plugin-JF-Onkostar/osc-variant
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c07d4c8976 | |||
| 3ec51099c7 | |||
| 1e7a95bb09 | |||
| abdef90e90 | |||
| a2df2650ed | |||
| f947395c54 | |||
| d3d4ec2646 | |||
| f507893b4d | |||
| af4ec8898a | |||
| 7d6a6ee9b3 | |||
| a605018176 | |||
| a8851c5e4f | |||
| 0b0188bd30 | |||
| 1e553aad58 | |||
| f9c66cfdb1 | |||
| 103075ab78 | |||
| 37c8b47d1f | |||
| d83fa34adb | |||
| 5c91e4d10f | |||
| e84a39b7c4 | |||
| 376bfb2852 | |||
| ad35b99371 | |||
| 224a7dba27 | |||
| 62ab073cfa | |||
| b2adb3c5fe | |||
| a8911f86dd | |||
| b030ce6a53 | |||
| b04ee563f2 | |||
| 6e266feaf5 |
109
Cargo.lock
generated
109
Cargo.lock
generated
@@ -4,27 +4,15 @@ version = 3
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "anstyle"
|
||||||
version = "1.0.0"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
|
checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "autocfg"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitflags"
|
|
||||||
version = "1.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.3.4"
|
version = "4.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed"
|
checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@@ -33,20 +21,19 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.3.4"
|
version = "4.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636"
|
checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"bitflags",
|
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.3.2"
|
version = "4.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
|
checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -56,9 +43,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
@@ -80,10 +67,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "equivalent"
|
||||||
version = "0.12.3"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@@ -93,19 +86,19 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.9.3"
|
version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.6"
|
version = "1.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
@@ -115,15 +108,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.146"
|
version = "0.2.147"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
|
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.5.0"
|
version = "2.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
@@ -133,7 +126,7 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "osc-variant"
|
name = "osc-variant"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"console",
|
"console",
|
||||||
@@ -145,18 +138,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.60"
|
version = "1.0.66"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
|
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.28.2"
|
version = "0.30.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
|
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -164,33 +157,33 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.28"
|
version = "1.0.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
|
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.13"
|
version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.164"
|
version = "1.0.188"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
|
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.164"
|
version = "1.0.188"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
|
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -199,9 +192,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.9.21"
|
version = "0.9.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c"
|
checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -212,9 +205,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.18"
|
version = "2.0.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
|
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -223,9 +216,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.9"
|
version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
|
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
@@ -235,9 +228,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unsafe-libyaml"
|
name = "unsafe-libyaml"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6"
|
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
@@ -307,6 +300,6 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xml-rs"
|
name = "xml-rs"
|
||||||
version = "0.8.14"
|
version = "0.8.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c"
|
checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1"
|
||||||
|
|||||||
11
Cargo.toml
11
Cargo.toml
@@ -1,13 +1,17 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "osc-variant"
|
name = "osc-variant"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
authors = ["Paul-Christian Volkmer <volkmer_p@ukw.de>"]
|
||||||
|
description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort"
|
||||||
|
license = "MIT"
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.3", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
clap = { version = "4.3", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_yaml = "0.9"
|
serde_yaml = "0.9"
|
||||||
quick-xml = { version = "0.28", features = ["escape-html", "serialize"], default-features=false }
|
quick-xml = { version = "0.30", features = ["escape-html", "serialize"], default-features = false }
|
||||||
xml-rs = "0.8"
|
xml-rs = "0.8"
|
||||||
console = "0.15"
|
console = "0.15"
|
||||||
|
|
||||||
@@ -17,3 +21,6 @@ codegen-units = 1
|
|||||||
lto = "thin"
|
lto = "thin"
|
||||||
strip = true
|
strip = true
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
||||||
|
[package.metadata.deb]
|
||||||
|
copyright = "Copyright (c) 2023 Comprehensive Cancer Center Mainfranken"
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -38,7 +38,11 @@ win-binary-x86_64:
|
|||||||
linux-binary-x86_64:
|
linux-binary-x86_64:
|
||||||
cargo build --release --target=x86_64-unknown-linux-gnu
|
cargo build --release --target=x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
.PHONE: clean
|
.PHONY: install
|
||||||
|
install:
|
||||||
|
cargo install --path .
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
cargo clean
|
cargo clean
|
||||||
rm -rf osc-variant 2>/dev/null || true
|
rm -rf osc-variant 2>/dev/null || true
|
||||||
|
|||||||
49
README.md
49
README.md
@@ -22,6 +22,29 @@ Zum Auflisten der Inhalte einer Datei wird folgender Befehl verwendet:
|
|||||||
osc-variant list meine-beispieldatei.osc
|
osc-variant list meine-beispieldatei.osc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Zum Auflisten der Inhalte mit allen Abhängigkeiten, z.B. Daten- und Merkmalkataloge und bei Formularen wird der Befehl
|
||||||
|
`tree` verwendet:
|
||||||
|
|
||||||
|
```
|
||||||
|
osc-variant tree meine-beispieldatei.osc
|
||||||
|
```
|
||||||
|
|
||||||
|
Achtung! Dies erzeugt eine sehr umfangreiche Ausgabe.
|
||||||
|
|
||||||
|
Zum Vergleich zweier OSC-Dateien wird der Unterbefehl `diff` verwendet.
|
||||||
|
Der optionale Parameter `--strict` vergleicht auch den Inhalt der OSC-Datei.
|
||||||
|
Ohne diesen wird nur das Vorhandensein von Inhalten und die Revision verglichen.
|
||||||
|
|
||||||
|
```
|
||||||
|
osc-variant diff meine-beispieldatei.osc andere-beispieldatei.osc
|
||||||
|
```
|
||||||
|
|
||||||
|
bzw.
|
||||||
|
|
||||||
|
```
|
||||||
|
osc-variant diff meine-beispieldatei.osc andere-beispieldatei.osc --strict
|
||||||
|
```
|
||||||
|
|
||||||
Zum Anpassen des Inhalts einer Datei:
|
Zum Anpassen des Inhalts einer Datei:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -44,6 +67,23 @@ Hierzu ist die Option `--compact` vorgesehen. Es können, je nach Datei, bis zu
|
|||||||
Bei der Auflistung der Inhalte, kann die Option `--sorted` dazu verwendet werden, die angezeigten Einträge alphabetisch zu sortieren.
|
Bei der Auflistung der Inhalte, kann die Option `--sorted` dazu verwendet werden, die angezeigten Einträge alphabetisch zu sortieren.
|
||||||
Die Sortierung erfolgt dabei nach Namen des Katalogs oder des Formulars.
|
Die Sortierung erfolgt dabei nach Namen des Katalogs oder des Formulars.
|
||||||
|
|
||||||
|
#### Experimentelle Funktionen
|
||||||
|
|
||||||
|
Neben den gebräuchlichen Funktionen gibt es weitere, derzeit noch experimentelle, Funktionen.
|
||||||
|
|
||||||
|
##### Sortierung bei Modifikation
|
||||||
|
|
||||||
|
Beim Modifizieren der Inhalte kann die experimentelle Option `--x-sorted` dazu verwendet werden, die Einträge im Anschluss an die Modifikation
|
||||||
|
nach Namen zu sortieren.
|
||||||
|
Dies erlaubt eine konsistente Reihenfolge der Einträge, wodurch ein direkter Vergleich mit Vorversionen ermöglicht wird.
|
||||||
|
ACHTUNG: Es kann sein, dass dadurch ein Import der resultierenden OSC-Datei nicht mehr möglich ist, da das genaue Verhalten des Imports aktuell noch nicht bekannt ist.
|
||||||
|
|
||||||
|
##### Entfernen von Inhalten der Systembibliothek bei Modifikation
|
||||||
|
|
||||||
|
Mit der die experimentelle Option `--x-strip` ist es möglich, die in der OSC-Datei enthaltenen und beim Import nicht genutzten Inhalte aus der Systembibliothek zu entfernen.
|
||||||
|
|
||||||
|
Hierbei werden alle Inhalte entfernt, die im Ordner "ONKOSTAR Bibliothek" enthalten sind, beim Import jedoch ignoriert werden.
|
||||||
|
|
||||||
## Profile
|
## Profile
|
||||||
|
|
||||||
Zum Erstellen von Varianten einer OSC-Datei wird eine Profildatei im YAML-Format verwendet.
|
Zum Erstellen von Varianten einer OSC-Datei wird eine Profildatei im YAML-Format verwendet.
|
||||||
@@ -53,6 +93,9 @@ In ihr sind die durchzuführenden Änderungen definiert. Eine Profildatei hat di
|
|||||||
```
|
```
|
||||||
forms:
|
forms:
|
||||||
- name: "ExampleForm"
|
- name: "ExampleForm"
|
||||||
|
form_field:
|
||||||
|
- name: "formularfeld"
|
||||||
|
hide: true
|
||||||
form_references:
|
form_references:
|
||||||
- name: "ref_first_mtb"
|
- name: "ref_first_mtb"
|
||||||
referenced_data_form: "Formularverweis.Variante"
|
referenced_data_form: "Formularverweis.Variante"
|
||||||
@@ -79,6 +122,12 @@ und dabei die vorhandenen Angaben für den Formularverweis zu ersetzen.
|
|||||||
Die Angaben für `referenced_data_form`, `anzeige_auswahl`, `anzeige` und `scripts_code` sind optional.
|
Die Angaben für `referenced_data_form`, `anzeige_auswahl`, `anzeige` und `scripts_code` sind optional.
|
||||||
Wird keine Angabe gemacht, wird der bestehende Wert beibehalten.
|
Wird keine Angabe gemacht, wird der bestehende Wert beibehalten.
|
||||||
|
|
||||||
|
Zudem wird im Formular "ExampleForm" das Formularfeld "formularfeld" ausgeblendet, indem der Filter auf "false" gesetzt wird.
|
||||||
|
Dadurch wird das Formularfeld nie angezeigt.
|
||||||
|
Ein zuvor bestehender Filter wird ersetzt.
|
||||||
|
Weiterhin wird die Eigenschaft "Speichern" des Formularfelds auf "Immer speichern" gesetzt um sicherzustellen, dass zuvor
|
||||||
|
enthaltene Daten weiterhin gespeichert bleiben und werden, auch wenn das Formularfeld nicht sichtbar ist.
|
||||||
|
|
||||||
**Achtung!** Diese Anwendung überprüft keine Scripts und verwendet angegebene Scripts als "valid" im resultierenden OSC-File.
|
**Achtung!** Diese Anwendung überprüft keine Scripts und verwendet angegebene Scripts als "valid" im resultierenden OSC-File.
|
||||||
|
|
||||||
Zudem kann die Menükategorie angepasst werden.
|
Zudem kann die Menükategorie angepasst werden.
|
||||||
|
|||||||
@@ -4,3 +4,24 @@ forms:
|
|||||||
- name: MTB
|
- name: MTB
|
||||||
referenced_data_form: 'MR.MTB_Anmeldung'
|
referenced_data_form: 'MR.MTB_Anmeldung'
|
||||||
anzeige_auswahl: 'MTB Anmeldung vom {Anmeldedatum}'
|
anzeige_auswahl: 'MTB Anmeldung vom {Anmeldedatum}'
|
||||||
|
- name: 'DNPM Therapieplan'
|
||||||
|
form_references:
|
||||||
|
- name: referstemtb
|
||||||
|
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||||
|
anzeige_auswahl: 'MTB vom {Datum}'
|
||||||
|
- name: reftkhumangenber
|
||||||
|
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||||
|
anzeige_auswahl: 'MTB vom {Datum}'
|
||||||
|
- name: reftkreevaluation
|
||||||
|
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||||
|
anzeige_auswahl: 'MTB vom {Datum}'
|
||||||
|
- name: 'DNPM UF Einzelempfehlung'
|
||||||
|
form_references:
|
||||||
|
- name: mtb
|
||||||
|
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||||
|
anzeige_auswahl: 'MTB vom {Datum}'
|
||||||
|
- name: 'DNPM UF Rebiopsie'
|
||||||
|
form_references:
|
||||||
|
- name: reftumorkonferenz
|
||||||
|
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||||
|
anzeige_auswahl: 'MTB vom {Datum}'
|
||||||
26
src/cli.rs
26
src/cli.rs
@@ -43,6 +43,15 @@ pub enum Command {
|
|||||||
)]
|
)]
|
||||||
sorted: bool,
|
sorted: bool,
|
||||||
},
|
},
|
||||||
|
#[command(about = "Zeigt Kataloge und Formulare mit Revision und Abhängigkeiten an.")]
|
||||||
|
Tree {
|
||||||
|
inputfile: String,
|
||||||
|
#[arg(
|
||||||
|
long = "sorted",
|
||||||
|
help = "Sortiere Kataloge und Formulare nach Name (Optional)"
|
||||||
|
)]
|
||||||
|
sorted: bool,
|
||||||
|
},
|
||||||
#[command(about = "Modifiziert die angegebene Datei anhand der Profildatei")]
|
#[command(about = "Modifiziert die angegebene Datei anhand der Profildatei")]
|
||||||
Modify {
|
Modify {
|
||||||
inputfile: String,
|
inputfile: String,
|
||||||
@@ -52,5 +61,22 @@ pub enum Command {
|
|||||||
outputfile: Option<String>,
|
outputfile: Option<String>,
|
||||||
#[arg(long = "compact", help = "Kompakte Ausgabe, ohne Einrücken (Optional)")]
|
#[arg(long = "compact", help = "Kompakte Ausgabe, ohne Einrücken (Optional)")]
|
||||||
compact: bool,
|
compact: bool,
|
||||||
|
#[arg(
|
||||||
|
long = "x-sorted",
|
||||||
|
help = "EXPERIMENTELL: Sortiere Kataloge und Formulare nach Name (Optional).\nKann negative Auswirkungen auf den ordnungsgemäßen Import haben."
|
||||||
|
)]
|
||||||
|
sorted: bool,
|
||||||
|
#[arg(
|
||||||
|
long = "x-strip",
|
||||||
|
help = "EXPERIMENTELL: Entferne Einträge aus der Systembibliothek die nicht importiert werden (Optional).\nKann negative Auswirkungen auf den ordnungsgemäßen Import haben."
|
||||||
|
)]
|
||||||
|
strip: bool,
|
||||||
|
},
|
||||||
|
#[command(about = "Vergleiche zwei Dateien anhand der Revision der enthaltenen Inhalte")]
|
||||||
|
Diff {
|
||||||
|
inputfile_a: String,
|
||||||
|
inputfile_b: String,
|
||||||
|
#[arg(long = "strict", help = "Strikter Vergleich des Inhalts")]
|
||||||
|
strict: bool,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
34
src/main.rs
34
src/main.rs
@@ -31,6 +31,7 @@ use std::ops::Add;
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
use console::style;
|
||||||
use quick_xml::se::Serializer;
|
use quick_xml::se::Serializer;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
@@ -116,11 +117,20 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
data.print_list();
|
data.print_list();
|
||||||
}
|
}
|
||||||
|
Command::Tree { inputfile, sorted } => {
|
||||||
|
let mut data = read_inputfile(inputfile)?;
|
||||||
|
if sorted {
|
||||||
|
data.sorted()
|
||||||
|
}
|
||||||
|
OnkostarEditor::print_tree(&data);
|
||||||
|
}
|
||||||
Command::Modify {
|
Command::Modify {
|
||||||
inputfile,
|
inputfile,
|
||||||
profile,
|
profile,
|
||||||
outputfile,
|
outputfile,
|
||||||
compact,
|
compact,
|
||||||
|
sorted,
|
||||||
|
strip,
|
||||||
} => {
|
} => {
|
||||||
let data = &mut read_inputfile(inputfile)?;
|
let data = &mut read_inputfile(inputfile)?;
|
||||||
|
|
||||||
@@ -131,6 +141,14 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
data.apply_profile(&profile);
|
data.apply_profile(&profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sorted {
|
||||||
|
data.sorted();
|
||||||
|
}
|
||||||
|
|
||||||
|
if strip {
|
||||||
|
data.strip_system_library_content();
|
||||||
|
}
|
||||||
|
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
|
||||||
let mut serializer = Serializer::new(&mut buf);
|
let mut serializer = Serializer::new(&mut buf);
|
||||||
@@ -157,6 +175,22 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Command::Diff {
|
||||||
|
inputfile_a,
|
||||||
|
inputfile_b,
|
||||||
|
strict,
|
||||||
|
} => {
|
||||||
|
println!(
|
||||||
|
"Vergleiche Datei A ({}) mit Datei B ({})",
|
||||||
|
style(&inputfile_a).yellow(),
|
||||||
|
style(&inputfile_b).yellow()
|
||||||
|
);
|
||||||
|
|
||||||
|
let data_a = &mut read_inputfile(inputfile_a)?;
|
||||||
|
let data_b = &mut read_inputfile(inputfile_b)?;
|
||||||
|
|
||||||
|
data_a.print_diff(data_b, strict);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -22,10 +22,14 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use console::style;
|
use console::style;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::model::{Listable, Ordner, Sortable};
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
|
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
@@ -59,7 +63,11 @@ pub struct DataCatalogue {
|
|||||||
impl Listable for DataCatalogue {
|
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() {
|
||||||
|
true => style("S").yellow(),
|
||||||
|
_ => style("u"),
|
||||||
|
},
|
||||||
style(&self.name).yellow(),
|
style(&self.name).yellow(),
|
||||||
style(&self.revision).yellow()
|
style(&self.revision).yellow()
|
||||||
)
|
)
|
||||||
@@ -70,6 +78,74 @@ impl Sortable for DataCatalogue {
|
|||||||
fn sorting_key(&self) -> String {
|
fn sorting_key(&self) -> String {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self {
|
||||||
|
self.entries
|
||||||
|
.entry
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
self.entries.entry.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Comparable for DataCatalogue {
|
||||||
|
fn get_name(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_revision(&self) -> u16 {
|
||||||
|
self.revision
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Requires for DataCatalogue {
|
||||||
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||||
|
self.entries
|
||||||
|
.entry
|
||||||
|
.iter()
|
||||||
|
.filter(|&entry| entry.property_catalogue.is_some())
|
||||||
|
.map(|entry| match &entry.property_catalogue {
|
||||||
|
Some(entry) => entry.to_string(),
|
||||||
|
_ => String::new(),
|
||||||
|
})
|
||||||
|
.collect::<HashSet<_>>()
|
||||||
|
.into_iter()
|
||||||
|
.map(|entry| match all.find_property_catalogue(entry.as_str()) {
|
||||||
|
Some(contained) => Requirement::PropertyCatalogue(contained),
|
||||||
|
None => Requirement::ExternalPropertyCatalogue(entry),
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||||
|
format!(
|
||||||
|
"{}\n{}",
|
||||||
|
self.to_listed_string(),
|
||||||
|
self.get_required_entries(all)
|
||||||
|
.iter()
|
||||||
|
.map(|entry| match entry {
|
||||||
|
Requirement::PropertyCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
|
Requirement::ExternalPropertyCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.filter(Option::is_some)
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FolderContent for DataCatalogue {
|
||||||
|
fn get_library_folder(&self) -> String {
|
||||||
|
self.ordner.bibliothek.name.to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -141,6 +217,23 @@ pub struct Entry {
|
|||||||
revision: u16,
|
revision: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for Entry {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
if let Some(ref mut use_) = self.use_ {
|
||||||
|
use_.program_module
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key())
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Use {
|
pub struct Use {
|
||||||
@@ -156,3 +249,9 @@ pub struct ProgramModule {
|
|||||||
#[serde(rename = "@name")]
|
#[serde(rename = "@name")]
|
||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for ProgramModule {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
format!("{}-{}", self.program, self.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,12 +22,17 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use console::style;
|
use console::style;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
apply_profile_to_form_entry, Ansichten, Entries, Filter, FormEntry, FormEntryContainer,
|
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
||||||
Listable, MenuCategory, PlausibilityRules, Script, Sortable,
|
Filter, FolderContent, FormEntry, FormEntryContainer, Listable, MenuCategory,
|
||||||
|
PlausibilityRules, RefEntries, Script, Sortable,
|
||||||
};
|
};
|
||||||
use crate::model::{Haeufigkeiten, Ordner};
|
use crate::model::{Haeufigkeiten, Ordner};
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
@@ -165,6 +170,12 @@ impl FormEntryContainer for DataForm {
|
|||||||
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
|
||||||
|
profile_form
|
||||||
|
.form_fields
|
||||||
|
.iter()
|
||||||
|
.for_each(|form_field| apply_profile_to_form_field(entry, form_field));
|
||||||
|
|
||||||
if let Some(menu_category) = &profile_form.menu_category {
|
if let Some(menu_category) = &profile_form.menu_category {
|
||||||
self.menu_category = Some(MenuCategory {
|
self.menu_category = Some(MenuCategory {
|
||||||
name: menu_category.name.clone(),
|
name: menu_category.name.clone(),
|
||||||
@@ -181,7 +192,11 @@ impl FormEntryContainer for DataForm {
|
|||||||
impl Listable for DataForm {
|
impl Listable for DataForm {
|
||||||
fn to_listed_string(&self) -> String {
|
fn to_listed_string(&self) -> String {
|
||||||
format!(
|
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.name).yellow(),
|
||||||
style(&self.revision).yellow()
|
style(&self.revision).yellow()
|
||||||
)
|
)
|
||||||
@@ -192,6 +207,102 @@ impl Sortable for DataForm {
|
|||||||
fn sorting_key(&self) -> String {
|
fn sorting_key(&self) -> String {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self {
|
||||||
|
self.data_catalogues.data_catalogue.sort_unstable();
|
||||||
|
|
||||||
|
self.entries
|
||||||
|
.entry
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
|
||||||
|
self.entries.entry.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Some(ref mut plausibility_rule) = self.plausibility_rules.plausibility_rule {
|
||||||
|
plausibility_rule.sort_unstable_by_key(|item| item.bezeichnung.clone());
|
||||||
|
|
||||||
|
plausibility_rule.iter_mut().for_each(|item| {
|
||||||
|
if let Some(ref mut data_form_entry_names) = item.data_form_entries.entry_name {
|
||||||
|
data_form_entry_names.sort_unstable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Comparable for DataForm {
|
||||||
|
fn get_name(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_revision(&self) -> u16 {
|
||||||
|
self.revision
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Requires for DataForm {
|
||||||
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||||
|
self.data_catalogues
|
||||||
|
.data_catalogue
|
||||||
|
.iter()
|
||||||
|
.collect::<HashSet<_>>()
|
||||||
|
.into_iter()
|
||||||
|
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||||
|
Some(contained) => Requirement::DataCatalogue(contained),
|
||||||
|
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||||
|
format!(
|
||||||
|
"{}\n{}",
|
||||||
|
self.to_listed_string(),
|
||||||
|
self.get_required_entries(all)
|
||||||
|
.iter()
|
||||||
|
.map(|entry| match entry {
|
||||||
|
Requirement::DataCatalogue(x) => {
|
||||||
|
let inner = x
|
||||||
|
.get_required_entries(all)
|
||||||
|
.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)
|
||||||
|
.map(|item| format!(" - {}\n", item.unwrap()))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("");
|
||||||
|
|
||||||
|
if inner.is_empty() {
|
||||||
|
Some(format!(" + {}\n", x.to_listed_string()))
|
||||||
|
} else {
|
||||||
|
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Requirement::ExternalDataCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.filter(Option::is_some)
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FolderContent for DataForm {
|
||||||
|
fn get_library_folder(&self) -> String {
|
||||||
|
self.ordner.bibliothek.name.to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -421,6 +532,35 @@ impl FormEntry for Entry {
|
|||||||
valid: true,
|
valid: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn hide(&mut self) {
|
||||||
|
self.filter = Some(Filter {
|
||||||
|
condition: "false".into(),
|
||||||
|
valid: true,
|
||||||
|
ref_entries: Some(RefEntries { ref_entry: None }),
|
||||||
|
});
|
||||||
|
self.speichern = "0".into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Sortable for Entry {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
if let Some(ref mut filter) = self.filter {
|
||||||
|
if let Some(ref mut ref_entries) = filter.ref_entries {
|
||||||
|
if let Some(ref mut ref_entry) = ref_entries.ref_entry {
|
||||||
|
ref_entry.sort_unstable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
|||||||
@@ -22,13 +22,19 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::profile::{FormReference, Profile};
|
use std::collections::hash_map::DefaultHasher;
|
||||||
|
use std::fmt::Debug;
|
||||||
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::profile::{FormField, FormReference, Profile};
|
||||||
|
|
||||||
pub mod data_catalogue;
|
pub mod data_catalogue;
|
||||||
pub mod data_form;
|
pub mod data_form;
|
||||||
pub mod onkostar_editor;
|
pub mod onkostar_editor;
|
||||||
pub mod property_catalogue;
|
pub mod property_catalogue;
|
||||||
|
pub mod requirements;
|
||||||
pub mod unterformular;
|
pub mod unterformular;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -226,6 +232,15 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn apply_profile_to_form_field<E>(entry: &mut E, form_field: &FormField)
|
||||||
|
where
|
||||||
|
E: FormEntry,
|
||||||
|
{
|
||||||
|
if entry.get_name() == form_field.name && form_field.hide {
|
||||||
|
entry.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub trait FormEntryContainer {
|
pub trait FormEntryContainer {
|
||||||
fn apply_profile(&mut self, profile: &Profile);
|
fn apply_profile(&mut self, profile: &Profile);
|
||||||
}
|
}
|
||||||
@@ -236,6 +251,22 @@ pub trait Listable {
|
|||||||
|
|
||||||
pub trait Sortable {
|
pub trait Sortable {
|
||||||
fn sorting_key(&self) -> String;
|
fn sorting_key(&self) -> String;
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Comparable: Debug {
|
||||||
|
fn get_name(&self) -> String;
|
||||||
|
fn get_revision(&self) -> u16;
|
||||||
|
fn get_hash(&self) -> String {
|
||||||
|
let mut h = DefaultHasher::new();
|
||||||
|
format!("{:?}", self).hash(&mut h);
|
||||||
|
h.finish().to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FormEntry {
|
pub trait FormEntry {
|
||||||
@@ -245,4 +276,13 @@ pub trait FormEntry {
|
|||||||
fn update_anzeige(&mut self, value: String);
|
fn update_anzeige(&mut self, value: String);
|
||||||
fn update_anzeige_auswahl(&mut self, value: String);
|
fn update_anzeige_auswahl(&mut self, value: String);
|
||||||
fn update_scripts_code(&mut self, value: String);
|
fn update_scripts_code(&mut self, value: String);
|
||||||
|
fn hide(&mut self);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait FolderContent {
|
||||||
|
fn get_library_folder(&self) -> String;
|
||||||
|
|
||||||
|
fn is_system_library_content(&self) -> bool {
|
||||||
|
"ONKOSTAR Bibliothek" == self.get_library_folder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* MIT License
|
* MIT License
|
||||||
*
|
*
|
||||||
* 2023 Comprehensive Cancer Center Mainfranken
|
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -22,16 +22,20 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::cmp::Ordering;
|
||||||
|
use std::fmt::Debug;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
use console::style;
|
use console::style;
|
||||||
use quick_xml::de::from_str;
|
use quick_xml::de::from_str;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use crate::model::data_catalogue::DataCatalogue;
|
use crate::model::data_catalogue::DataCatalogue;
|
||||||
use crate::model::data_form::DataForm;
|
use crate::model::data_form::DataForm;
|
||||||
use crate::model::property_catalogue::PropertyCatalogue;
|
use crate::model::property_catalogue::PropertyCatalogue;
|
||||||
|
use crate::model::requirements::Requires;
|
||||||
use crate::model::unterformular::Unterformular;
|
use crate::model::unterformular::Unterformular;
|
||||||
use crate::model::{FormEntryContainer, Listable, Sortable};
|
use crate::model::{Comparable, FolderContent, FormEntryContainer, Listable, Sortable};
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -44,13 +48,47 @@ pub struct OnkostarEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl OnkostarEditor {
|
impl OnkostarEditor {
|
||||||
|
pub fn find_property_catalogue<'a>(&'a self, name: &str) -> Option<&'a PropertyCatalogue> {
|
||||||
|
match self
|
||||||
|
.editor
|
||||||
|
.property_catalogue
|
||||||
|
.iter()
|
||||||
|
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
|
||||||
|
.nth(0)
|
||||||
|
{
|
||||||
|
Some(x) => Some(x),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn find_data_catalogue<'a>(&'a self, name: &str) -> Option<&'a DataCatalogue> {
|
||||||
|
match self
|
||||||
|
.editor
|
||||||
|
.data_catalogue
|
||||||
|
.iter()
|
||||||
|
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
|
||||||
|
.nth(0)
|
||||||
|
{
|
||||||
|
Some(x) => Some(x),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn apply_profile(&mut self, profile: &Profile) {
|
pub fn apply_profile(&mut self, profile: &Profile) {
|
||||||
self.editor.data_form.iter_mut().for_each(|data_form| {
|
self.editor
|
||||||
|
.data_form
|
||||||
|
.iter_mut()
|
||||||
|
.filter(|data_form| !data_form.is_system_library_content())
|
||||||
|
.for_each(|data_form| {
|
||||||
data_form.apply_profile(profile);
|
data_form.apply_profile(profile);
|
||||||
});
|
});
|
||||||
self.editor.unterformular.iter_mut().for_each(|data_form| {
|
self.editor
|
||||||
|
.unterformular
|
||||||
|
.iter_mut()
|
||||||
|
.filter(|data_form| !data_form.is_system_library_content())
|
||||||
|
.for_each(|data_form| {
|
||||||
data_form.apply_profile(profile);
|
data_form.apply_profile(profile);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_list(&self) {
|
pub fn print_list(&self) {
|
||||||
@@ -67,27 +105,214 @@ impl OnkostarEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn print_items(title: &str, list: &[impl Listable]) {
|
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 ({}), der Benutzerbibliothek mit (u) markiert",
|
||||||
|
style("S").yellow()
|
||||||
|
);
|
||||||
list.iter()
|
list.iter()
|
||||||
.for_each(|entry| println!("{}", entry.to_listed_string()));
|
.for_each(|entry| println!("{}", entry.to_listed_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn print_tree(&self) {
|
||||||
|
println!(
|
||||||
|
"Die Datei wurde am {} mit {} in Version {} erstellt.\n\nFolgende Inhalte sind gespeichert",
|
||||||
|
style(&self.info_xml.datum_xml).yellow(),
|
||||||
|
style(&self.info_xml.name).yellow(),
|
||||||
|
style(&self.info_xml.version).yellow()
|
||||||
|
);
|
||||||
|
|
||||||
|
Self::print_items("Merkmalskataloge", &self.editor.property_catalogue);
|
||||||
|
self.print_items_tree("Datenkataloge", &self.editor.data_catalogue);
|
||||||
|
self.print_items_tree("Formulare", &self.editor.data_form);
|
||||||
|
self.print_items_tree("Unterformulare", &self.editor.unterformular);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_items_tree(&self, title: &str, list: &[impl Requires]) {
|
||||||
|
print!("\n{} {}", list.len(), style(title).underlined());
|
||||||
|
println!(
|
||||||
|
" - Inhalte der Systembibliothek sind mit ({}), der Benutzerbibliothek mit (u) markiert",
|
||||||
|
style("S").yellow()
|
||||||
|
);
|
||||||
|
list.iter()
|
||||||
|
.for_each(|entry| println!("{}", entry.to_requirement_string(self)));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn sorted(&mut self) {
|
pub fn sorted(&mut self) {
|
||||||
self.editor
|
self.editor
|
||||||
.property_catalogue
|
.property_catalogue
|
||||||
.sort_unstable_by_key(|e| e.sorting_key());
|
.sort_unstable_by_key(|e| e.sorting_key());
|
||||||
|
|
||||||
|
self.editor.property_catalogue.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
self.editor
|
self.editor
|
||||||
.data_catalogue
|
.data_catalogue
|
||||||
.sort_unstable_by_key(|e| e.sorting_key());
|
.sort_unstable_by_key(|e| e.sorting_key());
|
||||||
|
|
||||||
|
self.editor.data_catalogue.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
self.editor
|
self.editor
|
||||||
.data_form
|
.data_form
|
||||||
.sort_unstable_by_key(|e| e.sorting_key());
|
.sort_unstable_by_key(|e| e.sorting_key());
|
||||||
|
|
||||||
|
self.editor.data_form.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
self.editor
|
self.editor
|
||||||
.unterformular
|
.unterformular
|
||||||
.sort_unstable_by_key(|e| e.sorting_key());
|
.sort_unstable_by_key(|e| e.sorting_key());
|
||||||
|
|
||||||
|
self.editor.unterformular.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn strip_system_library_content(&mut self) {
|
||||||
|
self.editor
|
||||||
|
.property_catalogue
|
||||||
|
.retain(|e| !e.is_system_library_content());
|
||||||
|
|
||||||
|
self.editor
|
||||||
|
.data_catalogue
|
||||||
|
.retain(|e| !e.is_system_library_content());
|
||||||
|
|
||||||
|
self.editor
|
||||||
|
.data_form
|
||||||
|
.retain(|e| !e.is_system_library_content());
|
||||||
|
|
||||||
|
self.editor
|
||||||
|
.unterformular
|
||||||
|
.retain(|e| !e.is_system_library_content());
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn print_diff(&mut self, other: &mut Self, strict: bool) {
|
||||||
|
println!();
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Datei A wurde am {} mit {} in Version {} erstellt.",
|
||||||
|
style(&self.info_xml.datum_xml).yellow(),
|
||||||
|
style(&self.info_xml.name).yellow(),
|
||||||
|
style(&self.info_xml.version).yellow()
|
||||||
|
);
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Datei B wurde am {} mit {} in Version {} erstellt.",
|
||||||
|
style(&other.info_xml.datum_xml).yellow(),
|
||||||
|
style(&other.info_xml.name).yellow(),
|
||||||
|
style(&other.info_xml.version).yellow()
|
||||||
|
);
|
||||||
|
|
||||||
|
self.sorted();
|
||||||
|
other.sorted();
|
||||||
|
|
||||||
|
Self::print_item_diff(
|
||||||
|
"Merkmalskataloge",
|
||||||
|
&self.editor.property_catalogue,
|
||||||
|
&other.editor.property_catalogue,
|
||||||
|
strict,
|
||||||
|
);
|
||||||
|
Self::print_item_diff(
|
||||||
|
"Datenkataloge",
|
||||||
|
&self.editor.data_catalogue,
|
||||||
|
&other.editor.data_catalogue,
|
||||||
|
strict,
|
||||||
|
);
|
||||||
|
Self::print_item_diff(
|
||||||
|
"Formulare",
|
||||||
|
&self.editor.data_form,
|
||||||
|
&other.editor.data_form,
|
||||||
|
strict,
|
||||||
|
);
|
||||||
|
Self::print_item_diff(
|
||||||
|
"Unterformulare",
|
||||||
|
&self.editor.unterformular,
|
||||||
|
&other.editor.unterformular,
|
||||||
|
strict,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print_item_diff(
|
||||||
|
title: &str,
|
||||||
|
list_a: &[impl Comparable],
|
||||||
|
list_b: &[impl Comparable],
|
||||||
|
strict: bool,
|
||||||
|
) {
|
||||||
|
println!("\n{}", style(title).underlined());
|
||||||
|
|
||||||
|
let mut has_diff = false;
|
||||||
|
|
||||||
|
let names_a = list_a
|
||||||
|
.iter()
|
||||||
|
.map(|entry| entry.get_name())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let names_b = list_b
|
||||||
|
.iter()
|
||||||
|
.map(|entry| entry.get_name())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
names_b.iter().for_each(|entry| {
|
||||||
|
if !names_a.contains(entry) {
|
||||||
|
println!("{}: {}", entry, style("Nicht in Datei A enthalten!").red());
|
||||||
|
has_diff = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
names_a.iter().for_each(|entry| {
|
||||||
|
if !names_b.contains(entry) {
|
||||||
|
println!("{}: {}", entry, style("Nicht in Datei B enthalten!").red());
|
||||||
|
has_diff = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
list_a.iter().for_each(|entry_a| {
|
||||||
|
list_b.iter().for_each(|entry_b| {
|
||||||
|
if entry_a.get_name() == entry_b.get_name() {
|
||||||
|
match entry_a.get_revision().cmp(&entry_b.get_revision()) {
|
||||||
|
Ordering::Less => {
|
||||||
|
println!(
|
||||||
|
"{}: {} (Revision {} < Revision {})",
|
||||||
|
entry_a.get_name(),
|
||||||
|
style("Neuer in Datei B").yellow(),
|
||||||
|
style(entry_a.get_revision()).blue(),
|
||||||
|
style(entry_b.get_revision()).green()
|
||||||
|
);
|
||||||
|
has_diff = true;
|
||||||
|
}
|
||||||
|
Ordering::Greater => {
|
||||||
|
println!(
|
||||||
|
"{}: {} (Revision {} > Revision {})",
|
||||||
|
entry_a.get_name(),
|
||||||
|
style("Neuer in Datei A").yellow(),
|
||||||
|
style(entry_a.get_revision()).green(),
|
||||||
|
style(entry_b.get_revision()).blue()
|
||||||
|
);
|
||||||
|
has_diff = true;
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
if strict && entry_a.get_hash() != entry_b.get_hash() {
|
||||||
|
println!(
|
||||||
|
"{}: {} (z.B. GUID oder Reihenfolge von Unterelementen)",
|
||||||
|
entry_a.get_name(),
|
||||||
|
style("Inhaltlich verschieden").yellow()
|
||||||
|
);
|
||||||
|
has_diff = true;
|
||||||
|
} else if strict {
|
||||||
|
println!("{}: {}", entry_a.get_name(), style("Identisch").green())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if !has_diff {
|
||||||
|
println!("Keine Unterschiede")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,12 +341,12 @@ pub struct InfoXML {
|
|||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
struct Editor {
|
struct Editor {
|
||||||
#[serde(rename = "PropertyCatalogue")]
|
#[serde(rename = "PropertyCatalogue", default)]
|
||||||
property_catalogue: Vec<PropertyCatalogue>,
|
property_catalogue: Vec<PropertyCatalogue>,
|
||||||
#[serde(rename = "DataCatalogue")]
|
#[serde(rename = "DataCatalogue", default)]
|
||||||
data_catalogue: Vec<DataCatalogue>,
|
data_catalogue: Vec<DataCatalogue>,
|
||||||
#[serde(rename = "Unterformular")]
|
#[serde(rename = "Unterformular", default)]
|
||||||
unterformular: Vec<Unterformular>,
|
unterformular: Vec<Unterformular>,
|
||||||
#[serde(rename = "DataForm")]
|
#[serde(rename = "DataForm", default)]
|
||||||
data_form: Vec<DataForm>,
|
data_form: Vec<DataForm>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
use console::style;
|
use console::style;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::model::{Listable, Ordner, Sortable};
|
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
@@ -56,7 +56,11 @@ pub struct PropertyCatalogue {
|
|||||||
impl Listable for PropertyCatalogue {
|
impl Listable for PropertyCatalogue {
|
||||||
fn to_listed_string(&self) -> String {
|
fn to_listed_string(&self) -> String {
|
||||||
format!(
|
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.name).yellow(),
|
||||||
style(&self.revision).yellow()
|
style(&self.revision).yellow()
|
||||||
)
|
)
|
||||||
@@ -67,6 +71,32 @@ impl Sortable for PropertyCatalogue {
|
|||||||
fn sorting_key(&self) -> String {
|
fn sorting_key(&self) -> String {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self {
|
||||||
|
if let Some(ref mut versions) = self.versions.entry {
|
||||||
|
versions.sort_unstable_by_key(|item| item.version_number);
|
||||||
|
versions.iter_mut().for_each(|version| {
|
||||||
|
version.sorted();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Comparable for PropertyCatalogue {
|
||||||
|
fn get_name(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_revision(&self) -> u16 {
|
||||||
|
self.revision
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FolderContent for PropertyCatalogue {
|
||||||
|
fn get_library_folder(&self) -> String {
|
||||||
|
self.ordner.bibliothek.name.to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -105,6 +135,40 @@ pub struct Version {
|
|||||||
categories: Categories,
|
categories: Categories,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for Version {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.oid.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
if let Some(ref mut abbildung) = self.abbildung {
|
||||||
|
abbildung.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
abbildung.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
self.entries
|
||||||
|
.content
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
self.entries.content.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.categories
|
||||||
|
.content
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
self.categories.content.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct VersionEntries {
|
pub struct VersionEntries {
|
||||||
@@ -131,6 +195,12 @@ pub struct VersionEntry {
|
|||||||
position: String,
|
position: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for VersionEntry {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.code.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Categories {
|
pub struct Categories {
|
||||||
@@ -155,6 +225,26 @@ pub struct Category {
|
|||||||
category_entries: CategoryEntries,
|
category_entries: CategoryEntries,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for Category {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
self.category_entries
|
||||||
|
.content
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
self.category_entries.content.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct CategoryEntries {
|
pub struct CategoryEntries {
|
||||||
@@ -181,6 +271,12 @@ pub struct CategoryEntry {
|
|||||||
note: Option<String>,
|
note: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for CategoryEntry {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.code.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Abbildung {
|
pub struct Abbildung {
|
||||||
@@ -190,6 +286,24 @@ pub struct Abbildung {
|
|||||||
content: Vec<AbbildungEintrag>,
|
content: Vec<AbbildungEintrag>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for Abbildung {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.ziel_mk_version_oid.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
self.content.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
self.content.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct AbbildungEintrag {
|
pub struct AbbildungEintrag {
|
||||||
@@ -199,6 +313,12 @@ pub struct AbbildungEintrag {
|
|||||||
entry_to: AbbildungEntry,
|
entry_to: AbbildungEntry,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Sortable for AbbildungEintrag {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
format!("{}-{}", self.entry_from.code, self.entry_to.code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct AbbildungEntry {
|
pub struct AbbildungEntry {
|
||||||
|
|||||||
57
src/model/requirements.rs
Normal file
57
src/model/requirements.rs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 {
|
||||||
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement>;
|
||||||
|
|
||||||
|
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String;
|
||||||
|
}
|
||||||
@@ -22,12 +22,17 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use console::style;
|
use console::style;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
apply_profile_to_form_entry, Ansichten, Entries, Filter, FormEntry, FormEntryContainer,
|
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
||||||
Listable, MenuCategory, PlausibilityRules, Script, Sortable,
|
Filter, FolderContent, FormEntry, FormEntryContainer, Listable, MenuCategory,
|
||||||
|
PlausibilityRules, RefEntries, Script, Sortable,
|
||||||
};
|
};
|
||||||
use crate::model::{Haeufigkeiten, Ordner};
|
use crate::model::{Haeufigkeiten, Ordner};
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
@@ -176,6 +181,12 @@ impl FormEntryContainer for Unterformular {
|
|||||||
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
|
||||||
|
profile_form
|
||||||
|
.form_fields
|
||||||
|
.iter()
|
||||||
|
.for_each(|form_field| apply_profile_to_form_field(entry, form_field));
|
||||||
|
|
||||||
if let Some(menu_category) = &profile_form.menu_category {
|
if let Some(menu_category) = &profile_form.menu_category {
|
||||||
self.menu_category = Some(MenuCategory {
|
self.menu_category = Some(MenuCategory {
|
||||||
name: menu_category.name.clone(),
|
name: menu_category.name.clone(),
|
||||||
@@ -193,14 +204,22 @@ impl Listable for Unterformular {
|
|||||||
fn to_listed_string(&self) -> String {
|
fn to_listed_string(&self) -> String {
|
||||||
if self.hat_unterformulare {
|
if self.hat_unterformulare {
|
||||||
return format!(
|
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.name).yellow(),
|
||||||
style(&self.revision).yellow(),
|
style(&self.revision).yellow(),
|
||||||
style("Unterformular mit Markierung 'hat Unterformulare'!").red()
|
style("Unterformular mit Markierung 'hat Unterformulare'!").red()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
format!(
|
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.name).yellow(),
|
||||||
style(&self.revision).yellow()
|
style(&self.revision).yellow()
|
||||||
)
|
)
|
||||||
@@ -211,6 +230,101 @@ impl Sortable for Unterformular {
|
|||||||
fn sorting_key(&self) -> String {
|
fn sorting_key(&self) -> String {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self {
|
||||||
|
self.data_catalogues.data_catalogue.sort_unstable();
|
||||||
|
|
||||||
|
self.entries
|
||||||
|
.entry
|
||||||
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
|
||||||
|
self.entries.entry.iter_mut().for_each(|item| {
|
||||||
|
item.sorted();
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Some(ref mut plausibility_rule) = self.plausibility_rules.plausibility_rule {
|
||||||
|
plausibility_rule.sort_unstable_by_key(|item| item.bezeichnung.clone());
|
||||||
|
|
||||||
|
plausibility_rule.iter_mut().for_each(|item| {
|
||||||
|
if let Some(ref mut data_form_entry_names) = item.data_form_entries.entry_name {
|
||||||
|
data_form_entry_names.sort_unstable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Comparable for Unterformular {
|
||||||
|
fn get_name(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_revision(&self) -> u16 {
|
||||||
|
self.revision
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Requires for Unterformular {
|
||||||
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||||
|
self.data_catalogues
|
||||||
|
.data_catalogue
|
||||||
|
.iter()
|
||||||
|
.collect::<HashSet<_>>()
|
||||||
|
.into_iter()
|
||||||
|
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||||
|
Some(contained) => Requirement::DataCatalogue(contained),
|
||||||
|
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||||
|
format!(
|
||||||
|
"{}\n{}",
|
||||||
|
self.to_listed_string(),
|
||||||
|
self.get_required_entries(all)
|
||||||
|
.iter()
|
||||||
|
.map(|entry| match entry {
|
||||||
|
Requirement::DataCatalogue(x) => {
|
||||||
|
let inner = x
|
||||||
|
.get_required_entries(all)
|
||||||
|
.iter()
|
||||||
|
.map(|inner_entry| match inner_entry {
|
||||||
|
Requirement::PropertyCatalogue(_) => Some(inner_entry.to_string()),
|
||||||
|
Requirement::ExternalPropertyCatalogue(_) => {
|
||||||
|
Some(inner_entry.to_string())
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.filter(Option::is_some)
|
||||||
|
.map(|item| format!(" - {}\n", item.unwrap()))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("");
|
||||||
|
|
||||||
|
if inner.is_empty() {
|
||||||
|
Some(format!(" + {}\n", x.to_listed_string()))
|
||||||
|
} else {
|
||||||
|
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Requirement::ExternalDataCatalogue(_) => {
|
||||||
|
Some(format!(" + {}\n", entry.to_string()))
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.filter(Option::is_some)
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FolderContent for Unterformular {
|
||||||
|
fn get_library_folder(&self) -> String {
|
||||||
|
self.ordner.bibliothek.name.to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -441,6 +555,35 @@ impl FormEntry for Entry {
|
|||||||
valid: true,
|
valid: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn hide(&mut self) {
|
||||||
|
self.filter = Some(Filter {
|
||||||
|
condition: "false".into(),
|
||||||
|
valid: true,
|
||||||
|
ref_entries: Some(RefEntries { ref_entry: None }),
|
||||||
|
});
|
||||||
|
self.speichern = "0".into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Sortable for Entry {
|
||||||
|
fn sorting_key(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sorted(&mut self) -> &Self
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
if let Some(ref mut filter) = self.filter {
|
||||||
|
if let Some(ref mut ref_entries) = filter.ref_entries {
|
||||||
|
if let Some(ref mut ref_entry) = ref_entries.ref_entry {
|
||||||
|
ref_entry.sort_unstable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ pub struct Form {
|
|||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub form_references: Vec<FormReference>,
|
pub form_references: Vec<FormReference>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub form_fields: Vec<FormField>,
|
||||||
pub menu_category: Option<MenuCategory>,
|
pub menu_category: Option<MenuCategory>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +70,13 @@ impl FormReference {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct FormField {
|
||||||
|
pub name: String,
|
||||||
|
#[serde(default)]
|
||||||
|
pub hide: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct MenuCategory {
|
pub struct MenuCategory {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
@@ -93,6 +102,9 @@ mod tests {
|
|||||||
referenced_data_form: 'OS.Tumorkonferenz.VarianteUKW'
|
referenced_data_form: 'OS.Tumorkonferenz.VarianteUKW'
|
||||||
anzeige: 'Datum: {Datum}'
|
anzeige: 'Datum: {Datum}'
|
||||||
anzeige_auswahl: 'TK vom {Datum}'
|
anzeige_auswahl: 'TK vom {Datum}'
|
||||||
|
form_fields:
|
||||||
|
- name: eingabefeld
|
||||||
|
hide: true
|
||||||
";
|
";
|
||||||
|
|
||||||
match Profile::from_str(content) {
|
match Profile::from_str(content) {
|
||||||
@@ -101,6 +113,7 @@ mod tests {
|
|||||||
assert_eq!(profile.forms[0].name, "DNPM Therapieplan");
|
assert_eq!(profile.forms[0].name, "DNPM Therapieplan");
|
||||||
assert!(profile.forms[0].menu_category.is_some());
|
assert!(profile.forms[0].menu_category.is_some());
|
||||||
assert_eq!(profile.forms[0].form_references.len(), 1);
|
assert_eq!(profile.forms[0].form_references.len(), 1);
|
||||||
|
assert_eq!(profile.forms[0].form_fields.len(), 1)
|
||||||
}
|
}
|
||||||
Err(e) => panic!("Cannot deserialize profile: {}", e),
|
Err(e) => panic!("Cannot deserialize profile: {}", e),
|
||||||
}
|
}
|
||||||
@@ -212,4 +225,29 @@ mod tests {
|
|||||||
let actual = Profile::from_str(content);
|
let actual = Profile::from_str(content);
|
||||||
assert!(actual.is_err());
|
assert!(actual.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_deserialize_form_fields() {
|
||||||
|
let content = "forms:
|
||||||
|
- name: 'DNPM Therapieplan'
|
||||||
|
form_fields:
|
||||||
|
- name: formularfeld_to_keep
|
||||||
|
hide: false
|
||||||
|
- name: formularfeld_to_hide
|
||||||
|
hide: true
|
||||||
|
";
|
||||||
|
|
||||||
|
match Profile::from_str(content) {
|
||||||
|
Ok(profile) => {
|
||||||
|
assert_eq!(profile.forms.len(), 1);
|
||||||
|
assert_eq!(profile.forms[0].name, "DNPM Therapieplan");
|
||||||
|
assert_eq!(profile.forms[0].form_fields.len(), 2);
|
||||||
|
assert_eq!(profile.forms[0].form_fields[0].name, "formularfeld_to_keep");
|
||||||
|
assert!(!profile.forms[0].form_fields[0].hide);
|
||||||
|
assert_eq!(profile.forms[0].form_fields[1].name, "formularfeld_to_hide");
|
||||||
|
assert!(profile.forms[0].form_fields[1].hide);
|
||||||
|
}
|
||||||
|
Err(e) => panic!("Cannot deserialize profile: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user