@@ -574,7 +574,33 @@ class SCMHistoryViewModel extends Disposable {
574
574
* values are updated in the same transaction (or during the initial read of the observable value).
575
575
*/
576
576
readonly repository = latestChangedValue ( this , [ this . _firstRepository , this . _graphRepository ] ) ;
577
- private readonly _historyItemGroupIds = observableValue < 'all' | 'auto' | string [ ] > ( this , 'auto' ) ;
577
+
578
+ private readonly _historyItemGroupFilter = observableValue < 'all' | 'auto' | string [ ] > ( this , 'auto' ) ;
579
+
580
+ readonly historyItemGroupFilter = derived < string [ ] > ( reader => {
581
+ const filter = this . _historyItemGroupFilter . read ( reader ) ;
582
+ if ( Array . isArray ( filter ) ) {
583
+ return filter ;
584
+ }
585
+
586
+ if ( filter === 'all' ) {
587
+ return [ ] ;
588
+ }
589
+
590
+ const repository = this . repository . get ( ) ;
591
+ const historyProvider = repository ?. provider . historyProvider . get ( ) ;
592
+ const currentHistoryItemGroup = historyProvider ?. currentHistoryItemGroup . get ( ) ;
593
+
594
+ if ( ! currentHistoryItemGroup ) {
595
+ return [ ] ;
596
+ }
597
+
598
+ return [
599
+ currentHistoryItemGroup . revision ?? currentHistoryItemGroup . id ,
600
+ ...currentHistoryItemGroup . remote ? [ currentHistoryItemGroup . remote . revision ?? currentHistoryItemGroup . remote . id ] : [ ] ,
601
+ ...currentHistoryItemGroup . base ? [ currentHistoryItemGroup . base . revision ?? currentHistoryItemGroup . base . id ] : [ ] ,
602
+ ] ;
603
+ } ) ;
578
604
579
605
private readonly _state = new Map < ISCMRepository , HistoryItemState > ( ) ;
580
606
@@ -633,13 +659,9 @@ class SCMHistoryViewModel extends Disposable {
633
659
}
634
660
635
661
if ( ! state || state . loadMore ) {
636
- const historyItemGroupIds = [
637
- currentHistoryItemGroup . revision ?? currentHistoryItemGroup . id ,
638
- ...currentHistoryItemGroup . remote ? [ currentHistoryItemGroup . remote . revision ?? currentHistoryItemGroup . remote . id ] : [ ] ,
639
- ...currentHistoryItemGroup . base ? [ currentHistoryItemGroup . base . revision ?? currentHistoryItemGroup . base . id ] : [ ] ,
640
- ] ;
641
-
642
662
const existingHistoryItems = state ?. items ?? [ ] ;
663
+
664
+ const historyItemGroupIds = this . historyItemGroupFilter . get ( ) ;
643
665
const limit = clamp ( this . _configurationService . getValue < number > ( 'scm.graph.pageSize' ) , 1 , 1000 ) ;
644
666
645
667
const historyItems = await historyProvider . provideHistoryItems ( {
@@ -656,7 +678,7 @@ class SCMHistoryViewModel extends Disposable {
656
678
}
657
679
658
680
// Create the color map
659
- const colorMap = this . _getHistoryItemsColorMap ( currentHistoryItemGroup ) ;
681
+ const colorMap = this . _getGraphColorMap ( currentHistoryItemGroup ) ;
660
682
661
683
return toISCMHistoryItemViewModelArray ( state . items , colorMap )
662
684
. map ( historyItemViewModel => ( {
@@ -670,11 +692,7 @@ class SCMHistoryViewModel extends Disposable {
670
692
this . _selectedRepository . set ( repository , undefined ) ;
671
693
}
672
694
673
- private _getHistoryItemsColorMap ( currentHistoryItemGroup : ISCMHistoryItemGroup ) : Map < string , ColorIdentifier > {
674
- if ( this . _historyItemGroupIds . get ( ) !== 'auto' ) {
675
- return new Map < string , ColorIdentifier > ( ) ;
676
- }
677
-
695
+ private _getGraphColorMap ( currentHistoryItemGroup : ISCMHistoryItemGroup ) : Map < string , ColorIdentifier > {
678
696
const colorMap = new Map < string , ColorIdentifier > ( [
679
697
[ currentHistoryItemGroup . name , historyItemGroupLocal ]
680
698
] ) ;
@@ -684,6 +702,9 @@ class SCMHistoryViewModel extends Disposable {
684
702
if ( currentHistoryItemGroup . base ) {
685
703
colorMap . set ( currentHistoryItemGroup . base . name , historyItemGroupBase ) ;
686
704
}
705
+ if ( this . _historyItemGroupFilter . get ( ) === 'all' ) {
706
+ colorMap . set ( '*' , '' ) ;
707
+ }
687
708
688
709
return colorMap ;
689
710
}
0 commit comments