Skip to content

Commit

Permalink
[ACS-8907] Remove query / question from input on the results page
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekpluta committed Oct 28, 2024
1 parent c2efff2 commit ce4ae16
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[searchTerm]="(inputState$ | async).searchTerm"
[placeholder]="placeholder"
[agentId]="agentId"
[useStoredNodes]="useStoredNodes">
[usedInAiResultsPage]="usedInAiResultsPage">
</aca-search-ai-input>
<mat-divider
[vertical]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ describe('SearchAiInputContainerComponent', () => {
expect(inputComponent.agentId).toBe(component.agentId);
});

it('should have assigned correct useStoredNodes flag', () => {
component.useStoredNodes = true;
it('should have assigned correct usedInAiResultsPage flag', () => {
component.usedInAiResultsPage = true;
fixture.detectChanges();

expect(inputComponent.useStoredNodes).toBeTrue();
expect(inputComponent.usedInAiResultsPage).toBeTrue();
});

it('should set inputState$ to toggleSearchAiInput$ from the service on ngOnInit', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class SearchAiInputContainerComponent implements OnInit {
@Input()
agentId: string;
@Input()
useStoredNodes: boolean;
usedInAiResultsPage: boolean;

inputState$: Observable<SearchAiInputState>;
isKnowledgeRetrievalPage = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,19 @@ describe('SearchAiInputComponent', () => {
expect(component.queryControl.value).toBe(query);
});

it('should set queryControl value to "some new query" if useStoredNodes is equal to false', () => {
it('should set queryControl value to "some new query" if usedInAiResultsPage is equal to false', () => {
const query = 'some new query';
component.useStoredNodes = false;
component.usedInAiResultsPage = false;
component.searchTerm = query;

component.ngOnInit();

expect(component.queryControl.value).toBe('some new query');
});

it('should set queryControl value to empty string if useStoredNodes is equal to true', () => {
it('should set queryControl value to empty string if usedInAiResultsPage is equal to true', () => {
const query = 'some new query';
component.useStoredNodes = true;
component.usedInAiResultsPage = true;
component.searchTerm = query;

component.ngOnInit();
Expand Down Expand Up @@ -371,7 +371,7 @@ describe('SearchAiInputComponent', () => {
});

it('should call checkSearchAvailability on SearchAiService with parameter based on value returned by UserPreferencesService', () => {
component.useStoredNodes = true;
component.usedInAiResultsPage = true;
component.ngOnInit();
submittingTrigger();

Expand All @@ -386,7 +386,7 @@ describe('SearchAiInputComponent', () => {
});

it('should call set on UserPreferencesService with parameter based on value returned by UserPreferencesService', () => {
component.useStoredNodes = true;
component.usedInAiResultsPage = true;
component.ngOnInit();
submittingTrigger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
agentId: string;

@Input()
useStoredNodes: boolean;
usedInAiResultsPage: boolean;

@Input()
searchTerm: string;
Expand Down Expand Up @@ -130,11 +130,10 @@ export class SearchAiInputComponent implements OnInit, OnDestroy {
) {}

ngOnInit(): void {
const usedInAiResultsPage = this.useStoredNodes;
const queryValue = usedInAiResultsPage ? '' : this.searchTerm || '';
const queryValue = this.usedInAiResultsPage ? '' : this.searchTerm || '';
this.queryControl.setValue(queryValue);

if (!usedInAiResultsPage) {
if (!this.usedInAiResultsPage) {
this.store
.select(getAppSelection)
.pipe(takeUntil(this.onDestroy$))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class="aca-page-layout-header"
placeholder="KNOWLEDGE_RETRIEVAL.SEARCH.RESULTS_PAGE.QUERY_INPUT_PLACEHOLDER"
[agentId]="agentId"
[useStoredNodes]="true"
[usedInAiResultsPage]="true"
*ngIf="!hasError && agentId">
</aca-search-ai-input-container>
<div
Expand Down

0 comments on commit ce4ae16

Please sign in to comment.