diff --git a/frontend/src/app/components/objective/objective.component.html b/frontend/src/app/components/objective/objective.component.html
index 54ddd22757..6d6e8115dc 100644
--- a/frontend/src/app/components/objective/objective.component.html
+++ b/frontend/src/app/components/objective/objective.component.html
@@ -15,7 +15,7 @@
[src]="'assets/icons/' + objective.state"
alt="The objectives state"
class="icon"
- matTooltip="{{ getStateTooltip() + ' ' + formatObjectiveState(objective.state) }}"
+ matTooltip="{{ getStateTooltip(objective.state) }}"
matTooltipPosition="above"
/>
{{ objective.title }}
diff --git a/frontend/src/app/components/objective/objective.component.ts b/frontend/src/app/components/objective/objective.component.ts
index f0623ac54a..e79de7c11b 100644
--- a/frontend/src/app/components/objective/objective.component.ts
+++ b/frontend/src/app/components/objective/objective.component.ts
@@ -1,10 +1,10 @@
import { Component, Input, OnInit } from '@angular/core';
import { ObjectiveMin } from '../../shared/types/model/ObjectiveMin';
import { Router } from '@angular/router';
-import { BehaviorSubject, map } from 'rxjs';
+import { map, Subject } from 'rxjs';
import { RefreshDataService } from '../../services/refresh-data.service';
import { ObjectiveService } from '../../services/objective.service';
-import { isObjectiveComplete, trackByFn } from '../../shared/common';
+import { getStateByValue, isObjectiveComplete, trackByFn } from '../../shared/common';
import { KeyresultDialogComponent } from '../keyresult-dialog/keyresult-dialog.component';
import { TranslateService } from '@ngx-translate/core';
import { DialogService } from '../../services/dialog.service';
@@ -17,11 +17,9 @@ import { ObjectiveMenuActionsService, ObjectiveMenuEntry } from '../../services/
})
export class ObjectiveComponent implements OnInit {
@Input() isWritable!: boolean;
- isComplete: boolean = false;
- public objective$ = new BehaviorSubject({} as ObjectiveMin);
+ public objective$ = new Subject();
menuEntries = this.objective$.pipe(map((objective) => this.objectiveMenuActionsService.getMenu(objective)));
protected readonly trackByFn = trackByFn;
- protected readonly console = console;
protected readonly isObjectiveComplete = isObjectiveComplete;
constructor(
@@ -39,17 +37,9 @@ export class ObjectiveComponent implements OnInit {
ngOnInit() {}
- formatObjectiveState(state: string): string {
- const lastIndex = state.lastIndexOf('-');
- if (lastIndex !== -1) {
- return state.substring(0, lastIndex).toUpperCase();
- } else {
- return state.toUpperCase();
- }
- }
-
- getStateTooltip(): string {
- return this.translate.instant('INFORMATION.OBJECTIVE_STATE_TOOLTIP');
+ getStateTooltip(stateString: string): string {
+ const state = getStateByValue(stateString);
+ return this.translate.instant('INFORMATION.OBJECTIVE_STATE_TOOLTIP', { state: state });
}
redirect(menuEntry: ObjectiveMenuEntry, objectiveMin: ObjectiveMin) {
diff --git a/frontend/src/app/shared/common.ts b/frontend/src/app/shared/common.ts
index a896202089..4429ac44ad 100644
--- a/frontend/src/app/shared/common.ts
+++ b/frontend/src/app/shared/common.ts
@@ -113,3 +113,7 @@ export function hasFormFieldErrors(formGroup: FormGroup, field: string) {
return false;
}
}
+
+export function getStateByValue(value: string): string {
+ return Object.keys(State).find((key) => State[key as keyof typeof State] === value) ?? '';
+}
diff --git a/frontend/src/assets/i18n/de.json b/frontend/src/assets/i18n/de.json
index 61b67dd9b2..28079fba2e 100644
--- a/frontend/src/assets/i18n/de.json
+++ b/frontend/src/assets/i18n/de.json
@@ -23,10 +23,7 @@
"ordinal": "Ordinal"
},
"INFORMATION": {
- "OBJECTIVE_STATE_TOOLTIP": "Der Status dieses Objectives ist",
- "DELETE_TEAM": "Möchtest du dieses Team wirklich löschen? Zugehörige Objectives werden dadurch in allen Quartalen ebenfalls gelöscht!",
- "DELETE_OBJECTIVE": "Möchtest du dieses Objective wirklich löschen? Zugehörige Key Results werden dadurch ebenfalls gelöscht!",
- "DELETE_KEY_RESULT": "Möchtest du dieses Key Result wirklich löschen? Zugehörige Check-ins werden dadurch ebenfalls gelöscht!"
+ "OBJECTIVE_STATE_TOOLTIP": "Der Status dieses Objectives ist: {{state}}"
},
"CONFIRMATION": {
"DRAFT_CREATE": {
@@ -58,7 +55,7 @@
"TITLE": "Objective löschen",
"TEXT": "Möchtest du dieses Objective wirklich löschen? Zugehörige Key Results werden dadurch ebenfalls gelöscht!"
},
- "KEYRESULT":{
+ "KEY_RESULT":{
"TITLE": "Key Result löschen\n",
"TEXT": "Möchtest du dieses Key Result wirklich löschen? Zugehörige Check-ins werden dadurch ebenfalls gelöscht!"
}