-
Notifications
You must be signed in to change notification settings - Fork 0
[API-373] Add dashboard field flags to create/update #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
callumreid
wants to merge
1
commit into
main
Choose a base branch
from
feat/api-373-dashboard-fields
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,20 @@ pub struct CreateArgs { | |
| input_json: InputJsonArg, | ||
| #[arg(long)] | ||
| name: Option<String>, | ||
| #[arg(long)] | ||
| description: Option<String>, | ||
| /// Mark as a favorite (true/false). | ||
| #[arg(long)] | ||
| favorite: Option<bool>, | ||
| /// Make this the organization's default dashboard (true/false). Omit to auto-default the first dashboard. | ||
| #[arg(long)] | ||
| default: Option<bool>, | ||
| /// Ordering position (>= 0). Omit to append to the end. | ||
| #[arg(long)] | ||
| position: Option<i64>, | ||
| /// Free-form JSON config: a JSON string or @path to a file. | ||
| #[arg(long)] | ||
| config: Option<String>, | ||
| } | ||
|
|
||
| #[derive(Args)] | ||
|
|
@@ -71,6 +85,20 @@ pub struct UpdateArgs { | |
| input_json: InputJsonArg, | ||
| #[arg(long)] | ||
| name: Option<String>, | ||
| #[arg(long)] | ||
| description: Option<String>, | ||
| /// Mark as a favorite (true/false). | ||
| #[arg(long)] | ||
| favorite: Option<bool>, | ||
| /// Make this the organization's default dashboard (true/false). Setting true unsets any other default. | ||
| #[arg(long)] | ||
| default: Option<bool>, | ||
| /// Ordering position (>= 0). | ||
| #[arg(long)] | ||
| position: Option<i64>, | ||
| /// Replacement free-form JSON config: a JSON string or @path to a file. | ||
| #[arg(long)] | ||
| config: Option<String>, | ||
|
Comment on lines
+88
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add validation for position >= 0. Same issue as CreateArgs: the doc comment at line 96 specifies ">= 0" but no validation is present. 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| #[derive(Args)] | ||
|
|
@@ -227,7 +255,13 @@ pub async fn execute( | |
| } | ||
| DashboardCommands::Create(args) => { | ||
| let mut input = args.input_json.object()?; | ||
| let config = args.config.as_ref().map(|c| parse_config(c)).transpose()?; | ||
| input_json::insert(&mut input, "display_name", args.name)?; | ||
| input_json::insert(&mut input, "description", args.description)?; | ||
| input_json::insert(&mut input, "is_favorite", args.favorite)?; | ||
| input_json::insert(&mut input, "is_default", args.default)?; | ||
| input_json::insert(&mut input, "position", args.position)?; | ||
| input_json::insert(&mut input, "config", config)?; | ||
| let req: CreateDashboardRequest = input_json::finish(input)?; | ||
| let dashboard = client.dashboards().create(req).await?; | ||
| let dashboard_id = resource_id(&dashboard.name); | ||
|
|
@@ -241,7 +275,13 @@ pub async fn execute( | |
| } | ||
| DashboardCommands::Update(args) => { | ||
| let mut input = args.input_json.object()?; | ||
| let config = args.config.as_ref().map(|c| parse_config(c)).transpose()?; | ||
| input_json::insert(&mut input, "display_name", args.name)?; | ||
| input_json::insert(&mut input, "description", args.description)?; | ||
| input_json::insert(&mut input, "is_favorite", args.favorite)?; | ||
| input_json::insert(&mut input, "is_default", args.default)?; | ||
| input_json::insert(&mut input, "position", args.position)?; | ||
| input_json::insert(&mut input, "config", config)?; | ||
| let req: UpdateDashboardRequest = input_json::finish(input)?; | ||
| let dashboard = client.dashboards().update(&args.dashboard_id, req).await?; | ||
| emit_one_with_actions( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add validation for position >= 0.
The doc comment at line 73 states position should be ">= 0", but there's no validation to enforce this constraint before sending the request. Users providing negative values will receive an API error instead of a clear, immediate CLI error.
Consider adding a validation helper similar to
validate_widget_grid(lines 192-204):Then call it in the Create and Update handlers before building the request.
🤖 Prompt for AI Agents