Bladeren bron

Adds indicator if view auto-refresh is unavailable

main
Eric Amodio 3 jaren geleden
bovenliggende
commit
0afba2c575
9 gewijzigde bestanden met toevoegingen van 67 en 15 verwijderingen
  1. +1
    -0
      src/constants.ts
  2. +6
    -1
      src/views/branchesView.ts
  3. +17
    -5
      src/views/commitsView.ts
  4. +6
    -1
      src/views/contributorsView.ts
  5. +4
    -2
      src/views/nodes/repositoryNode.ts
  6. +7
    -1
      src/views/nodes/viewNode.ts
  7. +6
    -1
      src/views/remotesView.ts
  8. +6
    -1
      src/views/stashesView.ts
  9. +14
    -3
      src/views/tagsView.ts

+ 1
- 0
src/constants.ts Bestand weergeven

@ -144,6 +144,7 @@ export enum GlyphChars {
SpaceThinnest = '\u200A',
SquareWithBottomShadow = '\u274F',
SquareWithTopShadow = '\u2750',
Warning = '\u26a0',
ZeroWidthSpace = '\u200b',
}

+ 6
- 1
src/views/branchesView.ts Bestand weergeven

@ -15,6 +15,7 @@ import {
ViewFilesLayout,
ViewShowBranchComparison,
} from '../configuration';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import {
GitBranchReference,
@ -34,7 +35,7 @@ import {
unknownGitUri,
ViewNode,
} from './nodes';
import { debug, gate } from '../system';
import { debug, gate, Strings } from '../system';
import { ViewBase } from './viewBase';
export class BranchesRepositoryNode extends RepositoryFolderNode<BranchesView, BranchesNode> {
@ -85,6 +86,10 @@ export class BranchesViewNode extends ViewNode {
if (this.children.length === 1) {
const [child] = this.children;
if (!child.repo.supportsChangeEvents) {
this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`;
}
const branches = await child.repo.getBranches({ filter: b => !b.remote });
if (branches.length === 0) {
this.view.message = 'No branches could be found.';

+ 17
- 5
src/views/commitsView.ts Bestand weergeven

@ -86,10 +86,12 @@ export class CommitsRepositoryNode extends RepositoryFolderNode
item.contextValue = `${ContextValues.RepositoryFolder}${this.repo.starred ? '+starred' : ''}`;
if (branch != null) {
const lastFetched = (await this.repo?.getLastFetched()) ?? 0;
const lastFetched = (await this.repo.getLastFetched()) ?? 0;
const status = branch?.getTrackingStatus();
item.description = `${status ? `${status}${Strings.pad(GlyphChars.Dot, 1, 1)}` : ''}${branch.name}${
item.description = `${this.repo.supportsChangeEvents ? '' : Strings.pad(GlyphChars.Warning, 1, 2)}${
status ? `${status}${Strings.pad(GlyphChars.Dot, 1, 1)}` : ''
}${branch.name}${
lastFetched
? `${Strings.pad(GlyphChars.Dot, 1, 1)}Last fetched ${Repository.formatLastFetched(lastFetched)}`
: ''
@ -126,6 +128,10 @@ export class CommitsRepositoryNode extends RepositoryFolderNode
suffix: ` $(git-branch) ${branch.tracking}${providerName ? ` on ${providerName}` : ''}`,
})}`
: `hasn't been published to ${providerName ?? 'a remote'}`
}${
this.repo.supportsChangeEvents
? ''
: `\n\n${GlyphChars.Warning} Unable to automatically detect repository changes`
}`,
true,
);
@ -213,14 +219,20 @@ export class CommitsViewNode extends ViewNode {
const branch = await child.repo.getBranch();
if (branch != null) {
const lastFetched = (await child.repo?.getLastFetched()) ?? 0;
const lastFetched = (await child.repo.getLastFetched()) ?? 0;
const status = branch.getTrackingStatus();
this.view.description = `${status ? `${status} ${GlyphChars.Dot} ` : ''}${branch.name}${
branch.rebasing ? ' (Rebasing)' : ''
}${lastFetched ? ` ${GlyphChars.Dot} Last fetched ${Repository.formatLastFetched(lastFetched)}` : ''}`;
}${lastFetched ? ` ${GlyphChars.Dot} Last fetched ${Repository.formatLastFetched(lastFetched)}` : ''}${
child.repo.supportsChangeEvents
? ''
: `${Strings.pad(GlyphChars.Warning, 3, 2)}Auto-refresh unavailable`
}`;
} else {
this.view.description = undefined;
this.view.description = child.repo.supportsChangeEvents
? undefined
: `${Strings.pad(GlyphChars.Warning, 1, 2)}Auto-refresh unavailable`;
}
return child.getChildren();

+ 6
- 1
src/views/contributorsView.ts Bestand weergeven

@ -2,11 +2,12 @@
import { commands, ConfigurationChangeEvent, Disposable, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { Avatars } from '../avatars';
import { configuration, ContributorsViewConfig, ViewFilesLayout } from '../configuration';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { RepositoryChange, RepositoryChangeEvent } from '../git/git';
import { GitUri } from '../git/gitUri';
import { ContributorsNode, RepositoryFolderNode, unknownGitUri, ViewNode } from './nodes';
import { debug, gate } from '../system';
import { debug, gate, Strings } from '../system';
import { ViewBase } from './viewBase';
export class ContributorsRepositoryNode extends RepositoryFolderNode<ContributorsView, ContributorsNode> {
@ -64,6 +65,10 @@ export class ContributorsViewNode extends ViewNode {
if (this.children.length === 1) {
const [child] = this.children;
if (!child.repo.supportsChangeEvents) {
this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`;
}
const contributors = await child.repo.getContributors();
if (contributors.length === 0) {
this.view.message = 'No contributors could be found.';

+ 4
- 2
src/views/nodes/repositoryNode.ts Bestand weergeven

@ -249,8 +249,10 @@ export class RepositoryNode extends SubscribeableViewNode {
}
if (!this.repo.supportsChangeEvents) {
description = `<!>${description ? ` ${GlyphChars.Space}${description}` : ''}`;
tooltip += '\n\n<!> Unable to automatically detect repository changes';
description = `${Strings.pad(GlyphChars.Warning, 1, 0)}${
description ? Strings.pad(description, 2, 0) : ''
}`;
tooltip += `\n\n${GlyphChars.Warning} Unable to automatically detect repository changes`;
}
const item = new TreeItem(label, TreeItemCollapsibleState.Expanded);

+ 7
- 1
src/views/nodes/viewNode.ts Bestand weergeven

@ -1,5 +1,6 @@
'use strict';
import { Command, Disposable, Event, TreeItem, TreeItemCollapsibleState, TreeViewVisibilityChangeEvent } from 'vscode';
import { GlyphChars } from '../../constants';
import { Container } from '../../container';
import {
GitFile,
@ -11,7 +12,7 @@ import {
} from '../../git/git';
import { GitUri } from '../../git/gitUri';
import { Logger } from '../../logger';
import { debug, Functions, gate, log, logName } from '../../system';
import { debug, Functions, gate, log, logName, Strings } from '../../system';
import { TreeViewNodeCollapsibleStateChangeEvent, View } from '../viewBase';
export enum ContextValues {
@ -352,8 +353,13 @@ export abstract class RepositoryFolderNode<
expand ? TreeItemCollapsibleState.Expanded : TreeItemCollapsibleState.Collapsed,
);
item.contextValue = `${ContextValues.RepositoryFolder}${this.repo.starred ? '+starred' : ''}`;
item.description = this.repo.supportsChangeEvents ? undefined : Strings.pad(GlyphChars.Warning, 1, 0);
item.tooltip = `${
this.repo.formattedName ? `${this.repo.formattedName}\n${this.uri.repoPath}` : this.uri.repoPath ?? ''
}${
this.repo.supportsChangeEvents
? ''
: `\n\n${GlyphChars.Warning} Unable to automatically detect repository changes`
}`;
return item;

+ 6
- 1
src/views/remotesView.ts Bestand weergeven

@ -9,6 +9,7 @@ import {
window,
} from 'vscode';
import { configuration, RemotesViewConfig, ViewBranchesLayout, ViewFilesLayout } from '../configuration';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import {
GitBranch,
@ -31,7 +32,7 @@ import {
unknownGitUri,
ViewNode,
} from './nodes';
import { debug, gate } from '../system';
import { debug, gate, Strings } from '../system';
import { ViewBase } from './viewBase';
export class RemotesRepositoryNode extends RepositoryFolderNode<RemotesView, RemotesNode> {
@ -80,6 +81,10 @@ export class RemotesViewNode extends ViewNode {
if (this.children.length === 1) {
const [child] = this.children;
if (!child.repo.supportsChangeEvents) {
this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`;
}
const remotes = await child.repo.getRemotes();
if (remotes.length === 0) {
this.view.message = 'No remotes could be found.';

+ 6
- 1
src/views/stashesView.ts Bestand weergeven

@ -9,11 +9,12 @@ import {
window,
} from 'vscode';
import { configuration, StashesViewConfig, ViewFilesLayout } from '../configuration';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { GitReference, GitStashReference, RepositoryChange, RepositoryChangeEvent } from '../git/git';
import { GitUri } from '../git/gitUri';
import { RepositoryFolderNode, RepositoryNode, StashesNode, StashNode, unknownGitUri, ViewNode } from './nodes';
import { debug, gate } from '../system';
import { debug, gate, Strings } from '../system';
import { ViewBase } from './viewBase';
export class StashesRepositoryNode extends RepositoryFolderNode<StashesView, StashesNode> {
@ -62,6 +63,10 @@ export class StashesViewNode extends ViewNode {
if (this.children.length === 1) {
const [child] = this.children;
if (!child.repo.supportsChangeEvents) {
this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`;
}
const stash = await child.repo.getStash();
if (stash == null) {
this.view.message = 'No stashes could be found.';

+ 14
- 3
src/views/tagsView.ts Bestand weergeven

@ -9,13 +9,20 @@ import {
window,
} from 'vscode';
import { configuration, TagsViewConfig, ViewBranchesLayout, ViewFilesLayout } from '../configuration';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { GitReference, GitTagReference, RepositoryChange, RepositoryChangeEvent } from '../git/git';
import { GitUri } from '../git/gitUri';
import { RepositoryFolderNode, RepositoryNode, TagsNode, unknownGitUri, ViewNode } from './nodes';
import { debug, gate } from '../system';
import {
BranchOrTagFolderNode,
RepositoryFolderNode,
RepositoryNode,
TagsNode,
unknownGitUri,
ViewNode,
} from './nodes';
import { debug, gate, Strings } from '../system';
import { ViewBase } from './viewBase';
import { BranchOrTagFolderNode } from './nodes/branchOrTagFolderNode';
export class TagsRepositoryNode extends RepositoryFolderNode<TagsView, TagsNode> {
async getChildren(): Promise<ViewNode[]> {
@ -63,6 +70,10 @@ export class TagsViewNode extends ViewNode {
if (this.children.length === 1) {
const [child] = this.children;
if (!child.repo.supportsChangeEvents) {
this.view.description = `${Strings.pad(GlyphChars.Warning, 0, 2)}Auto-refresh unavailable`;
}
const tags = await child.repo.getTags();
if (tags.length === 0) {
this.view.message = 'No tags could be found.';

Laden…
Annuleren
Opslaan