@@ -2,6 +2,7 @@ import { consume } from '@lit/context';
22import { SignalWatcher } from '@lit-labs/signals' ;
33import { css , html , LitElement , nothing } from 'lit' ;
44import { customElement , state } from 'lit/decorators.js' ;
5+ import { ifDefined } from 'lit/directives/if-defined.js' ;
56import { when } from 'lit/directives/when.js' ;
67import type { GitTrackingState } from '../../../../../git/models/branch' ;
78import { createWebviewCommandLink } from '../../../../../system/webview' ;
@@ -79,10 +80,10 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
7980 < skeleton-loader lines ="3 "> </ skeleton-loader >
8081 ` ;
8182 }
82- return this . renderComplete ( this . _overviewState . state ) ;
83+ return this . renderComplete ( this . _overviewState . state , true ) ;
8384 }
8485
85- private renderComplete ( overview : Overview ) {
86+ private renderComplete ( overview : Overview , isFetching = false ) {
8687 const repo = overview ?. repository ;
8788 const activeBranches = repo ?. branches ?. active ;
8889 if ( ! activeBranches ) return html `< span > None</ span > ` ;
@@ -95,6 +96,8 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
9596 ( ) =>
9697 html `< span
9798 > < gl-button
99+ aria-busy ="${ isFetching } "
100+ ?disabled =${ isFetching }
98101 class ="section-heading-action"
99102 appearance="toolbar"
100103 tooltip="Change Repository"
@@ -103,11 +106,11 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
103106 > </ span > ` ,
104107 ) }
105108 </ h3 >
106- ${ activeBranches . map ( branch => this . renderRepoBranchCard ( branch , repo . path ) ) }
109+ ${ activeBranches . map ( branch => this . renderRepoBranchCard ( branch , repo . path , isFetching ) ) }
107110 ` ;
108111 }
109112
110- private renderRepoBranchCard ( branch : GetOverviewBranch , repo : string ) {
113+ private renderRepoBranchCard ( branch : GetOverviewBranch , repo : string , isFetching : boolean ) {
111114 const { name, pr, state, workingTreeState, upstream } = branch ;
112115 return html `
113116 < gl-card class ="branch-item " active >
@@ -117,7 +120,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
117120 </ span >
118121 < span class ="branch-item__name "> ${ name } </ span >
119122 </ p >
120- ${ when ( state , ( ) => this . renderBranchStateActions ( state , upstream ) ) }
123+ ${ when ( state , ( ) => this . renderBranchStateActions ( state , upstream , isFetching ) ) }
121124 ${ when ( pr , pr => {
122125 return html ` < p class ="branch-item__main is-end ">
123126 < span class ="branch-item__icon ">
@@ -179,14 +182,22 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
179182 return html `< action-nav class ="branch-item__actions "> ${ actions } </ action-nav > ` ;
180183 }
181184
182- private renderBranchStateActions ( state ?: GitTrackingState , upstream ?: { name : string ; missing : boolean } ) {
185+ private renderBranchStateActions (
186+ state ?: GitTrackingState ,
187+ upstream ?: { name : string ; missing : boolean } ,
188+ isFetching ?: boolean ,
189+ ) {
183190 if ( upstream ?. missing !== false ) {
191+ const publishTooltip = upstream ?. name ? `Publish branch to ${ upstream . name } ` : 'Publish branch' ;
184192 return html `< div >
185193 < button-container >
186194 < gl-button
195+ aria-busy =${ ifDefined ( isFetching ) }
196+ ?disabled =${ isFetching }
187197 href=${ createWebviewCommandLink ( 'gitlens.views.home.publishBranch' , 'gitlens.views.home' , '' ) }
188198 full
189199 appearance="secondary"
200+ tooltip="${ publishTooltip } "
190201 > < code-icon icon ="cloud-upload " slot ="prefix "> </ code-icon > Publish Branch</ gl-button
191202 > </ button-container
192203 >
@@ -201,6 +212,8 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
201212 return html `< div >
202213 < button-container >
203214 < gl-button
215+ aria-busy =${ ifDefined ( isFetching ) }
216+ ?disabled =${ isFetching }
204217 href=${ createWebviewCommandLink ( 'gitlens.views.home.pull' , 'gitlens.views.home' , '' ) }
205218 full
206219 appearance="secondary"
@@ -213,6 +226,8 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
213226 > </ gl-tracking-pill
214227 > </ gl-button >
215228 < gl-button
229+ aria-busy =${ ifDefined ( isFetching ) }
230+ ?disabled =${ isFetching }
216231 href=${ createWebviewCommandLink ( 'gitlens.views.home.push' , 'gitlens.views.home' , '' , {
217232 force : true ,
218233 } ) }
@@ -229,6 +244,8 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
229244 return html `< div >
230245 < button-container >
231246 < gl-button
247+ aria-busy =${ ifDefined ( isFetching ) }
248+ ?disabled =${ isFetching }
232249 href=${ createWebviewCommandLink ( 'gitlens.views.home.pull' , 'gitlens.views.home' , '' ) }
233250 full
234251 appearance="secondary"
@@ -247,6 +264,8 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
247264 return html `< div >
248265 < button-container >
249266 < gl-button
267+ aria-busy =${ ifDefined ( isFetching ) }
268+ ?disabled =${ isFetching }
250269 href=${ createWebviewCommandLink ( 'gitlens.views.home.push' , 'gitlens.views.home' , '' ) }
251270 full
252271 appearance="secondary"
0 commit comments