Skip to content

Commit

Permalink
Merge branch 'main' into feat/search-widget-accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy committed Feb 26, 2024
2 parents 311ad06 + b8cff92 commit 76cd804
Show file tree
Hide file tree
Showing 53 changed files with 1,085 additions and 130 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
## [4.8.0](https://github.com/onecx/onecx-portal-ui-libs/compare/v4.7.0...v4.8.0) (2024-02-26)


### Features

* allow dynamically switching diagram type ([#144](https://github.com/onecx/onecx-portal-ui-libs/issues/144)) ([ac0e2e0](https://github.com/onecx/onecx-portal-ui-libs/commit/ac0e2e051f7dee12e45561bfda1cebf642d0504c))
* save and edit search config component ([#139](https://github.com/onecx/onecx-portal-ui-libs/issues/139)) ([635339a](https://github.com/onecx/onecx-portal-ui-libs/commit/635339aae8dedfa96d6a77798de591ef4ae49829))


### Bug Fixes

* check length of occurences and ([#141](https://github.com/onecx/onecx-portal-ui-libs/issues/141)) ([782cb27](https://github.com/onecx/onecx-portal-ui-libs/commit/782cb27643a32c7fcf5f9e14a3a4876cae4972e5))
* current page should persist between layout changes ([#142](https://github.com/onecx/onecx-portal-ui-libs/issues/142)) ([e023add](https://github.com/onecx/onecx-portal-ui-libs/commit/e023adda69ae2a90cb4a5b82ba87fdb60eba0670))
* empty message allignment to amount of columns ([#140](https://github.com/onecx/onecx-portal-ui-libs/issues/140)) ([3459c67](https://github.com/onecx/onecx-portal-ui-libs/commit/3459c676903225d1356ee7116951f3e25c60feb1))
* removed conflicting style ([#137](https://github.com/onecx/onecx-portal-ui-libs/issues/137)) ([7ddcd17](https://github.com/onecx/onecx-portal-ui-libs/commit/7ddcd17c0e025708353d8a525bb07ac13500cb6d))

## [4.7.0](https://github.com/onecx/onecx-portal-ui-libs/compare/v4.6.0...v4.7.0) (2024-02-21)


### Features

* add freeze action column functionality to table view ([#120](https://github.com/onecx/onecx-portal-ui-libs/issues/120)) ([6cecae9](https://github.com/onecx/onecx-portal-ui-libs/commit/6cecae961deb8ab2400cd45dda4fb3d6a3132bf1))


### Bug Fixes

* renaming filter quarams functions ([#136](https://github.com/onecx/onecx-portal-ui-libs/issues/136)) ([ac46f53](https://github.com/onecx/onecx-portal-ui-libs/commit/ac46f53133129ad09f4324fc104fa9351bc8a859))

## [4.6.0](https://github.com/onecx/onecx-portal-ui-libs/compare/v4.5.1...v4.6.0) (2024-02-19)


Expand Down
2 changes: 1 addition & 1 deletion libs/accelerator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/accelerator",
"version": "4.6.0",
"version": "4.8.0",
"peerDependencies": {
"tslib": "^2.3.0",
"rxjs": "7.8.1"
Expand Down
2 changes: 1 addition & 1 deletion libs/integration-interface/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/integration-interface",
"version": "4.6.0",
"version": "4.8.0",
"peerDependencies": {
"tslib": "^2.3.0",
"rxjs": "7.8.1",
Expand Down
2 changes: 1 addition & 1 deletion libs/keycloak-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/keycloak-auth",
"version": "4.6.0",
"version": "4.8.0",
"peerDependencies": {
"@angular/common": ">=15.2.7",
"@angular/core": ">=15.2.7",
Expand Down
12 changes: 11 additions & 1 deletion libs/portal-integration-angular/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"RIGHT": "Rechts"
}
},
"OCX_SEARCH_CONFIG": {
"PLACEHOLDER": "Bitte geben Sie den Namen der Suchkonfiguration an.",
"SAVE_COLUMNS_OPTION": "Möchten Sie die angezeigten Spalten speichern?",
"SAVE_INPUT_FIELDS_OPTION": "Möchten Sie die Werte aus den Suchfeldern speichern?"
},
"OCX_LIST_GRID_SORT": {
"DROPDOWN": {
"PLACEHOLDER": "Sortierung auswählen",
Expand Down Expand Up @@ -84,7 +89,12 @@
},
"OCX_DIAGRAM": {
"SUM": "Gesamtanzahl",
"NO_DATA": "Es sind keine Daten vorhanden"
"NO_DATA": "Es sind keine Daten vorhanden",
"SWITCH_DIAGRAM_TYPE": {
"PIE": "Zu Tortendiagramm wechseln",
"HORIZONTAL_BAR": "Zu horizontalem Balkendiagramm wechseln",
"VERTICAL_BAR": "Zu vertikalem Balkendiagramm wechseln"
}
},
"OCX_PORTAL_VIEWPORT": {
"SUCCESS": "Erfolg!",
Expand Down
12 changes: 11 additions & 1 deletion libs/portal-integration-angular/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"RIGHT": "Right"
}
},
"OCX_SEARCH_CONFIG": {
"PLACEHOLDER": "Please enter the name of the search configuration",
"SAVE_COLUMNS_OPTION": "Do you want to save the shown columns?",
"SAVE_INPUT_FIELDS_OPTION": "Do you want to save the input values from the input fields?"
},
"OCX_LIST_GRID_SORT": {
"DROPDOWN": {
"PLACEHOLDER": "Select sorting",
Expand Down Expand Up @@ -84,7 +89,12 @@
},
"OCX_DIAGRAM": {
"SUM": "Total",
"NO_DATA": "There is no data available"
"NO_DATA": "There is no data available",
"SWITCH_DIAGRAM_TYPE": {
"PIE": "Switch to pie chart",
"HORIZONTAL_BAR": "Switch to horizontal bar chart",
"VERTICAL_BAR": "Switch to vertical bar chart"
}
},
"OCX_PORTAL_VIEWPORT": {
"SUCCESS": "Success!",
Expand Down
6 changes: 0 additions & 6 deletions libs/portal-integration-angular/assets/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -27325,12 +27325,6 @@ p-autocomplete.ng-dirty.ng-invalid .p-autocomplete .p-autocomplete-multiple-cont
.p-button.p-button-icon-only {
min-width: auto;
}
.p-button:enabled:focus {
background: rgba(var(--primary-color-rgb), 0.76);
}
.p-button:enabled:active {
background: rgba(var(--primary-color-rgb), 0.68);
}
.p-button .p-ink {
background-color: rgba(255, 255, 255, 0.32);
}
Expand Down
2 changes: 1 addition & 1 deletion libs/portal-integration-angular/assets/output.css.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ import { Router, RoutesRecognized } from '@angular/router'
import { RouterNavigatedAction } from '@ngrx/router-store'
import { filter, map, MonoTypeOperatorFunction, withLatestFrom } from 'rxjs'

/**
* @deprecated use filterOutOnlyQueryParamsChanged
*/
export function filterForOnlyQueryParamsChanged<A extends RouterNavigatedAction>(
router: Router
): MonoTypeOperatorFunction<A> {
return filterOutOnlyQueryParamsChanged(router)
}

export function filterOutOnlyQueryParamsChanged<A extends RouterNavigatedAction>(
router: Router
): MonoTypeOperatorFunction<A> {
return (source) => {
return source.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ import { MonoTypeOperatorFunction, filter, withLatestFrom, map } from 'rxjs'
import equal from 'fast-deep-equal'
import { Router, RoutesRecognized } from '@angular/router'

/**
* @deprecated use filterOutQueryParamsHaveNotChanged
*/
export function filterForQueryParamsChanged<A extends RouterNavigatedAction>(
router: Router,
queryParamsTypeDef: ZodType,
allowEmptyQueryParamsList = false
): MonoTypeOperatorFunction<A> {
return filterOutQueryParamsHaveNotChanged(router, queryParamsTypeDef, allowEmptyQueryParamsList)
}

export function filterOutQueryParamsHaveNotChanged<A extends RouterNavigatedAction>(
router: Router,
queryParamsTypeDef: ZodType,
allowEmptyQueryParamsList = false
): MonoTypeOperatorFunction<A> {
return (source) => {
return source.pipe(
Expand Down
2 changes: 1 addition & 1 deletion libs/portal-integration-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/portal-integration-angular",
"version": "4.6.0",
"version": "4.8.0",
"peerDependencies": {
"@angular-architects/module-federation": "15.0.0",
"@angular/common": "^15.2.7",
Expand Down
1 change: 1 addition & 0 deletions libs/portal-integration-angular/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export * from './lib/core/components/search-config/search-config.component'
export * from './lib/core/components/loading-indicator/loading-indicator.component'
export * from './lib/core/components/content-container/content-container.component'
export * from './lib/core/components/content/content.component'
export * from './lib/core/components/create-or-edit-search-config-dialog/create-or-edit-search-config-dialog.component'

// services
export * from './lib/services/app.menu.service'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<form [formGroup]="searchConfigFormGroup" [class]="'searchConfigDialog'">
<div>
<input
type="text"
pInputText
formControlName="searchConfigName"
id="searchConfigName"
[placeholder]="placeHolderKey | translate"
/>
</div>

<div>
<p-checkbox formControlName="saveInputValues" [value]="saveInputValues" [binary]="true" inputId="saveInputValuesId">
</p-checkbox>
<label for="saveInputValuesId">{{ ("OCX_SEARCH_CONFIG.SAVE_INPUT_FIELDS_OPTION" | translate) }}</label>
</div>

<div>
<p-checkbox
formControlName="saveColumns"
[value]="saveColumns"
[binary]="true"
inputId="saveColumnsId"
></p-checkbox>
<label for="saveColumnsId">{{ ("OCX_SEARCH_CONFIG.SAVE_COLUMNS_OPTION" | translate) }}</label>
</div>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.searchConfigDialog {
display: flex;
flex-direction: column;
gap: 1em;
margin-bottom: 1em;
}

:host ::ng-deep .p-inputtext {
width: 100%;
}

:host ::ng-deep .p-checkbox {
margin-right: 1em;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { CreateOrEditSearchConfigDialogComponent } from './create-or-edit-search-config-dialog.component'
import { CheckboxModule } from 'primeng/checkbox'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { TranslateTestingModule } from 'ngx-translate-testing'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { TranslateService } from '@ngx-translate/core'
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'
import { PCheckboxHarness, CreateOrEditSearchConfigDialogHarness } from '../../../../../testing'
import { DialogState } from '../../../services/portal-dialog.service'
import { ReactiveFormsModule } from '@angular/forms'
import { InputTextModule } from 'primeng/inputtext'

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CreateOrEditSearchConfigDialogComponent],
imports: [
CheckboxModule,
MockAuthModule,
TranslateTestingModule.withTranslations({
en: require('./../../../../../assets/i18n/en.json'),
de: require('./../../../../../assets/i18n/de.json'),
}),
HttpClientTestingModule,
ReactiveFormsModule,
InputTextModule,
],
}).compileComponents()

fixture = TestBed.createComponent(CreateOrEditSearchConfigDialogComponent)
component = fixture.componentInstance

translateService = TestBed.inject(TranslateService)
translateService.setDefaultLang('en')
translateService.use('en')

fixture.detectChanges()
dialogHarness = await TestbedHarnessEnvironment.harnessForFixture(fixture, CreateOrEditSearchConfigDialogHarness)
})

it('should create the component', () => {
expect(component).toBeTruthy()
})

it('should load the CreateOrEditSearchConfigDialogHarness', async () => {
expect(dialogHarness).toBeTruthy()
})

it('should set the DialogResult of the saveInputValuesId checkbox to true when the saveInputValuesId checkbox is checked', async () => {
const saveInputValuesCheckbox = await dialogHarness.getHarness(
PCheckboxHarness.with({ inputid: 'saveInputValuesId' })
)
await saveInputValuesCheckbox.click()
const _state: DialogState<CreateOrEditSearchConfigDialogComponent> = { button: 'primary', result: undefined }
component.ocxDialogButtonClicked(_state)
const dialogResult = {
searchConfigName: '',
saveInputValues: true,
saveColumns: false,
}
expect(component.dialogResult).toEqual(dialogResult)
})

it('should set the DialogResult of the saveColumnsId checkbox initially false', async () => {
const _state: DialogState<CreateOrEditSearchConfigDialogComponent> = { button: 'primary', result: undefined }
await component.ocxDialogButtonClicked(_state)
const dialogResult = {
searchConfigName: '',
saveInputValues: false,
saveColumns: false,
}
expect(component.dialogResult).toEqual(dialogResult)
})

it('should set the DialogResult of the searchConfig input Field to the entered value', async () => {
await (await dialogHarness.getSearchConfigInputHarness()).setValue('search Config')
const _state: DialogState<CreateOrEditSearchConfigDialogComponent> = { button: 'primary', result: undefined }
await component.ocxDialogButtonClicked(_state)
const dialogResult = {
searchConfigName: 'search Config',
saveInputValues: false,
saveColumns: false,
}
expect(component.dialogResult).toEqual(dialogResult)
})

it('should set the saveColumnsId checkbox initially to unchecked', async () => {
const saveInputValuesCheckbox = await dialogHarness.getSaveColumnsCheckboxHarness()
const checked = await saveInputValuesCheckbox.isChecked()
expect(checked).toBeFalsy()
})

it('should set the saveInputValues checkbox initially to unchecked', async () => {
const saveInputValuesCheckbox = await dialogHarness.getSaveInputValuesCheckboxHarness()
const checked = await saveInputValuesCheckbox.isChecked()
expect(checked).toBeFalsy()
})

it('should set the saveInputValues checkbox to true when it is clicked', async () => {
const saveInputValuesCheckbox = await dialogHarness.getSaveInputValuesCheckboxHarness()
await saveInputValuesCheckbox.click()
const checked = await saveInputValuesCheckbox.isChecked()
expect(checked).toBeTruthy()
})

it('should emit true when the searchConfig name is not an empty string and the saveColumnsCheckBox is clicked', async () => {
let done: () => void
const finished = new Promise<void>((resolve) => (done = resolve))
let enabled = false
component.primaryButtonEnabled.subscribe((v) => {
enabled = v
done()
})

const searchConfigInputHarness = await dialogHarness.getSearchConfigInputHarness()
searchConfigInputHarness.setValue('test')
const saveInputValuesCheckbox = await dialogHarness.getSaveColumnsCheckboxHarness()
await saveInputValuesCheckbox.click()

await finished
expect(enabled).toEqual(true)
})

it('emit true when the searchConfig Name is not an empty string and the saveInputValuesCheckbox is clicked', async () => {
let done: () => void
const finished = new Promise<void>((resolve) => (done = resolve))
let enabled = false
component.primaryButtonEnabled.subscribe((v) => {
enabled = v
done()
})

const searchConfigInputHarness = await dialogHarness.getSearchConfigInputHarness()
searchConfigInputHarness.setValue('test')
const saveInputValuesCheckbox = await dialogHarness.getSaveInputValuesCheckboxHarness()
await saveInputValuesCheckbox.click()

await finished
expect(enabled).toEqual(true)
})
})
Loading

0 comments on commit 76cd804

Please sign in to comment.