Skip to content
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

Add missing SetDashboardParams #117

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions rest-dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ func (r *Client) Search(ctx context.Context, params ...SearchParam) ([]FoundBoar
type SetDashboardParams struct {
FolderID int
Overwrite bool
Message string
Refresh string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do:

Suggested change
Refresh string
Refresh time.Duration

}

// SetDashboard updates existing dashboard or creates a new one.
Expand All @@ -229,9 +231,11 @@ func (r *Client) SetDashboard(ctx context.Context, board Board, params SetDashbo
var (
isBoardFromDB bool
newBoard struct {
Dashboard Board `json:"dashboard"`
FolderID int `json:"folderId"`
Overwrite bool `json:"overwrite"`
Dashboard Board `json:"dashboard"`
FolderID int `json:"folderId"`
Overwrite bool `json:"overwrite"`
Message string `json:"message,omitempty"`
Refresh string `json:"refresh,omitempty"`
}
raw []byte
resp StatusMessage
Expand All @@ -244,6 +248,8 @@ func (r *Client) SetDashboard(ctx context.Context, board Board, params SetDashbo
newBoard.Dashboard = board
newBoard.FolderID = params.FolderID
newBoard.Overwrite = params.Overwrite
newBoard.Message = params.Message
newBoard.Refresh = params.Refresh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then do:

Suggested change
newBoard.Refresh = params.Refresh
newBoard.Refresh = params.Refresh.Round(time.Second).String()

if !params.Overwrite {
newBoard.Dashboard.ID = 0
}
Expand Down