Add comment for validLogViewerConfig function

Co-authored-by: Jared Scheib <jared.scheib@gmail.com>
pull/3806/head
Alirie Gray 2018-07-10 15:09:06 -07:00
parent 92029e5525
commit 0988388e24
1 changed files with 5 additions and 0 deletions

View File

@ -126,6 +126,11 @@ func (s *Service) ReplaceOrganizationLogViewerConfig(w http.ResponseWriter, r *h
encodeJSON(w, http.StatusOK, res, s.Logger)
}
// validLogViewerConfig ensures that the request body log viewer UI config is valid
// to be valid, it must: not be empty, have at least one column, not have multiple
// columns with the same name or position value, each column must have a visbility
// of either "visible" or "hidden" and if a column is of type severity, it must have
// at least one severity format of type icon, text, or both
func validLogViewerConfig(cfg chronograf.LogViewerConfig) error {
if len(cfg.Columns) == 0 {
return fmt.Errorf("Invalid log viewer config: must have at least 1 column")