Objects
- `notebook` :
object
Functions for creating Fiberplane Notebooks
- `cell` :
object
Functions for creating notebook cells
- `format` :
object
Functions for formatting text
Functions
- `snippet(cells)` ⇒
Array.<Cell>
Function for creating Snippets, or reusable groups of cells.
notebook
: object
notebook
: object
Functions for creating Fiberplane Notebooks
Kind: global namespace
Example
fp.notebook.new('My Notebook')
.setTimeRangeRelative(minutes=60)
.addCells([...])
notebook
:object
notebook.Notebook
A Fiberplane Notebook.
Kind: static class of notebook
See: notebook.new to create a Notebook
notebook.setTimeRangeRelative(minutes)
⇒ Notebook
notebook.setTimeRangeRelative(minutes)
⇒ Notebook
Set the notebook time range relative to when it is created.
For example, specifying minutes=60
will set the start timestamp
to 60 minutes before the notebook is created. The end timestamp
will automatically be set to the time when the notebook is created.
By default, the time range is set to 60 minutes relative to when the notebook is created.
Kind: instance method of Notebook
Param | Type |
---|---|
minutes | number |
notebook.setTimeRangeAbsolute(from, to)
⇒ Notebook
notebook.setTimeRangeAbsolute(from, to)
⇒ Notebook
Set the time range of the notebook using absolute timestamps.
Note: in most cases, you will want to use [notebook#setTimeRangeRelative](notebook#setTimeRangeRelative) instead.
Kind: instance method of Notebook
Param | Type | Description |
---|---|---|
from | string | ISO 8601/RFC 3339 formatted start timestamp |
to | string | ISO 8601/RFC 3339 formatted end timestamp |
notebook.setSelectedDataSource(providerType, dataSourceName, proxyName)
⇒ Notebook
notebook.setSelectedDataSource(providerType, dataSourceName, proxyName)
⇒ Notebook
Select a data source for the given provider type.
The workspace defaults will be used if none is specified.
Kind: instance method of Notebook
Param | Type | Description |
---|---|---|
providerType | string | The type of provider to select the data source for |
dataSourceName | string | The name of the data source to select for the given provider type |
proxyName | string | null | If the data source is configured in a proxy, the name of the proxy |
notebook.addCell(cell)
⇒ Notebook
notebook.addCell(cell)
⇒ Notebook
Add a single cell to the notebook.
Kind: instance method of Notebook
Param | Type |
---|---|
cell | Cell |
notebook.addCells(cells)
⇒ Notebook
notebook.addCells(cells)
⇒ Notebook
Add an array of cells to the notebook.
Note: this function supports nested arrays of cells.
Kind: instance method of Notebook
Param | Type |
---|---|
cells | Array.<Cell> |
notebook.addLabel(key, value)
⇒ Notebook
notebook.addLabel(key, value)
⇒ Notebook
Add a single label to the notebook.
Kind: instance method of Notebook
Param | Type | Description |
---|---|---|
key | string | Key of the label |
value | string | Value of the label |
Example
notebook.addLabel(key='service', value='api')
notebook.addLabels(labels)
⇒ Notebook
notebook.addLabels(labels)
⇒ Notebook
Add an object of labels to the notebook.
Kind: instance method of Notebook
Param | Type | Description |
---|---|---|
labels | object | Map of keys and values |
Example
notebook.addLabels({
service: 'api',
severity: 'high'
})
notebook.new(title)
⇒ Notebook
notebook.new(title)
⇒ Notebook
Create a new notebook with the given title.
Kind: static method of notebook
Param |
---|
title |
cell
: object
cell
: object
Functions for creating notebook cells
Kind: global namespace
Example (Adding cells to a notebook)
notebook.addCells([
cell.h1('Title'),
cell.text('Hello world!'),
// See below for all of the available cell types
])
cell
:object
- .Cell
.heading
:object
.list
:object
.listItem
:object
.checkbox(checked, content, level, readOnly)
⇒Cell
.code(checked, content, syntax, readOnly)
⇒Cell
.divider(readOnly)
⇒Cell
.provider(intent, title, queryData, readOnly)
.prometheus(content, readOnly)
⇒Cell
.elasticsearch(content, readOnly)
⇒Cell
.loki(content, readOnly)
⇒Cell
.text(content, readOnly)
⇒Cell
.image(url, readOnly)
cell.Cell
An individual cell in a notebook
Kind: static class of cell
cell.setReadOnly(readOnly)
⇒ Cell
cell.setReadOnly(readOnly)
⇒ Cell
Lock the cell
Kind: instance method of Cell
Param | Type | Default |
---|---|---|
readOnly | boolean | true |
cell.heading
: object
cell.heading
: object
Heading cells
Kind: static namespace of cell
.heading
:object
heading.h1(content, readOnly)
⇒ Cell
heading.h1(content, readOnly)
⇒ Cell
Create an H1 cell
Also accessible as cell.h1
Kind: static method of heading
Param | Type | Default | Description |
---|---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
readOnly | boolean | false | Whether the cell is locked |
heading.h2(content, readOnly)
⇒ Cell
heading.h2(content, readOnly)
⇒ Cell
Create an H2 cell
Also accessible as cell.h2
Kind: static method of heading
Param | Type | Default | Description |
---|---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
readOnly | boolean | false | Whether the cell is locked |
heading.h3(content, readOnly)
⇒ Cell
heading.h3(content, readOnly)
⇒ Cell
Create an H3 cell
Also accessible as cell.h3
Kind: static method of heading
Param | Type | Default | Description |
---|---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
readOnly | boolean | false | Whether the cell is locked |
cell.list
: object
cell.list
: object
Helper functions for easily creating lists
Kind: static namespace of cell
.list
:object
list.ordered(cells, startNumber, level, readOnly)
⇒ Array.<Cell>
list.ordered(cells, startNumber, level, readOnly)
⇒ Array.<Cell>
Create an ordered list
Also accessible as cell.ol
and cell.orderedList
Kind: static method of list
Param | Type | Default | Description |
---|---|---|---|
cells | Array.<(string|cell.Cell|Array)> | An array of strings, cells, or nested lists. Strings will become numbered list items. Other cell types are included as they are. Nested lists have their indentation | |
startNumber | number | 1 | Starting number for the whole list. This function automatically handles numbering for all items in this list. |
level | number | null |
| Specify the indentation level. The top level is |
readOnly | boolean | false | Whether the cells are locked |
list.unordered(cells, level, readOnly)
⇒ Array.<Cell>
list.unordered(cells, level, readOnly)
⇒ Array.<Cell>
Create an unordered list
Also accessible as cell.ul
and cell.unorderedList
Kind: static method of list
Param | Type | Default | Description |
---|---|---|---|
cells | Array.<(string|cell.Cell|Array)> | An array of strings, cells, or nested lists. Strings will become list items. Other cell types are included as they are. Nested lists have their indentation | |
level | number | null |
| Specify the indentation level. The top level is |
readOnly | boolean | false | Whether the cells are locked |
cell.listItem
: object
cell.listItem
: object
Individual list items.
In most cases, you will want to use [Cell.list](Cell.list) instead.
Kind: static namespace of cell
.listItem
:object
listItem.ordered(content, startNumber, level, readOnly)
⇒ Cell
listItem.ordered(content, startNumber, level, readOnly)
⇒ Cell
Create an ordered list item
Kind: static method of listItem
Param | Type | Default | Description |
---|---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
startNumber | number | null |
| Specify the starting number. Mostly useful if you want to start the list at a number other than |
level | number | null |
| Specify the indentation level. The top level is |
readOnly | boolean | false | Whether the cell is locked |
listItem.unordered(content, level, readOnly)
⇒ Cell
listItem.unordered(content, level, readOnly)
⇒ Cell
Create an unordered list item
Kind: static method of listItem
Param | Type | Default | Description |
---|---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
level | number | null |
| Specify the indentation level. The top level is |
readOnly | boolean | false | Whether the cell is locked |
cell.checkbox(checked, content, level, readOnly)
⇒ Cell
cell.checkbox(checked, content, level, readOnly)
⇒ Cell
Create a checkbox cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
checked | boolean | false | Whether the checkbox is checked |
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
level | number | null |
| Specify the indentation level. The top level is |
readOnly | boolean | false | Whether the cell is locked |
cell.code(checked, content, syntax, readOnly)
⇒ Cell
cell.code(checked, content, syntax, readOnly)
⇒ Cell
Create a code cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
checked | boolean | false | Whether the checkbox is checked |
content | string | "''" | Cell text content |
syntax | string | null | null | Specify the syntax to use for rendering the code |
readOnly | boolean | false | Whether the cell is locked |
cell.divider(readOnly)
⇒ Cell
cell.divider(readOnly)
⇒ Cell
Create a divider (horizontal rule) cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
readOnly | boolean | false | Whether the cell is locked |
cell.provider(intent, title, queryData, readOnly)
cell.provider(intent, title, queryData, readOnly)
Create a provider cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
intent | string | The intent of the new provider cell | |
title | string | Title for the new provider cell | |
queryData | string | Query data that the provider will understand | |
readOnly | boolean | false | Whether the cell is locked |
cell.prometheus(content, readOnly)
⇒ Cell
cell.prometheus(content, readOnly)
⇒ Cell
Create a Prometheus query cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
content | string | "''" | Prometheus query |
readOnly | boolean | false | Whether the cell is locked |
cell.elasticsearch(content, readOnly)
⇒ Cell
cell.elasticsearch(content, readOnly)
⇒ Cell
Create an Elasticsearch query cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
content | string | "''" | Elasticsearch query |
readOnly | boolean | false | Whether the cell is locked |
cell.loki(content, readOnly)
⇒ Cell
cell.loki(content, readOnly)
⇒ Cell
Create a Loki query cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
content | string | "''" | Loki query |
readOnly | boolean | false | Whether the cell is locked |
cell.text(content, readOnly)
⇒ Cell
cell.text(content, readOnly)
⇒ Cell
Create a plain text cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add | |
readOnly | boolean | false | Whether the cell is locked |
cell.image(url, readOnly)
cell.image(url, readOnly)
Create an image cell
Kind: static method of cell
Param | Type | Default | Description |
---|---|---|---|
url | string | URL of the image | |
readOnly | boolean | false | Whether the cell is locked |
format
: object
format
: object
Functions for formatting text
Kind: global namespace
Example
fp.format.bold('hello')
Example (Nested formatting)
fp.format.bold(fp.format.italic('hello'))
Example (Creating a cell with different text formats)
fp.cell.text(['hello ', fp.format.bold('world '), fp.format.italics('!')])
// This is equivalent to:
fp.cell.text(fp.format.raw('hello ').bold('world ').italics('!'))
format
:object
- .FormattedContent
.raw(content)
⇒FormattedContent
.bold(content)
⇒FormattedContent
.italics(content)
⇒FormattedContent
.code(content)
⇒FormattedContent
.highlight(content)
⇒FormattedContent
.strikethrough(content)
⇒FormattedContent
.underline(content)
⇒FormattedContent
.link(content, url)
⇒FormattedContent
.mention(userName, userId)
⇒FormattedContent
.timestamp(timestamp)
⇒FormattedContent
.label(key, url)
⇒FormattedContent
.raw(content)
⇒FormattedContent
.bold(content)
⇒FormattedContent
.code(content)
⇒FormattedContent
.highlight(content)
⇒FormattedContent
.italics(content)
⇒FormattedContent
.underline(content)
⇒FormattedContent
.strikethrough(content)
⇒FormattedContent
.link(content, url)
⇒FormattedContent
- .FormattedContent
format.FormattedContent
A class representing formatted text. Each of the formatting functions can be called as methods to append text with the given formatting.
Kind: static class of format
- .FormattedContent
.raw(content)
⇒FormattedContent
.bold(content)
⇒FormattedContent
.italics(content)
⇒FormattedContent
.code(content)
⇒FormattedContent
.highlight(content)
⇒FormattedContent
.strikethrough(content)
⇒FormattedContent
.underline(content)
⇒FormattedContent
.link(content, url)
⇒FormattedContent
.mention(userName, userId)
⇒FormattedContent
.timestamp(timestamp)
⇒FormattedContent
.label(key, url)
⇒FormattedContent
formattedContent.raw(content)
⇒ FormattedContent
formattedContent.raw(content)
⇒ FormattedContent
Add raw text. Note that if this is added inside a formatting helper, the outer formatting will be applied to this text.
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.bold(content)
⇒ FormattedContent
formattedContent.bold(content)
⇒ FormattedContent
Add bold text
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.italics(content)
⇒ FormattedContent
formattedContent.italics(content)
⇒ FormattedContent
Add italicized text
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.code(content)
⇒ FormattedContent
formattedContent.code(content)
⇒ FormattedContent
Add code-formatted text
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.highlight(content)
⇒ FormattedContent
formattedContent.highlight(content)
⇒ FormattedContent
Add highlighted text
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.strikethrough(content)
⇒ FormattedContent
formattedContent.strikethrough(content)
⇒ FormattedContent
Add strikethrough text
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.underline(content)
⇒ FormattedContent
formattedContent.underline(content)
⇒ FormattedContent
Add underlined text
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
formattedContent.link(content, url)
⇒ FormattedContent
formattedContent.link(content, url)
⇒ FormattedContent
Add a link
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
url | string | null | The URL of the link. If none is provided, the content will be used as the link URL |
Example
fmt.link('Example', 'https://example.com')
Example
fmt.link('https://example.com')
formattedContent.mention(userName, userId)
⇒ FormattedContent
formattedContent.mention(userName, userId)
⇒ FormattedContent
Add a mention
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
userName | string | The username to mention |
userId | string | The ID of the user to mention |
formattedContent.timestamp(timestamp)
⇒ FormattedContent
formattedContent.timestamp(timestamp)
⇒ FormattedContent
Add a timestamp
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
timestamp | string | The RFC3339-formatted timestamp to add |
formattedContent.label(key, url)
⇒ FormattedContent
formattedContent.label(key, url)
⇒ FormattedContent
Add a label
Kind: instance method of FormattedContent
Param | Type | Description |
---|---|---|
key | string | The label's key |
url | string | The label's value (optional) |
format.raw(content)
⇒ FormattedContent
format.raw(content)
⇒ FormattedContent
Add raw text. Note that if this is added inside a formatting helper, the outer formatting will be applied to this text.
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.bold(content)
⇒ FormattedContent
format.bold(content)
⇒ FormattedContent
Add bold text
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.code(content)
⇒ FormattedContent
format.code(content)
⇒ FormattedContent
Add code-formatted text
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.highlight(content)
⇒ FormattedContent
format.highlight(content)
⇒ FormattedContent
Add highlighted text
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.italics(content)
⇒ FormattedContent
format.italics(content)
⇒ FormattedContent
Add italicized text
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.underline(content)
⇒ FormattedContent
format.underline(content)
⇒ FormattedContent
Add underlined text
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.strikethrough(content)
⇒ FormattedContent
format.strikethrough(content)
⇒ FormattedContent
Add strikethrough text
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
format.link(content, url)
⇒ FormattedContent
format.link(content, url)
⇒ FormattedContent
Add a link
Kind: static method of format
Param | Type | Description |
---|---|---|
content | string | FormattedContent | Array.<(string|format.FormattedContent)> | The content to add |
url | string | null | The URL of the link. If none is provided, the content will be used as the link URL |
Example
fmt.link('Example', 'https://example.com')
Example
fmt.link('https://example.com')
snippet(cells)
⇒ Array.<Cell>
snippet(cells)
⇒ Array.<Cell>
Function for creating Snippets, or reusable groups of cells.
Kind: global function
Param | Type |
---|---|
cells | Array.<Cell> |
Example
fp.snippet([
c.text('Hello, world!'),
c.code('This is a snippet'),
])