Skip to content

Commit

Permalink
Updates fetch action for home active section
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Nov 20, 2024
1 parent e731faa commit 352262d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/webviews/apps/plus/home/components/active-work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
} satisfies OpenInGraphParams)}
><code-icon icon="gl-graph"></code-icon
></gl-button>
<gl-button
aria-busy="${ifDefined(isFetching)}"
?disabled=${isFetching}
class="section-heading-action"
appearance="toolbar"
tooltip="Fetch"
href=${createCommandLink('gitlens.home.fetch', undefined)}
><code-icon icon="gl-repo-fetch"></code-icon
></gl-button>
${when(
this._homeState.repositories.openCount > 1,
() =>
Expand Down Expand Up @@ -229,15 +238,6 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
);
}

// branch actions
actions.push(
html`<action-item
label="Fetch"
icon="gl-repo-fetch"
href=${createCommandLink('gitlens.home.fetch', branchRefs)}
></action-item>`,
);

if (!actions.length) {
return nothing;
}
Expand Down
8 changes: 7 additions & 1 deletion src/webviews/home/homeWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,13 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
void RepoActions.switchTo(repo!.repo, getReferenceFromBranch(branch));
}

private fetch(refs: BranchRef) {
private fetch(refs?: BranchRef) {
if (refs == null) {
const repo = this.getSelectedRepository();
void RepoActions.fetch(repo);
return;
}

const repo = this._repositoryBranches.get(refs.repoPath);
const branch = repo?.branches.find(b => b.id === refs.branchId);
if (branch == null) return;
Expand Down

0 comments on commit 352262d

Please sign in to comment.