Reads a string or numeric `testConfig` field as a stable identity component.
(run: &VisualizerRun, key: &str)
| 865 | |
| 866 | /// Reads a string or numeric `testConfig` field as a stable identity component. |
| 867 | fn config_component(run: &VisualizerRun, key: &str) -> Result<String> { |
| 868 | let value = run |
| 869 | .test_config |
| 870 | .get(key) |
| 871 | .ok_or_else(|| eyre::eyre!("run {} is missing testConfig.{key}", run.id))?; |
| 872 | if let Some(text) = value.as_str() { |
| 873 | return Ok(text.to_owned()); |
| 874 | } |
| 875 | if let Some(number) = value.as_i64() { |
| 876 | return Ok(number.to_string()); |
| 877 | } |
| 878 | if let Some(number) = value.as_u64() { |
| 879 | return Ok(number.to_string()); |
| 880 | } |
| 881 | Err(eyre::eyre!("run {} testConfig.{key} is not a string or number", run.id)) |
| 882 | } |
| 883 | |
| 884 | fn page_component(value: &str) -> String { |
| 885 | value |