Skip to content

Commit

Permalink
run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Dec 16, 2024
1 parent 11837c8 commit 1cf9c5d
Show file tree
Hide file tree
Showing 50 changed files with 499 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import ch.puzzle.okr.mapper.keyresult.KeyResultMapper;
import ch.puzzle.okr.models.Action;
import ch.puzzle.okr.models.Objective;
import ch.puzzle.okr.models.keyresult.KeyResult;
import ch.puzzle.okr.service.authorization.ActionAuthorizationService;
import ch.puzzle.okr.service.authorization.ObjectiveAuthorizationService;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -58,9 +57,10 @@ public ResponseEntity<ObjectiveDto> getObjective(@Parameter(description = "The I
@ApiResponse(responseCode = "401", description = "Not authorized to read KeyResults from an Objective", content = @Content),
@ApiResponse(responseCode = "404", description = "Did not find an Objective with the specified ID to get KeyResults from.", content = @Content) })
@GetMapping("/{id}/keyResults")
public ResponseEntity<List<KeyResultDto>> getKeyResultsFromObjective(
@Parameter(description = "The ID for getting all KeyResults of an Objective", required = true) @PathVariable long id) {
return ResponseEntity.status(OK)
public ResponseEntity<List<KeyResultDto>> getKeyResultsFromObjective(@Parameter(description = "The ID for getting all KeyResults of an Objective", required = true)
@PathVariable long id) {
return ResponseEntity
.status(OK)
.body(objectiveAuthorizationService.getAllKeyResultsByObjective(id).stream().map(keyResult -> {
List<Action> actionList = actionAuthorizationService.getActionsByKeyResult(keyResult);
return keyResultMapper.toDto(keyResult, actionList);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ch.puzzle.okr.dto;

import ch.puzzle.okr.dto.keyresult.KeyResultDto;

import java.util.List;

public record DuplicateObjectiveDto(ObjectiveDto objective, List<KeyResultDto> keyResults) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import ch.puzzle.okr.models.authorization.AuthorizationUser;
import ch.puzzle.okr.models.keyresult.KeyResult;
import ch.puzzle.okr.service.business.ObjectiveBusinessService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;
import org.springframework.stereotype.Service;

@Service
public class ObjectiveAuthorizationService extends AuthorizationServiceBase<Long, Objective, ObjectiveBusinessService> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Objective createEntity(Objective objective, AuthorizationUser authorizati
*/
@Transactional
public Objective duplicateObjective(Long id, Objective objective, AuthorizationUser authorizationUser,
List<KeyResult> keyResults) {
List<KeyResult> keyResults) {
Objective duplicatedObjective = createEntity(objective, authorizationUser);
for (KeyResult keyResult : keyResults) {
duplicateKeyResult(authorizationUser, keyResult, duplicatedObjective);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ void throwExceptionWhenObjectiveWithIdCantBeFoundWhileDeleting() throws Exceptio

@Test
void shouldReturnIsCreatedWhenObjectiveWasDuplicated() throws Exception {
BDDMockito.given(objectiveAuthorizationService.duplicateEntity(anyLong(), any(), anyList()))
BDDMockito
.given(objectiveAuthorizationService.duplicateEntity(anyLong(), any(), anyList()))
.willReturn(objective1);
BDDMockito.given(keyResultMapper.toDto(any(KeyResultMetric.class), any())).willReturn(keyResultMetricDto);
BDDMockito.given(keyResultMapper.toDto(any(KeyResultOrdinal.class), any())).willReturn(keyResultOrdinalDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import ch.puzzle.okr.models.Objective;
import ch.puzzle.okr.models.authorization.AuthorizationUser;
import ch.puzzle.okr.models.keyresult.KeyResult;
import ch.puzzle.okr.models.keyresult.KeyResultMetric;
import ch.puzzle.okr.service.business.ObjectiveBusinessService;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down
56 changes: 34 additions & 22 deletions frontend/cypress/e2e/duplicate-objective.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ describe('Functionality of duplicating objectives and their belonging keyResults
.submit();

cy.contains(duplicatedTitle);
overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName).should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, secondKeyResultName).should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, thirdKeyResultName).should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName)
.should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, secondKeyResultName)
.should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, thirdKeyResultName)
.should('exist');
});

it('Should be able to duplicate a objective into this quarter, only including one keyResult', () => {
Expand All @@ -35,7 +38,8 @@ describe('Functionality of duplicating objectives and their belonging keyResults
overviewPage
.duplicateObjective('Build a company culture that kills the competition.')
.fillObjectiveTitle(duplicatedTitle)
.excludeKeyResults([secondKeyResultName, thirdKeyResultName])
.excludeKeyResults([secondKeyResultName,
thirdKeyResultName])
.submit();

overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName);
Expand All @@ -49,13 +53,15 @@ describe('Functionality of duplicating objectives and their belonging keyResults
it('Should not show option to select keyResults when objective with no keyResults is being duplicated', () => {
const duplicatedTitle = 'This is a duplicated objective without any keyResults';

overviewPage.duplicateObjective(
'should not appear on staging, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
);
cy.contains('Key Results:').should('not.exist');
ObjectiveDialog.do().fillObjectiveTitle(duplicatedTitle).submit();
overviewPage.duplicateObjective('should not appear on staging, no sea takimata sanctus est Lorem ipsum dolor sit amet.');
cy.contains('Key Results:')
.should('not.exist');
ObjectiveDialog.do()
.fillObjectiveTitle(duplicatedTitle)
.submit();

overviewPage.getObjectiveByName(duplicatedTitle).should('exist');
overviewPage.getObjectiveByName(duplicatedTitle)
.should('exist');
});

it('Should be able to duplicate a objective into the next quarter, including all keyResults', () => {
Expand All @@ -70,9 +76,12 @@ describe('Functionality of duplicating objectives and their belonging keyResults
overviewPage.visitNextQuarter();

cy.contains(duplicatedTitle);
overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName).should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, secondKeyResultName).should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, thirdKeyResultName).should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, firstKeyResultName)
.should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, secondKeyResultName)
.should('exist');
overviewPage.getKeyResultOfObjective(duplicatedTitle, thirdKeyResultName)
.should('exist');
});

it('Should not duplicate objective when cancel button is clicked', () => {
Expand All @@ -84,12 +93,13 @@ describe('Functionality of duplicating objectives and their belonging keyResults
.fillObjectiveDescription('Wow this is a very nice description!')
.cancel();

cy.contains(duplicatedTitle).should('not.exist');
cy.contains(duplicatedTitle)
.should('not.exist');
});
});

describe('Verify functionality of scoring adjustment on duplicated objectives', () => {
let keyresultDetailPage = new KeyResultDetailPage();
const keyresultDetailPage = new KeyResultDetailPage();

it('Duplicate ordinal checkin and validate value of scoring component', () => {
overviewPage
Expand All @@ -108,7 +118,8 @@ describe('Verify functionality of scoring adjustment on duplicated objectives',
.fillCheckInInitiatives('Testmassnahmen')
.submit();

cy.intercept('GET', '**/overview?*').as('indexPage');
cy.intercept('GET', '**/overview?*')
.as('indexPage');
keyresultDetailPage.close();
cy.wait('@indexPage');

Expand All @@ -128,11 +139,12 @@ describe('Verify functionality of scoring adjustment on duplicated objectives',
.findByTestId('fail')
.as('fail-area');

cy.get('@fail-area').should(($fail) => {
expect($fail).not.to.have.css('score-red');
expect($fail).not.to.have.css('score-yellow');
expect($fail).not.to.have.css('score-green');
expect($fail).not.to.have.css('score-stretch');
});
cy.get('@fail-area')
.should(($fail) => {
expect($fail).not.to.have.css('score-red');
expect($fail).not.to.have.css('score-yellow');
expect($fail).not.to.have.css('score-green');
expect($fail).not.to.have.css('score-stretch');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
(cdkDropListDropped)="drop($event)"
id="actionlist"
>
<div class="action-point-item" *ngFor="let action of (control | async)!; index as i; trackBy: trackByFn" cdkDrag>
<div
class="action-point-item"
*ngFor="let action of (control | async)!; index as i; trackBy: trackByFn"
cdkDrag
>
<div class="drag-drop-dots">
<img
cdkDragHandle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@
id="header-accordion"
class="content-center"
>
<mat-expansion-panel-header
class="d-flex justify-content-center gap-2 mx-3"
[attr.data-testId]="'expansion-panel-header'"
>
<mat-expansion-panel-header class="d-flex justify-content-center gap-2 mx-3" [attr.data-testId]="'expansion-panel-header'">
<mat-panel-title>
<div class="w-100 d-flex justify-content-between expansion-panel-title">
<span *ngIf="!panelOpenState; else openedPanel">{{
(quarterLabel$ | async) || quarterLabel$.getValue()
}}</span>
}}</span>
<span *ngIf="!panelOpenState">Filter</span>
</div>
<ng-template #openedPanel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
<div id="topBarHeight">
<div id="okrTopbar">
<a routerLink="/" queryParamsHandling="preserve" class="d-flex h-100 align-items-center ps-4">
<img [attr.data-testId]="'logo'" alt="okr-logo" height="32" src="{{ this.logoSrc$ | async }}" priority />
<a
routerLink="/"
queryParamsHandling="preserve"
class="d-flex h-100 align-items-center ps-4"
>
<img
[attr.data-testId]="'logo'"
alt="okr-logo"
height="32"
src="{{ this.logoSrc$ | async }}"
priority
/>
</a>
<div class="d-flex align-items-center me-md-5 me-1">
<button
Expand All @@ -10,7 +20,11 @@
class="topBarEntry btn visible-by-default"
queryParamsHandling="preserve"
>
<mat-icon aria-hidden="false" aria-label="Group icon" fontIcon="group"></mat-icon>
<mat-icon
aria-hidden="false"
aria-label="Group icon"
fontIcon="group"
></mat-icon>
<span class="d-none d-md-flex">Teamverwaltung </span>
</button>

Expand All @@ -21,7 +35,11 @@
[attr.data-testId]="'help-button'"
(click)="window.open(helpSiteUrl, '_blank')"
>
<mat-icon aria-hidden="false" aria-label="Help icon" fontIcon="help_outline"></mat-icon>
<mat-icon
aria-hidden="false"
aria-label="Help icon"
fontIcon="help_outline"
></mat-icon>
<span class="d-none d-md-flex"> Hilfe </span>
</button>

Expand All @@ -32,15 +50,29 @@
[matMenuTriggerFor]="menu"
class="topBarEntry flex-nowrap btn"
>
<mat-icon aria-hidden="false" aria-label="person icon" fontIcon="person_outline" id="topbar-user"></mat-icon>
<mat-icon
aria-hidden="false"
aria-label="person icon"
fontIcon="person_outline"
id="topbar-user"
></mat-icon>
<span [attr.data-testId]="'user-name'" class="fw-normal fs-6 d-none d-md-flex">{{ userFullName }}</span>
<mat-icon *ngIf="!menuIsOpen">expand_more</mat-icon>
<mat-icon *ngIf="menuIsOpen">expand_less</mat-icon>
</button>
</div>

<mat-menu #menu="matMenu" xPosition="before" yPosition="below">
<button (click)="logOut()" [attr.data-testId]="'logout'" class="py-2" mat-menu-item>
<mat-menu
#menu="matMenu"
xPosition="before"
yPosition="below"
>
<button
(click)="logOut()"
[attr.data-testId]="'logout'"
class="py-2"
mat-menu-item
>
<mat-icon class="scale-9">exit_to_app</mat-icon>
<span>Logout</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
*ngIf="!isComplete && checkIn.writeable"
[attr.data-testId]="'edit-check-in'"
>
<img ngSrc="assets/icons/edit.svg" alt="edit check-in" width="24" height="24" />
<img
ngSrc="assets/icons/edit.svg"
alt="edit check-in"
width="24"
height="24"
/>
</button>
</div>
<div class="okr-form-row row-cols-4">
Expand All @@ -24,9 +29,7 @@ <h4 class="col-auto">Wert:</h4>
<ng-container *ngIf="keyResult.keyResultType === 'metric' && getCheckInMetric(checkIn) as metricCheckIn">
{{ metricCheckIn.value! | unitTransformation: getMetricKeyResult().unit }}
</ng-container>
<ng-container
*ngIf="keyResult.keyResultType === 'ordinal' && getCheckInOrdinal(checkIn) as ordinalCheckIn"
>
<ng-container *ngIf="keyResult.keyResultType === 'ordinal' && getCheckInOrdinal(checkIn) as ordinalCheckIn">
{{ ordinalCheckIn.zone! }}
</ng-container>
</span>
Expand All @@ -50,7 +53,12 @@ <h4 class="col-3">Massnahmen:</h4>

<ng-container actions>
<div class="col-auto">
<button [attr.data-testId]="'closeButton'" mat-flat-button color="primary" mat-dialog-close>Schliessen</button>
<button
[attr.data-testId]="'closeButton'"
mat-flat-button
color="primary"
mat-dialog-close
>Schliessen</button>
</div>
</ng-container>
</app-dialog-template-core>
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
<form [formGroup]="dialogForm">
<div class="okr-form-row okr-form-label-input-container">
<label class="okr-form-label okr-form-col" for="ordinal-radio-group">Erreichte Zone wählen:</label>
<mat-radio-group formControlName="value" class="d-flex flex-column gap-2" id="ordinal-radio-group">
<mat-radio-button [attr.data-testId]="'fail-radio'" value="{{ Zone.FAIL }}" class="ordinal-zone">
<mat-radio-group
formControlName="value"
class="d-flex flex-column gap-2"
id="ordinal-radio-group"
>
<mat-radio-button
[attr.data-testId]="'fail-radio'"
value="{{ Zone.FAIL }}"
class="ordinal-zone"
>
<div class="radio-text-container d-flex align-items-center p-3 text-black">
<strong>Fail:&nbsp;</strong> Commit / Target / Stretch noch nicht erreicht
</div>
</mat-radio-button>

<mat-radio-button [attr.data-testId]="'commit-radio'" value="{{ Zone.COMMIT }}" class="ordinal-zone">
<mat-radio-button
[attr.data-testId]="'commit-radio'"
value="{{ Zone.COMMIT }}"
class="ordinal-zone"
>
<div class="radio-text-container d-flex p-3">
<span class="text-black"><strong>Commit:&nbsp;</strong>{{ keyResult.commitZone }}</span>
</div>
</mat-radio-button>

<mat-radio-button [attr.data-testId]="'target-radio'" value="{{ Zone.TARGET }}" class="ordinal-zone">
<mat-radio-button
[attr.data-testId]="'target-radio'"
value="{{ Zone.TARGET }}"
class="ordinal-zone"
>
<div class="radio-text-container d-flex p-3 w-100">
<span class="text-black"><strong>Target:&nbsp;</strong>{{ keyResult.targetZone }}</span>
</div>
</mat-radio-button>

<mat-radio-button [attr.data-testId]="'stretch-radio'" value="{{ Zone.STRETCH }}" class="ordinal-zone">
<mat-radio-button
[attr.data-testId]="'stretch-radio'"
value="{{ Zone.STRETCH }}"
class="ordinal-zone"
>
<div class="radio-text-container d-flex p-3">
<span class="text-black"><strong>Stretch:&nbsp;</strong>{{ keyResult.stretchZone }}</span>
</div>
Expand Down
Loading

0 comments on commit 1cf9c5d

Please sign in to comment.