mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
feat: improve integrated issue search cases #3819
This commit is contained in:
parent
b06f53ce62
commit
d014ad42d5
3 changed files with 33 additions and 24 deletions
|
|
@ -120,6 +120,10 @@ export class IssueService {
|
|||
issueProviderId: string,
|
||||
issueProviderKey: IssueProviderKey,
|
||||
): Observable<SearchResultItem[]> {
|
||||
// check if text is more than just special chars
|
||||
if (searchTerm.replace(/[\W_]+/g, '').trim().length === 0) {
|
||||
return of([]);
|
||||
}
|
||||
return this.ISSUE_SERVICE_MAP[issueProviderKey].searchIssues$(
|
||||
searchTerm,
|
||||
issueProviderId,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export class GithubApiService {
|
|||
|
||||
return this._sendRequest$(
|
||||
{
|
||||
url: `${BASE}search/issues?q=${encodeURI(searchText + repoQuery)}`,
|
||||
url: `${BASE}search/issues?q=${encodeURIComponent(searchText.replace('#', '') + repoQuery)}`,
|
||||
},
|
||||
cfg,
|
||||
).pipe(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Injectable, WritableSignal, inject } from '@angular/core';
|
||||
import { inject, Injectable, WritableSignal } from '@angular/core';
|
||||
import { combineLatest, forkJoin, from, Observable, of } from 'rxjs';
|
||||
import {
|
||||
catchError,
|
||||
|
|
@ -59,29 +59,34 @@ export class AddTaskBarService {
|
|||
withLatestFrom(this._workContextService.activeWorkContextTypeAndId$),
|
||||
switchMap(([searchTerm, { activeType, activeId }]) =>
|
||||
isSearchIssueProviders$.pipe(
|
||||
switchMap((isIssueSearch) =>
|
||||
isIssueSearch
|
||||
? this._issueService.searchAllEnabledIssueProviders$(searchTerm).pipe(
|
||||
map((issueSuggestions) =>
|
||||
issueSuggestions.map(
|
||||
(issueSuggestion) =>
|
||||
({
|
||||
title: issueSuggestion.title,
|
||||
titleHighlighted: issueSuggestion.titleHighlighted,
|
||||
issueData: issueSuggestion.issueData,
|
||||
issueType: issueSuggestion.issueType,
|
||||
issueProviderId: issueSuggestion.issueProviderId,
|
||||
}) as AddTaskSuggestion,
|
||||
),
|
||||
switchMap((isIssueSearch) => {
|
||||
if (isIssueSearch) {
|
||||
if (!searchTerm?.length) {
|
||||
return of([]);
|
||||
}
|
||||
return this._issueService.searchAllEnabledIssueProviders$(searchTerm).pipe(
|
||||
map((issueSuggestions) =>
|
||||
issueSuggestions.map(
|
||||
(issueSuggestion) =>
|
||||
({
|
||||
title: issueSuggestion.title,
|
||||
titleHighlighted: issueSuggestion.titleHighlighted,
|
||||
issueData: issueSuggestion.issueData,
|
||||
issueType: issueSuggestion.issueType,
|
||||
issueProviderId: issueSuggestion.issueProviderId,
|
||||
}) as AddTaskSuggestion,
|
||||
),
|
||||
catchError(() => {
|
||||
return of([]);
|
||||
}),
|
||||
)
|
||||
: activeType === WorkContextType.PROJECT
|
||||
? this._searchForProject$(searchTerm, activeId)
|
||||
: this._searchForTag$(searchTerm, activeId),
|
||||
),
|
||||
),
|
||||
catchError(() => {
|
||||
return of([]);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return activeType === WorkContextType.PROJECT
|
||||
? this._searchForProject$(searchTerm, activeId)
|
||||
: this._searchForTag$(searchTerm, activeId);
|
||||
}),
|
||||
),
|
||||
),
|
||||
tap(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue