New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@senx/discovery-widgets

Package Overview
Dependencies
Maintainers
2
Versions
289
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@senx/discovery-widgets

Discovery Widgets Elements

  • 0.0.17
  • npm
  • Socket score

Version published
Weekly downloads
481
increased by14.52%
Maintainers
2
Weekly downloads
 
Created
Source

Discovery

Usage

In a Web Environment

With NPM/Yarn
$ npm install @senx/discovery-widgets
With CDN

<script nomodule src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.js"></script>
<script type="module" src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.esm.js"></script>
Usage

<html>
<head>
  <title>Test</title>
</head>
<body>
<discovery-dashboard url="https://warp.senx.io/api/v0/exec" dashboard-title="Test">
  {
  'title' 'Test'
  'description' 'Dashboard test'
  'tiles' [
  {
  'title' 'test'
  'options' { 'autoRefresh' 1 }
  'x' 0 'y' 0 'w' 12 'h' 4
  'type' 'area' 'macro' <%
  1 4 <% DROP NEWGTS 'g' STORE
  1 10 <% 'ts' STORE $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP %> FOR
  $g %> FOR %>
  }
  ]
  }
</discovery-dashboard>
<script nomodule src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.js"></script>
<script type="module" src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.esm.js"></script>
</body>
</html>

Within Warp 10

Through a WarpScript:

{
    'title' 'Test'
    'description' 'Dashboard test'
    'tiles' [ 
        {
            'title' 'test'
            'options' { 'autoRefresh' 1 }
            'x' 0 'y' 0 'w' 12 'h' 4
            'type' 'area' 'macro' <%
                1 4 <% DROP NEWGTS 'g' STORE
                1 10 <% 'ts' STORE $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP %> FOR
                $g %> FOR %> 
        }
    ] 
}
@senx/discovery2/render

Configuration

discovery-dashboard

This is the main Web Component.

Attributes
PropertyAttributeTypeDefaultDescription
autoRefreshauto-refreshnumber-1Reloads the dashboard each x seconds, -1 to disable it
cellHeightcell-heightnumber220If type = "scada", cell height in pixels
colscolsnumber12If type = "scada", number of columns of the grid
dashboardTitledashboard-titlestringundefinedTitle of the dashboard, not mandatory, could be overridden by the dashboard definition (see Dashboard Definition below).
debugdebugbooleanfalseEnable debug messages
optionsoptionsParam / stringnew Param()Serialized JSON options (see Params below)
typetype"dashboard" / "scada"'dashboard'Dashboard means a grid of cols columns, each tile is places in a cell with x and y. Scada means a free placement of tiles in pixels with x, y and z
urlurlstringundefinedexec url of your Warp 10 endpoint
Payload

Insert directly your dashboard definition as a WarpScript inside the HTML tag:


<discovery-dashboard url="https://warp.senx.io/api/v0/exec" dashboard-title="Test">
  {
  'title' 'Test'
  'description' 'Dashboard test'
  'tiles' [
  {
  'title' 'test'
  'options' { 'autoRefresh' 1 }
  'x' 0 'y' 0 'w' 12 'h' 4
  'type' 'area' 'macro' <%
  1 4 <% DROP NEWGTS 'g' STORE
  1 10 <% 'ts' STORE $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP %> FOR
  $g %> FOR %>
  }
  ]
  }
</discovery-dashboard>

discovery-tile

This Web component displays a Tile based upon a WarpScript (or FLoWS). The WarpScript is executed when the tile renders.

PropertyAttributeTypeDefaultDescription
autoRefreshauto-refreshnumber-1Reloads the tile and execute again the script each x seconds, -1 to disable it
chartTitlechart-titlestringundefinedTitle of the Tile, not mandatory, could be overridden by the dashboard definition (see Dashboard Definition below).
debugdebugbooleanfalseEnable debug messages
optionsoptionsParam / stringnew Param()Serialized JSON options (see Params below)
typetypeline, area, scatter, spline-area, spline, step, step-after, step-before, annotation, bar, display, image, map, gauge, linear-gauge, circle, pie, plot, doughnut, rose, tabular, svg, input:text, input:list, input:secret, input:autocomplete, input:slider, input:date, input:date-range, buttonChart type
urlurlstringundefinedexec url of your Warp 10 endpoint
langlangwarpscript, flowswarpscriptLanguage used

<discovery-tile url="warp 10 url"
                unit="°C"
                type="text"
                chart-title="Text">
  { 'data' 42 'globalParams' { 'bgColor' 'darkblue' 'fontColor' 'cyan' } }
