Skip to content

Commit

Permalink
Message or question list template - Add option in config file to choo…
Browse files Browse the repository at this point in the history
…se severity (#5595)

Signed-off-by: Giovanni Ferrari <giovanni.ferrari@soft.it>
  • Loading branch information
quinarygio committed Dec 13, 2023
1 parent 6b8da3b commit bc1f2d8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/docs/asciidoc/reference_doc/build-in_templates.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ If you want to use the template as is, the json file must follow this structure
"title": "Warning about the state of the grid",
"message": "A problem has been detected, please put maintenance work on hold and be on stand by",
"question": false,
"severity": "ALARM",
"recipients" : [
"ENTITY1_FR",
"ENTITY2_FR"
Expand All @@ -120,6 +121,7 @@ If you want to use the template as is, the json file must follow this structure
"title": "Confirmation the issues have been fixed",
"message": "Please confirm the issues in your area have been fixed",
"question": true,
"severity": "ACTION",
"recipients" : [
"ENTITY1_FR"
]
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/businessData/message-and-question-list
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"title": "Warning about the state of the grid",
"message": "A problem has been detected, please put maintenance work on hold and be on stand by",
"question": false,
"severity": "ALARM",
"recipients" : [
"ENTITY1_FR",
"ENTITY2_FR",
Expand All @@ -33,6 +34,7 @@
"title": "Confirmation the issues have been fixed",
"message": "Please confirm the issues in your area have been fixed",
"question": true,
"severity": "ACTION",
"recipients" : [
"ENTITY1_FR",
"ENTITY2_FR",
Expand All @@ -48,6 +50,7 @@
"title": "Situation solved",
"message": "All the problems have been dealt with, please resume normal operations",
"question": false,
"severity": "INFORMATION",
"recipients" : [
"ENTITY1_FR",
"ENTITY2_FR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ describe('MessageOrQuestionList UserCard template', () => {
it('GIVEN a user WHEN create card THEN card is the correct severity', () => {
const view = new MessageOrQuestionListUserCardTemplateView();

const selectedMessage = {title: "my title", question: true};
const selectedMessage = {title: "my title", question: true, severity: 'ACTION'};
view.selectedMessage = selectedMessage;
let specficCardInformation = view.getSpecificCardInformation('my question');
expect(specficCardInformation.card.severity).toEqual('ACTION');


view.selectedMessage.question = false;
view.selectedMessage.severity = 'ALARM';
specficCardInformation = view.getSpecificCardInformation('my message');
expect(specficCardInformation.card.severity).toEqual('INFORMATION');
expect(specficCardInformation.card.severity).toEqual('ALARM');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ export class MessageOrQuestionListUserCardTemplateView {
const title = this.selectedMessage.title.trim();
const id = this.selectedMessage.id;
const question = this.selectedMessage.question;
let severity = 'INFORMATION';
let severity = this.selectedMessage.severity;
let entitiesAllowedToRespond;

if (this.selectedMessage.question) {
severity = 'ACTION';
entitiesAllowedToRespond = this.selectedMessage?.possibleRecipients ? this.selectedMessage?.possibleRecipients : "";
} else {
entitiesAllowedToRespond = [];
Expand Down

0 comments on commit bc1f2d8

Please sign in to comment.