|
| 1 | +import type { Meta, StoryObj } from "@storybook/react"; |
| 2 | +import { ManagedAgentsConsumption } from "./ManagedAgentsConsumption"; |
| 3 | + |
| 4 | +const meta: Meta<typeof ManagedAgentsConsumption> = { |
| 5 | + title: |
| 6 | + "pages/DeploymentSettingsPage/LicensesSettingsPage/ManagedAgentsConsumption", |
| 7 | + component: ManagedAgentsConsumption, |
| 8 | + args: { |
| 9 | + managedAgentFeature: { |
| 10 | + enabled: true, |
| 11 | + actual: 50000, |
| 12 | + soft_limit: 60000, |
| 13 | + limit: 120000, |
| 14 | + usage_period: { |
| 15 | + start: "February 27, 2025", |
| 16 | + end: "February 27, 2026", |
| 17 | + issued_at: "February 27, 2025", |
| 18 | + }, |
| 19 | + entitlement: "entitled", |
| 20 | + }, |
| 21 | + }, |
| 22 | +}; |
| 23 | + |
| 24 | +export default meta; |
| 25 | +type Story = StoryObj<typeof ManagedAgentsConsumption>; |
| 26 | + |
| 27 | +export const Default: Story = {}; |
| 28 | + |
| 29 | +export const NearLimit: Story = { |
| 30 | + args: { |
| 31 | + managedAgentFeature: { |
| 32 | + enabled: true, |
| 33 | + actual: 115000, |
| 34 | + soft_limit: 60000, |
| 35 | + limit: 120000, |
| 36 | + usage_period: { |
| 37 | + start: "February 27, 2025", |
| 38 | + end: "February 27, 2026", |
| 39 | + issued_at: "February 27, 2025", |
| 40 | + }, |
| 41 | + entitlement: "entitled", |
| 42 | + }, |
| 43 | + }, |
| 44 | +}; |
| 45 | + |
| 46 | +export const OverIncluded: Story = { |
| 47 | + args: { |
| 48 | + managedAgentFeature: { |
| 49 | + enabled: true, |
| 50 | + actual: 80000, |
| 51 | + soft_limit: 60000, |
| 52 | + limit: 120000, |
| 53 | + usage_period: { |
| 54 | + start: "February 27, 2025", |
| 55 | + end: "February 27, 2026", |
| 56 | + issued_at: "February 27, 2025", |
| 57 | + }, |
| 58 | + entitlement: "entitled", |
| 59 | + }, |
| 60 | + }, |
| 61 | +}; |
| 62 | + |
| 63 | +export const LowUsage: Story = { |
| 64 | + args: { |
| 65 | + managedAgentFeature: { |
| 66 | + enabled: true, |
| 67 | + actual: 25000, |
| 68 | + soft_limit: 60000, |
| 69 | + limit: 120000, |
| 70 | + usage_period: { |
| 71 | + start: "February 27, 2025", |
| 72 | + end: "February 27, 2026", |
| 73 | + issued_at: "February 27, 2025", |
| 74 | + }, |
| 75 | + entitlement: "entitled", |
| 76 | + }, |
| 77 | + }, |
| 78 | +}; |
| 79 | + |
| 80 | +export const IncludedAtLimit: Story = { |
| 81 | + args: { |
| 82 | + managedAgentFeature: { |
| 83 | + enabled: true, |
| 84 | + actual: 25000, |
| 85 | + soft_limit: 30500, |
| 86 | + limit: 30500, |
| 87 | + usage_period: { |
| 88 | + start: "February 27, 2025", |
| 89 | + end: "February 27, 2026", |
| 90 | + issued_at: "February 27, 2025", |
| 91 | + }, |
| 92 | + entitlement: "entitled", |
| 93 | + }, |
| 94 | + }, |
| 95 | +}; |
| 96 | + |
| 97 | +export const Disabled: Story = { |
| 98 | + args: { |
| 99 | + managedAgentFeature: { |
| 100 | + enabled: false, |
| 101 | + actual: undefined, |
| 102 | + soft_limit: undefined, |
| 103 | + limit: undefined, |
| 104 | + usage_period: undefined, |
| 105 | + entitlement: "not_entitled", |
| 106 | + }, |
| 107 | + }, |
| 108 | +}; |
| 109 | + |
| 110 | +export const NoFeature: Story = { |
| 111 | + args: { |
| 112 | + managedAgentFeature: undefined, |
| 113 | + }, |
| 114 | +}; |
| 115 | + |
| 116 | +// Error States for Validation |
| 117 | +export const ErrorMissingData: Story = { |
| 118 | + args: { |
| 119 | + managedAgentFeature: { |
| 120 | + enabled: true, |
| 121 | + actual: undefined, |
| 122 | + soft_limit: undefined, |
| 123 | + limit: undefined, |
| 124 | + usage_period: undefined, |
| 125 | + entitlement: "entitled", |
| 126 | + }, |
| 127 | + }, |
| 128 | +}; |
| 129 | + |
| 130 | +export const ErrorNegativeValues: Story = { |
| 131 | + args: { |
| 132 | + managedAgentFeature: { |
| 133 | + enabled: true, |
| 134 | + actual: -100, |
| 135 | + soft_limit: 60000, |
| 136 | + limit: 120000, |
| 137 | + usage_period: { |
| 138 | + start: "February 27, 2025", |
| 139 | + end: "February 27, 2026", |
| 140 | + issued_at: "February 27, 2025", |
| 141 | + }, |
| 142 | + entitlement: "entitled", |
| 143 | + }, |
| 144 | + }, |
| 145 | +}; |
| 146 | + |
| 147 | +export const ErrorSoftLimitExceedsLimit: Story = { |
| 148 | + args: { |
| 149 | + managedAgentFeature: { |
| 150 | + enabled: true, |
| 151 | + actual: 50000, |
| 152 | + soft_limit: 150000, |
| 153 | + limit: 120000, |
| 154 | + usage_period: { |
| 155 | + start: "February 27, 2025", |
| 156 | + end: "February 27, 2026", |
| 157 | + issued_at: "February 27, 2025", |
| 158 | + }, |
| 159 | + entitlement: "entitled", |
| 160 | + }, |
| 161 | + }, |
| 162 | +}; |
| 163 | + |
| 164 | +export const ErrorInvalidDates: Story = { |
| 165 | + args: { |
| 166 | + managedAgentFeature: { |
| 167 | + enabled: true, |
| 168 | + actual: 50000, |
| 169 | + soft_limit: 60000, |
| 170 | + limit: 120000, |
| 171 | + usage_period: { |
| 172 | + start: "invalid-date", |
| 173 | + end: "February 27, 2026", |
| 174 | + issued_at: "February 27, 2025", |
| 175 | + }, |
| 176 | + entitlement: "entitled", |
| 177 | + }, |
| 178 | + }, |
| 179 | +}; |
| 180 | + |
| 181 | +export const ErrorEndBeforeStart: Story = { |
| 182 | + args: { |
| 183 | + managedAgentFeature: { |
| 184 | + enabled: true, |
| 185 | + actual: 50000, |
| 186 | + soft_limit: 60000, |
| 187 | + limit: 120000, |
| 188 | + usage_period: { |
| 189 | + start: "February 27, 2026", |
| 190 | + end: "February 27, 2025", |
| 191 | + issued_at: "February 27, 2025", |
| 192 | + }, |
| 193 | + entitlement: "entitled", |
| 194 | + }, |
| 195 | + }, |
| 196 | +}; |
0 commit comments