Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git sync info #13354

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
color: white;
font-size: 12px;
padding: 0 10px;
overflow: hidden;
}

.monaco-workbench.no-workspace > .part.statusbar {
Expand Down
13 changes: 10 additions & 3 deletions src/vs/workbench/parts/git/browser/gitWidgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/

import nls = require('vs/nls');
import strings = require('vs/base/common/strings');
import { Delayer } from 'vs/base/common/async';
import { $, append, show, hide, toggleClass } from 'vs/base/browser/dom';
import { IAction } from 'vs/base/common/actions';
Expand Down Expand Up @@ -39,6 +38,7 @@ export class GitStatusbarItem implements IStatusbarItem {
private branchElement: HTMLElement;
private publishElement: HTMLElement;
private syncElement: HTMLElement;
private syncInfo: HTMLElement;
private syncLabelElement: HTMLElement;
private disablementDelayer: Delayer<void>;

Expand Down Expand Up @@ -86,11 +86,15 @@ export class GitStatusbarItem implements IStatusbarItem {
this.publishElement.title = nls.localize('publishBranch', "Publish Branch");
this.publishElement.onclick = () => this.onPublishClick();

this.syncElement = append(this.element, $('a.git-statusbar-sync-item'));
const syncContainer = append(this.element, $('span.git-statusbar-sync'));

this.syncElement = append(syncContainer, $('a.git-statusbar-sync-item'));
this.syncElement.title = nls.localize('syncBranch', "Synchronize Changes");
this.syncElement.onclick = () => this.onSyncClick();
append(this.syncElement, $('span.octicon.octicon-sync'));

this.syncInfo = append(syncContainer, $('.git-statusbar-sync-info'));

this.syncLabelElement = append(this.syncElement, $('span.ahead-behind'));

this.setState(this.state);
Expand Down Expand Up @@ -118,6 +122,7 @@ export class GitStatusbarItem implements IStatusbarItem {
let className = 'git-statusbar-branch-item';
let textContent: string;
let aheadBehindLabel = '';
let aheadBehindInfoLabel = '';
let title = '';
let onclick: () => void = null;

Expand All @@ -144,7 +149,8 @@ export class GitStatusbarItem implements IStatusbarItem {
textContent = state.ps1;
} else {
textContent = state.ps1;
aheadBehindLabel = strings.format('{0}↓ {1}↑', HEAD.behind, HEAD.ahead);
aheadBehindLabel = `${ HEAD.behind }↓ ${ HEAD.ahead }↑`;
aheadBehindInfoLabel = nls.localize('commits', "Push {0} commits and pull {1} commits", HEAD.ahead, HEAD.behind);
}
}

Expand All @@ -153,6 +159,7 @@ export class GitStatusbarItem implements IStatusbarItem {
this.branchElement.textContent = textContent;
this.branchElement.onclick = onclick;
this.syncLabelElement.textContent = aheadBehindLabel;
this.syncInfo.textContent = aheadBehindInfoLabel;

if (isGitDisabled) {
hide(this.branchElement);
Expand Down
40 changes: 35 additions & 5 deletions src/vs/workbench/parts/git/browser/media/git.contribution.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

/* Status bar */

.monaco-shell .git-statusbar-group > a {
.monaco-shell .git-statusbar-group a {
padding: 0 5px;
}

Expand All @@ -140,7 +140,13 @@
font-size: 14px;
}

.monaco-shell .git-statusbar-group > .git-statusbar-sync-item:not(.empty) > span.octicon {
.monaco-shell .git-statusbar-group > .git-statusbar-sync {
position: relative;
height: 100%;
display: inline-block;
}

.monaco-shell .git-statusbar-group > .git-statusbar-sync > .git-statusbar-sync-item:not(.empty) > span.octicon {
margin-right: 6px;
}

Expand All @@ -149,12 +155,12 @@
to { transform: rotate(1080deg); }
}

.monaco-shell .git-statusbar-group > .git-statusbar-sync-item.syncing > .octicon {
.monaco-shell .git-statusbar-group > .git-statusbar-sync > .git-statusbar-sync-item.syncing > .octicon {
animation: 2s ease-in-out infinite spin;
}

.monaco-shell .git-statusbar-group > .git-statusbar-sync-item.disabled > .ahead-behind,
.monaco-shell .git-statusbar-group > .git-statusbar-sync-item.busy > .ahead-behind {
.monaco-shell .git-statusbar-group > .git-statusbar-sync > .git-statusbar-sync-item.disabled > .ahead-behind,
.monaco-shell .git-statusbar-group > .git-statusbar-sync > .git-statusbar-sync-item.busy > .ahead-behind {
cursor: default;
}

Expand All @@ -178,4 +184,28 @@

.monaco-shell .git-statusbar-group > .git-statusbar-branch-item.headless {
font-style: italic;
}

.monaco-shell .git-statusbar-group > .git-statusbar-sync > .git-statusbar-sync-info {
display: none;
position: absolute;
bottom: 22px;
left: 0;
color: #6C6C6C;
border: 1px solid #CCC;
border-bottom: none;
background-color: #F3F3F3;
padding: 4px 6px 3px 6px;
width: 120px;
}

.monaco-shell .git-statusbar-group > .git-statusbar-sync:hover > .git-statusbar-sync-info:not(:empty) {
display: block;
}


.vs-dark .monaco-workbench .git-statusbar-group > .git-statusbar-sync > .git-statusbar-sync-info {
color: #bbbbbb;
background-color: #2D2D30;
border-color: #555;
}