web: show worker status in sidebar
This commit is contained in:
@@ -561,6 +561,8 @@ pub struct SubscriptionWorker {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub profile: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub repository_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub working_directory_id: Option<SubscriptionWorkdirId>,
|
||||
}
|
||||
|
||||
@@ -570,6 +572,9 @@ impl SubscriptionWorker {
|
||||
if let Some(runtime_id) = &self.runtime_id {
|
||||
validate_identifier("runtime_id", runtime_id, MAX_RESOURCE_ID_BYTES)?;
|
||||
}
|
||||
if let Some(repository_id) = &self.repository_id {
|
||||
validate_identifier("repository_id", repository_id, MAX_RESOURCE_ID_BYTES)?;
|
||||
}
|
||||
if let Some(working_directory_id) = &self.working_directory_id {
|
||||
working_directory_id.validate()?;
|
||||
}
|
||||
@@ -794,6 +799,7 @@ mod tests {
|
||||
workspace_id: Some("workspace-1".to_string()),
|
||||
display_name: Some(format!("Worker {value}")),
|
||||
profile: Some("builtin:coder".to_string()),
|
||||
repository_id: None,
|
||||
working_directory_id: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1952,6 +1952,10 @@ impl RuntimeState {
|
||||
) -> Result<SubscriptionWorker, RuntimeError> {
|
||||
let worker_id = SubscriptionWorkerId::new(worker.worker_id.to_string())
|
||||
.map_err(subscription_validation_error)?;
|
||||
let repository_id = worker
|
||||
.working_directory
|
||||
.as_ref()
|
||||
.map(|working_directory| working_directory.summary.repository_id.clone());
|
||||
let working_directory_id = worker
|
||||
.working_directory
|
||||
.as_ref()
|
||||
@@ -1975,6 +1979,7 @@ impl RuntimeState {
|
||||
workspace_id: worker.workspace_id.clone(),
|
||||
display_name: worker.request.display_name.clone(),
|
||||
profile,
|
||||
repository_id,
|
||||
working_directory_id,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user