Compare commits
61 Commits
Refacor-MA
...
tactical-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
026349e82b | ||
|
|
2247a50296 | ||
|
|
9f18b593f9 | ||
|
|
ec7a79b8b6 | ||
|
|
3581a7edef | ||
|
|
d908755f45 | ||
|
|
f5e3ba706f | ||
|
|
042867e0db | ||
|
|
ebe885e02d | ||
|
|
7fab1257a9 | ||
|
|
3a42785fde | ||
|
|
8859ab7058 | ||
|
|
8ebea56925 | ||
|
|
a4ac6f474b | ||
|
|
9e5caf2043 | ||
|
|
a530303f73 | ||
|
|
8b6989f45e | ||
|
|
97822502c4 | ||
|
|
7615b24e8f | ||
|
|
dd4685d8ae | ||
|
|
1e195f12e2 | ||
|
|
7a1e385802 | ||
|
|
b766ef2ee4 | ||
|
|
f41ea8e67c | ||
|
|
8acd2e701d | ||
|
|
6002cfb866 | ||
|
|
94686d5815 | ||
|
|
c93bb7ad17 | ||
|
|
598718f9d8 | ||
|
|
6adfa1429e | ||
|
|
c054995509 | ||
|
|
f6ff2f1212 | ||
|
|
bb2d30e890 | ||
|
|
3e9a85a2a7 | ||
|
|
cd2092a7c9 | ||
|
|
12b79ed17c | ||
|
|
63e1ae6f0d | ||
|
|
f9dfb4bf64 | ||
|
|
298b35af4c | ||
|
|
e4e8b1a79d | ||
|
|
9ae78e01cc | ||
|
|
33e816e820 | ||
|
|
af3714bcfa | ||
|
|
71f261da52 | ||
|
|
b09d9e7c54 | ||
|
|
d7a93d5a3f | ||
|
|
523bae94f2 | ||
|
|
f1aeeed085 | ||
|
|
f456749a66 | ||
|
|
87d96d938f | ||
|
|
d012926261 | ||
|
|
77002200a3 | ||
|
|
367d778ec1 | ||
|
|
d466c1199d | ||
|
|
bcf3ec0d8c | ||
|
|
99ec37991e | ||
|
|
f99e1504f6 | ||
|
|
ee4fbf9a75 | ||
|
|
8a23815bd1 | ||
|
|
649a9a3648 | ||
|
|
e4305fbb41 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1 +1,6 @@
|
||||
/target
|
||||
.env
|
||||
backend/target/sqlx/backend
|
||||
Cargo.lock
|
||||
frontend/dist/db-frontend-a8d46cf89f6300e8.js
|
||||
frontend/dist
|
||||
|
||||
1868
Cargo.lock
generated
1868
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Project structure
|
||||
The project structure is divided into 3 thingies
|
||||
|
||||
## Frontend
|
||||
- Utilises YEW
|
||||
- Builds component with HTML macro
|
||||
- Don't need anythign fancy yet
|
||||
- Will hopefully add more here
|
||||
- [ ] Make user input without dying
|
||||
|
||||
## Backend
|
||||
Realised that diesel is abysmal and should not be used holy fuck
|
||||
- sqlx my beloved
|
||||
- we write the SQL code and it gets checked at compile time very cool
|
||||
- [ ] Define structs for certain types for simplicity sake
|
||||
1
backend
1
backend
Submodule backend deleted from 3eb1f29485
19
backend/Cargo.toml
Normal file
19
backend/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "backend"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dotenv = "0.15"
|
||||
common = { path = "../common"}
|
||||
yew = { version = "0.20.0", features = ["csr"] }
|
||||
anyhow = "1.0"
|
||||
futures = "0.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sqlx = {version = "0.6", features = ["postgres", "json", "runtime-actix-rustls", "chrono", "decimal", "uuid", "offline"] }
|
||||
async-trait = "0.1.60"
|
||||
actix-web = "4"
|
||||
chrono = {version = "0.4.23", features = ["serde"]}
|
||||
21
backend/LICENSE
Normal file
21
backend/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Linly
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
8
backend/diesel.toml
Normal file
8
backend/diesel.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
# For documentation on how to configure this file,
|
||||
# see https://diesel.rs/guides/configuring-diesel-cli
|
||||
|
||||
[print_schema]
|
||||
file = "src/schema.rs"
|
||||
|
||||
[migrations_directory]
|
||||
dir = "migrations"
|
||||
0
backend/migrations/.keep
Normal file
0
backend/migrations/.keep
Normal file
69
backend/sqlx-data.json
Normal file
69
backend/sqlx-data.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"db": "PostgreSQL",
|
||||
"eab68949a5cbad11b0ca3bc62e4e5c3611df0d3af69633dba08e3ad3941d76d1": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Text",
|
||||
"Text",
|
||||
"Date",
|
||||
"Date"
|
||||
]
|
||||
}
|
||||
},
|
||||
"query": "\n INSERT INTO drivers ( id, name, address, reg_date, birthdate )\n VALUES ( $1, $2, $3, $4, $5 ) \n RETURNING id\n "
|
||||
},
|
||||
"edfc7e63f5381c6f71191820f798a0f66ebaee1ceb9f3a5466d9f73ffe8271d0": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Int4"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "address",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "reg_date",
|
||||
"ordinal": 3,
|
||||
"type_info": "Date"
|
||||
},
|
||||
{
|
||||
"name": "birthdate",
|
||||
"ordinal": 4,
|
||||
"type_info": "Date"
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
],
|
||||
"parameters": {
|
||||
"Left": []
|
||||
}
|
||||
},
|
||||
"query": "SELECT * FROM drivers"
|
||||
}
|
||||
}
|
||||
2
backend/src/admin_data.rs
Normal file
2
backend/src/admin_data.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
46
backend/src/driver_data.rs
Normal file
46
backend/src/driver_data.rs
Normal file
@@ -0,0 +1,46 @@
|
||||
use crate::pog::SqlStruct;
|
||||
use actix_web::{get, web, HttpResponse, Responder};
|
||||
use async_trait::async_trait;
|
||||
use chrono::NaiveDate;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, sqlx::FromRow)]
|
||||
pub struct Driver {
|
||||
pub id: i32,
|
||||
pub name: String,
|
||||
pub address: String,
|
||||
pub reg_date: NaiveDate,
|
||||
pub birthdate: NaiveDate,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl SqlStruct<i32> for Driver {
|
||||
async fn add(&self, pool: &PgPool) -> anyhow::Result<i32> {
|
||||
let rec = sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO drivers ( id, name, address, reg_date, birthdate )
|
||||
VALUES ( $1, $2, $3, $4, $5 )
|
||||
RETURNING id
|
||||
"#,
|
||||
self.id as i32,
|
||||
self.name,
|
||||
self.address,
|
||||
self.reg_date,
|
||||
self.birthdate,
|
||||
)
|
||||
.fetch_one(pool)
|
||||
.await?;
|
||||
Ok(rec.id)
|
||||
}
|
||||
}
|
||||
#[get("/api/json/drivers")]
|
||||
pub async fn list_all(db_pool: web::Data<PgPool>) -> impl Responder {
|
||||
let drivers = sqlx::query_as!(Driver, "SELECT * FROM drivers")
|
||||
.fetch_all(db_pool.get_ref())
|
||||
.await
|
||||
.expect("Could not fetch anything from the DB D:");
|
||||
HttpResponse::Ok()
|
||||
.content_type("application/json")
|
||||
.json(drivers)
|
||||
}
|
||||
38
backend/src/main.rs
Normal file
38
backend/src/main.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
use actix_web::{web, App, HttpServer};
|
||||
use dotenv::dotenv;
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use std::env;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub mod admin_data;
|
||||
pub mod driver_data;
|
||||
pub mod pog;
|
||||
pub mod radar_data;
|
||||
pub mod ticket_data;
|
||||
pub mod vehicle_data;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
dotenv().ok();
|
||||
let port: u16 = env::var("ACTIX_PORT")
|
||||
.expect("SET ACTIX_PORT PLOX")
|
||||
.parse()
|
||||
.expect("NOPE CANT PARSE THIS WHAT DID YOU PUT IN?!!!");
|
||||
let address = env::var("ACTIX_IP").expect("SET ACTIX_IP PLOX");
|
||||
let database_url = env::var("DATABASE_URL").expect("Put a DB url in the .env file dumbass");
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(10)
|
||||
.connect(database_url.as_str())
|
||||
.await
|
||||
.expect("No pool connection man :(");
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.app_data(web::Data::new(pool.clone()))
|
||||
.service(driver_data::list_all)
|
||||
})
|
||||
.bind((address.as_str(), port))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
9
backend/src/pog.rs
Normal file
9
backend/src/pog.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use sqlx::PgPool;
|
||||
|
||||
//Nuke happened here but we got POOLS :DDDDDD
|
||||
#[async_trait]
|
||||
pub trait SqlStruct<T> {
|
||||
async fn add(&self, pool: &PgPool) -> Result<T>;
|
||||
}
|
||||
2
backend/src/radar_data.rs
Normal file
2
backend/src/radar_data.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
30
backend/src/tests.rs
Normal file
30
backend/src/tests.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use super::*;
|
||||
use actix_web::{
|
||||
http::header::ContentType,
|
||||
test::{self, init_service},
|
||||
};
|
||||
|
||||
//TODO: sqlx offline mode for these tests
|
||||
#[actix_web::test]
|
||||
async fn test_list_drivers_ok() {
|
||||
dotenv().ok();
|
||||
let database_url = env::var("DATABASE_URL").expect("Put a DB url in the .env file dumbass");
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(10)
|
||||
.connect(database_url.as_str())
|
||||
.await
|
||||
.expect("No pool connection man :(");
|
||||
let app = tests::init_service(
|
||||
App::new()
|
||||
.app_data(web::Data::new(pool.clone()))
|
||||
.service(driver_data::list_all),
|
||||
)
|
||||
.await;
|
||||
let req = test::TestRequest::get()
|
||||
.uri("/api/json/drivers")
|
||||
.insert_header(ContentType::plaintext())
|
||||
.to_request();
|
||||
let resp = test::call_service(&app, req).await;
|
||||
assert!(resp.status().is_success());
|
||||
}
|
||||
//TODO: sqlx tests
|
||||
2
backend/src/ticket_data.rs
Normal file
2
backend/src/ticket_data.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
2
backend/src/vehicle_data.rs
Normal file
2
backend/src/vehicle_data.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
@@ -15,3 +15,32 @@ pub struct CommonAdmin {
|
||||
pub name: String,
|
||||
pub address: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CommonDriver {
|
||||
pub id: i32,
|
||||
pub name: String,
|
||||
pub address: String,
|
||||
}
|
||||
|
||||
//generate common radar struct
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CommonRadar {
|
||||
pub id: i32,
|
||||
pub category: Option<String>,
|
||||
pub address: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CommonVehicle {
|
||||
pub model: Option<String>,
|
||||
pub category: String,
|
||||
pub color: Option<String>,
|
||||
pub chasse_num: Option<i32>,
|
||||
pub plate_num: String,
|
||||
pub vehicle_type: String,
|
||||
pub owner: Option<i32>,
|
||||
}
|
||||
|
||||
1
frontend
1
frontend
Submodule frontend deleted from 23ff6c8645
866
frontend/Cargo.lock
generated
Normal file
866
frontend/Cargo.lock
generated
Normal file
@@ -0,0 +1,866 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "anymap2"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "boolinator"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "console_error_panic_hook"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "db-frontend"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"yew",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a4bef6b277b3ab073253d4bca60761240cf8d6998f4bd142211957b69a61b20"
|
||||
dependencies = [
|
||||
"gloo-console",
|
||||
"gloo-dialogs",
|
||||
"gloo-events",
|
||||
"gloo-file",
|
||||
"gloo-history",
|
||||
"gloo-net",
|
||||
"gloo-render",
|
||||
"gloo-storage",
|
||||
"gloo-timers",
|
||||
"gloo-utils",
|
||||
"gloo-worker",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-console"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f"
|
||||
dependencies = [
|
||||
"gloo-utils",
|
||||
"js-sys",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-dialogs"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-events"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-file"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7"
|
||||
dependencies = [
|
||||
"gloo-events",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-history"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ce5ae65c5d76e2bbd9f274d7dcc00a306a79964305efa275a0ac728caaeb792"
|
||||
dependencies = [
|
||||
"gloo-events",
|
||||
"gloo-utils",
|
||||
"serde",
|
||||
"serde-wasm-bindgen",
|
||||
"serde_urlencoded",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-net"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9050ff8617e950288d7bf7f300707639fdeda5ca0d0ecf380cff448cfd52f4a6"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"gloo-utils",
|
||||
"js-sys",
|
||||
"pin-project",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-render"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-storage"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480"
|
||||
dependencies = [
|
||||
"gloo-utils",
|
||||
"js-sys",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-utils"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-worker"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a"
|
||||
dependencies = [
|
||||
"anymap2",
|
||||
"bincode",
|
||||
"gloo-console",
|
||||
"gloo-utils",
|
||||
"js-sys",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "implicit-clone"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "649cb12b410f9519ebc452e87a8e32c4f8cfc080968cf9b4db43d40d1da4d7e4"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.138"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
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 = "prettyplease"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[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 = "quote"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-wasm-bindgen"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "618365e8e586c22123d692b72a7d791d5ee697817b65a218cdf12a98870af0f7"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"js-sys",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4eae9b04cbffdfd550eb462ed33bc6a1b68c935127d008b27444d08380f94e4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"pin-project-lite",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[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",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
||||
|
||||
[[package]]
|
||||
name = "yew"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"futures",
|
||||
"gloo",
|
||||
"implicit-clone",
|
||||
"indexmap",
|
||||
"js-sys",
|
||||
"prokio",
|
||||
"rustversion",
|
||||
"serde",
|
||||
"slab",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"yew-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yew-macro"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301"
|
||||
dependencies = [
|
||||
"boolinator",
|
||||
"once_cell",
|
||||
"prettyplease",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
27
frontend/Cargo.toml
Normal file
27
frontend/Cargo.toml
Normal file
@@ -0,0 +1,27 @@
|
||||
[package]
|
||||
name = "db-frontend"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
yew = { version = "0.20.0", features = ["csr"] }
|
||||
common = { path = "../common"}
|
||||
gloo-net = {version = "0.2"}
|
||||
gloo = "0.8"
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
|
||||
[dependencies.web-sys]
|
||||
version = "0.3"
|
||||
features = [
|
||||
"Headers",
|
||||
"Request",
|
||||
"RequestInit",
|
||||
"RequestMode",
|
||||
"Response",
|
||||
"Window",
|
||||
]
|
||||
678
frontend/dist/db-frontend-12bfbd74b2a545ed.js
vendored
Normal file
678
frontend/dist/db-frontend-12bfbd74b2a545ed.js
vendored
Normal file
@@ -0,0 +1,678 @@
|
||||
|
||||
let wasm;
|
||||
|
||||
const heap = new Array(32).fill(undefined);
|
||||
|
||||
heap.push(undefined, null, true, false);
|
||||
|
||||
function getObject(idx) { return heap[idx]; }
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
let cachedUint8Memory0 = new Uint8Array();
|
||||
|
||||
function getUint8Memory0() {
|
||||
if (cachedUint8Memory0.byteLength === 0) {
|
||||
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedUint8Memory0;
|
||||
}
|
||||
|
||||
const cachedTextEncoder = new TextEncoder('utf-8');
|
||||
|
||||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
||||
? function (arg, view) {
|
||||
return cachedTextEncoder.encodeInto(arg, view);
|
||||
}
|
||||
: function (arg, view) {
|
||||
const buf = cachedTextEncoder.encode(arg);
|
||||
view.set(buf);
|
||||
return {
|
||||
read: arg.length,
|
||||
written: buf.length
|
||||
};
|
||||
});
|
||||
|
||||
function passStringToWasm0(arg, malloc, realloc) {
|
||||
|
||||
if (realloc === undefined) {
|
||||
const buf = cachedTextEncoder.encode(arg);
|
||||
const ptr = malloc(buf.length);
|
||||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
||||
WASM_VECTOR_LEN = buf.length;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
let len = arg.length;
|
||||
let ptr = malloc(len);
|
||||
|
||||
const mem = getUint8Memory0();
|
||||
|
||||
let offset = 0;
|
||||
|
||||
for (; offset < len; offset++) {
|
||||
const code = arg.charCodeAt(offset);
|
||||
if (code > 0x7F) break;
|
||||
mem[ptr + offset] = code;
|
||||
}
|
||||
|
||||
if (offset !== len) {
|
||||
if (offset !== 0) {
|
||||
arg = arg.slice(offset);
|
||||
}
|
||||
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
||||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
||||
const ret = encodeString(arg, view);
|
||||
|
||||
offset += ret.written;
|
||||
}
|
||||
|
||||
WASM_VECTOR_LEN = offset;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
function isLikeNone(x) {
|
||||
return x === undefined || x === null;
|
||||
}
|
||||
|
||||
let cachedInt32Memory0 = new Int32Array();
|
||||
|
||||
function getInt32Memory0() {
|
||||
if (cachedInt32Memory0.byteLength === 0) {
|
||||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedInt32Memory0;
|
||||
}
|
||||
|
||||
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||
|
||||
cachedTextDecoder.decode();
|
||||
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
|
||||
let heap_next = heap.length;
|
||||
|
||||
function addHeapObject(obj) {
|
||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||
const idx = heap_next;
|
||||
heap_next = heap[idx];
|
||||
|
||||
heap[idx] = obj;
|
||||
return idx;
|
||||
}
|
||||
|
||||
function dropObject(idx) {
|
||||
if (idx < 36) return;
|
||||
heap[idx] = heap_next;
|
||||
heap_next = idx;
|
||||
}
|
||||
|
||||
function takeObject(idx) {
|
||||
const ret = getObject(idx);
|
||||
dropObject(idx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
function debugString(val) {
|
||||
// primitive types
|
||||
const type = typeof val;
|
||||
if (type == 'number' || type == 'boolean' || val == null) {
|
||||
return `${val}`;
|
||||
}
|
||||
if (type == 'string') {
|
||||
return `"${val}"`;
|
||||
}
|
||||
if (type == 'symbol') {
|
||||
const description = val.description;
|
||||
if (description == null) {
|
||||
return 'Symbol';
|
||||
} else {
|
||||
return `Symbol(${description})`;
|
||||
}
|
||||
}
|
||||
if (type == 'function') {
|
||||
const name = val.name;
|
||||
if (typeof name == 'string' && name.length > 0) {
|
||||
return `Function(${name})`;
|
||||
} else {
|
||||
return 'Function';
|
||||
}
|
||||
}
|
||||
// objects
|
||||
if (Array.isArray(val)) {
|
||||
const length = val.length;
|
||||
let debug = '[';
|
||||
if (length > 0) {
|
||||
debug += debugString(val[0]);
|
||||
}
|
||||
for(let i = 1; i < length; i++) {
|
||||
debug += ', ' + debugString(val[i]);
|
||||
}
|
||||
debug += ']';
|
||||
return debug;
|
||||
}
|
||||
// Test for built-in
|
||||
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
||||
let className;
|
||||
if (builtInMatches.length > 1) {
|
||||
className = builtInMatches[1];
|
||||
} else {
|
||||
// Failed to match the standard '[object ClassName]'
|
||||
return toString.call(val);
|
||||
}
|
||||
if (className == 'Object') {
|
||||
// we're a user defined class or Object
|
||||
// JSON.stringify avoids problems with cycles, and is generally much
|
||||
// easier than looping through ownProperties of `val`.
|
||||
try {
|
||||
return 'Object(' + JSON.stringify(val) + ')';
|
||||
} catch (_) {
|
||||
return 'Object';
|
||||
}
|
||||
}
|
||||
// errors
|
||||
if (val instanceof Error) {
|
||||
return `${val.name}: ${val.message}\n${val.stack}`;
|
||||
}
|
||||
// TODO we could test for more things here, like `Set`s and `Map`s.
|
||||
return className;
|
||||
}
|
||||
|
||||
function makeMutClosure(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++;
|
||||
const a = state.a;
|
||||
state.a = 0;
|
||||
try {
|
||||
return f(a, state.b, ...args);
|
||||
} finally {
|
||||
if (--state.cnt === 0) {
|
||||
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
|
||||
|
||||
} else {
|
||||
state.a = a;
|
||||
}
|
||||
}
|
||||
};
|
||||
real.original = state;
|
||||
|
||||
return real;
|
||||
}
|
||||
|
||||
let stack_pointer = 32;
|
||||
|
||||
function addBorrowedObject(obj) {
|
||||
if (stack_pointer == 1) throw new Error('out of js stack');
|
||||
heap[--stack_pointer] = obj;
|
||||
return stack_pointer;
|
||||
}
|
||||
function __wbg_adapter_18(arg0, arg1, arg2) {
|
||||
try {
|
||||
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9380123c3ed0eddb(arg0, arg1, addBorrowedObject(arg2));
|
||||
} finally {
|
||||
heap[stack_pointer++] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function __wbg_adapter_21(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h414630ac9216cad4(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
let cachedUint32Memory0 = new Uint32Array();
|
||||
|
||||
function getUint32Memory0() {
|
||||
if (cachedUint32Memory0.byteLength === 0) {
|
||||
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachedUint32Memory0;
|
||||
}
|
||||
|
||||
function getArrayJsValueFromWasm0(ptr, len) {
|
||||
const mem = getUint32Memory0();
|
||||
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
||||
const result = [];
|
||||
for (let i = 0; i < slice.length; i++) {
|
||||
result.push(takeObject(slice[i]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function handleError(f, args) {
|
||||
try {
|
||||
return f.apply(this, args);
|
||||
} catch (e) {
|
||||
wasm.__wbindgen_exn_store(addHeapObject(e));
|
||||
}
|
||||
}
|
||||
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === 'function' && module instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||
try {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
|
||||
} catch (e) {
|
||||
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
||||
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
} else {
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return { instance, module };
|
||||
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getImports() {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
||||
const obj = getObject(arg1);
|
||||
const ret = typeof(obj) === 'string' ? obj : undefined;
|
||||
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.__wbindgen_string_new = function(arg0, arg1) {
|
||||
const ret = getStringFromWasm0(arg0, arg1);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
||||
const ret = getObject(arg0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
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_setlistenerid_3183aae8fa5840fb = function(arg0, arg1) {
|
||||
getObject(arg0).__yew_listener_id = arg1 >>> 0;
|
||||
};
|
||||
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_error_f851667af71bcfc6 = function(arg0, arg1) {
|
||||
try {
|
||||
console.error(getStringFromWasm0(arg0, arg1));
|
||||
} finally {
|
||||
wasm.__wbindgen_free(arg0, arg1);
|
||||
}
|
||||
};
|
||||
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
||||
const ret = new Error();
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
||||
const ret = getObject(arg1).stack;
|
||||
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.__wbindgen_object_drop_ref = function(arg0) {
|
||||
takeObject(arg0);
|
||||
};
|
||||
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
||||
const obj = takeObject(arg0).original;
|
||||
if (obj.cnt-- == 1) {
|
||||
obj.a = 0;
|
||||
return true;
|
||||
}
|
||||
const ret = false;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
||||
const ret = getObject(arg0) === undefined;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_error_71d6845bf00a930f = function(arg0, arg1) {
|
||||
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
||||
wasm.__wbindgen_free(arg0, arg1 * 4);
|
||||
console.error(...v0);
|
||||
};
|
||||
imports.wbg.__wbg_instanceof_Window_acc97ff9f5d2c7b4 = function(arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Window;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_document_3ead31dbcad65886 = function(arg0) {
|
||||
const ret = getObject(arg0).document;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_fetch_0fe04905cccfc2aa = function(arg0, arg1) {
|
||||
const ret = getObject(arg0).fetch(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_body_3cb4b4042b9a632b = function(arg0) {
|
||||
const ret = getObject(arg0).body;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_createElement_976dbb84fe1661b5 = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
const ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_createElementNS_1561aca8ee3693c0 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
||||
const ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_createTextNode_300f845fab76642f = function(arg0, arg1, arg2) {
|
||||
const ret = getObject(arg0).createTextNode(getStringFromWasm0(arg1, arg2));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
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_text_1169d752cc697903 = function() { return handleError(function (arg0) {
|
||||
const ret = getObject(arg0).text();
|
||||
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_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_value_ccb32485ee1b3928 = function(arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
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_setvalue_df64bc6794c098f2 = function(arg0, arg1, arg2) {
|
||||
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
|
||||
};
|
||||
imports.wbg.__wbg_setchecked_f1e1f3e62cdca8e7 = function(arg0, arg1) {
|
||||
getObject(arg0).checked = arg1 !== 0;
|
||||
};
|
||||
imports.wbg.__wbg_value_b2a620d34c663701 = function(arg0, arg1) {
|
||||
const ret = getObject(arg1).value;
|
||||
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_setvalue_e5b519cca37d82a7 = function(arg0, arg1, arg2) {
|
||||
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
|
||||
};
|
||||
imports.wbg.__wbg_instanceof_Element_33bd126d58f2021b = function(arg0) {
|
||||
let result;
|
||||
try {
|
||||
result = getObject(arg0) instanceof Element;
|
||||
} catch {
|
||||
result = false;
|
||||
}
|
||||
const ret = result;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_namespaceURI_e19c7be2c60e5b5c = function(arg0, arg1) {
|
||||
const ret = getObject(arg1).namespaceURI;
|
||||
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_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) };
|
||||
imports.wbg.__wbg_setAttribute_d8436c14a59ab1af = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
||||
getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
||||
}, arguments) };
|
||||
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_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_parentNode_e397bbbe28be7b28 = function(arg0) {
|
||||
const ret = getObject(arg0).parentNode;
|
||||
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
||||
};
|
||||
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_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_get_57245cc7d7c7619d = function(arg0, arg1) {
|
||||
const ret = getObject(arg0)[arg1 >>> 0];
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_from_7ce3cb27cb258569 = function(arg0) {
|
||||
const ret = Array.from(getObject(arg0));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_length_6e3bbe7c8bd4dbd8 = function(arg0) {
|
||||
const ret = getObject(arg0).length;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_newnoargs_b5b063fc6c2f0376 = function(arg0, arg1) {
|
||||
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_call_97ae9d8645dc388b = function() { return handleError(function (arg0, arg1) {
|
||||
const ret = getObject(arg0).call(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_is_40a66842732708e7 = function(arg0, arg1) {
|
||||
const ret = Object.is(getObject(arg0), getObject(arg1));
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_new_0b9bfdd97583284e = function() {
|
||||
const ret = new Object();
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_resolve_99fe17964f31ffc0 = function(arg0) {
|
||||
const ret = Promise.resolve(getObject(arg0));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_then_11f7a54d67b4bfad = function(arg0, arg1) {
|
||||
const ret = getObject(arg0).then(getObject(arg1));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_then_cedad20fbbd9418a = function(arg0, arg1, arg2) {
|
||||
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
|
||||
const ret = globalThis.globalThis;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
|
||||
const ret = self.self;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
|
||||
const ret = window.window;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
|
||||
const ret = global.global;
|
||||
return addHeapObject(ret);
|
||||
}, arguments) };
|
||||
imports.wbg.__wbg_set_bf3f89b92d5a34bf = function() { return handleError(function (arg0, arg1, arg2) {
|
||||
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
||||
return ret;
|
||||
}, arguments) };
|
||||
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
||||
const ret = debugString(getObject(arg1));
|
||||
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.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper3975 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 302, __wbg_adapter_18);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper6639 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 329, __wbg_adapter_21);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
return imports;
|
||||
}
|
||||
|
||||
function initMemory(imports, maybe_memory) {
|
||||
|
||||
}
|
||||
|
||||
function finalizeInit(instance, module) {
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
cachedInt32Memory0 = new Int32Array();
|
||||
cachedUint32Memory0 = new Uint32Array();
|
||||
cachedUint8Memory0 = new Uint8Array();
|
||||
|
||||
wasm.__wbindgen_start();
|
||||
return wasm;
|
||||
}
|
||||
|
||||
function initSync(module) {
|
||||
const imports = getImports();
|
||||
|
||||
initMemory(imports);
|
||||
|
||||
if (!(module instanceof WebAssembly.Module)) {
|
||||
module = new WebAssembly.Module(module);
|
||||
}
|
||||
|
||||
const instance = new WebAssembly.Instance(module, imports);
|
||||
|
||||
return finalizeInit(instance, module);
|
||||
}
|
||||
|
||||
async function init(input) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = new URL('db-frontend-12bfbd74b2a545ed_bg.wasm', import.meta.url);
|
||||
}
|
||||
const imports = getImports();
|
||||
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
initMemory(imports);
|
||||
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
return finalizeInit(instance, module);
|
||||
}
|
||||
|
||||
export { initSync }
|
||||
export default init;
|
||||
BIN
frontend/dist/db-frontend-12bfbd74b2a545ed_bg.wasm
vendored
Normal file
BIN
frontend/dist/db-frontend-12bfbd74b2a545ed_bg.wasm
vendored
Normal file
Binary file not shown.
35
frontend/dist/index.html
vendored
Normal file
35
frontend/dist/index.html
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html><html><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Ze greatest</title>
|
||||
|
||||
<link rel="preload" href="/db-frontend-12bfbd74b2a545ed_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
|
||||
<link rel="modulepreload" href="/db-frontend-12bfbd74b2a545ed.js"></head>
|
||||
<body>
|
||||
<script type="module">import init from '/db-frontend-12bfbd74b2a545ed.js';init('/db-frontend-12bfbd74b2a545ed_bg.wasm');</script><script>(function () {
|
||||
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
var url = protocol + '//' + window.location.host + '/_trunk/ws';
|
||||
var poll_interval = 5000;
|
||||
var reload_upon_connect = () => {
|
||||
window.setTimeout(
|
||||
() => {
|
||||
// when we successfully reconnect, we'll force a
|
||||
// reload (since we presumably lost connection to
|
||||
// trunk due to it being killed, so it will have
|
||||
// rebuilt on restart)
|
||||
var ws = new WebSocket(url);
|
||||
ws.onopen = () => window.location.reload();
|
||||
ws.onclose = reload_upon_connect;
|
||||
},
|
||||
poll_interval);
|
||||
};
|
||||
|
||||
var ws = new WebSocket(url);
|
||||
ws.onmessage = (ev) => {
|
||||
const msg = JSON.parse(ev.data);
|
||||
if (msg.reload) {
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
ws.onclose = reload_upon_connect;
|
||||
})()
|
||||
</script></body></html>
|
||||
7
frontend/index.html
Normal file
7
frontend/index.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Ze greatest</title>
|
||||
</head>
|
||||
</html>
|
||||
245
frontend/src/fetching.rs
Normal file
245
frontend/src/fetching.rs
Normal file
@@ -0,0 +1,245 @@
|
||||
use common::{CommonAdmin, CommonDriver};
|
||||
use std::{
|
||||
error::Error,
|
||||
fmt::{self, Debug, Display, Formatter},
|
||||
};
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
use wasm_bindgen_futures::JsFuture;
|
||||
use web_sys::{Request, RequestInit, RequestMode, Response};
|
||||
use yew::props;
|
||||
use yew::{html, Component, Context, Html, Properties};
|
||||
//Trait to handle Future yew HTMLS
|
||||
pub trait UseAble {
|
||||
//Return HTML if didn't fail return error if not
|
||||
fn use_it(self) -> Result<Html, String>;
|
||||
}
|
||||
impl UseAble for CommonDriver {
|
||||
fn use_it(self) -> Result<Html, String> {
|
||||
let name = self.name;
|
||||
let address = self.address;
|
||||
let id = self.id;
|
||||
let html = html! {
|
||||
<div>
|
||||
<h2> { "Driver:" } </h2>
|
||||
<p> { format!("Name: {}", name) } </p>
|
||||
<p> { format!("Address: {}", address) } </p>
|
||||
<p> { format!("ID: {}", id) } </p>
|
||||
</div>
|
||||
};
|
||||
Ok(html)
|
||||
}
|
||||
}
|
||||
impl UseAble for CommonAdmin {
|
||||
fn use_it(self) -> Result<Html, String> {
|
||||
let name = self.name;
|
||||
let address = self.address;
|
||||
let id = self.id;
|
||||
let html = html! {
|
||||
<div>
|
||||
<h2> { "Admin:" } </h2>
|
||||
<p> { format!("Name: {}", name) } </p>
|
||||
<p> { format!("Address: {}", address) } </p>
|
||||
<p> { format!("ID: {}", id) } </p>
|
||||
</div>
|
||||
};
|
||||
Ok(html)
|
||||
}
|
||||
}
|
||||
|
||||
//Wwasm bingdengen code
|
||||
const DRIVER_URL: &str = "http://db.sewelam.tech/api/driver/50";
|
||||
const ADMIN_URL: &str = "http://db.sewelam.tech/api/admin/";
|
||||
const TICKET_URL: &str = "http://db.sewelam.tech/api/ticket/";
|
||||
const FUNNY_TXT_URL: &str = "https://whatthecommit.com/index.txt";
|
||||
const INCORRECT_URL: &str = "http://libkyy.cf";
|
||||
//Generic Msg for our states
|
||||
pub enum Msg<T> {
|
||||
SetDataFetchState(FetchState<T>),
|
||||
GetData,
|
||||
GetError,
|
||||
}
|
||||
pub struct RandomCommit {
|
||||
commit: FetchState<String>,
|
||||
}
|
||||
//This trait is for all yew components
|
||||
impl Component for RandomCommit {
|
||||
type Message = Msg<String>;
|
||||
type Properties = ();
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
Self {
|
||||
commit: FetchState::NotFetching, //Default state is not fetching anything
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
match msg {
|
||||
Msg::SetDataFetchState(fetch_state) => {
|
||||
self.commit = fetch_state;
|
||||
true
|
||||
}
|
||||
Msg::GetData => {
|
||||
ctx.link().send_future(async {
|
||||
match fetch_url_text(FUNNY_TXT_URL).await {
|
||||
Ok(commit) => Msg::SetDataFetchState(FetchState::Success(commit)),
|
||||
Err(err) => Msg::SetDataFetchState(FetchState::Failed(err)),
|
||||
}
|
||||
});
|
||||
ctx.link()
|
||||
.send_message(Msg::SetDataFetchState(FetchState::Fetching));
|
||||
false
|
||||
}
|
||||
Msg::GetError => {
|
||||
ctx.link().send_future(async {
|
||||
match fetch_url_text(INCORRECT_URL).await {
|
||||
Ok(commit) => Msg::SetDataFetchState(FetchState::Success(commit)),
|
||||
Err(err) => Msg::SetDataFetchState(FetchState::Failed(err)),
|
||||
}
|
||||
});
|
||||
ctx.link()
|
||||
.send_message(Msg::SetDataFetchState(FetchState::Fetching));
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
match &self.commit {
|
||||
FetchState::NotFetching => html! {
|
||||
<>
|
||||
<button onclick={ctx.link().callback(|_| Msg::GetData)}>
|
||||
{ "Get commit msg" }
|
||||
</button>
|
||||
</>
|
||||
},
|
||||
FetchState::Fetching => html! { "Fetching" },
|
||||
FetchState::Success(data) => {
|
||||
html! { <> {data}</> }
|
||||
}
|
||||
FetchState::Failed(err) => html! { err },
|
||||
}
|
||||
}
|
||||
}
|
||||
//Generate Struct and implement component for driver using CommonDriver
|
||||
pub struct DriverComponent {
|
||||
driver: FetchState<String>,
|
||||
}
|
||||
|
||||
#[derive(Default, Properties, PartialEq)]
|
||||
pub struct ApiParams {
|
||||
pub entered_id: i32,
|
||||
}
|
||||
impl ApiParams {
|
||||
pub fn new_api_thingy_with_id(id: i32) -> Self {
|
||||
props! { ApiParams {
|
||||
entered_id: id
|
||||
}}
|
||||
}
|
||||
}
|
||||
//implement the component for Driver using a string
|
||||
impl Component for DriverComponent {
|
||||
type Message = Msg<String>;
|
||||
type Properties = ApiParams;
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
Self {
|
||||
driver: FetchState::NotFetching,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
match msg {
|
||||
Msg::SetDataFetchState(fetch_state) => {
|
||||
self.driver = fetch_state;
|
||||
true
|
||||
}
|
||||
Msg::GetData => {
|
||||
ctx.link().send_future(async {
|
||||
match fetch_url_text(DRIVER_URL).await {
|
||||
Ok(driver) => Msg::SetDataFetchState(FetchState::Success(driver)),
|
||||
Err(err) => Msg::SetDataFetchState(FetchState::Failed(err)),
|
||||
}
|
||||
});
|
||||
ctx.link()
|
||||
.send_message(Msg::SetDataFetchState(FetchState::Fetching));
|
||||
false
|
||||
}
|
||||
Msg::GetError => {
|
||||
ctx.link().send_future(async {
|
||||
match fetch_url_text(INCORRECT_URL).await {
|
||||
Ok(driver) => Msg::SetDataFetchState(FetchState::Success(driver)),
|
||||
Err(err) => Msg::SetDataFetchState(FetchState::Failed(err)),
|
||||
}
|
||||
});
|
||||
ctx.link()
|
||||
.send_message(Msg::SetDataFetchState(FetchState::Fetching));
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
match &self.driver {
|
||||
FetchState::NotFetching => html! {
|
||||
<>
|
||||
|
||||
<label for="id"> {"ID:"} </label>
|
||||
<input type="text" id="name" name="name"/>
|
||||
|
||||
<br/>
|
||||
<button onclick={ctx.link().callback(|_| Msg::GetData)}>
|
||||
{ "Get driver" }
|
||||
</button>
|
||||
</>
|
||||
},
|
||||
FetchState::Fetching => html! { "Fetching" },
|
||||
FetchState::Success(data) => html! { <> {data} <br/>
|
||||
<button onclick={ctx.link().callback(|_| Msg::GetData)}>
|
||||
{ "Get new driver (assuming input works :D)" }
|
||||
</button>
|
||||
</> },
|
||||
FetchState::Failed(err) => html! { err },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct FetchError {
|
||||
err: JsValue,
|
||||
}
|
||||
|
||||
impl Display for FetchError {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
Debug::fmt(&self.err, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for FetchError {}
|
||||
|
||||
impl From<JsValue> for FetchError {
|
||||
fn from(value: JsValue) -> Self {
|
||||
Self { err: value }
|
||||
}
|
||||
}
|
||||
//Enum for Fetchstates that takes a generic type --> String/Driver etc.
|
||||
pub enum FetchState<T> {
|
||||
NotFetching,
|
||||
Fetching,
|
||||
Success(T),
|
||||
Failed(FetchError),
|
||||
}
|
||||
|
||||
async fn fetch_url_text(url: &'static str) -> Result<String, FetchError> {
|
||||
let mut opts = RequestInit::new();
|
||||
opts.method("GET");
|
||||
opts.mode(RequestMode::Cors); //Cors is required for fetch to work
|
||||
|
||||
//initialise request
|
||||
let request = Request::new_with_str_and_init(url, &opts)?;
|
||||
let window = gloo::utils::window();
|
||||
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
|
||||
let resp: Response = resp_value.dyn_into().unwrap();
|
||||
let text = JsFuture::from(resp.text()?).await?;
|
||||
Ok(text.as_string().unwrap())
|
||||
}
|
||||
|
||||
//Admin component
|
||||
|
||||
21
frontend/src/main.rs
Normal file
21
frontend/src/main.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
mod fetching;
|
||||
use yew::prelude::*;
|
||||
|
||||
use crate::fetching::DriverComponent;
|
||||
|
||||
#[function_component]
|
||||
fn App() -> Html {
|
||||
let entered_id = 50;
|
||||
html! {
|
||||
<div>
|
||||
<h1> {"API response examples"} </h1>
|
||||
<h2> {"Drivers"} </h2>
|
||||
<DriverComponent {entered_id}/>
|
||||
<h2> {"Admins and Tickets" } </h2>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
yew::Renderer::<App>::new().render();
|
||||
}
|
||||
85
frontend/src/shadowrealm.rs
Normal file
85
frontend/src/shadowrealm.rs
Normal file
@@ -0,0 +1,85 @@
|
||||
// impl Component for Driver {
|
||||
// type Message = Msg<CommonDriver>;
|
||||
// type Properties = ();
|
||||
// fn create(_ctx: &Context<Self>) -> Self {
|
||||
// Self {
|
||||
// driver: FetchState::NotFetching, //Default state is not fetching anything
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
// match msg {
|
||||
// Msg::SetDataFetchState(fetch_state) => {
|
||||
// self.driver = fetch_state;
|
||||
// true
|
||||
// }
|
||||
// Msg::GetData => {
|
||||
// ctx.link().send_future(async {
|
||||
// match fetch_driver(DRIVER_URL).await {
|
||||
// Ok(driver) => Msg::SetDataFetchState(FetchState::Success(driver)),
|
||||
// Err(err) => Msg::SetDataFetchState(FetchState::Failed(err)),
|
||||
// }
|
||||
// });
|
||||
// ctx.link()
|
||||
// .send_message(Msg::SetDataFetchState(FetchState::Fetching));
|
||||
// false
|
||||
// }
|
||||
// Msg::GetError => {
|
||||
// ctx.link().send_future(async {
|
||||
// match fetch_driver(INCORRECT_URL).await {
|
||||
// Ok(driver) => Msg::SetDataFetchState(FetchState::Success(driver)),
|
||||
// Err(err) => Msg::SetDataFetchState(FetchState::Failed(err)),
|
||||
// }
|
||||
// });
|
||||
// ctx.link()
|
||||
// .send_message(Msg::SetDataFetchState(FetchState::Fetching));
|
||||
// false
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
// //render the component into HTML
|
||||
// match &self.driver {
|
||||
// FetchState::NotFetching => html! {
|
||||
// <>
|
||||
// <button onclick={ctx.link().callback(|_| Msg::GetData)}>
|
||||
// { "Get driver info" }
|
||||
// </button>
|
||||
// <button onclick={ctx.link().callback(|_| Msg::GetError)}>
|
||||
// { "Get using incorrect URL" }
|
||||
// </button>
|
||||
// </>
|
||||
// },
|
||||
// FetchState::Fetching => html! { "Fetching" },
|
||||
// FetchState::Success(data) => match data.clone().use_it() {
|
||||
// Ok(html) => html,
|
||||
// Err(err) => html! { err },
|
||||
// },
|
||||
// FetchState::Failed(err) => html! { err },
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// async fn fetch_driver(url: &'static str) -> Result<CommonDriver, FetchError> {
|
||||
// let mut opts = RequestInit::new();
|
||||
// opts.method("GET");
|
||||
// //Available request modes: Cors, NoCors, SameOrigin
|
||||
// opts.mode(RequestMode::NoCors); //NoCors because cors simply doesn't work here
|
||||
//
|
||||
// let request = Request::new_with_str_and_init(url, &opts)?;
|
||||
// //api header for json
|
||||
// request.headers().set("Accept", "application/json")?;
|
||||
//
|
||||
// let window = web_sys::window().unwrap();
|
||||
// let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
|
||||
// assert!(resp_value.is_instance_of::<Response>());
|
||||
// let resp: Response = resp_value.dyn_into().unwrap();
|
||||
//
|
||||
// //parsing Json response
|
||||
// let fetched_json = JsFuture::from(resp.json()?).await?;
|
||||
// log!(fetched_json.clone());
|
||||
// let fetched_json: JsValue = fetched_json.into();
|
||||
// //parsing into CommonDriver struct
|
||||
// let fetched_json: CommonDriver = fetched_json.into_serde().unwrap();
|
||||
// Ok(fetched_json)
|
||||
// }
|
||||
98
src/api.rs
Normal file
98
src/api.rs
Normal file
@@ -0,0 +1,98 @@
|
||||
use actix_web::{get, http::header::ContentType, web, HttpResponse, Responder};
|
||||
use backend::{
|
||||
admin_data::get_admin, driver_data::get_driver, establish_connection, ticket_data::get_ticket,
|
||||
vehicle_data::get_vehicle,
|
||||
};
|
||||
// use common::{CommonAdmin, CommonDriver, CommonTicket};
|
||||
|
||||
#[get("api/ticket/{id}")]
|
||||
async fn api_ticket(id: web::Path<i32>) -> impl Responder {
|
||||
let fetched_ticket_data = get_ticket(&mut establish_connection(), *id);
|
||||
//return struct values as string
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::plaintext())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("content-type", "text/plain"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.body(format!(
|
||||
"Ticket ID: {}, Ticket Price: {}, Ticket Status: {}",
|
||||
fetched_ticket_data.id, fetched_ticket_data.category, fetched_ticket_data.description
|
||||
))
|
||||
}
|
||||
|
||||
// Getting admin data or smth idk
|
||||
#[get("api/admin/{id}")]
|
||||
async fn api_admin(id: web::Path<i32>) -> impl Responder {
|
||||
let fetched_admin_data = get_admin(&mut establish_connection(), *id);
|
||||
//return struct values as string
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::plaintext())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("content-type", "text/plain"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.body(format!(
|
||||
"Admin ID: {}, Admin Name: {}, Admin Address: {}",
|
||||
fetched_admin_data.id, fetched_admin_data.name, fetched_admin_data.address
|
||||
))
|
||||
}
|
||||
|
||||
#[get("api/driver/{id}")]
|
||||
async fn api_driver(id: web::Path<i32>) -> impl Responder {
|
||||
let fetched_driver_data = get_driver(&mut establish_connection(), *id);
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::plaintext())
|
||||
//headers for plain text
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("content-type", "text/plain"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.body(format!(
|
||||
"Driver ID: {}, Driver Name: {}, Driver Address: {}",
|
||||
fetched_driver_data.id, fetched_driver_data.name, fetched_driver_data.address
|
||||
))
|
||||
}
|
||||
|
||||
#[get("api/test")]
|
||||
async fn api_test() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::plaintext())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("Access-Control-Allow-Methods", "GET"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.insert_header(("content-type", "text/plain"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.body("Alles gut")
|
||||
}
|
||||
|
||||
#[get("api/vehicle/{id}")]
|
||||
async fn api_vehicle(id: web::Path<String>) -> impl Responder {
|
||||
let id = id.into_inner();
|
||||
let fetched_vehicle_data = get_vehicle(&mut establish_connection(), id);
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::plaintext())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("content-type", "text/plain"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.body(format!(
|
||||
"Vehicle ID: {}, Vehicle Category: {}",
|
||||
fetched_vehicle_data.plate_num, fetched_vehicle_data.category
|
||||
))
|
||||
}
|
||||
46
src/main.rs
46
src/main.rs
@@ -1,32 +1,26 @@
|
||||
use actix_web::{
|
||||
get,
|
||||
web::{self, Json},
|
||||
App, HttpServer,
|
||||
};
|
||||
use backend::{establish_connection, ticket_data::get_ticket};
|
||||
use common::CommonTicket;
|
||||
|
||||
// //Admin Services
|
||||
// #[get("/api/admin/{id}")]
|
||||
// async fn admin(id: web::Path<i32>) -> Json<CommonAdmin> {
|
||||
// Json(get_admin(&mut establish_connection(), *id))
|
||||
// }
|
||||
// #[get("/api/admins{amount}")]
|
||||
// async fn admins(amount: web::Path<i64>) -> Json<Vec<CommonAdmin>> {
|
||||
// Json(get_admins(&mut establish_connection(), *amount))
|
||||
// }
|
||||
|
||||
//Ticket Table Services
|
||||
#[get("api/ticket/{id}")]
|
||||
async fn ticket(id: web::Path<i32>) -> Json<CommonTicket> {
|
||||
let fetched_ticket = get_ticket(&mut establish_connection(), *id);
|
||||
Json(fetched_ticket)
|
||||
}
|
||||
pub mod api;
|
||||
pub mod shadowrealmapi;
|
||||
use crate::api::*;
|
||||
use crate::shadowrealmapi::*;
|
||||
pub(crate) use actix_web::{App, HttpServer};
|
||||
|
||||
//Main function where all the api calls are
|
||||
//attached as services to backend
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| App::new().service(ticket))
|
||||
.bind(("127.0.0.1", 8081))?
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.service(api_ticket)
|
||||
.service(api_admin)
|
||||
.service(api_driver)
|
||||
.service(api_json_ticket)
|
||||
.service(api_json_admin)
|
||||
.service(api_json_driver)
|
||||
.service(api_test)
|
||||
.service(api_json_driver_tickets)
|
||||
.service(api_json_ticket_new)
|
||||
})
|
||||
.bind(("0.0.0.0", 48590))?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
||||
79
src/shadowrealmapi.rs
Normal file
79
src/shadowrealmapi.rs
Normal file
@@ -0,0 +1,79 @@
|
||||
use actix_web::{
|
||||
get,
|
||||
http::header::ContentType,
|
||||
post,
|
||||
web::{self, Json},
|
||||
HttpResponse, Responder,
|
||||
};
|
||||
use backend::{
|
||||
admin_data::get_admin,
|
||||
driver_data::get_driver,
|
||||
establish_connection,
|
||||
models::NewTicket,
|
||||
ticket_data::{create_ticket, get_ticket, get_tickets},
|
||||
};
|
||||
use common::{CommonAdmin, CommonDriver, CommonTicket};
|
||||
|
||||
// Json goodies? NAHH
|
||||
// Ticket Table Services
|
||||
#[get("api/json/ticket/{id}")]
|
||||
async fn api_json_ticket(id: web::Path<i32>) -> impl Responder {
|
||||
let fetched_ticket_data = get_ticket(&mut establish_connection(), *id);
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::json())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.json(fetched_ticket_data)
|
||||
}
|
||||
#[post("api/json/ticket/new")]
|
||||
async fn api_json_ticket_new(ticket: web::Json<CommonTicket>) -> impl Responder {
|
||||
let input = ticket.into_inner();
|
||||
let input_result = NewTicket {
|
||||
id: input.id,
|
||||
description: &input.description,
|
||||
category: &input.category,
|
||||
};
|
||||
create_ticket(&mut establish_connection(), input_result);
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::plaintext())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("Access-Control-Allow-Methods", "GET"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.insert_header(("content-type", "text/plain"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.body("Alles gut")
|
||||
}
|
||||
|
||||
// Getting admin data or smth idk
|
||||
#[get("api/json/admin/{id}")]
|
||||
async fn api_json_admin(id: web::Path<i32>) -> Json<CommonAdmin> {
|
||||
let fetched_admin_data = get_admin(&mut establish_connection(), *id);
|
||||
Json(fetched_admin_data)
|
||||
}
|
||||
|
||||
#[get("api/json/driver/{id}")]
|
||||
async fn api_json_driver(id: web::Path<i32>) -> Json<CommonDriver> {
|
||||
let fetched_driver_data = get_driver(&mut establish_connection(), *id);
|
||||
Json(fetched_driver_data)
|
||||
}
|
||||
|
||||
#[get("api/json/tickets/{driver}")]
|
||||
async fn api_json_driver_tickets(id: web::Path<i32>) -> impl Responder {
|
||||
let fetched_tickets = get_tickets(&mut establish_connection(), *id);
|
||||
HttpResponse::Ok()
|
||||
.content_type(ContentType::json())
|
||||
.insert_header(("Access-Control-Allow-Origin", "*"))
|
||||
.insert_header(("content-encoded", "gzip"))
|
||||
.insert_header((
|
||||
"Access-Control-Allow-Headers",
|
||||
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
|
||||
))
|
||||
.json(fetched_tickets)
|
||||
}
|
||||
Reference in New Issue
Block a user