Browse Source

enable options catagories && add prettierr dep

merge-requests/1/merge
vargburz 3 years ago
parent
commit
def5fd9718
  1. 2
      .prettierrc.js
  2. 3
      package.json
  3. 42
      src/module.ts
  4. 4
      src/types.ts
  5. 5
      yarn.lock

2
.prettierrc.js

@ -1,3 +1,3 @@
module.exports = {
...require("./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json"),
...require('./node_modules/@grafana/toolkit/src/config/prettier.plugin.config.json'),
};

3
package.json

@ -16,7 +16,8 @@
"@grafana/data": "latest",
"@grafana/toolkit": "latest",
"@grafana/ui": "latest",
"emotion": "10.0.27"
"emotion": "10.0.27",
"prettier": "^2.6.2"
},
"engines": {
"node": ">=14"

42
src/module.ts

@ -6,7 +6,8 @@ export const plugin = new PanelPlugin<PanelOptions>(Panel).setPanelOptions((buil
return builder
.addRadio({
path: 'visualizationType',
name: 'Visualization type',
name: 'Pod',
category: ['Visualization'],
defaultValue: Pod.GAUGE,
settings: {
options: [
@ -28,37 +29,16 @@ export const plugin = new PanelPlugin<PanelOptions>(Panel).setPanelOptions((buil
],
},
})
.addTextInput({
path: 'text',
name: 'Simple text option',
description: 'Description of panel option',
defaultValue: 'Default value of text input option',
})
.addBooleanSwitch({
path: 'showSeriesCount',
name: 'Show series counter',
defaultValue: false,
.addNumberInput({
path: 'gauge.min',
name: 'Min',
category: ['Gauge'],
showIf: (config) => config.visualizationType === Pod.GAUGE,
})
.addRadio({
path: 'seriesCountSize',
defaultValue: 'sm',
name: 'Series counter size',
settings: {
options: [
{
value: 'sm',
label: 'Small',
},
{
value: 'md',
label: 'Medium',
},
{
value: 'lg',
label: 'Large',
},
],
},
.addNumberInput({
path: 'gauge.max',
name: 'Max',
category: ['Gauge'],
showIf: (config) => config.visualizationType === Pod.GAUGE,
});
});

4
src/types.ts

@ -1,5 +1,9 @@
export interface PanelOptions {
visualizationType: Pod;
gauge: {
min: number | null;
max: number | null;
};
}
export enum Pod {

5
yarn.lock

@ -9731,6 +9731,11 @@ prettier@2.6.0:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4"
integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==
prettier@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032"
integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==
pretty-error@^2.0.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6"

Loading…
Cancel
Save