🌐 AI搜索 & 代理 主页
Skip to content

Commit 764a6a6

Browse files
authored
Dashboard fix for 2.7.8 (#963)
1 parent fbe9724 commit 764a6a6

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

pgml-dashboard/sqlx-data.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@
566566
"nullable": [
567567
false,
568568
false,
569-
false,
569+
true,
570570
false,
571571
false,
572572
null,
@@ -864,7 +864,7 @@
864864
"nullable": [
865865
false,
866866
false,
867-
false,
867+
true,
868868
false,
869869
false,
870870
null,
@@ -1113,7 +1113,7 @@
11131113
"nullable": [
11141114
false,
11151115
false,
1116-
false,
1116+
true,
11171117
false,
11181118
false,
11191119
null,

pgml-dashboard/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,12 @@ pub async fn models_index(cluster: ConnectedCluster<'_>) -> Result<ResponseOk, E
367367
#[get("/models/<id>")]
368368
pub async fn models_get(cluster: ConnectedCluster<'_>, id: i64) -> Result<ResponseOk, Error> {
369369
let model = models::Model::get_by_id(cluster.pool(), id).await?;
370-
let snapshot = models::Snapshot::get_by_id(cluster.pool(), model.snapshot_id).await?;
370+
let snapshot = if let Some(snapshot_id) = model.snapshot_id {
371+
Some(models::Snapshot::get_by_id(cluster.pool(), snapshot_id).await?)
372+
} else {
373+
None
374+
};
375+
371376
let project = models::Project::get_by_id(cluster.pool(), model.project_id).await?;
372377

373378
Ok(ResponseOk(

pgml-dashboard/src/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ pub enum Runtime {
444444
pub struct Model {
445445
pub id: i64,
446446
pub project_id: i64,
447-
pub snapshot_id: i64,
447+
pub snapshot_id: Option<i64>,
448448
pub num_features: i32,
449449
pub algorithm: String,
450450
pub runtime: Option<String>,

pgml-dashboard/src/templates/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ pub struct Models {
397397
pub struct Model {
398398
pub model: models::Model,
399399
pub project: models::Project,
400-
pub snapshot: models::Snapshot,
400+
pub snapshot: Option<models::Snapshot>,
401401
pub deployed: bool,
402402
}
403403

pgml-dashboard/templates/content/dashboard/panels/model.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ <h1><span class="material-symbols-outlined">model_training</span>
1313
<dl>
1414
<dt>Project</dt>
1515
<dd><a href="/dashboard?tab=Project&id=<%= project.id %>" data-turbo="false"><%= project.name %></a></dd>
16-
<dt>Snapshot</dt>
17-
<dd><a href="/dashboard?tab=Snapshot&id=<%= snapshot.id %>" data-turbo="false"><%= snapshot.relation_name %></a></dd>
16+
<% if let Some(snapshot) = snapshot { %>
17+
<dt>Snapshot</dt>
18+
<dd><a href="/dashboard?tab=Snapshot&id=<%= snapshot.id %>" data-turbo="false"><%= snapshot.relation_name %></a></dd>
19+
<% } %>
1820
<dt>Created</dt>
1921
<dd><time datetime="<% model.created_at; %>"><% model.created_at; %></time></dd>
2022
</dl>

0 commit comments

Comments
 (0)