@@ -24,6 +24,10 @@ pub struct InstalledPackageListItem {
2424 pub namespace : String ,
2525 pub status : String ,
2626 pub has_changes : bool ,
27+ /// True when the package has a local commit. Setting a remote only
28+ /// re-commits (creating a new revision) when there is a commit to
29+ /// re-commit, so the UI gates the "creates a new revision" notice on this.
30+ pub has_local_commit : bool ,
2731 pub uri : Option < quilt_uri:: S3PackageUri > ,
2832 /// Raw `lineage.remote_uri` rendering, kept separate from `uri` so
2933 /// the UI can still surface a misconfigured remote when origin
@@ -69,12 +73,15 @@ async fn load_package_item(
6973 let namespace = installed_package. namespace . to_string ( ) ;
7074 let paused_reason = paused_reasons. get ( & namespace) . cloned ( ) ;
7175 let lineage = m. get_installed_package_lineage ( installed_package) . await ?;
76+ // Computed before `lineage` is moved by the `into()` below.
77+ let has_local_commit = lineage. commit . is_some ( ) ;
7278
7379 let Some ( remote_uri) = lineage. remote_uri . as_ref ( ) else {
7480 return Ok ( InstalledPackageListItem {
7581 namespace,
7682 status : "local" . to_string ( ) ,
7783 has_changes : false ,
84+ has_local_commit,
7885 uri : None ,
7986 remote_display : None ,
8087 paused_reason,
@@ -88,6 +95,7 @@ async fn load_package_item(
8895 namespace,
8996 status : "error" . to_string ( ) ,
9097 has_changes : false ,
98+ has_local_commit,
9199 uri : Some ( typed_uri) ,
92100 remote_display : Some ( remote_uri. to_string ( ) ) ,
93101 paused_reason,
@@ -105,6 +113,7 @@ async fn load_package_item(
105113 namespace,
106114 status : upstream_state. to_string ( ) ,
107115 has_changes,
116+ has_local_commit,
108117 uri : Some ( typed_uri) ,
109118 remote_display : Some ( remote_display) ,
110119 paused_reason,
@@ -731,13 +740,14 @@ mod tests {
731740 namespace : "acme/data" . to_string ( ) ,
732741 status : "paused" . to_string ( ) ,
733742 has_changes : false ,
743+ has_local_commit : false ,
734744 uri : None ,
735745 remote_display : None ,
736746 paused_reason : Some ( "workflow rejected metadata" . to_string ( ) ) ,
737747 } ;
738748 assert_eq ! (
739749 serde_json:: to_string( & item) . unwrap( ) ,
740- r#"{"namespace":"acme/data","status":"paused","hasChanges":false,"uri":null,"remoteDisplay":null,"pausedReason":"workflow rejected metadata"}"#
750+ r#"{"namespace":"acme/data","status":"paused","hasChanges":false,"hasLocalCommit":false," uri":null,"remoteDisplay":null,"pausedReason":"workflow rejected metadata"}"#
741751 ) ;
742752 }
743753}
0 commit comments