Skip to content

Commit

Permalink
Include display name in workspace import (#290)
Browse files Browse the repository at this point in the history
* feat: include display name in import steps

* feat: finish display name changes

* fix: translations

---------

Co-authored-by: Christian Badura <[email protected]>
  • Loading branch information
cbadura and Christian Badura authored Aug 9, 2024
1 parent b8b087d commit 302db1b
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/app/workspace/workspace-import/confirm/confirm.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@
/>
<label for="workspace_import_confirm_base_url">{{ 'WORKSPACE.BASE_URL' | translate }}</label>
</span>
<span class="p-float-label">
<input
pInputText
type="text"
readonly
class="w-16rem"
id="workspace_import_confirm_display_name"
[(ngModel)]="displayName"
[pTooltip]="'WORKSPACE_IMPORT.DISPLAY_NAME.TOOLTIP' | translate"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label for="workspace_import_confirm_display_name">{{ 'WORKSPACE.DISPLAY_NAME' | translate }}</label>
</span>
</div>

<div class="flex flex-wrap align-items-center row-gap-1 my-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { WorkspaceAPIService, SearchWorkspacesResponse, WorkspaceAbstract } from
})
export class ConfirmComponent implements OnInit {
@Input() public workspaceName?: string
@Input() public displayName?: string
@Input() public themeName?: string
@Input() public hasPermission = false
@Input() public baseUrl?: string
Expand Down
18 changes: 18 additions & 0 deletions src/app/workspace/workspace-import/preview/preview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@
</label>
</span>
</div>
<div>
<span class="p-float-label" controlErrorAnchor>
<input
pInputText
type="text"
class="w-16rem"
id="workspace_import_preview_display_name"
formControlName="displayName"
(keyup)="onModelChange()"
[pTooltip]="'WORKSPACE_IMPORT.DISPLAY_NAME.TOOLTIP' | translate"
tooltipPosition="top"
tooltipEvent="hover"
/>
<label class="ocx-required-label" for="workspace_import_preview_base_url">
{{ 'WORKSPACE.DISPLAY_NAME' | translate }}
</label>
</span>
</div>
</div>

<p-tabView styleClass="mt-4 mb-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class PreviewComponent implements OnInit, OnChanges {
public formGroup!: FormGroup
public themes$: Observable<SelectItem<string>[]>
public workspaceName = ''
public displayName = ''
public themeName!: string
public baseUrl = ''
public themeProperties: any = null
Expand All @@ -36,6 +37,7 @@ export class PreviewComponent implements OnInit, OnChanges {
constructor(private workspaceApi: WorkspaceAPIService) {
this.formGroup = new FormGroup({
workspaceName: new FormControl(null, [Validators.required, Validators.minLength(2), Validators.maxLength(50)]),
displayName: new FormControl(null, [Validators.required, Validators.minLength(2), Validators.maxLength(50)]),
theme: new FormControl(null),
baseUrl: new FormControl(null, [Validators.required, Validators.minLength(2), Validators.maxLength(100)])
})
Expand All @@ -47,6 +49,7 @@ export class PreviewComponent implements OnInit, OnChanges {
if (this.importRequestDTO.workspaces) {
key = Object.keys(this.importRequestDTO.workspaces)
this.workspaceName = this.importRequestDTO.workspaces[key[0]].name ?? ''
this.displayName = this.importRequestDTO.workspaces[key[0]].displayName ?? ''
this.themeName = this.importRequestDTO?.workspaces[key[0]].theme
? this.importRequestDTO?.workspaces[key[0]].theme
: this.formGroup.controls['theme'].value || ''
Expand All @@ -71,6 +74,7 @@ export class PreviewComponent implements OnInit, OnChanges {
}
if (this.importRequestDTO.workspaces) {
this.formGroup.controls['workspaceName'].setValue(this.importRequestDTO?.workspaces[key[0]].name)
this.formGroup.controls['displayName'].setValue(this.importRequestDTO?.workspaces[key[0]].displayName)
this.formGroup.controls['theme'].setValue(this.importRequestDTO?.workspaces[key[0]].theme)
this.formGroup.controls['baseUrl'].setValue(this.importRequestDTO?.workspaces[key[0]].baseUrl)
}
Expand All @@ -94,10 +98,12 @@ export class PreviewComponent implements OnInit, OnChanges {
} else {
this.workspaceName = key[0]
}
this.displayName = this.formGroup.controls['displayName'].value
this.themeName = this.formGroup.controls['theme'].value
this.baseUrl = this.formGroup.controls['baseUrl'].value

this.importRequestDTO.workspaces[this.workspaceName].name = this.workspaceName
this.importRequestDTO.workspaces[this.workspaceName].displayName = this.displayName
this.importRequestDTO.workspaces[this.workspaceName].theme = this.themeName
this.importRequestDTO.workspaces[this.workspaceName].baseUrl = this.baseUrl
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*ngSwitchCase="2"
[hasPermission]="hasPermission"
[workspaceName]="workspaceName"
[displayName]="displayName"
[baseUrl]="baseUrl"
[themeName]="themeName"
(isLoading)="handleIsLoading($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export class WorkspaceImportComponent implements OnInit, OnChanges {
public isLoading = false
public workspaceName = ''
public workspaceNameOrg = ''
public displayName = ''
public displayNameOrg = ''
public themeName = ''
public baseUrl = ''
public baseUrlOrg: string | undefined = undefined // the original
Expand Down Expand Up @@ -71,6 +73,7 @@ export class WorkspaceImportComponent implements OnInit, OnChanges {
this.baseUrl = ''
this.baseUrlOrg = ''
this.workspaceNameOrg = ''
this.displayNameOrg = ''
this.isFormValid = true
this.importRequestDTO = undefined
this.activeIndex = 0
Expand Down Expand Up @@ -155,10 +158,12 @@ export class WorkspaceImportComponent implements OnInit, OnChanges {
keys = Object.keys(this.importRequestDTO.workspaces)
}
this.workspaceNameOrg = importRequestDTO.workspaces[keys[0]].name ?? ''
this.displayNameOrg = importRequestDTO.workspaces[keys[0]].displayName ?? ''
this.themeName = importRequestDTO.workspaces[keys[0]].theme ?? ''
this.baseUrlOrg = importRequestDTO.workspaces[keys[0]].baseUrl
} else if (this.activeIndex == 1) {
this.workspaceName = this.previewComponent?.workspaceName ?? ''
this.displayName = this.previewComponent?.displayName ?? ''
this.themeName = this.previewComponent?.themeName ?? ''
this.baseUrl = this.previewComponent?.baseUrl ?? ''
}
Expand All @@ -171,6 +176,7 @@ export class WorkspaceImportComponent implements OnInit, OnChanges {
const key: string[] = Object.keys(this.importRequestDTO.workspaces)
if (this.activeIndex == 2 && this.importRequestDTO?.workspaces) {
this.importRequestDTO.workspaces[key[0]].name = this.confirmComponent?.workspaceName ?? ''
this.importRequestDTO.workspaces[key[0]].displayName = this.confirmComponent?.displayName ?? ''
this.importRequestDTO.workspaces[key[0]].baseUrl = this.confirmComponent?.baseUrl ?? ''
this.importRequestDTO.workspaces[key[0]].theme = this.confirmComponent?.themeName ?? ''
}
Expand Down
9 changes: 6 additions & 3 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,9 @@
"CONFIRMATION": "Bestätigung",
"SUMMARY": "Zusammenfassung",
"THEME_NAME.TOOLTIP": "Name des verwendeten Themes. Kann später geändert werden.",
"WORKSPACE_NAME": "Workspace",
"WORKSPACE_NAME": "Name",
"WORKSPACE_NAME.TOOLTIP": "Eindeutiger Name des neuen Workspaces. Die Eindeutigkeit wird im nächsten Schritt geprüft.",
"DISPLAY_NAME.TOOLTIP": "Anzeigename des neuen Workspace, der nachträglich geändert werden kann.",
"WORKSPACE_IMPORT_OK": "Die Workspace-Definition wurde geprüft und kann importiert werden.",
"WORKSPACE_EXISTS_MESSAGE": "Ein Workspace mit diesem Namen existiert bereits. Dessen Definition wird überschrieben.",
"BASE_URL.TOOLTIP": "Base URL des Workspaces. Muss eindeutig sein weil sie für den Zugriff auf den Workspace benutzt wird. Das wird im nächsten Schritt geprüft.",
Expand All @@ -508,7 +509,7 @@
"RESPONSE.CREATED": "Der Workspace wurde erfolgreich erstellt.",
"RESPONSE.UPDATED": "Der Workspace wurde erfolgreich geändert.",
"RESPONSE.ERROR": "Ein Fehler ist aufgetreten. Der Workspace konnte nicht erstellt/aktualisiert werden.",
"INVALID_IMPORT_FILE": "Die Workspace Import-Datei ist nicht gültig",
"INVALID_IMPORT_FILE": "Die Workspace Import-Datei ist nicht gültig.",
"MISSING": "fehlen.",
"INVALID_MENU_ITEMS": "Ein oder mehrere der Menü-Items sind nicht gültig.",
"WORKSPACE_FORM_MISSING_FILES": " Workspace-Datei fehlt.",
Expand All @@ -522,7 +523,9 @@
"VALIDATION_MENU_ITEM_WRONG_POSITION": "In einem Menüpunkt ist der Wert für 'position' keine Zahl",
"VALIDATION_MENU_ITEM_WRONG_DISABLED": "In einem Menüpunkt ist der Wert für 'disabled' kein Boolean",
"VALIDATION_MENU_ITEM_WRONG_WORKSPACEEXIT": "In einem Menüpunkt ist der Wert für 'workspaceExit' kein Boolean",
"VALIDATION_RESULT": "Verarbeitung nicht möglich: "
"VALIDATION_RESULT": "Verarbeitung nicht möglich: ",
"WORKSPACE_IMPORT_ERROR": "Ein Fehler ist aufgetreten. Workspace für den Import konnte nicht geladen werden.",
"WORKSPACE_IMPORT_NOK": "Ein Fehler ist aufgetreten. Workspace konnte nicht importiert werden."
},
"IMAGE": {
"LOGO_URL": "Externe Logo URL",
Expand Down
9 changes: 6 additions & 3 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,10 @@
"PREVIEW_MENU": "Menu Structure",
"CONFIRMATION": "Confirmation",
"SUMMARY": "Summary",
"THEME_NAME.TOOLTIP": "Name of the used Themes. Can be changed later.",
"WORKSPACE_NAME": "Workspace",
"THEME_NAME.TOOLTIP": "Name of the used Theme. Can be changed later.",
"WORKSPACE_NAME": "Name",
"WORKSPACE_NAME.TOOLTIP": "Unique name of the new Workspace. Uniqueness is checked in next step.",
"DISPLAY_NAME.TOOLTIP": "Display name of the new Workspace, can be changed afterwards.",
"WORKSPACE_IMPORT_OK": "The Workspace definition has been checked and can be imported.",
"WORKSPACE_EXISTS_MESSAGE": "A Workspace with this name already exists. Its definition is overwritten.",
"BASE_URL.TOOLTIP": "Base URL of the Workspace. Must be unique because it is used to access the Workspace. Uniqueness is checked in next step",
Expand All @@ -522,7 +523,9 @@
"VALIDATION_MENU_ITEM_WRONG_POSITION": "In a Menu Item, the value for 'position' is not a number",
"VALIDATION_MENU_ITEM_WRONG_DISABLED": "In a Menu Item, the value for 'disabled' is not a boolean",
"VALIDATION_MENU_ITEM_WRONG_WORKSPACEEXIT": "In a Menu Item, the value for 'workspaceExit' is not a boolean",
"VALIDATION_RESULT": "Processing not possible: "
"VALIDATION_RESULT": "Processing not possible: ",
"WORKSPACE_IMPORT_ERROR": "An error occurred, the Workspace could not be loaded for import.",
"WORKSPACE_IMPORT_NOK": "An error occurred, the Workspace could not be imported."
},
"IMAGE": {
"LOGO_URL": "External Logo URL",
Expand Down

0 comments on commit 302db1b

Please sign in to comment.