-
Notifications
You must be signed in to change notification settings - Fork 328
Dan product left nav update #1445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b01f9d7
fix current product nav to maintain state on FE
chillenberger 8122f77
left nav works with shift checkpoint
chillenberger 4bcb252
fixed left nav
chillenberger dcd197e
product mobile menu full length, change menu-item icon color
chillenberger b044163
Merge branch 'master' into dan-product-left-nav-update
chillenberger 88ce70b
move product engines dropdown to topnav, set dropdown default formatt…
chillenberger d5d1ac7
Merge branch 'master' into dan-product-left-nav-update
chillenberger c1664d1
remove product lower left nav, remove account management nav, style u…
chillenberger 79d0a74
make owl a font, default breadcrumb start is home, remove bc on mobile
chillenberger 7656600
Merge branch 'master' into dan-product-left-nav-update
chillenberger 4442192
fix icomoon 400
chillenberger 66bda1d
reduce dropdown height in topnav
chillenberger 0d815fe
fix left and top borders
chillenberger 12725e3
change dashboard to home
chillenberger 2f14bbf
keep left nav updated, reset dropdown on nav
chillenberger 5d282af
reduce product left nav icon size, gap, images
chillenberger c9f0354
rename upper left nav to product left nav, add status and tier to das…
chillenberger 0ecac2a
Fix dashboard urls
chillenberger 2bdd96b
Merge branch 'master' into dan-product-left-nav-update
chillenberger 9fb64b0
remove all hardcoded deployment urls, change dashboard url to engine,…
chillenberger 082e942
fix warnings
chillenberger 51a01ef
make left nave recursive
chillenberger 1e49bc5
Merge branch 'master' into dan-product-left-nav-update
chillenberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,115 @@ | ||
use rocket::route::Route; | ||
use sailfish::TemplateOnce; | ||
|
||
use crate::{ | ||
guards::ConnectedCluster, | ||
responses::{Error, ResponseOk}, | ||
}; | ||
|
||
use crate::templates::{components::NavLink, *}; | ||
|
||
use crate::models; | ||
use crate::templates; | ||
use crate::utils::tabs; | ||
use crate::utils::urls; | ||
|
||
use std::collections::HashMap; | ||
|
||
// Returns models page | ||
#[get("/models")] | ||
pub async fn deployment_models(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> { | ||
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); | ||
layout.breadcrumbs(vec![NavLink::new("Models", &urls::deployment_models()).active()]); | ||
|
||
let tabs = vec![tabs::Tab { | ||
name: "Models", | ||
content: ModelsTab {}.render_once().unwrap(), | ||
}]; | ||
|
||
let nav_tabs = tabs::Tabs::new(tabs, Some("Models"), Some("Models"))?; | ||
|
||
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) | ||
} | ||
|
||
// Returns models page | ||
#[get("/models/<model_id>")] | ||
pub async fn model(cluster: ConnectedCluster<'_>, model_id: i64) -> Result<ResponseOk, Error> { | ||
let model = models::Model::get_by_id(cluster.pool(), model_id).await?; | ||
let project = models::Project::get_by_id(cluster.pool(), model.project_id).await?; | ||
|
||
let mut layout = crate::templates::WebAppBase::new("Dashboard", &cluster.inner.context); | ||
layout.breadcrumbs(vec![ | ||
NavLink::new("Models", &urls::deployment_models()), | ||
NavLink::new(&project.name, &urls::deployment_project_by_id(project.id)), | ||
NavLink::new(&model.algorithm, &urls::deployment_model_by_id(model.id)).active(), | ||
]); | ||
|
||
let tabs = vec![tabs::Tab { | ||
name: "Model", | ||
content: ModelTab { model_id }.render_once().unwrap(), | ||
}]; | ||
|
||
let nav_tabs = tabs::Tabs::new(tabs, Some("Models"), Some("Models"))?; | ||
|
||
Ok(ResponseOk(layout.render(templates::Dashboard { tabs: nav_tabs }))) | ||
} | ||
|
||
#[get("/models_turboframe")] | ||
pub async fn models_index(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> { | ||
let projects = models::Project::all(cluster.pool()).await?; | ||
let mut models = HashMap::new(); | ||
// let mut max_scores = HashMap::new(); | ||
// let mut min_scores = HashMap::new(); | ||
|
||
for project in &projects { | ||
let project_models = models::Model::get_by_project_id(cluster.pool(), project.id).await?; | ||
// let mut key_metrics = project_models | ||
// .iter() | ||
// .map(|m| m.key_metric(project).unwrap_or(0.)) | ||
// .collect::<Vec<f64>>(); | ||
// key_metrics.sort_by(|a, b| a.partial_cmp(b).unwrap()); | ||
|
||
// max_scores.insert(project.id, key_metrics.iter().last().unwrap_or(&0.).clone()); | ||
// min_scores.insert(project.id, key_metrics.iter().next().unwrap_or(&0.).clone()); | ||
|
||
models.insert(project.id, project_models); | ||
} | ||
|
||
Ok(ResponseOk( | ||
templates::Models { | ||
projects, | ||
models, | ||
// min_scores, | ||
// max_scores, | ||
} | ||
.render_once() | ||
.unwrap(), | ||
)) | ||
} | ||
|
||
#[get("/models_turboframe/<id>")] | ||
pub async fn models_get(cluster: ConnectedCluster<'_>, id: i64) -> Result<ResponseOk, Error> { | ||
let model = models::Model::get_by_id(cluster.pool(), id).await?; | ||
let snapshot = if let Some(snapshot_id) = model.snapshot_id { | ||
Some(models::Snapshot::get_by_id(cluster.pool(), snapshot_id).await?) | ||
} else { | ||
None | ||
}; | ||
|
||
let project = models::Project::get_by_id(cluster.pool(), model.project_id).await?; | ||
|
||
Ok(ResponseOk( | ||
templates::Model { | ||
deployed: model.deployed(cluster.pool()).await?, | ||
model, | ||
snapshot, | ||
project, | ||
} | ||
.render_once() | ||
.unwrap(), | ||
)) | ||
} | ||
|
||
pub fn routes() -> Vec<Route> { | ||
routes![deployment_models, model, models_index, models_get,] | ||
} |
This file contains hidden or 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,63 @@ | ||
use rocket::route::Route; | ||
use sailfish::TemplateOnce; | ||
|
||
use crate::{ | ||
guards::ConnectedCluster, | ||
responses::{Error, ResponseOk}, | ||
}; | ||
|
||
use crate::models; | ||
use crate::templates; | ||
|
||
use std::collections::HashMap; | ||
|
||
pub mod deployment_models; | ||
pub mod notebooks; | ||
pub mod projects; | ||
pub mod snapshots; | ||
pub mod uploader; | ||
|
||
#[get("/deployments")] | ||
pub async fn deployments_index(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, Error> { | ||
let projects = models::Project::all(cluster.pool()).await?; | ||
let mut deployments = HashMap::new(); | ||
|
||
for project in projects.iter() { | ||
deployments.insert( | ||
project.id, | ||
models::Deployment::get_by_project_id(cluster.pool(), project.id).await?, | ||
); | ||
} | ||
|
||
Ok(ResponseOk( | ||
templates::Deployments { projects, deployments }.render_once().unwrap(), | ||
)) | ||
} | ||
|
||
#[get("/deployments/<id>")] | ||
pub async fn deployments_get(cluster: ConnectedCluster<'_>, id: i64) -> Result<ResponseOk, Error> { | ||
let deployment = models::Deployment::get_by_id(cluster.pool(), id).await?; | ||
let project = models::Project::get_by_id(cluster.pool(), deployment.project_id).await?; | ||
let model = models::Model::get_by_id(cluster.pool(), deployment.model_id).await?; | ||
|
||
Ok(ResponseOk( | ||
templates::Deployment { | ||
project, | ||
deployment, | ||
model, | ||
} | ||
.render_once() | ||
.unwrap(), | ||
)) | ||
} | ||
|
||
pub fn routes() -> Vec<Route> { | ||
let mut routes = routes![deployments_index, deployments_get,]; | ||
|
||
routes.extend(deployment_models::routes()); | ||
routes.extend(notebooks::routes()); | ||
routes.extend(projects::routes()); | ||
routes.extend(snapshots::routes()); | ||
routes.extend(uploader::routes()); | ||
routes | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conflicts with our cloud route.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not new code, I just moved all the deployment/engine stuff out of lib.rs and into an organized file structure. We add /dashboard to the front. So the actual url is /dashboard/deployments, soon to be /engine/deployments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, sorry. Been a while since I looked at this code.