From b4a72b5641e9cae6b6844f1b2e0152be1edef509 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 15 Jun 2023 18:08:49 -0700 Subject: [PATCH] Basic recommendation-chart story with knobs --- .../charts/recommendation-chart.stories.js | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ui/stories/charts/recommendation-chart.stories.js diff --git a/ui/stories/charts/recommendation-chart.stories.js b/ui/stories/charts/recommendation-chart.stories.js new file mode 100644 index 000000000..c3a42c7a8 --- /dev/null +++ b/ui/stories/charts/recommendation-chart.stories.js @@ -0,0 +1,50 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: MPL-2.0 + */ + +import hbs from 'htmlbars-inline-precompile'; +import DelayedTruth from '../utils/delayed-truth'; +import { withKnobs, optionsKnob, number } from '@storybook/addon-knobs'; + +export default { + title: 'Charts/Recomendation CHart', + decorators: [withKnobs], +}; + +export let Configurable = () => { + return { + template: hbs` + + {{#if delayedTruth.complete}} + + {{/if}} + `, + context: contextFactory(), + }; +}; + +function contextFactory() { + const numberConfig = { range: true, min: 0, max: 1000, step: 1 }; + return { + delayedTruth: DelayedTruth.create(), + resource: optionsKnob( + 'Resource', + { Cpu: 'CPU', Memory: 'MemoryMB' }, + 'CPU', + { display: 'inline-radio' } + ), + current: number('Current', 100, numberConfig), + recommendedValue: number('Recommendation', 300, numberConfig), + stats: { + mean: number('Stat: mean', 150, numberConfig), + p99: number('Stat: p99', 600, numberConfig), + max: number('Stat: max', 650, numberConfig), + }, + }; +}