Skip to content
Snippets Groups Projects
Commit 97cd33da authored by OZGCloud's avatar OZGCloud
Browse files

Merge remote-tracking branch 'origin/master' into OZG-2943_Suche_Treffervoranzeige_loeschen

parents f7e75724 232d83b1
Branches
Tags
No related merge requests found
Showing
with 333 additions and 37 deletions
...@@ -13,6 +13,7 @@ pipeline { ...@@ -13,6 +13,7 @@ pipeline {
IMAGE_TAG = "" IMAGE_TAG = ""
VERSION = "" VERSION = ""
E2E_FAILED = "" E2E_FAILED = ""
HELM_CHART_VERSION = ""
} }
options { options {
...@@ -183,6 +184,28 @@ pipeline { ...@@ -183,6 +184,28 @@ pipeline {
} }
} }
} }
stage('Test, build and deploy Helm Chart') {
steps {
container('k8s') {
script {
FAILED_GOOFY_STAGE=env.STAGE_NAME
HELM_CHART_VERSION = generateHelmChartVersion()
dir('src/main/helm') {
sh "helm lint -f test-values.yaml"
sh "helm unittest -f '../../test/helm/*.yaml' ."
sh "helm package --version=${HELM_CHART_VERSION} ."
deployHelmChart(HELM_CHART_VERSION)
}
}
}
}
}
stage('Trigger Dev rollout') { stage('Trigger Dev rollout') {
when { when {
branch 'master' branch 'master'
...@@ -214,7 +237,7 @@ pipeline { ...@@ -214,7 +237,7 @@ pipeline {
def stageName = env.STAGE_NAME def stageName = env.STAGE_NAME
def bezeichner = generateBezeichner(stageName) def bezeichner = generateBezeichner(stageName)
startEnvironment(bezeichner, stageName, IMAGE_TAG, true) startEnvironment(bezeichner, stageName, IMAGE_TAG, true, HELM_CHART_VERSION)
def testResult = runTests(stageName, bezeichner, 'einheitlicher-ansprechpartner') def testResult = runTests(stageName, bezeichner, 'einheitlicher-ansprechpartner')
...@@ -242,7 +265,7 @@ pipeline { ...@@ -242,7 +265,7 @@ pipeline {
def stageName = env.STAGE_NAME def stageName = env.STAGE_NAME
def bezeichner = generateBezeichner(stageName) def bezeichner = generateBezeichner(stageName)
startEnvironment(bezeichner, stageName, IMAGE_TAG, false) startEnvironment(bezeichner, stageName, IMAGE_TAG, false, HELM_CHART_VERSION)
def testResult = runTests(stageName, bezeichner, 'main-tests') def testResult = runTests(stageName, bezeichner, 'main-tests')
...@@ -306,6 +329,34 @@ pipeline { ...@@ -306,6 +329,34 @@ pipeline {
} }
} }
Void deployHelmChart(String helmChartVersion) {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){
if (env.BRANCH_NAME == 'release') {
result = sh script: '''curl -u $USERNAME:$PASSWORD http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps -F file=@goofy-'''+helmChartVersion+'''.tgz''', returnStdout: true
}
else {
result = sh script: '''curl -u $USERNAME:$PASSWORD http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps-snapshot -F file=@goofy-'''+helmChartVersion+'''.tgz''', returnStdout: true
}
if (result != '') {
error(result)
}
}
}
String generateHelmChartVersion() {
def chartVersion = "${VERSION}"
if (env.BRANCH_NAME == 'master') {
chartVersion += "-${env.GIT_COMMIT.take(7)}"
}
else if (env.BRANCH_NAME != 'release') {
chartVersion += "-${env.BRANCH_NAME}"
}
return chartVersion
}
Void tagAndPushDockerImage(String newTag){ Void tagAndPushDockerImage(String newTag){
container("docker") { container("docker") {
withCredentials([usernamePassword(credentialsId: 'jenkins-docker-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'jenkins-docker-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
...@@ -327,8 +378,8 @@ String generateImageTag() { ...@@ -327,8 +378,8 @@ String generateImageTag() {
return imageTag return imageTag
} }
Void startEnvironment(String bezeichner, String stage, String imageTag, Boolean isEa) { Void startEnvironment(String bezeichner, String stage, String imageTag, Boolean isEa, String chartVersion) {
setupAnsible(imageTag, stage, isEa) setupAnsible(imageTag, stage, isEa, chartVersion)
try { try {
deleteKopStack(bezeichner, stage) deleteKopStack(bezeichner, stage)
...@@ -341,14 +392,14 @@ Void startEnvironment(String bezeichner, String stage, String imageTag, Boolean ...@@ -341,14 +392,14 @@ Void startEnvironment(String bezeichner, String stage, String imageTag, Boolean
addKeycloakUser(bezeichner, stage) addKeycloakUser(bezeichner, stage)
} }
Void setupAnsible(String imageTag, String stage, Boolean isEa) { Void setupAnsible(String imageTag, String stage, Boolean isEa, String chartVersion) {
checkoutProvisioningRepo(stage) checkoutProvisioningRepo(stage)
if (env.BRANCH_NAME == 'release') { if (env.BRANCH_NAME == 'release') {
copyTestEnvironmentToDev(stage) copyTestEnvironmentToDev(stage)
} }
editEnvironemntVersion(stage, imageTag, isEa) editEnvironemntVersion(stage, imageTag, isEa, chartVersion)
if (isEa) { if (isEa) {
setupEaEnvironment(stage) setupEaEnvironment(stage)
...@@ -400,7 +451,7 @@ Void copyTestEnvironmentToDev(stage) { ...@@ -400,7 +451,7 @@ Void copyTestEnvironmentToDev(stage) {
} }
} }
Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) { Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa, String chartVersion) {
dir("${stage}/provisioning") { dir("${stage}/provisioning") {
def editFile = "inventories/group_vars/dev/versions" def editFile = "inventories/group_vars/dev/versions"
...@@ -416,6 +467,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) { ...@@ -416,6 +467,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) {
devVersions.values.pluto.put('env', ['overrideSpringProfiles': overrideSpringProfiles]) devVersions.values.pluto.put('env', ['overrideSpringProfiles': overrideSpringProfiles])
devVersions.versions.goofy.image.tag = imageTag devVersions.versions.goofy.image.tag = imageTag
devVersions.charts.goofy.version = chartVersion
writeYaml file: editFile, data: devVersions, overwrite: true writeYaml file: editFile, data: devVersions, overwrite: true
} }
...@@ -743,6 +795,7 @@ Void setNewGoofyProvisioningVersion(String environment) { ...@@ -743,6 +795,7 @@ Void setNewGoofyProvisioningVersion(String environment) {
def envVersions = readYaml file: envFile def envVersions = readYaml file: envFile
envVersions.versions.goofy.image.tag = IMAGE_TAG envVersions.versions.goofy.image.tag = IMAGE_TAG
envVersions.charts.goofy.version = HELM_CHART_VERSION
writeYaml file: envFile, data: envVersions, overwrite: true writeYaml file: envFile, data: envVersions, overwrite: true
} }
......
...@@ -128,6 +128,8 @@ describe('Historie', () => { ...@@ -128,6 +128,8 @@ describe('Historie', () => {
createdAt: { $date: '2020-01-01T10:08:00.000Z' } createdAt: { $date: '2020-01-01T10:08:00.000Z' }
}; };
const resendPostfachNachricht: CommandE2E = buildCommand(CommandOrderE2E.RESEND_POSTFACH_NACHRICHT, vorgang._id.$oid, vorgang._id.$oid);
const createWiedervorlageCommandBody = { ...createWiedervorlageItem('Create Wiedervorlage Betreff'), attachments: 'DummyAttachment' }; const createWiedervorlageCommandBody = { ...createWiedervorlageItem('Create Wiedervorlage Betreff'), attachments: 'DummyAttachment' };
const createWiedervorlageCommand: CommandE2E = { const createWiedervorlageCommand: CommandE2E = {
...buildCommand(CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid), ...buildCommand(CommandOrderE2E.CREATE_ATTACHED_ITEM, vorgang._id.$oid, vorgang._id.$oid),
...@@ -157,7 +159,7 @@ describe('Historie', () => { ...@@ -157,7 +159,7 @@ describe('Historie', () => {
assignUserCommand, assignUserCommand,
createKommentarCommand, editKommentarCommand, createKommentarCommand, editKommentarCommand,
forwardVorgangCommand, forwardSuccessfulCommand, forwardFailedCommand, forwardVorgangCommand, forwardSuccessfulCommand, forwardFailedCommand,
sendPostfachMailCommand, sendPostfachNachrichtCommand, receivePostfachNachrichtCommand, sendPostfachMailCommand, sendPostfachNachrichtCommand, receivePostfachNachrichtCommand, resendPostfachNachricht,
createWiedervorlageCommand, editWiedervorlageCommand, wiedervorlageErledigenCommand, wiedervorlageWiedereroeffnenCommand createWiedervorlageCommand, editWiedervorlageCommand, wiedervorlageErledigenCommand, wiedervorlageWiedereroeffnenCommand
]); ]);
initUsermanagerUsers([getUserManagerUserSabine(), getUserManagerUserPeter(), getUserManagerUserEmil()]); initUsermanagerUsers([getUserManagerUserSabine(), getUserManagerUserPeter(), getUserManagerUserEmil()]);
...@@ -315,12 +317,20 @@ describe('Historie', () => { ...@@ -315,12 +317,20 @@ describe('Historie', () => {
contains(postfachNachtichtItem.getPostfachNachrichtSubject(), receivePostfachNachrichtCommand.bodyObject.item.subject); contains(postfachNachtichtItem.getPostfachNachrichtSubject(), receivePostfachNachrichtCommand.bodyObject.item.subject);
contains(postfachNachtichtItem.getPostfachNachrichtMailBody(), receivePostfachNachrichtCommand.bodyObject.item.mailBody); contains(postfachNachtichtItem.getPostfachNachrichtMailBody(), receivePostfachNachrichtCommand.bodyObject.item.mailBody);
}) })
it('resend postfach nachricht', () => {
const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(9);
exist(historieItem.getRoot());
contains(historieItem.getHeadline(), HistorieHeadlineE2E.RESEND_POSTFACH_NACHRICHT);
contains(historieItem.getUser(), userName);
})
}) })
describe('wiedervorlage order', () => { describe('wiedervorlage order', () => {
it('create wiedervorlage', () => { it('create wiedervorlage', () => {
const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(9); const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(10);
exist(historieItem.getRoot()); exist(historieItem.getRoot());
contains(historieItem.getHeadline(), HistorieHeadlineE2E.CREATE_WIEDERVORLAGE); contains(historieItem.getHeadline(), HistorieHeadlineE2E.CREATE_WIEDERVORLAGE);
...@@ -336,7 +346,7 @@ describe('Historie', () => { ...@@ -336,7 +346,7 @@ describe('Historie', () => {
}) })
it('edit wiedervorlage', () => { it('edit wiedervorlage', () => {
const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(10); const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(11);
exist(historieItem.getRoot()); exist(historieItem.getRoot());
contains(historieItem.getHeadline(), HistorieHeadlineE2E.EDIT_WIEDERVORLAGE); contains(historieItem.getHeadline(), HistorieHeadlineE2E.EDIT_WIEDERVORLAGE);
...@@ -352,7 +362,7 @@ describe('Historie', () => { ...@@ -352,7 +362,7 @@ describe('Historie', () => {
}) })
it('wiedervorlage erledigen', () => { it('wiedervorlage erledigen', () => {
const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(11); const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(12);
exist(historieItem.getRoot()); exist(historieItem.getRoot());
contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_ERLEDIGEN); contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_ERLEDIGEN);
...@@ -361,7 +371,7 @@ describe('Historie', () => { ...@@ -361,7 +371,7 @@ describe('Historie', () => {
}) })
it('wiedervorlage wiedereroeffnen', () => { it('wiedervorlage wiedereroeffnen', () => {
const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(12); const historieItem: VorgangFormularDatenHistorieItemE2EComponent = vorgangDatenFormular.getHistorieContainer().getListItemByIndex(13);
exist(historieItem.getRoot()); exist(historieItem.getRoot());
contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_WIEDEREROEFFNEN); contains(historieItem.getHeadline(), HistorieHeadlineE2E.WIEDERVORLAGE_WIEDEREROEFFNEN);
......
...@@ -257,4 +257,34 @@ describe('Wiedervorlage attachments', () => { ...@@ -257,4 +257,34 @@ describe('Wiedervorlage attachments', () => {
haveLength(attachmentList.getRoot(), 1); haveLength(attachmentList.getRoot(), 1);
}) })
}) })
describe.skip('OZG-3070 delete last attachment', () => {
it('should remove on delete', () => {
attachmentList.getItem(TEST_FILE_WITH_CONTENT).getDeleteButton().click();
waitForSpinnerToDisappear();
notExist(attachmentList.getItem(TEST_FILE_WITH_CONTENT).getRoot());
})
it('should show snackbar on save', () => {
wiedervorlageContainer.getSpeichernButton().click();
waitForSpinnerToDisappear();
exist(snackbar.getMessage());
contains(snackbar.getMessage(), `Die Wiedervorlage "${WIEDERVORLAGE_WITH_ATTACHMENTS_BETREFF}" wurde gespeichert`);
snackbar.getCloseButton().click();
waitForSpinnerToDisappear();
})
it('should have no attachments after save', () => {
const wiedervorlageComp: WiedervorlageInVorgangE2EComponent = wiedervorlageContainerInVorgang.getWiedervorlage(WIEDERVORLAGE_WITH_ATTACHMENTS_BETREFF);
wiedervorlageComp.getExpandButton();
wiedervorlageComp.expandItem();
notExist(wiedervorlageComp.getAttachmentContainer().getList().getItem(TEST_FILE_WITHOUT_CONTENT).getRoot());
notExist(wiedervorlageComp.getAttachmentContainer().getList().getItem(TEST_FILE_WITH_CONTENT).getRoot());
})
})
}) })
\ No newline at end of file
...@@ -215,4 +215,55 @@ describe('Wiedervorlage', () => { ...@@ -215,4 +215,55 @@ describe('Wiedervorlage', () => {
notExist(wiedervorlageInVorgang.getRoot()); notExist(wiedervorlageInVorgang.getRoot());
}) })
}) })
describe.skip('OZG-3070 remove beschreibung from wiedervoralge', () => {
it('should open Wiedervorlage-Page by click on wiedervorlage ', () => {
const wiedervorlageInVorgang: WiedervorlageInVorgangE2EComponent = vorgangPage.getWiedervorlagenContainer().getWiedervorlage('Editierter Betreff');
wiedervorlageInVorgang.getLink().click();
waitForSpinnerToDisappear();
exist(wiedervorlagePage.getSubnavigation().getRoot());
})
it('should have beschreibung', () => {
haveValue(wiedervorlageCotainer.getBeschreibung(), 'Diese Wiedervorlage wurde bearbeitet');
})
it('should show snackbar after clear beschreibung', () => {
wiedervorlageCotainer.getBeschreibung().clear();
wiedervorlageCotainer.getSpeichernButton().click();
waitForSpinnerToDisappear();
exist(snackbar.getMessage());
haveText(snackbar.getMessage(), MessagesE2E.WIEDERVORLAGE_GESPEICHERT.replace('%s', 'Editierter Betreff'));
})
it('should close snackbar on click on close button', () => {
snackbar.getCloseButton().click();
notExist(snackbar.getMessage());
})
it('should navigate after click on "Speichern"', () => {
exist(vorgangPage.getVorgangDetailHeader().getRoot());
})
it('should navigate to formular', () => {
const wiedervorlageInVorgang: WiedervorlageInVorgangE2EComponent = vorgangPage.getWiedervorlagenContainer().getWiedervorlage(wiedervorlageBetreff);
wiedervorlageInVorgang.getLink().click();
waitForSpinnerToDisappear();
exist(wiedervorlagePage.getSubnavigation().getRoot());
})
it('should show empty beschreibung', () => {
wiedervorlageCotainer.getBeschreibung().clear().type('Editierter Betreff');
haveText(wiedervorlageCotainer.getBeschreibung(), '');
})
})
}); });
...@@ -31,9 +31,10 @@ export enum CommandOrderE2E { ...@@ -31,9 +31,10 @@ export enum CommandOrderE2E {
FORWARD_SUCCESSFUL = 'FORWARD_SUCCESSFULL', //TODO Rename Order FORWARD_SUCCESSFUL = 'FORWARD_SUCCESSFULL', //TODO Rename Order
FORWARD_FAILED = 'FORWARD_FAILED', FORWARD_FAILED = 'FORWARD_FAILED',
PATCH_ATTACHED_ITEM = 'PATCH_ATTACHED_ITEM', PATCH_ATTACHED_ITEM = 'PATCH_ATTACHED_ITEM',
RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT',
RESEND_POSTFACH_NACHRICHT = 'RESEND_POSTFACH_MAIL',
SEND_POSTFACH_MAIL = 'SEND_POSTFACH_MAIL', SEND_POSTFACH_MAIL = 'SEND_POSTFACH_MAIL',
SEND_POSTFACH_NACHRICHT = 'SEND_POSTFACH_NACHRICHT', SEND_POSTFACH_NACHRICHT = 'SEND_POSTFACH_NACHRICHT',
RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT',
UPDATE_ATTACHED_ITEM = 'UPDATE_ATTACHED_ITEM' UPDATE_ATTACHED_ITEM = 'UPDATE_ATTACHED_ITEM'
} }
export class CommandE2E { export class CommandE2E {
......
...@@ -35,6 +35,7 @@ export enum HistorieHeadlineE2E { ...@@ -35,6 +35,7 @@ export enum HistorieHeadlineE2E {
FORWARD_FAILED = 'die Weiterleitung widerrufen.', FORWARD_FAILED = 'die Weiterleitung widerrufen.',
SEND_POSTFACH_NACHRICHT = 'eine Nachricht geschrieben', SEND_POSTFACH_NACHRICHT = 'eine Nachricht geschrieben',
RECEIVE_POSTFACH_NACHRICHT = 'eine Nachricht des Antragstellers empfangen.', RECEIVE_POSTFACH_NACHRICHT = 'eine Nachricht des Antragstellers empfangen.',
RESEND_POSTFACH_NACHRICHT = 'eine Nachricht erneut versendet.',
WIEDERVORLAGE_ERLEDIGEN = 'eine Wiedervorlage als erledigt markiert.', WIEDERVORLAGE_ERLEDIGEN = 'eine Wiedervorlage als erledigt markiert.',
WIEDERVORLAGE_WIEDEREROEFFNEN = 'eine Wiedervorlage als offen markiert.', WIEDERVORLAGE_WIEDEREROEFFNEN = 'eine Wiedervorlage als offen markiert.',
} }
......
...@@ -26,10 +26,10 @@ import { Injectable } from '@angular/core'; ...@@ -26,10 +26,10 @@ import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Actions, createEffect, ofType } from '@ngrx/effects';
import { mergeMap, switchMap, tap } from 'rxjs/operators'; import { mergeMap, switchMap, tap } from 'rxjs/operators';
import { BinaryFileRepository } from '../binary-file.repository'; import { BinaryFileRepository } from '../binary-file.repository';
import { DownloadBinaryFileAsPdfAction, SaveBinaryFileAsPdfAction } from './binary-file.actions';
import * as saveAs from 'file-saver'; import * as saveAs from 'file-saver';
import * as BinaryFileActions from './binary-file.actions'; import * as BinaryFileActions from './binary-file.actions';
import { DownloadBinaryFileAsPdfAction, SaveBinaryFileAsPdfAction } from './binary-file.actions';
@Injectable() @Injectable()
export class BinaryFileEffects { export class BinaryFileEffects {
......
...@@ -64,6 +64,7 @@ export enum CommandOrder { ...@@ -64,6 +64,7 @@ export enum CommandOrder {
FORWARD_SUCCESSFULL = 'FORWARD_SUCCESSFULL', FORWARD_SUCCESSFULL = 'FORWARD_SUCCESSFULL',
SEND_POSTFACH_NACHRICHT = 'SEND_POSTFACH_NACHRICHT', SEND_POSTFACH_NACHRICHT = 'SEND_POSTFACH_NACHRICHT',
RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT', RECEIVE_POSTFACH_NACHRICHT = 'RECEIVE_POSTFACH_NACHRICHT',
RESEND_POSTFACH_NACHRICHT = 'RESEND_POSTFACH_MAIL',
WIEDERVORLAGE_ERLEDIGEN = 'WIEDERVORLAGE_ERLEDIGEN', WIEDERVORLAGE_ERLEDIGEN = 'WIEDERVORLAGE_ERLEDIGEN',
WIEDERVORLAGE_WIEDEREROEFFNEN = 'WIEDERVORLAGE_WIEDEREROEFFNEN', WIEDERVORLAGE_WIEDEREROEFFNEN = 'WIEDERVORLAGE_WIEDEREROEFFNEN',
VORGANG_ANNEHMEN = 'VORGANG_ANNEHMEN', VORGANG_ANNEHMEN = 'VORGANG_ANNEHMEN',
...@@ -96,6 +97,7 @@ export const ORDER_TYPE_BY_COMMAND_ORDER = { ...@@ -96,6 +97,7 @@ export const ORDER_TYPE_BY_COMMAND_ORDER = {
[CommandOrder.FORWARD_SUCCESSFULL]: CommandOrderType.FORWARDING, [CommandOrder.FORWARD_SUCCESSFULL]: CommandOrderType.FORWARDING,
[CommandOrder.SEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT, [CommandOrder.SEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT, [CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.RESEND_POSTFACH_NACHRICHT]: CommandOrderType.POSTFACH_NACHRICHT,
[CommandOrder.WIEDERVORLAGE_ERLEDIGEN]: CommandOrderType.WIEDERVORLAGE, [CommandOrder.WIEDERVORLAGE_ERLEDIGEN]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.WIEDERVORLAGE_WIEDEREROEFFNEN]: CommandOrderType.WIEDERVORLAGE, [CommandOrder.WIEDERVORLAGE_WIEDEREROEFFNEN]: CommandOrderType.WIEDERVORLAGE,
[CommandOrder.VORGANG_ANNEHMEN]: CommandOrderType.VORGANG, [CommandOrder.VORGANG_ANNEHMEN]: CommandOrderType.VORGANG,
......
...@@ -23,8 +23,14 @@ ...@@ -23,8 +23,14 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<goofy-client-expansion-panel-with-user [headline]="headline" [resource]="command" data-test-id="historie-item-wiedervorlage-user-expansion-panel"> <goofy-client-expansion-panel-with-user *ngIf="postfachNachricht; else headlineOnly" [headline]="headline" [resource]="command" data-test-class="historie-item-postfach-nachricht-user-expansion-panel-with-body">
<p data-test-class="postfach-nachricht-subject" class="subject">{{postfachNachricht.subject}}</p> <p data-test-class="postfach-nachricht-subject" class="subject">{{postfachNachricht.subject}}</p>
<p data-test-class="postfach-nachricht-mail-body">{{postfachNachricht.mailBody}}</p> <p data-test-class="postfach-nachricht-mail-body">{{postfachNachricht.mailBody}}</p>
<goofy-client-historie-item-attachment *ngIf="postfachNachricht.attachments" [attachments]="postfachNachricht.attachments" data-test-id="historie-item-postfach-nachricht-attachment"></goofy-client-historie-item-attachment> <goofy-client-historie-item-attachment *ngIf="postfachNachricht.attachments" [attachments]="postfachNachricht.attachments" data-test-class="historie-item-postfach-nachricht-attachment"></goofy-client-historie-item-attachment>
</goofy-client-expansion-panel-with-user> </goofy-client-expansion-panel-with-user>
<ng-template #headlineOnly>
<div class="mat-expansion-panel">
<goofy-client-historie-item-header [resource]="command" [headline]="headline" data-test-class="historie-item-postfach-nachricht-user-expansion-panel"></goofy-client-historie-item-header>
</div>
</ng-template>
\ No newline at end of file
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen * Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
@import 'expansion-panel';
.subject { .subject {
font-weight: bold font-weight: bold
} }
\ No newline at end of file
...@@ -27,11 +27,12 @@ import { CommandOrder, CommandResource } from '@goofy-client/command-shared'; ...@@ -27,11 +27,12 @@ import { CommandOrder, CommandResource } from '@goofy-client/command-shared';
import { PostfachMail } from '@goofy-client/postfach-shared'; import { PostfachMail } from '@goofy-client/postfach-shared';
import { getElementFromFixture } from '@goofy-client/test-utils'; import { getElementFromFixture } from '@goofy-client/test-utils';
import { createCommandResource } from 'libs/command-shared/test/command'; import { createCommandResource } from 'libs/command-shared/test/command';
import { createPostfachMail } from 'libs/postfach-shared/test/postfach'; import { createPostfachMail, createPostfachMailResource } from 'libs/postfach-shared/test/postfach';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { getDataTestClassOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { ExpansionPanelWithUserComponent } from '../expansion-panel-with-user/expansion-panel-with-user.component'; import { ExpansionPanelWithUserComponent } from '../expansion-panel-with-user/expansion-panel-with-user.component';
import { HistorieItemAttachmentComponent } from '../historie-item-attachment/historie-item-attachment.component'; import { HistorieItemAttachmentComponent } from '../historie-item-attachment/historie-item-attachment.component';
import { HistorieItemHeaderComponent } from '../historie-item-header/historie-item-header.component';
import { HistorieItemPostfachNachrichtComponent } from './historie-item-postfach-nachricht.component'; import { HistorieItemPostfachNachrichtComponent } from './historie-item-postfach-nachricht.component';
describe('HistorieItemPostfachNachrichtComponent', () => { describe('HistorieItemPostfachNachrichtComponent', () => {
...@@ -41,14 +42,17 @@ describe('HistorieItemPostfachNachrichtComponent', () => { ...@@ -41,14 +42,17 @@ describe('HistorieItemPostfachNachrichtComponent', () => {
const item: PostfachMail = createPostfachMail(); const item: PostfachMail = createPostfachMail();
const postfachNachrichtCommand: CommandResource = { ...createCommandResource(), body: { item: item } }; const postfachNachrichtCommand: CommandResource = { ...createCommandResource(), body: { item: item } };
const attachment: string = getDataTestIdOf('historie-item-postfach-nachricht-attachment'); const attachment: string = getDataTestClassOf('historie-item-postfach-nachricht-attachment');
const expansionPanel: string = getDataTestClassOf('historie-item-postfach-nachricht-user-expansion-panel');
const mailBody: string = getDataTestClassOf('postfach-nachricht-mail-body');
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [ declarations: [
HistorieItemPostfachNachrichtComponent, HistorieItemPostfachNachrichtComponent,
MockComponent(ExpansionPanelWithUserComponent), MockComponent(ExpansionPanelWithUserComponent),
MockComponent(HistorieItemAttachmentComponent) MockComponent(HistorieItemAttachmentComponent),
MockComponent(HistorieItemHeaderComponent)
], ],
}).compileComponents(); }).compileComponents();
}); });
...@@ -136,4 +140,45 @@ describe('HistorieItemPostfachNachrichtComponent', () => { ...@@ -136,4 +140,45 @@ describe('HistorieItemPostfachNachrichtComponent', () => {
expect(attachmentElement).toBeInstanceOf(HTMLElement); expect(attachmentElement).toBeInstanceOf(HTMLElement);
}) })
}) })
describe('postfach nachricht body exists', () => {
beforeEach(() => {
component.postfachNachricht = createPostfachMailResource();
fixture.detectChanges();
})
it('should show postfach nachricht with body', () => {
const element = getElementFromFixture(fixture, mailBody);
expect(element).toBeInstanceOf(HTMLElement);
})
it('should hide postfach nachricht', () => {
const element = getElementFromFixture(fixture, expansionPanel);
expect(element).not.toBeInstanceOf(HTMLElement);
})
})
describe('postfach nachricht body not exists', () => {
beforeEach(() => {
component.postfachNachricht = undefined;
fixture.detectChanges();
})
it('should show postfach nachricht', () => {
const element = getElementFromFixture(fixture, expansionPanel);
expect(element).toBeInstanceOf(HTMLElement);
})
it('should hide postfach nachricht with body', () => {
const element = getElementFromFixture(fixture, mailBody);
expect(element).not.toBeInstanceOf(HTMLElement);
})
})
}); });
...@@ -54,4 +54,5 @@ export class HistorieItemPostfachNachrichtComponent { ...@@ -54,4 +54,5 @@ export class HistorieItemPostfachNachrichtComponent {
const HISTORIE_TEXT_BY_POSTFACH_NACHRICHT_ORDER: { [order: string]: string } = { const HISTORIE_TEXT_BY_POSTFACH_NACHRICHT_ORDER: { [order: string]: string } = {
[CommandOrder.SEND_POSTFACH_NACHRICHT]: 'eine Nachricht geschrieben.', [CommandOrder.SEND_POSTFACH_NACHRICHT]: 'eine Nachricht geschrieben.',
[CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: 'eine Nachricht des Antragstellers empfangen.', [CommandOrder.RECEIVE_POSTFACH_NACHRICHT]: 'eine Nachricht des Antragstellers empfangen.',
[CommandOrder.RESEND_POSTFACH_NACHRICHT]: 'eine Nachricht erneut versendet.'
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<button mat-icon-button [matMenuTriggerFor]="accountMenu" class="big-button" aria-label="Benutzerkonto" data-test-id="user-icon-button"> <button mat-icon-button [matMenuTriggerFor]="accountMenu" class="big-button" data-test-id="user-icon-button">
<goofy-client-user-icon [userProfileStateResource]="currentUserResource"></goofy-client-user-icon> <goofy-client-user-icon [userProfileStateResource]="currentUserResource"></goofy-client-user-icon>
</button> </button>
......
...@@ -32,6 +32,8 @@ import { UserProfileResource } from '@goofy-client/user-profile-shared'; ...@@ -32,6 +32,8 @@ import { UserProfileResource } from '@goofy-client/user-profile-shared';
styleUrls: ['./user-profile-in-header.component.scss'], styleUrls: ['./user-profile-in-header.component.scss'],
}) })
export class UserProfileInHeaderComponent { export class UserProfileInHeaderComponent {
@Output() public logoutEmitter: EventEmitter<void> = new EventEmitter<void>()
@Input() public currentUserResource: StateResource<UserProfileResource>; @Input() public currentUserResource: StateResource<UserProfileResource>;
@Output() public logoutEmitter: EventEmitter<void> = new EventEmitter<void>()
} }
...@@ -28,10 +28,10 @@ import { ApiError, ApiErrorAction, formatFullDateWithoutSeperator } from '@goofy ...@@ -28,10 +28,10 @@ import { ApiError, ApiErrorAction, formatFullDateWithoutSeperator } from '@goofy
import { VorgangHeaderLinkRel, VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; import { VorgangHeaderLinkRel, VorgangWithEingangResource } from '@goofy-client/vorgang-shared';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { TypedAction } from '@ngrx/store/src/models'; import { TypedAction } from '@ngrx/store/src/models';
import { getUrl } from '@ngxp/rest';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import * as BinaryFileActions from '@goofy-client/binary-file-shared'; import * as BinaryFileActions from '@goofy-client/binary-file-shared';
import { getUrl } from '@ngxp/rest';
import * as PostfachActions from './postfach.actions'; import * as PostfachActions from './postfach.actions';
import * as PostfachSelectors from './postfach.selectors'; import * as PostfachSelectors from './postfach.selectors';
......
...@@ -62,3 +62,9 @@ export interface CreatePostfachMailCommand extends CreateCommand { ...@@ -62,3 +62,9 @@ export interface CreatePostfachMailCommand extends CreateCommand {
export interface PostfachMailResource extends Resource, PostfachMail { } export interface PostfachMailResource extends Resource, PostfachMail { }
export interface PostfachMailListResource extends ListResource { } export interface PostfachMailListResource extends ListResource { }
export enum PostfachNachrichtenCount {
NONE,
SINGLE,
MULTIPLE
}
\ No newline at end of file
...@@ -22,11 +22,12 @@ ...@@ -22,11 +22,12 @@
/// unter der Lizenz sind dem Lizenztext zu entnehmen. /// unter der Lizenz sind dem Lizenztext zu entnehmen.
/// ///
import { createPostfachMail, createPostfachMailResource } from 'libs/postfach-shared/test/postfach'; import { createPostfachMail, createPostfachMailListResource, createPostfachMailResource } from 'libs/postfach-shared/test/postfach';
import { Direction, getMessageCodeMessage, isIncomingMail } from '..'; import { toResource } from 'libs/tech-shared/test/resource';
import { PostfachMailListLinkRel } from './postfach.linkrel';
import { PostfachNachrichtMessageCode } from './postfach.message-code'; import { PostfachNachrichtMessageCode } from './postfach.message-code';
import { CreatePostfachMailCommand, PostfachMail, PostfachOrder } from './postfach.model'; import { CreatePostfachMailCommand, Direction, PostfachMail, PostfachMailListResource, PostfachMailResource, PostfachNachrichtenCount, PostfachOrder } from './postfach.model';
import { createResendPostfachMailCommand, createSendPostfachMailCommand } from './postfach.util'; import { createResendPostfachMailCommand, createSendPostfachMailCommand, getMessageCodeMessage, getPostfachNachrichtenCount, isIncomingMail } from './postfach.util';
describe('PostfachUtil', () => { describe('PostfachUtil', () => {
...@@ -91,4 +92,60 @@ describe('PostfachUtil', () => { ...@@ -91,4 +92,60 @@ describe('PostfachUtil', () => {
expect(result).toEqual('Fehlerhafte Verarbeitung: Die Nachricht wurde an das Osi-Postfach geschickt, konnte dort aber nicht richtig verarbeitet werden.'); expect(result).toEqual('Fehlerhafte Verarbeitung: Die Nachricht wurde an das Osi-Postfach geschickt, konnte dort aber nicht richtig verarbeitet werden.');
}) })
}) })
describe('getPostfacNachrichtenCount', () => {
describe('return NONE', () => {
it('on null listResource', () => {
var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(null);
expect(count).toBe(PostfachNachrichtenCount.NONE);
})
it('on undefined listResource', () => {
var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(undefined);
expect(count).toBe(PostfachNachrichtenCount.NONE);
})
it('should return NONE on empty resource list', () => {
var listResource: PostfachMailListResource = createListResource([]);
var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(listResource);
expect(count).toBe(PostfachNachrichtenCount.NONE);
})
it('should return NONE on non existing resources', () => {
var listResource: PostfachMailListResource = toResource({}, [], {});
var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(listResource);
expect(count).toBe(PostfachNachrichtenCount.NONE);
})
})
it('should return SINGLE on one existing resources', () => {
var listResource: PostfachMailListResource = createListResource([createPostfachMailResource()]);
var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(listResource);
expect(count).toBe(PostfachNachrichtenCount.SINGLE);
})
it('should return MULTIPLE on multiple existing resources', () => {
var listResource: PostfachMailListResource = createPostfachMailListResource();
var count: PostfachNachrichtenCount = getPostfachNachrichtenCount(listResource);
expect(count).toBe(PostfachNachrichtenCount.MULTIPLE);
})
function createListResource(postfachMailResources: PostfachMailResource[]): PostfachMailListResource {
return toResource({}, [], {
[PostfachMailListLinkRel.POSTFACH_MAIL_LIST]: postfachMailResources
});
}
})
}) })
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
/// unter der Lizenz sind dem Lizenztext zu entnehmen. /// unter der Lizenz sind dem Lizenztext zu entnehmen.
/// ///
import { getEmbeddedResource } from '@ngxp/rest';
import { isNil } from 'lodash-es';
import { PostfachMailListLinkRel } from './postfach.linkrel';
import { postfachNachrichtMessageCodeMessages } from './postfach.message-code'; import { postfachNachrichtMessageCodeMessages } from './postfach.message-code';
import { CreatePostfachMailCommand, Direction, PostfachMail, PostfachMailResource, PostfachOrder } from './postfach.model'; import { CreatePostfachMailCommand, Direction, PostfachMail, PostfachMailListResource, PostfachMailResource, PostfachNachrichtenCount, PostfachOrder } from './postfach.model';
export function createSendPostfachMailCommand(postfachMail: PostfachMail): CreatePostfachMailCommand { export function createSendPostfachMailCommand(postfachMail: PostfachMail): CreatePostfachMailCommand {
return { order: PostfachOrder.SEND_POSTFACH_NACHRICHT, body: postfachMail }; return { order: PostfachOrder.SEND_POSTFACH_NACHRICHT, body: postfachMail };
...@@ -40,3 +43,20 @@ export function isIncomingMail(postfachMail: PostfachMailResource): boolean { ...@@ -40,3 +43,20 @@ export function isIncomingMail(postfachMail: PostfachMailResource): boolean {
export function getMessageCodeMessage(postfachMail: PostfachMailResource): string { export function getMessageCodeMessage(postfachMail: PostfachMailResource): string {
return postfachNachrichtMessageCodeMessages[postfachMail.messageCode]; return postfachNachrichtMessageCodeMessages[postfachMail.messageCode];
} }
export function getPostfachNachrichtenCount(postfachMailListResource: PostfachMailListResource): PostfachNachrichtenCount {
if (isNil(postfachMailListResource)) {
return PostfachNachrichtenCount.NONE;
}
const resources: PostfachMailResource[] = getEmbeddedResource<PostfachMailResource[]>(postfachMailListResource, PostfachMailListLinkRel.POSTFACH_MAIL_LIST);
if (isNil(resources) || resources.length == 0) {
return PostfachNachrichtenCount.NONE;
}
if (resources.length == 1) {
return PostfachNachrichtenCount.SINGLE;
}
if (resources.length > 1) {
return PostfachNachrichtenCount.MULTIPLE;
}
}
\ No newline at end of file
...@@ -23,11 +23,13 @@ ...@@ -23,11 +23,13 @@
unter der Lizenz sind dem Lizenztext zu entnehmen. unter der Lizenz sind dem Lizenztext zu entnehmen.
--> -->
<div class="nachrichten-header">
<h3 class="nachrichten">Nachrichten</h3> <h3 class="nachrichten">Nachrichten</h3>
<goofy-client-postfach-mail-pdf-button-container [postfachMailListResource]="postfachMailListStateResource.resource"></goofy-client-postfach-mail-pdf-button-container>
<goofy-client-postfach-mail-pdf-button-container *ngIf="vorgang | hasLink: vorgangHeaderLinkRel.POSTFACH_MAILS" data-test-id="postfach-pdf-button"></goofy-client-postfach-mail-pdf-button-container> </div>
<goofy-client-spinner [stateResource]="postfachMailListStateResource"> <goofy-client-spinner [stateResource]="postfachMailListStateResource">
<goofy-client-postfach-mail *ngFor="let postfachMail of postfachMailListStateResource.resource | toEmbeddedResources: postfachMailListLinkRel.POSTFACH_MAIL_LIST" <goofy-client-postfach-mail *ngFor="let postfachMail of postfachMailListStateResource.resource | toEmbeddedResources: postfachMailListLinkRel.POSTFACH_MAIL_LIST"
class="postfach" class="postfach"
[postfachMail]="postfachMail" [postfachMail]="postfachMail"
......
...@@ -54,5 +54,12 @@ h3 { ...@@ -54,5 +54,12 @@ h3 {
.nachrichten { .nachrichten {
border-top: 1px solid rgba(0, 0, 0, 0.08); border-top: 1px solid rgba(0, 0, 0, 0.08);
margin-top: 16px; margin-top: 16px;
}
.nachrichten-header {
padding-top: 16px; padding-top: 16px;
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment