From 02e080167ef49a87dd88e7c8c804f6857cda1462 Mon Sep 17 00:00:00 2001 From: Eric Amodio <eamodio@gmail.com> Date: Thu, 1 Mar 2018 23:26:15 -0500 Subject: [PATCH] Adds remote-specific icons to view --- CHANGELOG.md | 1 + images/dark/icon-bitbucket.svg | 11 +++++++++++ images/dark/icon-github.svg | 3 +++ images/dark/icon-gitlab.svg | 10 ++++++++++ images/light/icon-bitbucket.svg | 11 +++++++++++ images/light/icon-github.svg | 3 +++ images/light/icon-gitlab.svg | 10 ++++++++++ src/git/remotes/bitbucket-server.ts | 4 ++++ src/git/remotes/bitbucket.ts | 4 ++++ src/git/remotes/github.ts | 4 ++++ src/git/remotes/provider.ts | 4 ++++ src/views/remoteNode.ts | 17 +++++++++++++---- 12 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 images/dark/icon-bitbucket.svg create mode 100644 images/dark/icon-github.svg create mode 100644 images/dark/icon-gitlab.svg create mode 100644 images/light/icon-bitbucket.svg create mode 100644 images/light/icon-github.svg create mode 100644 images/light/icon-gitlab.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 803da69..c30a108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p  +- Adds icons to remotes in the *GitLens* view based on the remote service provider - Adds multi-cursor support to current line annotations — closes [#291](https://github.com/eamodio/vscode-gitlens/issues/291) - Adds support to toggle annotations for each file individually or for all files at once — closes [#289](https://github.com/eamodio/vscode-gitlens/issues/289) - Adds new controls the interactive settings editor (*Open Settings* from the Command Palette) to configure this new behavior diff --git a/images/dark/icon-bitbucket.svg b/images/dark/icon-bitbucket.svg new file mode 100644 index 0000000..b9181a2 --- /dev/null +++ b/images/dark/icon-bitbucket.svg @@ -0,0 +1,11 @@ +<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg"> + <defs> + <linearGradient id="a" x2="0" y2="1"> + <stop offset="0%" stop-color="#424242" stop-opacity=".7"/> + <stop offset="50%" stop-color="#424242" stop-opacity="0"/> + <stop offset="100%" stop-color="#424242" stop-opacity="0"/> + </linearGradient> + </defs> + <path fill="#C5C5C5" d="M1.41 4.66a.45.45 0 0 0-.45.53l1.92 11.63a.61.61 0 0 0 .6.51h9.2a.45.45 0 0 0 .44-.38L15.04 5.2a.45.45 0 0 0-.45-.53H1.41zm8.07 8.41H6.55l-.8-4.15h4.44l-.7 4.15z"/> + <path fill="url(#a)" d="M14.43 8.92h-4.24l-.7 4.15H6.54L3.08 17.2a.61.61 0 0 0 .4.15h9.2a.45.45 0 0 0 .44-.38l1.3-8.04z"/> +</svg> \ No newline at end of file diff --git a/images/dark/icon-github.svg b/images/dark/icon-github.svg new file mode 100644 index 0000000..10a49fc --- /dev/null +++ b/images/dark/icon-github.svg @@ -0,0 +1,3 @@ +<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg"> + <path fill="#C5C5C5" d="M8 4.234a6.936 6.936 0 0 0-6.938 6.937 6.933 6.933 0 0 0 4.744 6.582c.347.06.477-.147.477-.33 0-.164-.009-.71-.009-1.292-1.743.321-2.194-.424-2.332-.815-.078-.2-.417-.815-.712-.98-.242-.13-.59-.45-.008-.46.546-.008.936.504 1.066.712.625 1.05 1.622.754 2.021.572.06-.45.243-.754.442-.928-1.543-.173-3.156-.771-3.156-3.425a2.7 2.7 0 0 1 .71-1.865c-.069-.173-.311-.884.07-1.838 0 0 .581-.182 1.908.711a6.438 6.438 0 0 1 1.734-.234c.59 0 1.18.078 1.735.234 1.327-.902 1.908-.711 1.908-.711.381.954.138 1.665.069 1.838.442.486.711 1.102.711 1.865 0 2.662-1.622 3.252-3.165 3.425.251.217.468.633.468 1.284 0 .928-.009 1.673-.009 1.908 0 .182.13.398.477.33a6.949 6.949 0 0 0 4.727-6.583A6.936 6.936 0 0 0 8 4.234z"/> +</svg> \ No newline at end of file diff --git a/images/dark/icon-gitlab.svg b/images/dark/icon-gitlab.svg new file mode 100644 index 0000000..112278c --- /dev/null +++ b/images/dark/icon-gitlab.svg @@ -0,0 +1,10 @@ +<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg"> + <path fill="#636363" d="M15.12 11.98l-.8-2.57-1.59-5.1a.27.28 0 0 0-.52 0l-1.58 5.1H5.36l-1.59-5.1a.27.28 0 0 0-.51 0l-1.59 5.1-.8 2.57a.55.57 0 0 0 .2.64L8 17.87l6.93-5.25a.55.57 0 0 0 .2-.64"/> + <path fill="#C5C5C5" d="M8 17.87l2.63-8.46H5.36L8 17.87z"/> + <path fill="#9E9E9E" d="M8 17.87L5.35 9.41H1.67L8 17.87z"/> + <path fill="#636363" d="M1.67 9.41l-.8 2.57a.54.57 0 0 0 .2.64L8 17.87 1.67 9.41z"/> + <path fill="#C5C5C5" d="M1.67 9.41h3.7l-1.6-5.1a.27.28 0 0 0-.51 0l-1.59 5.1z"/> + <path fill="#9E9E9E" d="M8 17.87l2.63-8.46h3.69l-6.33 8.46z"/> + <path fill="#636363" d="M14.32 9.41l.8 2.57a.54.57 0 0 1-.2.64l-6.93 5.25 6.33-8.46z"/> + <path fill="#C5C5C5" d="M14.32 9.41h-3.7l1.6-5.1a.27.28 0 0 1 .51 0l1.59 5.1z"/> +</svg> \ No newline at end of file diff --git a/images/light/icon-bitbucket.svg b/images/light/icon-bitbucket.svg new file mode 100644 index 0000000..03062f3 --- /dev/null +++ b/images/light/icon-bitbucket.svg @@ -0,0 +1,11 @@ +<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg"> + <defs> + <linearGradient id="a" x2="0" y2="1"> + <stop offset="0%" stop-color="#C5C5C5" stop-opacity=".7"/> + <stop offset="50%" stop-color="#C5C5C5" stop-opacity="0"/> + <stop offset="100%" stop-color="#C5C5C5" stop-opacity="0"/> + </linearGradient> + </defs> + <path fill="#424242" d="M1.41 4.66a.45.45 0 0 0-.45.53l1.92 11.63a.61.61 0 0 0 .6.51h9.2a.45.45 0 0 0 .44-.38L15.04 5.2a.45.45 0 0 0-.45-.53H1.41zm8.07 8.41H6.55l-.8-4.15h4.44l-.7 4.15z"/> + <path fill="url(#a)" d="M14.43 8.92h-4.24l-.7 4.15H6.54L3.08 17.2a.61.61 0 0 0 .4.15h9.2a.45.45 0 0 0 .44-.38l1.3-8.04z"/> +</svg> \ No newline at end of file diff --git a/images/light/icon-github.svg b/images/light/icon-github.svg new file mode 100644 index 0000000..8be8bf9 --- /dev/null +++ b/images/light/icon-github.svg @@ -0,0 +1,3 @@ +<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg"> + <path fill="#424242" d="M8 4.234a6.936 6.936 0 0 0-6.938 6.937 6.933 6.933 0 0 0 4.744 6.582c.347.06.477-.147.477-.33 0-.164-.009-.71-.009-1.292-1.743.321-2.194-.424-2.332-.815-.078-.2-.417-.815-.712-.98-.242-.13-.59-.45-.008-.46.546-.008.936.504 1.066.712.625 1.05 1.622.754 2.021.572.06-.45.243-.754.442-.928-1.543-.173-3.156-.771-3.156-3.425a2.7 2.7 0 0 1 .71-1.865c-.069-.173-.311-.884.07-1.838 0 0 .581-.182 1.908.711a6.438 6.438 0 0 1 1.734-.234c.59 0 1.18.078 1.735.234 1.327-.902 1.908-.711 1.908-.711.381.954.138 1.665.069 1.838.442.486.711 1.102.711 1.865 0 2.662-1.622 3.252-3.165 3.425.251.217.468.633.468 1.284 0 .928-.009 1.673-.009 1.908 0 .182.13.398.477.33a6.949 6.949 0 0 0 4.727-6.583A6.936 6.936 0 0 0 8 4.234z"/> +</svg> \ No newline at end of file diff --git a/images/light/icon-gitlab.svg b/images/light/icon-gitlab.svg new file mode 100644 index 0000000..72e6795 --- /dev/null +++ b/images/light/icon-gitlab.svg @@ -0,0 +1,10 @@ +<svg width="16" height="22" xmlns="http://www.w3.org/2000/svg"> + <path fill="#A3A3A3" d="M15.12 11.98l-.8-2.57-1.59-5.1a.27.28 0 0 0-.52 0l-1.58 5.1H5.36l-1.59-5.1a.27.28 0 0 0-.51 0l-1.59 5.1-.8 2.57a.55.57 0 0 0 .2.64L8 17.87l6.93-5.25a.55.57 0 0 0 .2-.64"/> + <path fill="#424242" d="M8 17.87l2.63-8.46H5.36L8 17.87z"/> + <path fill="#696969" d="M8 17.87L5.35 9.41H1.67L8 17.87z"/> + <path fill="#A3A3A3" d="M1.67 9.41l-.8 2.57a.54.57 0 0 0 .2.64L8 17.87 1.67 9.41z"/> + <path fill="#424242" d="M1.67 9.41h3.7l-1.6-5.1a.27.28 0 0 0-.51 0l-1.59 5.1z"/> + <path fill="#696969" d="M8 17.87l2.63-8.46h3.69l-6.33 8.46z"/> + <path fill="#A3A3A3" d="M14.32 9.41l.8 2.57a.54.57 0 0 1-.2.64l-6.93 5.25 6.33-8.46z"/> + <path fill="#424242" d="M14.32 9.41h-3.7l1.6-5.1a.27.28 0 0 1 .51 0l1.59 5.1z"/> +</svg> \ No newline at end of file diff --git a/src/git/remotes/bitbucket-server.ts b/src/git/remotes/bitbucket-server.ts index e18871b..b05031a 100644 --- a/src/git/remotes/bitbucket-server.ts +++ b/src/git/remotes/bitbucket-server.ts @@ -22,6 +22,10 @@ export class BitbucketServerService extends RemoteProvider { return `https://${this.domain}/projects/${project}/repos/${repo}`; } + get icon() { + return 'bitbucket'; + } + get name() { return this.formatName('Bitbucket Server'); } diff --git a/src/git/remotes/bitbucket.ts b/src/git/remotes/bitbucket.ts index 21e543b..c998524 100644 --- a/src/git/remotes/bitbucket.ts +++ b/src/git/remotes/bitbucket.ts @@ -17,6 +17,10 @@ export class BitbucketService extends RemoteProvider { super(domain, path, protocol, name, custom); } + get icon() { + return 'bitbucket'; + } + get name() { return this.formatName('Bitbucket'); } diff --git a/src/git/remotes/github.ts b/src/git/remotes/github.ts index 23becee..24038e8 100644 --- a/src/git/remotes/github.ts +++ b/src/git/remotes/github.ts @@ -17,6 +17,10 @@ export class GitHubService extends RemoteProvider { super(domain, path, protocol, name, custom); } + get icon() { + return 'github'; + } + get name() { return this.formatName('GitHub'); } diff --git a/src/git/remotes/provider.ts b/src/git/remotes/provider.ts index e8830ce..e90cc78 100644 --- a/src/git/remotes/provider.ts +++ b/src/git/remotes/provider.ts @@ -46,6 +46,10 @@ export abstract class RemoteProvider { this._name = name; } + get icon(): string { + return 'remote'; + } + abstract get name(): string; protected get baseUrl() { diff --git a/src/views/remoteNode.ts b/src/views/remoteNode.ts index 13529ed..b51a13c 100644 --- a/src/views/remoteNode.ts +++ b/src/views/remoteNode.ts @@ -8,6 +8,7 @@ import { GlyphChars } from '../constants'; import { ExplorerNode, ResourceType } from './explorerNode'; import { GitExplorer } from './gitExplorer'; import { GitRemote, GitRemoteType, GitUri, Repository } from '../gitService'; +import { Container } from '../container'; export class RemoteNode extends ExplorerNode { @@ -66,10 +67,18 @@ export class RemoteNode extends ExplorerNode { const item = new TreeItem(label, TreeItemCollapsibleState.Collapsed); item.contextValue = ResourceType.Remote; - // item.iconPath = { - // dark: this.context.asAbsolutePath('images/dark/icon-remote.svg'), - // light: this.context.asAbsolutePath('images/light/icon-remote.svg') - // }; + if (this.remote.provider !== undefined) { + item.iconPath = { + dark: Container.context.asAbsolutePath(`images/dark/icon-${this.remote.provider.icon}.svg`), + light: Container.context.asAbsolutePath(`images/light/icon-${this.remote.provider.icon}.svg`) + }; + } + else { + item.iconPath = { + dark: Container.context.asAbsolutePath('images/dark/icon-remote.svg'), + light: Container.context.asAbsolutePath('images/light/icon-remote.svg') + }; + } return item; }