Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove search config and add search config info #161

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion libs/portal-integration-angular/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export * from './lib/model/data-action'
export * from './lib/model/button-dialog'
export * from './lib/model/diagram-type'
export * from './lib/model/config-key.model'
export * from './lib/model/search-config'
export * from './lib/model/search-config-info'

// core
export * from './lib/api/iauth.service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,29 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'
import { TranslateService } from '@ngx-translate/core'
import { MessageModule } from 'primeng/message'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { SearchConfigPrimitive, SearchConfig } from '../../../model/search-config'
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'
import { SearchConfigHarness } from '../../../../../testing'
import { PrimeNgModule } from '../../primeng.module'
import { ReactiveFormsModule } from '@angular/forms'
import { SearchConfigInfo } from '../../../model/search-config-info'

describe('SearchConfigComponent', () => {
let translateService: TranslateService
let component: SearchConfigComponent
let fixture: ComponentFixture<SearchConfigComponent>

const searchConfigurations: Record<string, SearchConfigPrimitive>[] = [
{
name: 'test',
startDate: undefined,
endDate: undefined,
},
{
name: 'example',
startDate: new Date(2023, 0, 15, 12, 30, 45),
endDate: new Date(2023, 0, 19, 12, 30, 45),
},
]

const searchConfigs: SearchConfig[] = [
const searchConfigs: SearchConfigInfo[] = [
{
id: '01',
name: 'Simple search config',
fieldListVersion: 1,
isReadonly: true,
isAdvanced: true,
values: searchConfigurations[0],
},
{
id: '02',
name: 'Adapted search config',
fieldListVersion: 1,
isReadonly: true,
isAdvanced: true,
values: searchConfigurations[1],
},
]

const emptySearchConfigEntry: SearchConfig[] = []
const emptySearchConfigEntry: SearchConfigInfo[] = []

const placeholderKey = 'OCX_SEARCH_HEADER.OCX_SEARCH_CONFIG.DROPDOWN_DEFAULT'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
import { SearchConfig } from '../../../model/search-config'
import { FormControl, FormGroup } from '@angular/forms'
import { SearchConfigInfo } from '../../../model/search-config-info'

@Component({
selector: 'ocx-search-config',
Expand All @@ -9,21 +9,21 @@ import { FormControl, FormGroup } from '@angular/forms'
})
export class SearchConfigComponent implements OnInit {
@Input()
searchConfigs: SearchConfig[] | [] | undefined
searchConfigs: SearchConfigInfo[] | [] | undefined

@Input() placeholderKey = 'OCX_SEARCH_HEADER.OCX_SEARCH_CONFIG.DROPDOWN_DEFAULT'

@Output()
selectedSearchConfigChanged: EventEmitter<SearchConfig> = new EventEmitter()
selectedSearchConfigChanged: EventEmitter<SearchConfigInfo> = new EventEmitter()

formGroup: FormGroup | undefined
ngOnInit(): void {
this.formGroup = new FormGroup({
searchConfigForm: new FormControl<SearchConfig | null>(null),
searchConfigForm: new FormControl<SearchConfigInfo | null>(null),
})
}

onSearchConfigChange(searchConfig: SearchConfig) {
onSearchConfigChange(searchConfig: SearchConfigInfo) {
this.selectedSearchConfigChanged?.emit(searchConfig)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ViewChild,
} from '@angular/core'
import { Action } from '../page-header/page-header.component'
import { SearchConfig } from '../../../model/search-config'
import { SearchConfigInfo } from '../../../model/search-config-info'

/**
* To trigger the search when Enter key is pressed inside a search parameter field,
Expand All @@ -24,7 +24,7 @@ import { SearchConfig } from '../../../model/search-config'
styleUrls: ['./search-header.component.scss'],
})
export class SearchHeaderComponent implements AfterViewInit {
@Input() searchConfigs: SearchConfig[] | undefined
@Input() searchConfigs: SearchConfigInfo[] | undefined
@Input() header = ''

/**
Expand Down Expand Up @@ -52,7 +52,7 @@ export class SearchHeaderComponent implements AfterViewInit {

@Output() searched: EventEmitter<any> = new EventEmitter()
@Output() resetted: EventEmitter<any> = new EventEmitter()
@Output() selectedSearchConfigChanged: EventEmitter<SearchConfig> = new EventEmitter()
@Output() selectedSearchConfigChanged: EventEmitter<SearchConfigInfo> = new EventEmitter()
@Output() viewModeChanged: EventEmitter<string> = new EventEmitter()
@ContentChild('additionalToolbarContent')
additionalToolbarContent: TemplateRef<any> | undefined
Expand Down Expand Up @@ -121,7 +121,7 @@ export class SearchHeaderComponent implements AfterViewInit {
}
}

confirmSearchConfig(searchConfig: SearchConfig) {
confirmSearchConfig(searchConfig: SearchConfigInfo) {
this.selectedSearchConfigChanged?.emit(searchConfig)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface SearchConfigInfo {
id: string
name: string
}

This file was deleted.

Loading