@@ -11,50 +11,45 @@ export function ApplyComplete({ result }: { result: ApplyResult }) {
1111
1212 const validationErrors = isPartial
1313 ? result . errors
14- . filter ( ( e ) => e . errorData . errorType === 'apply_validation' )
15- . map ( ( e ) => new ResourcePlan ( ( e . errorData . data as any ) . plan ) )
14+ . filter ( ( e ) => e . errorData . errorType === 'apply_validation' )
15+ . map ( ( e ) => ( {
16+ plan : new ResourcePlan ( ( e . errorData . data as any ) . plan ) ,
17+ logs : ( ( e . errorData . data as any ) . logs ?? [ ] ) as string [ ] ,
18+ } ) )
1619 : [ ] ;
1720
1821 const genericErrors = isPartial
1922 ? result . errors
20- . filter ( ( e ) => e . errorData . errorType !== 'apply_validation' )
21- . map ( ( e ) => e . message )
23+ . filter ( ( e ) => e . errorData . errorType !== 'apply_validation' )
24+ . map ( ( e ) => e . message )
2225 : [ ] ;
2326
2427 return (
2528 < Box flexDirection = "column" marginTop = { 1 } >
26- < Text bold color = { isPartial ? 'red' : 'green' } >
27- { isPartial ? '⚠ Apply completed with errors' : '🎉 Finished applying 🎉' }
28- </ Text >
29-
30- { result . entries . length > 0 && (
31- < Box flexDirection = "column" marginTop = { 1 } >
32- { result . entries . map ( ( entry ) => (
33- < Box key = { entry . id } >
34- < Text > { entry . id . padEnd ( 30 ) } </ Text >
35- < Text color = { applyEntryInkColor ( entry ) } > { applyEntryLabel ( entry ) } </ Text >
36- </ Box >
37- ) ) }
38- </ Box >
39- ) }
40-
4129 { validationErrors . length > 0 && (
4230 < Box flexDirection = "column" marginTop = { 1 } >
43- { validationErrors . map ( ( resourcePlan ) => (
44- < Box key = { resourcePlan . id } flexDirection = "column" >
31+ { validationErrors . map ( ( entry ) => (
32+ < Box key = { entry . plan . id } flexDirection = "column" >
4533 < Text color = "red" bold >
46- { `Apply failed: resource "${ resourcePlan . id } " did not reach its desired state.` }
34+ { `Apply failed: resource "${ entry . plan . id } " did not reach its desired state.` }
4735 </ Text >
4836 < Text > </ Text >
4937 < Text bold backgroundColor = { 'red' } > Changes still needed:</ Text >
50- < Text > { prettyFormatResourcePlan ( resourcePlan ) } </ Text >
38+ < Text > { prettyFormatResourcePlan ( entry . plan ) } </ Text >
39+ { entry . logs . length > 0 && (
40+ < Box flexDirection = "column" marginTop = { 1 } >
41+ < Text bold > { `Last ${ entry . logs . length } log lines:` } </ Text >
42+ < Text > { entry . logs . join ( '\n' ) } </ Text >
43+ </ Box >
44+ ) }
5145 < Text > </ Text >
5246 </ Box >
5347 ) ) }
5448 < Text color = "red" bold > Potential fixes:</ Text >
55- < Text color = "red" bold > { ' 1. Re-run the command again' } </ Text >
56- < Text color = "red" bold > { ' 2. Manually install the resource and retry' } </ Text >
57- < Text color = "red" bold > { ' 3. Reach out to support at https://github.com/codifycli/default-plugin/issues' } </ Text >
49+ < Text color = "red" bold > { ' 1. Re-run with verbose logging (--verbose or press \'v\' during apply)' } </ Text >
50+ < Text color = "red" bold > { ' 2. Manually install the failed resource' } </ Text >
51+ < Text color = "red"
52+ bold > { ' 3. Reach out to support at https://github.com/codifycli/default-plugin/issues' } </ Text >
5853 </ Box >
5954 ) }
6055
@@ -64,6 +59,28 @@ export function ApplyComplete({ result }: { result: ApplyResult }) {
6459 </ Box >
6560 ) }
6661
62+
63+ { isPartial && < Box marginTop = { 1 } >
64+ < Text dimColor > { '─' . repeat ( 40 ) } </ Text >
65+ </ Box > }
66+
67+ < Box marginTop = { isPartial ? 0 : 1 } >
68+ < Text bold color = { isPartial ? 'red' : 'green' } >
69+ { isPartial ? '⚠ Apply completed with errors' : '🎉 Finished applying 🎉' }
70+ </ Text >
71+ </ Box >
72+
73+ { result . entries . length > 0 && (
74+ < Box flexDirection = "column" >
75+ { result . entries . map ( ( entry ) => (
76+ < Box key = { entry . id } >
77+ < Text > { entry . id . padEnd ( 30 ) } </ Text >
78+ < Text color = { applyEntryInkColor ( entry ) } > { applyEntryLabel ( entry ) } </ Text >
79+ </ Box >
80+ ) ) }
81+ </ Box >
82+ ) }
83+
6784 { ! isPartial && (
6885 < Box marginTop = { 1 } >
6986 < Text dimColor > Open a new terminal or source '.zshrc' for the new changes to be reflected</ Text >
0 commit comments