diff --git a/Cargo.toml b/Cargo.toml
index c027601..255ede5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -91,7 +91,10 @@ tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3" }
tracing-subscriber-wasm = { version = "0.1" }
url = { version = "2.5" }
-uuid = { version = "1.10", default-features = false, features = ["serde"] }
+uuid = { version = "1.10", default-features = false, features = [
+ "serde",
+ "v4",
+] }
wasm-streams = { version = "0.4" }
web-sys = { version = "0.3", features = [
"FileList",
diff --git a/Justfile b/Justfile
index 2f58578..572cff0 100644
--- a/Justfile
+++ b/Justfile
@@ -59,13 +59,13 @@ build *ARGS: ( _trunk "build" ARGS )
run *ARGS: ( _trunk "serve" ARGS )
-run-examples *ARGS: ( _trunk "serve" "--features" "examples" ARGS )
+run-examples *ARGS: ( _trunk "serve" "--features" "examples,full,mock-release" ARGS )
run-gateway *ARGS:
- cargo watch -s 'clear && cargo run --package cassette-gateway'
+ cargo watch -s 'clear && cargo run --package cassette-gateway -- {{ ARGS }}'
run-operator *ARGS:
- cargo watch -s 'clear && cargo run --package cassette-operator'
+ cargo watch -s 'clear && cargo run --package cassette-operator -- {{ ARGS }}'
_oci-build file oci_suffix *ARGS:
mkdir -p "${OCI_BUILD_LOG_DIR}"
diff --git a/crates/cassette-core/Cargo.toml b/crates/cassette-core/Cargo.toml
index 5799b4a..f1d994d 100644
--- a/crates/cassette-core/Cargo.toml
+++ b/crates/cassette-core/Cargo.toml
@@ -25,7 +25,7 @@ api = ["dep:actix-web"]
ui = ["dep:gloo-net", "dep:patternfly-yew", "dep:tracing", "dep:yew"]
# net
-stream = ["dep:anyhow", "dep:wasm-streams"]
+stream = ["dep:wasm-streams"]
# for demo ONLY
examples = []
@@ -38,7 +38,7 @@ cdl = []
[dependencies]
actix-web = { workspace = true, optional = true }
-anyhow = { workspace = true, optional = true }
+anyhow = { workspace = true }
csv = { workspace = true }
garde = { workspace = true }
gloo-net = { workspace = true, optional = true }
diff --git a/crates/cassette-core/src/components/error.rs b/crates/cassette-core/src/components/error.rs
index a3e9c63..cb9c442 100644
--- a/crates/cassette-core/src/components/error.rs
+++ b/crates/cassette-core/src/components/error.rs
@@ -12,7 +12,9 @@ pub fn error(props: &Props) -> Html {
html! {
- { msg }
+
+ { msg.clone() }
+
}
}
diff --git a/crates/cassette-core/src/data/csv.rs b/crates/cassette-core/src/data/csv.rs
index 4ad0ebf..9b9f25b 100644
--- a/crates/cassette-core/src/data/csv.rs
+++ b/crates/cassette-core/src/data/csv.rs
@@ -5,7 +5,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
+#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, JsonSchema)]
pub struct CsvTable {
pub headers: Vec,
pub records: Vec>,
diff --git a/crates/cassette-core/src/data/table.rs b/crates/cassette-core/src/data/table.rs
index 3dcf13f..a725c95 100644
--- a/crates/cassette-core/src/data/table.rs
+++ b/crates/cassette-core/src/data/table.rs
@@ -31,6 +31,7 @@ impl Default for DataTableLog {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
#[serde(tag = "kind", content = "data", rename_all = "SCREAMING_SNAKE_CASE")]
pub enum DataTableSource {
+ #[cfg(feature = "cdl")]
Cdl(super::cdl::CdlTable),
Csv(super::csv::CsvTable),
Raw(Vec),
@@ -39,6 +40,7 @@ pub enum DataTableSource {
impl DataTableSource {
pub fn columns(&self) -> Result> {
match self {
+ #[cfg(feature = "cdl")]
DataTableSource::Cdl(data) => Ok(data.columns()),
DataTableSource::Csv(data) => Ok(data.columns()),
DataTableSource::Raw(_) => bail!("Raw data table has no columns"),
@@ -47,6 +49,7 @@ impl DataTableSource {
pub fn records(self) -> Result>> {
match self {
+ #[cfg(feature = "cdl")]
DataTableSource::Cdl(data) => Ok(data.records()),
DataTableSource::Csv(data) => Ok(data.records()),
DataTableSource::Raw(_) => bail!("Raw data table has no records"),
@@ -55,6 +58,7 @@ impl DataTableSource {
pub fn is_empty(&self) -> bool {
match self {
+ #[cfg(feature = "cdl")]
DataTableSource::Cdl(data) => data.is_empty(),
DataTableSource::Csv(data) => data.is_empty(),
DataTableSource::Raw(data) => data.is_empty(),
@@ -63,6 +67,7 @@ impl DataTableSource {
pub fn len(&self) -> usize {
match self {
+ #[cfg(feature = "cdl")]
DataTableSource::Cdl(data) => data.len(),
DataTableSource::Csv(data) => data.len(),
DataTableSource::Raw(data) => data.len(),
@@ -104,9 +109,3 @@ impl DataTableSourceType {
}
}
}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
-pub struct DataTableEntry {
- pub index: usize,
- pub values: Vec,
-}
diff --git a/crates/cassette-core/src/lib.rs b/crates/cassette-core/src/lib.rs
index 892ba32..3a7659d 100644
--- a/crates/cassette-core/src/lib.rs
+++ b/crates/cassette-core/src/lib.rs
@@ -1,6 +1,5 @@
pub mod cassette;
pub mod components;
-#[cfg(feature = "ui")]
pub mod data;
pub mod document;
pub mod net;
diff --git a/crates/cassette-gateway/Cargo.toml b/crates/cassette-gateway/Cargo.toml
index 901098f..7779a7c 100644
--- a/crates/cassette-gateway/Cargo.toml
+++ b/crates/cassette-gateway/Cargo.toml
@@ -40,7 +40,7 @@ rustls-tls = [
# plugins
## Connected Data Lake (CDL)
-cdl = ["dep:cassette-plugin-cdl-api"]
+cdl = ["cassette-core/cdl", "dep:cassette-plugin-cdl-api"]
## Kubernetes
kubernetes = ["dep:cassette-plugin-kubernetes-api"]
diff --git a/crates/cassette-gateway/src/actix.rs b/crates/cassette-gateway/src/actix.rs
index 6f3c3f8..16c9a32 100644
--- a/crates/cassette-gateway/src/actix.rs
+++ b/crates/cassette-gateway/src/actix.rs
@@ -97,7 +97,7 @@ where
{
let scope = web::scope(base_url.unwrap_or(""));
let scope = build_core_services(scope);
- let scope = build_plugin_servicess(scope);
+ let scope = build_plugin_services(scope);
app.route(
base_url.filter(|&path| !path.is_empty()).unwrap_or("/"),
@@ -114,12 +114,11 @@ fn build_core_services(scope: Scope) -> Scope {
.service(crate::routes::cassette::list)
}
-fn build_plugin_servicess(scope: Scope) -> Scope {
+fn build_plugin_services(scope: Scope) -> Scope {
+ #[cfg(feature = "cdl")]
+ let scope = ::cassette_plugin_cdl_api::build_services(scope);
#[cfg(feature = "kubernetes")]
- let scope = scope.route(
- "/kube/{path:.*}",
- ::actix_web::web::route().to(::cassette_plugin_kubernetes_api::handle),
- );
+ let scope = ::cassette_plugin_kubernetes_api::build_services(scope);
scope
}
diff --git a/crates/cassette-plugin-cdl-api/Cargo.toml b/crates/cassette-plugin-cdl-api/Cargo.toml
index bdd0a2d..9ba9004 100644
--- a/crates/cassette-plugin-cdl-api/Cargo.toml
+++ b/crates/cassette-plugin-cdl-api/Cargo.toml
@@ -29,8 +29,10 @@ rustls-tls = ["dash-pipe-provider/rustls-tls"]
[dependencies]
cassette-core = { path = "../cassette-core", features = ["api"] }
+cassette-plugin-kubernetes-api = { path = "../cassette-plugin-kubernetes-api" }
actix-web = { workspace = true }
anyhow = { workspace = true }
dash-pipe-provider = { workspace = true, features = ["kafka", "storage"] }
+serde = { workspace = true }
tracing = { workspace = true }
diff --git a/crates/cassette-plugin-cdl-api/src/lib.rs b/crates/cassette-plugin-cdl-api/src/lib.rs
index 7d12d9a..1b2a9de 100644
--- a/crates/cassette-plugin-cdl-api/src/lib.rs
+++ b/crates/cassette-plugin-cdl-api/src/lib.rs
@@ -1,14 +1,7 @@
-pub fn add(left: usize, right: usize) -> usize {
- left + right
-}
+mod zone;
-#[cfg(test)]
-mod tests {
- use super::*;
+use actix_web::Scope;
- #[test]
- fn it_works() {
- let result = add(2, 2);
- assert_eq!(result, 4);
- }
+pub fn build_services(scope: Scope) -> Scope {
+ scope.service(self::zone::list)
}
diff --git a/crates/cassette-plugin-cdl-api/src/zone.rs b/crates/cassette-plugin-cdl-api/src/zone.rs
new file mode 100644
index 0000000..1c1c8fc
--- /dev/null
+++ b/crates/cassette-plugin-cdl-api/src/zone.rs
@@ -0,0 +1,39 @@
+use actix_web::{get, HttpRequest, HttpResponse, Responder};
+use anyhow::Result;
+use cassette_core::{
+ data::{
+ csv::CsvTable,
+ table::{DataTable, DataTableLog, DataTableSource},
+ },
+ result::Result as HttpResult,
+};
+use cassette_plugin_kubernetes_api::{load_client, Client};
+use serde::Serialize;
+
+#[get("/cdl/zone")]
+pub async fn list(request: HttpRequest) -> impl Responder {
+ async fn try_handle(client: Client) -> Result {
+ Ok(DataTable {
+ name: "cdl-zones".into(),
+ data: DataTableSource::Csv(CsvTable::default()),
+ log: DataTableLog::default(),
+ })
+ }
+
+ match load_client(&request).await {
+ Ok(client) => response(try_handle(client).await),
+ Err(error) => HttpResponse::Unauthorized().json(HttpResult::<()>::Err(error.to_string())),
+ }
+}
+
+fn response(result: Result) -> HttpResponse
+where
+ T: Serialize,
+{
+ match result {
+ Ok(data) => HttpResponse::Ok().json(HttpResult::Ok(data)),
+ Err(error) => {
+ HttpResponse::MethodNotAllowed().json(HttpResult::::Err(error.to_string()))
+ }
+ }
+}
diff --git a/crates/cassette-plugin-cdl-zone/src/actor.rs b/crates/cassette-plugin-cdl-zone/src/actor.rs
new file mode 100644
index 0000000..c764b34
--- /dev/null
+++ b/crates/cassette-plugin-cdl-zone/src/actor.rs
@@ -0,0 +1,136 @@
+use cassette_core::{
+ cassette::CassetteContext,
+ components::ComponentRenderer,
+ task::{TaskResult, TaskState},
+};
+use patternfly_yew::prelude::*;
+use serde::{Deserialize, Serialize};
+use yew::prelude::*;
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Properties)]
+#[serde(rename_all = "camelCase")]
+pub struct Spec {}
+
+#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct State {}
+
+impl ComponentRenderer for State {
+ fn render(self, _ctx: &mut CassetteContext, spec: Spec) -> TaskResult