Update yew to 0.20 (#1308)

This commit is contained in:
Firstyear 2023-01-08 12:34:30 +10:00 committed by GitHub
parent f16e0886ae
commit 639ab0355e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 502 additions and 407 deletions

145
Cargo.lock generated
View file

@ -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",

View file

@ -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

View file

@ -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]

View file

@ -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);
};

View file

@ -25,7 +25,6 @@ pub struct ChangeUnixPassword {
#[derive(Debug, Default)]
struct FormValues {
password_input: String,
password_repeat_input: String,
}
impl From<FormData> for FormValues {
@ -36,10 +35,6 @@ impl From<FormData> 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 {
<div class="modal-dialog" role="document">
<form
onsubmit={
ctx.link().callback(|e: FocusEvent| {
ctx.link().callback(|e: SubmitEvent| {
e.prevent_default();
#[allow(clippy::expect_used)]
let form = e.target().and_then(|t| t.dyn_into::<HtmlFormElement>().ok()).expect("Failed to pull the form data from the browser");
@ -246,7 +231,7 @@ impl Component for ChangeUnixPassword {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
false
}

View file

@ -5,10 +5,8 @@ use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
use wasm_bindgen_futures::JsFuture;
use web_sys::{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;
@ -43,7 +41,11 @@ impl DeleteApp {
self.state = State::Init;
}
async fn submit_update(token: CUSessionToken, req: CURequest) -> Result<Msg, FetchError> {
async fn submit_update(
token: CUSessionToken,
req: CURequest,
cb: Callback<EventBusMsg>,
) -> Result<Msg, FetchError> {
let req_jsvalue = serde_json::to_string(&(req, token))
.map(|s| JsValue::from(&s))
.expect_throw("Failed to serialise pw curequest");
@ -73,7 +75,7 @@ impl DeleteApp {
let status: CUStatus =
serde_wasm_bindgen::from_value(jsval).expect_throw("Invalid response type");
EventBus::dispatcher().send(EventBusMsg::UpdateStatus { status });
cb.emit(EventBusMsg::UpdateStatus { status });
Ok(Msg::Success)
} else {
@ -95,7 +97,7 @@ impl Component for DeleteApp {
DeleteApp { state: State::Init }
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
#[cfg(debug_assertions)]
console::debug!("delete modal::change");
false
@ -105,13 +107,14 @@ impl Component for DeleteApp {
#[cfg(debug_assertions)]
console::debug!("delete modal::update");
let token_c = ctx.props().token.clone();
let cb = ctx.props().cb.clone();
match msg {
Msg::Cancel => {
self.reset_and_hide();
}
Msg::Submit => {
ctx.link().send_future(async {
match Self::submit_update(token_c, CURequest::PrimaryRemove).await {
match Self::submit_update(token_c, CURequest::PrimaryRemove, cb).await {
Ok(v) => v,
Err(v) => v.into(),
}
@ -124,7 +127,7 @@ impl Component for DeleteApp {
}
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();
}
};

View file

@ -1,47 +0,0 @@
use std::collections::HashSet;
use kanidm_proto::v1::CUStatus;
use serde::{Deserialize, Serialize};
use yew_agent::{Agent, AgentLink, Context, HandlerId};
#[derive(Serialize, Deserialize, Debug, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum EventBusMsg {
UpdateStatus { status: CUStatus },
Error { emsg: String, kopid: Option<String> },
}
pub struct EventBus {
link: AgentLink<EventBus>,
subscribers: HashSet<HandlerId>,
}
impl Agent for EventBus {
type Input = EventBusMsg;
type Message = ();
type Output = EventBusMsg;
type Reach = Context<Self>;
fn create(link: AgentLink<Self>) -> Self {
Self {
link,
subscribers: HashSet::new(),
}
}
fn update(&mut self, _msg: Self::Message) {}
fn handle_input(&mut self, msg: Self::Input, _id: HandlerId) {
for sub in self.subscribers.iter() {
self.link.respond(*sub, msg.clone());
}
}
fn connected(&mut self, id: HandlerId) {
self.subscribers.insert(id);
}
fn disconnected(&mut self, id: HandlerId) {
self.subscribers.remove(&id);
}
}

View file

@ -1,7 +1,6 @@
pub mod reset;
mod delete;
mod eventbus;
mod passkey;
mod passkeyremove;
mod pwmodal;

View file

@ -5,10 +5,8 @@ use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
use wasm_bindgen_futures::JsFuture;
use web_sys::{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;
@ -57,6 +55,7 @@ impl PasskeyModalApp {
async fn submit_passkey_update(
token: CUSessionToken,
req: CURequest,
cb: Callback<EventBusMsg>,
) -> Result<Msg, FetchError> {
let req_jsvalue = serde_json::to_string(&(req, token))
.map(|s| JsValue::from(&s))
@ -87,7 +86,7 @@ impl PasskeyModalApp {
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(),
});
@ -123,13 +122,14 @@ impl Component for PasskeyModalApp {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
console::debug!("passkey modal::change");
false
}
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
console::debug!("passkey modal::update");
let cb = ctx.props().cb.clone();
match msg {
Msg::LabelCheck => {
let label = utils::get_value_from_element_id("passkey-label")
@ -149,6 +149,7 @@ impl Component for PasskeyModalApp {
match Self::submit_passkey_update(
token_c,
CURequest::PasskeyFinish(label, rpkc),
cb,
)
.await
{
@ -169,7 +170,7 @@ impl Component for PasskeyModalApp {
let token_c = ctx.props().token.clone();
ctx.link().send_future(async {
match Self::submit_passkey_update(token_c, CURequest::PasskeyInit).await {
match Self::submit_passkey_update(token_c, CURequest::PasskeyInit, cb).await {
Ok(v) => v,
Err(v) => v.into(),
}
@ -227,7 +228,7 @@ impl Component for PasskeyModalApp {
let token_c = ctx.props().token.clone();
ctx.link().send_future(async {
match Self::submit_passkey_update(token_c, CURequest::CancelMFAReg).await {
match Self::submit_passkey_update(token_c, CURequest::CancelMFAReg, cb).await {
Ok(v) => v,
Err(v) => v.into(),
}
@ -237,7 +238,7 @@ impl Component for PasskeyModalApp {
}
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();
}
};
@ -308,7 +309,7 @@ impl Component for PasskeyModalApp {
html! {
<>
<form class="row needs-validation" novalidate=true
onsubmit={ ctx.link().callback(move |e: FocusEvent| {
onsubmit={ ctx.link().callback(move |e: SubmitEvent| {
#[cfg(debug_assertions)]
console::debug!("passkey modal::on form submit prevent default");
e.prevent_default();

View file

@ -6,10 +6,8 @@ use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
use wasm_bindgen_futures::JsFuture;
use web_sys::{Request, RequestInit, RequestMode, Response};
use yew::prelude::*;
use yew_agent::Dispatched;
use super::eventbus::{EventBus, EventBusMsg};
use super::reset::PasskeyRemoveModalProps;
use super::reset::{EventBusMsg, PasskeyRemoveModalProps};
use crate::error::*;
use crate::utils;
@ -66,6 +64,7 @@ impl PasskeyRemoveModalApp {
async fn submit_passkey_update(
token: CUSessionToken,
req: CURequest,
cb: Callback<EventBusMsg>,
) -> Result<Msg, FetchError> {
let req_jsvalue = serde_json::to_string(&(req, token))
.map(|s| JsValue::from(&s))
@ -96,7 +95,7 @@ impl PasskeyRemoveModalApp {
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(),
});
@ -139,7 +138,7 @@ impl Component for PasskeyRemoveModalApp {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
#[cfg(debug_assertions)]
console::debug!("passkey remove modal::change");
false
@ -148,6 +147,7 @@ impl Component for PasskeyRemoveModalApp {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
#[cfg(debug_assertions)]
console::debug!("passkey remove modal::update");
let cb = ctx.props().cb.clone();
match msg {
Msg::Submit => {
self.reset_and_hide();
@ -157,7 +157,8 @@ impl Component for PasskeyRemoveModalApp {
let uuid = self.uuid;
ctx.link().send_future(async move {
match Self::submit_passkey_update(token_c, CURequest::PasskeyRemove(uuid)).await
match Self::submit_passkey_update(token_c, CURequest::PasskeyRemove(uuid), cb)
.await
{
Ok(v) => v,
Err(v) => v.into(),
@ -171,7 +172,7 @@ impl Component for PasskeyRemoveModalApp {
}
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();
}
}

View file

@ -4,10 +4,8 @@ use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
use wasm_bindgen_futures::JsFuture;
use web_sys::{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;
@ -125,7 +123,7 @@ impl Component for PwModalApp {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
#[cfg(debug_assertions)]
console::debug!("pw modal::change");
false
@ -134,6 +132,7 @@ impl Component for PwModalApp {
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
#[cfg(debug_assertions)]
console::debug!("pw modal::update");
let cb = ctx.props().cb.clone();
match msg {
Msg::PasswordCheck => {
// default is empty string
@ -169,12 +168,12 @@ impl Component for PwModalApp {
Msg::PasswordResponseQuality { feedback } => self.state = PwState::Feedback(feedback),
Msg::PasswordResponseSuccess { status } => {
// Submit the update to the parent
EventBus::dispatcher().send(EventBusMsg::UpdateStatus { status });
cb.emit(EventBusMsg::UpdateStatus { status });
self.reset_and_hide();
}
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();
}
};
@ -254,7 +253,7 @@ impl Component for PwModalApp {
</div>
<div class="modal-body">
<form class="row g-3 needs-validation" novalidate=true
onsubmit={ ctx.link().callback(move |e: FocusEvent| {
onsubmit={ ctx.link().callback(move |e: SubmitEvent| {
console::debug!("pw modal::on form submit prevent default");
e.prevent_default();
if submit_enabled {

View file

@ -7,11 +7,9 @@ use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
use wasm_bindgen_futures::JsFuture;
use web_sys::{Request, RequestInit, RequestMode, Response};
use yew::prelude::*;
use yew_agent::{Bridge, Bridged};
use yew_router::prelude::*;
use super::delete::DeleteApp;
use super::eventbus::{EventBus, EventBusMsg};
use super::passkey::PasskeyModalApp;
use super::passkeyremove::PasskeyRemoveModalApp;
use super::pwmodal::PwModalApp;
@ -19,16 +17,27 @@ use super::totpmodal::TotpModalApp;
use crate::error::*;
use crate::{models, utils};
#[derive(PartialEq, Eq, Properties)]
pub struct ModalProps {
pub token: CUSessionToken,
// use std::rc::Rc;
#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum EventBusMsg {
UpdateStatus { status: CUStatus },
Error { emsg: String, kopid: Option<String> },
}
#[derive(PartialEq, Eq, Properties)]
#[derive(PartialEq, Properties)]
pub struct ModalProps {
pub token: CUSessionToken,
pub cb: Callback<EventBusMsg>,
}
#[derive(PartialEq, Properties)]
pub struct PasskeyRemoveModalProps {
pub token: CUSessionToken,
pub tag: String,
pub uuid: Uuid,
pub cb: Callback<EventBusMsg>,
}
pub enum Msg {
@ -80,9 +89,7 @@ enum State {
pub struct CredentialResetApp {
state: State,
// TODO: I'm sure past-William had a plan for this 🚌
#[allow(dead_code)]
eventbus: Box<dyn Bridge<EventBus>>,
cb: Callback<EventBusMsg>,
}
impl Component for CredentialResetApp {
@ -141,15 +148,21 @@ impl Component for CredentialResetApp {
},
};
let eventbus = EventBus::bridge(ctx.link().callback(|req| match req {
EventBusMsg::UpdateStatus { status } => Msg::UpdateSession { status },
EventBusMsg::Error { emsg, kopid } => Msg::Error { emsg, kopid },
}));
let cb = Callback::from({
let link = ctx.link().clone();
move |emsg| {
let msg = match emsg {
EventBusMsg::UpdateStatus { status } => Msg::UpdateSession { status },
EventBusMsg::Error { emsg, kopid } => Msg::Error { emsg, kopid },
};
link.send_message(msg);
}
});
CredentialResetApp { state, eventbus }
CredentialResetApp { state, cb }
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
#[cfg(debug_assertions)]
console::debug!("credential::reset::change");
false
@ -218,7 +231,11 @@ impl Component for CredentialResetApp {
let loc = models::pop_return_location();
#[cfg(debug_assertions)]
console::debug!(format!("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"),
);
None
}
@ -273,7 +290,7 @@ impl CredentialResetApp {
// <h3>{ "idm.example.com" } </h3>
</center>
<form
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
console::debug!("credential::reset::view_token_input -> TokenInput - prevent_default()");
e.prevent_default();
@ -322,6 +339,7 @@ impl CredentialResetApp {
let displayname = status.displayname.clone();
let spn = status.spn.clone();
let cb = self.cb.clone();
let can_commit = status.can_commit;
@ -429,7 +447,7 @@ impl CredentialResetApp {
<>
{ for status.passkeys.iter()
.map(|detail|
html! { <PasskeyRemoveModalApp token={ token.clone() } tag={ detail.tag.clone() } uuid={ detail.uuid } /> }
html! { <PasskeyRemoveModalApp token={ token.clone() } tag={ detail.tag.clone() } uuid={ detail.uuid } cb={ cb.clone() } /> }
)
}
</>
@ -490,13 +508,13 @@ impl CredentialResetApp {
</div>
</main>
<PasskeyModalApp token={ token.clone() } />
<PasskeyModalApp token={ token.clone() } cb={ cb.clone() } />
<PwModalApp token={ token.clone() } />
<PwModalApp token={ token.clone() } cb={ cb.clone() } />
<TotpModalApp token={ token.clone() }/>
<TotpModalApp token={ token.clone() } cb={ cb.clone() }/>
<DeleteApp token= { token.clone() }/>
<DeleteApp token= { token.clone() } cb={ cb.clone() }/>
{ passkey_modals_html }

View file

@ -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<Msg, FetchError> {
async fn submit_totp_update(
token: CUSessionToken,
req: CURequest,
cb: Callback<EventBusMsg>,
) -> Result<Msg, FetchError> {
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<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _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::<u32>() {
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! {
<form class="row g-3 needs-validation" novalidate=true
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
e.prevent_default();
Msg::TotpSubmit
} ) }

View file

@ -30,7 +30,7 @@ mod components;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen)]
pub fn run_app() -> Result<(), JsValue> {
yew::start_app::<manager::ManagerApp>();
yew::Renderer::<manager::ManagerApp>::new().render();
#[cfg(debug_assertions)]
gloo::console::debug!(kanidm_proto::utils::get_version("kanidmd_web_ui"));
Ok(())

View file

@ -252,7 +252,7 @@ impl LoginApp {
<div class="container">
<label for="username" class="form-label">{ "Username" }</label>
<form
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
#[cfg(debug_assertions)]
console::debug!("login::view_state -> Init - prevent_default()".to_string());
e.prevent_default();
@ -327,7 +327,7 @@ impl LoginApp {
<div class="container">
<label for="password" class="form-label">{ "Password" }</label>
<form
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
console::debug!("login::view_state -> Password - prevent_default()".to_string());
e.prevent_default();
LoginAppMsg::PasswordSubmit
@ -362,7 +362,7 @@ impl LoginApp {
{"Backup Code"}
</label>
<form
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
console::debug!("login::view_state -> BackupCode - prevent_default()".to_string());
e.prevent_default();
LoginAppMsg::BackupCodeSubmit
@ -394,7 +394,7 @@ impl LoginApp {
<div class="container">
<label for="totp" class="form-label">{"TOTP"}</label>
<form
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
console::debug!("login::view_state -> 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! {
<div class="alert alert-success">
<h3>{ "Login Success 🎉" }</h3>
@ -581,7 +585,7 @@ impl Component for LoginApp {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
false
}

View file

@ -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! { <main></main> }
}
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<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _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<Self>) -> Html {
html! {
<BrowserRouter>
<Switch<Route> render={ Switch::render(switch) } />
<Switch<Route> render={ switch } />
</BrowserRouter>
}
}

View file

@ -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),
}
}
}

View file

@ -270,7 +270,7 @@ impl Component for Oauth2App {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _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! {
<form
onsubmit={ ctx.link().callback(|e: FocusEvent| {
onsubmit={ ctx.link().callback(|e: SubmitEvent| {
console::debug!("oauth2::view -> LoginRequired - prevent_default()");
e.prevent_default();
Oauth2Msg::LoginProceed
@ -459,7 +459,7 @@ impl Component for Oauth2App {
let app_name = client_name.clone();
html! {
<form
onsubmit={ ctx.link().callback(move |e: FocusEvent| {
onsubmit={ ctx.link().callback(move |e: SubmitEvent| {
console::debug!("oauth2::view -> Consent - prevent_default()");
e.prevent_default();
Oauth2Msg::ConsentGranted(client_name.to_string())

View file

@ -56,7 +56,7 @@ impl Component for AppsApp {
AppsApp { state }
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
#[cfg(debug_assertions)]
console::debug!("views::apps::changed");
false

View file

@ -125,7 +125,7 @@ impl Component for ViewsApp {
ViewsApp { state }
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _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<ViewRoute> = 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! { <div></div> }
}
State::LoggingOut | State::Verifying => {
@ -326,11 +322,11 @@ impl ViewsApp {
</div>
</div>
<main class="p-3 x-auto">
<Switch<ViewRoute> render={ Switch::render(move |route: &ViewRoute| {
<Switch<ViewRoute> render={ move |route: ViewRoute| {
// safety - can't panic because to get to this location we MUST be authenticated!
match route {
ViewRoute::Admin => html!{
<Switch<AdminRoute> render={ Switch::render(admin_routes) } />
<Switch<AdminRoute> render={ admin_routes } />
},
#[allow(clippy::let_unit_value)]
ViewRoute::Apps => html! { <AppsApp /> },
@ -340,7 +336,8 @@ impl ViewsApp {
<Redirect<Route> to={Route::NotFound}/>
},
}
})} />
}
} />
</main>
</>
}
@ -449,7 +446,7 @@ impl ViewsApp {
}
}
fn admin_routes(route: &AdminRoute) -> Html {
fn admin_routes(route: AdminRoute) -> Html {
match route {
AdminRoute::AdminMenu => html! {
<admin_menu::AdminMenu />

View file

@ -112,7 +112,7 @@ impl Component for ProfileApp {
}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _props: &Self::Properties) -> bool {
true
}

View file

@ -58,7 +58,7 @@ impl Component for SecurityApp {
SecurityApp { state: State::Init }
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
fn changed(&mut self, _ctx: &Context<Self>, _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