-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dashboards] Squashed commits to delete history
- Loading branch information
Showing
3 changed files
with
34 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -11,55 +11,63 @@ class DashboardService < Dogapi::APIService | |
|
||
# Create new dashboard | ||
# | ||
# Required arguments: | ||
# :title => String: Title of the dashboard | ||
# :widgets => JSON: List of widgets to display on the dashboard | ||
# :layout_type => String: Layout type of the dashboard | ||
# (for now, only "ordered" layout - current timeboard layout - is supported) | ||
# Optional arguments: | ||
# :description => String: Description of the dashboard | ||
# :is_read_only => Boolean: Whether this dashboard is read-only. | ||
# If True, only the author and admins can make changes to it. | ||
# :notify_list => JSON: List of handles of users to notify when changes are made to this dashboard | ||
# e.g. '["[email protected]", "[email protected]"]' | ||
# :template_variables => JSON: List of template variables for this dashboard. | ||
# e.g. [{"name": "host", "prefix": "host", "default": "my-host"}]' | ||
def create_board(title, widgets, description, is_read_only, notify_list, template_variables) | ||
# e.g. [{"name": "host", "prefix": "host", "default": "my-host"}] | ||
def create_board(title, widgets, layout_type, options) | ||
# Required arguments | ||
body = { | ||
title: title, | ||
widgets: widgets, | ||
layout_type: 'ordered' | ||
layout_type: layout_type | ||
} | ||
# Optional arguments | ||
body[:description] = description if description | ||
body[:is_read_only] = is_read_only if is_read_only | ||
body[:notify_list] = notify_list if notify_list | ||
body[:template_variables] = template_variables if template_variables | ||
body[:description] = options[:description] if options[:description] | ||
body[:is_read_only] = options[:is_read_only] if options[:is_read_only] | ||
body[:notify_list] = options[:notify_list] if options[:notify_list] | ||
body[:template_variables] = options[:template_variables] if options[:template_variables] | ||
|
||
request(Net::HTTP::Post, "/api/#{API_VERSION}/#{RESOURCE_NAME}", nil, body, true) | ||
end | ||
|
||
# Update a dashboard | ||
# | ||
# Required arguments: | ||
# :dashboard_id => String: ID of the dashboard | ||
# :title => String: Title of the dashboard | ||
# :widgets => JSON: List of widgets to display on the dashboard | ||
# :layout_type => String: Layout type of the dashboard | ||
# (for now, only "ordered" layout - current timeboard layout - is supported) | ||
# Optional arguments: | ||
# :description => String: Description of the dashboard | ||
# :is_read_only => Boolean: Whether this dashboard is read-only. | ||
# If True, only the author and admins can make changes to it. | ||
# :notify_list => JSON: List of handles of users to notify when changes are made to this dashboard | ||
# e.g. '["[email protected]", "[email protected]"]' | ||
# :template_variables => JSON: List of template variables for this dashboard. | ||
# e.g. [{"name": "host", "prefix": "host", "default": "my-host"}]' | ||
def update_board(dashboard_id, title, widgets, description, is_read_only, notify_list, template_variables) | ||
# e.g. [{"name": "host", "prefix": "host", "default": "my-host"}] | ||
def update_board(dashboard_id, title, widgets, layout_type, options) | ||
# Required arguments | ||
body = { | ||
title: title, | ||
widgets: widgets, | ||
layout_type: 'ordered' | ||
layout_type: layout_type | ||
} | ||
# Optional arguments | ||
body[:description] = description if description | ||
body[:is_read_only] = is_read_only if is_read_only | ||
body[:notify_list] = notify_list if notify_list | ||
body[:template_variables] = template_variables if template_variables | ||
body[:description] = options[:description] if options[:description] | ||
body[:is_read_only] = options[:is_read_only] if options[:is_read_only] | ||
body[:notify_list] = options[:notify_list] if options[:notify_list] | ||
body[:template_variables] = options[:template_variables] if options[:template_variables] | ||
|
||
request(Net::HTTP::Put, "/api/#{API_VERSION}/#{RESOURCE_NAME}/#{dashboard_id}", nil, body, true) | ||
end | ||
|
This file contains 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