Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants.search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const searchOperationHelpRegex =

export interface SearchQuery {
query: string;
filter?: boolean;
matchAll?: boolean;
matchCase?: boolean;
matchRegex?: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/webviews/apps/plus/graph/GraphWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,7 @@ export function GraphWrapper({
refMetadataById={refsMetadata}
rowsStats={rowsStats}
rowsStatsLoading={rowsStatsLoading}
searchMode={searchQuery?.filter ? 'filter' : 'normal'}
shaLength={graphConfig?.idLength}
shiftSelectMode="simple"
suppressNonRefRowTooltips
Expand Down
19 changes: 19 additions & 0 deletions src/webviews/apps/shared/components/search/search-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export class GlSearchInput extends GlElement {
@property({ type: String }) label = 'Search';
@property({ type: String }) placeholder = 'Search...';
@property({ type: String }) value = '';
@property({ type: Boolean }) filter = false;
@property({ type: Boolean }) matchAll = false;
@property({ type: Boolean }) matchCase = false;
@property({ type: Boolean }) matchRegex = true;
Expand Down Expand Up @@ -380,6 +381,11 @@ export class GlSearchInput extends GlElement {
this.debouncedOnSearchChanged();
}

handleFilter(_e: Event) {
this.filter = !this.filter;
this.debouncedOnSearchChanged();
}

handleKeyup(_e: KeyboardEvent) {
this.updateHelpText();
}
Expand Down Expand Up @@ -423,6 +429,7 @@ export class GlSearchInput extends GlElement {
private onSearchChanged() {
const search: SearchQuery = {
query: this.value,
filter: this.filter,
matchAll: this.matchAll,
matchCase: this.matchCase,
matchRegex: this.matchRegex,
Expand Down Expand Up @@ -508,6 +515,18 @@ export class GlSearchInput extends GlElement {
</menu-item>
</div>
</gl-popover>
<gl-tooltip hoist placement="top" content="Filter Commits">
<button
class="action-button"
type="button"
role="checkbox"
aria-label="Filter Commits"
aria-checked="${this.filter}"
@click="${this.handleFilter}"
>
<code-icon icon="list-filter"></code-icon>
</button>
</gl-tooltip>
<div class="field">
<input
id="search"
Expand Down
Loading