Skip to content

Commit

Permalink
apply formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Dec 13, 2024
1 parent 75ccb81 commit 1b1712f
Show file tree
Hide file tree
Showing 36 changed files with 157 additions and 119 deletions.
12 changes: 9 additions & 3 deletions frontend/cypress/e2e/scoring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ describe("Scoring component e2e tests", () => {
stretchgoal,
value]) => {
it("Create metric checkin and validate value of scoring component", () => {
setupMetricKR(`Metric kr with check-in value ${value}`, baseline, stretchgoal, value);
setupMetricKR(
`Metric kr with check-in value ${value}`, baseline, stretchgoal, value
);
const percentage = getPercentageMetric(baseline, stretchgoal, value);
cy.validateScoring(false, percentage);
cy.get(".keyResult-detail-attribute-show")
Expand Down Expand Up @@ -59,7 +61,9 @@ describe("Scoring component e2e tests", () => {
stretchgoal,
value]) => {
it("show indicator that value is negative", () => {
setupMetricKR(`Check indicator with value ${value}`, baseline, stretchgoal, value);
setupMetricKR(
`Check indicator with value ${value}`, baseline, stretchgoal, value
);
cy.validateScoring(false, 0);
cy.get(".keyResult-detail-attribute-show")
.contains("Aktuell")
Expand Down Expand Up @@ -107,7 +111,9 @@ describe("Scoring component e2e tests", () => {
});
});

function setupMetricKR (name: string, baseline: number, stretchgoal: number, value: number) {
function setupMetricKR (
name: string, baseline: number, stretchgoal: number, value: number
) {
CyOverviewPage.do()
.addKeyResult()
.fillKeyResultTitle(name)
Expand Down
12 changes: 9 additions & 3 deletions frontend/cypress/support/helper/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ export function pressUntilContains (text: string, key: keyof typeof keyCodeDefin
pressUntil(key, condition);
}

export function doUntilSelector (selector: string, tab: () => void, limit = 100, count = 0) {
export function doUntilSelector (
selector: string, tab: () => void, limit = 100, count = 0
) {
const condition = (element: HTMLElement) => Cypress.$(element)
.is(selector);
doUntil(condition, tab, limit, count);
doUntil(
condition, tab, limit, count
);
}

function pressUntil (key: keyof typeof keyCodeDefinitions, condition: (elem: HTMLElement) => boolean) {
Expand All @@ -34,7 +38,9 @@ function doUntil (
return;
} else {
tab();
doUntil(condition, tab, limit, count + 1);
doUntil(
condition, tab, limit, count + 1
);
}
});
}
6 changes: 2 additions & 4 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ import { DomSanitizer } from "@angular/platform-browser";
export class AppComponent {
readonly PATH_PREFIX = "../assets/icons/";

constructor (
private matIconRegistry: MatIconRegistry,
private domSanitizer: DomSanitizer
) {
constructor (private matIconRegistry: MatIconRegistry,
private domSanitizer: DomSanitizer) {
this.matIconRegistry.addSvgIcon("pz-search", this.domSanitizer.bypassSecurityTrustResourceUrl(this.PATH_PREFIX + "search-icon.svg"));
this.matIconRegistry.addSvgIcon("pz-menu-icon", this.domSanitizer.bypassSecurityTrustResourceUrl(this.PATH_PREFIX + "three-dot-menu-icon.svg"));
}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/components/action-plan/action-plan.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ export class ActionPlanComponent {
@ViewChildren("listItem")
listItems!: QueryList<ElementRef>;

constructor (
private actionService: ActionService,
public dialogService: DialogService
) {}
constructor (private actionService: ActionService,
public dialogService: DialogService) {}

handleKeyDown (event: Event, currentIndex: number) {
let newIndex = currentIndex;
Expand Down Expand Up @@ -79,7 +77,9 @@ export class ActionPlanComponent {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data!, event.previousIndex, event.currentIndex);
} else {
transferArrayItem(event.previousContainer.data!, event.container.data!, event.previousIndex, event.currentIndex);
transferArrayItem(
event.previousContainer.data!, event.container.data!, event.previousIndex, event.currentIndex
);
}
this.adjustPriorities();
this.activeItem = event.currentIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ describe("KeyResultFormComponent", () => {
const keyResultObjective: KeyResultObjective = {
id: 2,
state: State.ONGOING,
quarter: new Quarter(1, "GJ 22/23-Q2", new Date(), new Date())
quarter: new Quarter(
1, "GJ 22/23-Q2", new Date(), new Date()
)
};

const keyResultFormGroup = new FormGroup({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ export class KeyResultFormComponent implements OnInit, OnDestroy {
@Input()
keyResult!: KeyResult | null;

constructor (
public userService: UserService,
constructor (public userService: UserService,
private oauthService: OAuthService,
private translate: TranslateService
) {}
private translate: TranslateService) {}

ngOnInit (): void {
this.users$ = this.userService.getUsers();
Expand Down Expand Up @@ -118,7 +116,9 @@ export class KeyResultFormComponent implements OnInit, OnDestroy {
return this.keyResultForm.get(name)?.dirty || this.keyResultForm.get(name)?.touched;
}

getErrorMessage (error: string, field: string, firstNumber: number | null, secondNumber: number | null): string {
getErrorMessage (
error: string, field: string, firstNumber: number | null, secondNumber: number | null
): string {
return field + this.translate.instant("DIALOG_ERRORS." + error)
.format(firstNumber, secondNumber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ describe("KeyresultDialogComponent", () => {
const keyResultObjective: KeyResultObjective = {
id: 2,
state: State.ONGOING,
quarter: new Quarter(1, "GJ 22/23-Q2", new Date(), new Date())
quarter: new Quarter(
1, "GJ 22/23-Q2", new Date(), new Date()
)
};

const fullKeyResultMetric = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export class KeyresultTypeComponent implements OnInit {
}
}

getErrorMessage (error: string, field: string, firstNumber: number | null, secondNumber: number | null): string {
getErrorMessage (
error: string, field: string, firstNumber: number | null, secondNumber: number | null
): string {
return field + this.translate.instant("DIALOG_ERRORS." + error)
.format(firstNumber, secondNumber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ export class ObjectiveFilterComponent implements OnInit {

query = "";

constructor (
private router: Router,
private route: ActivatedRoute
) {
constructor (private router: Router,
private route: ActivatedRoute) {
this.refresh.pipe(debounceTime(300))
.subscribe(() => this.updateURL());
}
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/app/components/objective/ObjectiveMenuActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ import {
import { ObjectiveMenuAfterActions } from "./ObjectiveMenuAfterActions";

export class ObjectiveMenuActions {
constructor (
private readonly dialogService: DialogService,
constructor (private readonly dialogService: DialogService,
private readonly refreshDataService: RefreshDataService,
private readonly afterActions: ObjectiveMenuAfterActions
) {}
private readonly afterActions: ObjectiveMenuAfterActions) {}

releaseFromQuarterAction (objective: ObjectiveMin): ObjectiveMenuEntry {
const action: ObjectiveMenuAction = () => this.dialogService.openConfirmDialog("CONFIRMATION.RELEASE");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { ObjectiveMin } from "../../shared/types/model/ObjectiveMin";
import { CompletedService } from "../../services/completed.servce";

export class ObjectiveMenuAfterActions {
constructor (
private readonly objectiveService: ObjectiveService,
constructor (private readonly objectiveService: ObjectiveService,
private readonly completedService: CompletedService,
private readonly refreshDataService: RefreshDataService
) {}
private readonly refreshDataService: RefreshDataService) {}

completeObjective (objectiveMin: ObjectiveMin, result: { endState: string;
comment: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ describe("OverviewComponent", () => {
[],
"a a"
]
])("should load overview based on queryparams", async (query: string, quarterParam?: number, teamsParam?: number[], objectiveQueryParam?: string) => {
])("should load overview based on queryparams", async (
query: string, quarterParam?: number, teamsParam?: number[], objectiveQueryParam?: string
) => {
jest.spyOn(overviewService, "getOverview");
jest.spyOn(component, "loadOverview");
const routerHarness = await RouterTestingHarness.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ const overviewService = {
};

const quarters = [
new Quarter(999, "Backlog", null, null),
new Quarter(2, "23.02.2025", new Date(), new Date()),
new Quarter(5, "23.02.2025", new Date(), new Date()),
new Quarter(7, "23.02.2025", new Date(), new Date())
new Quarter(
999, "Backlog", null, null
),
new Quarter(
2, "23.02.2025", new Date(), new Date()
),
new Quarter(
5, "23.02.2025", new Date(), new Date()
),
new Quarter(
7, "23.02.2025", new Date(), new Date()
)
];

const quarterService = {
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/app/components/team/team.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ export class TeamComponent {

addIconSrc = new BehaviorSubject<string>("assets/icons/new-icon.svg");

constructor (
private dialogService: DialogService,
constructor (private dialogService: DialogService,
private refreshDataService: RefreshDataService,
private configService: ConfigService
) {
private configService: ConfigService) {
this.configService.config$.pipe(first())
.subscribe((config: ClientConfig) => {
const configuredIconSrc = config.customStyles["okr-add-objective-icon"];
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/app/interceptors/error-interceptor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ import { ToasterType } from "../shared/types/enums/ToasterType";

@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
constructor (
private router: Router,
constructor (private router: Router,
private toasterService: ToasterService,
private translate: TranslateService
) {}
private translate: TranslateService) {}

intercept (request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
return next.handle(request)
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/app/interceptors/error.interceptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ describe("ErrorInterceptor", () => {
"KEYRESULT",
ToasterType.SUCCESS,
"Keyresult wurde gelöscht"
]])("handleSuccessToaster should show toaster ", (url: string, code: number, method: HttpType, key: string, toasterType: ToasterType, message: string) => {
]])("handleSuccessToaster should show toaster ", (
url: string, code: number, method: HttpType, key: string, toasterType: ToasterType, message: string
) => {
const SUCCESS_PREFIX = "SUCCESS.";
jest.spyOn(translator, "instant")
.mockReturnValue(message);
Expand Down Expand Up @@ -283,7 +285,9 @@ describe("ErrorInterceptor", () => {
HttpType.DELETE,
undefined
]
])("getSuccessMessageKey should work", (url: string, code: number, method: HttpType, result: any) => {
])("getSuccessMessageKey should work", (
url: string, code: number, method: HttpType, result: any
) => {
const successMessageKey = interceptor.getSuccessMessageKey(url, code, method);
expect(successMessageKey)
.toStrictEqual(result);
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/app/services/customization.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ import { ConfigService } from "./config.service";
export class CustomizationService {
private currentConfig?: CustomizationConfig;

constructor (
configService: ConfigService,
@Inject(DOCUMENT) private document: Document
) {
constructor (configService: ConfigService,
@Inject(DOCUMENT) private document: Document) {
configService.config$.subscribe((config) => {
this.updateCustomizations(config);
});
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/app/services/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ export class DialogService {
autoFocus: "first-tabbable"
};

constructor (
private readonly dialog: MatDialog,
private readonly translationService: TranslateService
) {}
constructor (private readonly dialog: MatDialog,
private readonly translationService: TranslateService) {}

open<T, D = any, R = any>(component: ComponentType<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R> {
return this.dialog.open(component, {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/app/services/quarter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class QuarterService {
getAllQuarters (): Observable<Quarter[]> {
return this.http
.get<Quarter[]>("/api/v2/quarters")
.pipe(map((quarters) => quarters.map((quarter) => new Quarter(quarter.id, quarter.label, quarter.startDate, quarter.endDate))));
.pipe(map((quarters) => quarters.map((quarter) => new Quarter(
quarter.id, quarter.label, quarter.startDate, quarter.endDate
))));
}

getCurrentQuarter (): Observable<Quarter> {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/app/shared/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ describe("test common functions", () => {
-10,
0
]
])("should calculate progress correctly", async (baseline: number, stretchGoal: number, value: number, filledPercentage: number) => {
])("should calculate progress correctly", async (
baseline: number, stretchGoal: number, value: number, filledPercentage: number
) => {
const keyResult = {
...keyResultMetricMinScoring,
baseline: baseline,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ export class CompleteDialogComponent {

protected readonly hasFormFieldErrors = hasFormFieldErrors;

constructor (
public dialogRef: MatDialogRef<CompleteDialogComponent>,
constructor (public dialogRef: MatDialogRef<CompleteDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: { objectiveTitle: string },
private translate: TranslateService
) {}
private translate: TranslateService) {}

switchSuccessState (input: string) {
this.removeStandardHover();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ export class ConfirmDialogComponent implements OnInit {

closeButtonState?: ButtonState;

constructor (
@Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData,
public dialogRef: MatDialogRef<ConfirmDialogComponent>
) {}
constructor (@Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData,
public dialogRef: MatDialogRef<ConfirmDialogComponent>) {}

ngOnInit () {
this.dialogTitle = this.data.title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ export class ExampleDialogComponent {
hobby: new FormControl<string>("", [Validators.required])
});

constructor (
public dialog: MatDialogRef<ExampleDialogComponent>,
@Inject(MAT_DIALOG_DATA) private data: any
) {}
constructor (public dialog: MatDialogRef<ExampleDialogComponent>,
@Inject(MAT_DIALOG_DATA) private data: any) {}

save () {
this.dialog.close({ data: this.dialogForm.value });
Expand Down
Loading

0 comments on commit 1b1712f

Please sign in to comment.