</discovery-tile>

discovery-tile-result

This Web component displays a Tile based upon a WarpScript (or FLoWS) execution result (DataModel).

PropertyAttributeTypeDefaultDescription
chartTitlechart-titlestringundefinedTitle of the Tile, not mandatory, could be overridden by the dashboard definition (see Dashboard Definition below).
debugdebugbooleanfalseEnable debug messages
optionsoptionsParam / stringnew Param()Serialized JSON options (see Params below)
typetypeline, area, scatter, spline-area, spline, step, step-after, step-before, annotation, bar, display, image, map, gauge, linear-gauge, circle, pie, plot, doughnut, rose, tabular, svg, input:text, input:list, input:secret, input:autocomplete, input:slider, input:date, input:date-range, buttonChart type
urlurlstringundefinedexec url of your Warp 10 endpoint
heightheightnumberFixed height of the tile
widthwidthnumberFixed width of the tile
resultresultDataModel / stringExecution result

<discovery-tile-result url="warp 10 url"
                       unit="°C"
                       type="text"
                       chart-title="Text">
  { 'data' 42 'globalParams' { 'bgColor' 'darkblue' 'fontColor' 'cyan' } }
</discovery-tile-result>
Params / Options

Options inherit from higher level. You can use options as an attribute in <discovery-dashboard />, as a field in the dashboard definition, as a field in a tile definition and as a field in execution result.

options

NameTypeDefaultDescription
typestringChart type (line, area, scatter, spline-area, spline, step, step-after, step-before, annotation, bar, display, image, map, gauge, linear-gauge, circle, pie, plot, doughnut, rose, tabular, svg, input:text, input:list, input:secret, input:autocomplete, input:slider, input:date, input:date-range, button)
timeModestring'date'date, timestamp or custom
timeZonestring'UTC'Timezone
timeUnitstring'us'Warp 10 time unit (us, ms, ns)
schemestring'WARP10'Color scheme (COHESIVE, COHESIVE_2, BELIZE, VIRIDIS, MAGMA, INFERNO, PLASMA, YL_OR_RD, YL_GN_BU, BU_GN, WARP10, NINETEEN_EIGHTY_FOUR, ATLANTIS, DO_ANDROIDS_DREAM, DELOREAN, CTHULHU, ECTOPLASM, T_MAX_400_FILM )
showLegendbooleanfalseDisplay the chart legend
unitstringUnit to be displayed
bgColorstringBackground color of tiles
datasetColorstringOnly for the param field in execution result. Color of the trace
fontColorstringFont color in tiles
borderColorstringBorder color in tiles
showLegendbooleanfalseDisplay chart legend
responsivebooleantrueResponsive charts
showRangeSelectorbooleanfalseDisplay the skyline below line or area charts
autoRefreshnumber-1if positive value, will refresh with a request each autoRefresh second
showErrorsbooleantrueDisplay errors if any
showStatusbooleantrueDisplay the Warp 10 execution status
expandAnnotationbooleanfalseExpand annotations
schemestring'WARP10'Color scheme ( COHESIVE, COHESIVE_2, BELIZE, VIRIDIS, MAGMA, INFERNO, PLASMA, YL_OR_RD, YL_GN_BU, BU_GN, WARP10, NINETEEN_EIGHTY_FOUR, ATLANTIS, DO_ANDROIDS_DREAM, DELOREAN, CTHULHU, ECTOPLASM, T_MAX_400_FILM, MATRIX, CHARTANA)
eventHandlerstring'type=Regexp,tag=Regexp'Only applies on Tiles and Dashboard. See the events chapter below

Dashboard definition

NameTypeDefaultDescription
titlestringDashboard title
descriptionstringDashboard sub-title
tilesTile[]Array of tiles

Tile definition

  • If the dashboard type is 'dashboard', x, y, h and w are expressed in cells. x and y begin at 0, the top left corner, w and h begin at 1.
  • If the dashboard type is 'scada', x, y, h and w are expressed in pixels. x and y begin at 0, the top left corner. z represents the z-index.

Data are displayed either with data or with macro. Auto-refresh for tiles only applies for macro.

