Skip to content

Commit

Permalink
Fix: after review. And added title to secret list response.
Browse files Browse the repository at this point in the history
  • Loading branch information
korvyashka committed Mar 8, 2024
1 parent 12ee55b commit 4dbbd97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/commands/edge_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl EdgeAppCommand {
let app_secrets: Vec<HashMap<String, serde_json::Value>> = serde_json::from_value(
commands::get(
&self.authentication,
&format!("v4.1/edge-apps/settings?select=optional,name,help_text&app_id=eq.{}&order=name.asc&type=eq.secret", app_id,)
&format!("v4.1/edge-apps/settings?select=optional,name,title,help_text&app_id=eq.{}&order=name.asc&type=eq.secret", app_id,)
)?
)?;

Expand Down Expand Up @@ -2881,7 +2881,7 @@ settings:
"user-agent",
format!("screenly-cli {}", env!("CARGO_PKG_VERSION")),
)
.query_param("select", "optional,name,help_text")
.query_param("select", "optional,name,title,help_text")
.query_param("app_id", "eq.01H2QZ6Z8WXWNDC0KQ198XCZEW")
.query_param("type", "eq.secret")
.query_param("order", "name.asc");
Expand Down
16 changes: 10 additions & 6 deletions src/commands/edge_app_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,29 @@ where
for (key, value) in setting_data {
match key.as_str() {
"type" => {
setting.type_ = deserialize_setting_type(value).unwrap();
setting.type_ =
deserialize_setting_type(value).expect("Failed to parse setting type.");
}
"default_value" => {
setting.default_value = value.as_str().map(|s| s.to_string());
}
"title" => {
setting.title = value.as_str().unwrap().to_string();
setting.title = value.as_str().expect("Failed to parse title.").to_string();
}
"optional" => {
setting.optional = value.as_bool().unwrap();
setting.optional = value.as_bool().expect("Failed to parse optional.")
}
"help_text" => {
setting.help_text = value.as_str().unwrap().to_string();
setting.help_text = value
.as_str()
.expect("Failed to parse help_text.")
.to_string();
}
"is_global" => {
setting.is_global = value.as_bool().unwrap();
setting.is_global = value.as_bool().expect("Failed to parse is_global.");
}
"name" => {
setting.name = value.as_str().unwrap().to_string();
setting.name = value.as_str().expect("Failed to parse name.").to_string();
}
_ => {}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,8 @@ impl Formatter for EdgeAppSecrets {
fn format(&self, output_type: OutputType) -> String {
format_value(
output_type,
vec!["Name", "Optional", "Help text"],
vec!["name", "optional", "help_text"],
vec!["Name", "Title", "Optional", "Help text"],
vec!["name", "title", "optional", "help_text"],
self,
Some(
|field_name: &str, field_value: &serde_json::Value| -> Cell {
Expand Down

0 comments on commit 4dbbd97

Please sign in to comment.