diff --git a/src/app/theme/theme-search/theme-search.component.spec.ts b/src/app/theme/theme-search/theme-search.component.spec.ts
index 22f3f8a..850f67c 100644
--- a/src/app/theme/theme-search/theme-search.component.spec.ts
+++ b/src/app/theme/theme-search/theme-search.component.spec.ts
@@ -8,7 +8,7 @@ import { TranslateTestingModule } from 'ngx-translate-testing'
import { DataViewModule } from 'primeng/dataview'
import { of } from 'rxjs'
-import { ThemesAPIService } from 'src/app/shared/generated'
+import { Theme, ThemesAPIService } from 'src/app/shared/generated'
import { ThemeSearchComponent } from './theme-search.component'
describe('ThemeSearchComponent', () => {
@@ -147,4 +147,24 @@ describe('ThemeSearchComponent', () => {
component.onImportThemeClick()
expect(component.themeImportDialogVisible).toBe(true)
})
+
+ it('should sort themes by display name ', () => {
+ let a: Theme = {
+ name: 'a',
+ displayName: 'a'
+ }
+ let b: Theme = {
+ name: 'b',
+ displayName: 'b'
+ }
+ let c: Theme = {
+ name: 'c',
+ displayName: 'c'
+ }
+ const themes = [b, c, a]
+
+ themes.sort((x, y) => component.sortThemesByName(x, y))
+
+ expect(themes).toEqual([a, b, c])
+ })
})
diff --git a/src/app/theme/theme-search/theme-search.component.ts b/src/app/theme/theme-search/theme-search.component.ts
index cfabd45..5a20271 100644
--- a/src/app/theme/theme-search/theme-search.component.ts
+++ b/src/app/theme/theme-search/theme-search.component.ts
@@ -18,7 +18,7 @@ export class ThemeSearchComponent implements OnInit {
public actions$: Observable | undefined
public viewMode = 'grid'
public filter: string | undefined
- public sortField = 'name'
+ public sortField = 'displayName'
public sortOrder = 1
public limitText = limitText
@@ -43,11 +43,15 @@ export class ThemeSearchComponent implements OnInit {
public loadThemes(): void {
this.themes$ = this.themeApi.getThemes({})
}
+ public sortThemesByName(a: Theme, b: Theme): number {
+ return (a.displayName ?? '').toUpperCase().localeCompare((b.displayName ?? '').toUpperCase())
+ }
private prepareTranslations() {
this.translate
.get([
'THEME.NAME',
+ 'THEME.DISPLAY_NAME',
'SEARCH.SORT_BY',
'SEARCH.FILTER',
'SEARCH.FILTER_OF',
@@ -62,7 +66,7 @@ export class ThemeSearchComponent implements OnInit {
this.dataViewControlsTranslations = {
sortDropdownPlaceholder: data['SEARCH.SORT_BY'],
filterInputPlaceholder: data['SEARCH.FILTER'],
- filterInputTooltip: data['SEARCH.FILTER_OF'] + data['THEME.NAME'],
+ filterInputTooltip: data['SEARCH.FILTER_OF'] + data['THEME.DISPLAY_NAME'] + ', ' + data['THEME.NAME'],
viewModeToggleTooltips: {
grid: data['GENERAL.TOOLTIP.VIEW_MODE_GRID'],
list: data['GENERAL.TOOLTIP.VIEW_MODE_LIST']
diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json
index 74dcc53..1865bd3 100644
--- a/src/assets/i18n/de.json
+++ b/src/assets/i18n/de.json
@@ -76,8 +76,8 @@
"CREATION_USER": "Erstellt von",
"MODIFICATION_DATE": "Geändert am",
"MODIFICATION_USER": "Geändert von",
- "OPERATOR": "Erstellt durch Operator",
- "OPERATOR_MESSAGE": "Dieses Theme wurde durch den Operator erstellt. Alle Änderungen gehen beim nächsten Deployment verloren.",
+ "OPERATOR": "Automatisiert erstellt",
+ "OPERATOR_MESSAGE": "Dieses Theme wurde automatisiert erstellt. Alle Änderungen gehen beim nächsten Deployment verloren.",
"TOOLTIPS": {
"CREATION_DATE": "Zeitpunkt der Erstellung",
"CREATION_USER": "Name des Benutzers der Erstellung",
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index ca8f624..5060f01 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -17,7 +17,7 @@
},
"DELETE": {
"LABEL": "Delete",
- "TOOLTIP": "Delete theme",
+ "TOOLTIP": "Delete Theme",
"THEME_MESSAGE": "Do you want to delete \"{{ITEM}}\"?",
"MESSAGE_INFO": "This action cannot be undone!",
"THEME_NOK": "Theme could not be deleted",
@@ -29,7 +29,7 @@
"MESSAGE": {
"CHANGE_OK": "The Theme was changed successfully",
"CHANGE_NOK": "An error has occurred. The Theme was not changed.",
- "IMAGE_CONSTRAINT": "An error has occurred. Please add a theme name before uploading a file.",
+ "IMAGE_CONSTRAINT": "An error has occurred. Please add a Theme name before uploading a file.",
"IMAGE_CONSTRAINT_SIZE": "An error has occurred. The image is too large."
}
},
@@ -63,7 +63,7 @@
"TOOLTIPS": {
"CANCEL_AND_CLOSE": "Cancel and close dialog",
"SAVE": "Save changes",
- "SAVE_AS": "Save as new theme"
+ "SAVE_AS": "Save as new Theme"
}
},
"BREADCRUMBS": {
@@ -76,14 +76,14 @@
"CREATION_USER": "Created by",
"MODIFICATION_DATE": "Changed on",
"MODIFICATION_USER": "Changed by",
- "OPERATOR": "Created by Operator",
- "OPERATOR_MESSAGE": "This theme was created by the operator. All changes will be lost during the next deployment.",
+ "OPERATOR": "Automated created",
+ "OPERATOR_MESSAGE": "This Theme was automated created. All changes will be lost during the next deployment.",
"TOOLTIPS": {
"CREATION_DATE": "Timestamp of the creation",
"CREATION_USER": "Name of the user of the creation",
"MODIFICATION_DATE": "Timestamp of the last change",
"MODIFICATION_USER": "Name of the user of the last change",
- "OPERATOR": "If set, the theme cannot be deleted and all changes will be lost during the next deployment."
+ "OPERATOR": "If set, the Theme cannot be deleted and all changes will be lost during the next deployment."
}
},
"GENERAL": {