diff --git a/projects/dsp-ui/src/lib/action/components/message/message.component.scss b/projects/dsp-ui/src/lib/action/components/message/message.component.scss
index f127a54e0..75e3d1cba 100644
--- a/projects/dsp-ui/src/lib/action/components/message/message.component.scss
+++ b/projects/dsp-ui/src/lib/action/components/message/message.component.scss
@@ -73,6 +73,15 @@ $warn: rgb(244, 67, 54);
.message-footnote {
padding: 24px;
+
+ .bolder {
+ font-weight: bolder;
+ }
+
+ .action {
+ margin: 48px auto 0 auto;
+ display: table;
+ }
}
}
diff --git a/projects/dsp-ui/src/lib/action/components/message/message.component.spec.ts b/projects/dsp-ui/src/lib/action/components/message/message.component.spec.ts
index ef8eb8e0b..0f41f39b7 100644
--- a/projects/dsp-ui/src/lib/action/components/message/message.component.spec.ts
+++ b/projects/dsp-ui/src/lib/action/components/message/message.component.spec.ts
@@ -13,7 +13,7 @@ import { DspMessageData, MessageComponent } from './message.component';
* Test host component to simulate parent component.
*/
@Component({
- template: `
`
+ template: `
`
})
class ShortMessageTestHostComponent implements OnInit {
@@ -27,7 +27,7 @@ class ShortMessageTestHostComponent implements OnInit {
footnote: 'Close it'
};
- short = true;
+ size = 'short';
constructor() {
}
@@ -39,7 +39,7 @@ class ShortMessageTestHostComponent implements OnInit {
* Test host component to simulate parent component.
*/
@Component({
- template: `
`
+ template: `
`
})
class LongMessageTestHostComponent implements OnInit {
@@ -52,8 +52,6 @@ class LongMessageTestHostComponent implements OnInit {
error: 'error message'
};
- short = false;
-
constructor() {
}
@@ -64,7 +62,7 @@ class LongMessageTestHostComponent implements OnInit {
* Test host component to simulate parent component.
*/
@Component({
- template: `
`
+ template: `
`
})
class ShortMessageWithDurationTestHostComponent implements OnInit {
@@ -78,7 +76,7 @@ class ShortMessageWithDurationTestHostComponent implements OnInit {
footnote: 'Close it'
};
- short = true;
+ size = 'short';
constructor() {
}
diff --git a/projects/dsp-ui/src/lib/action/components/message/message.component.ts b/projects/dsp-ui/src/lib/action/components/message/message.component.ts
index 49a0e2ed4..2985b9c48 100644
--- a/projects/dsp-ui/src/lib/action/components/message/message.component.ts
+++ b/projects/dsp-ui/src/lib/action/components/message/message.component.ts
@@ -1,6 +1,7 @@
import { Location } from '@angular/common';
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
+import { ApiResponseError } from '@dasch-swiss/dsp-js';
import { StatusMsg } from '../../../../assets/i18n/statusMsg';
/**
@@ -19,36 +20,50 @@ export class DspMessageData {
}
@Component({
- selector: 'dsp-message',
- templateUrl: './message.component.html',
- styleUrls: ['./message.component.scss']
+ selector: 'dsp-message',
+ templateUrl: './message.component.html',
+ styleUrls: ['./message.component.scss']
})
export class MessageComponent implements OnInit {
/**
- * Message type: DspMessageData or ApiServiceError
+ * Message type: DspMessageData
*
- * @param message This type needs at least a status number (0-511).
- * In this case, or if type is ApiServiceError, it takes the default status messages
+ * @param message This type needs at least a status number (0-599).
+ * In this case, or if type is ApiResponseError, it takes the default status messages
* from the list of HTTP status codes (https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
*/
@Input() message: DspMessageData = new DspMessageData();
- // TODO: Refactor Inputs into one parameter (i.e. 'size')
- // https://github.com/dasch-swiss/knora-ui-ng-lib/pull/95#discussion_r435978988
+ /**
+ * Message type: ApiResponseError
+ * @param apiError
+ */
+ @Input() apiError?: ApiResponseError;
+
+ /**
+ * Size of the message: long, medium or short?
+ * @param size Default size is 'long'
+ */
+ @Input() size: 'short' | 'medium' | 'long' = 'long';
/**
+ * @deprecated
* @param short Show short message only
* A small message box to notify the user an event has occured.
*/
- @Input() short = false;
+ @Input() short = (this.size === 'short');
/**
+ * @deprecated
* @param medium Show medium message
* A message box without footnote or links.
*/
- @Input() medium = false;
+ @Input() medium = (this.size === 'medium');
+ /**
+ * @param duration How long should the message be displayed
+ */
@Input() duration?: number;
statusMsg: any;
@@ -87,14 +102,6 @@ export class MessageComponent implements OnInit {
]
};
- footnote: any = {
- text: 'If you think this is a mistake, please',
- team: {
- dasch:
- '
inform the DaSCH development team.'
- }
- };
-
constructor(
private _router: Router,
private _location: Location,
@@ -103,6 +110,16 @@ export class MessageComponent implements OnInit {
) { }
ngOnInit() {
+ // temporary solution as long we have to support the deprecated inputs "short" and "medium"
+ if (this.short || this.medium) {
+ this.size = (this.short ? 'short' : 'medium')
+ }
+
+
+ if (this.apiError) {
+ this.message.status = this.apiError.status;
+ }
+
this.statusMsg = this._status.default;
if (!this.message) {
@@ -170,11 +187,7 @@ export class MessageComponent implements OnInit {
msg.statusText !== undefined
? msg.statusText
: this.statusMsg[s].description;
- tmpMsg.footnote =
- msg.footnote !== undefined
- ? msg.footnote
- : this.footnote.text + ' ' + this.footnote.team.dasch;
- this.showLinks = !this.medium;
+ this.showLinks = (this.size === 'long');
break;
case s >= 500 && s < 600:
// the message is a server side (api) error
@@ -188,8 +201,6 @@ export class MessageComponent implements OnInit {
msg.statusText !== undefined
? msg.statusText
: this.statusMsg[s].description;
- tmpMsg.footnote =
- this.footnote.text + ' ' + this.footnote.team.dasch;
this.showLinks = false;
break;
default:
@@ -212,4 +223,8 @@ export class MessageComponent implements OnInit {
this.disable = !this.disable;
}
+ reload() {
+ window.location.reload();
+ }
+
}
diff --git a/projects/dsp-ui/src/lib/search/advanced-search/advanced-search.component.html b/projects/dsp-ui/src/lib/search/advanced-search/advanced-search.component.html
index f8da6879f..45065fa48 100644
--- a/projects/dsp-ui/src/lib/search/advanced-search/advanced-search.component.html
+++ b/projects/dsp-ui/src/lib/search/advanced-search/advanced-search.component.html
@@ -1,4 +1,4 @@
-