|
| 1 | +import React from 'react'; |
| 2 | + |
| 3 | +import { ComponentStory, ComponentMeta } from '@storybook/react'; |
| 4 | + |
| 5 | +import { VariantAnalysisContainer } from '../../view/variant-analysis/VariantAnalysisContainer'; |
| 6 | +import { VariantAnalysisStats } from '../../view/variant-analysis/VariantAnalysisStats'; |
| 7 | +import { VariantAnalysisStatus } from '../../remote-queries/shared/variant-analysis'; |
| 8 | + |
| 9 | +export default { |
| 10 | + title: 'Variant Analysis/Variant Analysis Stats', |
| 11 | + component: VariantAnalysisStats, |
| 12 | + decorators: [ |
| 13 | + (Story) => ( |
| 14 | + <VariantAnalysisContainer> |
| 15 | + <Story /> |
| 16 | + </VariantAnalysisContainer> |
| 17 | + ) |
| 18 | + ], |
| 19 | + argTypes: { |
| 20 | + onViewLogsClick: { |
| 21 | + action: 'view-logs-clicked', |
| 22 | + table: { |
| 23 | + disable: true, |
| 24 | + }, |
| 25 | + }, |
| 26 | + } |
| 27 | +} as ComponentMeta<typeof VariantAnalysisStats>; |
| 28 | + |
| 29 | +const Template: ComponentStory<typeof VariantAnalysisStats> = (args) => ( |
| 30 | + <VariantAnalysisStats {...args} /> |
| 31 | +); |
| 32 | + |
| 33 | +export const Starting = Template.bind({}); |
| 34 | +Starting.args = { |
| 35 | + variantAnalysisStatus: VariantAnalysisStatus.InProgress, |
| 36 | + totalRepositoryCount: 10, |
| 37 | +}; |
| 38 | + |
| 39 | +export const Started = Template.bind({}); |
| 40 | +Started.args = { |
| 41 | + ...Starting.args, |
| 42 | + resultCount: 99_999, |
| 43 | + completedRepositoryCount: 2, |
| 44 | +}; |
| 45 | + |
| 46 | +export const StartedWithWarnings = Template.bind({}); |
| 47 | +StartedWithWarnings.args = { |
| 48 | + ...Starting.args, |
| 49 | + queryResult: 'warning', |
| 50 | +}; |
| 51 | + |
| 52 | +export const Succeeded = Template.bind({}); |
| 53 | +Succeeded.args = { |
| 54 | + ...Started.args, |
| 55 | + totalRepositoryCount: 1000, |
| 56 | + completedRepositoryCount: 1000, |
| 57 | + variantAnalysisStatus: VariantAnalysisStatus.Succeeded, |
| 58 | + duration: 720_000, |
| 59 | + completedAt: new Date(1661263446000), |
| 60 | +}; |
| 61 | + |
| 62 | +export const SucceededWithWarnings = Template.bind({}); |
| 63 | +SucceededWithWarnings.args = { |
| 64 | + ...Succeeded.args, |
| 65 | + totalRepositoryCount: 10, |
| 66 | + completedRepositoryCount: 2, |
| 67 | + queryResult: 'warning', |
| 68 | +}; |
| 69 | + |
| 70 | +export const Failed = Template.bind({}); |
| 71 | +Failed.args = { |
| 72 | + ...Starting.args, |
| 73 | + variantAnalysisStatus: VariantAnalysisStatus.Failed, |
| 74 | + duration: 10_000, |
| 75 | + completedAt: new Date(1661263446000), |
| 76 | +}; |
| 77 | + |
| 78 | +export const Stopped = Template.bind({}); |
| 79 | +Stopped.args = { |
| 80 | + ...SucceededWithWarnings.args, |
| 81 | + queryResult: 'stopped', |
| 82 | +}; |
0 commit comments