Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26b984904b | ||
|
|
4f1d1c5b1c | ||
|
|
39178d05a5 | ||
|
|
4b398c8445 | ||
|
|
6294b114df | ||
|
|
48f711a84d | ||
|
|
21c0df0ded | ||
|
|
eae8d2a26a | ||
|
|
07c1679e1a | ||
|
|
2b255ce968 | ||
|
|
5cda2f8070 | ||
|
|
f8d399f9ae | ||
|
|
c5b11481b3 | ||
|
|
3cf5e6342b | ||
|
|
93a4b54d42 | ||
|
|
c6386e54fc | ||
|
|
469f192feb | ||
|
|
3baee8cac7 | ||
|
|
17e339ea00 | ||
|
|
152c01124b | ||
|
|
f8502ba781 | ||
|
|
23c0029317 | ||
|
|
8a44513a04 | ||
|
|
2db09af903 | ||
|
|
467f8c9020 | ||
|
|
909f33b044 | ||
|
|
44450f407c | ||
|
|
70a86f4545 | ||
|
|
e6409cc423 | ||
|
|
4e3161a05f | ||
|
|
05b865c608 | ||
|
|
2e134fb693 | ||
|
|
db99f39716 |
No files matched your search
Generated
+202
@@ -2,6 +2,23 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler2"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "aes"
|
||||||
|
version = "0.8.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"cipher",
|
||||||
|
"cpufeatures",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
version = "1.1.4"
|
version = "1.1.4"
|
||||||
@@ -739,6 +756,15 @@ dependencies = [
|
|||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bzip2"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
|
||||||
|
dependencies = [
|
||||||
|
"libbz2-rs-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "camino"
|
name = "camino"
|
||||||
version = "1.2.2"
|
version = "1.2.2"
|
||||||
@@ -789,6 +815,16 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cipher"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||||
|
dependencies = [
|
||||||
|
"crypto-common",
|
||||||
|
"inout",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cmake"
|
name = "cmake"
|
||||||
version = "0.1.57"
|
version = "0.1.57"
|
||||||
@@ -895,6 +931,12 @@ version = "0.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f67855af358fcb20fac58f9d714c94e2b228fe5694c1c9b4ead4a366343eda1b"
|
checksum = "f67855af358fcb20fac58f9d714c94e2b228fe5694c1c9b4ead4a366343eda1b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "constant_time_eq"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@@ -1173,6 +1215,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "deflate64"
|
||||||
|
version = "0.1.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "der"
|
name = "der"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
@@ -1359,6 +1407,16 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "flate2"
|
||||||
|
version = "1.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
|
||||||
|
dependencies = [
|
||||||
|
"miniz_oxide",
|
||||||
|
"zlib-rs",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fnv"
|
name = "fnv"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
@@ -2237,6 +2295,15 @@ dependencies = [
|
|||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inout"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "interpolator"
|
name = "interpolator"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@@ -2683,6 +2750,12 @@ dependencies = [
|
|||||||
"tachys",
|
"tachys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libbz2-rs-sys"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.182"
|
version = "0.2.182"
|
||||||
@@ -2725,6 +2798,15 @@ version = "0.1.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
|
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lzma-rust2"
|
||||||
|
version = "0.16.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "47bb1e988e6fb779cf720ad431242d3f03167c1b3f2b1aae7f1a94b2495b36ae"
|
||||||
|
dependencies = [
|
||||||
|
"sha2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "macros"
|
name = "macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -2795,6 +2877,16 @@ dependencies = [
|
|||||||
"unicase",
|
"unicase",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.8.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||||
|
dependencies = [
|
||||||
|
"adler2",
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
@@ -2958,6 +3050,16 @@ version = "0.2.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pbkdf2"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
|
||||||
|
dependencies = [
|
||||||
|
"digest",
|
||||||
|
"hmac",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pem"
|
name = "pem"
|
||||||
version = "3.0.6"
|
version = "3.0.6"
|
||||||
@@ -3016,6 +3118,12 @@ dependencies = [
|
|||||||
"spki",
|
"spki",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.3.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "potential_utf"
|
name = "potential_utf"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@@ -3031,6 +3139,12 @@ version = "0.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppmd-rust"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "efca4c95a19a79d1c98f791f10aebd5c1363b473244630bb7dbde1dc98455a24"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.21"
|
version = "0.2.21"
|
||||||
@@ -3621,6 +3735,7 @@ dependencies = [
|
|||||||
"chrono",
|
"chrono",
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"csv",
|
"csv",
|
||||||
|
"futures",
|
||||||
"icondata",
|
"icondata",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"jsonwebtoken 10.3.0",
|
"jsonwebtoken 10.3.0",
|
||||||
@@ -3640,6 +3755,7 @@ dependencies = [
|
|||||||
"traits",
|
"traits",
|
||||||
"uuid",
|
"uuid",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3931,6 +4047,12 @@ dependencies = [
|
|||||||
"rand_core 0.6.4",
|
"rand_core 0.6.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simd-adler32"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simple_asn1"
|
name = "simple_asn1"
|
||||||
version = "0.6.4"
|
version = "0.6.4"
|
||||||
@@ -4177,6 +4299,7 @@ checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"deranged",
|
"deranged",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
"js-sys",
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
@@ -4464,6 +4587,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typed-path"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.19.0"
|
version = "1.19.0"
|
||||||
@@ -5311,8 +5440,81 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zip"
|
||||||
|
version = "8.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dcab981e19633ebcf0b001ddd37dd802996098bc1864f90b7c5d970ce76c1d59"
|
||||||
|
dependencies = [
|
||||||
|
"aes",
|
||||||
|
"bzip2",
|
||||||
|
"constant_time_eq",
|
||||||
|
"crc32fast",
|
||||||
|
"deflate64",
|
||||||
|
"flate2",
|
||||||
|
"getrandom 0.4.1",
|
||||||
|
"hmac",
|
||||||
|
"indexmap",
|
||||||
|
"lzma-rust2",
|
||||||
|
"memchr",
|
||||||
|
"pbkdf2",
|
||||||
|
"ppmd-rust",
|
||||||
|
"sha1",
|
||||||
|
"time",
|
||||||
|
"typed-path",
|
||||||
|
"zeroize",
|
||||||
|
"zopfli",
|
||||||
|
"zstd",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zlib-rs"
|
||||||
|
version = "0.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zmij"
|
name = "zmij"
|
||||||
version = "1.0.21"
|
version = "1.0.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zopfli"
|
||||||
|
version = "0.8.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"
|
||||||
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
|
"crc32fast",
|
||||||
|
"log",
|
||||||
|
"simd-adler32",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zstd"
|
||||||
|
version = "0.13.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a"
|
||||||
|
dependencies = [
|
||||||
|
"zstd-safe",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zstd-safe"
|
||||||
|
version = "7.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d"
|
||||||
|
dependencies = [
|
||||||
|
"zstd-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zstd-sys"
|
||||||
|
version = "2.0.16+zstd.1.5.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
+4
-1
@@ -25,7 +25,6 @@ leptos_oidc = "0.9.0"
|
|||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
leptos_animate = "0.1"
|
leptos_animate = "0.1"
|
||||||
|
|
||||||
macros = { path = "./macros" }
|
macros = { path = "./macros" }
|
||||||
traits = { path = "./traits" }
|
traits = { path = "./traits" }
|
||||||
icondata = { version = "0.7.0", features = ["font-awesome"] }
|
icondata = { version = "0.7.0", features = ["font-awesome"] }
|
||||||
@@ -35,6 +34,8 @@ csv = "1.4.0"
|
|||||||
leptos-use = { version = "0.18.3", features = ["use_drop_zone"] }
|
leptos-use = { version = "0.18.3", features = ["use_drop_zone"] }
|
||||||
jsonwebtoken = { version = "10.3.0", features = ["aws_lc_rs"], optional = true }
|
jsonwebtoken = { version = "10.3.0", features = ["aws_lc_rs"], optional = true }
|
||||||
reqwest = { version = "0.13.2", features = ["json"] }
|
reqwest = { version = "0.13.2", features = ["json"] }
|
||||||
|
zip = { version = "8.5.1", optional = true }
|
||||||
|
futures = { version = "0.3.32", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["ssr"]
|
default = ["ssr"]
|
||||||
@@ -52,6 +53,8 @@ ssr = [
|
|||||||
"dep:aws-config",
|
"dep:aws-config",
|
||||||
"dep:serde_dynamo",
|
"dep:serde_dynamo",
|
||||||
"dep:jsonwebtoken",
|
"dep:jsonwebtoken",
|
||||||
|
"dep:zip",
|
||||||
|
"dep:futures",
|
||||||
"leptos/ssr",
|
"leptos/ssr",
|
||||||
"leptos_meta/ssr",
|
"leptos_meta/ssr",
|
||||||
"leptos_router/ssr",
|
"leptos_router/ssr",
|
||||||
|
|||||||
+19
-24
@@ -1,11 +1,12 @@
|
|||||||
use crate::components::ToastList;
|
use crate::components::ToastList;
|
||||||
use crate::components::login::ProviderLoginContext;
|
use crate::components::login::ProviderLoginContext;
|
||||||
use crate::pages::student;
|
|
||||||
use crate::pages::{
|
use crate::pages::{
|
||||||
AdminHomePage, AdminProviderPage, AdminScholarshipPage, AdminShell, AdminUtilsPage,
|
AdminHomePage, AdminProviderPage, AdminScholarshipPage, AdminShell, AdminUtilsPage,
|
||||||
ApplicantsPageFallback, AuthCallbackPage, LoanerBorrowForm, LoanerFallback, LoanerReturnForm,
|
ApplicantsPageFallback, ApplicantsStudentList, AuthCallbackPage, LoanerBorrowForm,
|
||||||
LoanerShell, ProviderContactPage, ProviderPortal, ScholarshipInfoPage,
|
LoanerFallback, LoanerReturnForm, LoanerShell, ProviderContactPage, ProviderPortal,
|
||||||
|
ScholarshipInfoPage,
|
||||||
};
|
};
|
||||||
|
use crate::pages::{ApplicantsPageShell, student};
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context};
|
use leptos_meta::{MetaTags, Stylesheet, Title, provide_meta_context};
|
||||||
use leptos_oidc::AuthSignal;
|
use leptos_oidc::AuthSignal;
|
||||||
@@ -86,7 +87,10 @@ fn ProviderRoutes() -> impl MatchNestedRoutes + Clone {
|
|||||||
view! {
|
view! {
|
||||||
<ParentRoute path=path!("/providers") view=ProviderLoginContext>
|
<ParentRoute path=path!("/providers") view=ProviderLoginContext>
|
||||||
<Route path=path!("") view=ProviderPortal />
|
<Route path=path!("") view=ProviderPortal />
|
||||||
<Route path=path!("/applicants") view=ApplicantsPageFallback />
|
<ParentRoute path=path!("/applicants") view=ApplicantsPageShell>
|
||||||
|
<Route path=path!("") view=ApplicantsPageFallback />
|
||||||
|
<Route path=path!("/:scholarship_id") view=ApplicantsStudentList />
|
||||||
|
</ParentRoute>
|
||||||
<Route path=path!("/callback") view=AuthCallbackPage />
|
<Route path=path!("/callback") view=AuthCallbackPage />
|
||||||
<Route path=path!("/profile") view=ProviderContactPage />
|
<Route path=path!("/profile") view=ProviderContactPage />
|
||||||
// <Route path=path!("/scholarships") view=FormClosedPage />
|
// <Route path=path!("/scholarships") view=FormClosedPage />
|
||||||
@@ -134,26 +138,17 @@ fn StudentRoutes() -> impl MatchNestedRoutes + Clone {
|
|||||||
<ParentRoute path=path!("students") view=student::StudentShell>
|
<ParentRoute path=path!("students") view=student::StudentShell>
|
||||||
<Route path=path!("callback") view=AuthCallbackPage />
|
<Route path=path!("callback") view=AuthCallbackPage />
|
||||||
<Route path=path!("home") view=student::StudentHomePage />
|
<Route path=path!("home") view=student::StudentHomePage />
|
||||||
<Route path=path!("demographics") view=student::StudentDemographicsPage />
|
<Route path=path!("demographics") view=student::ClosedForm />
|
||||||
<Route path=path!("eligibility") view=student::StudentEligibilityPage />
|
<Route path=path!("eligibility") view=student::ClosedForm />
|
||||||
<Route path=path!("additional") view=student::AdditionalPage />
|
<Route path=path!("additional") view=student::ClosedForm />
|
||||||
<Route path=path!("additional/academics") view=student::StudentAcademicsPage />
|
<Route path=path!("additional/academics") view=student::ClosedForm />
|
||||||
<Route path=path!("additional/athletics") view=student::StudentAthleticsPage />
|
<Route path=path!("additional/athletics") view=student::ClosedForm />
|
||||||
<Route
|
<Route path=path!("additional/extracurriculars") view=student::ClosedForm />
|
||||||
path=path!("additional/extracurriculars")
|
<Route path=path!("additional/work-experience") view=student::ClosedForm />
|
||||||
view=student::StudentExtracurricularsPage
|
<Route path=path!("additional/university") view=student::ClosedForm />
|
||||||
/>
|
<Route path=path!("additional/family-info") view=student::ClosedForm />
|
||||||
<Route
|
<Route path=path!("additional/financials") view=student::ClosedForm />
|
||||||
path=path!("additional/work-experience")
|
<Route path=path!("additional/specifics") view=student::ClosedForm />
|
||||||
view=student::StudentWorkExperiencePage
|
|
||||||
/>
|
|
||||||
<Route path=path!("additional/university") view=student::StudentUniversityPage />
|
|
||||||
<Route path=path!("additional/family-info") view=student::StudentFamilyPage />
|
|
||||||
<Route path=path!("additional/financials") view=student::StudentFinancialPage />
|
|
||||||
<Route
|
|
||||||
path=path!("additional/specifics")
|
|
||||||
view=student::StudentSpecificRequirementsPage
|
|
||||||
/>
|
|
||||||
</ParentRoute>
|
</ParentRoute>
|
||||||
}
|
}
|
||||||
.into_inner()
|
.into_inner()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use std::collections::HashMap;
|
|||||||
/// now, the table will simply create a single massive `Map` field that contains all the stored
|
/// now, the table will simply create a single massive `Map` field that contains all the stored
|
||||||
/// information in the `HashMap`. We'd prefer to be able to get single values if possible,
|
/// information in the `HashMap`. We'd prefer to be able to get single values if possible,
|
||||||
/// especially for interoperability with other applications, should they be created.
|
/// especially for interoperability with other applications, should they be created.
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Reactive)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Reactive)]
|
||||||
pub struct ExpandableInfo {
|
pub struct ExpandableInfo {
|
||||||
/// The main key member. Required and used to get/put the information in a database.
|
/// The main key member. Required and used to get/put the information in a database.
|
||||||
pub subject: String,
|
pub subject: String,
|
||||||
|
|||||||
+170
-15
@@ -1,13 +1,35 @@
|
|||||||
use std::collections::HashMap;
|
use indexmap::IndexMap;
|
||||||
use indexmap::IndexMap;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Default, Debug, Clone)]
|
||||||
pub enum SchemaType {
|
pub enum SchemaType {
|
||||||
|
/// Indicates a `ValueType::String` value.
|
||||||
|
#[default]
|
||||||
String,
|
String,
|
||||||
|
/// Indicates a `ValueType::Number` value.
|
||||||
Number,
|
Number,
|
||||||
List,
|
/// Indicates a `ValueType::List` containing only strings or numbers.
|
||||||
Map
|
PrimitiveList,
|
||||||
|
/// Indicates a `ValueType::List` containing only maps.
|
||||||
|
MapList,
|
||||||
|
/// Indicates a `ValueType::Map`.
|
||||||
|
Map,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone)]
|
||||||
|
pub enum SchemaContainerStyle {
|
||||||
|
#[default]
|
||||||
|
Header,
|
||||||
|
Capsule,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Default, Debug, Clone)]
|
||||||
|
pub enum SchemaHeaderStyle {
|
||||||
|
#[default]
|
||||||
|
None,
|
||||||
|
MainHeader,
|
||||||
|
SubsectionHeader,
|
||||||
|
Bold,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Schema Node
|
/// # Schema Node
|
||||||
@@ -55,12 +77,16 @@ pub enum SchemaType {
|
|||||||
/// This schema does not currently support display of a single nested member, like a single map
|
/// This schema does not currently support display of a single nested member, like a single map
|
||||||
/// within a list. This means that you will have to display any listed or mapped information as a
|
/// within a list. This means that you will have to display any listed or mapped information as a
|
||||||
/// list. Consider this when designing the data.
|
/// list. Consider this when designing the data.
|
||||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Default, Debug, Clone)]
|
||||||
pub struct SchemaNode {
|
pub struct SchemaNode {
|
||||||
|
/// The display style of the data. Refer to [`SchemaContainerStyle`] for more information.
|
||||||
|
pub container_style: SchemaContainerStyle,
|
||||||
/// The datatype of the data found using the `data_member` key.
|
/// The datatype of the data found using the `data_member` key.
|
||||||
pub data_type: SchemaType,
|
pub data_type: SchemaType,
|
||||||
/// The header of this display.
|
/// The header of this display.
|
||||||
pub header: String,
|
pub header: String,
|
||||||
|
/// The style of the header's display.
|
||||||
|
pub header_style: SchemaHeaderStyle,
|
||||||
/// When used with a SchemaType::List, this determines the datatype and children for every entry
|
/// When used with a SchemaType::List, this determines the datatype and children for every entry
|
||||||
/// in the list. Some examples include a list of maps, where we use the `item_template` to define
|
/// in the list. Some examples include a list of maps, where we use the `item_template` to define
|
||||||
/// the SchemaType::Map, and all its children. This is then mapped across all entries in the list,
|
/// the SchemaType::Map, and all its children. This is then mapped across all entries in the list,
|
||||||
@@ -69,16 +95,28 @@ pub struct SchemaNode {
|
|||||||
/// When used with a SchemaType::Map, this determines what children from the map are displayed
|
/// When used with a SchemaType::Map, this determines what children from the map are displayed
|
||||||
/// and how. It is ignored with all other SchemaType variants.
|
/// and how. It is ignored with all other SchemaType variants.
|
||||||
pub children: IndexMap<String, SchemaNode>,
|
pub children: IndexMap<String, SchemaNode>,
|
||||||
|
/// The primary key for iteration over maps. Used when there is a list of maps.
|
||||||
|
pub primary_key: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SchemaNode {
|
impl SchemaNode {
|
||||||
pub fn new(data_type: SchemaType) -> Self {
|
/// Creates a new [`SchemaBuilder`].
|
||||||
SchemaNode {
|
pub fn builder() -> SchemaBuilder {
|
||||||
data_type,
|
SchemaBuilder::default()
|
||||||
header: "".to_string(),
|
}
|
||||||
item_template: None,
|
}
|
||||||
children: IndexMap::new(),
|
|
||||||
}
|
#[derive(Default, Debug, Clone)]
|
||||||
|
pub struct SchemaBuilder {
|
||||||
|
container_style: SchemaContainerStyle,
|
||||||
|
header: String,
|
||||||
|
header_style: SchemaHeaderStyle,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SchemaBuilder {
|
||||||
|
pub fn container(mut self, style: SchemaContainerStyle) -> Self {
|
||||||
|
self.container_style = style;
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn header(mut self, header: impl Into<String>) -> Self {
|
pub fn header(mut self, header: impl Into<String>) -> Self {
|
||||||
@@ -86,13 +124,130 @@ impl SchemaNode {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn child(mut self, data_member: impl Into<String>, node: SchemaNode) -> Self {
|
pub fn header_style(mut self, header_style: SchemaHeaderStyle) -> Self {
|
||||||
self.children.insert(data_member.into(), node);
|
self.header_style = header_style;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn primitive_list(self) -> SchemaPrimitiveListBuilder {
|
||||||
|
SchemaPrimitiveListBuilder::new(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn map_list(self) -> SchemaMapListBuilder {
|
||||||
|
SchemaMapListBuilder::new(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn map(self) -> SchemaMapBuilder {
|
||||||
|
SchemaMapBuilder::new(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn string(self) -> SchemaPrimitiveBuilder {
|
||||||
|
SchemaPrimitiveBuilder::new(self, SchemaType::String)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn number(self) -> SchemaPrimitiveBuilder {
|
||||||
|
SchemaPrimitiveBuilder::new(self, SchemaType::Number)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn into_node(self) -> SchemaNode {
|
||||||
|
SchemaNode {
|
||||||
|
container_style: self.container_style,
|
||||||
|
header: self.header,
|
||||||
|
header_style: self.header_style,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone)]
|
||||||
|
pub struct SchemaPrimitiveListBuilder {
|
||||||
|
builder: SchemaBuilder,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SchemaPrimitiveListBuilder {
|
||||||
|
fn new(builder: SchemaBuilder) -> Self {
|
||||||
|
Self { builder }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone)]
|
||||||
|
pub struct SchemaMapListBuilder {
|
||||||
|
builder: SchemaBuilder,
|
||||||
|
item_template: Option<Box<SchemaNode>>,
|
||||||
|
primary_key: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SchemaMapListBuilder {
|
||||||
|
fn new(builder: SchemaBuilder) -> Self {
|
||||||
|
Self {
|
||||||
|
builder,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn item_template(mut self, node: SchemaNode) -> Self {
|
pub fn item_template(mut self, node: SchemaNode) -> Self {
|
||||||
self.item_template = Some(Box::new(node));
|
self.item_template = Some(Box::new(node));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn primary_key(mut self, primary_key: impl Into<String>) -> Self {
|
||||||
|
self.primary_key = primary_key.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(self) -> SchemaNode {
|
||||||
|
SchemaNode {
|
||||||
|
data_type: SchemaType::MapList,
|
||||||
|
item_template: self.item_template,
|
||||||
|
primary_key: Some(self.primary_key),
|
||||||
|
..self.builder.into_node()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone)]
|
||||||
|
pub struct SchemaMapBuilder {
|
||||||
|
builder: SchemaBuilder,
|
||||||
|
children: IndexMap<String, SchemaNode>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SchemaMapBuilder {
|
||||||
|
fn new(builder: SchemaBuilder) -> Self {
|
||||||
|
Self {
|
||||||
|
builder,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn child(mut self, data_member: impl Into<String>, node: SchemaNode) -> Self {
|
||||||
|
self.children.insert(data_member.into(), node);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(self) -> SchemaNode {
|
||||||
|
SchemaNode {
|
||||||
|
data_type: SchemaType::Map,
|
||||||
|
children: self.children,
|
||||||
|
..self.builder.into_node()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone)]
|
||||||
|
pub struct SchemaPrimitiveBuilder {
|
||||||
|
builder: SchemaBuilder,
|
||||||
|
data_type: SchemaType,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SchemaPrimitiveBuilder {
|
||||||
|
fn new(builder: SchemaBuilder, data_type: SchemaType) -> Self {
|
||||||
|
Self { data_type, builder }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(self) -> SchemaNode {
|
||||||
|
SchemaNode {
|
||||||
|
data_type: self.data_type,
|
||||||
|
..self.builder.into_node()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,4 +24,7 @@ pub struct UserClaims {
|
|||||||
pub username: String,
|
pub username: String,
|
||||||
/// The intended use for the token.
|
/// The intended use for the token.
|
||||||
pub token_use: String,
|
pub token_use: String,
|
||||||
|
/// The list of the names of user pool groups that have this user as a member.
|
||||||
|
#[serde(rename = "cognito:groups")]
|
||||||
|
pub groups: Vec<String>,
|
||||||
}
|
}
|
||||||
@@ -8,13 +8,13 @@ pub fn ActionButton(
|
|||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<button
|
<button
|
||||||
class="m-1.5 p-2.5 min-w-20 rounded-lg font-semibold text-white transition-all duration-400 cursor-pointer"
|
class="flex-1 m-1.5 p-2.5 min-w-20 rounded-lg font-semibold text-white transition-all duration-400 cursor-pointer"
|
||||||
class=(["bg-red-800", "hover:bg-red-900"], move || !disabled.get())
|
class=(["bg-red-800", "hover:bg-red-900"], move || !disabled.get())
|
||||||
class=(["bg-gray-600", "pointer-events-none"], move || disabled.get())
|
class=(["bg-gray-600", "pointer-events-none"], move || disabled.get())
|
||||||
r#type=button_type
|
r#type=button_type
|
||||||
disabled=move || disabled.get()
|
disabled=move || disabled.get()
|
||||||
>
|
>
|
||||||
{ children() }
|
{children()}
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+207
-217
@@ -1,263 +1,253 @@
|
|||||||
use crate::common::{SchemaNode, SchemaType, ValueType};
|
use crate::common::{SchemaContainerStyle, SchemaHeaderStyle, SchemaNode, SchemaType, ValueType};
|
||||||
use indexmap::IndexMap;
|
|
||||||
use leptos::logging::debug_log;
|
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
/// # Value Display Component
|
|
||||||
/// This component displays any data from a given `HashMap<String, ValueType>`. It requires a schema
|
|
||||||
/// to tell it how to display the information, which is covered in the [`SchemaNode`] documentation.
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn ValueDisplay(
|
pub fn DataDisplay(
|
||||||
#[prop(into)] schema: Signal<SchemaNode>,
|
/// The schema that this component should use to display the given data.
|
||||||
#[prop(into, optional)] data_member: Signal<String>,
|
#[prop(into)]
|
||||||
#[prop(into)] data_map: Signal<HashMap<String, ValueType>>,
|
schema: Signal<SchemaNode>,
|
||||||
|
/// The starting key in the data map.
|
||||||
|
#[prop(into, optional)]
|
||||||
|
data_member: Signal<String>,
|
||||||
|
/// A `HashMap` containing all the data that should be displayed.
|
||||||
|
#[prop(into)]
|
||||||
|
data_map: Signal<HashMap<String, ValueType>>,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
let data_value = Memo::new(move |_| {
|
// The schema should contain information about the header type and styling, along with the
|
||||||
if data_member.get().is_empty() {
|
// information display. This is rendered as part of the DataDisplayWrapper, which is simply a
|
||||||
ValueType::Map(Some(data_map.get()))
|
// wrapper around the information to be displayed.
|
||||||
|
|
||||||
|
// The children are all SchemaNodes as well, meaning that this component needs to call itself
|
||||||
|
// for each of these children. They will of course contain all the same information that we
|
||||||
|
// expect here.
|
||||||
|
|
||||||
|
// The actual displayed information is controlled through a DataDisplayView, which will accept
|
||||||
|
// settings for how the information is parsed. For example, rendering a list may be done by
|
||||||
|
// a string join operation, or it may be a list of maps, each of which needs to be displayed with
|
||||||
|
// a specific set of children. The SchemaNode must be able to handle this, and these options
|
||||||
|
// should be given to the DataDisplayView somehow.
|
||||||
|
|
||||||
|
// As the display_value here is actually an Option<ValueType>, we want to be able to handle cases
|
||||||
|
// where the display is given no values. In this case, the SchemaNode needs to specify whether
|
||||||
|
// a missing value is expected or an error.
|
||||||
|
|
||||||
|
let display_value = Memo::new(move |_| {
|
||||||
|
let member = data_member.get();
|
||||||
|
if member.is_empty() {
|
||||||
|
Some(ValueType::Map(Some(data_map.get())))
|
||||||
} else {
|
} else {
|
||||||
data_map
|
data_map.get().get(&member).cloned()
|
||||||
.get()
|
|
||||||
.get(&data_member.get())
|
|
||||||
.map(|v| v.clone())
|
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
{move || {
|
<DataDisplayWrapper
|
||||||
match schema.get().data_type {
|
container_style=schema.get().container_style
|
||||||
SchemaType::String | SchemaType::Number => {
|
header_style=schema.get().header_style
|
||||||
view! {
|
header_text=schema.get().header
|
||||||
<PrimitiveDisplay
|
>
|
||||||
header=move || schema.get().header
|
<DataDisplayView display_data=display_value schema=schema />
|
||||||
value=data_value
|
</DataDisplayWrapper>
|
||||||
nested=true
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
.into_any()
|
|
||||||
}
|
|
||||||
SchemaType::List => {
|
|
||||||
view! {
|
|
||||||
<ListDisplay
|
|
||||||
header=move || schema.get().header
|
|
||||||
value=data_value
|
|
||||||
item_template=move || {
|
|
||||||
schema
|
|
||||||
.get()
|
|
||||||
.item_template
|
|
||||||
.unwrap_or(Box::from(SchemaNode::new(SchemaType::List)))
|
|
||||||
}
|
|
||||||
nested=true
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
.into_any()
|
|
||||||
}
|
|
||||||
SchemaType::Map => {
|
|
||||||
view! {
|
|
||||||
<MapDisplay
|
|
||||||
value=data_value
|
|
||||||
header=move || schema.get().header
|
|
||||||
schema=move || schema.get().children
|
|
||||||
nested=true
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
.into_any()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Display Wrapper Component
|
|
||||||
/// This component is designed to wrap information for the [`ValueDisplay`] component. It allows
|
|
||||||
/// for simple uniform styling of the header and capsule, along with the ability for users to
|
|
||||||
/// collapse the information.
|
|
||||||
#[component]
|
#[component]
|
||||||
fn DisplayWrapper(
|
fn DataDisplayWrapper(
|
||||||
#[prop(into, optional)] header: Signal<String>,
|
#[prop(into)] container_style: SchemaContainerStyle,
|
||||||
#[prop(into, optional)] nested: Signal<bool>,
|
#[prop(into)] header_style: SchemaHeaderStyle,
|
||||||
|
#[prop(into)] header_text: Signal<String>,
|
||||||
children: Children,
|
children: Children,
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
|
// This component takes a wrapper style and displays the "chrome" of the interface. It has two
|
||||||
|
// options: Text Headers or Capsules. This will then render a DataDisplayHeader, which handles
|
||||||
|
// the styling for the text inside the header specifically.
|
||||||
|
|
||||||
|
// The capsule style is a colored header and a rounded container.
|
||||||
|
// The text header style is an invisible container.
|
||||||
|
|
||||||
let expanded = RwSignal::new(true);
|
let expanded = RwSignal::new(true);
|
||||||
|
|
||||||
view! {
|
match container_style {
|
||||||
<div class="m-3 rounded-lg shadow-lg flex flex-col">
|
SchemaContainerStyle::Header => {
|
||||||
<div
|
// Creates a simple container that only has a header and a series of children.
|
||||||
class="p-2 px-3 font-bold rounded-t-lg cursor-pointer"
|
// The spacing between the header and children is controlled by the header style.
|
||||||
class=(["bg-gray-300"], move || !nested.get())
|
// This type of container is not collapsable at the moment.
|
||||||
class=(["text-white", "bg-red-900"], move || nested.get())
|
view! {
|
||||||
class=(["rounded-lg"], move || !expanded.get())
|
<div class="flex flex-col w-full text-left">
|
||||||
on:click=move |_| expanded.update(|b| *b = !*b)
|
<div class="self-start w-full">
|
||||||
>
|
<DataDisplayHeader header_text=header_text header_style=header_style />
|
||||||
{header}
|
<div class="p-2 flex flex-col gap-1">{children()}</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="grid transition-all ease-in-out"
|
|
||||||
style:grid-template-rows=move || if expanded.get() { "1fr" } else { "0fr" }
|
|
||||||
>
|
|
||||||
<div class="min-h-0 overflow-hidden">
|
|
||||||
<div class="p-2">{children()}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
</div>
|
.into_any()
|
||||||
}
|
}
|
||||||
}
|
SchemaContainerStyle::Capsule => {
|
||||||
|
// Creates a capsule container - it is collapsable, with rounded corners and a colored
|
||||||
/// # Primitive Value Display Component
|
// header.
|
||||||
/// This component allows for the display of a `ValueType::String` or `ValueType::Number`.
|
view! {
|
||||||
#[component]
|
<div class="self-stretch rounded-lg shadow-lg flex flex-col w-full text-center">
|
||||||
fn PrimitiveDisplay(
|
<div
|
||||||
#[prop(into)] header: Signal<String>,
|
class="p-2 px-3 rounded-t-lg cursor-pointer bg-red-800 text-white"
|
||||||
#[prop(into)] value: Signal<ValueType>,
|
class=(["rounded-lg"], move || !expanded.get())
|
||||||
#[prop(into, optional)] nested: Signal<bool>,
|
on:click=move |_| expanded.update(|b| *b = !*b)
|
||||||
) -> impl IntoView {
|
>
|
||||||
let display_string = Memo::new(move |_| {
|
<DataDisplayHeader header_text=header_text header_style=header_style />
|
||||||
let value = value.get();
|
</div>
|
||||||
match value {
|
<div
|
||||||
ValueType::String(_) | ValueType::Number(_) => value.to_string(),
|
class="grid transition-all ease-in-out"
|
||||||
_ => "Value is not a string.".to_string(),
|
style:grid-template-rows=move || if expanded.get() { "1fr" } else { "0fr" }
|
||||||
|
>
|
||||||
|
<div class="min-h-0 overflow-hidden">
|
||||||
|
<div class="p-2 flex flex-col gap-1 flex-1">{children()}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
.into_any()
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
view! {
|
|
||||||
<DisplayWrapper header=header nested=nested>
|
|
||||||
<div>{display_string}</div>
|
|
||||||
</DisplayWrapper>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # List Value Display Component
|
|
||||||
/// This component allows for the display of a `ValueType::List`. It will show an error if passed
|
|
||||||
/// anything other than a list. It requires an item template that tells the list how to display
|
|
||||||
/// each value inside of it, most specifically the type of data inside of it.
|
|
||||||
#[component]
|
#[component]
|
||||||
fn ListDisplay(
|
fn DataDisplayHeader(
|
||||||
#[prop(into)] item_template: Signal<Box<SchemaNode>>,
|
#[prop(into)] header_style: SchemaHeaderStyle,
|
||||||
#[prop(into)] value: Signal<ValueType>,
|
#[prop(into)] header_text: Signal<String>,
|
||||||
#[prop(into)] header: Signal<String>,
|
|
||||||
#[prop(into, optional)] nested: Signal<bool>,
|
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
// Unwrap the value and check if it's the correct type. To be displayed with this component, it
|
// This component will take a header style and displays the corresponding text. It has a few
|
||||||
// MUST be a ValueType::List.
|
// options, all of which are defined in the HeaderStyle enum.
|
||||||
let display_list = Memo::new(move |_| {
|
|
||||||
let ValueType::List(Some(list)) = value.get() else {
|
|
||||||
return Vec::new();
|
|
||||||
};
|
|
||||||
|
|
||||||
list.into_iter()
|
match header_style {
|
||||||
.enumerate()
|
SchemaHeaderStyle::MainHeader => {
|
||||||
.collect::<Vec<(usize, ValueType)>>()
|
view! { <div class="text-3xl font-bold my-2">{header_text}</div> }.into_any()
|
||||||
});
|
}
|
||||||
|
SchemaHeaderStyle::SubsectionHeader => {
|
||||||
let is_valid = Memo::new(move |_| matches!(value.get(), ValueType::List(_)));
|
view! { <div class="text-xl font-bold">{header_text}</div> }.into_any()
|
||||||
|
}
|
||||||
let item_header = Memo::new(move |_| item_template.get().header);
|
SchemaHeaderStyle::Bold => view! { <div class="font-bold">{header_text}</div> }.into_any(),
|
||||||
|
SchemaHeaderStyle::None => view! {}.into_any(),
|
||||||
view! {
|
|
||||||
<DisplayWrapper header=header nested=nested>
|
|
||||||
<For
|
|
||||||
each=move || display_list.get()
|
|
||||||
key=|(idx, _)| idx.clone()
|
|
||||||
children=move |(idx, entry)| {
|
|
||||||
match item_template.get().data_type {
|
|
||||||
SchemaType::String | SchemaType::Number => {
|
|
||||||
view! { <PrimitiveDisplay value=entry header=item_header /> }.into_any()
|
|
||||||
}
|
|
||||||
SchemaType::List => {
|
|
||||||
view! {
|
|
||||||
<div>"Nested lists are not currently supported for display."</div>
|
|
||||||
}
|
|
||||||
.into_any()
|
|
||||||
}
|
|
||||||
SchemaType::Map => {
|
|
||||||
let map_header = format!("{} {}", item_template.get().header, idx + 1);
|
|
||||||
view! {
|
|
||||||
<MapDisplay
|
|
||||||
value=entry
|
|
||||||
header=map_header
|
|
||||||
schema=move || item_template.get().children
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
.into_any()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</DisplayWrapper>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Map Data Display Component
|
|
||||||
/// This component allows for the display of a `ValueType::Map`. The nested information must be defined
|
|
||||||
/// by a [`SchemaNode`], which tells the display what keys in the value map to search for the
|
|
||||||
/// display information.
|
|
||||||
#[component]
|
#[component]
|
||||||
fn MapDisplay(
|
fn DataDisplayView(
|
||||||
#[prop(into)] value: Signal<ValueType>,
|
#[prop(into)] display_data: Signal<Option<ValueType>>,
|
||||||
#[prop(into)] header: Signal<String>,
|
#[prop(into)] schema: Signal<SchemaNode>,
|
||||||
#[prop(into)] schema: Signal<IndexMap<String, SchemaNode>>,
|
|
||||||
#[prop(into, optional)] nested: Signal<bool>,
|
|
||||||
) -> impl IntoView {
|
) -> impl IntoView {
|
||||||
// Unwrap the value and check if it is the correct type. It must be a ValueType::Map.
|
// This is the part of the data display that does most of the work. It will take the values
|
||||||
let display_map = Memo::new(move |_| {
|
// found in the DataDisplay component and perform the logic that actually displays the
|
||||||
let ValueType::Map(Some(map)) = value.get() else {
|
// information. This component is only displayed if there is Some(value) in the DataDisplay.
|
||||||
return HashMap::new();
|
|
||||||
};
|
|
||||||
|
|
||||||
map
|
// In the case that this is displaying a Map or List, it will recursively call the DataDisplay
|
||||||
});
|
// component.
|
||||||
|
|
||||||
Effect::new(move || {
|
// If this is displaying a PrimitiveList, it will flatten and join all the values into a single
|
||||||
debug_log!("Current map values: {:?}", display_map.get());
|
// string, then display that string.
|
||||||
});
|
|
||||||
|
|
||||||
let is_valid = Memo::new(move |_| matches!(value.get(), ValueType::Map(_)));
|
let data_type = schema.get().data_type;
|
||||||
|
|
||||||
view! {
|
// Matches the specific data type. Displays errors if the given display data does not match.
|
||||||
<DisplayWrapper header=header nested=nested>
|
match data_type {
|
||||||
<For
|
SchemaType::String => {
|
||||||
each=move || schema.get()
|
let value = Signal::derive(move || {
|
||||||
key=|(k, _)| k.clone()
|
display_data
|
||||||
children=move |(member, child_schema)| {
|
.get()
|
||||||
let display_value = Memo::new(move |_| {
|
.map(|v| v.as_string().ok().flatten())
|
||||||
display_map.get().get(&member).map(|v| v.clone()).unwrap_or_default()
|
.flatten()
|
||||||
});
|
.unwrap_or("N/A".to_string())
|
||||||
match child_schema.data_type {
|
});
|
||||||
SchemaType::String | SchemaType::Number => {
|
view! { <div>{value}</div> }.into_any()
|
||||||
view! {
|
}
|
||||||
<PrimitiveDisplay value=display_value header=child_schema.header />
|
SchemaType::Number => {
|
||||||
}
|
let value = Signal::derive(move || {
|
||||||
.into_any()
|
display_data
|
||||||
|
.get()
|
||||||
|
.map(|v| v.as_number().ok().flatten())
|
||||||
|
.flatten()
|
||||||
|
.unwrap_or("N/A".to_string())
|
||||||
|
});
|
||||||
|
view! { <div>{value}</div> }.into_any()
|
||||||
|
}
|
||||||
|
SchemaType::PrimitiveList => {
|
||||||
|
let value = Signal::derive(move || {
|
||||||
|
display_data
|
||||||
|
.get()
|
||||||
|
.map(|v| v.as_list().ok().flatten())
|
||||||
|
.flatten()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.iter()
|
||||||
|
.map(|v| v.to_string())
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(", ")
|
||||||
|
});
|
||||||
|
view! { <div>{value}</div> }.into_any()
|
||||||
|
}
|
||||||
|
SchemaType::MapList => {
|
||||||
|
let list = Signal::derive(move || {
|
||||||
|
display_data
|
||||||
|
.get()
|
||||||
|
.map(|v| v.as_list().ok().flatten())
|
||||||
|
.flatten()
|
||||||
|
.unwrap_or_default()
|
||||||
|
.iter()
|
||||||
|
.filter_map(|v| v.as_map().ok().flatten().clone())
|
||||||
|
.collect::<Vec<HashMap<String, ValueType>>>()
|
||||||
|
});
|
||||||
|
let primary_key = StoredValue::new(schema.get().primary_key.unwrap_or_default());
|
||||||
|
view! {
|
||||||
|
<Show
|
||||||
|
when=move || !list.get().is_empty()
|
||||||
|
fallback=|| view! { <div class="w-full text-center">"List is empty."</div> }
|
||||||
|
>
|
||||||
|
<For
|
||||||
|
each=move || list.get()
|
||||||
|
key=move |map| {
|
||||||
|
map.get(&primary_key.get_value())
|
||||||
|
.map(|v| v.to_string())
|
||||||
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
SchemaType::List => {
|
children=move |map| {
|
||||||
let template = child_schema
|
|
||||||
.item_template
|
|
||||||
.unwrap_or(Box::from(SchemaNode::new(SchemaType::List)));
|
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<ListDisplay
|
<DataDisplay
|
||||||
value=display_value
|
schema=*schema.get().item_template.unwrap_or_default()
|
||||||
item_template=template
|
data_map=map
|
||||||
header=child_schema.header
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
.into_any()
|
|
||||||
}
|
}
|
||||||
SchemaType::Map => {
|
/>
|
||||||
|
</Show>
|
||||||
|
}
|
||||||
|
.into_any()
|
||||||
|
}
|
||||||
|
SchemaType::Map => {
|
||||||
|
let map = Signal::derive(move || {
|
||||||
|
display_data
|
||||||
|
.get()
|
||||||
|
.map(|v| v.as_map().ok().flatten())
|
||||||
|
.flatten()
|
||||||
|
});
|
||||||
|
view! {
|
||||||
|
<Show
|
||||||
|
when=move || map.get().is_some()
|
||||||
|
fallback=|| view! { <div class="text-red-500">"Map was not found."</div> }
|
||||||
|
>
|
||||||
|
<For
|
||||||
|
each=move || schema.get().children
|
||||||
|
key=|(key, _)| key.clone()
|
||||||
|
children=move |(key, schema)| {
|
||||||
view! {
|
view! {
|
||||||
<MapDisplay
|
<DataDisplay
|
||||||
value=display_value
|
schema=schema
|
||||||
schema=child_schema.children
|
data_member=key
|
||||||
header=child_schema.header
|
data_map=Signal::derive(move || map.get().unwrap_or_default())
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
.into_any()
|
|
||||||
}
|
}
|
||||||
}
|
/>
|
||||||
}
|
</Show>
|
||||||
/>
|
}
|
||||||
</DisplayWrapper>
|
.into_any()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::pages::api::files::{DeleteFile, upload_file};
|
use crate::pages::api::files::{DeleteFile, upload_file};
|
||||||
use leptos::html::{Input, Label};
|
use leptos::html::{Input, Label};
|
||||||
use leptos::logging::debug_log;
|
use leptos::logging::{debug_error, debug_log};
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use leptos::web_sys::{File, FormData};
|
use leptos::web_sys::{File, FormData};
|
||||||
use leptos_icons::Icon;
|
use leptos_icons::Icon;
|
||||||
@@ -28,6 +28,7 @@ pub fn FileDrop(
|
|||||||
|
|
||||||
let file_name_list = RwSignal::new(Vec::new());
|
let file_name_list = RwSignal::new(Vec::new());
|
||||||
let hovering = RwSignal::new(false);
|
let hovering = RwSignal::new(false);
|
||||||
|
let error_msg = RwSignal::new(String::new());
|
||||||
let name = StoredValue::new(name);
|
let name = StoredValue::new(name);
|
||||||
let form_id = StoredValue::new(form_id);
|
let form_id = StoredValue::new(form_id);
|
||||||
let auth = expect_context::<AuthSignal>();
|
let auth = expect_context::<AuthSignal>();
|
||||||
@@ -172,10 +173,18 @@ pub fn FileDrop(
|
|||||||
existing_files
|
existing_files
|
||||||
.get()
|
.get()
|
||||||
.map(|result| {
|
.map(|result| {
|
||||||
if let Ok(files) = result {
|
match result {
|
||||||
file_name_list.set(files);
|
Ok(files) => {
|
||||||
|
error_msg.set("".to_string());
|
||||||
|
file_name_list.set(files);
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
let msg = err.to_string();
|
||||||
|
debug_error!("Error while getting files: {}", msg);
|
||||||
|
error_msg.set(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}}
|
}}
|
||||||
<label
|
<label
|
||||||
node_ref=zone_ref
|
node_ref=zone_ref
|
||||||
@@ -194,6 +203,9 @@ pub fn FileDrop(
|
|||||||
<div class="text-sm text-gray-400">"Or click to select a file"</div>
|
<div class="text-sm text-gray-400">"Or click to select a file"</div>
|
||||||
<input node_ref=input_ref type="file" class="hidden" on:change=on_input_change />
|
<input node_ref=input_ref type="file" class="hidden" on:change=on_input_change />
|
||||||
</label>
|
</label>
|
||||||
|
<Show when=move || !error_msg.get().is_empty()>
|
||||||
|
<div class="flex-1">{error_msg}</div>
|
||||||
|
</Show>
|
||||||
<For
|
<For
|
||||||
each=move || file_name_list.get()
|
each=move || file_name_list.get()
|
||||||
key=|file| file.clone()
|
key=|file| file.clone()
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ mod admin;
|
|||||||
mod comparisons;
|
mod comparisons;
|
||||||
mod dates;
|
mod dates;
|
||||||
pub mod exports;
|
pub mod exports;
|
||||||
|
pub mod files;
|
||||||
mod providers;
|
mod providers;
|
||||||
mod scholarships;
|
mod scholarships;
|
||||||
pub mod students;
|
pub mod students;
|
||||||
pub mod files;
|
pub(crate) mod tokens;
|
||||||
mod tokens;
|
|
||||||
|
|
||||||
pub use admin::*;
|
pub use admin::*;
|
||||||
pub use comparisons::*;
|
pub use comparisons::*;
|
||||||
|
|||||||
+345
-3
@@ -1,22 +1,26 @@
|
|||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use leptos::server_fn::codec::Json;
|
use leptos::server_fn::codec::Json;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
mod imports {
|
mod imports {
|
||||||
pub use super::super::MAIN_TABLE_NAME;
|
pub use super::super::MAIN_TABLE_NAME;
|
||||||
pub use crate::common::ValueType;
|
pub use crate::common::ValueType;
|
||||||
|
pub use crate::pages::api::tokens::validate_and_get_token_info;
|
||||||
pub use crate::utils::server::*;
|
pub use crate::utils::server::*;
|
||||||
pub use aws_sdk_dynamodb::error::ProvideErrorMetadata;
|
pub use aws_sdk_dynamodb::error::ProvideErrorMetadata;
|
||||||
pub use aws_sdk_dynamodb::types::AttributeValue;
|
pub use aws_sdk_dynamodb::types::AttributeValue;
|
||||||
pub use leptos::logging::{debug_log, error};
|
pub use leptos::logging::{debug_log, error};
|
||||||
pub use std::collections::HashMap;
|
pub use std::collections::HashMap;
|
||||||
|
pub use zip::write::SimpleFileOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[server(input = Json)]
|
#[server(input = Json)]
|
||||||
pub async fn put_student_data(
|
pub async fn put_student_data(
|
||||||
subject: String,
|
subject: String,
|
||||||
data_type: String,
|
data_type: String,
|
||||||
data_map: std::collections::HashMap<String, crate::common::ValueType>,
|
data_map: HashMap<String, crate::common::ValueType>,
|
||||||
) -> Result<(), ServerFnError> {
|
) -> Result<(), ServerFnError> {
|
||||||
use imports::*;
|
use imports::*;
|
||||||
|
|
||||||
@@ -52,7 +56,7 @@ pub async fn put_student_data(
|
|||||||
pub async fn get_student_data(
|
pub async fn get_student_data(
|
||||||
subject: String,
|
subject: String,
|
||||||
data_type: String,
|
data_type: String,
|
||||||
) -> Result<std::collections::HashMap<String, crate::common::ValueType>, ServerFnError> {
|
) -> Result<HashMap<String, crate::common::ValueType>, ServerFnError> {
|
||||||
use imports::*;
|
use imports::*;
|
||||||
|
|
||||||
let client = create_dynamo_client().await;
|
let client = create_dynamo_client().await;
|
||||||
@@ -99,7 +103,7 @@ pub async fn get_student_data(
|
|||||||
#[server]
|
#[server]
|
||||||
pub async fn get_all_student_data(
|
pub async fn get_all_student_data(
|
||||||
subject: String,
|
subject: String,
|
||||||
) -> Result<std::collections::HashMap<String, crate::common::ValueType>, ServerFnError> {
|
) -> Result<HashMap<String, crate::common::ValueType>, ServerFnError> {
|
||||||
use imports::*;
|
use imports::*;
|
||||||
|
|
||||||
let client = create_dynamo_client().await;
|
let client = create_dynamo_client().await;
|
||||||
@@ -131,3 +135,341 @@ pub async fn get_all_student_data(
|
|||||||
ServerFnError::new(msg)
|
ServerFnError::new(msg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[server]
|
||||||
|
pub async fn get_completed_students(
|
||||||
|
access_token: String,
|
||||||
|
) -> Result<HashMap<String, HashMap<String, crate::common::ValueType>>, ServerFnError> {
|
||||||
|
use imports::*;
|
||||||
|
|
||||||
|
// We want to get all student information. The requirements are that the students have completed
|
||||||
|
// the demographics form - everything else may bed from this.
|
||||||
|
// The easiest way is to get all the information and filter on this side, instead of bookkeeping
|
||||||
|
// on the database's side.
|
||||||
|
|
||||||
|
// We want to verify the access token first, and make sure that the user has the correct access.
|
||||||
|
let claims = validate_and_get_token_info(access_token).await?;
|
||||||
|
if !claims.groups.contains(&"ScholarshipProviders".to_string()) {
|
||||||
|
return Err(ServerFnError::new(
|
||||||
|
"User is not in the ScholarshipProviders group",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let client = create_dynamo_client().await;
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.scan()
|
||||||
|
.table_name(MAIN_TABLE_NAME)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|err| {
|
||||||
|
let msg = err.message().unwrap_or("Unknown error occurred");
|
||||||
|
error!("{}", msg);
|
||||||
|
ServerFnError::new(msg)
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let Some(items) = response.items else {
|
||||||
|
return Ok(HashMap::new());
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut output = HashMap::<String, HashMap<String, ValueType>>::new();
|
||||||
|
|
||||||
|
items.into_iter().for_each(|mut form_info| {
|
||||||
|
let student_id_full = form_info
|
||||||
|
.get("HK")
|
||||||
|
.map(|v| v.as_s().cloned().unwrap_or_default())
|
||||||
|
.unwrap_or_default()
|
||||||
|
.to_owned();
|
||||||
|
|
||||||
|
let student_id = student_id_full.split("STUDENT#").collect::<String>();
|
||||||
|
|
||||||
|
form_info.remove("HK");
|
||||||
|
form_info.remove("SK");
|
||||||
|
|
||||||
|
let form_info_convert = form_info
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, ValueType::from(&v)))
|
||||||
|
.collect::<HashMap<String, ValueType>>();
|
||||||
|
|
||||||
|
// We want to insert all the remaining information into the output map
|
||||||
|
output
|
||||||
|
.entry(student_id)
|
||||||
|
.and_modify(|v| {
|
||||||
|
v.extend(form_info_convert.clone());
|
||||||
|
})
|
||||||
|
.or_insert(form_info_convert);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Don't love this, but it does verify that the student has completed the demographics form
|
||||||
|
let output = output
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|(k, student_info)| {
|
||||||
|
student_info
|
||||||
|
.get("first_name")
|
||||||
|
.and_then(|_| Some((k, student_info.clone())))
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Ok(output)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # Get File by Key API
|
||||||
|
/// This function gets a file from the corresponding S3 file key. If the subject found from the
|
||||||
|
/// `access_token` does not match the owner of the requested file, the requesting user must have
|
||||||
|
/// provider-level access or higher.
|
||||||
|
///
|
||||||
|
/// ## Possible errors
|
||||||
|
/// Please check the [`validate_and_get_token_info`] function for all token parsing errors. Otherwise,
|
||||||
|
/// if the requesting user does not have the correct permissions, it will return a message indicating
|
||||||
|
/// such. If the file is not found, an error containing "File not found" will be returned.
|
||||||
|
#[server]
|
||||||
|
pub async fn get_file_by_key(
|
||||||
|
access_token: String,
|
||||||
|
file_key: String,
|
||||||
|
) -> Result<Vec<u8>, ServerFnError> {
|
||||||
|
use imports::*;
|
||||||
|
|
||||||
|
let user_claims = validate_and_get_token_info(access_token).await?;
|
||||||
|
|
||||||
|
// Check if the user's subject is contained in the file_key (since all files are keyed by the
|
||||||
|
// user's subject)
|
||||||
|
if !file_key.contains(&user_claims.subject) {
|
||||||
|
// Check that the user is a provider.
|
||||||
|
if !user_claims
|
||||||
|
.groups
|
||||||
|
.contains(&"ScholarshipProviders".to_string())
|
||||||
|
{
|
||||||
|
return Err(ServerFnError::new(
|
||||||
|
"Access denied: user is not the student or a provider",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We now just need to get the actual file.
|
||||||
|
let client = aws_sdk_s3::Client::new(&create_aws_config().await);
|
||||||
|
|
||||||
|
let result = client
|
||||||
|
.get_object()
|
||||||
|
.key(file_key)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
let msg = e.message().unwrap_or("Unknown error occurred");
|
||||||
|
error!("{}", msg);
|
||||||
|
ServerFnError::new(msg)
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let bytes = result.body.collect().await?;
|
||||||
|
|
||||||
|
Ok(bytes.to_vec())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # Get Student File Names API
|
||||||
|
/// Gets a list of file names given a student's ID and the corresponding input ID from the forms.
|
||||||
|
/// These file names can be used to construct a file key for S3.
|
||||||
|
///
|
||||||
|
/// This API is only accessible by provider-level users.
|
||||||
|
#[server]
|
||||||
|
pub async fn get_student_files(
|
||||||
|
access_token: String,
|
||||||
|
student_id: String,
|
||||||
|
form_name: String,
|
||||||
|
question_id: String,
|
||||||
|
file_name_postfix: String,
|
||||||
|
) -> Result<(String, Vec<u8>), ServerFnError> {
|
||||||
|
use imports::*;
|
||||||
|
|
||||||
|
let claims = validate_and_get_token_info(access_token).await?;
|
||||||
|
|
||||||
|
// Check if the user has permission to get these files.
|
||||||
|
if !claims.groups.contains(&"ScholarshipProviders".to_string()) {
|
||||||
|
return Err(ServerFnError::new("Access denied: user is not a provider"));
|
||||||
|
}
|
||||||
|
|
||||||
|
let client = create_dynamo_client().await;
|
||||||
|
|
||||||
|
let demographics_res = client
|
||||||
|
.query()
|
||||||
|
.table_name(MAIN_TABLE_NAME)
|
||||||
|
.expression_attribute_values(":hk", AttributeValue::S(format!("STUDENT#{student_id}")))
|
||||||
|
.expression_attribute_values(":sk", AttributeValue::S("DEMOGRAPHICS".to_string()))
|
||||||
|
.key_condition_expression("HK = :hk and SK = :sk")
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
let msg = e.message().unwrap_or("Unknown error occurred");
|
||||||
|
error!("{}", msg);
|
||||||
|
ServerFnError::new(msg)
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let student_demographics = demographics_res
|
||||||
|
.items
|
||||||
|
.unwrap_or_default()
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.ok_or(ServerFnError::new(
|
||||||
|
"Failed to find student demographic information.",
|
||||||
|
))?;
|
||||||
|
|
||||||
|
let first_name = student_demographics
|
||||||
|
.get("first_name")
|
||||||
|
.and_then(|v| v.as_s().ok().cloned())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
let last_name = student_demographics
|
||||||
|
.get("last_name")
|
||||||
|
.and_then(|v| v.as_s().ok().cloned())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
let file_keys = client
|
||||||
|
.query()
|
||||||
|
.table_name(MAIN_TABLE_NAME)
|
||||||
|
.expression_attribute_values(":hk", AttributeValue::S(format!("STUDENT#{student_id}")))
|
||||||
|
.expression_attribute_values(
|
||||||
|
":sk",
|
||||||
|
AttributeValue::S(format!("FILE#{form_name}#{question_id}")),
|
||||||
|
)
|
||||||
|
.key_condition_expression("HK = :hk and begins_with(SK, :sk)")
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
let msg = e.message().unwrap_or("Unknown error occurred");
|
||||||
|
error!("{}", msg);
|
||||||
|
ServerFnError::new(msg)
|
||||||
|
})
|
||||||
|
.map(|output| {
|
||||||
|
let Some(items) = output.items else {
|
||||||
|
return Vec::new();
|
||||||
|
};
|
||||||
|
|
||||||
|
items
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|item| item.get("file_key")?.as_s().ok().cloned())
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
})?;
|
||||||
|
|
||||||
|
debug_log!("Await student file futures...");
|
||||||
|
let futures: Vec<_> = file_keys
|
||||||
|
.into_iter()
|
||||||
|
.map(|file_key| async move {
|
||||||
|
debug_log!("Requesting file from API with key {file_key}");
|
||||||
|
// Get all files from S3. This is a batch operation.
|
||||||
|
let s3_client = aws_sdk_s3::Client::new(&create_aws_config().await);
|
||||||
|
let file_output = s3_client
|
||||||
|
.get_object()
|
||||||
|
.bucket("leptos-scholarships")
|
||||||
|
.key(&file_key)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.ok()?;
|
||||||
|
|
||||||
|
let bytes = file_output.body.collect().await.ok()?.to_vec();
|
||||||
|
|
||||||
|
Some((file_key, bytes))
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let results = futures::future::join_all(futures)
|
||||||
|
.await
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.collect::<Vec<(String, Vec<u8>)>>();
|
||||||
|
|
||||||
|
let cur = std::io::Cursor::new(Vec::new());
|
||||||
|
let mut writer = zip::ZipWriter::new(cur);
|
||||||
|
|
||||||
|
debug_log!("Writing {} files to zip file...", results.len());
|
||||||
|
for (key, file_bytes) in results {
|
||||||
|
let file_name = key
|
||||||
|
.split('/')
|
||||||
|
.last()
|
||||||
|
.ok_or(ServerFnError::new("Failed to parse file name"))?
|
||||||
|
.split(".")
|
||||||
|
.next()
|
||||||
|
.unwrap_or_default();
|
||||||
|
let file_ext = key
|
||||||
|
.split('.')
|
||||||
|
.last()
|
||||||
|
.ok_or(ServerFnError::new("Failed to parse file extension"))?;
|
||||||
|
|
||||||
|
// Construct the real file name. This name should be under 150 characters.
|
||||||
|
let temp = format!("{first_name} {last_name} - {file_name}");
|
||||||
|
let file_name_no_ext = temp.chars().take(150).collect::<String>();
|
||||||
|
let file_name_complete = format!("{file_name_no_ext}.{file_ext}");
|
||||||
|
|
||||||
|
writer
|
||||||
|
.start_file(file_name_complete, SimpleFileOptions::default())
|
||||||
|
.map_err(ServerFnError::new)?;
|
||||||
|
writer.write_all(&file_bytes).map_err(ServerFnError::new)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
debug_log!("Getting finished file");
|
||||||
|
let finished = writer.finish().map_err(ServerFnError::new)?;
|
||||||
|
|
||||||
|
let file_name_hint = format!("{first_name}{last_name}_{file_name_postfix}.zip");
|
||||||
|
|
||||||
|
Ok((file_name_hint, finished.into_inner()))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # Get All Input Files API
|
||||||
|
/// Gets all files that have been uploaded to the given input. For example, getting all the FAFSA
|
||||||
|
/// files that were uploaded to the FAFSA file input on the Financial Info page.
|
||||||
|
///
|
||||||
|
/// Returns a `HashMap` keyed by the submitting user's ID, with a value of all files that were
|
||||||
|
/// uploaded by that user.
|
||||||
|
///
|
||||||
|
/// This is only usable by users with provider-level access.
|
||||||
|
#[server]
|
||||||
|
pub async fn get_all_input_files(
|
||||||
|
access_token: String,
|
||||||
|
form_name: String,
|
||||||
|
input_name: String,
|
||||||
|
) -> Result<HashMap<String, Vec<String>>, ServerFnError> {
|
||||||
|
use imports::*;
|
||||||
|
|
||||||
|
let claims = validate_and_get_token_info(access_token).await?;
|
||||||
|
|
||||||
|
if !claims.groups.contains(&"ScholarshipProviders".to_string()) {
|
||||||
|
return Err(ServerFnError::new("Access denied: user is not a provider"));
|
||||||
|
}
|
||||||
|
|
||||||
|
let client = create_dynamo_client().await;
|
||||||
|
|
||||||
|
let res = client
|
||||||
|
.scan()
|
||||||
|
.table_name(MAIN_TABLE_NAME)
|
||||||
|
.filter_expression("begins_with(SK, :sk)")
|
||||||
|
.expression_attribute_values(
|
||||||
|
":sk",
|
||||||
|
AttributeValue::S(format!("FILE#{form_name}#{input_name}")),
|
||||||
|
)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
let msg = e.message().unwrap_or("Unknown error occurred");
|
||||||
|
error!("{}", msg);
|
||||||
|
ServerFnError::new(msg)
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let mut result_map = HashMap::<String, Vec<String>>::new();
|
||||||
|
res.items.unwrap_or_default().iter().for_each(|item| {
|
||||||
|
let id = item
|
||||||
|
.get("HK")
|
||||||
|
.map(|v| v.as_s().cloned().unwrap_or_default())
|
||||||
|
.unwrap_or_default()
|
||||||
|
.split("STUDENT#")
|
||||||
|
.collect::<String>();
|
||||||
|
|
||||||
|
let file_key = item
|
||||||
|
.get("file_key")
|
||||||
|
.map(|v| v.as_s().cloned().unwrap_or_default())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
result_map
|
||||||
|
.entry(id)
|
||||||
|
.and_modify(|v| v.push(file_key.clone()))
|
||||||
|
.or_insert(vec![file_key]);
|
||||||
|
});
|
||||||
|
|
||||||
|
Ok(result_map)
|
||||||
|
}
|
||||||
+15
-16
@@ -1,19 +1,16 @@
|
|||||||
#[cfg(feature = "ssr")]
|
use crate::common::UserClaims;
|
||||||
use jsonwebtoken::{jwk::JwkSet, DecodingKey};
|
#[cfg(feature = "ssr")]
|
||||||
|
use jsonwebtoken::{DecodingKey, jwk::JwkSet};
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use crate::common::UserClaims;
|
|
||||||
|
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
pub async fn fetch_jwks(user_pool_id: String, region: String) -> Result<JwkSet, ServerFnError> {
|
pub async fn fetch_jwks(user_pool_id: String, region: String) -> Result<JwkSet, ServerFnError> {
|
||||||
let request_url = format!(
|
let request_url = format!(
|
||||||
"https://cognito-idp.{}.amazonaws.com/{}/.well-known/jwks.json",
|
"https://cognito-idp.{}.amazonaws.com/{}/.well-known/jwks.json",
|
||||||
region,
|
region, user_pool_id
|
||||||
user_pool_id
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let jwks = reqwest::get(&request_url).await?
|
let jwks = reqwest::get(&request_url).await?.json::<JwkSet>().await?;
|
||||||
.json::<JwkSet>()
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(jwks)
|
Ok(jwks)
|
||||||
}
|
}
|
||||||
@@ -21,7 +18,7 @@ pub async fn fetch_jwks(user_pool_id: String, region: String) -> Result<JwkSet,
|
|||||||
/// Validates a JWT, and, if successful, decodes it into a series of user claims.
|
/// Validates a JWT, and, if successful, decodes it into a series of user claims.
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
pub async fn validate_and_get_token_info(token: String) -> Result<UserClaims, ServerFnError> {
|
pub async fn validate_and_get_token_info(token: String) -> Result<UserClaims, ServerFnError> {
|
||||||
use jsonwebtoken::{decode, Algorithm, Validation};
|
use jsonwebtoken::{Algorithm, Validation, decode};
|
||||||
|
|
||||||
let jwks = fetch_jwks("us-east-1_Lfjuy5zaM".into(), "us-east-1".into()).await?;
|
let jwks = fetch_jwks("us-east-1_Lfjuy5zaM".into(), "us-east-1".into()).await?;
|
||||||
|
|
||||||
@@ -31,16 +28,18 @@ pub async fn validate_and_get_token_info(token: String) -> Result<UserClaims, Se
|
|||||||
let header = jsonwebtoken::decode_header(&token)
|
let header = jsonwebtoken::decode_header(&token)
|
||||||
.map_err(|e| ServerFnError::new(format!("Invalid token header: {e}")))?;
|
.map_err(|e| ServerFnError::new(format!("Invalid token header: {e}")))?;
|
||||||
|
|
||||||
let kid = header.kid.ok_or_else(|| ServerFnError::new("Missing kid header"))?;
|
let kid = header
|
||||||
|
.kid
|
||||||
|
.ok_or_else(|| ServerFnError::new("Missing kid header"))?;
|
||||||
|
|
||||||
let jwk = jwks.find(&kid)
|
let jwk = jwks
|
||||||
|
.find(&kid)
|
||||||
.ok_or_else(|| ServerFnError::new("Couldn't find matching key in JWKS"))?;
|
.ok_or_else(|| ServerFnError::new("Couldn't find matching key in JWKS"))?;
|
||||||
|
|
||||||
let token_data = decode::<UserClaims>(
|
leptos::logging::debug_log!("Parsing token: {:?}", token);
|
||||||
&token,
|
|
||||||
&DecodingKey::from_jwk(&jwk)?,
|
let token_data = decode::<UserClaims>(&token, &DecodingKey::from_jwk(&jwk)?, &validation)
|
||||||
&validation
|
.map_err(|err| ServerFnError::new(format!("Invalid token found: {err}")))?;
|
||||||
).map_err(|_| ServerFnError::new("Invalid token found".to_string()))?;
|
|
||||||
|
|
||||||
if token_data.claims.token_use != "access" {
|
if token_data.claims.token_use != "access" {
|
||||||
return Err(ServerFnError::new("Token type mismatch"));
|
return Err(ServerFnError::new("Token type mismatch"));
|
||||||
|
|||||||
+1313
-10
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,13 @@
|
|||||||
|
use leptos::prelude::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn ClosedForm() -> impl IntoView {
|
||||||
|
view! {
|
||||||
|
<div class="flex flex-col items-center mx-auto mt-10">
|
||||||
|
<h1 class="text-2xl font-bold">"Form Closed"</h1>
|
||||||
|
<p class="text-lg">
|
||||||
|
"This form is now closed. If you believe this is an error, please contact the guidance office."
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,10 +25,6 @@ pub fn StudentEligibilityPage() -> impl IntoView {
|
|||||||
let user_id = Memo::new(move |_| user_claims.get().map(|info| info.claims.subject.clone()));
|
let user_id = Memo::new(move |_| user_claims.get().map(|info| info.claims.subject.clone()));
|
||||||
let access_token = Memo::new(move |_| auth.get().authenticated().map(|a| a.access_token()));
|
let access_token = Memo::new(move |_| auth.get().authenticated().map(|a| a.access_token()));
|
||||||
|
|
||||||
Effect::new(move || {
|
|
||||||
debug_log!("User ID was updated: {}", user_id.get().unwrap_or_default());
|
|
||||||
});
|
|
||||||
|
|
||||||
let form_id = StoredValue::new("scholarship_essays".to_string());
|
let form_id = StoredValue::new("scholarship_essays".to_string());
|
||||||
|
|
||||||
let refresh_trigger = Trigger::new();
|
let refresh_trigger = Trigger::new();
|
||||||
@@ -146,7 +142,9 @@ pub fn StudentEligibilityPage() -> impl IntoView {
|
|||||||
),
|
),
|
||||||
async move |(access_token, form_id, scholarship_id)| {
|
async move |(access_token, form_id, scholarship_id)| {
|
||||||
let Some(access_token) = access_token else {
|
let Some(access_token) = access_token else {
|
||||||
return Ok(Vec::new());
|
return Err(
|
||||||
|
ServerFnError::new("Couldn't find access token"),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
list_files(access_token, form_id, scholarship_id).await
|
list_files(access_token, form_id, scholarship_id).await
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use leptos::prelude::*;
|
|
||||||
use crate::components::{Loading, OutlinedTextField, TextFieldType, ValidatedForm};
|
use crate::components::{Loading, OutlinedTextField, TextFieldType, ValidatedForm};
|
||||||
use crate::pages::student::form_setup::use_student_form;
|
use crate::pages::student::form_setup::use_student_form;
|
||||||
|
use leptos::prelude::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn StudentFamilyPage() -> impl IntoView {
|
pub fn StudentFamilyPage() -> impl IntoView {
|
||||||
let controller = use_student_form("family", true);
|
let controller = use_student_form("family", true);
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Show when=move || controller.data_resource.get().is_some() fallback=Loading>
|
<Show when=move || controller.data_resource.get().is_some() fallback=Loading>
|
||||||
<div class="flex flex-1" />
|
<div class="flex flex-1" />
|
||||||
@@ -115,4 +115,4 @@ pub fn StudentFamilyPage() -> impl IntoView {
|
|||||||
<div class="flex flex-1" />
|
<div class="flex flex-1" />
|
||||||
</Show>
|
</Show>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
mod academics_page;
|
mod academics_page;
|
||||||
mod additional_page;
|
mod additional_page;
|
||||||
mod athletics_page;
|
mod athletics_page;
|
||||||
|
mod closed_form;
|
||||||
mod demographics_page;
|
mod demographics_page;
|
||||||
mod eligibility_page;
|
mod eligibility_page;
|
||||||
mod extracurriculars_page;
|
mod extracurriculars_page;
|
||||||
@@ -9,14 +10,14 @@ mod financial_page;
|
|||||||
mod form_setup;
|
mod form_setup;
|
||||||
mod home_page;
|
mod home_page;
|
||||||
mod shell;
|
mod shell;
|
||||||
mod test_display;
|
mod specific_requirements_page;
|
||||||
mod university_page;
|
mod university_page;
|
||||||
mod work_experience_page;
|
mod work_experience_page;
|
||||||
mod specific_requirements_page;
|
|
||||||
|
|
||||||
pub use academics_page::*;
|
pub use academics_page::*;
|
||||||
pub use additional_page::*;
|
pub use additional_page::*;
|
||||||
pub use athletics_page::*;
|
pub use athletics_page::*;
|
||||||
|
pub use closed_form::*;
|
||||||
pub use demographics_page::*;
|
pub use demographics_page::*;
|
||||||
pub use eligibility_page::*;
|
pub use eligibility_page::*;
|
||||||
pub use extracurriculars_page::*;
|
pub use extracurriculars_page::*;
|
||||||
@@ -24,7 +25,6 @@ pub use family_info_page::*;
|
|||||||
pub use financial_page::*;
|
pub use financial_page::*;
|
||||||
pub use home_page::*;
|
pub use home_page::*;
|
||||||
pub use shell::*;
|
pub use shell::*;
|
||||||
pub use test_display::*;
|
pub use specific_requirements_page::*;
|
||||||
pub use university_page::*;
|
pub use university_page::*;
|
||||||
pub use work_experience_page::*;
|
pub use work_experience_page::*;
|
||||||
pub use specific_requirements_page::*;
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
use crate::common::{SchemaNode, SchemaType};
|
|
||||||
use crate::components::{Loading, ValueDisplay};
|
|
||||||
use crate::pages::api::students::get_all_student_data;
|
|
||||||
use crate::utils::get_user_claims;
|
|
||||||
use leptos::prelude::*;
|
|
||||||
|
|
||||||
#[component]
|
|
||||||
pub fn StudentTestDisplay() -> impl IntoView {
|
|
||||||
let create_student_display_schema = move || {
|
|
||||||
SchemaNode::new(SchemaType::Map)
|
|
||||||
.header("Student Information")
|
|
||||||
.child(
|
|
||||||
"first_name",
|
|
||||||
SchemaNode::new(SchemaType::String).header("First Name"),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
"last_name",
|
|
||||||
SchemaNode::new(SchemaType::String).header("Last Name"),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
"sports_participation",
|
|
||||||
SchemaNode::new(SchemaType::List)
|
|
||||||
.header("Sports Activities")
|
|
||||||
.item_template(
|
|
||||||
SchemaNode::new(SchemaType::Map)
|
|
||||||
.header("Sport")
|
|
||||||
.child(
|
|
||||||
"sport_name",
|
|
||||||
SchemaNode::new(SchemaType::String).header("Sport Name"),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
"achievements",
|
|
||||||
SchemaNode::new(SchemaType::String).header("Special Achievements"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
let user_claims = get_user_claims();
|
|
||||||
let user_id = Memo::new(move |_| user_claims.get().map(|info| info.claims.subject.clone()));
|
|
||||||
|
|
||||||
let resource = Resource::new(
|
|
||||||
move || user_id.get().unwrap_or_default(),
|
|
||||||
async move |id| get_all_student_data(id).await,
|
|
||||||
);
|
|
||||||
|
|
||||||
let schema = StoredValue::new(create_student_display_schema());
|
|
||||||
|
|
||||||
view! {
|
|
||||||
<div class="flex flex-1" />
|
|
||||||
<Suspense fallback=Loading>
|
|
||||||
<div class="flex flex-2 flex-col">
|
|
||||||
{move || {
|
|
||||||
resource
|
|
||||||
.get()
|
|
||||||
.map(|data_map| {
|
|
||||||
let Ok(map) = data_map else {
|
|
||||||
return view! {}.into_any();
|
|
||||||
};
|
|
||||||
let data_map = StoredValue::new(map);
|
|
||||||
|
|
||||||
view! {
|
|
||||||
<div>
|
|
||||||
<ValueDisplay
|
|
||||||
schema=schema.get_value()
|
|
||||||
data_map=data_map.get_value()
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
.into_any()
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</Suspense>
|
|
||||||
<div class="flex flex-1" />
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user