Skip to content

Commit

Permalink
Realtime screen uses entity role #5435
Browse files Browse the repository at this point in the history
Signed-off-by: ClementBouvierN <clement.bouvierneveu@rte-france.com>
  • Loading branch information
ClementBouvierN committed Dec 5, 2023
1 parent b9813c8 commit e8314b3
Show file tree
Hide file tree
Showing 20 changed files with 183 additions and 259 deletions.
8 changes: 8 additions & 0 deletions config/docker/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,16 @@ operatorfabric.users.default:
- id: ENTITY_FR
name: French Control Centers
description: French Control Centers
roles: ["REALTIME_SCREEN_GROUP"]
entityAllowedToSendCard: false
- id: CENTRAL_SUPERVISION_CENTERS
name: Central Supervision Centers
description: Central Supervision Centers
roles: ["REALTIME_SCREEN_GROUP"]
- id: IT_SUPERVISOR_ENTITY
name: IT SUPERVISION CENTER
description: IT SUPERVISION CENTER
parents : ["CENTRAL_SUPERVISION_CENTERS"]
- id: ENTITY1_IT
name: Control Center IT North
description: Control Center IT North
Expand All @@ -129,6 +135,7 @@ operatorfabric.users.default:
name: Italian Control Centers
description: Italian Control Centers
entityAllowedToSendCard: false
roles: ["REALTIME_SCREEN_GROUP"]
- id: ENTITY1_NL
name: Control Center NL North
description: Control Center NL North
Expand All @@ -141,6 +148,7 @@ operatorfabric.users.default:
name: Dutch Control Centers
description: Dutch Control Centers
entityAllowedToSendCard: false
roles: ["REALTIME_SCREEN_GROUP"]
- id: ENTITY1_EU
name: North Europe Control Center
description: North Europe Control Center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
* EntitiesGroups Model, documented at {@link EntitiesGroups}
*
Expand All @@ -28,6 +26,5 @@
@AllArgsConstructor
@Builder
public class EntitiesGroupsData implements EntitiesGroups {
private String name;
private List<String> entities;
private String id;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

Expand All @@ -28,7 +27,6 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Slf4j
public class RealTimeScreenData implements RealTimeScreen {

private String screenName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2022, RTE (http://www.rte-france.com)
/* Copyright (c) 2023, RTE (http://www.rte-france.com)
* See AUTHORS.txt
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -10,14 +10,11 @@

package org.opfab.businessconfig.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import jakarta.validation.Valid;
import java.util.List;

/**
Expand All @@ -30,7 +27,6 @@
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Slf4j
public class ScreenColumnData implements ScreenColumn {
private List<EntitiesGroups> entitiesGroups;
}
6 changes: 1 addition & 5 deletions services/businessconfig/src/main/modeling/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,8 @@ definitions:
$ref: '#/definitions/EntitiesGroups'
EntitiesGroups:
properties:
name:
id:
type: string
entities:
type: array
items:
type: string
UserCard:
properties:
template:
Expand Down
26 changes: 4 additions & 22 deletions services/businessconfig/src/test/data/realtimescreens.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,20 @@
{
"entitiesGroups": [
{
"name": "French Control Centers",
"entities": [
"ENTITY1_FR",
"ENTITY2_FR",
"ENTITY3_FR",
"ENTITY4_FR"
]
"id": "ENTITY_FR"
},
{
"name": "Italian Control Centers",
"entities": [
"ENTITY1_IT",
"ENTITY2_IT",
"ENTITY3_IT"
]
"id": "ENTITY_IT"
},
{
"name": "Dutch Control Centers",
"entities": [
"ENTITY1_NL",
"ENTITY2_NL"
]
"id": "ENTITY_NL"
}
]
},
{
"entitiesGroups": [
{
"name": "Central Supervision Centers",
"entities": [
"IT_SUPERVISOR_ENTITY"
]
"id": "CENTRAL_SUPERVISION_CENTERS"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ void createRealTimeScreens() throws Exception {
.andExpect(jsonPath("$.realTimeScreens[0].screenName", is("All Control Centers")))
.andExpect(jsonPath("$.realTimeScreens[0].screenColumns", hasSize(2)))
.andExpect(jsonPath("$.realTimeScreens[0].screenColumns[0].entitiesGroups", hasSize(3)))
.andExpect(jsonPath("$.realTimeScreens[0].screenColumns[0].entitiesGroups[0].name", is("French Control Centers")))
.andExpect(jsonPath("$.realTimeScreens[0].screenColumns[0].entitiesGroups[0].entities", hasSize(4)));
.andExpect(jsonPath("$.realTimeScreens[0].screenColumns[0].entitiesGroups[0].id", is("ENTITY_FR")));
}

@Nested
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
66 changes: 12 additions & 54 deletions src/docs/asciidoc/reference_doc/users_management.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -126,38 +126,20 @@ Here is an example of the configuration file :
{
"entitiesGroups": [
{
"name": "French Control Centers",
"entities": [
"ENTITY1_FR",
"ENTITY2_FR",
"ENTITY3_FR",
"ENTITY4_FR"
]
"id": "ENTITY_FR"
},
{
"name": "Italian Control Centers",
"entities": [
"ENTITY1_IT",
"ENTITY2_IT",
"ENTITY3_IT"
]
"id": "ENTITY_IT"
},
{
"name": "Dutch Control Centers",
"entities": [
"ENTITY1_NL",
"ENTITY2_NL"
]
"id": "ENTITY_NL"
}
]
},
{
"entitiesGroups": [
{
"name": "Central Supervision Centers",
"entities": [
"IT_SUPERVISOR_ENTITY"
]
"id": "CENTRAL_SUPERVISION_CENTERS"
}
]
}
Expand All @@ -169,23 +151,14 @@ Here is an example of the configuration file :
{
"entitiesGroups": [
{
"name": "French Control Centers",
"entities": [
"ENTITY1_FR",
"ENTITY2_FR",
"ENTITY3_FR",
"ENTITY4_FR"
]
"id": "ENTITY_FR"
}
]
},
{
"entitiesGroups": [
{
"name": "Central Supervision Centers",
"entities": [
"IT_SUPERVISOR_ENTITY"
]
"id": "CENTRAL_SUPERVISION_CENTERS"
}
]
}
Expand All @@ -197,22 +170,14 @@ Here is an example of the configuration file :
{
"entitiesGroups": [
{
"name": "Italian Control Centers",
"entities": [
"ENTITY1_IT",
"ENTITY2_IT",
"ENTITY3_IT"
]
"id": "ENTITY_IT"
}
]
},
{
"entitiesGroups": [
{
"name": "Central Supervision Centers",
"entities": [
"IT_SUPERVISOR_ENTITY"
]
"id": "CENTRAL_SUPERVISION_CENTERS"
}
]
}
Expand All @@ -224,21 +189,14 @@ Here is an example of the configuration file :
{
"entitiesGroups": [
{
"name": "Dutch Control Centers",
"entities": [
"ENTITY1_NL",
"ENTITY2_NL"
]
"id": "ENTITY_NL"
}
]
},
{
"entitiesGroups": [
{
"name": "Central Supervision Centers",
"entities": [
"IT_SUPERVISOR_ENTITY"
]
"id": "CENTRAL_SUPERVISION_CENTERS"
}
]
}
Expand All @@ -248,11 +206,11 @@ Here is an example of the configuration file :
}
----

With this configuration file, 4 different screens will be available : "All Control Centers", "French Control Centers", "Italian Control Centers" and "Dutch Control Centers".
With this configuration file, 4 different screens will be available : "All Control Centers", "French Control Centers", "Italian Control Centers" and "Dutch Control Centers". To associate the entities under each entity group, it is required to label the entity group as a parent of the entities.

For example, in the UI, "All Control Centers" will look like :

image::realtimescreens_screenshot.png[Real Time Screens screenshot,align="center"]
image::realtimescreen_screenshot.png[Real Time Screens screenshot,align="center"]

== Activity area

Expand Down
72 changes: 72 additions & 0 deletions src/docs/asciidoc/resources/migration_guide_to_4.2.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) 2023 RTE (http://www.rte-france.com)
// See AUTHORS.txt
// This document is subject to the terms of the Creative Commons Attribution 4.0 International license.
// If a copy of the license was not distributed with this
// file, You can obtain one at https://creativecommons.org/licenses/by/4.0/.
// SPDX-License-Identifier: CC-BY-4.0

= Migration Guide from release 4.1.0 to release 4.2.0


== Configuration files of the realtime users screen

Previously, to configure this screen, the json file had to fit the following structure :

[source,json]
----
{
"realTimeScreens": [
{
"screenName": <Name of the screen>,
"screenColumns": [
{
"entitiesGroups": [
{
"name": <Name of a group of entities>,
"entities": [
<entity1 id>,
<entity2 id>
]
},
{
"name": <Name of another group of entities>,
"entities": [
<entity3 id>,
<entity4 id>
]
}
]
}
]
}
]
}
----

Now entities shouldn't be grouped in the configuration file anymore. Instead entities are grouped by a shared parent entity. The configuration file needs to be changed to the following structure:

[source,json]
----
{
"realTimeScreens": [
{
"screenName": <Name of the screen>,
"screenColumns": [
{
"entitiesGroups": [
{
"id": <parent entity 1 id>,
},
{
"id": <parent entity 2 id>,
}
]
}
]
}
]
}
----


With this parent entity 1 and parent entity 2 need to be declared and the name of the parent entities will be the name of the group.

0 comments on commit e8314b3

Please sign in to comment.