-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Saving and loading subgraph presets working E2E!
* Build out all the backend stuff (migrations, models, routes) for saving and loading subgraph presets with tags, matching existing preset systems * Wire up graph editor UI actions to save and load presets * Using existing generic preset saver/picker components * Add global toaster to the app * Fixed a couple of bugs with the previously subgraph/subgraph portal implementation * Build out code for saving + loading serialized subgraphs * Handle storing the state of all VCs, FCs, and child subgraphs for the subgraph being saved * Handle updating all the entity IDs to random IDs to avoid conflicts * Handle creating all of the entities into the new context * Handle wiring up subgraph portals with accurate inputs/outputs * Handle connecting everything up * Handle updating special-case FC states (subgraph portal, graph editor) to correct IDs as well * Everything I've tested so far is working as expected
- Loading branch information
Showing
50 changed files
with
1,715 additions
and
799 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
backend/migrations/2024-02-11-211258_subgraph-presets/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DROP TABLE subgraph_preset_tags_join; | ||
DROP TABLE subgraph_preset_tags; | ||
DROP TABLE subgraph_presets; |
15 changes: 15 additions & 0 deletions
15
backend/migrations/2024-02-11-211258_subgraph-presets/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CREATE TABLE subgraph_presets ( | ||
id BIGINT NOT NULL AUTO_INCREMENT UNIQUE, | ||
user_id BIGINT REFERENCES users(id) ON DELETE CASCADE, | ||
title TEXT NOT NULL, | ||
description TEXT NOT NULL, | ||
content LONGTEXT NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE subgraph_preset_tags ( | ||
id BIGINT NOT NULL AUTO_INCREMENT UNIQUE, | ||
subgraph_preset_id BIGINT NOT NULL REFERENCES subgraph_presets(id) ON DELETE CASCADE, | ||
tag_id BIGINT NOT NULL REFERENCES tags(id) ON DELETE CASCADE, | ||
PRIMARY KEY (id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use uuid::Uuid; | ||
|
||
use crate::schema::{subgraph_preset_tags, subgraph_presets}; | ||
|
||
#[derive(Insertable)] | ||
#[diesel(table_name = subgraph_presets)] | ||
pub struct NewSubgraphPreset { | ||
pub user_id: Option<i64>, | ||
pub title: String, | ||
pub description: String, | ||
pub content: String, | ||
} | ||
|
||
#[derive(Insertable)] | ||
#[diesel(table_name = subgraph_preset_tags)] | ||
pub struct NewSubgraphPresetTag { | ||
pub subgraph_preset_id: i64, | ||
pub tag_id: i64, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct SerializedSubgraphPreset { | ||
pub fcs: Vec<serde_json::Map<String, serde_json::Value>>, | ||
pub vcs: Vec<serde_json::Map<String, serde_json::Value>>, | ||
pub intra_conns: Vec<( | ||
serde_json::Map<String, serde_json::Value>, | ||
serde_json::Map<String, serde_json::Value>, | ||
)>, | ||
pub subgraphs: Vec<(Uuid, serde_json::Map<String, serde_json::Value>)>, | ||
pub base_subgraph_id: Uuid, | ||
pub connnecting_subgraph_id: Uuid, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.