Skip to content

Commit

Permalink
Apply the "Fetch" button state when the remotes of the repository cha…
Browse files Browse the repository at this point in the history
…nge, instead of during the normal view render process.
  • Loading branch information
mhutchie committed Nov 17, 2019
1 parent 7203d7e commit 3aa31b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class GitGraphView {
this.showRemoteBranchesElem.checked = this.gitRepos[this.currentRepo].showRemoteBranches;
this.maxCommits = this.config.initialLoadCommits;
this.gitRemotes = [];
alterClass(this.controlsElem, CLASS_FETCH_SUPPORTED, false);
this.renderFetchButton();
this.closeCommitDetails(false);
this.settingsWidget.close();
this.currentBranches = null;
Expand All @@ -171,6 +171,9 @@ class GitGraphView {
this.gitBranchHead = branchHead;
this.gitRemotes = remotes;

// Update the state of the fetch button
this.renderFetchButton();

// Configure current branches

let globPatterns = [];
Expand Down Expand Up @@ -470,7 +473,6 @@ class GitGraphView {
/* Renderers */

private render() {
alterClass(this.controlsElem, CLASS_FETCH_SUPPORTED, this.gitRemotes.length > 0);
this.renderTable();
this.renderGraph();
}
Expand Down Expand Up @@ -687,6 +689,10 @@ class GitGraphView {
this.findWidget.update([]);
}

private renderFetchButton() {
alterClass(this.controlsElem, CLASS_FETCH_SUPPORTED, this.gitRemotes.length > 0);
}

public renderRefreshButton(enabled: boolean) {
this.refreshBtnElem.title = enabled ? 'Refresh' : 'Refreshing';
this.refreshBtnElem.innerHTML = enabled ? SVG_ICONS.refresh : SVG_ICONS.loading;
Expand Down

0 comments on commit 3aa31b0

Please sign in to comment.