@@ -5,82 +5,102 @@ import type { Prerequisite, ServiceView } from 'common'
55import { BranchSelector } from '../../../components/branch-selector.js'
66import { ServiceStatusIndicator } from '../../../components/service-status-indicator.js'
77import { getPrimaryAction , getSecondaryActions } from '../../../utils/service-pipeline.js'
8+ import type { TabId } from './index.js'
89
910type ServiceDetailActionBarProps = {
1011 service : ServiceView
1112 servicePrereqs : Prerequisite [ ]
1213 prereqSatisfiedCount : number
1314 prereqFailedCount : number
1415 actionInProgress : string | null
16+ activeTab : TabId
1517 onRunAction : ( apiAction : string ) => void
18+ onEdit : ( ) => void
1619 onDelete : ( ) => void
1720}
1821
1922export const ServiceDetailActionBar = Shade < ServiceDetailActionBarProps > ( {
2023 customElementName : 'shade-service-detail-action-bar' ,
2124 render : ( { props } ) => {
22- const { service, servicePrereqs, prereqSatisfiedCount, prereqFailedCount, actionInProgress } = props
25+ const { service, servicePrereqs, prereqSatisfiedCount, prereqFailedCount, actionInProgress, activeTab } = props
2326
27+ const isEditing = activeTab === 'configuration'
2428 const primary = getPrimaryAction ( service )
2529 const secondaryActions = getSecondaryActions ( service )
2630
2731 return (
2832 < div style = { { display : 'flex' , alignItems : 'center' , gap : '8px' , flexWrap : 'wrap' } } >
2933 < ServiceStatusIndicator service = { service } />
30- { service . repositoryId ? (
31- < BranchSelector
32- serviceId = { service . id }
33- currentBranch = { service . currentBranch }
34- isCloned = { service . cloneStatus === 'cloned' }
35- />
36- ) : null }
37- { servicePrereqs . length > 0 ? (
38- < Chip
39- variant = "outlined"
40- size = "small"
41- color = {
42- prereqFailedCount > 0 ? 'error' : prereqSatisfiedCount === servicePrereqs . length ? 'success' : 'secondary'
43- }
44- >
45- { prereqSatisfiedCount === servicePrereqs . length
46- ? '✓ Prerequisites OK'
47- : `${ prereqSatisfiedCount } /${ servicePrereqs . length } prereqs` }
48- </ Chip >
49- ) : null }
50- { primary . apiAction ? (
51- < Button
52- variant = "contained"
53- size = "small"
54- color = { primary . color === 'secondary' ? undefined : primary . color }
55- loading = { ! ! actionInProgress }
56- disabled = { ! ! actionInProgress }
57- onclick = { ( ) => props . onRunAction ( primary . apiAction ) }
58- >
59- { primary . label }
60- </ Button >
61- ) : null }
62- { secondaryActions . map ( ( action ) => (
63- < Button
64- variant = "outlined"
65- size = "small"
66- color = { action . color === 'secondary' ? undefined : action . color }
67- title = { action . tooltip }
68- loading = { actionInProgress === action . apiAction }
69- disabled = { ! ! actionInProgress }
70- onclick = { ( ) => props . onRunAction ( action . apiAction ) }
71- >
72- { action . label }
73- </ Button >
74- ) ) }
75- < Button
76- variant = "outlined"
77- size = "small"
78- color = "error"
79- onclick = { props . onDelete }
80- startIcon = { < Icon icon = { icons . trash } size = "small" /> }
81- >
82- Delete
83- </ Button >
34+ { isEditing ? null : (
35+ < >
36+ { service . repositoryId ? (
37+ < BranchSelector
38+ serviceId = { service . id }
39+ currentBranch = { service . currentBranch }
40+ isCloned = { service . cloneStatus === 'cloned' }
41+ />
42+ ) : null }
43+ { servicePrereqs . length > 0 ? (
44+ < Chip
45+ variant = "outlined"
46+ size = "small"
47+ color = {
48+ prereqFailedCount > 0
49+ ? 'error'
50+ : prereqSatisfiedCount === servicePrereqs . length
51+ ? 'success'
52+ : 'secondary'
53+ }
54+ >
55+ { prereqSatisfiedCount === servicePrereqs . length
56+ ? '✓ Prerequisites OK'
57+ : `${ prereqSatisfiedCount } /${ servicePrereqs . length } prereqs` }
58+ </ Chip >
59+ ) : null }
60+ { primary . apiAction ? (
61+ < Button
62+ variant = "contained"
63+ size = "small"
64+ color = { primary . color === 'secondary' ? undefined : primary . color }
65+ loading = { ! ! actionInProgress }
66+ disabled = { ! ! actionInProgress }
67+ onclick = { ( ) => props . onRunAction ( primary . apiAction ) }
68+ >
69+ { primary . label }
70+ </ Button >
71+ ) : null }
72+ { secondaryActions . map ( ( action ) => (
73+ < Button
74+ variant = "outlined"
75+ size = "small"
76+ color = { action . color === 'secondary' ? undefined : action . color }
77+ title = { action . tooltip }
78+ loading = { actionInProgress === action . apiAction }
79+ disabled = { ! ! actionInProgress }
80+ onclick = { ( ) => props . onRunAction ( action . apiAction ) }
81+ >
82+ { action . label }
83+ </ Button >
84+ ) ) }
85+ < Button
86+ variant = "outlined"
87+ size = "small"
88+ onclick = { props . onEdit }
89+ startIcon = { < Icon icon = { icons . edit } size = "small" /> }
90+ >
91+ Edit
92+ </ Button >
93+ < Button
94+ variant = "outlined"
95+ size = "small"
96+ color = "error"
97+ onclick = { props . onDelete }
98+ startIcon = { < Icon icon = { icons . trash } size = "small" /> }
99+ >
100+ Delete
101+ </ Button >
102+ </ >
103+ ) }
84104 </ div >
85105 )
86106 } ,
0 commit comments