1+ import { useFeatures } from "@contexts/Features.hook" ;
12import { type Producer } from "@services/producers" ;
23import { type ConcurrencyConfig } from "@services/queues" ;
34import { Meta , StoryObj } from "@storybook/react-vite" ;
@@ -88,25 +89,25 @@ export const QueueNotFound: Story = {
8889 } ,
8990} ;
9091
91- // Active queue with no producers (features disabled)
92- export const ActiveQueueWithoutPro : Story = {
93- args : {
94- producers : [ ] ,
95- queue : queueFactory . active ( ) . build ( ) ,
96- } ,
97- parameters : {
98- features : {
99- hasProducerTable : false ,
100- } ,
101- } ,
102- } ;
103-
10492// Active queue with no producers (features enabled)
10593export const ActiveQueueNoProducers : Story = {
10694 args : {
10795 producers : [ ] ,
10896 queue : queueFactory . active ( ) . build ( ) ,
10997 } ,
98+ parameters : {
99+ mockData : [
100+ {
101+ hook : useFeatures ,
102+ mockValue : {
103+ features : {
104+ hasProducerTable : true ,
105+ producerQueries : true ,
106+ } ,
107+ } ,
108+ } ,
109+ ] ,
110+ } ,
110111} ;
111112
112113// Paused queue with no producers
@@ -115,6 +116,19 @@ export const PausedQueueNoProducers: Story = {
115116 producers : [ ] ,
116117 queue : queueFactory . paused ( ) . build ( ) ,
117118 } ,
119+ parameters : {
120+ mockData : [
121+ {
122+ hook : useFeatures ,
123+ mockValue : {
124+ features : {
125+ hasProducerTable : true ,
126+ producerQueries : true ,
127+ } ,
128+ } ,
129+ } ,
130+ ] ,
131+ } ,
118132} ;
119133
120134// Active queue with producers
@@ -123,6 +137,19 @@ export const ActiveQueueWithProducers: Story = {
123137 producers : createProducers ( 5 , "test-queue" ) ,
124138 queue : queueFactory . active ( ) . build ( ) ,
125139 } ,
140+ parameters : {
141+ mockData : [
142+ {
143+ hook : useFeatures ,
144+ mockValue : {
145+ features : {
146+ hasProducerTable : true ,
147+ producerQueries : true ,
148+ } ,
149+ } ,
150+ } ,
151+ ] ,
152+ } ,
126153} ;
127154
128155// Paused queue with some paused producers
@@ -131,31 +158,110 @@ export const PausedQueueWithMixedProducers: Story = {
131158 producers : createProducers ( 5 , "test-queue" , { paused : true } ) ,
132159 queue : queueFactory . paused ( ) . build ( ) ,
133160 } ,
161+ parameters : {
162+ mockData : [
163+ {
164+ hook : useFeatures ,
165+ mockValue : {
166+ features : {
167+ hasProducerTable : true ,
168+ producerQueries : true ,
169+ } ,
170+ } ,
171+ } ,
172+ ] ,
173+ } ,
134174} ;
135175
136176// Queue with concurrency settings
137- export const QueueWithConcurrencySettings : Story = {
177+ export const WithConcurrencySettings : Story = {
138178 args : {
139179 producers : createProducers ( 3 , "test-queue" , { withConcurrency : true } ) ,
140180 queue : queueFactory . withConcurrency ( ) . build ( ) ,
141181 } ,
182+ parameters : {
183+ features : {
184+ hasProducerTable : true ,
185+ producerQueries : true ,
186+ } ,
187+ } ,
142188} ;
143189
144190// Queue with inconsistent producer concurrency settings
145- export const QueueWithInconsistentConcurrency : Story = {
191+ export const InconsistentConcurrency : Story = {
146192 args : {
147193 producers : createProducers ( 3 , "test-queue" , {
148194 inconsistentConcurrency : true ,
149195 withConcurrency : true ,
150196 } ) ,
151197 queue : queueFactory . withConcurrency ( ) . build ( ) ,
152198 } ,
199+ parameters : {
200+ mockData : [
201+ {
202+ hook : useFeatures ,
203+ mockValue : {
204+ features : {
205+ hasProducerTable : true ,
206+ producerQueries : true ,
207+ } ,
208+ } ,
209+ } ,
210+ ] ,
211+ } ,
153212} ;
154213
155214// Queue with many producers
156- export const QueueWithManyProducers : Story = {
215+ export const ManyProducers : Story = {
157216 args : {
158217 producers : createProducers ( 20 , "test-queue" , { paused : true } ) ,
159218 queue : queueFactory . active ( ) . build ( ) ,
160219 } ,
220+ parameters : {
221+ mockData : [
222+ {
223+ hook : useFeatures ,
224+ mockValue : {
225+ features : {
226+ hasProducerTable : true ,
227+ producerQueries : true ,
228+ } ,
229+ } ,
230+ } ,
231+ ] ,
232+ } ,
233+ } ;
234+
235+ // Queue with single paused producer (should not show concurrency warning)
236+ export const SinglePausedProducer : Story = {
237+ args : {
238+ producers : createProducers ( 1 , "test-queue" , { paused : true } ) ,
239+ queue : queueFactory . active ( ) . build ( ) ,
240+ } ,
241+ parameters : {
242+ mockData : [
243+ {
244+ hook : useFeatures ,
245+ mockValue : {
246+ features : {
247+ hasProducerTable : true ,
248+ producerQueries : true ,
249+ } ,
250+ } ,
251+ } ,
252+ ] ,
253+ } ,
254+ } ;
255+
256+ // Pro features disabled
257+ export const WithoutPro : Story = {
258+ args : {
259+ producers : [ ] ,
260+ queue : queueFactory . active ( ) . build ( ) ,
261+ } ,
262+ parameters : {
263+ features : {
264+ hasProducerTable : false ,
265+ } ,
266+ } ,
161267} ;
0 commit comments