Browse Source

Button to show SCM for wip node in commit details

main
Ramin Tadayon 2 years ago
parent
commit
a2c5b02267
No known key found for this signature in database GPG Key ID: 5B90E918AEBCE7A7
4 changed files with 21 additions and 5 deletions
  1. +9
    -0
      src/webviews/apps/commitDetails/commitDetails.html
  2. +6
    -2
      src/webviews/apps/commitDetails/commitDetails.ts
  3. +5
    -2
      src/webviews/commitDetails/commitDetailsWebviewView.ts
  4. +1
    -1
      src/webviews/commitDetails/protocol.ts

+ 9
- 0
src/webviews/apps/commitDetails/commitDetails.html View File

@ -74,6 +74,15 @@
class="commit-details__commit-action"
href="#"
data-action="commit-actions"
data-action-type="scm"
aria-label="Open SCM view"
title="Open SCM view"
><code-icon icon="source-control"></code-icon
></a>
<a
class="commit-details__commit-action"
href="#"
data-action="commit-actions"
data-action-type="graph"
aria-label="Show in Commit Graph"
title="Show in Commit Graph"

+ 6
- 2
src/webviews/apps/commitDetails/commitDetails.ts View File

@ -229,9 +229,13 @@ export class CommitDetailsApp extends App> {
}
renderActions(state: CommitState) {
const isHidden = state.selected?.sha === uncommittedSha ? 'true' : 'false';
const isHiddenForUncommitted = state.selected?.sha === uncommittedSha ? 'true' : 'false';
const isHiddenForCommitted = state.selected?.sha !== uncommittedSha ? 'true' : 'false';
[...document.querySelectorAll('[data-action-type="graph"],[data-action-type="more"]')].forEach($el =>
$el.setAttribute('aria-hidden', isHidden),
$el.setAttribute('aria-hidden', isHiddenForUncommitted),
);
[...document.querySelectorAll('[data-action-type="scm"]')].forEach($el =>
$el.setAttribute('aria-hidden', isHiddenForCommitted),
);
}

+ 5
- 2
src/webviews/commitDetails/commitDetailsWebviewView.ts View File

@ -7,7 +7,7 @@ import type {
import { CancellationTokenSource, Disposable, env, Uri, window } from 'vscode';
import { executeGitCommand, GitActions } from '../../commands/gitCommands.actions';
import { configuration } from '../../configuration';
import { Commands } from '../../constants';
import { Commands, CoreCommands } from '../../constants';
import type { Container } from '../../container';
import type { GitCommit } from '../../git/models/commit';
import { isCommit } from '../../git/models/commit';
@ -21,7 +21,7 @@ import type { GitRevisionReference } from '../../git/models/reference';
import { GitReference } from '../../git/models/reference';
import { Logger } from '../../logger';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/graphWebview';
import { executeCommand } from '../../system/command';
import { executeCommand, executeCoreCommand } from '../../system/command';
import type { DateTimeFormat } from '../../system/date';
import { debug, getLogScope } from '../../system/decorators/log';
import type { Deferrable } from '../../system/function';
@ -245,6 +245,9 @@ export class CommitDetailsWebviewView extends WebviewViewBase
case 'more':
this.showCommitActions();
break;
case 'scm':
void executeCoreCommand(CoreCommands.ShowSCM);
break;
case 'sha':
if (params.alt) {
this.showCommitPicker();

+ 1
- 1
src/webviews/commitDetails/protocol.ts View File

@ -48,7 +48,7 @@ export type ShowCommitDetailsViewCommandArgs = string[];
// COMMANDS
export interface CommitActionsParams {
action: 'graph' | 'more' | 'sha';
action: 'graph' | 'more' | 'scm' | 'sha';
alt?: boolean;
}
export const CommitActionsCommandType = new IpcCommandType<CommitActionsParams>('commit/actions');

Loading…
Cancel
Save