From 56caefde5e2a63be198852dc637515ae3dc8456f Mon Sep 17 00:00:00 2001 From: Yanick Minder <79108296+kcinay055679@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:51:55 +0100 Subject: [PATCH] refactor styles of dialogs (#1072) * add jar debug dev tools only on profile * change log levels * try to fix autorestart of spring * rename intelij config and change log level of spring to debug in staging config * rename folder * use external profile to disable formatter * remove backend/pom.xml from branch * refactor styles of dialogs * remove useless tabindex * refactor styling of dialog-content and dialog-actions * refactor dialog header * clean up * fix invite members test * change default width of dialog * set cypress viewport * remove it.only from cy tests * use diffrent classes for default and small dialogs * remove useless config * clean up styling * remove scroll-shaddow * change height sizing strategie * refactor styling of keyresult edit component * introduce dialog-template-core-component * create base template for dialogs * align close button * comment in dialog component * fix scrolling of dialog * refactor kr-type-form * finish styling of kr-type select * fix scrolling by setting height of action buttons * clean up dialog content size * clean up styles.scss * refactor styles * refactor styles of generic component * move core component to shared module * fix design because of scrollbar * change keyresult type tabs to butotns * delete cancel dialog and refactor related files * refactor confirm dialog component to use template dialog core * refactor styling * refactor style of okr-label * refactor example dialog * refactor objective form component to use template dialog core * refactor objective form dialog * refactor dialog width * refactor keyresult component * fix responsive dialog * refactor objective complete dialog * clean up * refactor objective form component * minder out * fix objective form component * use priority to fetch logos * refactor dialog history compoennt * add spinner to dialog core * refactor dialog history component * refactor check-in componentn * refactor metric check in component * clean up keyresult dialog * clean up * fix kr type component * finish dialog refactoring * remove header component * refactor css classes * refactor styling * insert okr-form-label-input-container * fix dialog service tests * fix jest of objective form compoennt * fix tests of keyresult form * fix pom * fix tests of add-edit team dialog * fix tests keyresult-dialog tests * fix tests of complete dialog * fix jest tests * readd cancel button for check-in create * fix check-in e2e tests * fix e2e tests * remove only from cypress tests * fix teammanagement e2e test * fix duplicate scorring * clean up check-in tests * fix objective duplicate tests * clean up * clean up styles * create a dialog-data-show class * fix check in metric * fix keyresult type * clean up * implement todo --------- Co-authored-by: peggimann --- .../resources/application-staging.properties | 4 +- frontend/cypress/e2e/checkIn.cy.ts | 18 +- frontend/cypress/e2e/duplicated-scoring.cy.ts | 5 +- frontend/cypress/e2e/keyresult.cy.ts | 2 +- frontend/cypress/e2e/objective.cy.ts | 2 +- frontend/cypress/e2e/tab.cy.ts | 2 +- frontend/cypress/e2e/teammanagement.cy.ts | 33 ++- frontend/cypress/support/commands.ts | 1 + frontend/src/app/app.component.scss | 9 - frontend/src/app/app.module.ts | 2 +- .../src/app/callback/callback.component.html | 1 - .../src/app/callback/callback.component.ts | 8 - .../action-plan/action-plan.component.html | 10 +- .../application-top-bar.component.html | 2 +- .../check-in-history-dialog.component.html | 86 +++--- .../check-in-history-dialog.component.scss | 87 +----- .../check-in-history-dialog.component.spec.ts | 14 +- .../check-in-form-metric.component.html | 48 ++-- .../check-in-form-metric.component.scss | 51 ---- .../check-in-form-ordinal.component.html | 6 +- .../check-in-form-ordinal.component.scss | 2 +- .../check-in-form.component.html | 151 ++++++----- .../check-in-form.component.scss | 15 -- .../check-in-form.component.spec.ts | 15 +- .../check-in-form/check-in-form.component.ts | 8 +- .../confidence/confidence.component.html | 9 +- .../confidence/confidence.component.scss | 2 +- .../key-result-form.component.html | 39 +-- .../key-result-form.component.scss | 4 - .../key-result-form.component.spec.ts | 18 +- .../keyresult-detail.component.scss | 2 +- .../keyresult-dialog.component.html | 35 +-- .../keyresult-dialog.component.scss | 10 - .../keyresult-dialog.component.spec.ts | 28 +- .../keyresult-dialog.component.ts | 6 +- .../keyresult-type.component.html | 250 +++++++++--------- .../keyresult-type.component.scss | 63 +---- .../keyresult/keyresult.component.html | 2 +- .../objective-filter.component.scss | 12 - .../src/app/services/dialog.service.spec.ts | 61 ++++- frontend/src/app/services/dialog.service.ts | 17 +- .../dialog-header.component.html | 15 -- .../dialog-header.component.scss | 15 -- .../dialog-header.component.spec.ts | 21 -- .../dialog-header/dialog-header.component.ts | 11 - .../dialog-template-core.component.cy.ts} | 0 .../dialog-template-core.component.html | 35 +++ .../dialog-template-core.component.scss | 24 ++ .../dialog-template-core.component.ts | 22 ++ .../okr-tangram/okr-tangram.component.html | 2 +- .../cancel-dialog.component.html | 18 -- .../cancel-dialog.component.scss | 0 .../cancel-dialog/cancel-dialog.component.ts | 23 -- .../complete-dialog.component.html | 74 +++--- .../complete-dialog.component.scss | 4 - .../complete-dialog.component.spec.ts | 19 +- .../confirm-dialog.component.html | 35 ++- .../confirm-dialog.component.spec.ts | 6 +- .../example-dialog.component.html | 79 +++--- .../objective-form.component.html | 115 ++++---- .../objective-form.component.scss | 42 --- .../objective-form.component.spec.ts | 27 +- .../objective-form.component.ts | 20 ++ frontend/src/app/shared/shared.module.ts | 10 +- .../add-edit-team-dialog.component.html | 35 +-- .../add-edit-team-dialog.component.scss | 4 - .../add-edit-team-dialog.component.spec.ts | 16 +- .../add-edit-team-dialog.component.ts | 4 + .../add-member-to-team-dialog.component.html | 79 +++--- .../invite-user-dialog.component.html | 61 ++--- .../member-detail.component.spec.ts | 25 +- .../member-detail/member-detail.component.ts | 11 +- .../member-list-table.component.spec.ts | 5 +- .../member-list-table.component.ts | 14 +- .../member-list/member-list.component.spec.ts | 15 +- .../member-list/member-list.component.ts | 12 +- frontend/src/assets/i18n/de.json | 8 +- frontend/src/style/_variables.scss | 9 +- .../src/style/custom_angular.components.scss | 14 +- frontend/src/style/custom_bootstrap.scss | 3 +- frontend/src/style/styles.scss | 132 ++++----- 81 files changed, 1015 insertions(+), 1189 deletions(-) delete mode 100644 frontend/src/app/callback/callback.component.html delete mode 100644 frontend/src/app/callback/callback.component.ts delete mode 100644 frontend/src/app/objective-filter/objective-filter.component.scss delete mode 100644 frontend/src/app/shared/custom/dialog-header/dialog-header.component.html delete mode 100644 frontend/src/app/shared/custom/dialog-header/dialog-header.component.scss delete mode 100644 frontend/src/app/shared/custom/dialog-header/dialog-header.component.spec.ts delete mode 100644 frontend/src/app/shared/custom/dialog-header/dialog-header.component.ts rename frontend/src/app/{callback/callback.component.css => shared/custom/dialog-template-core/dialog-template-core.component.cy.ts} (100%) create mode 100644 frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.html create mode 100644 frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.scss create mode 100644 frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.ts delete mode 100644 frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.html delete mode 100644 frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.scss delete mode 100644 frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.ts diff --git a/backend/src/main/resources/application-staging.properties b/backend/src/main/resources/application-staging.properties index effd67d65a..38e4a47571 100644 --- a/backend/src/main/resources/application-staging.properties +++ b/backend/src/main/resources/application-staging.properties @@ -1,5 +1,7 @@ # logging level for staging -logging.level.org.springframework=debug +logging.level.ch.puzzle.okr=DEBUG +#logging.level.org.flywaydb.core=DEBUG + connect.src=http://localhost:8544 http://localhost:8545 diff --git a/frontend/cypress/e2e/checkIn.cy.ts b/frontend/cypress/e2e/checkIn.cy.ts index 45728dedc0..70c2c17a38 100644 --- a/frontend/cypress/e2e/checkIn.cy.ts +++ b/frontend/cypress/e2e/checkIn.cy.ts @@ -163,12 +163,12 @@ describe('OKR Check-in e2e tests', () => { cy.contains(getCurrentDate()); cy.contains('Wert: 30%'); cy.contains('Wert: 50%'); - cy.contains('Confidence: 5 / 10'); - cy.contains('Confidence: 6 / 10'); - cy.contains('Veränderungen: We bought a new house'); - cy.contains('Veränderungen: This was a good idea'); - cy.contains('Massnahmen: We have to buy more PCs'); - cy.contains('Massnahmen: Will be difficult'); + checkForAttribute('Confidence:', '5 / 10'); + checkForAttribute('Confidence:', '6 / 10'); + checkForAttribute('Veränderungen:', 'We bought a new house'); + checkForAttribute('Veränderungen:', 'This was a good idea'); + checkForAttribute('Massnahmen:', 'We have to buy more PCs'); + checkForAttribute('Massnahmen:', 'Will be difficult'); cy.contains('Schliessen'); }); @@ -312,7 +312,7 @@ describe('OKR Check-in e2e tests', () => { cy.wait('@getKeyResultsAfterSave'); cy.getByTestId('add-check-in').first().click(); - cy.get('#old-value label + div').contains('10 %'); + cy.contains('Letzter Wert').siblings('div').contains('10 %'); }); }); }); @@ -359,3 +359,7 @@ function getCurrentDate() { return dd_str + '.' + mm_str + '.' + yyyy; } + +function checkForAttribute(title: string, value: string) { + cy.get('mat-dialog-container').contains(value).parent().should('contain', title); +} diff --git a/frontend/cypress/e2e/duplicated-scoring.cy.ts b/frontend/cypress/e2e/duplicated-scoring.cy.ts index d1152ced59..6a87dbd243 100644 --- a/frontend/cypress/e2e/duplicated-scoring.cy.ts +++ b/frontend/cypress/e2e/duplicated-scoring.cy.ts @@ -9,7 +9,10 @@ describe('e2e test for scoring adjustment on objective duplicate', () => { }); it('Create ordinal checkin and validate value of scoring component', () => { + cy.intercept('POST', '**/keyresults').as('createKeyresult'); cy.createOrdinalKeyresult('stretch keyresult for testing', null); + cy.wait('@createKeyresult'); + cy.contains('stretch keyresult for testing'); cy.getByTestId('keyresult').get(':contains("stretch keyresult for testing")').last().click(); cy.getByTestId('add-check-in').click(); cy.getByTestId(`stretch-radio`).click(); @@ -26,7 +29,7 @@ describe('e2e test for scoring adjustment on objective duplicate', () => { cy.visit('/?quarter=3'); let scoringBlock1 = cy - .getByTestId('objective') + .get('.objective:contains("A duplicated Objective for this tool")') .first() .getByTestId('key-result') .first() diff --git a/frontend/cypress/e2e/keyresult.cy.ts b/frontend/cypress/e2e/keyresult.cy.ts index f7f9ef7b67..aaa5d3b709 100644 --- a/frontend/cypress/e2e/keyresult.cy.ts +++ b/frontend/cypress/e2e/keyresult.cy.ts @@ -294,7 +294,7 @@ describe('OKR Overview', () => { cy.getByTestId('edit-keyResult').click(); cy.getByTestId('delete-keyResult').click(); - cy.getByTestId('confirmYes').click(); + cy.getByTestId('confirm-yes').click(); cy.contains('Puzzle ITC'); cy.get('A keyresult to delete').should('not.exist'); diff --git a/frontend/cypress/e2e/objective.cy.ts b/frontend/cypress/e2e/objective.cy.ts index 758d7687a3..83eb98496e 100644 --- a/frontend/cypress/e2e/objective.cy.ts +++ b/frontend/cypress/e2e/objective.cy.ts @@ -30,7 +30,7 @@ describe('OKR Objective e2e tests', () => { .click(); cy.contains('Objective veröffentlichen'); cy.contains('Soll dieses Objective veröffentlicht werden?'); - cy.getByTestId('confirmYes').click(); + cy.getByTestId('confirm-yes').click(); cy.getByTestId('objective') .filter(':contains(A objective in state draft)') .last() diff --git a/frontend/cypress/e2e/tab.cy.ts b/frontend/cypress/e2e/tab.cy.ts index 4d1cdd714b..ee8143f4eb 100644 --- a/frontend/cypress/e2e/tab.cy.ts +++ b/frontend/cypress/e2e/tab.cy.ts @@ -416,7 +416,7 @@ describe('Tab workflow tests', () => { cy.tabForwardUntil('[data-testId="add-action-plan-line"]'); cy.tabBackward(); cy.realPress('Enter'); - cy.tabForwardUntil('[data-testId="confirmYes"]'); + cy.tabForwardUntil('[data-testId="confirm-yes"]'); cy.realPress('Enter'); cy.tabForward(); cy.tabForwardUntil('[data-testId="submit"]'); diff --git a/frontend/cypress/e2e/teammanagement.cy.ts b/frontend/cypress/e2e/teammanagement.cy.ts index d89d8b06e1..6edf0db28e 100644 --- a/frontend/cypress/e2e/teammanagement.cy.ts +++ b/frontend/cypress/e2e/teammanagement.cy.ts @@ -44,8 +44,8 @@ describe('Team management tests', () => { cy.getByTestId('remove-from-member-list').click(); // dialog - cy.contains(`Jaya Norris wirklich aus Team ${teamName} entfernen?`); - cy.getByTestId('cancelDialog-confirm').click(); + cy.contains(`Möchtest du Jaya Norris wirklich aus dem Team '${teamName}' entfernen?`); + cy.getByTestId('confirm-yes').click(); cy.wait('@removeUser'); @@ -60,8 +60,8 @@ describe('Team management tests', () => { cy.getByTestId('remove-from-member-list').click(); // cancel dialog - cy.contains(`Jaya Norris wirklich aus Team ${teamName} entfernen?`); - cy.getByTestId('cancelDialog-cancel').click(); + cy.contains(`Möchtest du Jaya Norris wirklich aus dem Team '${teamName}' entfernen?`); + cy.getByTestId('confirm-no').click(); cy.get('@removeUser.all').then((interceptions) => { expect(interceptions).to.have.length(0); @@ -96,14 +96,18 @@ describe('Team management tests', () => { cy.getByTestId('teamDeleteButton').click(); // cancel dialog => cancel - cy.contains(`${teamName} wirklich löschen?`); - cy.getByTestId('cancelDialog-cancel').click(); + cy.contains( + `Möchtest du das Team '${teamName}' wirklich löschen? Zugehörige Objectives werden dadurch in allen Quartalen ebenfalls gelöscht!`, + ); + cy.getByTestId('confirm-no').click(); // try again and confirm dialog cy.getByTestId('teamMoreButton').click(); cy.getByTestId('teamDeleteButton').click(); - cy.contains(`${teamName} wirklich löschen?`); - cy.getByTestId('cancelDialog-confirm').click(); + cy.contains( + `Möchtest du das Team '${teamName}' wirklich löschen? Zugehörige Objectives werden dadurch in allen Quartalen ebenfalls gelöscht!`, + ); + cy.getByTestId('confirm-yes').click(); cy.wait(['@saveTeam', '@getUsers']); @@ -149,6 +153,10 @@ describe('Team management tests', () => { const firstNameStefan = uniqueSuffix('Stefan'); cy.getByTestId('invite-member').click(); + cy.wait(1000); // wait for dialog to open + cy.tabForward(); + cy.contains('Members registrieren'); + fillOutNewUser(firstNameClaudia, 'Meier', mailUserClaudia); cy.tabForward(); cy.tabForward(); @@ -305,7 +313,7 @@ describe('Team management tests', () => { // add findus peterson cy.getByTestId('search-member-to-add').click().type('Find', { delay: 1 }); - cy.get(matOption).contains('Findus Peterson').click(); + cy.contains(matOption, 'Findus Peterson').click(); // add robin papierer cy.getByTestId('search-member-to-add').click(); @@ -336,6 +344,7 @@ describe('Team management tests', () => { return; } $row.find(`[data-testId='edit-role']`).click(); + cy.wait(500); // wait for dialog to open }) .then(() => { cy.getByTestId('select-team-role').click(); @@ -356,7 +365,7 @@ describe('Team management tests', () => { it('should remove BBT membership of findus', () => { navigateToUser('Findus Peterson'); cy.getByTestId('delete-team-member').click(); - cy.getByTestId('cancelDialog-confirm').click(); + cy.getByTestId('confirm-yes').click(); cy.get('app-member-detail').contains('/BBT').should('not.exist'); }); @@ -365,12 +374,12 @@ describe('Team management tests', () => { navigateToUser(nameEsha); cy.getByTestId('delete-team-member').eq(0).click(); - cy.getByTestId('cancelDialog-confirm').click(); + cy.getByTestId('confirm-yes').click(); cy.wait('@removeUser'); cy.getByTestId('delete-team-member').eq(0).click(); - cy.getByTestId('cancelDialog-confirm').click(); + cy.getByTestId('confirm-yes').click(); cy.get('app-member-detail').should('not.contain', '/BBT').and('not.contain', 'LoremIpsum'); }); diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 1fa1df2314..30e6b962c6 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -1,6 +1,7 @@ import { validateScoring } from './scoringSupport'; Cypress.Commands.add('loginAsUser', (user: any) => { + cy.viewport(1920, 1080); loginWithCredentials(user.username, user.password); overviewIsLoaded(); }); diff --git a/frontend/src/app/app.component.scss b/frontend/src/app/app.component.scss index 97a874648e..8ba091ef8b 100644 --- a/frontend/src/app/app.component.scss +++ b/frontend/src/app/app.component.scss @@ -1,12 +1,3 @@ -.okr-label { - margin-left: 35px; -} - -.overview-item { - margin-right: 20px; - margin-left: 50px; -} - app-application-top-bar { z-index: 1001; position: relative; diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 58fa564e59..6e3150d3c1 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -166,9 +166,9 @@ export const MY_FORMATS = { MatChipsModule, CdkDropList, CdkDrag, - SharedModule, A11yModule, CdkDragHandle, + SharedModule, ], providers: [ { diff --git a/frontend/src/app/callback/callback.component.html b/frontend/src/app/callback/callback.component.html deleted file mode 100644 index 9a5f2cf345..0000000000 --- a/frontend/src/app/callback/callback.component.html +++ /dev/null @@ -1 +0,0 @@ -

You are getting forwarded!

diff --git a/frontend/src/app/callback/callback.component.ts b/frontend/src/app/callback/callback.component.ts deleted file mode 100644 index ac042fdc53..0000000000 --- a/frontend/src/app/callback/callback.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-callback', - templateUrl: './callback.component.html', - styleUrl: './callback.component.css', -}) -export class CallbackComponent {} diff --git a/frontend/src/app/components/action-plan/action-plan.component.html b/frontend/src/app/components/action-plan/action-plan.component.html index b056643283..4d7b642f9e 100644 --- a/frontend/src/app/components/action-plan/action-plan.component.html +++ b/frontend/src/app/components/action-plan/action-plan.component.html @@ -1,11 +1,11 @@ -
- +
+
@@ -42,11 +42,11 @@
-
+
- -
-
- Wert: {{ getMetricKeyResult().unit | unitLabelTransformation }} - {{ +checkIn.value! | unitValueTransformation: getMetricKeyResult().unit }} - Wert: {{ checkIn.value }} +
+

Wert:

+
+ + {{ getMetricKeyResult().unit | unitLabelTransformation }} + {{ +checkIn.value! | unitValueTransformation: getMetricKeyResult().unit }} + + + {{ checkIn.value }} + +
+

Confidence:

+
{{ checkIn.confidence }} / 10
-
- Confidence: {{ checkIn.confidence }} / 10 + +
+

Veränderungen:

+ {{ checkIn.changeInfo }} +
+ +
+

Massnahmen:

+ {{ checkIn.initiatives }}
-
-
- Veränderungen: - {{ checkIn.changeInfo }} -
-
- Massnahmen: - {{ checkIn.initiatives }}
-
- - - - - + + + +
+ +
+
+ diff --git a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.scss b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.scss index 2d5a6334b6..c2c8998c4f 100644 --- a/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.scss +++ b/frontend/src/app/components/check-in-history-dialog/check-in-history-dialog.component.scss @@ -1,85 +1,4 @@ -@import "../style/variables"; - -.cancel-button { - background-color: $pz-dark-blue; - border-radius: 8px; - width: min-content; -} - -.edit-check-in { - width: 20px; - height: 20px; -} - -.edit-check-in-button { - @extend .edit-check-in; - margin-right: 5px; -} - -.check-in-box { - background-color: #f5f5f5; -} - -.label-width { - width: 19%; -} - -.value-width { - width: 81%; -} - -.dialog-content { - max-height: 28.5vh; -} - -.close-button { - margin-top: 32px; -} - -@media only screen and (max-width: 690px) { - .label-width { - width: 60%; - } -} - -@media only screen and (min-height: 600px) and (max-width: 450px) { - .dialog-content { - max-height: 500px; - } -} - -@media only screen and (min-height: 700px) and (max-width: 450px) { - .dialog-content { - max-height: 590px; - } -} - -@media only screen and (min-height: 800px) and (max-width: 450px) { - .dialog-content { - max-height: 625px; - } -} - -@media only screen and (min-height: 850px) and (max-width: 450px) { - .dialog-content { - max-height: 685px; - } -} - -@media only screen and (min-height: 875px) and (max-width: 450px) { - .dialog-content { - max-height: 715px; - } -} - -@media only screen and (min-height: 900px) and (max-width: 450px) { - .dialog-content { - max-height: 750px; - } -} - -@media only screen and (min-height: 1000px) and (max-width: 450px) { - .dialog-content { - max-height: 550px; - } +//TODO: Just Temporarily so the application look decent +h4 { + font-size: 1rem; } 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 cd4b5a7262..ee75865c64 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 @@ -2,15 +2,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CheckInHistoryDialogComponent } from './check-in-history-dialog.component'; import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; import { checkInMetric, checkInMetricWriteableFalse, keyResult } from '../../shared/testData'; import { By } from '@angular/platform-browser'; import { DialogService } from '../../services/dialog.service'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; -import { DialogHeaderComponent } from '../../shared/custom/dialog-header/dialog-header.component'; import { MatIconModule } from '@angular/material/icon'; import { SpinnerComponent } from '../../shared/custom/spinner/spinner.component'; import { MatProgressSpinner } from '@angular/material/progress-spinner'; +import { provideRouter } from '@angular/router'; +import { provideHttpClient } from '@angular/common/http'; +import { DialogTemplateCoreComponent } from '../../shared/custom/dialog-template-core/dialog-template-core.component'; +import { MatDividerModule } from '@angular/material/divider'; const checkInService = { getAllCheckInOfKeyResult: jest.fn(), @@ -22,10 +25,13 @@ describe('CheckInHistoryDialogComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [CheckInHistoryDialogComponent, DialogHeaderComponent, SpinnerComponent], + declarations: [CheckInHistoryDialogComponent, DialogTemplateCoreComponent, SpinnerComponent], - imports: [HttpClientTestingModule, TranslateModule.forRoot(), MatIconModule, MatProgressSpinner], + imports: [TranslateModule.forRoot(), MatIconModule, MatProgressSpinner, MatDividerModule, MatDialogModule], providers: [ + provideRouter([]), + provideHttpClient(), + provideHttpClientTesting(), TranslateService, DialogService, { provide: MAT_DIALOG_DATA, useValue: { keyResult: keyResult } }, diff --git a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.html b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.html index 45d9ce03ec..3c796f384f 100644 --- a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.html +++ b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.html @@ -1,28 +1,34 @@ -
-
-
- -
-
- +
+
+
+ +
+ +
+ +
+ + {{ generateUnitLabel() }} - {{ generateUnitLabel() }}
+ + {{ getErrorMessage("MUST_BE_NUMBER", "Neuer Wert") }} +
-
- -
- {{ checkIn.value }} {{ generateUnitLabel() }} +
+ +
+
+

Letzter Wert

+
+
{{ checkIn.value }} {{ generateUnitLabel() }}
- - {{ getErrorMessage("MUST_BE_NUMBER", "Neuer Wert") }} -
diff --git a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.scss b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.scss index 46bd29b25b..e69de29bb2 100644 --- a/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.scss +++ b/frontend/src/app/components/checkin/check-in-form-metric/check-in-form-metric.component.scss @@ -1,51 +0,0 @@ -.custom-input { - margin-top: 3px; -} - -mat-label { - color: black; -} - -.value-field { - height: 2rem; - padding: 0.437rem 0.625rem 0.375rem 0.625rem !important; -} - -.unit-label { - margin-left: 10px; -} - -.disabled-field { - background-color: #f5f5f5; - width: 218px; -} - -@media only screen and (min-width: 601px) { - .gap-between { - gap: 5rem; - } -} - -@media only screen and (min-width: 575px) and (max-width: 600px) { - #new-value { - order: 0; - } - #old-value { - order: 1; - } - .gap-between { - gap: 3rem; - } -} - -@media only screen and (max-width: 574px) { - #new-value { - order: 1; - } - #old-value { - order: 0; - } - .gap-between { - gap: 1rem; - } -} diff --git a/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html b/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html index 511f0222b1..8a5af56f89 100644 --- a/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html +++ b/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.html @@ -1,7 +1,7 @@
-
- - +
+ +
Fail:   Commit / Target / Stretch noch nicht erreicht diff --git a/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss b/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss index 55e3fe921d..62b280fbef 100644 --- a/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss +++ b/frontend/src/app/components/checkin/check-in-form-ordinal/check-in-form-ordinal.component.scss @@ -17,6 +17,6 @@ mat-label { color: black; } .radio-text-container { - background: $show-element; + background: $display-element; height: auto; } diff --git a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.html b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.html index c821f83b3e..5a2ee63747 100644 --- a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.html +++ b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.html @@ -1,42 +1,45 @@ -
- - -
- - -
- -
-

Key Result

-

{{ keyResult.title }}

+ + + +
+

Key Result

+ +

{{ keyResult.title }}

+
-
- - - - - {{ action.action }} + +
+

Action Plan:

+
+ + + +
+ {{ action.action }} +
- +
-
- - - - {{ getErrorMessage("MAX_VALUE", "Kommentar / Veränderung", 4096) }} - +
+ +
+ + + {{ getErrorMessage("MAX_VALUE", "Kommentar / Veränderung", 4096) }} + +
-
- - - - {{ getErrorMessage("MAX_VALUE", "Massnahmen", 4096) }} - +
+ +
+ + + {{ getErrorMessage("MAX_VALUE", "Massnahmen", 4096) }} + +
-
-
- + - - - - + +
+ + +
+
+ diff --git a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.scss b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.scss index 669c394785..010e8abc58 100644 --- a/frontend/src/app/components/checkin/check-in-form/check-in-form.component.scss +++ b/frontend/src/app/components/checkin/check-in-form/check-in-form.component.scss @@ -1,14 +1,3 @@ -@import "../style/variables"; - -.action-list-item { - background-color: $show-element; - height: auto; - min-height: 40px; - padding: 10px; - margin: auto; - color: black; -} - .confidence-label { margin-bottom: -7px; } @@ -16,7 +5,3 @@ app-check-in-form-ordinal { padding-top: 0.1rem; } - -.dialog-content { - max-height: 45vh; -} 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 65f71b851e..55819aace2 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 @@ -11,7 +11,6 @@ import { keyResultMetric, keyResultOrdinal, } from '../../../shared/testData'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { MatIconModule } from '@angular/material/icon'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; @@ -23,11 +22,16 @@ import { ParseUnitValuePipe } from '../../../shared/pipes/parse-unit-value/parse import { CheckInService } from '../../../services/check-in.service'; import { of } from 'rxjs'; import { ActionService } from '../../../services/action.service'; +// @ts-ignore import * as de from '../../../../assets/i18n/de.json'; import { TranslateTestingModule } from 'ngx-translate-testing'; -import { DialogHeaderComponent } from '../../../shared/custom/dialog-header/dialog-header.component'; import { ConfidenceComponent } from '../../confidence/confidence.component'; import { MatSliderModule } from '@angular/material/slider'; +import { provideRouter } from '@angular/router'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { DialogTemplateCoreComponent } from '../../../shared/custom/dialog-template-core/dialog-template-core.component'; +import { MatDividerModule } from '@angular/material/divider'; const dialogMock = { close: jest.fn(), @@ -48,7 +52,6 @@ describe('CheckInFormComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ - HttpClientTestingModule, MatDialogModule, MatIconModule, MatFormFieldModule, @@ -63,15 +66,19 @@ describe('CheckInFormComponent', () => { TranslateTestingModule.withTranslations({ de: de, }), + MatDividerModule, ], providers: [ + provideRouter([]), + provideHttpClient(), + provideHttpClientTesting(), { provide: MAT_DIALOG_DATA, useValue: { keyResult: {} } }, { provide: MatDialogRef, useValue: dialogMock }, { provide: CheckInService, useValue: checkInServiceMock }, { provide: ActionService, useValue: actionServiceMock }, ParseUnitValuePipe, ], - declarations: [CheckInFormComponent, DialogHeaderComponent, ConfidenceComponent], + declarations: [CheckInFormComponent, DialogTemplateCoreComponent, ConfidenceComponent], }); fixture = TestBed.createComponent(CheckInFormComponent); component = fixture.componentInstance; 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 baa3b8b1a0..a47c0b1da7 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 @@ -111,8 +111,8 @@ export class CheckInFormComponent implements OnInit { return this.keyResult as KeyResultOrdinal; } - getActions(): Action[] | null { - return this.dialogForm.controls['actionList'].value; + getActions(): Action[] { + return this.dialogForm.controls['actionList'].value || []; } changeIsChecked(event: any, index: number) { @@ -120,4 +120,8 @@ export class CheckInFormComponent implements OnInit { actions[index] = { ...actions[index], isChecked: event.checked }; this.dialogForm.patchValue({ actionList: actions }); } + + getDialogTitle(): string { + return this.checkIn.id ? 'Check-in bearbeiten' : 'Check-in erfassen'; + } } diff --git a/frontend/src/app/components/confidence/confidence.component.html b/frontend/src/app/components/confidence/confidence.component.html index aa8b974de0..286d8e3cf4 100644 --- a/frontend/src/app/components/confidence/confidence.component.html +++ b/frontend/src/app/components/confidence/confidence.component.html @@ -1,13 +1,14 @@
-

{{ checkIn.confidence }}/{{ max }}

+

+ {{ checkIn.confidence }}/{{ max }} +

-
-
- + +
+ +
- - {{ getErrorMessage("SIZE_BETWEEN", "Commit Zone", 1, 400) }} - -
+ +
+
+ +
+ + + {{ getErrorMessage("SIZE_BETWEEN", "Commit Zone", 1, 400) }} + +
+
+
-
- - - - {{ getErrorMessage("SIZE_BETWEEN", "Target Zone", 1, 400) }} - -
+
+
+ +
+ + + {{ getErrorMessage("SIZE_BETWEEN", "Target Zone", 1, 400) }} + +
+
+
-
- - - - {{ getErrorMessage("SIZE_BETWEEN", "Stretch Zone", 1, 400) }} - -
-
+
+
+ +
+ + + {{ getErrorMessage("SIZE_BETWEEN", "Stretch Zone", 1, 400) }} +
diff --git a/frontend/src/app/components/keyresult-type/keyresult-type.component.scss b/frontend/src/app/components/keyresult-type/keyresult-type.component.scss index 9b3e87d79e..0edb31b8a7 100644 --- a/frontend/src/app/components/keyresult-type/keyresult-type.component.scss +++ b/frontend/src/app/components/keyresult-type/keyresult-type.component.scss @@ -1,7 +1,11 @@ +@import "custom_bootstrap"; + .active { border-left: #909090 1px solid; border-top: #909090 1px solid; border-right: #909090 1px solid; + border-bottom: #909090 0 solid; + border-top-left-radius: 5px; border-top-right-radius: 5px; background: white; @@ -10,22 +14,21 @@ .non-active { color: #9c9c9c; + background: white; + border: #909090 0 solid; border-bottom: #909090 1px solid; } .tab-title { - display: flex; - justify-content: center; - align-items: center; - height: 39px; - margin-bottom: 16px; + @extend .p-2; + @extend .tab-focus; } .buffer { border-bottom: #909090 1px solid; } -.tabfocus { +.tab-focus { outline: none; &:focus-visible { border-radius: 5px; @@ -33,55 +36,7 @@ } } -.metric { - width: 87px; -} - -.ordinal { - width: 75px; -} - -.ordinal-input-fields { - height: 4.3rem; - padding: 0.437rem 0.625rem 0.375rem 0.625rem !important; -} - -.metric-fields { - height: 2rem; - padding: 0.437rem 0.625rem 0.375rem 0.625rem !important; -} - -.input-style { - width: 31%; -} - .unit-dropdown { - @extend .metric-fields; border: solid 1px #909090; cursor: pointer; } - -@media only screen and (min-width: 820px) { - .input-alignments { - display: flex; - justify-content: space-between; - } - - .input-style { - margin-bottom: 0; - } -} - -@media only screen and (max-width: 820px) { - .metric-fields { - width: 100%; - } - - .ordinal-input-fields { - width: 100%; - } - - .input-style { - width: auto; - } -} diff --git a/frontend/src/app/components/keyresult/keyresult.component.html b/frontend/src/app/components/keyresult/keyresult.component.html index 926322cd1c..3abe4ac6e6 100644 --- a/frontend/src/app/components/keyresult/keyresult.component.html +++ b/frontend/src/app/components/keyresult/keyresult.component.html @@ -24,7 +24,7 @@

{{ keyResult.title }}

[edit]="false" [isDetail]="false" [checkIn]="keyResult.lastCheckIn!" - class="ms-2 bg-keyResult-attribute" + class="bg-keyResult-attribute" >
diff --git a/frontend/src/app/objective-filter/objective-filter.component.scss b/frontend/src/app/objective-filter/objective-filter.component.scss deleted file mode 100644 index 0f3d371327..0000000000 --- a/frontend/src/app/objective-filter/objective-filter.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -.search-button { - border-radius: 0 4px 4px 0; - padding-left: 15px; -} - -#objective-form-field { - width: 300px; -} - -.search-scale { - transform: scale(1.2); -} diff --git a/frontend/src/app/services/dialog.service.spec.ts b/frontend/src/app/services/dialog.service.spec.ts index 16b4888d16..b9f540874f 100644 --- a/frontend/src/app/services/dialog.service.spec.ts +++ b/frontend/src/app/services/dialog.service.spec.ts @@ -2,16 +2,26 @@ import { TestBed } from '@angular/core/testing'; import { DialogService } from './dialog.service'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; -import { MatDialogRef } from '@angular/material/dialog'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { ConfirmDialogComponent } from '../shared/dialog/confirm-dialog/confirm-dialog.component'; -import { TeamComponent } from '../components/team/team.component'; +import { AddEditTeamDialog } from '../team-management/add-edit-team-dialog/add-edit-team-dialog.component'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { provideHttpClient } from '@angular/common/http'; describe('DialogService', () => { let service: DialogService; + let matDialogSpy: MatDialog; + let translateServiceSpy: TranslateService; beforeEach(() => { - TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], providers: [TranslateService] }); + TestBed.configureTestingModule({ + imports: [TranslateModule.forRoot()], + providers: [provideHttpClient(), provideHttpClientTesting(), TranslateService], + }); + matDialogSpy = TestBed.inject(MatDialog); service = TestBed.inject(DialogService); + translateServiceSpy = TestBed.inject(TranslateService); + jest.spyOn(matDialogSpy, 'open'); }); it('should be created', () => { @@ -19,20 +29,51 @@ describe('DialogService', () => { }); it('should open dialog', () => { - const dialog = service.open(TeamComponent); + const dialog = service.open(AddEditTeamDialog, { + data: { + aProperty: 'aValue', + }, + }); expect(dialog).toBeInstanceOf(MatDialogRef); - expect(dialog._containerInstance._config.panelClass).toEqual(service.DIALOG_CONFIG.panelClass); - expect(dialog._containerInstance._config.maxWidth).toEqual(service.DIALOG_CONFIG.maxWidth); - expect(dialog.componentInstance).toBeInstanceOf(TeamComponent); + expect(dialog.componentInstance).toBeInstanceOf(AddEditTeamDialog); + + expect(matDialogSpy.open).toHaveBeenCalledWith(AddEditTeamDialog, { + panelClass: service.DIALOG_PANEL_CLASS_DEFAULT, + ...service.DIALOG_CONFIG, + data: { + aProperty: 'aValue', + }, + }); }); it('should open confirm dialog', () => { + const i18nData = { + team: 'the a-team', + }; jest.spyOn(service, 'open'); - const dialog = service.openConfirmDialog('DELETE.ACTION'); + jest.spyOn(translateServiceSpy, 'instant'); + const dialog = service.openConfirmDialog('DELETE.TEAM', i18nData); + + //Call function of own service expect(service.open).toHaveBeenCalledTimes(1); expect(dialog).toBeInstanceOf(MatDialogRef); + expect(translateServiceSpy.instant).toHaveBeenCalledTimes(2); + expect(translateServiceSpy.instant).toHaveBeenCalledWith('DELETE.TEAM.TITLE', i18nData); + expect(translateServiceSpy.instant).toHaveBeenCalledWith('DELETE.TEAM.TEXT', i18nData); + + //Call function of angular material dialog + expect(matDialogSpy.open).toHaveBeenCalledTimes(1); expect(dialog.componentInstance).toBeInstanceOf(ConfirmDialogComponent); - expect(dialog.componentInstance.data.title).toBe('DELETE.ACTION.TITLE'); - expect(dialog.componentInstance.data.text).toBe('DELETE.ACTION.TEXT'); + expect(dialog.componentInstance.data.title).toBe('DELETE.TEAM.TITLE'); + expect(dialog.componentInstance.data.text).toBe('DELETE.TEAM.TEXT'); + + expect(matDialogSpy.open).toHaveBeenCalledWith(ConfirmDialogComponent, { + panelClass: service.DIALOG_PANEL_CLASS_SMALL, + ...service.DIALOG_CONFIG, + data: { + title: 'DELETE.TEAM.TITLE', + text: 'DELETE.TEAM.TEXT', + }, + }); }); }); diff --git a/frontend/src/app/services/dialog.service.ts b/frontend/src/app/services/dialog.service.ts index 5bfa310482..a1236133ea 100644 --- a/frontend/src/app/services/dialog.service.ts +++ b/frontend/src/app/services/dialog.service.ts @@ -13,9 +13,12 @@ export interface ConfirmDialogData { providedIn: 'root', }) export class DialogService { - DIALOG_CONFIG = { - panelClass: 'okr-dialog-panel', - maxWidth: '100vw', + DIALOG_PANEL_CLASS_DEFAULT = 'okr-dialog-panel-default'; + DIALOG_PANEL_CLASS_SMALL = 'okr-dialog-panel-small'; + + DIALOG_CONFIG: MatDialogConfig = { + maxWidth: '100vw', // Used to override the default maxWidth of angular material dialog + autoFocus: 'first-tabbable', }; constructor( @@ -25,15 +28,17 @@ export class DialogService { open(component: ComponentType, config?: MatDialogConfig): MatDialogRef { return this.dialog.open(component, { + panelClass: this.DIALOG_PANEL_CLASS_DEFAULT, ...this.DIALOG_CONFIG, ...config, }); } - openConfirmDialog(translationKey: string) { - const title = this.translationService.instant(`${translationKey}.TITLE`); - const text = this.translationService.instant(`${translationKey}.TEXT`); + 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, { + panelClass: this.DIALOG_PANEL_CLASS_SMALL, data: { title: title, text: text, diff --git a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.html b/frontend/src/app/shared/custom/dialog-header/dialog-header.component.html deleted file mode 100644 index 80a7f62d05..0000000000 --- a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.html +++ /dev/null @@ -1,15 +0,0 @@ -
- - {{ dialogTitle }} - -
- -
-
diff --git a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.scss b/frontend/src/app/shared/custom/dialog-header/dialog-header.component.scss deleted file mode 100644 index 40bb4dbcda..0000000000 --- a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.scss +++ /dev/null @@ -1,15 +0,0 @@ -.closing-button { - right: 0; -} - -@media only screen and (min-width: 800px) { - .dialog-header { - margin-bottom: 1rem; - } -} - -mat-icon { - display: flex; - justify-content: center; - align-items: center; -} diff --git a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.spec.ts b/frontend/src/app/shared/custom/dialog-header/dialog-header.component.spec.ts deleted file mode 100644 index 2065d3916a..0000000000 --- a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DialogHeaderComponent } from './dialog-header.component'; - -describe('DialogHeaderComponent', () => { - let component: DialogHeaderComponent; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - declarations: [DialogHeaderComponent], - }); - fixture = TestBed.createComponent(DialogHeaderComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.ts b/frontend/src/app/shared/custom/dialog-header/dialog-header.component.ts deleted file mode 100644 index 3808dc9bb7..0000000000 --- a/frontend/src/app/shared/custom/dialog-header/dialog-header.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component, Input } from '@angular/core'; - -@Component({ - selector: 'app-dialog-header', - templateUrl: './dialog-header.component.html', - styleUrls: ['./dialog-header.component.scss'], -}) -export class DialogHeaderComponent { - @Input() - dialogTitle!: string; -} diff --git a/frontend/src/app/callback/callback.component.css b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.cy.ts similarity index 100% rename from frontend/src/app/callback/callback.component.css rename to frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.cy.ts diff --git a/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.html b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.html new file mode 100644 index 0000000000..c74e127ca2 --- /dev/null +++ b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.html @@ -0,0 +1,35 @@ +
+
+
+

+ {{ title }} + +

+
+
+
+ + + + + +
+ +
+
+ + + +
+ + + + +
+
+ +
+
+
diff --git a/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.scss b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.scss new file mode 100644 index 0000000000..769a21b288 --- /dev/null +++ b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.scss @@ -0,0 +1,24 @@ +@import "custom_bootstrap"; + +mat-dialog-content { + //scrollbar-gutter: stable both-edges; + $dialog-header-height: 48px; + $full-dialog-content-height: calc( + 100vh - $top-bar-height - $dialog-header-height - $dialog-content-padding-y - $dialog-action-buttons-div-height + ); + @extend .d-flex; + @extend .flex-column; + @extend .flex-wrap; + @extend .container-fluid; + max-height: $full-dialog-content-height !important; + + @include media-breakpoint-down(sm) { + height: $full-dialog-content-height !important; + } +} + +mat-dialog-actions { + @extend .d-flex; + @extend .justify-content-between; + height: $dialog-action-buttons-div-height !important; +} 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 new file mode 100644 index 0000000000..95f651d3dd --- /dev/null +++ b/frontend/src/app/shared/custom/dialog-template-core/dialog-template-core.component.ts @@ -0,0 +1,22 @@ +import { Component, Input } from '@angular/core'; +import { Observable, of } from 'rxjs'; + +@Component({ + selector: 'app-dialog-template-core', + templateUrl: './dialog-template-core.component.html', + styleUrl: './dialog-template-core.component.scss', +}) +export class DialogTemplateCoreComponent { + @Input() observable: Observable = of({}); + @Input() title: string = ''; + + isValueReady(obj: any): boolean { + if (obj == null) { + return false; + } + if (Array.isArray(obj)) { + return obj.length > 0; + } + return true; + } +} diff --git a/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.html b/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.html index abd7776d79..92bb32f252 100644 --- a/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.html +++ b/frontend/src/app/shared/custom/okr-tangram/okr-tangram.component.html @@ -1 +1 @@ -okr-logo +okr-logo diff --git a/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.html b/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.html deleted file mode 100644 index b3d5fd8848..0000000000 --- a/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.html +++ /dev/null @@ -1,18 +0,0 @@ -
- -
- - - @if (data.dialogText) { -
- {{ this.data.dialogText }} -
- } -
- - - - - diff --git a/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.scss b/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.ts b/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.ts deleted file mode 100644 index c2a33fc611..0000000000 --- a/frontend/src/app/shared/dialog/cancel-dialog/cancel-dialog.component.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; - -export type CancelDialogData = { - dialogTitle: string; - dialogText?: string; -}; - -@Component({ - selector: 'app-cancel-dialog', - templateUrl: './cancel-dialog.component.html', - styleUrl: './cancel-dialog.component.scss', -}) -export class CancelDialogComponent { - constructor( - @Inject(MAT_DIALOG_DATA) public data: CancelDialogData, - private dialogRef: MatDialogRef, - ) {} - - closeAndConfirm() { - this.dialogRef.close(true); - } -} diff --git a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.html b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.html index 5a0cb5d688..e4eae92721 100644 --- a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.html +++ b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.html @@ -1,20 +1,18 @@ -
- -
- - -
-
-

Objective

-

{{ data.objectiveTitle }}

+ + +
+

Objective

+ +

{{ data.objectiveTitle }}

+
-
- -
-
+

Bewertung

+
+
-
+
+
-
- - - - {{ getErrorMessage("MAX_VALUE", "Kommentar", 4096) }} - +
+ +
+ + + {{ getErrorMessage("MAX_VALUE", "Kommentar", 4096) }} + +
-
- + - -
-
+ +
- +
-
- + + diff --git a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.scss b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.scss index 2244ba1bf0..f757130a0f 100644 --- a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.scss +++ b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.scss @@ -73,7 +73,3 @@ div:hover { @extend .card-shadow; background-color: #ba3838; } - -.dialog-content { - max-height: 30vh; -} diff --git a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.spec.ts b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.spec.ts index e949a38b9a..72ce7381c6 100644 --- a/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.spec.ts +++ b/frontend/src/app/shared/dialog/complete-dialog/complete-dialog.component.spec.ts @@ -2,10 +2,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CompleteDialogComponent } from './complete-dialog.component'; import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'; -import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header.component'; import { TranslateService } from '@ngx-translate/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatIconModule } from '@angular/material/icon'; +import { DialogTemplateCoreComponent } from '../../custom/dialog-template-core/dialog-template-core.component'; +import { MatDividerModule } from '@angular/material/divider'; +import { provideRouter } from '@angular/router'; +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; const dialogMock = { close: jest.fn(), @@ -21,12 +25,16 @@ let matDataMock: { objective: { objectiveId: number | undefined; teamId: number describe('CompleteDialogComponent', () => { let component: CompleteDialogComponent; let fixture: ComponentFixture; + let debugElement: any; beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormsModule, ReactiveFormsModule, MatDialogModule, MatIconModule], - declarations: [CompleteDialogComponent, DialogHeaderComponent], + imports: [FormsModule, ReactiveFormsModule, MatDialogModule, MatIconModule, MatDividerModule], + declarations: [CompleteDialogComponent, DialogTemplateCoreComponent], providers: [ + provideRouter([]), + provideHttpClient(), + provideHttpClientTesting(), { provide: MatDialogRef, useValue: dialogMock }, { provide: MAT_DIALOG_DATA, useValue: matDataMock }, { provide: TranslateService, useValue: {} }, @@ -35,6 +43,7 @@ describe('CompleteDialogComponent', () => { fixture = TestBed.createComponent(CompleteDialogComponent); component = fixture.componentInstance; fixture.detectChanges(); + debugElement = fixture.debugElement.nativeElement; }); it('should create', () => { @@ -45,7 +54,7 @@ describe('CompleteDialogComponent', () => { let elements = document.querySelectorAll('.valuation-card'); let successful = document.querySelectorAll('.card-hover-successful'); let notSuccessful = document.querySelectorAll('.card-hover-not-successful'); - let submitButton = document.querySelectorAll('button')[1]; + let submitButton = debugElement.querySelector('[data-testid="submit"]'); expect(elements.length).toEqual(2); expect(successful.length).toEqual(1); @@ -59,7 +68,7 @@ describe('CompleteDialogComponent', () => { it('should change isSuccessful value on card click and remove class card-hover', () => { component.switchSuccessState('successful'); let elements = document.querySelectorAll('.card-hover'); - let submitButton = document.querySelectorAll('button')[1]; + let submitButton = debugElement.querySelector('[data-testid="submit"]'); expect(component.completeForm.value.isSuccessful).toBeTruthy(); expect(component.completeForm.invalid).toBeFalsy(); diff --git a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.html b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.html index 60f6120ae7..c34a464c2b 100644 --- a/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.html +++ b/frontend/src/app/shared/dialog/confirm-dialog/confirm-dialog.component.html @@ -1,16 +1,23 @@ -
- -
+ + +
+ {{ this.dialogText.trim() }} +
+
- -
- {{ this.dialogText.trim() }} -
-
+ +
+ - - - - + +
+
+
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 7ed74ba54e..22c02998c8 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 @@ -11,9 +11,10 @@ import { MatInputModule } from '@angular/material/input'; import { MatRadioModule } from '@angular/material/radio'; import { ReactiveFormsModule } from '@angular/forms'; import { TranslateModule, TranslateService } from '@ngx-translate/core'; -import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header.component'; import { MatIconModule } from '@angular/material/icon'; import { ConfirmDialogData } from '../../../services/dialog.service'; +import { DialogTemplateCoreComponent } from '../../custom/dialog-template-core/dialog-template-core.component'; +import { MatDividerModule } from '@angular/material/divider'; const dialogRefMock = { close: jest.fn(), @@ -35,8 +36,9 @@ describe('ConfirmDialogComponent', () => { ReactiveFormsModule, TranslateModule.forRoot(), MatIconModule, + MatDividerModule, ], - declarations: [ConfirmDialogComponent, DialogHeaderComponent], + declarations: [ConfirmDialogComponent, DialogTemplateCoreComponent], providers: [ TranslateService, { provide: MAT_DIALOG_DATA, useValue: { title: '', text: '' } as ConfirmDialogData }, diff --git a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.html b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.html index 83957d9873..37a8bc048e 100644 --- a/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.html +++ b/frontend/src/app/shared/dialog/example-dialog/example-dialog.component.html @@ -1,50 +1,55 @@ -

This is an example dialog

- -
- - Name - -
- + + This is an example dialog + + + + + Name + +
+ + {{ errorMessages[errorKey.toUpperCase()] }} + +
+
+ + + Male + Female + Other + +
+ {{ errorMessages[errorKey.toUpperCase()] }}
- - - - Male - Female - Other - -
- - {{ errorMessages[errorKey.toUpperCase()] }} - -
- - Please select a hobby - - {{ hobby }} - - -
- - {{ errorMessages[errorKey.toUpperCase()] }} - -
+ + Please select a hobby + + {{ hobby }} + + +
+ + {{ errorMessages[errorKey.toUpperCase()] }} + +
+ +
- - + +
- - - + +
+
+
diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html index 742809d8f3..8479d497d8 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.html @@ -1,30 +1,9 @@ -
-
- -
-
- -
-
- - -
-
- - -
-
-
-
- + + + +
+ +