-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mockotlpserver): some improvements to "summary" styling (#459)
- Show attributes for histogram metrics and handle showing multiple data points. - Bold "span", "event", "$metricType" in renderings; and style the name of that span/event/metric in magenta. See PR for screenshots.
- Loading branch information
Showing
5 changed files
with
104 additions
and
59 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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
// This color-related block from Bunyan, with permission. ;) | ||
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics | ||
// Suggested colors (some are unreadable in common cases): | ||
// - Good: cyan, yellow (limited use), bold, green, magenta, red | ||
// - Bad: blue (not visible on cmd.exe), grey (same color as background on | ||
// Solarized Dark theme from <https://github.com/altercation/solarized>, see | ||
// issue #160) | ||
var colors = { | ||
bold: [1, 22], | ||
italic: [3, 23], | ||
underline: [4, 24], | ||
inverse: [7, 27], | ||
white: [37, 39], | ||
grey: [90, 39], | ||
black: [30, 39], | ||
blue: [34, 39], | ||
cyan: [36, 39], | ||
green: [32, 39], | ||
magenta: [35, 39], | ||
red: [31, 39], | ||
yellow: [33, 39], | ||
}; | ||
function stylizeWithColor(str, color) { | ||
if (!str) return ''; | ||
var codes = colors[color]; | ||
if (codes) { | ||
return '\x1b[' + codes[0] + 'm' + str + '\x1b[' + codes[1] + 'm'; | ||
} else { | ||
return str; | ||
} | ||
} | ||
|
||
module.exports = { | ||
style: stylizeWithColor, | ||
}; |
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