Skip to content

Commit 294d826

Browse files
committed
fixed pipeline icons
1 parent bf16022 commit 294d826

File tree

2 files changed

+56
-13
lines changed

2 files changed

+56
-13
lines changed

frontend/src/pages/services/service-detail/action-bar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const ServiceDetailActionBar = Shade<ServiceDetailActionBarProps>({
2929
...secondaryActions.map((action) => ({
3030
key: action.apiAction,
3131
label: action.label,
32+
icon: action.icon,
3233
})),
3334
...(secondaryActions.length > 0 ? [{ type: 'divider' as const, key: 'sep' }] : []),
3435
{ key: 'delete', label: 'Delete', icon: <Icon icon={icons.trash} size="small" /> },
@@ -54,6 +55,7 @@ export const ServiceDetailActionBar = Shade<ServiceDetailActionBarProps>({
5455
variant="contained"
5556
size="small"
5657
color={primary.color === 'secondary' ? undefined : primary.color}
58+
startIcon={primary.icon}
5759
loading={!!actionInProgress}
5860
disabled={!!actionInProgress}
5961
onclick={() => props.onRunAction(primary.apiAction)}
Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
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'
23
import type { ServiceView } from 'common'
34

45
export 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

9798
export 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

129165
export 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

Comments
 (0)