From 35a90a08b29a196e29aa60083126694594efe436 Mon Sep 17 00:00:00 2001 From: Pedro Rico Pinazo Date: Thu, 24 Oct 2024 12:36:39 +0100 Subject: [PATCH] Embed GraphQL playground into Raphtory UI (#1838) * embed graph playground into raphtory ui * fix window bounds for the subgraph query --- raphtory-graphql/resources/index.html | 703 ++++++++++------ raphtory-graphql/resources/playground.html | 930 --------------------- raphtory-graphql/src/routes.rs | 5 - raphtory-graphql/src/server.rs | 4 +- 4 files changed, 438 insertions(+), 1204 deletions(-) delete mode 100644 raphtory-graphql/resources/playground.html diff --git a/raphtory-graphql/resources/index.html b/raphtory-graphql/resources/index.html index 422008a82..d05ddd7ce 100644 --- a/raphtory-graphql/resources/index.html +++ b/raphtory-graphql/resources/index.html @@ -2,10 +2,10 @@ - + Pometry UI - - - +
diff --git a/raphtory-graphql/resources/playground.html b/raphtory-graphql/resources/playground.html deleted file mode 100644 index c8206a0cb..000000000 --- a/raphtory-graphql/resources/playground.html +++ /dev/null @@ -1,930 +0,0 @@ - - - - - - - GraphQL Playground - - - - - - - - - - - -
- -
- Loading - GraphQL Playground -
-
- -
- - - diff --git a/raphtory-graphql/src/routes.rs b/raphtory-graphql/src/routes.rs index 1cf0cb0ab..08e4fc902 100644 --- a/raphtory-graphql/src/routes.rs +++ b/raphtory-graphql/src/routes.rs @@ -18,11 +18,6 @@ pub(crate) async fn health() -> impl IntoResponse { (StatusCode::OK, Json(health)) } -#[handler] -pub(crate) async fn graphql_playground() -> impl IntoResponse { - Html(include_str!("../resources/playground.html")) -} - #[handler] pub(crate) async fn ui() -> impl IntoResponse { Html(include_str!("../resources/index.html")) diff --git a/raphtory-graphql/src/server.rs b/raphtory-graphql/src/server.rs index 12fccae67..3404dc834 100644 --- a/raphtory-graphql/src/server.rs +++ b/raphtory-graphql/src/server.rs @@ -8,7 +8,7 @@ use crate::{ App, }, observability::open_telemetry::OpenTelemetry, - routes::{graphql_playground, health, ui}, + routes::{health, ui}, server::ServerError::SchemaError, }; use async_graphql_poem::GraphQL; @@ -234,7 +234,7 @@ impl GraphServer { .at("/", get(ui).post(GraphQL::new(schema))) .at("/graph", get(ui)) .at("/search", get(ui)) - .at("/playground", get(graphql_playground)) + .at("/playground", get(ui)) .at("/health", get(health)) .with(CookieJarManager::new()) .with(Cors::new());