- Notifications
You must be signed in to change notification settings - Fork909
Commitcc89820
feat: add template export functionality to UI (#18214)
## SummaryThis PR adds template export functionality to the Coder UI, addressingissue#17859. Users can now export templates directly from the webinterface without requiring CLI access.## Changes### Frontend API- Added `downloadTemplateVersion` function to `site/src/api/api.ts`- Supports both TAR (default) and ZIP formats- Uses existing `/api/v2/files/{fileId}` endpoint with format parameter### UI Enhancement- Added "Export as TAR" and "Export as ZIP" options to template dropdownmenu- Positioned logically between "Duplicate" and "Delete" actions- Uses download icon from Lucide React for consistency### User Experience- Files automatically named as`{templateName}-{templateVersion}.{extension}`- Immediate download trigger on click- Proper error handling with console logging- Clean blob URL management to prevent memory leaks## TestingThe implementation has been tested for:- ✅ TypeScript compilation- ✅ Proper function signatures and types- ✅ UI component integration- ✅ Error handling structure## ScreenshotsThe export options appear in the template dropdown menu:- Export as TAR (default format, compatible with `coder template pull`)- Export as ZIP (compressed format for easier handling)## FixesCloses#17859## NotesThis enhancement makes template management more accessible for userswho:- Don't have CLI access- Manage deployments on devices without Coder CLI- Prefer web-based workflows- Need to transfer templates between environmentsThe implementation follows existing patterns in the codebase andmaintains consistency with the current UI design.---------Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>Co-authored-by: Kyle Carberry <kyle@coder.com>1 parent7b273b0 commitcc89820
2 files changed
+58
-1
lines changedLines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1084 | 1084 |
| |
1085 | 1085 |
| |
1086 | 1086 |
| |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1087 | 1112 |
| |
1088 | 1113 |
| |
1089 | 1114 |
| |
|
Lines changed: 33 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
| 3 | + | |
3 | 4 |
| |
4 | 5 |
| |
5 | 6 |
| |
| |||
26 | 27 |
| |
27 | 28 |
| |
28 | 29 |
| |
29 |
| - | |
| 30 | + | |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
| |||
46 | 47 |
| |
47 | 48 |
| |
48 | 49 |
| |
| 50 | + | |
49 | 51 |
| |
50 | 52 |
| |
51 | 53 |
| |
| |||
54 | 56 |
| |
55 | 57 |
| |
56 | 58 |
| |
| 59 | + | |
57 | 60 |
| |
58 | 61 |
| |
59 | 62 |
| |
| |||
68 | 71 |
| |
69 | 72 |
| |
70 | 73 |
| |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
71 | 92 |
| |
72 | 93 |
| |
73 | 94 |
| |
| |||
102 | 123 |
| |
103 | 124 |
| |
104 | 125 |
| |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
105 | 136 |
| |
106 | 137 |
| |
107 | 138 |
| |
| |||
206 | 237 |
| |
207 | 238 |
| |
208 | 239 |
| |
| 240 | + | |
209 | 241 |
| |
210 | 242 |
| |
211 | 243 |
| |
|
0 commit comments
Comments
(0)