diff --git a/Cargo.lock b/Cargo.lock index 76dfb6456..de28b5239 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1708,22 +1708,6 @@ dependencies = [ "url", ] -[[package]] -name = "gloo" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23947965eee55e3e97a5cd142dd4c10631cc349b48cecca0ed230fd296f568cd" -dependencies = [ - "gloo-console", - "gloo-dialogs", - "gloo-events", - "gloo-file", - "gloo-render", - "gloo-storage", - "gloo-timers", - "gloo-utils", -] - [[package]] name = "gloo" version = "0.8.0" @@ -2174,6 +2158,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "implicit-clone" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40fc102e70475c320b185cd18c1e48bba2d7210b63970a4d581ef903e4368ef7" +dependencies = [ + "indexmap", +] + [[package]] name = "indexmap" version = "1.9.2" @@ -2500,7 +2493,7 @@ name = "kanidmd_web_ui" version = "1.1.0-alpha.11-dev" dependencies = [ "compact_jwt", - "gloo 0.8.0", + "gloo", "gloo-net", "js-sys", "kanidm_proto", @@ -2515,7 +2508,6 @@ dependencies = [ "wasm-bindgen-test", "web-sys", "yew", - "yew-agent", "yew-router", ] @@ -3277,6 +3269,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pinned" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" +dependencies = [ + "futures", + "rustversion", + "thiserror", +] + [[package]] name = "pkg-config" version = "0.3.26" @@ -3342,6 +3345,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -3401,6 +3414,23 @@ dependencies = [ "toml", ] +[[package]] +name = "prokio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" +dependencies = [ + "futures", + "gloo", + "num_cpus", + "once_cell", + "pin-project", + "pinned", + "tokio", + "tokio-stream", + "wasm-bindgen-futures", +] + [[package]] name = "psl-types" version = "2.0.11" @@ -3756,6 +3786,12 @@ dependencies = [ "nom 7.1.1", ] +[[package]] +name = "rustversion" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" + [[package]] name = "ryu" version = "1.0.11" @@ -3812,12 +3848,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" -[[package]] -name = "scoped-tls-hkt" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" - [[package]] name = "scopeguard" version = "1.1.0" @@ -4579,6 +4609,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.9", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.4" @@ -5318,50 +5359,38 @@ dependencies = [ [[package]] name = "yew" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1ccb53e57d3f7d847338cf5758befa811cabe207df07f543c06f502f9998cd" +checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc" dependencies = [ "console_error_panic_hook", - "gloo 0.4.2", - "gloo-utils", + "futures", + "gloo", + "implicit-clone", "indexmap", "js-sys", - "scoped-tls-hkt", + "prokio", + "rustversion", + "serde", "slab", + "thiserror", + "tokio", + "tracing", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "yew-macro", ] -[[package]] -name = "yew-agent" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616700dc3851945658c44ba4477ede6b77c795462fbbb9b0ad9a8b6273a3ca77" -dependencies = [ - "anymap2", - "bincode", - "gloo-console", - "gloo-utils", - "js-sys", - "serde", - "slab", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "yew", -] - [[package]] name = "yew-macro" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fab79082b556d768d6e21811869c761893f0450e1d550a67892b9bce303b7bb" +checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301" dependencies = [ "boolinator", - "lazy_static", + "once_cell", + "prettyplease", "proc-macro-error", "proc-macro2", "quote", @@ -5370,18 +5399,16 @@ dependencies = [ [[package]] name = "yew-router" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "155804f6f3aa309f596d5c3fa14486a94e7756f1edd7634569949e401d5099f2" +checksum = "426ee0486d2572a6c5e39fbdbc48b58d59bb555f3326f54631025266cf04146e" dependencies = [ - "gloo 0.4.2", - "gloo-utils", + "gloo", "js-sys", "route-recognizer 0.3.1", "serde", - "serde-wasm-bindgen 0.3.1", "serde_urlencoded", - "thiserror", + "tracing", "wasm-bindgen", "web-sys", "yew", @@ -5390,9 +5417,9 @@ dependencies = [ [[package]] name = "yew-router-macro" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39049d193b52eaad4ffc80916bf08806d142c90b5edcebd527644de438a7e19a" +checksum = "89b249cdb39e0cddaf0644dedc781854524374664793479fdc01e6a65d6e6ae3" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 5806cee78..77329373a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -170,9 +170,8 @@ web-sys = "^0.3.60" whoami = "^1.3.0" walkdir = "2" -yew = "^0.19.3" -yew-agent = "^0.1.0" -yew-router = "^0.16.0" +yew = "^0.20.0" +yew-router = "^0.17.0" zxcvbn = "^2.2.1" # enshrinken the WASMs diff --git a/kanidmd_web_ui/Cargo.toml b/kanidmd_web_ui/Cargo.toml index ca8ac6c0b..9b0da30a2 100644 --- a/kanidmd_web_ui/Cargo.toml +++ b/kanidmd_web_ui/Cargo.toml @@ -36,9 +36,8 @@ wasm-bindgen = { version = "^0.2.81" } wasm-bindgen-futures = { version = "^0.4.30" } wasm-bindgen-test = "0.3.33" url = "^2.3.1" -yew = "^0.19.3" -yew-agent = "^0.1.0" -yew-router = "^0.16.0" +yew = { version = "0.20.0", features = ["csr"] } +yew-router = "^0.17.0" [dependencies.web-sys] diff --git a/kanidmd_web_ui/pkg/kanidmd_web_ui.js b/kanidmd_web_ui/pkg/kanidmd_web_ui.js index 80bfbb47c..ef3fa9cab 100644 --- a/kanidmd_web_ui/pkg/kanidmd_web_ui.js +++ b/kanidmd_web_ui/pkg/kanidmd_web_ui.js @@ -231,41 +231,24 @@ function addBorrowedObject(obj) { heap[--stack_pointer] = obj; return stack_pointer; } -function __wbg_adapter_48(arg0, arg1, arg2) { +function __wbg_adapter_50(arg0, arg1, arg2) { try { - wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdb7f5bd2101eb559(arg0, arg1, addBorrowedObject(arg2)); + wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3fce4a672296c312(arg0, arg1, addBorrowedObject(arg2)); } finally { heap[stack_pointer++] = undefined; } } -function makeClosure(arg0, arg1, dtor, f) { - const state = { a: arg0, b: arg1, cnt: 1, dtor }; - const real = (...args) => { - // First up with a closure we increment the internal reference - // count. This ensures that the Rust closure environment won't - // be deallocated while we're invoking it. - state.cnt++; - try { - return f(state.a, state.b, ...args); - } finally { - if (--state.cnt === 0) { - wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b); - state.a = 0; - - } - } - }; - real.original = state; - - return real; -} -function __wbg_adapter_51(arg0, arg1, arg2) { - wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd6c53cf713a6c0ff(arg0, arg1, addHeapObject(arg2)); +function __wbg_adapter_53(arg0, arg1, arg2) { + wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h90c46f524e922c83(arg0, arg1, addHeapObject(arg2)); } -function __wbg_adapter_54(arg0, arg1, arg2) { - wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3b581d83a45c2264(arg0, arg1, addHeapObject(arg2)); +function __wbg_adapter_56(arg0, arg1, arg2) { + try { + wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h785bf27b1a1ece21(arg0, arg1, addBorrowedObject(arg2)); + } finally { + heap[stack_pointer++] = undefined; + } } /** @@ -379,10 +362,6 @@ function getImports() { const ret = new Error(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); }; - imports.wbg.__wbindgen_object_clone_ref = function(arg0) { - const ret = getObject(arg0); - return addHeapObject(ret); - }; imports.wbg.__wbindgen_string_new = function(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); return addHeapObject(ret); @@ -390,6 +369,10 @@ function getImports() { imports.wbg.__wbindgen_object_drop_ref = function(arg0) { takeObject(arg0); }; + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { + const ret = getObject(arg0); + return addHeapObject(ret); + }; imports.wbg.__wbindgen_in = function(arg0, arg1) { const ret = getObject(arg0) in getObject(arg1); return ret; @@ -424,9 +407,29 @@ function getImports() { imports.wbg.__wbg_modalhidebyid_130cc6453fa7b55b = function(arg0, arg1) { modal_hide_by_id(getStringFromWasm0(arg0, arg1)); }; - imports.wbg.__wbindgen_number_new = function(arg0) { - const ret = arg0; - return addHeapObject(ret); + imports.wbg.__wbg_subtreeid_e348577f7ef777e3 = function(arg0, arg1) { + const ret = getObject(arg1).__yew_subtree_id; + getInt32Memory0()[arg0 / 4 + 1] = isLikeNone(ret) ? 0 : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); + }; + imports.wbg.__wbg_setsubtreeid_d32e6327eef1f7fc = function(arg0, arg1) { + getObject(arg0).__yew_subtree_id = arg1 >>> 0; + }; + imports.wbg.__wbg_cachekey_b61393159c57fd7b = function(arg0, arg1) { + const ret = getObject(arg1).__yew_subtree_cache_key; + getInt32Memory0()[arg0 / 4 + 1] = isLikeNone(ret) ? 0 : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); + }; + imports.wbg.__wbg_setcachekey_80183b7cfc421143 = function(arg0, arg1) { + getObject(arg0).__yew_subtree_cache_key = arg1 >>> 0; + }; + imports.wbg.__wbg_setlistenerid_3183aae8fa5840fb = function(arg0, arg1) { + getObject(arg0).__yew_listener_id = arg1 >>> 0; + }; + imports.wbg.__wbg_listenerid_12315eee21527820 = function(arg0, arg1) { + const ret = getObject(arg1).__yew_listener_id; + getInt32Memory0()[arg0 / 4 + 1] = isLikeNone(ret) ? 0 : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); }; imports.wbg.__wbg_new_abda76e883ba8a5f = function() { const ret = new Error(); @@ -446,6 +449,10 @@ function getImports() { wasm.__wbindgen_free(arg0, arg1); } }; + imports.wbg.__wbindgen_number_new = function(arg0) { + const ret = arg0; + return addHeapObject(ret); + }; imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) { const ret = getObject(arg0) == getObject(arg1); return ret; @@ -457,6 +464,17 @@ function getImports() { imports.wbg.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) { getObject(arg0)[takeObject(arg1)] = takeObject(arg2); }; + imports.wbg.__wbindgen_is_null = function(arg0) { + const ret = getObject(arg0) === null; + return ret; + }; + imports.wbg.__wbg_get_723f83ba0c34871a = function(arg0, arg1) { + const ret = getObject(arg0)[takeObject(arg1)]; + return addHeapObject(ret); + }; + imports.wbg.__wbg_set_ce5827ace4c694dc = function(arg0, arg1, arg2) { + getObject(arg0)[takeObject(arg1)] = takeObject(arg2); + }; imports.wbg.__wbg_debug_783a3d4910bc24c7 = function(arg0, arg1) { var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice(); wasm.__wbindgen_free(arg0, arg1 * 4); @@ -539,22 +557,111 @@ function getImports() { const ret = getObject(arg0).querySelector(getStringFromWasm0(arg1, arg2)); return isLikeNone(ret) ? 0 : addHeapObject(ret); }, arguments) }; - imports.wbg.__wbg_log_4b5638ad60bdc54a = function(arg0) { - console.log(getObject(arg0)); + imports.wbg.__wbg_parentNode_e397bbbe28be7b28 = function(arg0) { + const ret = getObject(arg0).parentNode; + return isLikeNone(ret) ? 0 : addHeapObject(ret); }; - imports.wbg.__wbg_getItem_845e475f85f593e4 = function() { return handleError(function (arg0, arg1, arg2, arg3) { - const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3)); + imports.wbg.__wbg_parentElement_0cffb3ceb0f107bd = function(arg0) { + const ret = getObject(arg0).parentElement; + return isLikeNone(ret) ? 0 : addHeapObject(ret); + }; + imports.wbg.__wbg_lastChild_a2f5ed739809bb31 = function(arg0) { + const ret = getObject(arg0).lastChild; + return isLikeNone(ret) ? 0 : addHeapObject(ret); + }; + imports.wbg.__wbg_nextSibling_62338ec2a05607b4 = function(arg0) { + const ret = getObject(arg0).nextSibling; + return isLikeNone(ret) ? 0 : addHeapObject(ret); + }; + imports.wbg.__wbg_setnodeValue_4077cafeefd0725e = function(arg0, arg1, arg2) { + getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2); + }; + imports.wbg.__wbg_textContent_77bd294928962f93 = function(arg0, arg1) { + const ret = getObject(arg1).textContent; var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); var len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; + imports.wbg.__wbg_appendChild_e513ef0e5098dfdd = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).appendChild(getObject(arg1)); + return addHeapObject(ret); }, arguments) }; - imports.wbg.__wbg_removeItem_9da69ede4eea3326 = function() { return handleError(function (arg0, arg1, arg2) { - getObject(arg0).removeItem(getStringFromWasm0(arg1, arg2)); + imports.wbg.__wbg_insertBefore_9f2d2defb9471006 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2)); + return addHeapObject(ret); }, arguments) }; - imports.wbg.__wbg_setItem_9c469d634d0c321c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + imports.wbg.__wbg_removeChild_6751e9ca5d9aaf00 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).removeChild(getObject(arg1)); + return addHeapObject(ret); }, arguments) }; + imports.wbg.__wbg_instanceof_Response_eaa426220848a39e = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof Response; + } catch { + result = false; + } + const ret = result; + return ret; + }; + imports.wbg.__wbg_status_c4ef3dd591e63435 = function(arg0) { + const ret = getObject(arg0).status; + return ret; + }; + imports.wbg.__wbg_headers_fd64ad685cf22e5d = function(arg0) { + const ret = getObject(arg0).headers; + return addHeapObject(ret); + }; + imports.wbg.__wbg_json_eb16b12f372e850c = function() { return handleError(function (arg0) { + const ret = getObject(arg0).json(); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_text_1169d752cc697903 = function() { return handleError(function (arg0) { + const ret = getObject(arg0).text(); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_state_4896ba54c2e3301e = function() { return handleError(function (arg0) { + const ret = getObject(arg0).state; + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_pushState_38917fb88b4add30 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) { + getObject(arg0).pushState(getObject(arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5)); + }, arguments) }; + imports.wbg.__wbg_href_bbb11e0e61ea410e = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).href; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }, arguments) }; + imports.wbg.__wbg_pathname_4441d4d8fc4aba51 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).pathname; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }, arguments) }; + imports.wbg.__wbg_search_4aac147f005678e5 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).search; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }, arguments) }; + imports.wbg.__wbg_hash_8565e7b1ae1f2be4 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg1).hash; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }, arguments) }; + imports.wbg.__wbg_replace_ab0ff56e84982ad2 = function() { return handleError(function (arg0, arg1, arg2) { + getObject(arg0).replace(getStringFromWasm0(arg1, arg2)); + }, arguments) }; + imports.wbg.__wbg_log_4b5638ad60bdc54a = function(arg0) { + console.log(getObject(arg0)); + }; imports.wbg.__wbg_instanceof_HtmlFormElement_1c489ff7e99e43d3 = function(arg0) { let result; try { @@ -575,6 +682,33 @@ function getImports() { imports.wbg.__wbg_setvalue_df64bc6794c098f2 = function(arg0, arg1, arg2) { getObject(arg0).value = getStringFromWasm0(arg1, arg2); }; + imports.wbg.__wbg_instanceof_ShadowRoot_76b32ccdae10a710 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof ShadowRoot; + } catch { + result = false; + } + const ret = result; + return ret; + }; + imports.wbg.__wbg_host_57eec05a2624bc1b = function(arg0) { + const ret = getObject(arg0).host; + return addHeapObject(ret); + }; + imports.wbg.__wbg_getItem_845e475f85f593e4 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + const ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3)); + var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }, arguments) }; + imports.wbg.__wbg_removeItem_9da69ede4eea3326 = function() { return handleError(function (arg0, arg1, arg2) { + getObject(arg0).removeItem(getStringFromWasm0(arg1, arg2)); + }, arguments) }; + imports.wbg.__wbg_setItem_9c469d634d0c321c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + }, arguments) }; imports.wbg.__wbg_new_2d0053ee81e4dd2a = function() { return handleError(function () { const ret = new Headers(); return addHeapObject(ret); @@ -589,31 +723,23 @@ function getImports() { imports.wbg.__wbg_set_992c1d31586b2957 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); }, arguments) }; - imports.wbg.__wbg_pathname_78a642e573bf8169 = function(arg0, arg1) { - const ret = getObject(arg1).pathname; - const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - const len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_search_afb25c63fe262036 = function(arg0, arg1) { - const ret = getObject(arg1).search; - const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - const len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_setsearch_40007c2a91333011 = function(arg0, arg1, arg2) { - getObject(arg0).search = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_new_7d95b89914e4d377 = function() { return handleError(function (arg0, arg1) { - const ret = new URL(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }, arguments) }; imports.wbg.__wbg_new_ca4d3a3eca340210 = function() { return handleError(function () { const ret = new URLSearchParams(); return addHeapObject(ret); }, arguments) }; + imports.wbg.__wbg_add_89a4f3b0846cf0aa = function() { return handleError(function (arg0, arg1, arg2) { + getObject(arg0).add(getStringFromWasm0(arg1, arg2)); + }, arguments) }; + imports.wbg.__wbg_remove_1a26eb5d822902ed = function() { return handleError(function (arg0, arg1, arg2) { + getObject(arg0).remove(getStringFromWasm0(arg1, arg2)); + }, arguments) }; + imports.wbg.__wbg_href_90ff36b5040e3b76 = function(arg0, arg1) { + const ret = getObject(arg1).href; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; imports.wbg.__wbg_instanceof_HtmlInputElement_970e4026de0fccff = function(arg0) { let result; try { @@ -637,36 +763,46 @@ function getImports() { imports.wbg.__wbg_setvalue_e5b519cca37d82a7 = function(arg0, arg1, arg2) { getObject(arg0).value = getStringFromWasm0(arg1, arg2); }; - imports.wbg.__wbg_add_89a4f3b0846cf0aa = function() { return handleError(function (arg0, arg1, arg2) { - getObject(arg0).add(getStringFromWasm0(arg1, arg2)); - }, arguments) }; - imports.wbg.__wbg_remove_1a26eb5d822902ed = function() { return handleError(function (arg0, arg1, arg2) { - getObject(arg0).remove(getStringFromWasm0(arg1, arg2)); - }, arguments) }; - imports.wbg.__wbg_href_90ff36b5040e3b76 = function(arg0, arg1) { + imports.wbg.__wbg_href_9b462d09b5f8b378 = function(arg0, arg1) { const ret = getObject(arg1).href; const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; }; - imports.wbg.__wbg_url_1c013f0875e97715 = function(arg0, arg1) { - const ret = getObject(arg1).url; + imports.wbg.__wbg_pathname_78a642e573bf8169 = function(arg0, arg1) { + const ret = getObject(arg1).pathname; const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 0] = ptr0; }; - imports.wbg.__wbg_headers_85824e993aa739bf = function(arg0) { - const ret = getObject(arg0).headers; - return addHeapObject(ret); + imports.wbg.__wbg_search_afb25c63fe262036 = function(arg0, arg1) { + const ret = getObject(arg1).search; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; }; - imports.wbg.__wbg_newwithstr_fdce36db91ec5f92 = function() { return handleError(function (arg0, arg1) { - const ret = new Request(getStringFromWasm0(arg0, arg1)); + imports.wbg.__wbg_setsearch_40007c2a91333011 = function(arg0, arg1, arg2) { + getObject(arg0).search = getStringFromWasm0(arg1, arg2); + }; + imports.wbg.__wbg_hash_5ca9e2d439e2b3e1 = function(arg0, arg1) { + const ret = getObject(arg1).hash; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; + imports.wbg.__wbg_sethash_d35570df091aa47e = function(arg0, arg1, arg2) { + getObject(arg0).hash = getStringFromWasm0(arg1, arg2); + }; + imports.wbg.__wbg_new_7d95b89914e4d377 = function() { return handleError(function (arg0, arg1) { + const ret = new URL(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); }, arguments) }; - imports.wbg.__wbg_newwithstrandinit_05d7180788420c40 = function() { return handleError(function (arg0, arg1, arg2) { - const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2)); + imports.wbg.__wbg_newwithbase_41b4a8c94dd8c467 = function() { return handleError(function (arg0, arg1, arg2, arg3) { + const ret = new URL(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3)); return addHeapObject(ret); }, arguments) }; imports.wbg.__wbg_instanceof_Element_33bd126d58f2021b = function(arg0) { @@ -693,6 +829,17 @@ function getImports() { imports.wbg.__wbg_setinnerHTML_32081d8a164e6dc4 = function(arg0, arg1, arg2) { getObject(arg0).innerHTML = getStringFromWasm0(arg1, arg2); }; + imports.wbg.__wbg_outerHTML_bf662bdff92e5910 = function(arg0, arg1) { + const ret = getObject(arg1).outerHTML; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; + imports.wbg.__wbg_children_67776b4810f38b6a = function(arg0) { + const ret = getObject(arg0).children; + return addHeapObject(ret); + }; imports.wbg.__wbg_removeAttribute_beaed7727852af78 = function() { return handleError(function (arg0, arg1, arg2) { getObject(arg0).removeAttribute(getStringFromWasm0(arg1, arg2)); }, arguments) }; @@ -720,6 +867,29 @@ function getImports() { const ret = getObject(arg0).get(getObject(arg1)); return addHeapObject(ret); }, arguments) }; + imports.wbg.__wbg_url_1c013f0875e97715 = function(arg0, arg1) { + const ret = getObject(arg1).url; + const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; + imports.wbg.__wbg_headers_85824e993aa739bf = function(arg0) { + const ret = getObject(arg0).headers; + return addHeapObject(ret); + }; + imports.wbg.__wbg_newwithstr_fdce36db91ec5f92 = function() { return handleError(function (arg0, arg1) { + const ret = new Request(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_newwithstrandinit_05d7180788420c40 = function() { return handleError(function (arg0, arg1, arg2) { + const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2)); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_credentials_eab5c0bffc3e9cc5 = function(arg0) { + const ret = getObject(arg0).credentials; + return addHeapObject(ret); + }; imports.wbg.__wbg_getClientExtensionResults_0381c2792f96b9fa = function(arg0) { const ret = getObject(arg0).getClientExtensionResults(); return addHeapObject(ret); @@ -738,13 +908,27 @@ function getImports() { const ret = getObject(arg0).target; return isLikeNone(ret) ? 0 : addHeapObject(ret); }; + imports.wbg.__wbg_bubbles_03eed164b4feeaf1 = function(arg0) { + const ret = getObject(arg0).bubbles; + return ret; + }; imports.wbg.__wbg_cancelBubble_8c0bdf21c08f1717 = function(arg0) { const ret = getObject(arg0).cancelBubble; return ret; }; + imports.wbg.__wbg_composedPath_160ed014dc4d787f = function(arg0) { + const ret = getObject(arg0).composedPath(); + return addHeapObject(ret); + }; imports.wbg.__wbg_preventDefault_3209279b490de583 = function(arg0) { getObject(arg0).preventDefault(); }; + imports.wbg.__wbg_addEventListener_1fc744729ac6dc27 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4)); + }, arguments) }; + imports.wbg.__wbg_removeEventListener_b10f1a66647f3aa0 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0); + }, arguments) }; imports.wbg.__wbg_newwithform_6b545e9ddaccc455 = function() { return handleError(function (arg0) { const ret = new FormData(getObject(arg0)); return addHeapObject(ret); @@ -753,39 +937,6 @@ function getImports() { const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2)); return addHeapObject(ret); }; - imports.wbg.__wbg_credentials_eab5c0bffc3e9cc5 = function(arg0) { - const ret = getObject(arg0).credentials; - return addHeapObject(ret); - }; - imports.wbg.__wbg_addEventListener_1fc744729ac6dc27 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4)); - }, arguments) }; - imports.wbg.__wbg_removeEventListener_b10f1a66647f3aa0 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0); - }, arguments) }; - imports.wbg.__wbg_parentElement_0cffb3ceb0f107bd = function(arg0) { - const ret = getObject(arg0).parentElement; - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }; - imports.wbg.__wbg_lastChild_a2f5ed739809bb31 = function(arg0) { - const ret = getObject(arg0).lastChild; - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }; - imports.wbg.__wbg_setnodeValue_4077cafeefd0725e = function(arg0, arg1, arg2) { - getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_appendChild_e513ef0e5098dfdd = function() { return handleError(function (arg0, arg1) { - const ret = getObject(arg0).appendChild(getObject(arg1)); - return addHeapObject(ret); - }, arguments) }; - imports.wbg.__wbg_insertBefore_9f2d2defb9471006 = function() { return handleError(function (arg0, arg1, arg2) { - const ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2)); - return addHeapObject(ret); - }, arguments) }; - imports.wbg.__wbg_removeChild_6751e9ca5d9aaf00 = function() { return handleError(function (arg0, arg1) { - const ret = getObject(arg0).removeChild(getObject(arg1)); - return addHeapObject(ret); - }, arguments) }; imports.wbg.__wbg_instanceof_WorkerGlobalScope_16bb97a4549a3f21 = function(arg0) { let result; try { @@ -800,52 +951,6 @@ function getImports() { const ret = getObject(arg0).fetch(getObject(arg1)); return addHeapObject(ret); }; - imports.wbg.__wbg_pushState_38917fb88b4add30 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) { - getObject(arg0).pushState(getObject(arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5)); - }, arguments) }; - imports.wbg.__wbg_pathname_4441d4d8fc4aba51 = function() { return handleError(function (arg0, arg1) { - const ret = getObject(arg1).pathname; - const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - const len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) }; - imports.wbg.__wbg_search_4aac147f005678e5 = function() { return handleError(function (arg0, arg1) { - const ret = getObject(arg1).search; - const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - const len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }, arguments) }; - imports.wbg.__wbg_replace_ab0ff56e84982ad2 = function() { return handleError(function (arg0, arg1, arg2) { - getObject(arg0).replace(getStringFromWasm0(arg1, arg2)); - }, arguments) }; - imports.wbg.__wbg_instanceof_Response_eaa426220848a39e = function(arg0) { - let result; - try { - result = getObject(arg0) instanceof Response; - } catch { - result = false; - } - const ret = result; - return ret; - }; - imports.wbg.__wbg_status_c4ef3dd591e63435 = function(arg0) { - const ret = getObject(arg0).status; - return ret; - }; - imports.wbg.__wbg_headers_fd64ad685cf22e5d = function(arg0) { - const ret = getObject(arg0).headers; - return addHeapObject(ret); - }; - imports.wbg.__wbg_json_eb16b12f372e850c = function() { return handleError(function (arg0) { - const ret = getObject(arg0).json(); - return addHeapObject(ret); - }, arguments) }; - imports.wbg.__wbg_text_1169d752cc697903 = function() { return handleError(function (arg0) { - const ret = getObject(arg0).text(); - return addHeapObject(ret); - }, arguments) }; imports.wbg.__wbg_get_57245cc7d7c7619d = function(arg0, arg1) { const ret = getObject(arg0)[arg1 >>> 0]; return addHeapObject(ret); @@ -921,6 +1026,10 @@ function getImports() { imports.wbg.__wbg_set_a68214f35c417fa9 = function(arg0, arg1, arg2) { getObject(arg0)[arg1 >>> 0] = takeObject(arg2); }; + imports.wbg.__wbg_from_7ce3cb27cb258569 = function(arg0) { + const ret = Array.from(getObject(arg0)); + return addHeapObject(ret); + }; imports.wbg.__wbg_isArray_27c46c67f498e15d = function(arg0) { const ret = Array.isArray(getObject(arg0)); return ret; @@ -949,6 +1058,10 @@ function getImports() { const ret = result; return ret; }; + imports.wbg.__wbg_new_8d2af00bc1e329ee = function(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }; imports.wbg.__wbg_message_fe2af63ccc8985bc = function(arg0) { const ret = getObject(arg0).message; return addHeapObject(ret); @@ -969,10 +1082,6 @@ function getImports() { const ret = Number.isSafeInteger(getObject(arg0)); return ret; }; - imports.wbg.__wbg_valueOf_6b6effad03e5c546 = function(arg0) { - const ret = getObject(arg0).valueOf(); - return ret; - }; imports.wbg.__wbg_entries_65a76a413fc91037 = function(arg0) { const ret = Object.entries(getObject(arg0)); return addHeapObject(ret); @@ -1050,16 +1159,16 @@ function getImports() { const ret = wasm.memory; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper4824 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 1020, __wbg_adapter_48); + imports.wbg.__wbindgen_closure_wrapper4699 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 1064, __wbg_adapter_50); return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper5009 = function(arg0, arg1, arg2) { - const ret = makeClosure(arg0, arg1, 1044, __wbg_adapter_51); + imports.wbg.__wbindgen_closure_wrapper5635 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 1412, __wbg_adapter_53); return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper5669 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 1294, __wbg_adapter_54); + imports.wbg.__wbindgen_closure_wrapper5705 = function(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 1442, __wbg_adapter_56); return addHeapObject(ret); }; diff --git a/kanidmd_web_ui/pkg/kanidmd_web_ui_bg.wasm b/kanidmd_web_ui/pkg/kanidmd_web_ui_bg.wasm index de1dcbb0d..17299c280 100644 Binary files a/kanidmd_web_ui/pkg/kanidmd_web_ui_bg.wasm and b/kanidmd_web_ui/pkg/kanidmd_web_ui_bg.wasm differ diff --git a/kanidmd_web_ui/src/components/change_unix_password.rs b/kanidmd_web_ui/src/components/change_unix_password.rs index c6ac41bf3..bebd02b1c 100644 --- a/kanidmd_web_ui/src/components/change_unix_password.rs +++ b/kanidmd_web_ui/src/components/change_unix_password.rs @@ -25,7 +25,6 @@ pub struct ChangeUnixPassword { #[derive(Debug, Default)] struct FormValues { password_input: String, - password_repeat_input: String, } impl From for FormValues { @@ -36,10 +35,6 @@ impl From for FormValues { .get("password_input") .as_string() .expect_throw("Failed to pull the password input field"), - password_repeat_input: data - .get("password_repeat_input") - .as_string() - .expect_throw("Failed to pull the password_repeat input field"), } } } @@ -87,16 +82,6 @@ impl Component for ChangeUnixPassword { match msg { Msg::Submit(data) => { let fd: FormValues = data.into(); - if fd.password_input != fd.password_repeat_input { - return self.update( - ctx, - Msg::Error { - emsg: "Password fields did not match".to_string(), - kopid: None, - }, - ); - } - let id = ctx.props().uat.uuid; ctx.link().send_future(async move { @@ -174,7 +159,7 @@ impl Component for ChangeUnixPassword { - + - + - + - + { passkey_modals_html } diff --git a/kanidmd_web_ui/src/credential/totpmodal.rs b/kanidmd_web_ui/src/credential/totpmodal.rs index abcaa756e..5891e5e31 100644 --- a/kanidmd_web_ui/src/credential/totpmodal.rs +++ b/kanidmd_web_ui/src/credential/totpmodal.rs @@ -7,10 +7,8 @@ use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt}; use wasm_bindgen_futures::JsFuture; use web_sys::{Node, Request, RequestInit, RequestMode, Response}; use yew::prelude::*; -use yew_agent::Dispatched; -use super::eventbus::{EventBus, EventBusMsg}; -use super::reset::ModalProps; +use super::reset::{EventBusMsg, ModalProps}; use crate::error::*; use crate::utils; @@ -67,7 +65,11 @@ impl TotpModalApp { self.secret = TotpValue::Init; } - async fn submit_totp_update(token: CUSessionToken, req: CURequest) -> Result { + async fn submit_totp_update( + token: CUSessionToken, + req: CURequest, + cb: Callback, + ) -> Result { let req_jsvalue = serde_json::to_string(&(req, token)) .map(|s| JsValue::from(&s)) .expect_throw("Failed to serialise pw curequest"); @@ -97,7 +99,7 @@ impl TotpModalApp { let status: CUStatus = serde_wasm_bindgen::from_value(jsval).expect_throw("Invalid response type"); - EventBus::dispatcher().send(EventBusMsg::UpdateStatus { + cb.emit(EventBusMsg::UpdateStatus { status: status.clone(), }); @@ -134,7 +136,7 @@ impl Component for TotpModalApp { } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { #[cfg(debug_assertions)] console::debug!("totp modal::change"); false @@ -144,12 +146,13 @@ impl Component for TotpModalApp { #[cfg(debug_assertions)] console::debug!("totp modal::update"); let token_c = ctx.props().token.clone(); + let cb = ctx.props().cb.clone(); match msg { Msg::TotpCancel => { // Cancel the totp req! // Should end up with a success? ctx.link().send_future(async { - match Self::submit_totp_update(token_c, CURequest::CancelMFAReg).await { + match Self::submit_totp_update(token_c, CURequest::CancelMFAReg, cb).await { Ok(v) => v, Err(v) => v.into(), } @@ -165,7 +168,7 @@ impl Component for TotpModalApp { match totp.trim().parse::() { Ok(totp) => { ctx.link().send_future(async move { - match Self::submit_totp_update(token_c, CURequest::TotpVerify(totp)) + match Self::submit_totp_update(token_c, CURequest::TotpVerify(totp), cb) .await { Ok(v) => v, @@ -182,10 +185,8 @@ impl Component for TotpModalApp { } Msg::TotpGenerate => { // SEND OFF A REQUEST TO GET THE TOTP STRING - let token_c = ctx.props().token.clone(); - ctx.link().send_future(async { - match Self::submit_totp_update(token_c, CURequest::TotpGenerate).await { + match Self::submit_totp_update(token_c, CURequest::TotpGenerate, cb).await { Ok(v) => v, Err(v) => v.into(), } @@ -215,7 +216,7 @@ impl Component for TotpModalApp { } Msg::TotpAcceptSha1 => { ctx.link().send_future(async { - match Self::submit_totp_update(token_c, CURequest::TotpAcceptSha1).await { + match Self::submit_totp_update(token_c, CURequest::TotpAcceptSha1, cb).await { Ok(v) => v, Err(v) => v.into(), } @@ -229,7 +230,7 @@ impl Component for TotpModalApp { } Msg::Error { emsg, kopid } => { // Submit the error to the parent. - EventBus::dispatcher().send(EventBusMsg::Error { emsg, kopid }); + cb.emit(EventBusMsg::Error { emsg, kopid }); self.reset_and_hide(); } }; @@ -383,7 +384,7 @@ impl Component for TotpModalApp { TotpValue::Secret(secret) => { html! { Result<(), JsValue> { - yew::start_app::(); + yew::Renderer::::new().render(); #[cfg(debug_assertions)] gloo::console::debug!(kanidm_proto::utils::get_version("kanidmd_web_ui")); Ok(()) diff --git a/kanidmd_web_ui/src/login.rs b/kanidmd_web_ui/src/login.rs index d0f67101c..212eee3f7 100644 --- a/kanidmd_web_ui/src/login.rs +++ b/kanidmd_web_ui/src/login.rs @@ -252,7 +252,7 @@ impl LoginApp {
Init - prevent_default()".to_string()); e.prevent_default(); @@ -327,7 +327,7 @@ impl LoginApp {
Password - prevent_default()".to_string()); e.prevent_default(); LoginAppMsg::PasswordSubmit @@ -362,7 +362,7 @@ impl LoginApp { {"Backup Code"} BackupCode - prevent_default()".to_string()); e.prevent_default(); LoginAppMsg::BackupCodeSubmit @@ -394,7 +394,7 @@ impl LoginApp {
Totp - prevent_default()".to_string()); e.prevent_default(); LoginAppMsg::TotpSubmit @@ -509,7 +509,11 @@ impl LoginApp { // redirect #[cfg(debug_assertions)] console::debug!(format!("authenticated, try going to -> {:?}", loc)); - loc.goto(&ctx.link().history().expect_throw("failed to read history")); + loc.goto( + &ctx.link() + .navigator() + .expect_throw("failed to read history"), + ); html! {

{ "Login Success 🎉" }

@@ -581,7 +585,7 @@ impl Component for LoginApp { } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { false } diff --git a/kanidmd_web_ui/src/manager.rs b/kanidmd_web_ui/src/manager.rs index f15de2e50..7cfdfe035 100644 --- a/kanidmd_web_ui/src/manager.rs +++ b/kanidmd_web_ui/src/manager.rs @@ -41,14 +41,14 @@ pub enum Route { #[function_component(Landing)] fn landing() -> Html { - // Do this to allow use_history to work because lol. - use_history() + // Do this to allow use_navigator to work because lol. + yew_router::hooks::use_navigator() .expect_throw("Unable to access history") - .push(ViewRoute::Apps); + .push(&ViewRoute::Apps); html! {
} } -fn switch(route: &Route) -> Html { +fn switch(route: Route) -> Html { #[cfg(debug_assertions)] console::debug!("manager::switch"); match route { @@ -97,7 +97,7 @@ impl Component for ManagerApp { ManagerApp {} } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { #[cfg(debug_assertions)] console::debug!("manager::change"); false @@ -119,7 +119,7 @@ impl Component for ManagerApp { fn view(&self, _ctx: &Context) -> Html { html! { - render={ Switch::render(switch) } /> + render={ switch } /> } } diff --git a/kanidmd_web_ui/src/models/mod.rs b/kanidmd_web_ui/src/models/mod.rs index 688d0b944..d2d4221c5 100644 --- a/kanidmd_web_ui/src/models/mod.rs +++ b/kanidmd_web_ui/src/models/mod.rs @@ -7,7 +7,7 @@ use kanidm_proto::oauth2::AuthorisationRequest; use kanidm_proto::v1::{CUSessionToken, CUStatus}; use serde::{Deserialize, Serialize}; use wasm_bindgen::UnwrapThrowExt; -use yew_router::prelude::{AnyHistory, History}; +use yew_router::navigator::Navigator; use crate::manager::Route; use crate::views::ViewRoute; @@ -23,10 +23,10 @@ pub enum Location { } impl Location { - pub(crate) fn goto(self, history: &AnyHistory) { + pub(crate) fn goto(self, navigator: &Navigator) { match self { - Location::Manager(r) => history.push(r), - Location::Views(r) => history.push(r), + Location::Manager(r) => navigator.push(&r), + Location::Views(r) => navigator.push(&r), } } } diff --git a/kanidmd_web_ui/src/oauth2.rs b/kanidmd_web_ui/src/oauth2.rs index 6ce1533e2..685f79a6b 100644 --- a/kanidmd_web_ui/src/oauth2.rs +++ b/kanidmd_web_ui/src/oauth2.rs @@ -270,7 +270,7 @@ impl Component for Oauth2App { } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { #[cfg(debug_assertions)] console::debug!("oauth2::change"); false @@ -289,9 +289,9 @@ impl Component for Oauth2App { models::push_return_location(models::Location::Manager(Route::Oauth2)); ctx.link() - .history() + .navigator() .expect_throw("failed to read history") - .push(Route::Login); + .push(&Route::Login); // Don't need to redraw as we are yolo-ing out. false } @@ -409,7 +409,7 @@ impl Component for Oauth2App { html! { LoginRequired - prevent_default()"); e.prevent_default(); Oauth2Msg::LoginProceed @@ -459,7 +459,7 @@ impl Component for Oauth2App { let app_name = client_name.clone(); html! { Consent - prevent_default()"); e.prevent_default(); Oauth2Msg::ConsentGranted(client_name.to_string()) diff --git a/kanidmd_web_ui/src/views/apps.rs b/kanidmd_web_ui/src/views/apps.rs index 3e0ce049f..93d18bfaa 100644 --- a/kanidmd_web_ui/src/views/apps.rs +++ b/kanidmd_web_ui/src/views/apps.rs @@ -56,7 +56,7 @@ impl Component for AppsApp { AppsApp { state } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { #[cfg(debug_assertions)] console::debug!("views::apps::changed"); false diff --git a/kanidmd_web_ui/src/views/mod.rs b/kanidmd_web_ui/src/views/mod.rs index b9ad04aec..2dcb333e2 100644 --- a/kanidmd_web_ui/src/views/mod.rs +++ b/kanidmd_web_ui/src/views/mod.rs @@ -125,7 +125,7 @@ impl Component for ViewsApp { ViewsApp { state } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { #[cfg(debug_assertions)] console::debug!("views::changed"); false @@ -179,20 +179,16 @@ impl Component for ViewsApp { match &self.state { State::LoginRequired => { // Where are we? - let loc = ctx - .link() - .history() - .expect_throw("failed to read history") - .location() - .route() - .expect_throw("invalid route"); + let maybe_loc: Option = ctx.link().route(); - models::push_return_location(models::Location::Views(loc)); + if let Some(loc) = maybe_loc { + models::push_return_location(models::Location::Views(loc)); + } ctx.link() - .history() + .navigator() .expect_throw("failed to read history") - .push(Route::Login); + .push(&Route::Login); html! {
} } State::LoggingOut | State::Verifying => { @@ -326,11 +322,11 @@ impl ViewsApp {
- render={ Switch::render(move |route: &ViewRoute| { + render={ move |route: ViewRoute| { // safety - can't panic because to get to this location we MUST be authenticated! match route { ViewRoute::Admin => html!{ - render={ Switch::render(admin_routes) } /> + render={ admin_routes } /> }, #[allow(clippy::let_unit_value)] ViewRoute::Apps => html! { }, @@ -340,7 +336,8 @@ impl ViewsApp { to={Route::NotFound}/> }, } - })} /> + } + } />
} @@ -449,7 +446,7 @@ impl ViewsApp { } } -fn admin_routes(route: &AdminRoute) -> Html { +fn admin_routes(route: AdminRoute) -> Html { match route { AdminRoute::AdminMenu => html! { diff --git a/kanidmd_web_ui/src/views/profile.rs b/kanidmd_web_ui/src/views/profile.rs index 2a8f1a61a..4a03fca3a 100644 --- a/kanidmd_web_ui/src/views/profile.rs +++ b/kanidmd_web_ui/src/views/profile.rs @@ -112,7 +112,7 @@ impl Component for ProfileApp { } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { true } diff --git a/kanidmd_web_ui/src/views/security.rs b/kanidmd_web_ui/src/views/security.rs index 2aa4690c4..9c2d334bd 100644 --- a/kanidmd_web_ui/src/views/security.rs +++ b/kanidmd_web_ui/src/views/security.rs @@ -58,7 +58,7 @@ impl Component for SecurityApp { SecurityApp { state: State::Init } } - fn changed(&mut self, _ctx: &Context) -> bool { + fn changed(&mut self, _ctx: &Context, _props: &Self::Properties) -> bool { #[cfg(debug_assertions)] console::debug!("views::security::changed"); true @@ -91,9 +91,9 @@ impl Component for SecurityApp { models::push_return_location(models::Location::Views(ViewRoute::Security)); ctx.link() - .history() + .navigator() .expect_throw("failed to read history") - .push(Route::CredentialReset); + .push(&Route::CredentialReset); // No need to redraw, or reset state, since this redirect will destroy // the state. false