From 7f33e271c3bf8f460944953633f6da28cbcea376 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 13 May 2023 12:42:53 -0400 Subject: [PATCH] Adds Open Repo on Remote button to Graph --- images/icons/provider-azdo.svg | 1 + images/icons/provider-bitbucket.svg | 1 + images/icons/provider-gerrit.svg | 1 + images/icons/provider-gitea.svg | 1 + images/icons/provider-github.svg | 1 + images/icons/provider-gitlab.svg | 1 + images/icons/template/mapping.json | 8 ++++- package.json | 42 ++++++++++++++++++++++ src/plus/webviews/graph/graphWebview.ts | 6 +++- src/plus/webviews/graph/protocol.ts | 6 +++- src/webviews/apps/commitDetails/commitDetails.html | 2 +- src/webviews/apps/plus/focus/focus.html | 2 +- src/webviews/apps/plus/graph/GraphWrapper.tsx | 22 +++++++++++- src/webviews/apps/plus/graph/graph.html | 2 +- src/webviews/apps/plus/graph/graph.scss | 10 ++---- src/webviews/apps/plus/timeline/timeline.html | 2 +- src/webviews/apps/shared/glicons.scss | 20 ++++++++++- 17 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 images/icons/provider-azdo.svg create mode 100644 images/icons/provider-bitbucket.svg create mode 100644 images/icons/provider-gerrit.svg create mode 100644 images/icons/provider-gitea.svg create mode 100644 images/icons/provider-github.svg create mode 100644 images/icons/provider-gitlab.svg diff --git a/images/icons/provider-azdo.svg b/images/icons/provider-azdo.svg new file mode 100644 index 0000000..b21bb70 --- /dev/null +++ b/images/icons/provider-azdo.svg @@ -0,0 +1 @@ + diff --git a/images/icons/provider-bitbucket.svg b/images/icons/provider-bitbucket.svg new file mode 100644 index 0000000..54ddd78 --- /dev/null +++ b/images/icons/provider-bitbucket.svg @@ -0,0 +1 @@ + diff --git a/images/icons/provider-gerrit.svg b/images/icons/provider-gerrit.svg new file mode 100644 index 0000000..73c6397 --- /dev/null +++ b/images/icons/provider-gerrit.svg @@ -0,0 +1 @@ + diff --git a/images/icons/provider-gitea.svg b/images/icons/provider-gitea.svg new file mode 100644 index 0000000..4e8b522 --- /dev/null +++ b/images/icons/provider-gitea.svg @@ -0,0 +1 @@ + diff --git a/images/icons/provider-github.svg b/images/icons/provider-github.svg new file mode 100644 index 0000000..d146e13 --- /dev/null +++ b/images/icons/provider-github.svg @@ -0,0 +1 @@ + diff --git a/images/icons/provider-gitlab.svg b/images/icons/provider-gitlab.svg new file mode 100644 index 0000000..66f94a0 --- /dev/null +++ b/images/icons/provider-gitlab.svg @@ -0,0 +1 @@ + diff --git a/images/icons/template/mapping.json b/images/icons/template/mapping.json index b74f5a8..b98a7bf 100644 --- a/images/icons/template/mapping.json +++ b/images/icons/template/mapping.json @@ -29,5 +29,11 @@ "list-auto": 61722, "arrow-up-force": 61723, "pinned-filled": 61724, - "clock": 61725 + "clock": 61725, + "provider-azdo": 61726, + "provider-bitbucket": 61727, + "provider-gerrit": 61728, + "provider-gitea": 61729, + "provider-github": 61730, + "provider-gitlab": 61731 } \ No newline at end of file diff --git a/package.json b/package.json index 70f486b..a46476a 100644 --- a/package.json +++ b/package.json @@ -7508,6 +7508,48 @@ "fontPath": "dist/glicons.woff2", "fontCharacter": "\\f11d" } + }, + "gitlens-provider-azdo": { + "description": "provider-azdo icon", + "default": { + "fontPath": "dist/glicons.woff2", + "fontCharacter": "\\f11e" + } + }, + "gitlens-provider-bitbucket": { + "description": "provider-bitbucket icon", + "default": { + "fontPath": "dist/glicons.woff2", + "fontCharacter": "\\f11f" + } + }, + "gitlens-provider-gerrit": { + "description": "provider-gerrit icon", + "default": { + "fontPath": "dist/glicons.woff2", + "fontCharacter": "\\f120" + } + }, + "gitlens-provider-gitea": { + "description": "provider-gitea icon", + "default": { + "fontPath": "dist/glicons.woff2", + "fontCharacter": "\\f121" + } + }, + "gitlens-provider-github": { + "description": "provider-github icon", + "default": { + "fontPath": "dist/glicons.woff2", + "fontCharacter": "\\f122" + } + }, + "gitlens-provider-gitlab": { + "description": "provider-gitlab icon", + "default": { + "fontPath": "dist/glicons.woff2", + "fontCharacter": "\\f123" + } } }, "menus": { diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index a46e987..25a3080 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -1792,7 +1792,11 @@ export class GraphWebviewProvider implements WebviewProvider { const remote = await branch.getRemote(); if (remote?.provider != null) { - branchState.provider = remote.provider.name; + branchState.provider = { + name: remote.provider.name, + icon: remote.provider.icon === 'remote' ? 'cloud' : remote.provider.icon, + url: remote.provider.url({ type: RemoteResourceType.Repo }), + }; } } } diff --git a/src/plus/webviews/graph/protocol.ts b/src/plus/webviews/graph/protocol.ts index 9a17289..ee75e52 100644 --- a/src/plus/webviews/graph/protocol.ts +++ b/src/plus/webviews/graph/protocol.ts @@ -124,7 +124,11 @@ export interface State { export interface BranchState extends GitTrackingState { upstream?: string; - provider?: string; + provider?: { + name: string; + icon?: string; + url?: string; + }; } export type GraphWorkingTreeStats = WorkDirStats; diff --git a/src/webviews/apps/commitDetails/commitDetails.html b/src/webviews/apps/commitDetails/commitDetails.html index 1810c16..2966403 100644 --- a/src/webviews/apps/commitDetails/commitDetails.html +++ b/src/webviews/apps/commitDetails/commitDetails.html @@ -258,7 +258,7 @@ @font-face { font-family: 'glicons'; font-display: block; - src: url('#{root}/dist/glicons.woff2?bee7d3595dedb7062d58fb94d382c713') format('woff2'); + src: url('#{root}/dist/glicons.woff2?33c8fcd4948539e9758d0430426d7bdc') format('woff2'); } diff --git a/src/webviews/apps/plus/focus/focus.html b/src/webviews/apps/plus/focus/focus.html index 1e2aacf..4f4e184 100644 --- a/src/webviews/apps/plus/focus/focus.html +++ b/src/webviews/apps/plus/focus/focus.html @@ -193,7 +193,7 @@ @font-face { font-family: 'glicons'; font-display: block; - src: url('#{root}/dist/glicons.woff2?bee7d3595dedb7062d58fb94d382c713') format('woff2'); + src: url('#{root}/dist/glicons.woff2?33c8fcd4948539e9758d0430426d7bdc') format('woff2'); } diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 42de61d..712ae2f 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -1115,7 +1115,7 @@ export function GraphWrapper({ isBehind = branchState.behind > 0; isAhead = branchState.ahead > 0; const branchPrefix = `Branch ${branchName} is`; - remote = `${branchState.upstream}${branchState.provider ? ` on ${branchState.provider}` : ''}`; + remote = `${branchState.upstream}${branchState.provider?.name ? ` on ${branchState.provider?.name}` : ''}`; if (isBehind) { action = 'command:gitlens.graph.pull'; icon = 'arrow-down'; @@ -1179,11 +1179,30 @@ export function GraphWrapper({ {renderAlertContent()}
+ {repo && branchState?.provider?.url && ( + + + + )}