NameTypeDefaultDescription
typestringChart type (line, area, scatter, spline-area, spline, step, step-after, step-before, annotation, bar, display, image, map, gauge, linear-gauge, circle, pie, plot, doughnut, rose, tabular, svg, input:text, input:list, input:secret, input:autocomplete, input:slider, input:date, input:date-range, button
endpointstringexec url of your Warp 10 endpoint
titlestringTile title
unitstringUnit to be displayed
xnumberX position of the Tile.
ynumberY position of the Tile.
wnumberWidth the Tile.
hnumberHeight the Tile.
znumberZ index the Tile.
data[]Array of static data computed when the dashboard is rendered. See Execution Result below.
macro<% macro %>A macro executed when the tile loads in the display. See Execution Result below.
optionsOptionOptions (see above) concerning this tile

Execution result (DataModel)

You could either return a single value ( GTS, number or string depending on the chart type), or a complex data structure:

NameTypeDescription
dataGTS, GTS[], string, numberData to display depending on the chart type
globalParamsOptionGlobal options (see above) concerning this tile
paramsOption[]List of options (see above) concerning each displayed data depending of the index of this array
eventsEvents[]List of events to emit (see below)

Common CSS vars

NameDefault
--gts-classname-font-color#004eff
--gts-labelname-font-color#19A979
--gts-attrname-font-color#ED4A7B
--gts-separator-font-color#a0a0a0
--gts-labelvalue-font-color#000000
--gts-attrvalue-font-color#000000
--warp-view-font-color#000000

Specific charts configuration and CSS styles

EventDescriptionType
drawCustomEvent<void>
line, area, scatter, spline-area, spline, step, step-after, step-before
NameDefault
--warp-view-chart-label-color#8e8e8e
--warp-view-chart-grid-color#8e8e8e
NameTypeDescription
dataGTS, GTS[]Data to display, numeric GTS only
globalParamsOptionGlobal options (see above) concerning this tile
paramsOption[]List of options (see above) concerning each displayed dataset depending of the index of this array
eventsEvents[]List of events to emit (see below)

Supported option per series are:

  • datasetColor: Hex CSS color of the series. ie: '#fff00f'
  • type: Chart type (line, area, scatter, spline-area, spline, step, step-after, step-before)
  • xAxis: In case of multi-X axis support, represents the index of related axis.
  • yAxis: In case of multi-Y axis support, represents the index of related axis.
1 4 <% 
  DROP NEWGTS 'g' STORE
  1 30 <% 
    'ts' STORE 
    $g $ts RAND + STU * NOW + NaN NaN NaN RAND ADDVALUE DROP 
  %> FOR
$g %> FOR STACKTOLIST 'data' STORE
{ 
  'data' $data 
  'params' [ 
    { 'datasetColor' '#dc3545' 'xAxis' 0 }
    { 'datasetColor' '#ff9900' 'xAxis' 0 }
    { 'type' 'area' 'datasetColor' '#90d743' 'xAxis' 1 }
    { 'datasetColor' 'white' 'xAxis' 0 }
  ]
}  
annotation
NameDefault
--warp-view-chart-label-color#8e8e8e
--warp-view-chart-grid-color#8e8e8e
NameTypeDescription
dataGTS, GTS[]Data to display, non-numeric GTS only
globalParamsOptionGlobal options (see above) concerning this tile
paramsOption[]List of options (see above) concerning each displayed dataset depending of the index of this array
eventsEvents[]List of events to emit (see below)

Supported option per series are:

  • datasetColor: Hex CSS color of the series. ie: '#fff00f'
bar
NameDefault
--warp-view-chart-label-color#8e8e8e
--warp-view-chart-grid-color#8e8e8e
NameTypeDescription
dataGTS, GTS[], custom dataData to display
globalParamsOptionGlobal options (see above) concerning this tile
paramsOption[]List of options (see above) concerning each displayed dataset depending of the index of this array
eventsEvents[]List of events to emit (see below)

Supported option per series are:

  • datasetColor: Hex CSS color of the series. ie: '#fff00f'
  • bar
    • horizontal: Bar chart orientation
    • stacked

Custom data:

{
  "title": "Test",
  "columns":  [ "A", "B", "C", "D" ],
  "rows": [
    [ "label X", 15, 56, 44, 22 ],
    [ "label Y", 1, 5, 4, 2 ],
    [ "label Z", 14, 45, 78, 12 ]
  ]
}
display
image
map
gauge, circle
linear-gauge
pie, doughnut, rose
plot
tabular
svg
input:text, input:secret
input:list, input:autocomplete
input:slider
input:date
input:date-range
button

Events

Keywords

FAQs

Package last updated on 18 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc