1.5.1 • Published 22 days ago

@grafana/labels v1.5.1

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
22 days ago

@grafana/labels

Getting Started

The following guide is for consuming the library imports

  1. Import core component
import { ServiceLabels } from '@grafana/labels'
  1. Render ServiceLabels
<ServiceLabels
  value={options}
  errors={{}}
  loadById
  onLoadKeys={() => Promise.resolve(keys)}
  onLoadValuesForKey={() => Promise.resolve(values)}
  onCreateKey={() => Promise.resolve(undefined)}
  onUpdateKey={() => Promise.resolve(undefined)}
  onCreateValue={() => Promise.resolve(undefined)}
  onUpdateValue={() => Promise.resolve(undefined)}
  onRowItemRemoval={() => {}}
  onDataUpdate={(result) => console.info(result)}
/>

Props you may want to pass to the component

  • valueField - (optional) Field name for the id field (defaults to id)
  • labelField - (optional) Field name for the value field (defaults to name)
  • loadById - (optional - defaults to true) If true this will pas the id to some callbacks that fetch that, otherwise it will pass the value
  • onLoadKeys - Callback for fetching the keys
  • onLoadValuesForKey - Callback for fetching the values for a key
  • onCreateKey - Callback for requesting data whenever a new key is added
  • onUpdateKey - Callback for requesting data whenever a key is updated (edited)
  • onCreateValue - Callback for requesting data whenever a new value is added
  • onUpdateValue - Callback for requesting data whenever a value is updated (edited)
  • onRowItemRemoval - (optional) Callback for when a row is being removed (clicked X)
  • onDataUpdate - Callback for whenever the data changes (add/edit/add new row/remove row)

valueField and labelField allow customizing the data type you pass to the component in case you don't want to follow id/name convention

The following guide is for running the development version

To bootstrap both the webpack server and the library build:

  1. Open terminal and run yarn watch in the frontend directory - this will watch for any changes in library
  2. Run yarn link to allow creating a symlink to this directory
  3. In your grafana plugin directory, run yarn add '@grafana/labels'

Available commands

yarn build // triggers webpack to build the library  
yarn watch // triggers webpack to watch for library changes  

NPM library publishing

  • Update version in package.json
  • Run npm publish, authenticate and voila!
1.5.1

22 days ago

1.4.5

22 days ago

1.5.0

3 months ago

1.4.4

5 months ago

1.4.3

5 months ago

1.4.2

5 months ago

1.4.1

5 months ago

1.4.0

5 months ago

1.3.5

5 months ago

1.3.4

6 months ago

1.3.3

6 months ago

1.3.2

6 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.0

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.0.1

7 months ago

0.0.1-beta.12

7 months ago

0.0.1-beta.11

7 months ago

0.0.1-beta.10

7 months ago

0.0.1-beta.9

7 months ago

0.0.1-beta.8

7 months ago

0.0.1-beta.7

7 months ago

0.0.1-beta.6

7 months ago

0.0.1-beta.5

7 months ago

0.0.1-beta.4

7 months ago

0.0.1-beta.2

7 months ago

0.0.1-beta.1

7 months ago

0.0.1-beta.0

7 months ago