diff --git a/frontend/cypress/e2e/check-in.cy.ts b/frontend/cypress/e2e/check-in.cy.ts index 04b68b877f..a725b088da 100644 --- a/frontend/cypress/e2e/check-in.cy.ts +++ b/frontend/cypress/e2e/check-in.cy.ts @@ -304,7 +304,7 @@ describe('OKR Check-in e2e tests', () => { }); }); -function getCurrentDate () { +function getCurrentDate() { const today = new Date(); const yyyy = today.getFullYear(); const mm = today.getMonth() + 1; // Months start at 0! diff --git a/frontend/cypress/e2e/scoring.cy.ts b/frontend/cypress/e2e/scoring.cy.ts index 0501c3e60c..4c7e421b78 100644 --- a/frontend/cypress/e2e/scoring.cy.ts +++ b/frontend/cypress/e2e/scoring.cy.ts @@ -111,7 +111,7 @@ describe('Scoring component e2e tests', () => { }); }); -function setupMetricKR ( +function setupMetricKR( name: string, baseline: number, stretchgoal: number, value: number ) { CyOverviewPage.do() diff --git a/frontend/cypress/e2e/tab.cy.ts b/frontend/cypress/e2e/tab.cy.ts index 01a6485273..ad08374842 100644 --- a/frontend/cypress/e2e/tab.cy.ts +++ b/frontend/cypress/e2e/tab.cy.ts @@ -13,12 +13,12 @@ describe('Tab workflow tests', () => { .focus(); }); - function focusedShouldHaveTestId (testId: string) { + function focusedShouldHaveTestId(testId: string) { cy.focused() .should('have.attr', 'data-testId', testId); } - function tabAndCheck (testId: string, text?: string) { + function tabAndCheck(testId: string, text?: string) { cy.tabForwardUntil(`[data-testId="${testId}"]`); focusedShouldHaveTestId(testId); if (text) { @@ -364,7 +364,7 @@ describe('Tab workflow tests', () => { }); }); -function tabToThreeDotMenuOption (name: string) { +function tabToThreeDotMenuOption(name: string) { cy.pressUntilContains(name, 'ArrowDown'); cy.realPress('Enter'); } diff --git a/frontend/cypress/e2e/teammanagement.cy.ts b/frontend/cypress/e2e/teammanagement.cy.ts index 19b154a3bf..07432f14fc 100644 --- a/frontend/cypress/e2e/teammanagement.cy.ts +++ b/frontend/cypress/e2e/teammanagement.cy.ts @@ -35,7 +35,7 @@ describe('Team management tests', () => { checkTeamsSelected(); }); - function checkTeamsSelected () { + function checkTeamsSelected() { FilterHelper.do() .optionShouldBeSelected('LoremIpsum') .optionShouldBeSelected('/BBT'); @@ -543,12 +543,12 @@ describe('Team management tests', () => { }); }); -function closeOverlay () { +function closeOverlay() { cy.get('.cdk-overlay-backdrop') .click(-50, -50, { force: true }); } -function checkRolesForEsha () { +function checkRolesForEsha() { cy.get('app-member-detail tbody tr') .eq(0) .should('contain', '/BBT') @@ -559,7 +559,7 @@ function checkRolesForEsha () { .and('contain', 'Team-Member'); } -function editTeamNameAndTest (teamName: string) { +function editTeamNameAndTest(teamName: string) { cy.intercept('PUT', '**/teams/*') .as('saveTeam'); cy.getByTestId('editTeamButton') @@ -577,7 +577,7 @@ function editTeamNameAndTest (teamName: string) { cy.contains(teamName); } -function navigateToUser (userName: string) { +function navigateToUser(userName: string) { cy.intercept('GET', '**/users/*') .as('getUser'); cy.get('td') @@ -586,7 +586,7 @@ function navigateToUser (userName: string) { cy.wait('@getUser'); } -function fillOutNewUser (firstname: string, lastname: string, email: string) { +function fillOutNewUser(firstname: string, lastname: string, email: string) { cy.realType(firstname); cy.tabForward(); cy.realType(lastname); diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index d69d44e2d6..44e1c93e5a 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -62,7 +62,7 @@ Cypress.Commands.add('validateScoring', (isOverview: boolean, percentage: number validateScoring(isOverview, percentage); }); -function loginWithCredentials (username: string, password: string) { +function loginWithCredentials(username: string, password: string) { cy.visit('/'); cy.intercept('GET', '**/users/current') .as('getCurrentUser'); diff --git a/frontend/cypress/support/helper/dom-helper/angularSearchBox.ts b/frontend/cypress/support/helper/dom-helper/angularSearchBox.ts index c9fe560037..706f73cfb9 100644 --- a/frontend/cypress/support/helper/dom-helper/angularSearchBox.ts +++ b/frontend/cypress/support/helper/dom-helper/angularSearchBox.ts @@ -3,13 +3,13 @@ import { PageObjectMapperBase } from './pageObjectMapperBase'; export default class AngularSearchBox extends PageObjectMapperBase { selector: string; - constructor (selector: string) { + constructor(selector: string) { super(); this.selector = selector; this.validatePage(); } - fill (value: string) { + fill(value: string) { const input = cy.get('input') .first(); input.clear(); @@ -17,30 +17,30 @@ export default class AngularSearchBox extends PageObjectMapperBase { return this; } - shouldHaveOption (option: string) { + shouldHaveOption(option: string) { cy.contains('.mat-mdc-autocomplete-panel mat-option', option); return this; } - shouldHaveLabel (label: string) { + shouldHaveLabel(label: string) { cy.contains('.mat-mdc-autocomplete-panel .mat-mdc-optgroup-label', label); return this; } - selectOption (option: string) { + selectOption(option: string) { cy.contains('.mat-mdc-autocomplete-panel mat-option', option) .click(); } - getPage () { + getPage() { return cy.get(this.selector); } - static from (selector: string): AngularSearchBox { + static from(selector: string): AngularSearchBox { return new this(selector); } - validatePage (): void { + validatePage(): void { this.getPage() .should('exist'); } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/checkInDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/checkInDialog.ts index 4aec8b5a1c..576539fc8d 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/checkInDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/checkInDialog.ts @@ -2,17 +2,17 @@ import Dialog from './dialog'; import Chainable = Cypress.Chainable; export default class CheckInDialog extends Dialog { - fillCheckInCommentary (commentary: string) { + fillCheckInCommentary(commentary: string) { this.fillInputByTestId('changeInfo', commentary); return this; } - fillMetricCheckInValue (value: string) { + fillMetricCheckInValue(value: string) { this.fillInputByTestId('check-in-metric-value', value); return this; } - selectOrdinalCheckInZone (zone: 'fail' | 'commit' | 'target' | 'stretch') { + selectOrdinalCheckInZone(zone: 'fail' | 'commit' | 'target' | 'stretch') { switch (zone) { case 'fail': cy.getByTestId('fail-radio') @@ -34,12 +34,12 @@ export default class CheckInDialog extends Dialog { return this; } - fillCheckInInitiatives (value: string) { + fillCheckInInitiatives(value: string) { this.fillInputByTestId('initiatives', value); return this; } - setCheckInConfidence (confidence: number) { + setCheckInConfidence(confidence: number) { cy.getByTestId('confidence-slider') .find('input') .focus(); @@ -52,7 +52,7 @@ export default class CheckInDialog extends Dialog { return this; } - checkForDialogTextMetric () { + checkForDialogTextMetric() { cy.contains('Very important keyresult'); cy.contains('Check-in erfassen'); cy.contains('Key Result'); @@ -62,7 +62,7 @@ export default class CheckInDialog extends Dialog { return this; } - checkForDialogTextOrdinal () { + checkForDialogTextOrdinal() { cy.contains('A new ordinal keyresult for our company'); cy.contains('Check-in erfassen'); cy.contains('Key Result'); @@ -79,12 +79,12 @@ export default class CheckInDialog extends Dialog { return this; } - override submit () { + override submit() { cy.getByTestId('submit-check-in') .click(); } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-check-in-form'); } } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts index f97cc858aa..4fc5053e8c 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/checkInHistoryDialog.ts @@ -3,27 +3,27 @@ import CheckInDialog from './checkInDialog'; import Chainable = Cypress.Chainable; export default class CheckInHistoryDialog extends Dialog { - override submit () { + override submit() { throw new Error('This dialog doesnt have a submit button'); } - override cancel () { + override cancel() { cy.getByTestId('closeButton') .click(); } - editLatestCheckIn () { + editLatestCheckIn() { cy.getByTestId('edit-check-in') .first() .click(); return new CheckInDialog(); } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-check-in-history-dialog'); } - checkForAttribute (title: string, value: string) { + checkForAttribute(title: string, value: string) { cy.get('mat-dialog-container') .contains(value) .parent() diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/confirmDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/confirmDialog.ts index 7c6eb3d945..677ab5127d 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/confirmDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/confirmDialog.ts @@ -2,31 +2,31 @@ import Dialog from './dialog'; import Chainable = Cypress.Chainable; export default class ConfirmDialog extends Dialog { - checkTitle (title: string) { + checkTitle(title: string) { this.getPage() .contains(title) .should('exist'); return this; } - checkDescription (title: string) { + checkDescription(title: string) { this.getPage() .contains(title) .should('exist'); return this; } - override submit () { + override submit() { cy.getByTestId('confirm-yes') .click(); } - override cancel () { + override cancel() { cy.getByTestId('confirm-no') .click(); } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-confirm-dialog'); } } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/dialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/dialog.ts index 44cbe75cd6..fd23784bb0 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/dialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/dialog.ts @@ -2,40 +2,40 @@ import { PageObjectMapperBase } from '../pageObjectMapperBase'; import Chainable = Cypress.Chainable; export default abstract class Dialog extends PageObjectMapperBase { - constructor () { + constructor() { super(); this.validatePage(); } - override validatePage () { + override validatePage() { this.getPage() .should('exist'); } - submit () { + submit() { cy.getByTestId('save') .click(); } - cancel () { + cancel() { cy.getByTestId('cancel') .click(); } - close () { + close() { cy.getByTestId('close-dialog') .click(); } - protected fillInputByTestId (testId: string, value: string) { + protected fillInputByTestId(testId: string, value: string) { const elem = cy.getByTestId(testId); this.fillInput(elem, value); } - protected fillInput (elem: Cypress.Chainable>, value: string) { + protected fillInput(elem: Cypress.Chainable>, value: string) { elem.clear(); elem.type(value); } - abstract getPage (): Chainable; + abstract getPage(): Chainable; } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts index 929e614bc9..01379e7966 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/inviteMembersDialog.ts @@ -5,14 +5,14 @@ import Chainable = Cypress.Chainable; export default class InviteMembersDialog extends Dialog { private readonly firstnames: string[] = []; - override validatePage () { + override validatePage() { super.validatePage(); this.getPage() .contains('Members registrieren') .should('exist'); } - enterUser (firstName: string, lastName: string, email: string) { + enterUser(firstName: string, lastName: string, email: string) { firstName = uniqueSuffix(firstName); email = uniqueSuffix(email); this.firstnames.push(firstName); @@ -28,23 +28,23 @@ export default class InviteMembersDialog extends Dialog { return this; } - addAnotherUser () { + addAnotherUser() { cy.contains('Weiterer Member hinzufügen') .click(); return this; } - getFirstNames () { + getFirstNames() { return this.firstnames; } - override submit () { + override submit() { cy.getByTestId('invite') .click(); return this.firstnames; } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-invite-user-dialog'); } } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/keyResultDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/keyResultDialog.ts index 7f6da4a841..b724f5131a 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/keyResultDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/keyResultDialog.ts @@ -4,17 +4,17 @@ import ConfirmDialog from './confirmDialog'; import Chainable = Cypress.Chainable; export default class KeyResultDialog extends Dialog { - fillKeyResultTitle (title: string) { + fillKeyResultTitle(title: string) { this.fillInputByTestId('titleInput', title); return this; } - fillKeyResultDescription (description: string) { + fillKeyResultDescription(description: string) { this.fillInputByTestId('descriptionInput', description); return this; } - withMetricValues (unit: Unit, baseline: string, stretchGoal: string) { + withMetricValues(unit: Unit, baseline: string, stretchGoal: string) { cy.getByTestId('metricTab') .click(); cy.getByTestId('unit') @@ -24,7 +24,7 @@ export default class KeyResultDialog extends Dialog { return this; } - withOrdinalValues (commitZone: string, targetZone: string, stretchGoal: string) { + withOrdinalValues(commitZone: string, targetZone: string, stretchGoal: string) { cy.getByTestId('ordinalTab') .click(); this.fillInputByTestId('commitZone', commitZone); @@ -33,14 +33,14 @@ export default class KeyResultDialog extends Dialog { return this; } - fillOwner (owner: string) { + fillOwner(owner: string) { this.fillInputByTestId('ownerInput', owner); cy.realPress('ArrowDown') .realPress('Enter'); return this; } - addActionPlanElement (action: string) { + addActionPlanElement(action: string) { cy.getByTestId('add-action-plan-line') .click(); cy.getByTestId('actionInput') @@ -52,13 +52,13 @@ export default class KeyResultDialog extends Dialog { return this; } - deleteKeyResult () { + deleteKeyResult() { cy.getByTestId('delete-keyResult') .click(); return new ConfirmDialog(); } - checkForDialogTextMetric () { + checkForDialogTextMetric() { cy.contains('Einheit'); cy.contains('Baseline'); cy.contains('Stretch Goal'); @@ -66,7 +66,7 @@ export default class KeyResultDialog extends Dialog { return this; } - checkForDialogTextOrdinal () { + checkForDialogTextOrdinal() { cy.contains('Commit Zone'); cy.contains('Target Zone'); cy.contains('Stretch Goal'); @@ -74,7 +74,7 @@ export default class KeyResultDialog extends Dialog { return this; } - private checkForDialogText () { + private checkForDialogText() { cy.contains('Key Result erfassen'); cy.contains('Titel'); cy.contains('Metrisch'); @@ -88,17 +88,17 @@ export default class KeyResultDialog extends Dialog { cy.contains('Abbrechen'); } - override submit () { + override submit() { cy.getByTestId('submit') .click(); } - saveAndNew () { + saveAndNew() { cy.getByTestId('saveAndNew') .click(); } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-key-result-form'); } } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/objectiveDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/objectiveDialog.ts index 5a7accd349..4957e72663 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/objectiveDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/objectiveDialog.ts @@ -3,41 +3,41 @@ import ConfirmDialog from './confirmDialog'; import Chainable = Cypress.Chainable; export default class ObjectiveDialog extends Dialog { - fillObjectiveTitle (title: string) { + fillObjectiveTitle(title: string) { this.fillInputByTestId('title', title); return this; } - fillObjectiveDescription (description: string) { + fillObjectiveDescription(description: string) { this.fillInputByTestId('description', description); return this; } - selectQuarter (quarter: string) { + selectQuarter(quarter: string) { cy.get('select#quarter') .select(quarter); return this; } - toggleCreateKeyResults () { + toggleCreateKeyResults() { cy.getByTestId('keyResult-checkbox') .find("[type='checkbox']") .check(); return this; } - deleteObjective () { + deleteObjective() { cy.getByTestId('delete') .click(); return new ConfirmDialog(); } - submitDraftObjective () { + submitDraftObjective() { cy.getByTestId('save-draft') .click(); } - excludeKeyResults (keyResults: string[]) { + excludeKeyResults(keyResults: string[]) { keyResults.forEach((keyResult) => { cy.get('label') .contains(keyResult.slice(0, 30)) @@ -46,7 +46,7 @@ export default class ObjectiveDialog extends Dialog { return this; } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-objective-form') .should('exist'); } diff --git a/frontend/cypress/support/helper/dom-helper/dialogs/teamDialog.ts b/frontend/cypress/support/helper/dom-helper/dialogs/teamDialog.ts index b48d4c0e9b..8b64e8243c 100644 --- a/frontend/cypress/support/helper/dom-helper/dialogs/teamDialog.ts +++ b/frontend/cypress/support/helper/dom-helper/dialogs/teamDialog.ts @@ -2,23 +2,23 @@ import Dialog from './dialog'; import Chainable = Cypress.Chainable; export default class TeamDialog extends Dialog { - override validatePage () { + override validatePage() { super.validatePage(); this.getPage() .contains('Team erfassen'); } - fillName (name: string) { + fillName(name: string) { this.fillInputByTestId('add-team-name', name); return this; } - override submit () { + override submit() { cy.getByTestId('save') .click(); } - getPage (): Chainable { + getPage(): Chainable { return cy.get('app-add-edit-team-dialog'); } } diff --git a/frontend/cypress/support/helper/dom-helper/filterHelper.ts b/frontend/cypress/support/helper/dom-helper/filterHelper.ts index 229b43d626..36bb077a4a 100644 --- a/frontend/cypress/support/helper/dom-helper/filterHelper.ts +++ b/frontend/cypress/support/helper/dom-helper/filterHelper.ts @@ -1,9 +1,9 @@ import { PageObjectMapperBase } from './pageObjectMapperBase'; export default class FilterHelper extends PageObjectMapperBase { - validatePage (): void {} + validatePage(): void {} - optionShouldBeSelected (text: string, onOverview = true): this { + optionShouldBeSelected(text: string, onOverview = true): this { if (onOverview) { cy.contains('h1:visible', text) .should('have.length', 1); @@ -15,7 +15,7 @@ export default class FilterHelper extends PageObjectMapperBase { return this; } - optionShouldNotBeSelected (text: string): this { + optionShouldNotBeSelected(text: string): this { cy.contains('h1:visible', text) .should('not.exist'); this.getOption(text) @@ -25,13 +25,13 @@ export default class FilterHelper extends PageObjectMapperBase { return this; } - toggleOption (text: string): this { + toggleOption(text: string): this { this.getOption(text) .click(); return this; } - private getOption (text: string): Cypress.Chainable> { + private getOption(text: string): Cypress.Chainable> { return cy.contains('mat-chip:visible', text); } } diff --git a/frontend/cypress/support/helper/dom-helper/pageObjectMapperBase.ts b/frontend/cypress/support/helper/dom-helper/pageObjectMapperBase.ts index 38464e51c2..ac4a103a8e 100644 --- a/frontend/cypress/support/helper/dom-helper/pageObjectMapperBase.ts +++ b/frontend/cypress/support/helper/dom-helper/pageObjectMapperBase.ts @@ -1,15 +1,15 @@ export abstract class PageObjectMapperBase { - abstract validatePage (): void; + abstract validatePage(): void; static do(this: new () => T): T { return new this(); } - run (arg: any) { + run(arg: any) { return this; } - checkForToaster (content: any, type: 'success' | 'error') { + checkForToaster(content: any, type: 'success' | 'error') { cy.get('#toast-container') .find(`.toast-${type}`) .contains(content) @@ -17,7 +17,7 @@ export abstract class PageObjectMapperBase { return this; } - validateUrlParameter (key: string, value: any[]) { + validateUrlParameter(key: string, value: any[]) { cy.url() .then((url) => { const params = new URL(url).searchParams; diff --git a/frontend/cypress/support/helper/dom-helper/pages/keyResultDetailPage.ts b/frontend/cypress/support/helper/dom-helper/pages/keyResultDetailPage.ts index 9ddea57a8c..93328177d2 100644 --- a/frontend/cypress/support/helper/dom-helper/pages/keyResultDetailPage.ts +++ b/frontend/cypress/support/helper/dom-helper/pages/keyResultDetailPage.ts @@ -13,54 +13,54 @@ export default class KeyResultDetailPage extends Page { editKeyResult: () => cy.getByTestId('edit-keyResult') }; - override validatePage () { + override validatePage() { this.elements.addCheckin() .contains('Check-in erfassen'); this.elements.editKeyResult() .contains('Key Result bearbeiten'); } - override visit (keyResultName: string): this { + override visit(keyResultName: string): this { this.doVisit(keyResultName); return this.afterVisit(); } - protected doVisit (keyResultName: string): this { + protected doVisit(keyResultName: string): this { CyOverviewPage.do() .getKeyResultByName(keyResultName) .click(); return this; } - createCheckIn () { + createCheckIn() { this.elements.addCheckin() .click(); return new CheckInDialog(); } - editKeyResult () { + editKeyResult() { this.elements.editKeyResult() .click(); return new KeyResultDialog(); } - showAllCheckins () { + showAllCheckins() { this.elements.showAllCheckins() .click(); return new CheckInHistoryDialog(); } - close (): void { + close(): void { this.elements.closeDrawer() .click({ force: true }); } - visitOverview (): void { + visitOverview(): void { this.elements.logo() .click(); } - getURL (): string { + getURL(): string { return '/details/keyresult'; } } diff --git a/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts b/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts index 9a256ba7cc..7e302c890b 100644 --- a/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts +++ b/frontend/cypress/support/helper/dom-helper/pages/overviewPage.ts @@ -10,27 +10,27 @@ export default class CyOverviewPage extends Page { teammanagement: () => cy.getByTestId('team-management') }; - visitGJForTests () { + visitGJForTests() { this.visitQuarter(998); } - visitBacklogQuarter () { + visitBacklogQuarter() { this.visitQuarter(999); } - visitCurrentQuarter () { + visitCurrentQuarter() { this.visitQuarter(2); } - visitNextQuarter () { + visitNextQuarter() { this.visitQuarter(3); } - private visitQuarter (quarter: number) { + private visitQuarter(quarter: number) { cy.visit(`/?quarter=${quarter}`); } - addObjective (teamName?: string) { + addObjective(teamName?: string) { if (teamName) { this.getTeamByName(teamName) .find('.add-objective') @@ -44,7 +44,7 @@ export default class CyOverviewPage extends Page { return new ObjectiveDialog(); } - addKeyResult (teamName?: string, objectiveName?: string) { + addKeyResult(teamName?: string, objectiveName?: string) { if (teamName && objectiveName) { this.getObjectiveByTeamAndName(teamName, objectiveName) .findByTestId('add-keyResult') @@ -69,7 +69,7 @@ export default class CyOverviewPage extends Page { return new KeyResultDialog(); } - addOngoingKeyResult () { + addOngoingKeyResult() { this.getObjectiveByState('ongoing') .findByTestId('add-keyResult') .first() @@ -78,18 +78,18 @@ export default class CyOverviewPage extends Page { return new KeyResultDialog(); } - getTeamByName (teamName: string) { + getTeamByName(teamName: string) { return cy.contains('.team-title', teamName) .parentsUntil('#overview') .last(); } - getFirstObjective () { + getFirstObjective() { return cy.get('.objective') .first(); } - getObjectiveByNameAndState (objectiveName: string, state: string) { + getObjectiveByNameAndState(objectiveName: string, state: string) { this.getObjectivesByNameAndState(objectiveName, state) .last() .as('objective') @@ -97,13 +97,13 @@ export default class CyOverviewPage extends Page { return cy.get('@objective'); } - getObjectivesByNameAndState (objectiveName: string, state: string) { + getObjectivesByNameAndState(objectiveName: string, state: string) { return getObjectiveColumns() .filter(filterByObjectiveName(objectiveName)) .filter(filterByObjectiveState(state)); } - getObjectiveByName (objectiveName: string) { + getObjectiveByName(objectiveName: string) { this.getObjectivesByName(objectiveName) .last() .as('objective') @@ -111,7 +111,7 @@ export default class CyOverviewPage extends Page { return cy.get('@objective'); } - getObjectiveByTeamAndName (teamName: string, objectiveName: string) { + getObjectiveByTeamAndName(teamName: string, objectiveName: string) { this.getTeamByName(teamName) .find('.objective') .filter(filterByObjectiveName(objectiveName)) @@ -122,22 +122,22 @@ export default class CyOverviewPage extends Page { return cy.get('@team'); } - getKeyResultOfObjective (objectiveName: string, keyResultName: string) { + getKeyResultOfObjective(objectiveName: string, keyResultName: string) { return this.getAllKeyResultsOfObjective(objectiveName) .filter(filterByKeyResultName(keyResultName)); } - getAllKeyResultsOfObjective (objectiveName: string) { + getAllKeyResultsOfObjective(objectiveName: string) { return this.getObjectiveByName(objectiveName) .find('.key-result'); } - getObjectivesByName (objectiveName: string) { + getObjectivesByName(objectiveName: string) { return getObjectiveColumns() .filter(filterByObjectiveName(objectiveName)); } - getObjectiveByState (state: string) { + getObjectiveByState(state: string) { this.getObjectivesByState(state) .first() .as('objective') @@ -145,12 +145,12 @@ export default class CyOverviewPage extends Page { return cy.get('@objective'); } - getObjectivesByState (state: string) { + getObjectivesByState(state: string) { return getObjectiveColumns() .filter(filterByObjectiveState(state)); } - getKeyResultByName (keyResultName: string) { + getKeyResultByName(keyResultName: string) { this.getKeyResultsByName(keyResultName) .last() .as('keyResult') @@ -158,12 +158,12 @@ export default class CyOverviewPage extends Page { return cy.get('@keyResult'); } - getKeyResultsByName (keyresultName: string) { + getKeyResultsByName(keyresultName: string) { return getKeyResults() .filter(filterByKeyResultName(keyresultName)); } - selectFromThreeDotMenu (optionName: string) { + selectFromThreeDotMenu(optionName: string) { cy.contains(optionName) .should('exist'); cy.get('.objective-three-dot-menu') @@ -176,7 +176,7 @@ export default class CyOverviewPage extends Page { .click(); } - duplicateObjective (objectiveName: string) { + duplicateObjective(objectiveName: string) { cy.intercept('GET', '**/objectives/*/keyResults') .as('keyResults'); this.getObjectiveByName(objectiveName) @@ -187,18 +187,18 @@ export default class CyOverviewPage extends Page { return new ObjectiveDialog(); } - visitTeammanagement (): void { + visitTeammanagement(): void { this.elements.teammanagement() .click(); } - getURL (): string { + getURL(): string { return ''; } - validatePage (): void {} + validatePage(): void {} - protected doVisit (): void { + protected doVisit(): void { this.elements.logo() .click(); } diff --git a/frontend/cypress/support/helper/dom-helper/pages/page.ts b/frontend/cypress/support/helper/dom-helper/pages/page.ts index 12db5e8c7c..9ac04fbddd 100644 --- a/frontend/cypress/support/helper/dom-helper/pages/page.ts +++ b/frontend/cypress/support/helper/dom-helper/pages/page.ts @@ -1,24 +1,24 @@ import { PageObjectMapperBase } from '../pageObjectMapperBase'; export abstract class Page extends PageObjectMapperBase { - visit (arg?: any): this { + visit(arg?: any): this { this.doVisit(); return this.afterVisit(); } - visitViaURL (): this { + visitViaURL(): this { cy.visit(this.getURL()); return this.afterVisit(); } - protected abstract doVisit (arg?: any): void; + protected abstract doVisit(arg?: any): void; - afterVisit (): this { + afterVisit(): this { cy.url() .should('include', this.getURL()); this.validatePage(); return this; } - abstract getURL (): string; + abstract getURL(): string; } diff --git a/frontend/cypress/support/helper/dom-helper/pages/teammanagementPage.ts b/frontend/cypress/support/helper/dom-helper/pages/teammanagementPage.ts index a150e13007..44af69d882 100644 --- a/frontend/cypress/support/helper/dom-helper/pages/teammanagementPage.ts +++ b/frontend/cypress/support/helper/dom-helper/pages/teammanagementPage.ts @@ -15,7 +15,7 @@ export default class TeammanagementPage extends Page { teamSearch: () => AngularSearchBox.from('app-team-management-banner [data-testId="teamManagementSearch"]') }; - override validatePage () { + override validatePage() { this.elements.teammanagement() .contains('Teamverwaltung'); this.elements.backToOverview() @@ -32,29 +32,29 @@ export default class TeammanagementPage extends Page { .contains('Member registrieren'); } - protected doVisit (): this { + protected doVisit(): this { this.elements.logo() .click(); return this; } - backToOverview (): void { + backToOverview(): void { this.elements.backToOverview() .click(); } - visitOverview (): void { + visitOverview(): void { this.elements.logo() .click(); } - addTeam (): TeamDialog { + addTeam(): TeamDialog { this.elements.addTeam() .click(); return new TeamDialog(); } - deleteTeam (teamName: string) { + deleteTeam(teamName: string) { cy.get('app-team-list .mat-mdc-list-item') .contains(teamName) .click(); @@ -68,7 +68,7 @@ export default class TeammanagementPage extends Page { .checkDescription(`Möchtest du das Team '${teamName}' wirklich löschen? Zugehörige Objectives werden dadurch in allen Quartalen ebenfalls gelöscht!`); } - getURL (): string { + getURL(): string { return 'team-management'; } } diff --git a/frontend/cypress/support/helper/keyResultHelper.ts b/frontend/cypress/support/helper/keyResultHelper.ts index f6107a3757..0edaa2d253 100644 --- a/frontend/cypress/support/helper/keyResultHelper.ts +++ b/frontend/cypress/support/helper/keyResultHelper.ts @@ -1,4 +1,4 @@ -export function filterByKeyResultName (keyResultName: string) { +export function filterByKeyResultName(keyResultName: string) { return (index: number, element: HTMLElement) => isKeyResultName(element, keyResultName); } @@ -7,6 +7,6 @@ const isKeyResultName = (element: HTMLElement, keyResultName: string) => { .find(`:contains("${keyResultName}")`).length > 0; }; -export function getKeyResults () { +export function getKeyResults() { return cy.get('.key-result'); } diff --git a/frontend/cypress/support/helper/objectiveHelper.ts b/frontend/cypress/support/helper/objectiveHelper.ts index f28627c2f3..b0bf9edae2 100644 --- a/frontend/cypress/support/helper/objectiveHelper.ts +++ b/frontend/cypress/support/helper/objectiveHelper.ts @@ -1,8 +1,8 @@ -export function filterByObjectiveName (objectiveName: string) { +export function filterByObjectiveName(objectiveName: string) { return (index: number, element: HTMLElement) => isObjectiveName(element, objectiveName); } -export function filterByObjectiveState (icon: string) { +export function filterByObjectiveState(icon: string) { return (index: number, element: HTMLElement) => isObjectiveState(element, icon); } @@ -16,6 +16,6 @@ const isObjectiveName = (element: HTMLElement, objectiveName: string) => { .find(`:contains("${objectiveName}")`).length > 0; }; -export function getObjectiveColumns () { +export function getObjectiveColumns() { return cy.get('.objective'); } diff --git a/frontend/cypress/support/helper/scoringSupport.ts b/frontend/cypress/support/helper/scoringSupport.ts index cccb630f53..ccb55625de 100644 --- a/frontend/cypress/support/helper/scoringSupport.ts +++ b/frontend/cypress/support/helper/scoringSupport.ts @@ -6,7 +6,7 @@ interface ScoringValue { targetPercent: number; } -export function validateScoring (isOverview: boolean, percentage: number) { +export function validateScoring(isOverview: boolean, percentage: number) { const rgbCode = colorFromPercentage(percentage); const scoringValue = scoringValueFromPercentage(percentage); @@ -26,14 +26,14 @@ export function validateScoring (isOverview: boolean, percentage: number) { validateScoringColor('target', rgbCode, isOverview); } -export function getPercentageMetric (baseline: number, stretchGoal: number, value: number) { +export function getPercentageMetric(baseline: number, stretchGoal: number, value: number) { if (isLastCheckInNegative(baseline, stretchGoal, value)) { return -1; } return (Math.abs(value - baseline) / Math.abs(stretchGoal - baseline)) * 100; } -export function getPercentageOrdinal (zone: string) { +export function getPercentageOrdinal(zone: string) { if (zone == 'stretch') return 101; if (zone == 'target') return 99.99; if (zone == 'commit') return 70; @@ -41,7 +41,7 @@ export function getPercentageOrdinal (zone: string) { return 0; } -function validateScoringWidth (zone: string, percent: number, isOverview: boolean) { +function validateScoringWidth(zone: string, percent: number, isOverview: boolean) { cy.getZone(zone, isOverview) .parent() .invoke('width') @@ -53,7 +53,7 @@ function validateScoringWidth (zone: string, percent: number, isOverview: boolea }); } -function validateScoringColor (zone: string, rgbCode: string, isOverview: boolean) { +function validateScoringColor(zone: string, rgbCode: string, isOverview: boolean) { cy.getZone(zone, isOverview) .invoke('css', 'background-color') .should('equal', rgbCode); @@ -69,21 +69,21 @@ function validateScoringColor (zone: string, rgbCode: string, isOverview: boolea } } -function checkVisibilityOfScoringComponent (isOverview: boolean, displayProperty: string, componentTestId: string) { +function checkVisibilityOfScoringComponent(isOverview: boolean, displayProperty: string, componentTestId: string) { (isOverview ? cy.focused() : cy.getByTestId('side-panel')) .findByTestId(componentTestId) .invoke('css', 'display') .should('equal', displayProperty); } -function colorFromPercentage (percentage: number) { +function colorFromPercentage(percentage: number) { if (percentage >= 100) return 'rgba(0, 0, 0, 0)'; if (percentage > 70) return 'rgb(30, 138, 41)'; if (percentage > 30) return 'rgb(255, 214, 0)'; return 'rgb(186, 56, 56)'; } -function scoringValueFromPercentage (percentage: number): ScoringValue { +function scoringValueFromPercentage(percentage: number): ScoringValue { if (percentage >= 100) { return { failPercent: 0, commitPercent: 0, diff --git a/frontend/cypress/support/helper/utils.ts b/frontend/cypress/support/helper/utils.ts index e89b1392cc..454ba2433c 100644 --- a/frontend/cypress/support/helper/utils.ts +++ b/frontend/cypress/support/helper/utils.ts @@ -5,12 +5,12 @@ export const uniqueSuffix = (value: string): string => { return `${value}-${uuidv4()}`; }; -export function pressUntilContains (text: string, key: keyof typeof keyCodeDefinitions) { +export function pressUntilContains(text: string, key: keyof typeof keyCodeDefinitions) { const condition = (element: HTMLElement) => element.innerText.includes(text); pressUntil(key, condition); } -export function doUntilSelector ( +export function doUntilSelector( selector: string, tab: () => void, limit = 100, count = 0 ) { const condition = (element: HTMLElement) => Cypress.$(element) @@ -20,11 +20,11 @@ export function doUntilSelector ( ); } -function pressUntil (key: keyof typeof keyCodeDefinitions, condition: (elem: HTMLElement) => boolean) { +function pressUntil(key: keyof typeof keyCodeDefinitions, condition: (elem: HTMLElement) => boolean) { doUntil(condition, () => cy.realPress(key)); } -function doUntil ( +function doUntil( condition: (element: HTMLElement) => boolean, tab: () => void, limit = 100, diff --git a/frontend/src/app/app.component.spec.ts b/frontend/src/app/app.component.spec.ts index 0d10e92017..3d1bda7afb 100644 --- a/frontend/src/app/app.component.spec.ts +++ b/frontend/src/app/app.component.spec.ts @@ -18,13 +18,13 @@ import { ObjectiveDetailComponent } from './components/objective-detail/objectiv import { CommonModule } from '@angular/common'; const oauthServiceMock = { - configure (environment: AuthConfig): void {}, - initCodeFlow (): void {}, - setupAutomaticSilentRefresh (): void {}, - hasValidAccessToken (): boolean { + configure(environment: AuthConfig): void {}, + initCodeFlow(): void {}, + setupAutomaticSilentRefresh(): void {}, + hasValidAccessToken(): boolean { return true; }, - loadDiscoveryDocumentAndTryLogin (): Promise { + loadDiscoveryDocumentAndTryLogin(): Promise { this.initCodeFlow(); return Promise.resolve(); } @@ -49,7 +49,7 @@ describe('AppComponent', () => { let fixture: ComponentFixture; let loader: HarnessLoader; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ RouterTestingModule.withRoutes(routes), diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index b389755dcb..8b2861a876 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -11,7 +11,7 @@ import { DomSanitizer } from '@angular/platform-browser'; export class AppComponent { readonly PATH_PREFIX = '../assets/icons/'; - constructor (private matIconRegistry: MatIconRegistry, + constructor(private matIconRegistry: MatIconRegistry, private domSanitizer: DomSanitizer) { this.matIconRegistry.addSvgIcon('pz-search', this.domSanitizer.bypassSecurityTrustResourceUrl(this.PATH_PREFIX + 'search-icon.svg')); diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 15918314ce..053e984698 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -70,8 +70,8 @@ import { A11yModule } from '@angular/cdk/a11y'; import { CustomizationService } from './services/customization.service'; import { MetricCheckInDirective } from './components/checkin/check-in-form-metric/metric-check-in-directive'; -function initOauthFactory (configService: ConfigService, oauthService: OAuthService) { - return async () => { +function initOauthFactory(configService: ConfigService, oauthService: OAuthService) { + return async() => { const config = await firstValueFrom(configService.config$); oauthService.configure({ ...environment.oauth, @@ -81,11 +81,11 @@ function initOauthFactory (configService: ConfigService, oauthService: OAuthServ }; } -export function createTranslateLoader (http: HttpBackend) { +export function createTranslateLoader(http: HttpBackend) { return new TranslateHttpLoader(new HttpClient(http), './assets/i18n/', '.json'); } -export function storageFactory (): OAuthStorage { +export function storageFactory(): OAuthStorage { return localStorage; } @@ -205,5 +205,5 @@ export const MY_FORMATS = { ] }) export class AppModule { - constructor (private readonly customizationService: CustomizationService) {} + constructor(private readonly customizationService: CustomizationService) {} } diff --git a/frontend/src/app/components/action-plan/action-plan.component.ts b/frontend/src/app/components/action-plan/action-plan.component.ts index 2b7e8b9aa2..623055e1d8 100644 --- a/frontend/src/app/components/action-plan/action-plan.component.ts +++ b/frontend/src/app/components/action-plan/action-plan.component.ts @@ -21,10 +21,10 @@ export class ActionPlanComponent { @ViewChildren('listItem') listItems!: QueryList; - constructor (private actionService: ActionService, + constructor(private actionService: ActionService, public dialogService: DialogService) {} - handleKeyDown (event: Event, currentIndex: number) { + handleKeyDown(event: Event, currentIndex: number) { let newIndex = currentIndex; if ((event as KeyboardEvent).key === 'ArrowDown') { if (newIndex + 1 <= this.control.getValue()!.length - 1) { @@ -39,7 +39,7 @@ export class ActionPlanComponent { this.listItems.get(this.activeItem)?.nativeElement.focus(); } - changeItemPosition (newIndex: number, currentIndex: number) { + changeItemPosition(newIndex: number, currentIndex: number) { this.activeItem = newIndex; const currentActionPlan: Action[] = this.control.getValue()!; this.updateActionTexts(currentActionPlan); @@ -48,25 +48,25 @@ export class ActionPlanComponent { this.control.next(currentActionPlan); } - updateActionTexts (currentActionPlan: Action[]) { + updateActionTexts(currentActionPlan: Action[]) { const texts = Array.from(this.listItems) .map((input: any) => input.nativeElement.value); currentActionPlan.forEach((action: Action, index: number) => (action.action = texts[index])); } - increaseActiveItemWithTab () { + increaseActiveItemWithTab() { if (this.activeItem <= this.control.value!.length - 2) { this.activeItem++; } } - decreaseActiveItemWithShiftTab () { + decreaseActiveItemWithShiftTab() { if (this.activeItem > 0) { this.activeItem--; } } - drop (event: CdkDragDrop) { + drop(event: CdkDragDrop) { const value: string = (event.container.element.nativeElement.children[event.previousIndex].children[1] as HTMLInputElement).value; const actions: Action[] = this.control.getValue()!; if (actions[event.previousIndex].action == '' && value != '') { @@ -85,15 +85,15 @@ export class ActionPlanComponent { this.activeItem = event.currentIndex; } - adjustPriorities () { + adjustPriorities() { const actions: Action[] = this.control.getValue()!; - actions.forEach(function (action: Action, index: number) { + actions.forEach(function(action: Action, index: number) { action.priority = index; }); this.control.next(actions); } - removeAction (index: number) { + removeAction(index: number) { const actions: Action[] = this.control.getValue()!; if (this.activeItem == index && this.activeItem > 0) { this.activeItem--; @@ -120,7 +120,7 @@ export class ActionPlanComponent { } } - addNewAction () { + addNewAction() { const actions: Action[] = this.control.getValue()!; actions.push({ action: '', priority: actions.length, @@ -133,7 +133,7 @@ export class ActionPlanComponent { * By default angular material adds a new entry inside the actionplan when the user presses enter * to disable this behaviour we need this method which prevents the event from firing */ - preventAddingNewItems (event: Event) { + preventAddingNewItems(event: Event) { event.preventDefault(); } diff --git a/frontend/src/app/components/application-banner/application-banner.component.spec.ts b/frontend/src/app/components/application-banner/application-banner.component.spec.ts index 1bde07e55d..339dbded88 100644 --- a/frontend/src/app/components/application-banner/application-banner.component.spec.ts +++ b/frontend/src/app/components/application-banner/application-banner.component.spec.ts @@ -21,11 +21,11 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatInputModule } from '@angular/material/input'; class ResizeObserverMock { - observe () {} + observe() {} - unobserve () {} + unobserve() {} - disconnect () {} + disconnect() {} } const refreshDataServiceMock = { diff --git a/frontend/src/app/components/application-banner/application-banner.component.ts b/frontend/src/app/components/application-banner/application-banner.component.ts index a5d64d1917..2e0ef4c781 100644 --- a/frontend/src/app/components/application-banner/application-banner.component.ts +++ b/frontend/src/app/components/application-banner/application-banner.component.ts @@ -30,7 +30,7 @@ export class ApplicationBannerComponent implements AfterViewInit, OnDestroy { lastScrollPosition = 0; - constructor (private refreshDataService: RefreshDataService) { + constructor(private refreshDataService: RefreshDataService) { this.resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => { const newBannerHeight = entries[0].contentRect.height; if (newBannerHeight != this.bannerHeight) { @@ -40,18 +40,18 @@ export class ApplicationBannerComponent implements AfterViewInit, OnDestroy { }); } - ngAfterViewInit (): void { + ngAfterViewInit(): void { this.resizeObserver.observe(this.okrBanner.nativeElement); this.changeHeaderAppearance(); } - changeHeaderAppearance () { + changeHeaderAppearance() { const scrollTop: number = window.scrollY || document.documentElement.scrollTop; this.refreshBanner(scrollTop); this.lastScrollPosition = scrollTop; } - refreshBanner (scrollTop: number) { + refreshBanner(scrollTop: number) { const newBannerPadding = this.getBannerTopPadding(scrollTop); this.okrBanner.nativeElement.style.top = newBannerPadding + 'px'; @@ -59,22 +59,22 @@ export class ApplicationBannerComponent implements AfterViewInit, OnDestroy { this.refreshDataService.okrBannerHeightSubject.next(overviewPadding); } - getBannerTopPadding (scrollTop: number) { + getBannerTopPadding(scrollTop: number) { return scrollTop > this.lastScrollPosition ? 0 - (PUZZLE_TOP_BAR_HEIGHT + this.bannerHeight) : PUZZLE_TOP_BAR_HEIGHT; } - getOverviewPadding (newBannerPadding: number, paddingAmount: number): number { + getOverviewPadding(newBannerPadding: number, paddingAmount: number): number { return newBannerPadding < 0 ? PUZZLE_TOP_BAR_HEIGHT * 2 : paddingAmount; } @HostListener('window:scroll') - scroll () { + scroll() { this.changeHeaderAppearance(); } - ngOnDestroy (): void { + ngOnDestroy(): void { this.resizeObserver.disconnect(); } } diff --git a/frontend/src/app/components/application-top-bar/application-top-bar.component.spec.ts b/frontend/src/app/components/application-top-bar/application-top-bar.component.spec.ts index 06831bcdba..f1cf1d3568 100644 --- a/frontend/src/app/components/application-top-bar/application-top-bar.component.spec.ts +++ b/frontend/src/app/components/application-top-bar/application-top-bar.component.spec.ts @@ -96,7 +96,7 @@ describe('ApplicationTopBarComponent', () => { .toBe('Bob Baumeister'); }); - it('logout function should get called on button click', async () => { + it('logout function should get called on button click', async() => { routerMock.navigateByUrl.mockReturnValue(of() .toPromise()); const harness = await loader.getHarness(MatMenuHarness); diff --git a/frontend/src/app/components/application-top-bar/application-top-bar.component.ts b/frontend/src/app/components/application-top-bar/application-top-bar.component.ts index 2560e0a0c7..dca10dac5a 100644 --- a/frontend/src/app/components/application-top-bar/application-top-bar.component.ts +++ b/frontend/src/app/components/application-top-bar/application-top-bar.component.ts @@ -23,7 +23,7 @@ export class ApplicationTopBarComponent implements OnInit, OnDestroy { private subscription?: Subscription; - constructor ( + constructor( private oauthService: OAuthService, private userService: UserService, private configService: ConfigService, @@ -31,7 +31,7 @@ export class ApplicationTopBarComponent implements OnInit, OnDestroy { private readonly cd: ChangeDetectorRef ) {} - ngOnInit (): void { + ngOnInit(): void { this.subscription = this.configService.config$.subscribe({ next: (config) => { if (config.logo) { @@ -45,11 +45,11 @@ export class ApplicationTopBarComponent implements OnInit, OnDestroy { this.initUserFullName(); } - ngOnDestroy (): void { + ngOnDestroy(): void { this.subscription?.unsubscribe(); } - logOut () { + logOut() { const currentUrlTree = this.router.createUrlTree([], { queryParams: {} }); this.router.navigateByUrl(currentUrlTree) .then(() => { @@ -57,7 +57,7 @@ export class ApplicationTopBarComponent implements OnInit, OnDestroy { }); } - private initUserFullName () { + private initUserFullName() { // user is loaded on base route resolver. We have to wait until routing is done. this.router.events.subscribe((val) => { if (!this.userFullName && val instanceof NavigationEnd) { diff --git a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.spec.ts b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.spec.ts index 102e72399f..1f01408053 100644 --- a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.spec.ts +++ b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.spec.ts @@ -62,7 +62,7 @@ describe('CheckInHistoryDialogComponent', () => { .toBeTruthy(); }); - it.skip('should not display edit check-in button if writeable is false', async () => { + it.skip('should not display edit check-in button if writeable is false', async() => { const buttons = fixture.debugElement.queryAll(By.css('button')); expect(buttons.length) .toBe(1); diff --git a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.ts b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.ts index 714829d5b2..e562dba5b4 100644 --- a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.ts +++ b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.ts @@ -26,7 +26,7 @@ export class CheckInHistoryDialogComponent implements OnInit { protected readonly DATE_FORMAT = DATE_FORMAT; - constructor ( + constructor( @Inject(MAT_DIALOG_DATA) public data: any, private checkInService: CheckInService, private dialogService: DialogService, @@ -34,13 +34,13 @@ export class CheckInHistoryDialogComponent implements OnInit { private refreshDataService: RefreshDataService ) {} - ngOnInit (): void { + ngOnInit(): void { this.keyResult = this.data.keyResult; this.isComplete = this.data.isComplete; this.loadCheckInHistory(); } - openCheckInDialogForm (checkIn: CheckInMin) { + openCheckInDialogForm(checkIn: CheckInMin) { const dialogRef = this.dialogService.open(CheckInFormComponent, { data: { keyResult: this.keyResult, @@ -55,7 +55,7 @@ export class CheckInHistoryDialogComponent implements OnInit { }); } - loadCheckInHistory () { + loadCheckInHistory() { this.checkInHistory$ = this.checkInService.getAllCheckInOfKeyResult(this.keyResult.id); this.checkInHistory$.subscribe((result) => { if (result.length == 0) { @@ -64,15 +64,15 @@ export class CheckInHistoryDialogComponent implements OnInit { }); } - getMetricKeyResult (): KeyResultMetric { + getMetricKeyResult(): KeyResultMetric { return this.keyResult as KeyResultMetric; } - getCheckInMetric (checkIn: CheckInMin): CheckInMetricMin { + getCheckInMetric(checkIn: CheckInMin): CheckInMetricMin { return checkIn as CheckInMetricMin; } - getCheckInOrdinal (checkIn: CheckInMin): CheckInOrdinalMin { + getCheckInOrdinal(checkIn: CheckInMin): CheckInOrdinalMin { return checkIn as CheckInOrdinalMin; } } diff --git a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.spec.ts b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.spec.ts index 3ca966b7b8..808addfb4f 100644 --- a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.spec.ts +++ b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.spec.ts @@ -49,35 +49,35 @@ describe('CheckInFormComponent', () => { .toBeTruthy(); }); - it('should format percent correctly', waitForAsync(async () => { + it('should format percent correctly', waitForAsync(async() => { component.keyResult = { ...keyResultMetric, unit: Unit.PERCENT }; expect(component.generateUnitLabel()) .toEqual('%'); })); - it('should format chf correctly', waitForAsync(async () => { + it('should format chf correctly', waitForAsync(async() => { component.keyResult = { ...keyResultMetric, unit: Unit.CHF }; expect(component.generateUnitLabel()) .toEqual('CHF'); })); - it('should format eur correctly', waitForAsync(async () => { + it('should format eur correctly', waitForAsync(async() => { component.keyResult = { ...keyResultMetric, unit: Unit.EUR }; expect(component.generateUnitLabel()) .toEqual('EUR'); })); - it('should format fte correctly', waitForAsync(async () => { + it('should format fte correctly', waitForAsync(async() => { component.keyResult = { ...keyResultMetric, unit: Unit.FTE }; expect(component.generateUnitLabel()) .toEqual('FTE'); })); - it('should format number correctly', waitForAsync(async () => { + it('should format number correctly', waitForAsync(async() => { component.keyResult = { ...keyResultMetric, unit: Unit.NUMBER }; expect(component.generateUnitLabel()) diff --git a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.ts b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.ts index af87f47d10..ca77d2ef0b 100644 --- a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.ts +++ b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.ts @@ -26,14 +26,14 @@ export class CheckInFormMetricComponent implements OnInit { protected readonly hasFormFieldErrors = hasFormFieldErrors; - constructor (private translate: TranslateService) {} + constructor(private translate: TranslateService) {} - ngOnInit () { + ngOnInit() { this.dialogForm.controls['value'].setValidators([Validators.required, Validators.pattern('^-?\\d+\\.?\\d*$')]); } - generateUnitLabel (): string { + generateUnitLabel(): string { switch (this.keyResult.unit) { case 'PERCENT': return '%'; @@ -48,11 +48,11 @@ export class CheckInFormMetricComponent implements OnInit { } } - getErrorMessage (error: string, field: string): string { + getErrorMessage(error: string, field: string): string { return field + this.translate.instant('DIALOG_ERRORS.' + error); } - getCheckInMetric (): CheckInMetricMin { + getCheckInMetric(): CheckInMetricMin { return this.checkIn as CheckInMetricMin; } } diff --git a/frontend/src/app/components/checkin/check-in-form-metric/metric-check-in-directive.ts b/frontend/src/app/components/checkin/check-in-form-metric/metric-check-in-directive.ts index 73e636daa2..98f4638545 100644 --- a/frontend/src/app/components/checkin/check-in-form-metric/metric-check-in-directive.ts +++ b/frontend/src/app/components/checkin/check-in-form-metric/metric-check-in-directive.ts @@ -14,20 +14,20 @@ export class MetricCheckInDirective implements ControlValueAccessor { protected readonly CHAR_REGEX = /[^0-9.]/g; - writeValue (value: any): void { + writeValue(value: any): void { // does not need to be implemented because the display value does not need to be modified } - registerOnChange (fn: (value: number | null) => void): void { + registerOnChange(fn: (value: number | null) => void): void { this.onChange = fn; } - registerOnTouched (fn: () => void): void { + registerOnTouched(fn: () => void): void { // does not need to be implemented } @HostListener('input', ['$event.target.value']) - handleInput (param: string): void { + handleInput(param: string): void { const value: string = param || '0'; if (value.toString() .at(0) == '-') { diff --git a/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts b/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts index 84931bfa71..62dd6f82e8 100644 --- a/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts +++ b/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.spec.ts @@ -49,40 +49,40 @@ describe('CheckInFormOrdinalComponent', () => { .toBeTruthy(); }); - it('should set zone of check-in to fail if value is empty', waitForAsync(async () => { + it('should set zone of check-in to fail if value is empty', waitForAsync(async() => { expect(component.dialogForm.controls['value'].value) .toBe(''); })); - it('should set zone to Fail', waitForAsync(async () => { + it('should set zone to Fail', waitForAsync(async() => { const radioButtons = await loader.getAllHarnesses(MatRadioButtonHarness); await radioButtons[0].check(); expect(component.dialogForm.controls['value'].value) .toBe(Zone.FAIL); })); - it('should set zone to Commit', waitForAsync(async () => { + it('should set zone to Commit', waitForAsync(async() => { const radioButtons = await loader.getAllHarnesses(MatRadioButtonHarness); await radioButtons[1].check(); expect(component.dialogForm.controls['value'].value) .toBe(Zone.COMMIT); })); - it('should set zone to Target', waitForAsync(async () => { + it('should set zone to Target', waitForAsync(async() => { const radioButtons = await loader.getAllHarnesses(MatRadioButtonHarness); await radioButtons[2].check(); expect(component.dialogForm.controls['value'].value) .toBe(Zone.TARGET); })); - it('should set zone to Stretch', waitForAsync(async () => { + it('should set zone to Stretch', waitForAsync(async() => { const radioButtons = await loader.getAllHarnesses(MatRadioButtonHarness); await radioButtons[3].check(); expect(component.dialogForm.controls['value'].value) .toBe(Zone.STRETCH); })); - it('should be able to switch options ', waitForAsync(async () => { + it('should be able to switch options ', waitForAsync(async() => { const radioButtons = await loader.getAllHarnesses(MatRadioButtonHarness); await radioButtons[3].check(); await radioButtons[1].check(); diff --git a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.spec.ts b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.spec.ts index 78f6cd1501..a9988b3081 100644 --- a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.spec.ts +++ b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.spec.ts @@ -94,7 +94,7 @@ describe('CheckInFormComponent', () => { .toBeTruthy(); }); - it('should save check-in correctly if key result is metric', waitForAsync(async () => { + it('should save check-in correctly if key result is metric', waitForAsync(async() => { component.checkIn = checkInMetric; component.keyResult = keyResultMetric; component.dialogForm.controls['value'].setValue(checkInMetric?.value!.toString()); @@ -120,7 +120,7 @@ describe('CheckInFormComponent', () => { .toHaveBeenCalled(); })); - it('should save check-in correctly if key result is ordinal', waitForAsync(async () => { + it('should save check-in correctly if key result is ordinal', waitForAsync(async() => { component.checkIn = checkInOrdinal; component.keyResult = keyResultOrdinal; component.dialogForm.controls['value'].setValue(checkInOrdinal?.zone!.toString()); @@ -144,7 +144,7 @@ describe('CheckInFormComponent', () => { }); })); - it('should set default values if form check-in input is not null', waitForAsync(async () => { + it('should set default values if form check-in input is not null', waitForAsync(async() => { component.data.checkIn = checkInMetric; component.setDefaultValues(); expect(component.dialogForm.value) @@ -157,7 +157,7 @@ describe('CheckInFormComponent', () => { }); })); - it('should set default values if last check-in of key result is not null', waitForAsync(async () => { + it('should set default values if last check-in of key result is not null', waitForAsync(async() => { component.keyResult = keyResultOrdinal; component.ngOnInit(); component.setDefaultValues(); @@ -171,7 +171,7 @@ describe('CheckInFormComponent', () => { }); })); - it('should set default values with actionList on KeyResult', waitForAsync(async () => { + it('should set default values with actionList on KeyResult', waitForAsync(async() => { component.keyResult = keyResultActions; component.ngOnInit(); component.setDefaultValues(); @@ -186,7 +186,7 @@ describe('CheckInFormComponent', () => { }); })); - it('should call actionService when saving CheckIn', waitForAsync(async () => { + it('should call actionService when saving CheckIn', waitForAsync(async() => { checkInServiceMock.saveCheckIn.mockReturnValue(of(true)); actionServiceMock.updateActions.mockReturnValue(of(true)); diff --git a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.ts b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.ts index 6db471b7d1..b1e1343eb5 100644 --- a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.ts +++ b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.ts @@ -43,7 +43,7 @@ export class CheckInFormComponent implements OnInit { protected readonly hasFormFieldErrors = hasFormFieldErrors; - constructor ( + constructor( public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any, private checkInService: CheckInService, @@ -55,16 +55,16 @@ export class CheckInFormComponent implements OnInit { this.setDefaultValues(); } - ngOnInit () { + ngOnInit() { this.dialogForm.patchValue({ actionList: this.keyResult.actionList }); } - getErrorMessage (error: string, field: string, maxLength: number): string { + getErrorMessage(error: string, field: string, maxLength: number): string { return field + this.translate.instant('DIALOG_ERRORS.' + error) .format(maxLength); } - setDefaultValues () { + setDefaultValues() { this.dialogForm.controls.actionList.setValue(this.keyResult.actionList); if (this.data.checkIn != null) { this.checkIn = this.data.checkIn; @@ -87,11 +87,11 @@ export class CheckInFormComponent implements OnInit { this.checkIn = { confidence: 5 } as CheckInMin; } - calculateTarget (keyResult: KeyResultMetric): number { + calculateTarget(keyResult: KeyResultMetric): number { return keyResult.stretchGoal - (keyResult.stretchGoal - keyResult.baseline) * 0.3; } - saveCheckIn () { + saveCheckIn() { this.dialogForm.controls.confidence.setValue(this.checkIn.confidence); const baseCheckIn: any = { id: this.checkIn.id, @@ -116,7 +116,7 @@ export class CheckInFormComponent implements OnInit { }); } - getCheckInValue (): string { + getCheckInValue(): string { if ((this.checkIn as CheckInMetricMin).value != null) { return (this.checkIn as CheckInMetricMin).value!.toString(); } else { @@ -124,26 +124,26 @@ export class CheckInFormComponent implements OnInit { } } - getKeyResultMetric (): KeyResultMetric { + getKeyResultMetric(): KeyResultMetric { return this.keyResult as KeyResultMetric; } - getKeyResultOrdinal (): KeyResultOrdinal { + getKeyResultOrdinal(): KeyResultOrdinal { return this.keyResult as KeyResultOrdinal; } - getActions (): Action[] { + getActions(): Action[] { return this.dialogForm.controls['actionList'].value || []; } - changeIsChecked (event: any, index: number) { + changeIsChecked(event: any, index: number) { const actions = this.dialogForm.value.actionList!; actions[index] = { ...actions[index], isChecked: event.checked }; this.dialogForm.patchValue({ actionList: actions }); } - getDialogTitle (): string { + getDialogTitle(): string { return this.checkIn.id ? 'Check-in bearbeiten' : 'Check-in erfassen'; } } diff --git a/frontend/src/app/components/confidence/confidence.component.spec.ts b/frontend/src/app/components/confidence/confidence.component.spec.ts index e1b42cc605..f29a6e0b80 100644 --- a/frontend/src/app/components/confidence/confidence.component.spec.ts +++ b/frontend/src/app/components/confidence/confidence.component.spec.ts @@ -38,7 +38,7 @@ describe('ConfidenceComponent', () => { it.each([[{ confidence: 8 } as CheckInMin, '8'], [null, - '5']])('should set confidence of component with right value', async (checkIn: CheckInMin | null, expected: string) => { + '5']])('should set confidence of component with right value', async(checkIn: CheckInMin | null, expected: string) => { component.checkIn = checkIn!; component.ngOnChanges({ checkIn: new SimpleChange(null, component.checkIn, true) @@ -56,7 +56,7 @@ describe('ConfidenceComponent', () => { }); it.each([[true], - [false]])('should show slider on based on input var', async (editable) => { + [false]])('should show slider on based on input var', async(editable) => { component.edit = editable; fixture.detectChanges(); const slider = fixture.debugElement.query(By.css('mat-slider')); diff --git a/frontend/src/app/components/confidence/confidence.component.ts b/frontend/src/app/components/confidence/confidence.component.ts index 4bd48a4d46..bfe2b48af6 100644 --- a/frontend/src/app/components/confidence/confidence.component.ts +++ b/frontend/src/app/components/confidence/confidence.component.ts @@ -18,7 +18,7 @@ export class ConfidenceComponent implements OnChanges { @Input() checkIn!: CheckInMin; - ngOnChanges (changes: SimpleChanges) { + ngOnChanges(changes: SimpleChanges) { if (!changes['checkIn']?.currentValue) { this.checkIn = { confidence: 5 } as CheckInMin; } diff --git a/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts b/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts index 43ce3f75cc..7127efb2e1 100644 --- a/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts +++ b/frontend/src/app/components/key-result-form/key-result-form.component.spec.ts @@ -37,13 +37,13 @@ describe('KeyResultFormComponent', () => { let fixture: ComponentFixture; const oauthMockService = { - getIdentityClaims () { + getIdentityClaims() { return { name: users[1].firstname + ' ' + users[1].lastname }; } }; const userService = { - getUsers () { + getUsers() { return of(users); }, getCurrentUser: jest.fn() @@ -153,7 +153,7 @@ describe('KeyResultFormComponent', () => { .toBeTruthy(); }); - it('should have logged in user as owner', waitForAsync(async () => { + it('should have logged in user as owner', waitForAsync(async() => { const userServiceSpy = jest.spyOn(userService, 'getUsers'); component.keyResultForm.setValue(keyResultForm); component.ngOnInit(); diff --git a/frontend/src/app/components/key-result-form/key-result-form.component.ts b/frontend/src/app/components/key-result-form/key-result-form.component.ts index 1595fdb4f3..9f5fb36f00 100644 --- a/frontend/src/app/components/key-result-form/key-result-form.component.ts +++ b/frontend/src/app/components/key-result-form/key-result-form.component.ts @@ -36,11 +36,11 @@ export class KeyResultFormComponent implements OnInit, OnDestroy { @Input() keyResult!: KeyResult | null; - constructor (public userService: UserService, + constructor(public userService: UserService, private oauthService: OAuthService, private translate: TranslateService) {} - ngOnInit (): void { + ngOnInit(): void { this.users$ = this.userService.getUsers(); this.filteredUsers$ = this.keyResultForm.get('owner')?.valueChanges.pipe(startWith(''), filter((value) => typeof value === 'string'), @@ -93,63 +93,63 @@ export class KeyResultFormComponent implements OnInit, OnDestroy { }); } - ngOnDestroy () { + ngOnDestroy() { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - isMetricKeyResult () { + isMetricKeyResult() { return this.keyResultForm.controls['keyResultType'].value === 'metric'; } - setMetricValuesInForm (keyResultMetric: KeyResultMetric) { + setMetricValuesInForm(keyResultMetric: KeyResultMetric) { this.keyResultForm.controls['unit'].setValue(keyResultMetric.unit); this.keyResultForm.controls['baseline'].setValue(keyResultMetric.baseline); this.keyResultForm.controls['stretchGoal'].setValue(keyResultMetric.stretchGoal); } - setOrdinalValuesInForm (keyResultOrdinal: KeyResultOrdinal) { + setOrdinalValuesInForm(keyResultOrdinal: KeyResultOrdinal) { this.keyResultForm.controls['commitZone'].setValue(keyResultOrdinal.commitZone); this.keyResultForm.controls['targetZone'].setValue(keyResultOrdinal.targetZone); this.keyResultForm.controls['stretchZone'].setValue(keyResultOrdinal.stretchZone); } - isTouchedOrDirty (name: string) { + isTouchedOrDirty(name: string) { return this.keyResultForm.get(name)?.dirty || this.keyResultForm.get(name)?.touched; } - getErrorMessage ( + getErrorMessage( error: string, field: string, firstNumber: number | null, secondNumber: number | null ): string { return field + this.translate.instant('DIALOG_ERRORS.' + error) .format(firstNumber, secondNumber); } - filter (value: string): Observable { + filter(value: string): Observable { const filterValue = value.toLowerCase(); return this.users$.pipe(map((users) => users.filter((user) => getFullNameFromUser(user) .toLowerCase() .includes(filterValue)))); } - invalidOwner (): boolean { + invalidOwner(): boolean { return ( !!this.isTouchedOrDirty('owner') && (typeof this.keyResultForm.value.owner === 'string' || !this.keyResultForm.value.owner) ); } - getUserNameFromUser (user: User): string { + getUserNameFromUser(user: User): string { return user ? getFullNameFromUser(user) : ''; } - getKeyResultId (): number | null { + getKeyResultId(): number | null { return this.keyResult ? this.keyResult.id : null; } - updateFormValidity () {} + updateFormValidity() {} - getLoggedInUserName () { + getLoggedInUserName() { return this.getUserNameFromUser(this.userService.getCurrentUser()); } } diff --git a/frontend/src/app/components/keyresult-detail/keyresult-detail.component.spec.ts b/frontend/src/app/components/keyresult-detail/keyresult-detail.component.spec.ts index 072357901b..5422ef8cf3 100644 --- a/frontend/src/app/components/keyresult-detail/keyresult-detail.component.spec.ts +++ b/frontend/src/app/components/keyresult-detail/keyresult-detail.component.spec.ts @@ -30,7 +30,7 @@ describe('KeyresultDetailComponent', () => { let component: KeyresultDetailComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, @@ -72,13 +72,13 @@ describe('KeyresultDetailComponent', () => { .toThrowError('keyresult id is undefined'); }); - it('should display edit keyresult button if writeable is true', async () => { + it('should display edit keyresult button if writeable is true', async() => { const button = fixture.debugElement.query(By.css('[data-testId="edit-keyResult"]')); expect(button) .toBeTruthy(); }); - it('should not display edit keyresult button if writeable is false', async () => { + it('should not display edit keyresult button if writeable is false', async() => { jest.spyOn(keyResultServiceMock, 'getFullKeyResult') .mockReturnValue(of(keyResultWriteableFalse)); component.ngOnInit(); @@ -88,13 +88,13 @@ describe('KeyresultDetailComponent', () => { .toBeFalsy(); }); - it('should display add check-in button if writeable is true', async () => { + it('should display add check-in button if writeable is true', async() => { const button = fixture.debugElement.query(By.css('[data-testId="add-check-in"]')); expect(button) .toBeTruthy(); }); - it('should not display add check-in button if writeable is false', async () => { + it('should not display add check-in button if writeable is false', async() => { jest.spyOn(keyResultServiceMock, 'getFullKeyResult') .mockReturnValue(of(keyResultWriteableFalse)); component.ngOnInit(); diff --git a/frontend/src/app/components/keyresult-detail/keyresult-detail.component.ts b/frontend/src/app/components/keyresult-detail/keyresult-detail.component.ts index 382f239a3f..69ab2a4f3f 100644 --- a/frontend/src/app/components/keyresult-detail/keyresult-detail.component.ts +++ b/frontend/src/app/components/keyresult-detail/keyresult-detail.component.ts @@ -37,7 +37,7 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { protected readonly isLastCheckInNegative = isLastCheckInNegative; - constructor ( + constructor( private keyResultService: KeyresultService, private refreshDataService: RefreshDataService, private dialogService: DialogService, @@ -45,7 +45,7 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { private route: ActivatedRoute ) {} - ngOnInit (): void { + ngOnInit(): void { this.keyResultId = this.getIdFromParams(); this.loadKeyResult(this.keyResultId); this.refreshDataService.reloadKeyResultSubject.pipe(takeUntil(this.ngDestroy$)) @@ -54,12 +54,12 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { }); } - ngOnDestroy () { + ngOnDestroy() { this.ngDestroy$.next(); this.ngDestroy$.complete(); } - private getIdFromParams (): number { + private getIdFromParams(): number { const id = this.route.snapshot.paramMap.get('id'); if (!id) { throw Error('keyresult id is undefined'); @@ -67,7 +67,7 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { return parseInt(id); } - loadKeyResult (id: number): void { + loadKeyResult(id: number): void { this.keyResultService .getFullKeyResult(id) .pipe(catchError(() => EMPTY)) @@ -78,15 +78,15 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { }); } - castToMetric (keyResult: KeyResult) { + castToMetric(keyResult: KeyResult) { return keyResult as KeyResultMetric; } - castToOrdinal (keyResult: KeyResult) { + castToOrdinal(keyResult: KeyResult) { return keyResult as KeyResultOrdinal; } - checkInHistory () { + checkInHistory() { const dialogRef = this.dialogService.open(CheckInHistoryDialogComponent, { data: { keyResult: this.keyResult$.getValue(), @@ -99,7 +99,7 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { }); } - openEditKeyResultDialog (keyResult: KeyResult) { + openEditKeyResultDialog(keyResult: KeyResult) { this.dialogService .open(KeyresultDialogComponent, { data: { @@ -121,7 +121,7 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { }); } - checkForDraftState (keyResult: KeyResult) { + checkForDraftState(keyResult: KeyResult) { if (keyResult.objective.state.toUpperCase() === 'DRAFT') { this.dialogService .openConfirmDialog('CONFIRMATION.DRAFT_CREATE') @@ -136,7 +136,7 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { } } - openCheckInForm () { + openCheckInForm() { const dialogRef = this.dialogService.open(CheckInFormComponent, { data: { keyResult: this.keyResult$.getValue() @@ -149,11 +149,11 @@ export class KeyresultDetailComponent implements OnInit, OnDestroy { }); } - backToOverview () { + backToOverview() { this.router.navigate(['']); } - getKeyResultWithCorrectType (keyResult: KeyResult): KeyResultOrdinalMin | KeyResultMetricMin { + getKeyResultWithCorrectType(keyResult: KeyResult): KeyResultOrdinalMin | KeyResultMetricMin { if (keyResult.keyResultType === 'metric') { return keyResult as KeyresultMin as KeyResultMetricMin; } else { diff --git a/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts b/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts index fffc4a399c..397a27b534 100644 --- a/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts +++ b/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.spec.ts @@ -35,13 +35,13 @@ describe('KeyresultDialogComponent', () => { let keyResultService: KeyresultService; const oauthMockService = { - getIdentityClaims () { + getIdentityClaims() { return { name: users[1].firstname + ' ' + users[1].lastname }; } }; const userService = { - getUsers () { + getUsers() { return of(users); }, getCurrentUser: jest.fn() @@ -311,7 +311,7 @@ describe('KeyresultDialogComponent', () => { .toBeTruthy(); }); - it('should be able to set title', waitForAsync(async () => { + it('should be able to set title', waitForAsync(async() => { component.keyResultForm.setValue({ owner: null, actionList: [], @@ -337,7 +337,7 @@ describe('KeyresultDialogComponent', () => { .toBe(null); })); - it('should display error message of too short input', waitForAsync(async () => { + it('should display error message of too short input', waitForAsync(async() => { component.keyResultForm.setValue({ owner: testUser, actionList: [], @@ -362,7 +362,7 @@ describe('KeyresultDialogComponent', () => { .toBeTruthy(); })); - it('should display error message of required', waitForAsync(async () => { + it('should display error message of required', waitForAsync(async() => { component.keyResultForm.setValue({ owner: testUser, actionList: [], @@ -484,7 +484,7 @@ describe('KeyresultDialogComponent', () => { .toBe(testUser); })); - it('should be able to set title and description', waitForAsync(async () => { + it('should be able to set title and description', waitForAsync(async() => { expect(component.keyResultForm.value.title) .toEqual('Der Titel ist hier'); expect(component.keyResultForm.value.description) @@ -517,7 +517,7 @@ describe('KeyresultDialogComponent', () => { .toBeFalsy(); })); - it('should display error message of too short input', waitForAsync(async () => { + it('should display error message of too short input', waitForAsync(async() => { component.keyResultForm.setValue({ owner: testUser, actionList: [], @@ -539,7 +539,7 @@ describe('KeyresultDialogComponent', () => { .toBeTruthy(); })); - it('should display error message of required', waitForAsync(async () => { + it('should display error message of required', waitForAsync(async() => { component.keyResultForm.setValue({ owner: testUser, actionList: [], @@ -648,7 +648,7 @@ describe('KeyresultDialogComponent', () => { .toBe(testUser); })); - it('should be able to set title and description', waitForAsync(async () => { + it('should be able to set title and description', waitForAsync(async() => { expect(component.keyResultForm.value.title) .toEqual('Der Titel ist hier'); expect(component.keyResultForm.value.description) @@ -681,7 +681,7 @@ describe('KeyresultDialogComponent', () => { .toBeFalsy(); })); - it('should display error message of too short input', waitForAsync(async () => { + it('should display error message of too short input', waitForAsync(async() => { component.keyResultForm.setValue({ owner: testUser, actionList: [], @@ -703,7 +703,7 @@ describe('KeyresultDialogComponent', () => { .toBeTruthy(); })); - it('should display error message of required', waitForAsync(async () => { + it('should display error message of required', waitForAsync(async() => { component.keyResultForm.setValue({ owner: testUser, actionList: [], diff --git a/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.ts b/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.ts index 3abb87855d..af9422eb4e 100644 --- a/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.ts +++ b/frontend/src/app/components/keyresult-dialog/keyresult-dialog.component.ts @@ -34,7 +34,7 @@ export class KeyresultDialogComponent { keyResultType: new FormControl('metric') }); - constructor ( + constructor( @Inject(MAT_DIALOG_DATA) public data: { objective: Objective; keyResult: KeyResult; }, private keyResultService: KeyresultService, @@ -42,11 +42,11 @@ export class KeyresultDialogComponent { public dialogRef: MatDialogRef ) {} - isMetricKeyResult () { + isMetricKeyResult() { return this.keyResultForm.controls['keyResultType'].value === 'metric'; } - saveKeyResult (openNewDialog = false) { + saveKeyResult(openNewDialog = false) { const value = this.keyResultForm.value; const keyResult = this.isMetricKeyResult() ? ({ ...value, @@ -68,7 +68,7 @@ export class KeyresultDialogComponent { }); } - deleteKeyResult () { + deleteKeyResult() { this.dialogService .openConfirmDialog('CONFIRMATION.DELETE.KEYRESULT') .afterClosed() @@ -81,22 +81,22 @@ export class KeyresultDialogComponent { }); } - openNew () { + openNew() { this.saveKeyResult(true); } - isTouchedOrDirty (name: string) { + isTouchedOrDirty(name: string) { return this.keyResultForm.get(name)?.dirty || this.keyResultForm.get(name)?.touched; } - invalidOwner (): boolean { + invalidOwner(): boolean { return ( !!this.isTouchedOrDirty('owner') && (typeof this.keyResultForm.value.owner === 'string' || !this.keyResultForm.value.owner) ); } - getDialogTitle (): string { + getDialogTitle(): string { return this.data.keyResult ? 'Key Result bearbeiten' : 'Key Result erfassen'; } } diff --git a/frontend/src/app/components/keyresult-type/keyresult-type.component.ts b/frontend/src/app/components/keyresult-type/keyresult-type.component.ts index a5663560cc..e988cef30f 100644 --- a/frontend/src/app/components/keyresult-type/keyresult-type.component.ts +++ b/frontend/src/app/components/keyresult-type/keyresult-type.component.ts @@ -29,9 +29,9 @@ export class KeyresultTypeComponent implements OnInit { protected readonly hasFormFieldErrors = hasFormFieldErrors; - constructor (private translate: TranslateService) {} + constructor(private translate: TranslateService) {} - ngOnInit (): void { + ngOnInit(): void { if (this.keyresult) { this.typeChangeAllowed = (this.keyresult as KeyResultMetric | KeyResultOrdinal).lastCheckIn?.id == null; this.isMetric = this.keyresult.keyResultType == 'metric'; @@ -42,15 +42,15 @@ export class KeyresultTypeComponent implements OnInit { this.switchValidators(); } - castToMetric (keyResult: KeyResult) { + castToMetric(keyResult: KeyResult) { return keyResult as KeyResultMetric; } - castToOrdinal (keyResult: KeyResult) { + castToOrdinal(keyResult: KeyResult) { return keyResult as KeyResultOrdinal; } - switchValidators () { + switchValidators() { if (this.isMetric) { this.setValidatorsMetric(); this.clearValidatorsOrdinal(); @@ -63,12 +63,12 @@ export class KeyresultTypeComponent implements OnInit { this.updateFormValidity(); } - async updateFormValidity () { + async updateFormValidity() { await new Promise((r) => setTimeout(r, 100)); this.formValidityEmitter.emit(this.keyResultForm.invalid); } - setValidatorsMetric () { + setValidatorsMetric() { this.keyResultForm.controls['unit'].setValidators([Validators.required]); this.keyResultForm.controls['baseline'].setValidators([Validators.required, Validators.pattern('^-?\\d+\\.?\\d*$')]); @@ -76,7 +76,7 @@ export class KeyresultTypeComponent implements OnInit { Validators.pattern('^-?\\d+\\.?\\d*$')]); } - setValidatorsOrdinal () { + setValidatorsOrdinal() { this.keyResultForm.controls['commitZone'].setValidators([Validators.required, Validators.maxLength(400)]); this.keyResultForm.controls['targetZone'].setValidators([Validators.required, @@ -85,19 +85,19 @@ export class KeyresultTypeComponent implements OnInit { Validators.maxLength(400)]); } - clearValidatorsMetric () { + clearValidatorsMetric() { this.keyResultForm.controls['unit'].clearValidators(); this.keyResultForm.controls['baseline'].clearValidators(); this.keyResultForm.controls['stretchGoal'].clearValidators(); } - clearValidatorsOrdinal () { + clearValidatorsOrdinal() { this.keyResultForm.controls['commitZone'].clearValidators(); this.keyResultForm.controls['targetZone'].clearValidators(); this.keyResultForm.controls['stretchZone'].clearValidators(); } - switchKeyResultType (type: string) { + switchKeyResultType(type: string) { if (((type == 'metric' && !this.isMetric) || (type == 'ordinal' && this.isMetric)) && this.typeChangeAllowed) { this.isMetric = !this.isMetric; const keyResultType = this.isMetric ? 'metric' : 'ordinal'; @@ -106,7 +106,7 @@ export class KeyresultTypeComponent implements OnInit { } } - getErrorMessage ( + getErrorMessage( error: string, field: string, firstNumber: number | null, secondNumber: number | null ): string { return field + this.translate.instant('DIALOG_ERRORS.' + error) diff --git a/frontend/src/app/components/keyresult/keyresult.component.spec.ts b/frontend/src/app/components/keyresult/keyresult.component.spec.ts index 332a60dd38..88fc5f84dc 100644 --- a/frontend/src/app/components/keyresult/keyresult.component.spec.ts +++ b/frontend/src/app/components/keyresult/keyresult.component.spec.ts @@ -10,7 +10,7 @@ describe('KeyresultComponent', () => { let component: KeyresultComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [KeyresultComponent, ScoringComponent, diff --git a/frontend/src/app/components/keyresult/keyresult.component.ts b/frontend/src/app/components/keyresult/keyresult.component.ts index 7822690a95..791fc5eaf8 100644 --- a/frontend/src/app/components/keyresult/keyresult.component.ts +++ b/frontend/src/app/components/keyresult/keyresult.component.ts @@ -16,14 +16,14 @@ export class KeyresultComponent { protected readonly DATE_FORMAT = DATE_FORMAT; - constructor (private router: Router) {} + constructor(private router: Router) {} - openDrawer () { + openDrawer() { this.router.navigate(['details/keyresult', this.keyResult.id]); } - getKeyResultWithCorrectType (): KeyResultOrdinalMin | KeyResultMetricMin { + getKeyResultWithCorrectType(): KeyResultOrdinalMin | KeyResultMetricMin { if (this.keyResult.keyResultType === 'metric') { return this.keyResult as KeyResultMetricMin; } else { diff --git a/frontend/src/app/components/objective-detail/objective-detail.component.spec.ts b/frontend/src/app/components/objective-detail/objective-detail.component.spec.ts index 955fa92044..6a00efe244 100644 --- a/frontend/src/app/components/objective-detail/objective-detail.component.spec.ts +++ b/frontend/src/app/components/objective-detail/objective-detail.component.spec.ts @@ -27,7 +27,7 @@ describe('ObjectiveDetailComponent', () => { let component: ObjectiveDetailComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, @@ -72,14 +72,14 @@ describe('ObjectiveDetailComponent', () => { .toContain(objective.description); }); - it('should display add keyresult button if writeable is true', async () => { + it('should display add keyresult button if writeable is true', async() => { fixture.detectChanges(); const button = fixture.debugElement.query(By.css('[data-testId="add-keyResult-objective-detail"]')); expect(button) .toBeTruthy(); }); - it('should not display add keyresult button if writeable is false', async () => { + it('should not display add keyresult button if writeable is false', async() => { objectiveService.getFullObjective.mockReturnValue(of(objectiveWriteableFalse)); fixture.detectChanges(); const button = fixture.debugElement.query(By.css('[data-testId="add-keyResult-objective-detail"]')); diff --git a/frontend/src/app/components/objective-detail/objective-detail.component.ts b/frontend/src/app/components/objective-detail/objective-detail.component.ts index f38fd57611..d9c32f9249 100644 --- a/frontend/src/app/components/objective-detail/objective-detail.component.ts +++ b/frontend/src/app/components/objective-detail/objective-detail.component.ts @@ -19,7 +19,7 @@ export class ObjectiveDetailComponent implements OnInit { objective$: BehaviorSubject = new BehaviorSubject({} as Objective); - constructor ( + constructor( private objectiveService: ObjectiveService, private dialogService: DialogService, private refreshDataService: RefreshDataService, @@ -27,12 +27,12 @@ export class ObjectiveDetailComponent implements OnInit { private route: ActivatedRoute ) {} - ngOnInit (): void { + ngOnInit(): void { this.objectiveId = this.getIdFromParams(); this.loadObjective(this.objectiveId); } - private getIdFromParams (): number { + private getIdFromParams(): number { const id = this.route.snapshot.paramMap.get('id'); if (!id) { throw Error('objective id is undefined'); @@ -40,14 +40,14 @@ export class ObjectiveDetailComponent implements OnInit { return parseInt(id); } - loadObjective (id: number): void { + loadObjective(id: number): void { this.objectiveService .getFullObjective(id) .pipe(catchError(() => EMPTY)) .subscribe((objective) => this.objective$.next(objective)); } - openAddKeyResultDialog () { + openAddKeyResultDialog() { this.dialogService .open(KeyresultDialogComponent, { data: { @@ -64,7 +64,7 @@ export class ObjectiveDetailComponent implements OnInit { }); } - openEditObjectiveDialog () { + openEditObjectiveDialog() { this.dialogService .open(ObjectiveFormComponent, { data: { @@ -85,7 +85,7 @@ export class ObjectiveDetailComponent implements OnInit { }); } - backToOverview () { + backToOverview() { this.router.navigate(['']); } } diff --git a/frontend/src/app/components/objective-filter/objective-filter.component.ts b/frontend/src/app/components/objective-filter/objective-filter.component.ts index c7a64bff5a..ab4c587236 100644 --- a/frontend/src/app/components/objective-filter/objective-filter.component.ts +++ b/frontend/src/app/components/objective-filter/objective-filter.component.ts @@ -14,20 +14,20 @@ export class ObjectiveFilterComponent implements OnInit { query = ''; - constructor (private router: Router, + constructor(private router: Router, private route: ActivatedRoute) { this.refresh.pipe(debounceTime(300)) .subscribe(() => this.updateURL()); } - updateURL () { + updateURL() { const sanitizedQuery = sanitize(this.query); const params = { objectiveQuery: sanitizedQuery }; const optionalParams = optionalReplaceWithNulls(params); this.router.navigate([], { queryParams: optionalParams }); } - ngOnInit () { + ngOnInit() { this.route.queryParams.pipe(map((p) => p['objectiveQuery'])) .subscribe((query) => { const objectiveQuery = getQueryString(query); diff --git a/frontend/src/app/components/objective/ObjectiveMenuActions.ts b/frontend/src/app/components/objective/ObjectiveMenuActions.ts index 138e9c8d62..eaad39b5f2 100644 --- a/frontend/src/app/components/objective/ObjectiveMenuActions.ts +++ b/frontend/src/app/components/objective/ObjectiveMenuActions.ts @@ -11,11 +11,11 @@ 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) {} - releaseFromQuarterAction (objective: ObjectiveMin): ObjectiveMenuEntry { + releaseFromQuarterAction(objective: ObjectiveMin): ObjectiveMenuEntry { const action: ObjectiveMenuAction = () => this.dialogService.openConfirmDialog('CONFIRMATION.RELEASE'); const afterAction: ObjectiveMenuAfterAction = (objective: ObjectiveMin, dialogResult) => this.afterActions.releaseFromQuarter(objective); return { displayName: 'Objective veröffentlichen', @@ -23,7 +23,7 @@ export class ObjectiveMenuActions { afterAction: afterAction }; } - releaseFromBacklogAction (objective: ObjectiveMin): ObjectiveMenuEntry { + releaseFromBacklogAction(objective: ObjectiveMin): ObjectiveMenuEntry { const config = { data: { objective: { objectiveId: objective.id }, action: 'releaseBacklog' } }; const action: ObjectiveMenuAction = () => this.dialogService.open(ObjectiveFormComponent, config); @@ -33,7 +33,7 @@ export class ObjectiveMenuActions { afterAction }; } - editObjectiveAction (objective: ObjectiveMin): ObjectiveMenuEntry { + editObjectiveAction(objective: ObjectiveMin): ObjectiveMenuEntry { const config = { data: { objective: { objectiveId: objective.id } } }; const action: ObjectiveMenuAction = () => this.dialogService.open(ObjectiveFormComponent, config); const afterAction: ObjectiveMenuAfterAction = () => { @@ -44,7 +44,7 @@ export class ObjectiveMenuActions { afterAction: afterAction }; } - duplicateObjectiveAction (objective: ObjectiveMin): ObjectiveMenuEntry { + duplicateObjectiveAction(objective: ObjectiveMin): ObjectiveMenuEntry { const config = { data: { objective: { objectiveId: objective.id }, action: 'duplicate' } }; const action: ObjectiveMenuAction = () => this.dialogService.open(ObjectiveFormComponent, config); @@ -54,7 +54,7 @@ export class ObjectiveMenuActions { afterAction: afterAction }; } - completeObjectiveAction (objective: ObjectiveMin): ObjectiveMenuEntry { + completeObjectiveAction(objective: ObjectiveMin): ObjectiveMenuEntry { const config = { data: { objectiveTitle: objective.title } }; @@ -66,7 +66,7 @@ export class ObjectiveMenuActions { afterAction: afterAction }; } - objectiveBackToDraft (): ObjectiveMenuEntry { + objectiveBackToDraft(): ObjectiveMenuEntry { const action: ObjectiveMenuAction = () => this.dialogService.openConfirmDialog('CONFIRMATION.TO_DRAFT'); const afterAction: ObjectiveMenuAfterAction = (obj: ObjectiveMin, result: any) => this.afterActions.objectiveBackToDraft(obj); @@ -75,7 +75,7 @@ export class ObjectiveMenuActions { afterAction: afterAction }; } - objectiveReopen (): ObjectiveMenuEntry { + objectiveReopen(): ObjectiveMenuEntry { const action: ObjectiveMenuAction = () => this.dialogService.openConfirmDialog('CONFIRMATION.REOPEN'); const afterAction: ObjectiveMenuAfterAction = (obj: ObjectiveMin, result: any) => this.afterActions.objectiveReopen(obj); diff --git a/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts b/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts index 91de181c0b..dc525282a0 100644 --- a/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts +++ b/frontend/src/app/components/objective/ObjectiveMenuAfterActions.ts @@ -7,11 +7,11 @@ 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) {} - completeObjective (objectiveMin: ObjectiveMin, result: { endState: string; + completeObjective(objectiveMin: ObjectiveMin, result: { endState: string; comment: string | null; objective: any; }) { this.objectiveService.getFullObjective(objectiveMin.id) @@ -33,7 +33,7 @@ export class ObjectiveMenuAfterActions { }); } - releaseFromQuarter (objectiveMin: ObjectiveMin) { + releaseFromQuarter(objectiveMin: ObjectiveMin) { this.objectiveService.getFullObjective(objectiveMin.id) .subscribe((objective: Objective) => { objective.state = 'ONGOING' as State; @@ -44,7 +44,7 @@ export class ObjectiveMenuAfterActions { }); } - objectiveBackToDraft (objectiveMin: ObjectiveMin) { + objectiveBackToDraft(objectiveMin: ObjectiveMin) { this.objectiveService.getFullObjective(objectiveMin.id) .subscribe((objective: Objective) => { objective.state = 'DRAFT' as State; @@ -55,7 +55,7 @@ export class ObjectiveMenuAfterActions { }); } - objectiveReopen (objectiveMin: ObjectiveMin) { + objectiveReopen(objectiveMin: ObjectiveMin) { this.objectiveService.getFullObjective(objectiveMin.id) .subscribe((objective: Objective) => { objective.state = 'ONGOING' as State; diff --git a/frontend/src/app/components/objective/objective.component.spec.ts b/frontend/src/app/components/objective/objective.component.spec.ts index 8f9a3d43c5..5c4106124f 100644 --- a/frontend/src/app/components/objective/objective.component.spec.ts +++ b/frontend/src/app/components/objective/objective.component.spec.ts @@ -88,7 +88,7 @@ describe('ObjectiveColumnComponent', () => { .toBeTruthy(); }); - test('Mat-menu should open and close', async () => { + test('Mat-menu should open and close', async() => { component.isWritable = true; fixture.detectChanges(); @@ -122,7 +122,7 @@ describe('ObjectiveColumnComponent', () => { .toBe(path); }); - test('Mat-menu should not be present if writeable is false', async () => { + test('Mat-menu should not be present if writeable is false', async() => { component.isWritable = false; fixture.detectChanges(); const menu = fixture.debugElement.query(By.css('[data-testid="objective-menu"]')); @@ -130,7 +130,7 @@ describe('ObjectiveColumnComponent', () => { .toBeFalsy(); }); - test('Create keyresult button should not be present if writeable is false', async () => { + test('Create keyresult button should not be present if writeable is false', async() => { component.isWritable = false; const button = fixture.debugElement.query(By.css('[data-testId="add-keyResult"]')); expect(button) diff --git a/frontend/src/app/components/objective/objective.component.ts b/frontend/src/app/components/objective/objective.component.ts index 43e66a7258..9596777046 100644 --- a/frontend/src/app/components/objective/objective.component.ts +++ b/frontend/src/app/components/objective/objective.component.ts @@ -29,7 +29,7 @@ export class ObjectiveComponent { @ViewChild(MatMenuTrigger) trigger: MatMenuTrigger | undefined; - constructor ( + constructor( private readonly dialogService: DialogService, private readonly router: Router, private readonly refreshDataService: RefreshDataService, @@ -37,16 +37,16 @@ export class ObjectiveComponent { private readonly objectiveMenuActionsService: ObjectiveMenuActionsService ) {} - @Input() set objective (objective: ObjectiveMin) { + @Input() set objective(objective: ObjectiveMin) { this.objective$.next(objective); } - getStateTooltip (stateString: string): string { + getStateTooltip(stateString: string): string { const state = this.getStateByValue(stateString); return this.translate.instant('INFORMATION.OBJECTIVE_STATE_TOOLTIP', { state: state }); } - redirect (menuEntry: ObjectiveMenuEntry, objectiveMin: ObjectiveMin) { + redirect(menuEntry: ObjectiveMenuEntry, objectiveMin: ObjectiveMin) { const matDialogRef = menuEntry.action(); matDialogRef .afterClosed() @@ -59,12 +59,12 @@ export class ObjectiveComponent { }); } - openObjectiveDetail (objectiveId: number) { + openObjectiveDetail(objectiveId: number) { this.router.navigate(['details/objective', objectiveId]); } - openAddKeyResultDialog (objective: ObjectiveMin) { + openAddKeyResultDialog(objective: ObjectiveMin) { this.dialogService .open(KeyresultDialogComponent, { data: { @@ -81,11 +81,11 @@ export class ObjectiveComponent { }); } - isObjectiveComplete (objective: ObjectiveMin): boolean { + isObjectiveComplete(objective: ObjectiveMin): boolean { return objective.state == State.SUCCESSFUL || objective.state == State.NOTSUCCESSFUL; } - getStateByValue (value: string): string { + getStateByValue(value: string): string { return Object.keys(State) .find((key) => State[key as keyof typeof State] === value) ?? ''; } diff --git a/frontend/src/app/components/overview/overview.component.spec.ts b/frontend/src/app/components/overview/overview.component.spec.ts index 4dfb91f0d6..4d75cf23f8 100644 --- a/frontend/src/app/components/overview/overview.component.spec.ts +++ b/frontend/src/app/components/overview/overview.component.spec.ts @@ -33,11 +33,11 @@ const refreshDataServiceMock = { }; class ResizeObserverMock { - observe () {} + observe() {} - unobserve () {} + unobserve() {} - disconnect () {} + disconnect() {} } describe('OverviewComponent', () => { @@ -46,7 +46,7 @@ describe('OverviewComponent', () => { let component: OverviewComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, @@ -102,7 +102,7 @@ describe('OverviewComponent', () => { .toHaveBeenCalled(); }); - it('should load default overview on init', async () => { + it('should load default overview on init', async() => { jest.spyOn(overviewService, 'getOverview'); markFiltersAsReady(); expect(overviewService.getOverview) @@ -150,7 +150,7 @@ describe('OverviewComponent', () => { 'a a' ] ])('should load overview based on queryparams', - async ( + async( query: string, quarterParam?: number, teamsParam?: number[], objectiveQueryParam?: string ) => { jest.spyOn(overviewService, 'getOverview'); @@ -165,7 +165,7 @@ describe('OverviewComponent', () => { .toHaveBeenCalledWith(quarterParam, teamsParam, objectiveQueryParam); }); - it('should refresh overview Entities after getOverview is called', async () => { + it('should refresh overview Entities after getOverview is called', async() => { jest.spyOn(component.overviewEntities$, 'next'); jest.spyOn(component, 'loadOverview'); component.loadOverview(); @@ -175,7 +175,7 @@ describe('OverviewComponent', () => { .toHaveBeenCalledWith([overViewEntity1]); }); - it('should get default if call throws error', async () => { + it('should get default if call throws error', async() => { overviewService.getOverview.mockReturnValue(of(new Error(''))); jest.spyOn(component, 'loadOverview'); @@ -184,7 +184,7 @@ describe('OverviewComponent', () => { .toHaveBeenLastCalledWith(); }); - function markFiltersAsReady () { + function markFiltersAsReady() { refreshDataServiceMock.quarterFilterReady.next(null); refreshDataServiceMock.teamFilterReady.next(null); fixture.detectChanges(); diff --git a/frontend/src/app/components/overview/overview.component.ts b/frontend/src/app/components/overview/overview.component.ts index 745abfe922..c0724cbf63 100644 --- a/frontend/src/app/components/overview/overview.component.ts +++ b/frontend/src/app/components/overview/overview.component.ts @@ -33,7 +33,7 @@ export class OverviewComponent implements OnInit, OnDestroy { backgroundLogoSrc$ = new BehaviorSubject('assets/images/empty.svg'); - constructor ( + constructor( private overviewService: OverviewService, private refreshDataService: RefreshDataService, private activatedRoute: ActivatedRoute, @@ -55,7 +55,7 @@ export class OverviewComponent implements OnInit, OnDestroy { }); } - ngOnInit (): void { + ngOnInit(): void { this.refreshDataService.okrBannerHeightSubject.subscribe((e) => { this.overviewPadding.next(e); this.changeDetector.detectChanges(); @@ -72,7 +72,7 @@ export class OverviewComponent implements OnInit, OnDestroy { }); } - loadOverviewWithParams () { + loadOverviewWithParams() { const quarterQuery = this.activatedRoute.snapshot.queryParams['quarter']; const teamQuery = this.activatedRoute.snapshot.queryParams['teams']; const objectiveQuery = this.activatedRoute.snapshot.queryParams['objectiveQuery']; @@ -83,7 +83,7 @@ export class OverviewComponent implements OnInit, OnDestroy { this.loadOverview(quarterId, teamIds, objectiveQueryString); } - loadOverview (quarterId?: number, teamIds?: number[], objectiveQuery?: string) { + loadOverview(quarterId?: number, teamIds?: number[], objectiveQuery?: string) { this.overviewService .getOverview(quarterId, teamIds, objectiveQuery) .pipe(catchError(() => { @@ -95,7 +95,7 @@ export class OverviewComponent implements OnInit, OnDestroy { }); } - ngOnDestroy (): void { + ngOnDestroy(): void { this.destroyed$.next(true); this.destroyed$.complete(); } diff --git a/frontend/src/app/components/quarter-filter/quarter-filter.component.spec.ts b/frontend/src/app/components/quarter-filter/quarter-filter.component.spec.ts index e6243d925d..aae2470805 100644 --- a/frontend/src/app/components/quarter-filter/quarter-filter.component.spec.ts +++ b/frontend/src/app/components/quarter-filter/quarter-filter.component.spec.ts @@ -35,10 +35,10 @@ const quarters = [ ]; const quarterService = { - getAllQuarters (): Observable { + getAllQuarters(): Observable { return of(quarters); }, - getCurrentQuarter (): Observable { + getCurrentQuarter(): Observable { return of(quarters[2]); } }; @@ -77,7 +77,7 @@ describe('QuarterFilterComponent', () => { .toBeTruthy(); }); - it('should set correct default quarter if no route param is defined', async () => { + it('should set correct default quarter if no route param is defined', async() => { jest.spyOn(component, 'changeDisplayedQuarter'); jest.spyOn(quarters[2] as any, 'isCurrent') .mockReturnValue(true); @@ -94,13 +94,13 @@ describe('QuarterFilterComponent', () => { .toHaveBeenCalledTimes(1); }); - it('should set correct value in form according to route param', async () => { + it('should set correct value in form according to route param', async() => { jest.spyOn(component, 'changeDisplayedQuarter'); const routerHarnessPromise = RouterTestingHarness.create(); const quarterSelectPromise = loader.getHarness(MatSelectHarness); await Promise.all([routerHarnessPromise, quarterSelectPromise]) - .then(async ([routerHarness, + .then(async([routerHarness, quarterSelect]) => { await routerHarness.navigateByUrl('/?quarter=' + quarters[3].id); @@ -119,7 +119,7 @@ describe('QuarterFilterComponent', () => { }); }); - it('should set default quarter if quarter id in route params does not exist', async () => { + it('should set default quarter if quarter id in route params does not exist', async() => { jest.spyOn(component, 'changeDisplayedQuarter'); const quarterSelect = await loader.getHarness(MatSelectHarness); diff --git a/frontend/src/app/components/quarter-filter/quarter-filter.component.ts b/frontend/src/app/components/quarter-filter/quarter-filter.component.ts index f99408975d..5b2fb3da16 100644 --- a/frontend/src/app/components/quarter-filter/quarter-filter.component.ts +++ b/frontend/src/app/components/quarter-filter/quarter-filter.component.ts @@ -18,14 +18,14 @@ export class QuarterFilterComponent implements OnInit { currentQuarterId = -1; - constructor ( + constructor( private quarterService: QuarterService, private router: Router, private route: ActivatedRoute, private refreshDataService: RefreshDataService ) {} - ngOnInit () { + ngOnInit() { const allQuarters$ = this.quarterService.getAllQuarters(); const currentQuarter$ = this.quarterService.getCurrentQuarter(); forkJoin([allQuarters$, @@ -52,7 +52,7 @@ export class QuarterFilterComponent implements OnInit { }); } - changeDisplayedQuarter () { + changeDisplayedQuarter() { const id = this.currentQuarterId; const quarterLabel = this.quarters.getValue() .find((e) => e.id == id)?.label || ''; diff --git a/frontend/src/app/components/team-filter/team-filter.component.spec.ts b/frontend/src/app/components/team-filter/team-filter.component.spec.ts index 60f51833f9..acfde2bc6e 100644 --- a/frontend/src/app/components/team-filter/team-filter.component.spec.ts +++ b/frontend/src/app/components/team-filter/team-filter.component.spec.ts @@ -70,7 +70,7 @@ describe('TeamFilterComponent', () => { .toBeTruthy(); }); - it('should select all chips per default', waitForAsync(async () => { + it('should select all chips per default', waitForAsync(async() => { jest.spyOn(component.teams$, 'next'); jest.spyOn(component, 'changeTeamFilterParams'); component.ngOnInit(); @@ -84,7 +84,7 @@ describe('TeamFilterComponent', () => { .toHaveBeenCalledTimes(1); })); - it('should select the right chips', waitForAsync(async () => { + it('should select the right chips', waitForAsync(async() => { const teamIds = teamList.map((e) => e.id) .filter((e, i) => i < 2); jest.spyOn(component.teams$, 'next'); @@ -106,7 +106,7 @@ describe('TeamFilterComponent', () => { .toHaveBeenCalledTimes(1); })); - it('activeTeams array should contain every team when all teams are shown', waitForAsync(async () => { + it('activeTeams array should contain every team when all teams are shown', waitForAsync(async() => { const teamIds = teamList.map((e) => e.id); jest.spyOn(component.teams$, 'next'); jest.spyOn(component, 'changeTeamFilterParams'); @@ -127,7 +127,7 @@ describe('TeamFilterComponent', () => { .toHaveBeenCalledTimes(1); })); - it('change filter params and reload', fakeAsync(async () => { + it('change filter params and reload', fakeAsync(async() => { component.activeTeams = teamList.map((e) => e.id) .filter((e, i) => i < 2); const routerHarness = await RouterTestingHarness.create(); @@ -253,7 +253,7 @@ describe('TeamFilterComponent', () => { .toStrictEqual([team1.id]); }); - it('should use teams of user if no known teams are in url', async () => { + it('should use teams of user if no known teams are in url', async() => { const teamIds = [654, 478]; jest.spyOn(component.teams$, 'next'); @@ -274,7 +274,7 @@ describe('TeamFilterComponent', () => { .toHaveBeenCalledTimes(1); }); - it('should use teams of user if no teams are in url', async () => { + it('should use teams of user if no teams are in url', async() => { jest.spyOn(component.teams$, 'next'); jest.spyOn(component, 'changeTeamFilterParams'); const routerHarness = await RouterTestingHarness.create(); @@ -298,7 +298,7 @@ describe('TeamFilterComponent', () => { 3], '1,2,3'], [[], - null]])('changeTeamFilterParams', async (currentTeams: number[], routingTeams: string | null) => { + null]])('changeTeamFilterParams', async(currentTeams: number[], routingTeams: string | null) => { component.activeTeams = currentTeams; jest.spyOn(router, 'navigate'); @@ -312,7 +312,7 @@ describe('TeamFilterComponent', () => { .toHaveBeenCalledWith([], { queryParams: { teams: routingTeams } }); }); - it('should filter teams by toggled priority and then by name', async () => { + it('should filter teams by toggled priority and then by name', async() => { const teams = [ { id: 1, version: 0, diff --git a/frontend/src/app/components/team-filter/team-filter.component.ts b/frontend/src/app/components/team-filter/team-filter.component.ts index 3aaf7b9ce9..f1708d283b 100644 --- a/frontend/src/app/components/team-filter/team-filter.component.ts +++ b/frontend/src/app/components/team-filter/team-filter.component.ts @@ -30,7 +30,7 @@ export class TeamFilterComponent implements OnInit, OnDestroy { isMobile = false; - constructor ( + constructor( private teamService: TeamService, private route: ActivatedRoute, private router: Router, @@ -44,7 +44,7 @@ export class TeamFilterComponent implements OnInit, OnDestroy { }); } - ngOnInit (): void { + ngOnInit(): void { this.refreshTeamData(); this.breakpointObserver @@ -55,7 +55,7 @@ export class TeamFilterComponent implements OnInit, OnDestroy { }); } - private refreshTeamData () { + private refreshTeamData() { if (this.subscription) { this.subscription.unsubscribe(); } @@ -82,12 +82,12 @@ export class TeamFilterComponent implements OnInit, OnDestroy { }); } - ngOnDestroy () { + ngOnDestroy() { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - changeTeamFilterParams () { + changeTeamFilterParams() { const params = { teams: this.activeTeams.join(',') }; const optionalParams = optionalReplaceWithNulls(params); this.router @@ -95,7 +95,7 @@ export class TeamFilterComponent implements OnInit, OnDestroy { .then(() => this.refreshDataService.teamFilterReady.next()); } - toggleSelection (id: number) { + toggleSelection(id: number) { if (this.areAllTeamsShown()) { this.activeTeams = [id]; } else if (this.activeTeams.includes(id)) { @@ -110,27 +110,27 @@ export class TeamFilterComponent implements OnInit, OnDestroy { this.changeTeamFilterParams(); } - areAllTeamsShown () { + areAllTeamsShown() { return areEqual(this.activeTeams, this.getAllTeamIds()); } - toggleAll () { + toggleAll() { this.activeTeams = this.areAllTeamsShown() ? [] : this.getAllTeamIds(); this.changeTeamFilterParams(); } - getAllTeamIds () { + getAllTeamIds() { return this.teams$.getValue() .map((team) => team.id); } - getTeamName (id: number): string { + getTeamName(id: number): string { const teamName = this.teams$.getValue() .find((team) => team.id === id)?.name; return teamName ?? 'no team name'; } - sortTeamsToggledPriority () { + sortTeamsToggledPriority() { return this.teams$.getValue() .sort((a, b) => { const aToggled = this.activeTeams.includes(a.id) ? 0 : 1; diff --git a/frontend/src/app/components/team/team.component.spec.ts b/frontend/src/app/components/team/team.component.spec.ts index 0ddc518e44..4f042ec920 100644 --- a/frontend/src/app/components/team/team.component.spec.ts +++ b/frontend/src/app/components/team/team.component.spec.ts @@ -49,7 +49,7 @@ describe('TeamComponent', () => { let component: TeamComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ RouterTestingModule, @@ -101,7 +101,7 @@ describe('TeamComponent', () => { .toBeTruthy(); }); - it('should display add objective button if writeable is true', async () => { + it('should display add objective button if writeable is true', async() => { fixture.detectChanges(); const button = fixture.debugElement.query(By.css('[data-testId="add-objective"]')); expect(button) @@ -130,7 +130,7 @@ describe('TeamComponent undefined values in config service', () => { let component: TeamComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [MatMenuModule, TranslateTestingModule.withTranslations({ diff --git a/frontend/src/app/components/team/team.component.ts b/frontend/src/app/components/team/team.component.ts index 8303eef554..6e86c8f7fb 100644 --- a/frontend/src/app/components/team/team.component.ts +++ b/frontend/src/app/components/team/team.component.ts @@ -22,7 +22,7 @@ export class TeamComponent { addIconSrc = new BehaviorSubject('assets/icons/new-icon.svg'); - constructor (private dialogService: DialogService, + constructor(private dialogService: DialogService, private refreshDataService: RefreshDataService, private configService: ConfigService) { this.configService.config$.pipe(first()) @@ -34,7 +34,7 @@ export class TeamComponent { trackByObjectiveId: TrackByFunction = (index, objective) => objective.id; - createObjective () { + createObjective() { const matDialogRef = this.dialogService.open(ObjectiveFormComponent, { data: { objective: { @@ -51,7 +51,7 @@ export class TeamComponent { }); } - openAddKeyResultDialog (objective: Objective) { + openAddKeyResultDialog(objective: Objective) { this.dialogService .open(KeyresultDialogComponent, { data: { diff --git a/frontend/src/app/guards/auth.guard.spec.ts b/frontend/src/app/guards/auth.guard.spec.ts index c3d13a8709..5687143c4d 100644 --- a/frontend/src/app/guards/auth.guard.spec.ts +++ b/frontend/src/app/guards/auth.guard.spec.ts @@ -51,7 +51,7 @@ describe('authGuard', () => { .toBeTruthy(); }); - it('should not call initCodeFlow if token is valid and call router if state param exist', async () => { + it('should not call initCodeFlow if token is valid and call router if state param exist', async() => { jest.spyOn(oAuthMock, 'hasValidIdToken') .mockReturnValue(true); route.queryParamMap.set('state', 1234); @@ -70,7 +70,7 @@ describe('authGuard', () => { .toHaveBeenCalled(); }); - it('should not call router if state param does not exist', async () => { + it('should not call router if state param does not exist', async() => { jest.spyOn(oAuthMock, 'hasValidIdToken') .mockReturnValue(true); route.queryParamMap.set('state', null); @@ -82,7 +82,7 @@ describe('authGuard', () => { expect(routerMock.navigateByUrl).not.toHaveBeenCalled(); }); - it('should call initCodeFlow if token is invalid', async () => { + it('should call initCodeFlow if token is invalid', async() => { jest.spyOn(oAuthMock, 'hasValidIdToken') .mockReturnValue(false); const result = await runAuthGuardWithContext(authGuard); @@ -96,7 +96,7 @@ describe('authGuard', () => { expect(oAuthMock.setupAutomaticSilentRefresh).not.toHaveBeenCalled(); }); - async function runAuthGuardWithContext (authGuard: any): Promise { + async function runAuthGuardWithContext(authGuard: any): Promise { return await TestBed.runInInjectionContext(() => authGuard(route, null)); } }); diff --git a/frontend/src/app/guards/auth.guard.ts b/frontend/src/app/guards/auth.guard.ts index 60aea79779..cbccbc8166 100644 --- a/frontend/src/app/guards/auth.guard.ts +++ b/frontend/src/app/guards/auth.guard.ts @@ -6,7 +6,7 @@ export const authGuard: CanActivateFn = (route, state) => { const oauthService = inject(OAuthService); const router = inject(Router); return oauthService.loadDiscoveryDocumentAndTryLogin() - .then(async () => { + .then(async() => { // if the login failed initialize code flow const validToken = oauthService.hasValidIdToken(); if (!validToken) { diff --git a/frontend/src/app/interceptors/error-interceptor.service.ts b/frontend/src/app/interceptors/error-interceptor.service.ts index ed876275a4..23ad72a6b9 100644 --- a/frontend/src/app/interceptors/error-interceptor.service.ts +++ b/frontend/src/app/interceptors/error-interceptor.service.ts @@ -16,11 +16,11 @@ 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) {} - intercept (request: HttpRequest, next: HttpHandler): Observable> { + intercept(request: HttpRequest, next: HttpHandler): Observable> { return next.handle(request) .pipe(filter((event) => event instanceof HttpResponse), tap((response) => { @@ -38,20 +38,20 @@ export class ErrorInterceptor implements HttpInterceptor { })); } - handleErrorToaster (response: any) { + handleErrorToaster(response: any) { const errors = response.error.errors.map((error: any) => this.translate.instant(ERROR_MESSAGE_KEY_PREFIX + error.errorKey) .format(error.params)); errors.forEach((error: string) => this.toasterService.showError(error)); } - handleDrawerError (request: any) { + handleDrawerError(request: any) { if (DRAWER_ROUTES.some((route) => request.url.includes(route))) { this.router.navigate(['']); } } - handleSuccessToaster (response: any, method: HttpType) { + handleSuccessToaster(response: any, method: HttpType) { const successMessageObj = this.getSuccessMessageKey(response.url, response.status, method); if (!successMessageObj) return; @@ -64,7 +64,7 @@ export class ErrorInterceptor implements HttpInterceptor { this.toasterService.showCustomToaster(message, successMessageObj.toasterType); } - getSuccessMessageKey (url: string, statusCode: number, method: HttpType) { + getSuccessMessageKey(url: string, statusCode: number, method: HttpType) { for (const key in SUCCESS_MESSAGE_MAP) { const value = SUCCESS_MESSAGE_MAP[key]; if (!url.includes(key)) continue; @@ -87,7 +87,7 @@ export class ErrorInterceptor implements HttpInterceptor { return undefined; } - checkForToaster (response: any): boolean { + checkForToaster(response: any): boolean { const requestURL = new URL(response.url); return window.location.hostname == requestURL.hostname && requestURL.pathname.startsWith('/api'); } diff --git a/frontend/src/app/interceptors/oauth.interceptor.ts b/frontend/src/app/interceptors/oauth.interceptor.ts index 7787d60cb9..28934d09fc 100644 --- a/frontend/src/app/interceptors/oauth.interceptor.ts +++ b/frontend/src/app/interceptors/oauth.interceptor.ts @@ -7,9 +7,9 @@ import { OAuthService } from 'angular-oauth2-oidc'; providedIn: 'root' }) export class OauthInterceptor implements HttpInterceptor { - constructor (private oauthService: OAuthService) {} + constructor(private oauthService: OAuthService) {} - intercept (req: HttpRequest, next: HttpHandler): Observable> { + intercept(req: HttpRequest, next: HttpHandler): Observable> { if (!req.url.match(/^(\/)?api/)) { return next.handle(req); } diff --git a/frontend/src/app/services/action.service.ts b/frontend/src/app/services/action.service.ts index 3ad8d6e767..a2ec00407a 100644 --- a/frontend/src/app/services/action.service.ts +++ b/frontend/src/app/services/action.service.ts @@ -7,13 +7,13 @@ import { Action } from '../shared/types/model/Action'; providedIn: 'root' }) export class ActionService { - constructor (private httpClient: HttpClient) {} + constructor(private httpClient: HttpClient) {} - updateActions (actionList: Action[]): Observable { + updateActions(actionList: Action[]): Observable { return this.httpClient.put(`/api/v2/action`, actionList); } - deleteAction (actionId: number): Observable { + deleteAction(actionId: number): Observable { return this.httpClient.delete(`/api/v2/action/${actionId}`); } } diff --git a/frontend/src/app/services/check-in.service.ts b/frontend/src/app/services/check-in.service.ts index 3f995ad4d1..873e31be05 100644 --- a/frontend/src/app/services/check-in.service.ts +++ b/frontend/src/app/services/check-in.service.ts @@ -8,13 +8,13 @@ import { CheckIn } from '../shared/types/model/CheckIn'; providedIn: 'root' }) export class CheckInService { - constructor (private httpclient: HttpClient) {} + constructor(private httpclient: HttpClient) {} - getAllCheckInOfKeyResult (keyResultId: number): Observable { + getAllCheckInOfKeyResult(keyResultId: number): Observable { return this.httpclient.get(`/api/v2/keyresults/${keyResultId}/checkins`); } - saveCheckIn (checkIn: CheckIn) { + saveCheckIn(checkIn: CheckIn) { if (checkIn.id) { return this.httpclient.put('/api/v2/checkIns/' + checkIn.id, checkIn); } else { diff --git a/frontend/src/app/services/completed.servce.ts b/frontend/src/app/services/completed.servce.ts index c7abf2641e..5cfd95f666 100644 --- a/frontend/src/app/services/completed.servce.ts +++ b/frontend/src/app/services/completed.servce.ts @@ -7,13 +7,13 @@ import { Completed } from '../shared/types/model/Completed'; providedIn: 'root' }) export class CompletedService { - constructor (private httpClient: HttpClient) {} + constructor(private httpClient: HttpClient) {} - createCompleted (completed: Completed): Observable { + createCompleted(completed: Completed): Observable { return this.httpClient.post('/api/v2/completed', completed); } - deleteCompleted (objectiveId: number): Observable { + deleteCompleted(objectiveId: number): Observable { return this.httpClient.delete('/api/v2/completed/' + objectiveId); } } diff --git a/frontend/src/app/services/config.service.ts b/frontend/src/app/services/config.service.ts index da718e6d78..4d128def97 100644 --- a/frontend/src/app/services/config.service.ts +++ b/frontend/src/app/services/config.service.ts @@ -9,7 +9,7 @@ import { ClientConfig } from '../shared/types/model/ClientConfig'; export class ConfigService { public config$: Observable; - constructor (private httpClient: HttpClient) { + constructor(private httpClient: HttpClient) { this.config$ = this.httpClient.get('/config') .pipe(shareReplay()); } diff --git a/frontend/src/app/services/customization.service.spec.ts b/frontend/src/app/services/customization.service.spec.ts index 692bbff002..e6130449df 100644 --- a/frontend/src/app/services/customization.service.spec.ts +++ b/frontend/src/app/services/customization.service.spec.ts @@ -6,22 +6,22 @@ import { ConfigService } from './config.service'; class CallRecorder { private calls: Record = {}; - public add (key: string, value: any): void { + public add(key: string, value: any): void { if (!this.calls[key]) { this.calls[key] = []; } this.calls[key].push(value); } - public getCallByIdx (key: string, index = 0): any[] { + public getCallByIdx(key: string, index = 0): any[] { return this.calls[key][index]; } - public getCallCount (key: string): number { + public getCallCount(key: string): number { return this.calls[key]?.length ?? 0; } - public clear (): void { + public clear(): void { this.calls = {}; } } @@ -54,22 +54,22 @@ describe('CustomizationService', () => { documentMock = { getElementById: (id: string) => { return { - setAttribute: function () { + setAttribute: function() { callRecorder.add(`${id}-setAttribute`, arguments); } } as unknown as HTMLElement; }, querySelector: (selector: string) => { return { - set innerHTML (value: string) { + set innerHTML(value: string) { callRecorder.add(`${selector}.innerHTML`, arguments); }, - get style () { + get style() { return { - setProperty: function () { + setProperty: function() { callRecorder.add(`${selector}.style.setProperty`, arguments); }, - removeProperty: function () { + removeProperty: function() { callRecorder.add(`${selector}.style.removeProperty`, arguments); } }; diff --git a/frontend/src/app/services/customization.service.ts b/frontend/src/app/services/customization.service.ts index 6f191b86bd..8f1275ca73 100644 --- a/frontend/src/app/services/customization.service.ts +++ b/frontend/src/app/services/customization.service.ts @@ -9,18 +9,18 @@ import { ConfigService } from './config.service'; export class CustomizationService { private currentConfig?: CustomizationConfig; - constructor (configService: ConfigService, + constructor(configService: ConfigService, @Inject(DOCUMENT) private document: Document) { configService.config$.subscribe((config) => { this.updateCustomizations(config); }); } - public getCurrentConfig () { + public getCurrentConfig() { return this.currentConfig; } - private updateCustomizations (config: CustomizationConfig) { + private updateCustomizations(config: CustomizationConfig) { this.setTitle(config.title); this.setFavicon(config.favicon); this.setStyleCustomizations(config.customStyles); @@ -28,7 +28,7 @@ export class CustomizationService { this.currentConfig = config; } - private setFavicon (favicon: string) { + private setFavicon(favicon: string) { if (!favicon || this.currentConfig?.favicon === favicon) { return; } @@ -41,7 +41,7 @@ export class CustomizationService { ?.setAttribute('href', favicon); } - private setTitle (title: string) { + private setTitle(title: string) { if (!title || this.currentConfig?.title === title) { return; } @@ -53,7 +53,7 @@ export class CustomizationService { this.document.querySelector('title')!.innerHTML = title; } - private setStyleCustomizations (customStylesMap: CustomStyles) { + private setStyleCustomizations(customStylesMap: CustomStyles) { if (!customStylesMap || this.areStylesTheSame(customStylesMap)) { return; } @@ -62,11 +62,11 @@ export class CustomizationService { this.setStyles(customStylesMap); } - private areStylesTheSame (customStylesMap: CustomStyles) { + private areStylesTheSame(customStylesMap: CustomStyles) { return JSON.stringify(this.currentConfig?.customStyles) === JSON.stringify(customStylesMap); } - private setStyles (customStylesMap: CustomStyles | undefined) { + private setStyles(customStylesMap: CustomStyles | undefined) { if (!customStylesMap) { return; } @@ -87,7 +87,7 @@ export class CustomizationService { }); } - private removeStyles (customStylesMap: CustomStyles | undefined) { + private removeStyles(customStylesMap: CustomStyles | undefined) { if (!customStylesMap) { return; } diff --git a/frontend/src/app/services/dialog.service.spec.ts b/frontend/src/app/services/dialog.service.spec.ts index 1be92d147c..14362ea020 100644 --- a/frontend/src/app/services/dialog.service.spec.ts +++ b/frontend/src/app/services/dialog.service.spec.ts @@ -27,7 +27,7 @@ describe('DialogService', () => { jest.spyOn(matDialogSpy, 'open'); }); - function expectData (current: ConfirmDialogData, expected: ConfirmDialogData) { + function expectData(current: ConfirmDialogData, expected: ConfirmDialogData) { expect(current.title) .toBe(expected.title); expect(current.text) @@ -40,28 +40,28 @@ describe('DialogService', () => { .toBe(expected.closeButtonState); } - function expectYesButtonIsVisibleAndEnabled (dialog: ConfirmDialogComponent) { + function expectYesButtonIsVisibleAndEnabled(dialog: ConfirmDialogComponent) { expect(dialog.isYesButtonVisible()) .toBe(true); expect(dialog.isYesButtonDisabled()) .toBe(false); } - function expectNoButtonIsVisibleAndEnabled (dialog: ConfirmDialogComponent) { + function expectNoButtonIsVisibleAndEnabled(dialog: ConfirmDialogComponent) { expect(dialog.isNoButtonVisible()) .toBe(true); expect(dialog.isNoButtonDisabled()) .toBe(false); } - function expectCloseButtonIsHiddenAndEnabled (dialog: ConfirmDialogComponent) { + function expectCloseButtonIsHiddenAndEnabled(dialog: ConfirmDialogComponent) { expect(dialog.isCloseButtonVisible()) .toBe(false); expect(dialog.isCloseButtonDisabled()) .toBe(false); } - function expectNoButtonIsVisibleAndDisabled (dialog: ConfirmDialogComponent) { + function expectNoButtonIsVisibleAndDisabled(dialog: ConfirmDialogComponent) { expect(dialog.isNoButtonVisible()) .toBe(true); expect(dialog.isNoButtonDisabled()) diff --git a/frontend/src/app/services/dialog.service.ts b/frontend/src/app/services/dialog.service.ts index 37b1b0647f..b0d1eb49a2 100644 --- a/frontend/src/app/services/dialog.service.ts +++ b/frontend/src/app/services/dialog.service.ts @@ -27,7 +27,7 @@ export class DialogService { autoFocus: 'first-tabbable' }; - constructor (private readonly dialog: MatDialog, + constructor(private readonly dialog: MatDialog, private readonly translationService: TranslateService) {} open(component: ComponentType, config?: MatDialogConfig): MatDialogRef { @@ -38,7 +38,7 @@ export class DialogService { }); } - openConfirmDialog (translationKey: string, i18nData?: object): MatDialogRef { + openConfirmDialog(translationKey: string, i18nData?: object): MatDialogRef { const title = this.translationService.instant(`${translationKey}.TITLE`, i18nData); const text = this.translationService.instant(`${translationKey}.TEXT`, i18nData); return this.open(ConfirmDialogComponent, { @@ -50,7 +50,7 @@ export class DialogService { }); } - openCustomizedConfirmDialog (data: ConfirmDialogData): MatDialogRef { + openCustomizedConfirmDialog(data: ConfirmDialogData): MatDialogRef { return this.open(ConfirmDialogComponent, { panelClass: this.DIALOG_PANEL_CLASS_SMALL, data: { diff --git a/frontend/src/app/services/keyresult.service.ts b/frontend/src/app/services/keyresult.service.ts index 6186222cd5..a4dd7fa76b 100644 --- a/frontend/src/app/services/keyresult.service.ts +++ b/frontend/src/app/services/keyresult.service.ts @@ -8,9 +8,9 @@ import { KeyResultDTO } from '../shared/types/DTOs/KeyResultDTO'; providedIn: 'root' }) export class KeyresultService { - constructor (private httpClient: HttpClient) {} + constructor(private httpClient: HttpClient) {} - getFullKeyResult (keyresultId: number): Observable { + getFullKeyResult(keyresultId: number): Observable { return this.httpClient.get('/api/v2/keyresults/' + keyresultId) .pipe(map((keyresult: any) => { keyresult.objective.quarter = keyresult.objective.keyResultQuarterDto; @@ -18,7 +18,7 @@ export class KeyresultService { })); } - saveKeyResult (keyResultDTO: KeyResultDTO): Observable { + saveKeyResult(keyResultDTO: KeyResultDTO): Observable { if (keyResultDTO.id) { return this.httpClient.put(`/api/v2/keyresults/` + keyResultDTO.id, keyResultDTO); } else { @@ -26,7 +26,7 @@ export class KeyresultService { } } - deleteKeyResult (keyResultId: number): Observable { + deleteKeyResult(keyResultId: number): Observable { return this.httpClient.delete(`/api/v2/keyresults/` + keyResultId); } } diff --git a/frontend/src/app/services/objective-menu-actions.service.ts b/frontend/src/app/services/objective-menu-actions.service.ts index c5223b967b..0c67435f0d 100644 --- a/frontend/src/app/services/objective-menu-actions.service.ts +++ b/frontend/src/app/services/objective-menu-actions.service.ts @@ -27,7 +27,7 @@ export class ObjectiveMenuActionsService { actions: ObjectiveMenuActions; - constructor ( + constructor( dialogService: DialogService, objectiveService: ObjectiveService, completedService: CompletedService, @@ -37,12 +37,12 @@ export class ObjectiveMenuActionsService { this.actions = new ObjectiveMenuActions(dialogService, refreshDataService, this.afterActions); } - getMenu (objective: ObjectiveMin): ObjectiveMenuEntry[] { + getMenu(objective: ObjectiveMin): ObjectiveMenuEntry[] { return [...this.getSpecificMenuEntries(objective), ...this.getDefaultActions(objective)]; } - private getSpecificMenuEntries (objective: ObjectiveMin): ObjectiveMenuEntry[] { + private getSpecificMenuEntries(objective: ObjectiveMin): ObjectiveMenuEntry[] { if (this.isObjectiveComplete(objective)) { return this.getCompletedMenuActions(objective); } else if (objective.state === State.ONGOING) { @@ -53,36 +53,36 @@ export class ObjectiveMenuActionsService { throw new Error('Objective invalid'); } - private getDefaultActions (objective: ObjectiveMin): ObjectiveMenuEntry[] { + private getDefaultActions(objective: ObjectiveMin): ObjectiveMenuEntry[] { return [this.actions.duplicateObjectiveAction(objective)]; } - private getDraftMenuActions (objective: ObjectiveMin): ObjectiveMenuEntry[] { + private getDraftMenuActions(objective: ObjectiveMin): ObjectiveMenuEntry[] { return [this.actions.editObjectiveAction(objective), this.getReleaseAction(objective)]; } - private getOngoingMenuActions (objective: ObjectiveMin): ObjectiveMenuEntry[] { + private getOngoingMenuActions(objective: ObjectiveMin): ObjectiveMenuEntry[] { return [this.actions.editObjectiveAction(objective), this.actions.completeObjectiveAction(objective), this.actions.objectiveBackToDraft()]; } - private getCompletedMenuActions (objective: ObjectiveMin): ObjectiveMenuEntry[] { + private getCompletedMenuActions(objective: ObjectiveMin): ObjectiveMenuEntry[] { return [this.actions.objectiveReopen()]; } - private getReleaseAction (objective: ObjectiveMin): ObjectiveMenuEntry { + private getReleaseAction(objective: ObjectiveMin): ObjectiveMenuEntry { return this.isInBacklogQuarter(objective) ? this.actions.releaseFromBacklogAction(objective) : this.actions.releaseFromQuarterAction(objective); } - private isObjectiveComplete (objective: ObjectiveMin): boolean { + private isObjectiveComplete(objective: ObjectiveMin): boolean { return objective.state == State.SUCCESSFUL || objective.state == State.NOTSUCCESSFUL; } - private isInBacklogQuarter (objective: ObjectiveMin) { + private isInBacklogQuarter(objective: ObjectiveMin) { return !GJ_REGEX_PATTERN.test(objective.quarter.label); } } diff --git a/frontend/src/app/services/objective.service.ts b/frontend/src/app/services/objective.service.ts index 20c96ea252..894f4c23a1 100644 --- a/frontend/src/app/services/objective.service.ts +++ b/frontend/src/app/services/objective.service.ts @@ -11,29 +11,29 @@ import { Action } from '../shared/types/model/Action'; providedIn: 'root' }) export class ObjectiveService { - constructor (private httpClient: HttpClient) {} + constructor(private httpClient: HttpClient) {} - getFullObjective (id: number) { + getFullObjective(id: number) { return this.httpClient.get('/api/v2/objectives/' + id); } - getAllKeyResultsByObjective (id: number): Observable { + getAllKeyResultsByObjective(id: number): Observable { return this.httpClient.get('api/v2/objectives/' + id + '/keyResults'); } - createObjective (objectiveDTO: Objective): Observable { + createObjective(objectiveDTO: Objective): Observable { return this.httpClient.post('/api/v2/objectives', objectiveDTO); } - updateObjective (objectiveDTO: Objective): Observable { + updateObjective(objectiveDTO: Objective): Observable { return this.httpClient.put(`/api/v2/objectives/${objectiveDTO.id}`, objectiveDTO); } - deleteObjective (objectiveId: number): Observable { + deleteObjective(objectiveId: number): Observable { return this.httpClient.delete(`/api/v2/objectives/${objectiveId}`); } - duplicateObjective (objectiveId: number, + duplicateObjective(objectiveId: number, duplicateObjectiveDto: { keyResults: { owner: User; diff --git a/frontend/src/app/services/overview.service.ts b/frontend/src/app/services/overview.service.ts index 6a9e438105..74ec7bcb41 100644 --- a/frontend/src/app/services/overview.service.ts +++ b/frontend/src/app/services/overview.service.ts @@ -9,9 +9,9 @@ import { OverviewEntity } from '../shared/types/model/OverviewEntity'; providedIn: 'root' }) export class OverviewService { - constructor (private http: HttpClient) {} + constructor(private http: HttpClient) {} - getOverview (quarterId?: number, teamIds?: number[], objectiveQuery?: string): Observable { + getOverview(quarterId?: number, teamIds?: number[], objectiveQuery?: string): Observable { const params = optionalValue({ quarter: quarterId, team: teamIds, diff --git a/frontend/src/app/services/quarter.service.ts b/frontend/src/app/services/quarter.service.ts index d177a4f94c..4a03acb815 100644 --- a/frontend/src/app/services/quarter.service.ts +++ b/frontend/src/app/services/quarter.service.ts @@ -7,9 +7,9 @@ import { map, Observable } from 'rxjs'; providedIn: 'root' }) export class QuarterService { - constructor (private http: HttpClient) {} + constructor(private http: HttpClient) {} - getAllQuarters (): Observable { + getAllQuarters(): Observable { return this.http .get('/api/v2/quarters') .pipe(map((quarters) => quarters.map((quarter) => new Quarter( @@ -17,7 +17,7 @@ export class QuarterService { )))); } - getCurrentQuarter (): Observable { + getCurrentQuarter(): Observable { return this.http.get('/api/v2/quarters/current'); } } diff --git a/frontend/src/app/services/refresh-data.service.ts b/frontend/src/app/services/refresh-data.service.ts index 89d9915404..4b4e5d86d5 100644 --- a/frontend/src/app/services/refresh-data.service.ts +++ b/frontend/src/app/services/refresh-data.service.ts @@ -16,7 +16,7 @@ export class RefreshDataService { public okrBannerHeightSubject: BehaviorSubject = new BehaviorSubject(DEFAULT_HEADER_HEIGHT_PX); - markDataRefresh () { + markDataRefresh() { this.reloadOverviewSubject.next(); } } diff --git a/frontend/src/app/services/team.service.ts b/frontend/src/app/services/team.service.ts index 2503847e31..dcf8b52698 100644 --- a/frontend/src/app/services/team.service.ts +++ b/frontend/src/app/services/team.service.ts @@ -9,7 +9,7 @@ import { UserTeam } from '../shared/types/model/UserTeam'; providedIn: 'root' }) export class TeamService { - constructor (private http: HttpClient) {} + constructor(private http: HttpClient) {} private teams: BehaviorSubject = new BehaviorSubject([]); @@ -17,7 +17,7 @@ export class TeamService { private readonly API_URL = '/api/v2/teams'; - getAllTeams (): Observable { + getAllTeams(): Observable { if (!this.teamsLoaded) { this.reloadTeams(); this.teamsLoaded = true; @@ -25,7 +25,7 @@ export class TeamService { return this.teams.asObservable(); } - reloadTeams (): void { + reloadTeams(): void { this.http.get(this.API_URL) .subscribe((teams) => { if (!this.teams) { @@ -36,32 +36,32 @@ export class TeamService { }); } - createTeam (team: Team): Observable { + createTeam(team: Team): Observable { return this.http.post(this.API_URL, team) .pipe(tap(() => this.reloadTeams())); } - updateTeam (team: Team): Observable { + updateTeam(team: Team): Observable { return this.http.put(`${this.API_URL}/${team.id}`, team) .pipe(tap(() => this.reloadTeams())); } - deleteTeam (id: number): Observable { + deleteTeam(id: number): Observable { return this.http.delete(`${this.API_URL}/${id}`) .pipe(tap(() => this.reloadTeams())); } - addUsersToTeam (team: Team, selectedUsers: User[]): Observable { + addUsersToTeam(team: Team, selectedUsers: User[]): Observable { return this.http.put(`${this.API_URL}/${team.id}/addusers`, selectedUsers); } - removeUserFromTeam (userId: number, team: Team): Observable { + removeUserFromTeam(userId: number, team: Team): Observable { return this.http .put(`${this.API_URL}/${team.id}/user/${userId}/removeuser`, null) .pipe(tap(() => this.reloadTeams())); } - updateOrAddTeamMembership (userId: number, userTeam: UserTeam): Observable { + updateOrAddTeamMembership(userId: number, userTeam: UserTeam): Observable { return this.http .put(`${this.API_URL}/${userTeam.team.id}/user/${userId}/updateaddteammembership/${userTeam.isTeamAdmin}`, {}) diff --git a/frontend/src/app/services/toaster.service.ts b/frontend/src/app/services/toaster.service.ts index 257edd9312..0fce4c106f 100644 --- a/frontend/src/app/services/toaster.service.ts +++ b/frontend/src/app/services/toaster.service.ts @@ -6,21 +6,21 @@ import { ToasterType } from '../shared/types/enums/ToasterType'; providedIn: 'root' }) export class ToasterService { - constructor (private toastr: ToastrService) {} + constructor(private toastr: ToastrService) {} - showSuccess (msg: string) { + showSuccess(msg: string) { this.toastr.success(msg, 'Erfolgreich!'); } - showError (msg: string) { + showError(msg: string) { this.toastr.error(msg, 'Fehler!'); } - showWarn (msg: string) { + showWarn(msg: string) { this.toastr.warning(msg, 'Warnung!'); } - showCustomToaster (msg: string, type?: ToasterType) { + showCustomToaster(msg: string, type?: ToasterType) { switch (type) { case ToasterType.SUCCESS: this.showSuccess(msg); diff --git a/frontend/src/app/services/user.service.ts b/frontend/src/app/services/user.service.ts index 40dcce0ea8..fa62e4d74f 100644 --- a/frontend/src/app/services/user.service.ts +++ b/frontend/src/app/services/user.service.ts @@ -17,28 +17,28 @@ export class UserService { private usersLoaded = false; - constructor (private httpClient: HttpClient) {} + constructor(private httpClient: HttpClient) {} - public getOrInitCurrentUser (): Observable { + public getOrInitCurrentUser(): Observable { if (this._currentUser) { return of(this._currentUser); } return this.reloadCurrentUser(); } - public reloadCurrentUser (): Observable { + public reloadCurrentUser(): Observable { return this.httpClient.get(this.API_URL + '/current') .pipe(tap((u) => (this._currentUser = u))); } - public getCurrentUser (): User { + public getCurrentUser(): User { if (!this._currentUser) { throw new Error('user should not be undefined here'); } return this._currentUser; } - public getUsers (): Observable { + public getUsers(): Observable { if (!this.usersLoaded) { this.usersLoaded = true; this.reloadUsers(); @@ -46,16 +46,16 @@ export class UserService { return this.users.asObservable(); } - public reloadUsers (): void { + public reloadUsers(): void { this.httpClient.get(this.API_URL) .subscribe((users) => this.users.next(users)); } - getUserById (id: number): Observable { + getUserById(id: number): Observable { return this.httpClient.get(this.API_URL + '/' + id); } - setIsOkrChampion (user: User, isOkrChampion: boolean) { + setIsOkrChampion(user: User, isOkrChampion: boolean) { return this.httpClient.put(`${this.API_URL}/${user.id}/isokrchampion/${isOkrChampion}`, {}) .pipe(tap(() => { this.reloadUsers(); @@ -64,21 +64,21 @@ export class UserService { })); } - createUsers (userList: NewUser[]) { + createUsers(userList: NewUser[]) { return this.httpClient.post(`${this.API_URL}/createall`, userList) .pipe(tap(() => this.reloadUsers())); } - deleteUser (user: User) { + deleteUser(user: User) { return this.httpClient.delete(`${this.API_URL}/${user.id}`, {}) .pipe(tap(() => this.reloadUsers())); } - getUserOkrData (user: User): Observable { + getUserOkrData(user: User): Observable { return this.httpClient.get(`${this.API_URL}/${user.id}/userokrdata`, {}); } - isUserMemberOfTeams (user: User): Observable { + isUserMemberOfTeams(user: User): Observable { return this.httpClient.get(`${this.API_URL}/${user.id}/ismemberofteams`, {}); } } diff --git a/frontend/src/app/shared/common.spec.ts b/frontend/src/app/shared/common.spec.ts index f329cb9172..7412f77ce2 100644 --- a/frontend/src/app/shared/common.spec.ts +++ b/frontend/src/app/shared/common.spec.ts @@ -302,7 +302,7 @@ describe('test common functions', () => { 0 ] ])('should calculate progress correctly', - async ( + async( baseline: number, stretchGoal: number, value: number, filledPercentage: number ) => { const keyResult = { diff --git a/frontend/src/app/shared/common.ts b/frontend/src/app/shared/common.ts index cabc88e189..0942f99995 100644 --- a/frontend/src/app/shared/common.ts +++ b/frontend/src/app/shared/common.ts @@ -1,7 +1,7 @@ import { FormGroup } from '@angular/forms'; import { KeyResultMetricMin } from './types/model/KeyResultMetricMin'; -export function getNumberOrNull (str: string | null | undefined): number | null { +export function getNumberOrNull(str: string | null | undefined): number | null { if (str === null || str === undefined || str.toString() .trim() === '') { return null; @@ -10,7 +10,7 @@ export function getNumberOrNull (str: string | null | undefined): number | null return Number.isNaN(number) ? null : number; } -export function getValueFromQuery (query: any, fallback?: number): number[] { +export function getValueFromQuery(query: any, fallback?: number): number[] { const values = Array.from([query]) .flat() .filter((e) => e !== '') @@ -22,7 +22,7 @@ export function getValueFromQuery (query: any, fallback?: number): number[] { return values.length > 0 ? values : [fallback]; } -export function optionalValue (param: object): Record { +export function optionalValue(param: object): Record { return Object.fromEntries(Object.entries(param) .filter(([_, v]) => v != undefined) @@ -36,11 +36,11 @@ export function optionalValue (param: object): Record { return true; })); } -export function isLastCheckInNegative (baseline: number, stretchGoal: number, value: number): boolean { +export function isLastCheckInNegative(baseline: number, stretchGoal: number, value: number): boolean { return (value > baseline && baseline > stretchGoal) || (value < baseline && baseline <= stretchGoal); } -export function calculateCurrentPercentage (keyResultMetric: KeyResultMetricMin): number { +export function calculateCurrentPercentage(keyResultMetric: KeyResultMetricMin): number { const value: number = +keyResultMetric.lastCheckIn?.value!; const baseline: number = +keyResultMetric.baseline; const stretchGoal: number = +keyResultMetric.stretchGoal; @@ -49,16 +49,16 @@ export function calculateCurrentPercentage (keyResultMetric: KeyResultMetricMin) return (Math.abs(value - baseline) / Math.abs(stretchGoal - baseline)) * 100; } -export function sanitize (query: string) { +export function sanitize(query: string) { return query.trim() .toLowerCase(); } -export function getQueryString (query?: string) { +export function getQueryString(query?: string) { const queryString = query || ''; return sanitize(decodeURI(queryString)); } -export function optionalReplaceWithNulls (param: object): Record { +export function optionalReplaceWithNulls(param: object): Record { const clearObject = optionalValue(param); return Object.fromEntries(Object.entries(param) .map(([k, @@ -66,7 +66,7 @@ export function optionalReplaceWithNulls (param: object): Record { clearObject[k] === undefined ? null : v])); } -export function areEqual (arr1: number[], arr2: number[]) { +export function areEqual(arr1: number[], arr2: number[]) { if (arr1.length !== arr2.length) return false; // implement custom sort if necessary @@ -81,11 +81,11 @@ export function areEqual (arr1: number[], arr2: number[]) { return true; } -export function trackByFn (id: any): any { +export function trackByFn(id: any): any { return id; } -export function formInputCheck (form: FormGroup, propertyName: string) { +export function formInputCheck(form: FormGroup, propertyName: string) { if ((form.get(propertyName)?.dirty || form.get(propertyName)?.touched) && form.get(propertyName)?.invalid) { return 'dialog-form-field-error'; } else { @@ -93,12 +93,12 @@ export function formInputCheck (form: FormGroup, propertyName: string) { } } -export function isMobileDevice () { +export function isMobileDevice() { return window.navigator.userAgent.toLowerCase() .includes('mobile'); } -export function hasFormFieldErrors (formGroup: FormGroup, field: string) { +export function hasFormFieldErrors(formGroup: FormGroup, field: string) { if (formGroup.get(field)?.dirty || formGroup.get(field)?.touched) { return formGroup.get(field)?.errors; } else { diff --git a/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.ts b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.ts index 76a1453f7b..91f4721749 100644 --- a/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.ts +++ b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.ts @@ -11,7 +11,7 @@ export class DialogTemplateCoreComponent { @Input() title = ''; - isValueReady (obj: any): boolean { + isValueReady(obj: any): boolean { if (obj == null) { return false; } diff --git a/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.ts b/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.ts index 8df6e01b6b..2a7ff7d6cc 100644 --- a/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.ts +++ b/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.ts @@ -12,7 +12,7 @@ export class OkrTangramComponent { trianglesSrc$ = new Observable(); - constructor (private readonly configService: ConfigService) { + constructor(private readonly configService: ConfigService) { this.trianglesSrc$ = this.configService.config$.pipe(map((config) => config.triangles || this.DEFAULT_TRIANGLE_SRC)); } } diff --git a/frontend/src/app/shared/custom/puzzle-icon-button/puzzle-icon-button.component.ts b/frontend/src/app/shared/custom/puzzle-icon-button/puzzle-icon-button.component.ts index 55b72805ba..f8c44bbd53 100644 --- a/frontend/src/app/shared/custom/puzzle-icon-button/puzzle-icon-button.component.ts +++ b/frontend/src/app/shared/custom/puzzle-icon-button/puzzle-icon-button.component.ts @@ -19,7 +19,7 @@ export class PuzzleIconButtonComponent { imgSize = this.size - 2 * this.padding; - getStyle () { + getStyle() { return { 'border-radius': this.size / 2 + 'px', padding: this.padding + 'px' diff --git a/frontend/src/app/shared/custom/scoring/scoring.component.spec.ts b/frontend/src/app/shared/custom/scoring/scoring.component.spec.ts index c70fa3f5e2..7c331b9f75 100644 --- a/frontend/src/app/shared/custom/scoring/scoring.component.spec.ts +++ b/frontend/src/app/shared/custom/scoring/scoring.component.spec.ts @@ -83,7 +83,7 @@ describe('ScoringComponent', () => { target: 101, className: 'score-stretch', borderClass: 'none' }] - ])('should set styles correctly', async (object: any) => { + ])('should set styles correctly', async(object: any) => { component.targetPercent = object.target; component.commitPercent = object.commit; component.failPercent = object.fail; diff --git a/frontend/src/app/shared/custom/scoring/scoring.component.ts b/frontend/src/app/shared/custom/scoring/scoring.component.ts index f6b2a99d99..5912d506c7 100644 --- a/frontend/src/app/shared/custom/scoring/scoring.component.ts +++ b/frontend/src/app/shared/custom/scoring/scoring.component.ts @@ -54,11 +54,11 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { @ViewChild('valueLabel') private valueLabel: ElementRef | undefined = undefined; - constructor (private changeDetectionRef: ChangeDetectorRef) { + constructor(private changeDetectionRef: ChangeDetectorRef) { this.labelPercentage = new Observable(); } - ngOnInit () { + ngOnInit() { this.stretched = false; if (this.keyResult.lastCheckIn) { if (this.keyResult.keyResultType === 'metric') { @@ -69,7 +69,7 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - ngAfterViewInit (): void { + ngAfterViewInit(): void { // Define width of scoring elements this.failElement!.nativeElement.style.width = this.failPercent + '%'; this.commitElement!.nativeElement.style.width = this.commitPercent + '%'; @@ -97,7 +97,7 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - calculatePercentageOrdinal () { + calculatePercentageOrdinal() { switch ((this.keyResult.lastCheckIn as CheckInOrdinalMin)!.zone!) { case Zone.STRETCH: this.stretched = true; @@ -120,7 +120,7 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - calculatePercentageMetric () { + calculatePercentageMetric() { if (this.keyResult.lastCheckIn !== null) { const keyResultMetric: KeyResultMetricMin = this.castToMetric(); const percentage = calculateCurrentPercentage(keyResultMetric); @@ -143,7 +143,7 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - getScoringColorClassAndSetBorder (): string | null { + getScoringColorClassAndSetBorder(): string | null { if (this.targetPercent > 100) { return 'score-stretch'; } else if (this.targetPercent > 0 || (this.commitPercent == 100 && this.keyResult.keyResultType === 'metric')) { @@ -158,7 +158,7 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - ngOnChanges (changes: SimpleChanges): void { + ngOnChanges(changes: SimpleChanges): void { if (changes['keyResult']?.currentValue !== undefined || changes['keyResult']?.currentValue !== null) { if (this.commitElement != undefined) { this.resetPercentagesToZero(); @@ -170,13 +170,13 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - resetPercentagesToZero () { + resetPercentagesToZero() { this.commitPercent = 0; this.targetPercent = 0; this.failPercent = 0; } - removeStyleClass () { + removeStyleClass() { const classArray: string[] = [ 'score-red', 'score-green', @@ -191,7 +191,7 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { } } - castToMetric (): KeyResultMetricMin { + castToMetric(): KeyResultMetricMin { return this.keyResult as KeyResultMetricMin; } diff --git a/frontend/src/app/shared/customRouter.ts b/frontend/src/app/shared/customRouter.ts index 86721d290a..7e90cbee8f 100644 --- a/frontend/src/app/shared/customRouter.ts +++ b/frontend/src/app/shared/customRouter.ts @@ -3,11 +3,11 @@ import { NavigationExtras, Router } from '@angular/router'; @Injectable() export class CustomRouter extends Router { - constructor () { + constructor() { super(); } - override navigate (commands: any[], extras?: NavigationExtras | undefined): Promise { + override navigate(commands: any[], extras?: NavigationExtras | undefined): Promise { const customExtras = { ...extras, queryParamsHandling: 'merge' } as NavigationExtras; return super.navigate(commands, customExtras); diff --git a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.ts b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.ts index eeacb8d4a3..581e82f7aa 100644 --- a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.ts +++ b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.ts @@ -19,11 +19,11 @@ export class CompleteDialogComponent { protected readonly hasFormFieldErrors = hasFormFieldErrors; - constructor (public dialogRef: MatDialogRef, + constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: { objectiveTitle: string }, private translate: TranslateService) {} - switchSuccessState (input: string) { + switchSuccessState(input: string) { this.removeStandardHover(); let successfulValue = this.completeForm.value.isSuccessful; if ( @@ -36,21 +36,21 @@ export class CompleteDialogComponent { } } - closeDialog () { + closeDialog() { this.dialogRef.close({ endState: this.completeForm.value.isSuccessful ? 'SUCCESSFUL' : 'NOTSUCCESSFUL', comment: this.completeForm.value.comment }); } - removeStandardHover () { + removeStandardHover() { const elements = document.querySelectorAll('.card-hover'); elements.forEach((el) => { el.classList.remove('card-hover'); }); } - getErrorMessage (error: string, field: string, maxLength: number): string { + getErrorMessage(error: string, field: string, maxLength: number): string { return field + this.translate.instant('DIALOG_ERRORS.' + error) .format(maxLength); } diff --git a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.spec.ts b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.spec.ts index 8054507ab9..ed2b68a891 100644 --- a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.spec.ts +++ b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.spec.ts @@ -58,7 +58,7 @@ describe('ConfirmDialogComponent', () => { .toBeTruthy(); }); - it('should call close method with parameter: true if clicked to submit button', async () => { + it('should call close method with parameter: true if clicked to submit button', async() => { const buttons = await loader.getAllHarnesses(MatButtonHarness); const submitButton = buttons[1]; await submitButton.click(); @@ -67,7 +67,7 @@ describe('ConfirmDialogComponent', () => { .toHaveBeenCalledWith(true); }); - it('should call close method with parameter: "" if clicked to cancel button', async () => { + it('should call close method with parameter: "" if clicked to cancel button', async() => { const buttons = await loader.getAllHarnesses(MatButtonHarness); const cancelButton = buttons[0]; await cancelButton.click(); diff --git a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts index 8d2b290d86..819d45a093 100644 --- a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts +++ b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.ts @@ -19,10 +19,10 @@ export class ConfirmDialogComponent implements OnInit { closeButtonState?: ButtonState; - constructor (@Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData, + constructor(@Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData, public dialogRef: MatDialogRef) {} - ngOnInit () { + ngOnInit() { this.dialogTitle = this.data.title; this.dialogText = this.data.text; this.yesButtonState = this.data.yesButtonState ?? ButtonState.VisibleEnabled; @@ -30,33 +30,33 @@ export class ConfirmDialogComponent implements OnInit { this.closeButtonState = this.data.closeButtonState ?? ButtonState.Hidden; } - closeAndDelete () { + closeAndDelete() { this.dialogRef.close(true); } - isYesButtonVisible () { + isYesButtonVisible() { return this.yesButtonState === ButtonState.VisibleEnabled || this.yesButtonState === ButtonState.VisibleDisabled; } - isYesButtonDisabled () { + isYesButtonDisabled() { return this.yesButtonState === ButtonState.VisibleDisabled; } - isNoButtonVisible () { + isNoButtonVisible() { return this.noButtonState === ButtonState.VisibleEnabled || this.noButtonState === ButtonState.VisibleDisabled; } - isNoButtonDisabled () { + isNoButtonDisabled() { return this.noButtonState === ButtonState.VisibleDisabled; } - isCloseButtonVisible () { + isCloseButtonVisible() { return ( this.closeButtonState === ButtonState.VisibleEnabled || this.closeButtonState === ButtonState.VisibleDisabled ); } - isCloseButtonDisabled () { + isCloseButtonDisabled() { return this.closeButtonState === ButtonState.VisibleDisabled; } } diff --git a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.spec.ts b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.spec.ts index 5693bc6956..bc1410f763 100644 --- a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.spec.ts +++ b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.spec.ts @@ -57,7 +57,7 @@ describe('ExampleDialogComponent', () => { .toBeTruthy(); })); - it('should be able to set name', waitForAsync(async () => { + it('should be able to set name', waitForAsync(async() => { // Insert values into name input const nameInput = await loader.getHarness(MatInputHarness); await nameInput.setValue('Name'); @@ -73,7 +73,7 @@ describe('ExampleDialogComponent', () => { .toBe('Name'); })); - it('should be able to set buttons', waitForAsync(async () => { + it('should be able to set buttons', waitForAsync(async() => { // Check radio button const buttons = await loader.getAllHarnesses(MatRadioButtonHarness); await buttons[0].check(); @@ -91,7 +91,7 @@ describe('ExampleDialogComponent', () => { .toBe(await buttons[0].getValue()); })); - it('should be able to set select', async () => { + it('should be able to set select', async() => { let option = ''; // Get mat-select element and click it (dropdown) await loader.getHarness(MatSelectHarness) @@ -120,7 +120,7 @@ describe('ExampleDialogComponent', () => { .toBe(formObject.hobby); }); - it('should display error message of too short input', waitForAsync(async () => { + it('should display error message of too short input', waitForAsync(async() => { // Insert values into name input which don't match length validator const nameInput = await loader.getHarness(MatInputHarness); await nameInput.setValue('Na'); @@ -136,7 +136,7 @@ describe('ExampleDialogComponent', () => { .toBeTruthy(); })); - it('should display error message of required dropdown', waitForAsync(async () => { + it('should display error message of required dropdown', waitForAsync(async() => { // Open and close mat-select element to trigger validation const matSelect = await loader.getHarness(MatSelectHarness); await matSelect.open(); @@ -153,7 +153,7 @@ describe('ExampleDialogComponent', () => { .toBeTruthy(); })); - it('should not save form unless radio button is checked', async () => { + it('should not save form unless radio button is checked', async() => { // Insert value into input const nameInput = loader.getHarness(MatInputHarness); const matSelect = loader.getHarness(MatSelectHarness); @@ -199,7 +199,7 @@ describe('ExampleDialogComponent', () => { })); }); - function advance (duration = 100) { + function advance(duration = 100) { tick(duration); fixture.detectChanges(); tick(duration); diff --git a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts index f9a50694cd..6581465a38 100644 --- a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts +++ b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.ts @@ -29,19 +29,19 @@ export class ExampleDialogComponent { hobby: new FormControl('', [Validators.required]) }); - constructor (public dialog: MatDialogRef, + constructor(public dialog: MatDialogRef, @Inject(MAT_DIALOG_DATA) private data: any) {} - save () { + save() { this.dialog.close({ data: this.dialogForm.value }); } - isTouchedOrDirty (name: string) { + isTouchedOrDirty(name: string) { return this.dialogForm.get(name)?.dirty || this.dialogForm.get(name)?.touched; } // Check if any errors are present if not return empty array if yes return error keys - getErrorKeysOfFormField (name: string) { + getErrorKeysOfFormField(name: string) { const errors = this.dialogForm.get(name)?.errors; return errors == null ? [] : Object.keys(errors); } diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts index c8133dc6e6..760968a1c1 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.spec.ts @@ -45,7 +45,7 @@ interface MatDialogDataInterface { } const quarterService = { - getAllQuarters (): Observable { + getAllQuarters(): Observable { return of([new Quarter( 1, quarter.label, quarter.startDate, quarter.endDate ), @@ -56,7 +56,7 @@ const quarterService = { 999, 'Backlog', null, null )]); }, - getCurrentQuarter (): Observable { + getCurrentQuarter(): Observable { return of(new Quarter( 2, quarter.label, quarter.startDate, quarter.endDate )); @@ -295,7 +295,7 @@ describe('ObjectiveDialogComponent', () => { }); }); - it('should load default values into form onInit with defined objectiveId', async () => { + it('should load default values into form onInit with defined objectiveId', async() => { matDataMock.objective.objectiveId = 1; const routerHarness = await RouterTestingHarness.create(); await routerHarness.navigateByUrl('/?quarter=2'); @@ -342,7 +342,7 @@ describe('ObjectiveDialogComponent', () => { }); }); - it('should return correct value if allowed to save to backlog', async () => { + it('should return correct value if allowed to save to backlog', async() => { component.quarters = quarterList; const isBacklogQuarterSpy = jest.spyOn(component, 'isBacklogQuarter'); isBacklogQuarterSpy.mockReturnValue(false); @@ -385,7 +385,7 @@ describe('ObjectiveDialogComponent', () => { .toBeTruthy(); }); - it('should return if option is allowed for quarter select', async () => { + it('should return if option is allowed for quarter select', async() => { const quarter: Quarter = new Quarter( 1, 'Backlog', null, null ); @@ -480,7 +480,7 @@ describe('ObjectiveDialogComponent', () => { .toBeTruthy(); }); - it('should set correct default value if objective is released in backlog', async () => { + it('should set correct default value if objective is released in backlog', async() => { component.data = { objective: { objectiveId: 1, diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts index 1f632ba2c1..31036fc4df 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts @@ -62,7 +62,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { private unsubscribe$ = new Subject(); - constructor ( + constructor( private route: ActivatedRoute, private teamService: TeamService, private quarterService: QuarterService, @@ -80,7 +80,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { private translate: TranslateService ) {} - onSubmit (submitType: any): void { + onSubmit(submitType: any): void { const value = this.objectiveForm.getRawValue(); const state = this.data.objective.objectiveId == null ? submitType : this.state; const objectiveDTO: Objective = { @@ -99,7 +99,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { }); } - ngOnInit (): void { + ngOnInit(): void { const isEditing: boolean = this.data.objective.objectiveId != undefined; this.teams$ = this.teamService.getAllTeams() .pipe(takeUntil(this.unsubscribe$)); @@ -130,7 +130,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { }); } - private handleDataInitialization ( + private handleDataInitialization( objective: Objective, quarters: Quarter[], currentQuarter: Quarter, @@ -170,12 +170,12 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { }); } - ngOnDestroy () { + ngOnDestroy() { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - getSubmitFunction (id: number, objectiveDTO: any): Observable { + getSubmitFunction(id: number, objectiveDTO: any): Observable { if (this.data.action == 'duplicate') { objectiveDTO.id = null; objectiveDTO.state = 'DRAFT' as State; @@ -196,7 +196,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { } } - deleteObjective () { + deleteObjective() { const dialog = this.dialogService.openConfirmDialog('CONFIRMATION.DELETE.OBJECTIVE'); dialog.afterClosed() .subscribe((result) => { @@ -215,14 +215,14 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { }); } - objectiveToObjectiveMin (objectiveDto: Objective): ObjectiveMin { + objectiveToObjectiveMin(objectiveDto: Objective): ObjectiveMin { return { ...objectiveDto, state: State[objectiveDto.state as string as keyof typeof State] } as unknown as ObjectiveMin; } - closeDialog (objectiveDTO: Objective, willDelete = false, addKeyResult = false) { + closeDialog(objectiveDTO: Objective, willDelete = false, addKeyResult = false) { const value = this.objectiveForm.getRawValue(); const objectiveMin: ObjectiveMin = this.objectiveToObjectiveMin(objectiveDTO); this.dialogRef.close({ @@ -233,14 +233,14 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { }); } - getErrorMessage ( + getErrorMessage( error: string, field: string, firstNumber: number | null, secondNumber: number | null ): string { return field + this.translate.instant('DIALOG_ERRORS.' + error) .format(firstNumber, secondNumber); } - getDefaultObjective () { + getDefaultObjective() { return { id: 0, title: '', @@ -251,7 +251,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { } as Objective; } - allowedToSaveBacklog () { + allowedToSaveBacklog() { const currentQuarter: Quarter | undefined = this.quarters.find((quarter) => quarter.id == this.objectiveForm.value.quarter); if (currentQuarter) { const isBacklogCurrent = !this.isBacklogQuarter(currentQuarter.label); @@ -266,7 +266,7 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { } } - allowedOption (quarter: Quarter) { + allowedOption(quarter: Quarter) { if (quarter.label == 'Backlog') { if (this.data.action == 'duplicate') { return true; @@ -282,11 +282,11 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { } } - isBacklogQuarter (label: string) { + isBacklogQuarter(label: string) { return GJ_REGEX_PATTERN.test(label); } - getDialogTitle (teamName: string): string { + getDialogTitle(teamName: string): string { if (this.data.action === 'duplicate') { return `Objective von ${teamName} duplizieren`; } diff --git a/frontend/src/app/shared/pipes/unit-transformation/unit-transformation.pipe.ts b/frontend/src/app/shared/pipes/unit-transformation/unit-transformation.pipe.ts index 7ee5aef62b..23d8b84c9c 100644 --- a/frontend/src/app/shared/pipes/unit-transformation/unit-transformation.pipe.ts +++ b/frontend/src/app/shared/pipes/unit-transformation/unit-transformation.pipe.ts @@ -5,20 +5,20 @@ import { Pipe, PipeTransform } from '@angular/core'; name: 'unitTransformation' }) export class UnitTransformationPipe implements PipeTransform { - transform (value: number, label: string): string { + transform(value: number, label: string): string { return this.transformValue(value) + this.transformLabel(label); } - transformValue (value: number): string { + transformValue(value: number): string { return Number.isNaN(value) ? '0' : this.roundAndAddThousandSplitSign(value); } - roundAndAddThousandSplitSign (value: number): string { + roundAndAddThousandSplitSign(value: number): string { return (+value.toFixed(2)).toLocaleString('en-US') .replace(/,/g, "'"); } - transformLabel (label: string): string { + transformLabel(label: string): string { switch (label) { case Unit.PERCENT: return '%'; diff --git a/frontend/src/app/shared/sidepanel/sidepanel.component.ts b/frontend/src/app/shared/sidepanel/sidepanel.component.ts index ef4e6131f3..124725eac0 100644 --- a/frontend/src/app/shared/sidepanel/sidepanel.component.ts +++ b/frontend/src/app/shared/sidepanel/sidepanel.component.ts @@ -34,28 +34,28 @@ export class SidepanelComponent implements OnInit, AfterContentInit, OnDestroy { overlayY: 'top' }]; - constructor (private router: Router, + constructor(private router: Router, private cd: ChangeDetectorRef, private route: ActivatedRoute) {} - ngOnInit (): void {} + ngOnInit(): void {} - ngAfterContentInit (): void { + ngAfterContentInit(): void { document.body.classList.add('disable-scrolling'); this.right = '0'; this.loaded = true; this.cd.markForCheck(); } - ngOnDestroy () { + ngOnDestroy() { document.body.classList.remove('disable-scrolling'); } - close () { + close() { this.router.navigate(['../'], { relativeTo: this.route }); } - closeOnKeydown ($event: KeyboardEvent) { + closeOnKeydown($event: KeyboardEvent) { if (this.leaveKeys.includes($event.key)) { this.close(); } diff --git a/frontend/src/app/shared/types/model/Quarter.ts b/frontend/src/app/shared/types/model/Quarter.ts index a52af14dc7..4668e78b9e 100644 --- a/frontend/src/app/shared/types/model/Quarter.ts +++ b/frontend/src/app/shared/types/model/Quarter.ts @@ -1,5 +1,5 @@ export class Quarter { - constructor ( + constructor( id: number, label: string, startDate: Date | null, endDate: Date | null ) { this.id = id; @@ -16,11 +16,11 @@ export class Quarter { readonly endDate: Date | null; - fullLabel (): string { + fullLabel(): string { return this.isCurrent() ? this.label + ' Aktuell' : this.label; } - private isCurrent (): boolean { + private isCurrent(): boolean { if (this.startDate === null || this.endDate === null) { return false; } diff --git a/frontend/src/app/shared/validators.ts b/frontend/src/app/shared/validators.ts index 632aab446c..1bd6ab32f3 100644 --- a/frontend/src/app/shared/validators.ts +++ b/frontend/src/app/shared/validators.ts @@ -13,7 +13,7 @@ import { NUMBER_REGEX, PERCENT_REGEX } from './regexLibrary'; export class UnitValueValidator implements Validator { @Input('unitValueValidator') unit: string | null = ''; - validate (control: AbstractControl): ValidationErrors | null { + validate(control: AbstractControl): ValidationErrors | null { const value: string = control.value; switch (this.unit) { case 'PERCENT': { @@ -34,13 +34,13 @@ export class UnitValueValidator implements Validator { } } - proceedRegex (value: string, regex: string) { + proceedRegex(value: string, regex: string) { return String(value) .match(regex) ? null : { valid: false }; } } -export function comparisonValidator (secondControl: AbstractControl): ValidatorFn { +export function comparisonValidator(secondControl: AbstractControl): ValidatorFn { return (firstControl: AbstractControl): ValidationErrors | null => { return firstControl.value == secondControl.value ? { valid: false } : null; }; diff --git a/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.spec.ts b/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.spec.ts index ce94a8f409..032d4f5208 100644 --- a/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.spec.ts +++ b/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.spec.ts @@ -91,7 +91,7 @@ describe('TeamManagementComponent', () => { .toBeTruthy(); }); - it('should call service method to save team', async () => { + it('should call service method to save team', async() => { component.teamForm.setValue(teamFormObject); jest.spyOn(teamServiceMock, 'createTeam') .mockReturnValue(of(teamFormObject)); @@ -103,7 +103,7 @@ describe('TeamManagementComponent', () => { .toHaveBeenCalledWith(teamFormObject as Team); }); - it('should call service method to update team if data input is not null', async () => { + it('should call service method to update team if data input is not null', async() => { component.data = { team: marketingTeamWriteable }; component.teamForm.setValue(teamFormObject); jest.spyOn(teamServiceMock, 'updateTeam') @@ -120,7 +120,7 @@ describe('TeamManagementComponent', () => { } as Team); }); - it('should set team values in from on init if data is not null', async () => { + it('should set team values in from on init if data is not null', async() => { component.data = { team: marketingTeamWriteable }; component.ngOnInit(); expect(component.teamForm.controls.name.value) diff --git a/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.ts b/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.ts index ff59ad8d59..d4dd21b262 100644 --- a/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.ts +++ b/frontend/src/app/team-management/add-edit-team-dialog/add-edit-team-dialog.component.ts @@ -24,7 +24,7 @@ export class AddEditTeamDialog implements OnInit { protected readonly hasFormFieldErrors = hasFormFieldErrors; - constructor ( + constructor( public dialogRef: MatDialogRef, private teamService: TeamService, private userService: UserService, @@ -38,7 +38,7 @@ export class AddEditTeamDialog implements OnInit { private translate: TranslateService ) {} - ngOnInit (): void { + ngOnInit(): void { if (this.data) { this.teamForm.setValue({ name: this.data.team.name @@ -46,7 +46,7 @@ export class AddEditTeamDialog implements OnInit { } } - saveTeam () { + saveTeam() { if (!this.data) { this.createNewTeam(); } else { @@ -54,7 +54,7 @@ export class AddEditTeamDialog implements OnInit { } } - private createNewTeam () { + private createNewTeam() { const newTeam: Team = this.teamForm.value as Team; this.teamService.createTeam(newTeam) .subscribe((result) => { @@ -66,7 +66,7 @@ export class AddEditTeamDialog implements OnInit { }); } - private updateTeam () { + private updateTeam() { const updatedTeam: Team = { ...this.teamForm.value, id: this.data!.team.id, @@ -78,14 +78,14 @@ export class AddEditTeamDialog implements OnInit { }); } - getErrorMessage ( + getErrorMessage( error: string, field: string, firstNumber: number | null, secondNumber: number | null ): string { return field + this.translate.instant('DIALOG_ERRORS.' + error) .format(firstNumber, secondNumber); } - getDialogTitle (): string { + getDialogTitle(): string { return this.data ? 'Team bearbeiten' : 'Team erfassen'; } } diff --git a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts index e16058b374..8c01c8952e 100644 --- a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts +++ b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.spec.ts @@ -26,7 +26,7 @@ describe('AddMemberToTeamDialogComponent', () => { const matDialogRefMock = {}; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [AddMemberToTeamDialogComponent], imports: [ diff --git a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts index 4d24e7602a..4ecb860cb7 100644 --- a/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts +++ b/frontend/src/app/team-management/add-member-to-team-dialog/add-member-to-team-dialog.component.ts @@ -35,7 +35,7 @@ export class AddMemberToTeamDialogComponent implements OnInit, OnDestroy { private readonly unsubscribe$ = new Subject(); - public constructor ( + public constructor( private readonly userService: UserService, private readonly teamService: TeamService, public dialogRef: MatDialogRef, @@ -45,7 +45,7 @@ export class AddMemberToTeamDialogComponent implements OnInit, OnDestroy { this.selectedUsers$.subscribe((users) => (this.dataSource = new MatTableDataSource(users))); } - public ngOnInit (): void { + public ngOnInit(): void { this.usersForSelection$ = combineLatest([this.userService.getUsers(), this.selectedUsers$, this.search.valueChanges.pipe(startWith(''), @@ -59,16 +59,16 @@ export class AddMemberToTeamDialogComponent implements OnInit, OnDestroy { })); } - public ngOnDestroy () { + public ngOnDestroy() { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - getDialogTitle (): string { + getDialogTitle(): string { return `Members zu Team ${this.data.team.name} hinzufügen`; } - addUsersToTeam (): void { + addUsersToTeam(): void { this.teamService.addUsersToTeam(this.data.team, this.selectedUsers$.getValue()) .subscribe(() => { this.userService.reloadUsers(); @@ -78,7 +78,7 @@ export class AddMemberToTeamDialogComponent implements OnInit, OnDestroy { }); } - private filter (allPossibleUsers: User[], searchValue: string, selectedUsers: User[]) { + private filter(allPossibleUsers: User[], searchValue: string, selectedUsers: User[]) { // filter currently current users of team const currentUserIds = this.data.currentUsersOfTeam.map((u) => u.id); const filteredUsers = allPossibleUsers.filter((u) => !currentUserIds.includes(u.id)); @@ -94,21 +94,21 @@ export class AddMemberToTeamDialogComponent implements OnInit, OnDestroy { }); } - getDisplayValue (user: User | ''): string { + getDisplayValue(user: User | ''): string { if (!user) { return ''; } return `${user.firstname} ${user.lastname} (${user.email})`; } - selectUser (user: User) { + selectUser(user: User) { const newUsers = this.selectedUsers$.getValue(); newUsers.push(user); this.selectedUsers$.next(newUsers); this.search.setValue(''); } - remove (user: User): void { + remove(user: User): void { const filteredUsers = this.selectedUsers$.getValue() .filter((u) => u !== user); this.selectedUsers$.next(filteredUsers); diff --git a/frontend/src/app/team-management/add-user-team/add-user-team.component.spec.ts b/frontend/src/app/team-management/add-user-team/add-user-team.component.spec.ts index ab2e1e3b48..2a06fc1cdf 100644 --- a/frontend/src/app/team-management/add-user-team/add-user-team.component.spec.ts +++ b/frontend/src/app/team-management/add-user-team/add-user-team.component.spec.ts @@ -17,7 +17,7 @@ describe('AddUserTeamComponent', () => { getAllTeams: jest.fn() }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [AddUserTeamComponent], providers: [{ provide: TeamService, diff --git a/frontend/src/app/team-management/add-user-team/add-user-team.component.ts b/frontend/src/app/team-management/add-user-team/add-user-team.component.ts index 491f50fabe..c61c8be9fc 100644 --- a/frontend/src/app/team-management/add-user-team/add-user-team.component.ts +++ b/frontend/src/app/team-management/add-user-team/add-user-team.component.ts @@ -25,9 +25,9 @@ export class AddUserTeamComponent implements OnInit, OnDestroy { private unsubscribe$ = new Subject(); - constructor (private readonly teamService: TeamService) {} + constructor(private readonly teamService: TeamService) {} - ngOnInit () { + ngOnInit() { this.allAdminTeams$ = this.teamService.getAllTeams() .pipe(takeUntil(this.unsubscribe$), map((teams) => { @@ -46,19 +46,19 @@ export class AddUserTeamComponent implements OnInit, OnDestroy { })); } - ngOnDestroy () { + ngOnDestroy() { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - createUserTeam (team: Team) { + createUserTeam(team: Team) { this.userTeam = { team, isTeamAdmin: false }; } - save (): void { + save(): void { if (!this.userTeam) { throw new Error('UserTeam should be defined here'); } @@ -66,11 +66,11 @@ export class AddUserTeamComponent implements OnInit, OnDestroy { this.userTeam = undefined; } - showAddButton (adminTeams: Team[] | null) { + showAddButton(adminTeams: Team[] | null) { return !this.userTeam && adminTeams?.length; } - addButtonDisabled (selectableAdminTeams: Team[] | null) { + addButtonDisabled(selectableAdminTeams: Team[] | null) { return !selectableAdminTeams?.length; } } diff --git a/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts b/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts index 146bfa9c23..5c528383b2 100644 --- a/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts +++ b/frontend/src/app/team-management/delete-user/delete-user.component.spec.ts @@ -24,7 +24,7 @@ describe('DeleteUserComponent', () => { const dialogServiceMock = { openCustomizedConfirmDialog: jest.fn() }; const mockLocation: jest.Mocked = { back: jest.fn() } as any; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [DeleteUserComponent], providers: [{ provide: UserService, @@ -86,7 +86,7 @@ describe('DeleteUserComponent', () => { it('deleteUser() should not reload users when UserService throws an error', () => { // arrange - function createErrorSubject () { + function createErrorSubject() { const myError = new Subject(); myError.error('uups'); return myError; diff --git a/frontend/src/app/team-management/delete-user/delete-user.component.ts b/frontend/src/app/team-management/delete-user/delete-user.component.ts index 8959cc589e..58ddf7fad1 100644 --- a/frontend/src/app/team-management/delete-user/delete-user.component.ts +++ b/frontend/src/app/team-management/delete-user/delete-user.component.ts @@ -26,22 +26,22 @@ export class DeleteUserComponent implements OnInit, OnDestroy { unsubscribe$ = new Subject(); - constructor (private readonly userService: UserService, + constructor(private readonly userService: UserService, private readonly dialogService: DialogService, private readonly location: Location) {} - ngOnInit () { + ngOnInit() { this.loadOkrUser(); this.loadUserOkrData(); this.updateUserTeamsStatusWhenTeamOfUserChanges(); } - ngOnDestroy (): void { + ngOnDestroy(): void { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - private loadOkrUser () { + private loadOkrUser() { this.userService .getOrInitCurrentUser() .pipe(takeUntil(this.unsubscribe$), @@ -49,7 +49,7 @@ export class DeleteUserComponent implements OnInit, OnDestroy { .subscribe(); } - loadUserOkrData () { + loadUserOkrData() { this.userService .getUserOkrData(this.user) .pipe(takeUntil(this.unsubscribe$), @@ -57,13 +57,13 @@ export class DeleteUserComponent implements OnInit, OnDestroy { .subscribe(); } - updateUserTeamsStatusWhenTeamOfUserChanges (): void { + updateUserTeamsStatusWhenTeamOfUserChanges(): void { this.currentTeams$.subscribe(() => { this.loadUserMemberOfTeamsStatus(); }); } - loadUserMemberOfTeamsStatus () { + loadUserMemberOfTeamsStatus() { this.userService .isUserMemberOfTeams(this.user) .pipe(takeUntil(this.unsubscribe$), @@ -71,12 +71,12 @@ export class DeleteUserComponent implements OnInit, OnDestroy { .subscribe(); } - hasOkrUserRoleOkrChampion () { + hasOkrUserRoleOkrChampion() { if (this.okrUser == undefined) return false; return this.okrUser.isOkrChampion; } - deleteUserWithChecks () { + deleteUserWithChecks() { if (this.isUserMemberOfTeams()) { const dialogTitle = `User kann nicht gelöscht werden`; const dialogText = `${getFullNameFromUser(this.user)} ist in folgenden Teams und kann daher nicht gelöscht werden: ${this.dialogDetailsUserTeams()}`; @@ -91,15 +91,15 @@ export class DeleteUserComponent implements OnInit, OnDestroy { this.deleteUser(); } - private isUserMemberOfTeams (): boolean { + private isUserMemberOfTeams(): boolean { return this.userIsMemberOfTeams !== undefined ? this.userIsMemberOfTeams.valueOf() : true; } - private isUserOwnerOfKeyResults (): boolean { + private isUserOwnerOfKeyResults(): boolean { return this.userOkrData !== undefined ? this.userOkrData.keyResults.length > 0 : true; } - dialogDetailsUserTeams () { + dialogDetailsUserTeams() { if (this.userOkrData) { return this.user.userTeamList // .map((userTeam) => userTeam.team.name) @@ -108,7 +108,7 @@ export class DeleteUserComponent implements OnInit, OnDestroy { return ''; } - dialogDetailsUserKeyResults () { + dialogDetailsUserKeyResults() { if (this.userOkrData) { return this.userOkrData.keyResults .map((data) => data.keyResultName + '\n(Objective: ' + data.objectiveName + ')') @@ -117,7 +117,7 @@ export class DeleteUserComponent implements OnInit, OnDestroy { return ''; } - showUnableToDeleteUserDialog (dialogTitle: string, dialogText: string) { + showUnableToDeleteUserDialog(dialogTitle: string, dialogText: string) { const data: ConfirmDialogData = { title: dialogTitle, text: dialogText, @@ -128,7 +128,7 @@ export class DeleteUserComponent implements OnInit, OnDestroy { this.dialogService.openCustomizedConfirmDialog(data); } - deleteUser () { + deleteUser() { const data: ConfirmDialogData = { title: `User löschen`, text: `Möchtest du den User ${this.user.firstname} ${this.user.lastname} wirklich löschen?`, diff --git a/frontend/src/app/team-management/edit-okr-champion/edit-okr-champion.component.ts b/frontend/src/app/team-management/edit-okr-champion/edit-okr-champion.component.ts index 6020e9b3a3..a4a5dbfe9d 100644 --- a/frontend/src/app/team-management/edit-okr-champion/edit-okr-champion.component.ts +++ b/frontend/src/app/team-management/edit-okr-champion/edit-okr-champion.component.ts @@ -15,7 +15,7 @@ export class EditOkrChampionComponent { edit = false; - constructor ( + constructor( private readonly userService: UserService, private readonly teamService: TeamService, private readonly cd: ChangeDetectorRef, @@ -23,7 +23,7 @@ export class EditOkrChampionComponent { ) {} @HostListener('document:click', ['$event']) - clickOutside (event: MouseEvent) { + clickOutside(event: MouseEvent) { if (this.elementRef.nativeElement.contains(event.target)) { return; } @@ -34,18 +34,18 @@ export class EditOkrChampionComponent { * we set edit async, to ensure hostListener can detect outside-of-element clicks correctly * otherwise element of event.target is already hidden */ - setEditAsync (edit: boolean) { + setEditAsync(edit: boolean) { setTimeout(() => { this.edit = edit; this.cd.markForCheck(); }, 0); } - okrChampionEditable (): boolean { + okrChampionEditable(): boolean { return this.userService.getCurrentUser().isOkrChampion; } - setOkrChampion (okrChampion: boolean) { + setOkrChampion(okrChampion: boolean) { this.okrChampionChange.emit(okrChampion); this.setEditAsync(false); this.cd.markForCheck(); diff --git a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts index f1d6838203..052c844d55 100644 --- a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts +++ b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.spec.ts @@ -42,7 +42,7 @@ describe('InviteUserDialogComponent', () => { validate: () => null }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [ InviteUserDialogComponent, diff --git a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts index 8ecb64d147..e008c91fee 100644 --- a/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts +++ b/frontend/src/app/team-management/invite-user-dialog/invite-user-dialog.component.ts @@ -17,7 +17,7 @@ export class InviteUserDialogComponent { triedToSubmit = false; - constructor ( + constructor( private readonly userService: UserService, private readonly dialogRef: DialogRef, private readonly formBuilder: NonNullableFormBuilder, @@ -29,7 +29,7 @@ export class InviteUserDialogComponent { .subscribe(() => this.uniqueMailValidator.setAddedMails(this.extractAddedMails())); } - registerUsers () { + registerUsers() { this.triedToSubmit = true; if (!this.form.valid) { return; @@ -38,19 +38,19 @@ export class InviteUserDialogComponent { .subscribe(() => this.dialogRef.close()); } - private extractFormValue (): NewUser[] { + private extractFormValue(): NewUser[] { return this.form.value as NewUser[]; } - addUser () { + addUser() { this.form.push(this.createUserFormGroup()); } - removeUser (index: number) { + removeUser(index: number) { this.form.removeAt(index); } - private createUserFormGroup () { + private createUserFormGroup() { return this.formBuilder.group({ firstname: this.formBuilder.control('', [Validators.required, Validators.minLength(1)]), @@ -65,7 +65,7 @@ export class InviteUserDialogComponent { }); } - private extractAddedMails () { + private extractAddedMails() { if (!this.form) { return []; } diff --git a/frontend/src/app/team-management/member-detail/member-detail.component.spec.ts b/frontend/src/app/team-management/member-detail/member-detail.component.spec.ts index 165251d7b9..24213edc02 100644 --- a/frontend/src/app/team-management/member-detail/member-detail.component.spec.ts +++ b/frontend/src/app/team-management/member-detail/member-detail.component.spec.ts @@ -49,7 +49,7 @@ describe('MemberDetailComponent', () => { openConfirmDialog: jest.fn() }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [ MemberDetailComponent, diff --git a/frontend/src/app/team-management/member-detail/member-detail.component.ts b/frontend/src/app/team-management/member-detail/member-detail.component.ts index 9099d9b2c5..b338e4cf44 100644 --- a/frontend/src/app/team-management/member-detail/member-detail.component.ts +++ b/frontend/src/app/team-management/member-detail/member-detail.component.ts @@ -36,7 +36,7 @@ export class MemberDetailComponent implements OnInit, OnDestroy { readonly getFullNameFromUser = getFullNameFromUser; - constructor ( + constructor( private readonly userService: UserService, private readonly route: ActivatedRoute, private readonly translateService: TranslateService, @@ -46,7 +46,7 @@ export class MemberDetailComponent implements OnInit, OnDestroy { private readonly dialogService: DialogService ) {} - ngOnInit (): void { + ngOnInit(): void { this.route.paramMap .pipe(takeUntil(this.unsubscribe$), tap((params) => { @@ -56,12 +56,12 @@ export class MemberDetailComponent implements OnInit, OnDestroy { .subscribe(); } - ngOnDestroy (): void { + ngOnDestroy(): void { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - private loadUser (userId: number) { + private loadUser(userId: number) { this.userService .getUserById(userId) .pipe(tap((user) => this.setSelectedUserIsLoggedinUser(user))) @@ -72,11 +72,11 @@ export class MemberDetailComponent implements OnInit, OnDestroy { }); } - private setSelectedUserIsLoggedinUser (selectedUser: User) { + private setSelectedUserIsLoggedinUser(selectedUser: User) { this.selectedUserIsLoggedInUser = selectedUser.id === this.userService.getCurrentUser().id; } - private getIdFromParams (params: ParamMap): number { + private getIdFromParams(params: ParamMap): number { const id = params.get('id'); if (!id) { throw Error('member id is undefined'); @@ -84,7 +84,7 @@ export class MemberDetailComponent implements OnInit, OnDestroy { return parseInt(id); } - removeUserFromTeam (userTeam: UserTeam, user: User) { + removeUserFromTeam(userTeam: UserTeam, user: User) { const i18nData = { user: getFullNameFromUser(user), team: userTeam.team.name @@ -100,7 +100,7 @@ export class MemberDetailComponent implements OnInit, OnDestroy { }); } - updateTeamMembership (isAdmin: boolean, userTeam: UserTeam, user: User) { + updateTeamMembership(isAdmin: boolean, userTeam: UserTeam, user: User) { this.userTeamEditId = undefined; // make a copy and set value of real object after successful request const newUserTeam = { ...userTeam }; @@ -115,7 +115,7 @@ export class MemberDetailComponent implements OnInit, OnDestroy { }); } - addTeamMembership (userTeam: UserTeam, user: User) { + addTeamMembership(userTeam: UserTeam, user: User) { this.userTeamEditId = undefined; this.teamService.updateOrAddTeamMembership(user.id, userTeam) .subscribe(() => { @@ -126,15 +126,15 @@ export class MemberDetailComponent implements OnInit, OnDestroy { }); } - isDeletable (userTeam: UserTeam): boolean { + isDeletable(userTeam: UserTeam): boolean { return userTeam.team.writeable || this.selectedUserIsLoggedInUser; } - navigateBack () { + navigateBack() { this.router.navigate(['../'], { relativeTo: this.route.parent }); } - isOkrChampionChange (okrChampion: boolean, user: User) { + isOkrChampionChange(okrChampion: boolean, user: User) { this.userService.setIsOkrChampion(user, okrChampion) .subscribe(() => { this.loadUser(user.id); diff --git a/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.spec.ts b/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.spec.ts index 597c56df44..83848a4591 100644 --- a/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.spec.ts +++ b/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.spec.ts @@ -11,7 +11,7 @@ describe('MemberListMobileComponent', () => { let component: MemberListMobileComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [MemberListMobileComponent] }) diff --git a/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.ts b/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.ts index d1021aec78..995decf6a9 100644 --- a/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.ts +++ b/frontend/src/app/team-management/member-list/member-list-mobile/member-list-mobile.component.ts @@ -16,11 +16,11 @@ export class MemberListMobileComponent implements OnInit { @Input() selectedTeam$!: BehaviorSubject; - constructor () {} + constructor() {} - ngOnInit (): void {} + ngOnInit(): void {} - getMemberDetailsLink (userTableEntry: UserTableEntry) { + getMemberDetailsLink(userTableEntry: UserTableEntry) { return getRouteToUserDetails(userTableEntry.id, this.selectedTeam$.value?.id); } diff --git a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.spec.ts b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.spec.ts index 7015aac521..47521af029 100644 --- a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.spec.ts +++ b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.spec.ts @@ -32,7 +32,7 @@ describe('MemberListTableComponent', () => { openConfirmDialog: jest.fn() }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [MatTableModule], declarations: [MemberListTableComponent], diff --git a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts index dd0e6b2c9c..1a1e7cd2ba 100644 --- a/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts +++ b/frontend/src/app/team-management/member-list/member-list-table/member-list-table.component.ts @@ -36,34 +36,34 @@ export class MemberListTableComponent implements OnInit, OnDestroy { displayedColumns: string[] = this.allColumns; - constructor (private readonly teamService: TeamService, + constructor(private readonly teamService: TeamService, private readonly userService: UserService, private readonly dialogService: DialogService) {} - ngOnInit () { + ngOnInit() { this.selectedTeam$.pipe(takeUntil(this.unsubscribe$)) .subscribe((team) => { team ? this.setColumnForTeam(team) : this.setColumnsForAllTeams(); }); } - ngOnDestroy () { + ngOnDestroy() { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - private setColumnForTeam (team: Team) { + private setColumnForTeam(team: Team) { this.displayedColumns = [...this.teamColumns]; if (team.writeable) { this.displayedColumns.push('menu'); } } - private setColumnsForAllTeams () { + private setColumnsForAllTeams() { this.displayedColumns = this.allColumns; } - removeMemberFromTeam (entry: UserTableEntry, event: MouseEvent) { + removeMemberFromTeam(entry: UserTableEntry, event: MouseEvent) { event.stopPropagation(); event.preventDefault(); const i18nData = { @@ -82,7 +82,7 @@ export class MemberListTableComponent implements OnInit, OnDestroy { }); } - saveUserTeamMembership (isAdmin: boolean, userTableEntry: UserTableEntry, userTeam: UserTeam): void { + saveUserTeamMembership(isAdmin: boolean, userTableEntry: UserTableEntry, userTeam: UserTeam): void { // make a copy and set value only after successful request const newUserTeam = { ...userTeam }; newUserTeam.isTeamAdmin = isAdmin; @@ -95,7 +95,7 @@ export class MemberListTableComponent implements OnInit, OnDestroy { }); } - getMemberDetailsLink (user: User, team?: Team) { + getMemberDetailsLink(user: User, team?: Team) { return getRouteToUserDetails(user.id, team?.id); } @@ -103,7 +103,7 @@ export class MemberListTableComponent implements OnInit, OnDestroy { * this method is only used in Team context. Therefore, it should only have one userTeam. * otherwise the method will throw an exception */ - getSingleUserTeam (userTableEntry: UserTableEntry): UserTeam { + getSingleUserTeam(userTableEntry: UserTableEntry): UserTeam { if (userTableEntry.userTeamList.length !== 1) { throw Error('it should have exactly one UserTeam at this point'); } diff --git a/frontend/src/app/team-management/member-list/member-list.component.ts b/frontend/src/app/team-management/member-list/member-list.component.ts index f60ce775f5..2b2f264691 100644 --- a/frontend/src/app/team-management/member-list/member-list.component.ts +++ b/frontend/src/app/team-management/member-list/member-list.component.ts @@ -26,7 +26,7 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { private unsubscribe$ = new Subject(); - public constructor ( + public constructor( private readonly userService: UserService, private readonly route: ActivatedRoute, private readonly cd: ChangeDetectorRef, @@ -35,9 +35,9 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { private readonly dialogService: DialogService ) {} - public ngOnInit (): void {} + public ngOnInit(): void {} - public ngAfterViewInit () { + public ngAfterViewInit() { this.userService .getUsers() .pipe(takeUntil(this.unsubscribe$)) @@ -55,12 +55,12 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { }); } - public ngOnDestroy (): void { + public ngOnDestroy(): void { this.unsubscribe$.next(); this.unsubscribe$.complete(); } - private setSelectedTeam (teams: Team[], teamIdParam: string | null) { + private setSelectedTeam(teams: Team[], teamIdParam: string | null) { if (!teamIdParam) { this.selectedTeam$.next(undefined); return; @@ -70,7 +70,7 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { this.cd.markForCheck(); } - private setDataSourceForTeamOrAll (users: User[], teamIdParam: string | null) { + private setDataSourceForTeamOrAll(users: User[], teamIdParam: string | null) { if (!teamIdParam) { this.setDataSourceForAllTeams(users); this.cd.markForCheck(); @@ -80,16 +80,16 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { this.cd.markForCheck(); } - private setDataSourceForAllTeams (users: User[]) { + private setDataSourceForAllTeams(users: User[]) { this.dataSource.data = convertFromUsers(users, null); } - private setDataSourceForTeam (teamIdParam: string, users: User[]) { + private setDataSourceForTeam(teamIdParam: string, users: User[]) { const teamId = parseInt(teamIdParam); this.dataSource.data = convertFromUsers(users, teamId); } - deleteTeam (selectedTeam: Team) { + deleteTeam(selectedTeam: Team) { const data = { team: selectedTeam.name }; @@ -107,7 +107,7 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { }); } - addMemberToTeam () { + addMemberToTeam() { const dialogRef = this.dialogService.open(AddMemberToTeamDialogComponent, { data: { team: this.selectedTeam$.value!, @@ -118,21 +118,21 @@ export class MemberListComponent implements OnInit, OnDestroy, AfterViewInit { .subscribe(() => this.cd.markForCheck()); } - inviteMember () { + inviteMember() { this.dialogService.open(InviteUserDialogComponent) .afterClosed() .subscribe(); } - showInviteMember (): boolean { + showInviteMember(): boolean { return !this.selectedTeam$.value && this.userService.getCurrentUser().isOkrChampion; } - showAddMemberToTeam () { + showAddMemberToTeam() { return this.selectedTeam$.value?.writeable; } - editTeam (): void { + editTeam(): void { const dialogRef = this.dialogService.open(AddEditTeamDialog, { data: { team: this.selectedTeam$.value } }); dialogRef.afterClosed() .subscribe(() => this.cd.markForCheck()); diff --git a/frontend/src/app/team-management/new-user/new-user.component.spec.ts b/frontend/src/app/team-management/new-user/new-user.component.spec.ts index a46c336730..c39f8c50bd 100644 --- a/frontend/src/app/team-management/new-user/new-user.component.spec.ts +++ b/frontend/src/app/team-management/new-user/new-user.component.spec.ts @@ -12,7 +12,7 @@ describe('NewUserComponent', () => { let component: NewUserComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [NewUserComponent, PuzzleIconButtonComponent, diff --git a/frontend/src/app/team-management/new-user/new-user.component.ts b/frontend/src/app/team-management/new-user/new-user.component.ts index 67d9c6c140..c0c8f5cc8d 100644 --- a/frontend/src/app/team-management/new-user/new-user.component.ts +++ b/frontend/src/app/team-management/new-user/new-user.component.ts @@ -33,23 +33,23 @@ export class NewUserComponent implements AfterViewInit { @ViewChild('firstInput') firstInput: any; - ngAfterViewInit (): void { + ngAfterViewInit(): void { this.firstInput.nativeElement.focus(); } - remove () { + remove() { this.removeUser.emit(); } - get firstname () { + get firstname() { return this.userFormGroup.controls.firstname; } - get lastname () { + get lastname() { return this.userFormGroup.controls.lastname; } - get email () { + get email() { return this.userFormGroup.controls.email; } } diff --git a/frontend/src/app/team-management/new-user/unique-mail.validator.ts b/frontend/src/app/team-management/new-user/unique-mail.validator.ts index 1a7973acba..fa905a580e 100644 --- a/frontend/src/app/team-management/new-user/unique-mail.validator.ts +++ b/frontend/src/app/team-management/new-user/unique-mail.validator.ts @@ -9,7 +9,7 @@ export class UniqueEmailValidator implements Validator { private addedMails: string[] = []; // mails added in form - constructor (private readonly userService: UserService) { + constructor(private readonly userService: UserService) { this.userService .getUsers() .pipe(takeUntilDestroyed()) @@ -18,13 +18,13 @@ export class UniqueEmailValidator implements Validator { }); } - validate (control: AbstractControl): ValidationErrors | null { + validate(control: AbstractControl): ValidationErrors | null { const existingUser = this.existingUserMails.concat(this.addedMails) .includes(control.value); return existingUser ? { notUniqueMail: { value: control.value } } : null; } - setAddedMails (mails: string[]) { + setAddedMails(mails: string[]) { this.addedMails = mails; } } diff --git a/frontend/src/app/team-management/okr-champion.pipe.ts b/frontend/src/app/team-management/okr-champion.pipe.ts index 006e505ff7..e1434ad1d0 100644 --- a/frontend/src/app/team-management/okr-champion.pipe.ts +++ b/frontend/src/app/team-management/okr-champion.pipe.ts @@ -6,9 +6,9 @@ import { TranslateService } from '@ngx-translate/core'; standalone: true }) export class OkrChampionPipe implements PipeTransform { - constructor (private readonly translate: TranslateService) {} + constructor(private readonly translate: TranslateService) {} - transform (isOkrChampion: boolean): string { + transform(isOkrChampion: boolean): string { return isOkrChampion ? this.translate.instant('SHARED.JA') : '-'; } } diff --git a/frontend/src/app/team-management/roles.pipe.ts b/frontend/src/app/team-management/roles.pipe.ts index efd4916f35..620ff0a6f6 100644 --- a/frontend/src/app/team-management/roles.pipe.ts +++ b/frontend/src/app/team-management/roles.pipe.ts @@ -6,9 +6,9 @@ import { TranslateService } from '@ngx-translate/core'; name: 'roles' }) export class RolesPipe implements PipeTransform { - constructor (private translate: TranslateService) {} + constructor(private translate: TranslateService) {} - transform (roles: UserRole[]): string { + transform(roles: UserRole[]): string { if (!roles?.length) { return ''; } diff --git a/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts b/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts index 745d28d436..3e381802cf 100644 --- a/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts +++ b/frontend/src/app/team-management/search-team-management/search-team-management.component.spec.ts @@ -78,7 +78,7 @@ describe('SearchTeamManagementComponent', () => { let userServiceMock: Partial; let activatedRouteMock: Partial; let navigateSpy: Spy; - beforeEach(async () => { + beforeEach(async() => { jest.useFakeTimers(); teamServiceMock = { diff --git a/frontend/src/app/team-management/search-team-management/search-team-management.component.ts b/frontend/src/app/team-management/search-team-management/search-team-management.component.ts index 47585e75d9..e692b77021 100644 --- a/frontend/src/app/team-management/search-team-management/search-team-management.component.ts +++ b/frontend/src/app/team-management/search-team-management/search-team-management.component.ts @@ -39,7 +39,7 @@ export class SearchTeamManagementComponent { private users: User[] = []; - constructor ( + constructor( private readonly userService: UserService, private readonly teamService: TeamService, private readonly router: Router, @@ -71,20 +71,20 @@ export class SearchTeamManagementComponent { }); } - selectUser (user: User) { + selectUser(user: User) { this.search.setValue(''); const teamId: number = this.activatedRoute.snapshot.params['teamId']; this.router.navigateByUrl(getRouteToUserDetails(user.id, teamId)) .then(); } - selectTeam (team: Team) { + selectTeam(team: Team) { this.search.setValue(''); this.router.navigateByUrl(getRouteToTeam(team.id)) .then(); } - private applyFilter (filterValue: string): void { + private applyFilter(filterValue: string): void { if (!filterValue.length) { this.filteredUsers$.next([]); this.filteredTeams$.next([]); @@ -99,7 +99,7 @@ export class SearchTeamManagementComponent { .slice(0, SearchTeamManagementComponent.MAX_SUGGESTIONS)); } - private sortByStringPosition (a: string, b: string, value: string): number { + private sortByStringPosition(a: string, b: string, value: string): number { const indexA = a.toLowerCase() .indexOf(value); const indexB = b.toLowerCase() @@ -119,13 +119,13 @@ export class SearchTeamManagementComponent { return indexA - indexB; } - private updateTeamsAndUsers (teams: Team[], users: User[]) { + private updateTeamsAndUsers(teams: Team[], users: User[]) { this.teams = [...teams].sort((a, b) => a.name.localeCompare(b.name)); this.users = users.sort((a, b) => (a.firstname + a.lastname).localeCompare(b.firstname + b.lastname)); this.applyFilter(this.searchValue$.getValue()); } - private filterTeams (teams: Team[], filterValue: string): FilteredTeam[] { + private filterTeams(teams: Team[], filterValue: string): FilteredTeam[] { return teams .filter((team) => this.containsText(team.name, filterValue)) .map((team) => ({ @@ -135,7 +135,7 @@ export class SearchTeamManagementComponent { })); } - private filterUsers (users: User[], filterValue: string): FilteredUser[] { + private filterUsers(users: User[], filterValue: string): FilteredUser[] { return users .filter((user) => this.containsText(user.firstname + user.lastname + user.email, filterValue)) @@ -146,12 +146,12 @@ export class SearchTeamManagementComponent { })); } - private containsText (value: string, text: string): boolean { + private containsText(value: string, text: string): boolean { return value.toLowerCase() .indexOf(text.toLowerCase()) >= 0; } - private formatText (value: string, text: string): string { + private formatText(value: string, text: string): string { return value.replaceAll(new RegExp(`(${text})`, 'ig'), `$1`); } } diff --git a/frontend/src/app/team-management/show-edit-role/show-edit-role.component.spec.ts b/frontend/src/app/team-management/show-edit-role/show-edit-role.component.spec.ts index 771714ca4a..348bda27cd 100644 --- a/frontend/src/app/team-management/show-edit-role/show-edit-role.component.spec.ts +++ b/frontend/src/app/team-management/show-edit-role/show-edit-role.component.spec.ts @@ -10,7 +10,7 @@ describe('ShowEditRoleComponent', () => { let fixture: ComponentFixture; const userTeam = { ...testUser.userTeamList[0] }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [ShowEditRoleComponent], imports: [TranslateTestingModule.withTranslations({ de: de })] diff --git a/frontend/src/app/team-management/show-edit-role/show-edit-role.component.ts b/frontend/src/app/team-management/show-edit-role/show-edit-role.component.ts index 9fbb52ce20..cb57ebb83a 100644 --- a/frontend/src/app/team-management/show-edit-role/show-edit-role.component.ts +++ b/frontend/src/app/team-management/show-edit-role/show-edit-role.component.ts @@ -15,12 +15,12 @@ export class ShowEditRoleComponent { edit = false; - constructor (private readonly translate: TranslateService, + constructor(private readonly translate: TranslateService, private readonly elementRef: ElementRef, private readonly cd: ChangeDetectorRef) {} @HostListener('document:click', ['$event']) - clickOutside (event: MouseEvent) { + clickOutside(event: MouseEvent) { if (this.elementRef.nativeElement.contains(event.target)) { return; } @@ -31,7 +31,7 @@ export class ShowEditRoleComponent { * we set edit async, to ensure hostListener can detect outside-of-element clicks correctly * otherwise element of event.target is already hidden */ - setEditAsync ($event: MouseEvent, edit: boolean) { + setEditAsync($event: MouseEvent, edit: boolean) { $event.stopPropagation(); setTimeout(() => { this.edit = edit; @@ -39,19 +39,19 @@ export class ShowEditRoleComponent { }, 0); } - saveIsAdmin (isAdmin: boolean) { + saveIsAdmin(isAdmin: boolean) { this.edit = false; this.save.emit(isAdmin); } - getRole (): string { + getRole(): string { if (this.userTeam.isTeamAdmin) { return this.translate.instant('USER_ROLE.TEAM_ADMIN'); } return this.translate.instant('USER_ROLE.TEAM_MEMBER'); } - isEditable () { + isEditable() { return this.userTeam.team.writeable; } } diff --git a/frontend/src/app/team-management/team-list/team-list.component.spec.ts b/frontend/src/app/team-management/team-list/team-list.component.spec.ts index 9525ce19f9..0578ad2dde 100644 --- a/frontend/src/app/team-management/team-list/team-list.component.spec.ts +++ b/frontend/src/app/team-management/team-list/team-list.component.spec.ts @@ -22,7 +22,7 @@ describe('TeamListComponent', () => { }) }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ declarations: [TeamListComponent], providers: [{ provide: TeamService, diff --git a/frontend/src/app/team-management/team-list/team-list.component.ts b/frontend/src/app/team-management/team-list/team-list.component.ts index a37d84a3af..1e0734c69c 100644 --- a/frontend/src/app/team-management/team-list/team-list.component.ts +++ b/frontend/src/app/team-management/team-list/team-list.component.ts @@ -16,12 +16,12 @@ export class TeamListComponent implements OnInit, OnDestroy { private unsubscribe$ = new Subject(); - constructor (private readonly teamService: TeamService, + constructor(private readonly teamService: TeamService, private readonly route: ActivatedRoute) { this.teams$ = teamService.getAllTeams(); } - public ngOnInit (): void { + public ngOnInit(): void { this.route.paramMap.pipe(takeUntil(this.unsubscribe$)) .subscribe((params) => { const teamId = params.get('teamId'); @@ -29,7 +29,7 @@ export class TeamListComponent implements OnInit, OnDestroy { }); } - public ngOnDestroy (): void { + public ngOnDestroy(): void { this.unsubscribe$.next(); this.unsubscribe$.complete(); } diff --git a/frontend/src/app/team-management/team-management-banner/team-management-banner.component.ts b/frontend/src/app/team-management/team-management-banner/team-management-banner.component.ts index 67dbfb8b00..38b8fa91a7 100644 --- a/frontend/src/app/team-management/team-management-banner/team-management-banner.component.ts +++ b/frontend/src/app/team-management/team-management-banner/team-management-banner.component.ts @@ -11,9 +11,9 @@ import { DialogService } from '../../services/dialog.service'; export class TeamManagementBannerComponent { private dialogRef!: MatDialogRef | undefined; - public constructor (private dialogService: DialogService) {} + public constructor(private dialogService: DialogService) {} - createTeam (): void { + createTeam(): void { if (!this.dialogRef) { this.dialogRef = this.dialogService.open(AddEditTeamDialog); this.dialogRef.afterClosed() diff --git a/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.spec.ts b/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.spec.ts index d6ddee8e10..b0bfa092a7 100644 --- a/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.spec.ts +++ b/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.spec.ts @@ -39,7 +39,7 @@ describe('TeamManagementMobileFilterComponent', () => { navigateByUrl: jest.fn() }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ HttpClientModule, diff --git a/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.ts b/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.ts index 1d70667f9c..b4eb421be3 100644 --- a/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.ts +++ b/frontend/src/app/team-management/team-management-mobile-filter/team-management-mobile-filter.component.ts @@ -17,7 +17,7 @@ export class TeamManagementMobileFilterComponent { selectedTeam: Team | undefined | 'alle'; - constructor (private readonly teamService: TeamService, + constructor(private readonly teamService: TeamService, private readonly router: Router, private readonly route: ActivatedRoute) { combineLatest([teamService.getAllTeams(), @@ -27,19 +27,19 @@ export class TeamManagementMobileFilterComponent { params]) => this.setTeamsAndSelectedTeam(teams, params)); } - navigate (team: Team | 'alle') { + navigate(team: Team | 'alle') { team == this.ALL_TEAMS ? this.navigateToAllTeams() : this.navigateToTeam(team); } - private navigateToTeam (team: Team) { + private navigateToTeam(team: Team) { this.router.navigateByUrl(getRouteToTeam(team.id)); } - private navigateToAllTeams () { + private navigateToAllTeams() { this.router.navigateByUrl(getRouteToAllTeams()); } - private setTeamsAndSelectedTeam (teams: Team[], params: ParamMap) { + private setTeamsAndSelectedTeam(teams: Team[], params: ParamMap) { this.teams = teams; const teamId = params.get('teamId'); if (teamId) { diff --git a/frontend/src/app/team-management/team-management.component.spec.ts b/frontend/src/app/team-management/team-management.component.spec.ts index 311351ccca..92d190f08e 100644 --- a/frontend/src/app/team-management/team-management.component.spec.ts +++ b/frontend/src/app/team-management/team-management.component.spec.ts @@ -42,7 +42,7 @@ describe('TeamManagementComponent', () => { config$: of({}) }; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, diff --git a/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.spec.ts b/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.spec.ts index 29dd2fbc5f..25da7cd1bf 100644 --- a/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.spec.ts +++ b/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.spec.ts @@ -10,7 +10,7 @@ describe('TeamRoleDropdownComponent', () => { let component: TeamRoleDropdownComponent; let fixture: ComponentFixture; - beforeEach(async () => { + beforeEach(async() => { await TestBed.configureTestingModule({ imports: [ ReactiveFormsModule, diff --git a/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.ts b/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.ts index 3553df6332..4ee2e4e520 100644 --- a/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.ts +++ b/frontend/src/app/team-management/team-role-dropdown/team-role-dropdown.component.ts @@ -15,11 +15,11 @@ export class TeamRoleDropdownComponent implements OnInit { adminControl!: FormControl; - ngOnInit (): void { + ngOnInit(): void { this.adminControl = new FormControl(this.isAdmin, [Validators.required]); } - public triggerIsAdminChange (): void { + public triggerIsAdminChange(): void { this.isAdminChange.next(this.isAdmin); } } diff --git a/frontend/src/app/team-management/teams.pipe.ts b/frontend/src/app/team-management/teams.pipe.ts index 14ebe2e049..c4622564e2 100644 --- a/frontend/src/app/team-management/teams.pipe.ts +++ b/frontend/src/app/team-management/teams.pipe.ts @@ -7,9 +7,9 @@ import { TranslateService } from '@ngx-translate/core'; export class TeamsPipe implements PipeTransform { private readonly SEPARATOR = ', '; - constructor (private readonly translate: TranslateService) {} + constructor(private readonly translate: TranslateService) {} - transform (teams: string[], maxEntries: number | undefined): string { + transform(teams: string[], maxEntries: number | undefined): string { if (!teams?.length) { return ''; } diff --git a/frontend/src/global.ts b/frontend/src/global.ts index b7ffa9613e..5e6fc0210b 100644 --- a/frontend/src/global.ts +++ b/frontend/src/global.ts @@ -5,10 +5,10 @@ declare global { } } -String.prototype.format = function () { +String.prototype.format = function() { const args = Array.from(arguments) .flat(); - return this.replace(/{(\d+)}/g, function (match, index) { + return this.replace(/{(\d+)}/g, function(match, index) { return typeof args[index] == 'undefined' ? match : args[index]; }); };