1- import type { Palette } from '@furystack/shades-common-components'
1+ import { createComponent } from '@furystack/shades'
2+ import { CircularProgress , Icon , icons , type Palette } from '@furystack/shades-common-components'
23import type { ServiceView } from 'common'
34
45export type PipelineStageId = 'clone' | 'install' | 'build' | 'run'
@@ -15,7 +16,7 @@ export type ServiceAction = {
1516 label : string
1617 apiAction : string
1718 color : keyof Palette
18- icon : string
19+ icon : JSX . Element
1920 tooltip ?: string
2021}
2122
@@ -96,46 +97,86 @@ const stageActionMap: Record<PipelineStageId, { label: string; retryLabel: strin
9697
9798export const getPrimaryAction = ( service : ServiceView ) : ServiceAction => {
9899 if ( service . runStatus === 'running' ) {
99- return { label : 'Stop' , apiAction : '/services/:id/stop' , color : 'error' , icon : 'stopCircle' }
100+ return {
101+ label : 'Stop' ,
102+ apiAction : '/services/:id/stop' ,
103+ color : 'error' ,
104+ icon : < Icon icon = { icons . stopCircle } size = "small" /> ,
105+ }
100106 }
101107 if ( service . runStatus === 'starting' || service . runStatus === 'stopping' ) {
102- return { label : 'Stop' , apiAction : '/services/:id/stop' , color : 'warning' , icon : 'stopCircle' }
108+ return {
109+ label : 'Stop' ,
110+ apiAction : '/services/:id/stop' ,
111+ color : 'warning' ,
112+ icon : < Icon icon = { icons . stopCircle } size = "small" /> ,
113+ }
103114 }
104115
105116 const stages = getPipelineStages ( service )
106117 const failedStage = stages . find ( ( s ) => s . status === 'failed' )
107118 if ( failedStage ) {
108119 const map = stageActionMap [ failedStage . id ]
109- return { label : map . retryLabel , apiAction : map . apiAction , color : 'error' , icon : 'refresh' }
120+ return {
121+ label : map . retryLabel ,
122+ apiAction : map . apiAction ,
123+ color : 'error' ,
124+ icon : < Icon icon = { icons . refresh } size = "small" /> ,
125+ }
110126 }
111127
112128 const inProgressStage = stages . find ( ( s ) => s . status === 'in-progress' )
113129 if ( inProgressStage ) {
114- return { label : `${ inProgressStage . label } ing...` , apiAction : '' , color : 'warning' , icon : 'loader' }
130+ return {
131+ label : `${ inProgressStage . label } ing...` ,
132+ apiAction : '' ,
133+ color : 'warning' ,
134+ icon : < CircularProgress size = { 12 } thickness = { 2.5 } /> ,
135+ }
115136 }
116137
117138 const pendingStage = stages . find ( ( s ) => s . status === 'pending' )
118139 if ( pendingStage ) {
119140 if ( pendingStage . id === 'run' ) {
120- return { label : 'Start' , apiAction : '/services/:id/start' , color : 'success' , icon : 'play' }
141+ return {
142+ label : 'Start' ,
143+ apiAction : '/services/:id/start' ,
144+ color : 'success' ,
145+ icon : < Icon icon = { icons . play } size = "small" /> ,
146+ }
121147 }
122148 const map = stageActionMap [ pendingStage . id ]
123- return { label : map . label , apiAction : map . apiAction , color : 'primary' , icon : 'settings' }
149+ return {
150+ label : map . label ,
151+ apiAction : map . apiAction ,
152+ color : 'primary' ,
153+ icon : < Icon icon = { icons . settings } size = "small" /> ,
154+ }
124155 }
125156
126- return { label : 'Start' , apiAction : '/services/:id/start' , color : 'success' , icon : 'play' }
157+ return {
158+ label : 'Start' ,
159+ apiAction : '/services/:id/start' ,
160+ color : 'success' ,
161+ icon : < Icon icon = { icons . play } size = "small" /> ,
162+ }
127163}
128164
129165export const getSecondaryActions = ( service : ServiceView ) : ServiceAction [ ] => {
130166 const actions : ServiceAction [ ] = [ ]
131167
132168 if ( service . runStatus === 'running' ) {
133- actions . push ( { label : 'Restart' , apiAction : '/services/:id/restart' , color : 'warning' , icon : 'refresh' } )
169+ actions . push ( {
170+ label : 'Restart' ,
171+ apiAction : '/services/:id/restart' ,
172+ color : 'warning' ,
173+ icon : < Icon icon = { icons . refresh } size = "small" /> ,
174+ } )
134175 actions . push ( {
135176 label : 'Update' ,
136177 apiAction : '/services/:id/update' ,
137178 color : 'primary' ,
138- icon : 'download' ,
179+ icon : < Icon icon = { icons . refresh } size = "small" /> ,
139180 tooltip : 'Pull, install, build, and restart if running' ,
140181 } )
141182 }
@@ -147,7 +188,7 @@ export const getSecondaryActions = (service: ServiceView): ServiceAction[] => {
147188 label : 'Set Up All' ,
148189 apiAction : '/services/:id/setup' ,
149190 color : 'primary' ,
150- icon : ' settings' ,
191+ icon : < Icon icon = { icons . settings } size = "small" /> ,
151192 tooltip : 'Clone, install, and build (initial provisioning)' ,
152193 } )
153194 }
@@ -158,7 +199,7 @@ export const getSecondaryActions = (service: ServiceView): ServiceAction[] => {
158199 label : 'Update' ,
159200 apiAction : '/services/:id/update' ,
160201 color : 'primary' ,
161- icon : 'download' ,
202+ icon : < Icon icon = { icons . refresh } size = "small" /> ,
162203 tooltip : 'Pull, install, build, and restart if running' ,
163204 } )
164205 }
0 commit comments