@@ -12,6 +12,8 @@ import {
1212} from "./actions-shared.js"
1313import { loadSelectedProjectTasks } from "./actions-tasks.js"
1414import {
15+ applyAllProjects ,
16+ applyProject ,
1517 createProjectTerminalSession ,
1618 deleteProject ,
1719 downAllProjects ,
@@ -104,6 +106,31 @@ export const connectProjectById = (
104106 } )
105107}
106108
109+ export const applyProjectById = (
110+ projectId : string ,
111+ context : BrowserActionContext
112+ ) => {
113+ context . setSelectedProjectId ( projectId )
114+ withBusy ( {
115+ context,
116+ effect : applyProject ( projectId ) ,
117+ label : "Applying project" ,
118+ onSuccess : ( project ) => {
119+ context . reloadDashboard ( )
120+ context . setSelectedProject ( project )
121+ context . setMessage ( `Applied ${ project . displayName } .` )
122+ }
123+ } )
124+ }
125+
126+ export const applySelectedProject = ( context : BrowserActionContext ) => {
127+ const projectId = requireSelectedProjectId ( context )
128+ if ( projectId === null ) {
129+ return
130+ }
131+ applyProjectById ( projectId , context )
132+ }
133+
107134const runProjectOutputAction = (
108135 context : BrowserActionContext ,
109136 effect : ( projectId : string ) => ReturnType < typeof loadProjectPs > ,
@@ -177,6 +204,21 @@ const runDownAllProjects = (context: BrowserActionContext) => {
177204 } )
178205}
179206
207+ export const runApplyAllProjects = ( context : BrowserActionContext ) => {
208+ if ( ! confirmAction ( "Apply docker-git config to all projects?" ) ) {
209+ return
210+ }
211+ withBusy ( {
212+ context,
213+ effect : applyAllProjects ( false ) ,
214+ label : "Applying all projects" ,
215+ onSuccess : ( ) => {
216+ context . reloadDashboard ( )
217+ context . setMessage ( "Applied docker-git config to all projects." )
218+ }
219+ } )
220+ }
221+
180222export const runProjectMenuAction = (
181223 currentMenu : Exclude < BrowserMenuTag , "Auth" | "ProjectAuth" > ,
182224 context : BrowserActionContext
0 commit comments