Browse Source

Adds last fetched on to commits view

main
Eric Amodio 4 years ago
parent
commit
e9831dab6f
1 changed files with 15 additions and 3 deletions
  1. +15
    -3
      src/views/commitsView.ts

+ 15
- 3
src/views/commitsView.ts View File

@ -30,7 +30,7 @@ import {
unknownGitUri,
ViewNode,
} from './nodes';
import { debug, gate } from '../system';
import { Dates, debug, gate } from '../system';
import { ViewBase } from './viewBase';
export class CommitsRepositoryNode extends SubscribeableViewNode<CommitsView> {
@ -86,8 +86,14 @@ export class CommitsRepositoryNode extends SubscribeableViewNode {
item.contextValue = ContextValues.RepositoryFolder;
if (branch != null) {
const lastFetched = (await this.repo?.getLastFetched()) ?? 0;
const status = branch?.getTrackingStatus();
item.description = `${branch.name}${status ? ` ${GlyphChars.Dot} ${status}` : ''}`;
item.description = `${status ? `${status} ${GlyphChars.Dot} ` : ''}${branch.name}${
lastFetched
? ` ${GlyphChars.Dot} Last fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}`
: ''
}`;
}
return item;
@ -168,8 +174,14 @@ export class CommitsViewNode extends ViewNode {
const branch = await child.repo.getBranch();
if (branch != null) {
const lastFetched = (await child.repo?.getLastFetched()) ?? 0;
const status = branch.getTrackingStatus();
this.view.description = `${status ? `${status} ${GlyphChars.Dot} ` : ''}${branch.name}`;
this.view.description = `${status ? `${status} ${GlyphChars.Dot} ` : ''}${branch.name}${
lastFetched
? ` ${GlyphChars.Dot} Last fetched ${Dates.getFormatter(new Date(lastFetched)).fromNow()}`
: ''
}`;
} else {
this.view.description = undefined;
}

Loading…
Cancel
Save