Sfoglia il codice sorgente

Changes to use tree.message for no "items"

main
Eric Amodio 4 anni fa
parent
commit
97e6e13b77
8 ha cambiato i file con 69 aggiunte e 21 eliminazioni
  1. +7
    -2
      src/views/branchesView.ts
  2. +14
    -3
      src/views/commitsView.ts
  3. +7
    -2
      src/views/contributorsView.ts
  4. +7
    -2
      src/views/remotesView.ts
  5. +8
    -0
      src/views/searchAndCompareView.ts
  6. +7
    -2
      src/views/stashesView.ts
  7. +8
    -10
      src/views/tagsView.ts
  8. +11
    -0
      src/views/viewBase.ts

+ 7
- 2
src/views/branchesView.ts Vedi File

@ -31,7 +31,6 @@ import {
BranchNode,
BranchOrTagFolderNode,
ContextValues,
MessageNode,
RepositoryNode,
SubscribeableViewNode,
unknownGitUri,
@ -137,7 +136,13 @@ export class BranchesViewNode extends ViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.children == null) {
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this.view, this, 'No branches could be found.')];
if (repositories.length === 0) {
this.view.message = 'No branches could be found.';
return [];
}
this.view.message = undefined;
const splat = repositories.length === 1;
this.children = repositories.map(

+ 14
- 3
src/views/commitsView.ts Vedi File

@ -24,7 +24,6 @@ import {
BranchNode,
BranchTrackingStatusNode,
ContextValues,
MessageNode,
RepositoryNode,
SubscribeableViewNode,
unknownGitUri,
@ -50,7 +49,13 @@ export class CommitsRepositoryNode extends SubscribeableViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.child == null) {
const branch = await this.repo.getBranch();
if (branch == null) return [new MessageNode(this.view, this, 'No commits could be found.')];
if (branch == null) {
this.view.message = 'No commits could be found.';
return [];
}
this.view.message = undefined;
let authors;
if (this.view.state.myCommitsOnly) {
@ -161,7 +166,13 @@ export class CommitsViewNode extends ViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.children == null) {
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this.view, this, 'No commits could be found.')];
if (repositories.length === 0) {
this.view.message = 'No commits could be found.';
return [];
}
this.view.message = undefined;
const splat = repositories.length === 1;
this.children = repositories.map(

+ 7
- 2
src/views/contributorsView.ts Vedi File

@ -8,7 +8,6 @@ import { GitUri } from '../git/gitUri';
import {
ContextValues,
ContributorsNode,
MessageNode,
RepositoryNode,
SubscribeableViewNode,
unknownGitUri,
@ -110,7 +109,13 @@ export class ContributorsViewNode extends ViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.children == null) {
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this.view, this, 'No contributors could be found.')];
if (repositories.length === 0) {
this.view.message = 'No contributors could be found.';
return [];
}
this.view.message = undefined;
const splat = repositories.length === 1;
this.children = repositories.map(

+ 7
- 2
src/views/remotesView.ts Vedi File

@ -26,7 +26,6 @@ import {
BranchNode,
BranchOrTagFolderNode,
ContextValues,
MessageNode,
RemoteNode,
RemotesNode,
RepositoryNode,
@ -127,7 +126,13 @@ export class RemotesViewNode extends ViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.children == null) {
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this.view, this, 'No remotes could be found.')];
if (repositories.length === 0) {
this.view.message = 'No remotes could be found.';
return [];
}
this.view.message = undefined;
const splat = repositories.length === 1;
this.children = repositories.map(

+ 8
- 0
src/views/searchAndCompareView.ts Vedi File

@ -52,6 +52,14 @@ export class SearchAndCompareViewNode extends ViewNode {
}
getChildren(): ViewNode[] {
if (this.children.length === 0) {
this.view.message = 'No search or comparison results could be found.';
return [];
}
this.view.message = undefined;
return this.children.sort((a, b) => (a.pinned ? -1 : 1) - (b.pinned ? -1 : 1) || b.order - a.order);
}

+ 7
- 2
src/views/stashesView.ts Vedi File

@ -14,7 +14,6 @@ import { GitReference, GitStashReference, Repository, RepositoryChange, Reposito
import { GitUri } from '../git/gitUri';
import {
ContextValues,
MessageNode,
RepositoryNode,
StashesNode,
StashNode,
@ -111,7 +110,13 @@ export class StashesViewNode extends ViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.children == null) {
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this.view, this, 'No stashes could be found.')];
if (repositories.length === 0) {
this.view.message = 'No stashes could be found.';
return [];
}
this.view.message = undefined;
const splat = repositories.length === 1;
this.children = repositories.map(

+ 8
- 10
src/views/tagsView.ts Vedi File

@ -12,15 +12,7 @@ import { configuration, TagsViewConfig, ViewBranchesLayout, ViewFilesLayout } fr
import { Container } from '../container';
import { GitReference, GitTagReference, Repository, RepositoryChange, RepositoryChangeEvent } from '../git/git';
import { GitUri } from '../git/gitUri';
import {
ContextValues,
MessageNode,
RepositoryNode,
SubscribeableViewNode,
TagsNode,
unknownGitUri,
ViewNode,
} from './nodes';
import { ContextValues, RepositoryNode, SubscribeableViewNode, TagsNode, unknownGitUri, ViewNode } from './nodes';
import { debug, gate } from '../system';
import { ViewBase } from './viewBase';
import { BranchOrTagFolderNode } from './nodes/branchOrTagFolderNode';
@ -115,7 +107,13 @@ export class TagsViewNode extends ViewNode {
async getChildren(): Promise<ViewNode[]> {
if (this.children == null) {
const repositories = await Container.git.getOrderedRepositories();
if (repositories.length === 0) return [new MessageNode(this.view, this, 'No tags could be found.')];
if (repositories.length === 0) {
this.view.message = 'No tags could be found.';
return [];
}
this.view.message = undefined;
const splat = repositories.length === 1;
this.children = repositories.map(

+ 11
- 0
src/views/viewBase.ts Vedi File

@ -182,6 +182,17 @@ export abstract class ViewBase<
}
}
private _message: string | undefined;
get message(): string | undefined {
return this._message;
}
set message(value: string | undefined) {
this._message = value;
if (this.tree != null) {
this.tree.message = value;
}
}
getQualifiedCommand(command: string) {
return `${this.id}.${command}`;
}

Caricamento…
Annulla
Salva