Architecture #4753
closedExtract compliance calculus from RuleEditForm
Description
In 2.10 and above, the calculus of compliance for a rule (or for a node) is done within the display code (RuleEditForm mainly).
That violates any best (or even good) practices I can think of, including:
- it mixes displaying and business logic, make change in one or the other both harder and more error prone than if the orthogonal subject where actually in different part of the code (try to drive an helicopter to understand that)
- the code is not reusable, so we can't build new services using the logic (API, component using it elsewhere...)
- it's not DRY, and so bugs are jumping from screen to screen
- we can't optimize the business logic performance
- and moreover, we can't make things impossible by construction, so we spend more time checking normally impossible to reach state
- we can't evolve the business logic (for example, #4750, knowing if a set of repaired report should be "repaired" or "error" (is pure business logic, not displaying)
- we can't build the UI from a stable datastructure / service layout
So we need to:
- specify what we NEED from a compliance point of view (by rule ? by node ? bulk ? only the last one ? etc)
- specify the datastructures in use now
- split anything dealing with displaying (human name, etc) from business logic (where we get data from ? When ? How do we transform them ? What are our contracts with the caller ? What are the datastructures ?)
- refactore RuleEditForm the use the new services
Updated by François ARMAND over 10 years ago
A plugin was done to expose compliance information thought the API: https://github.com/Normation/rudder-plugin-itop/
The file https://github.com/Normation/rudder-plugin-itop/blob/master/src/main/scala/com/normation/plugins/itop/service/ItopNodeService.scala can be a good starting point to understand what is needed to build a compliance datastructure, define vocabulary, tests, etc.
Updated by François ARMAND over 10 years ago
- Target version changed from 2.11.0~beta1 to 140
That is going on it's way with the refactoring done around ruleEditForm in http://www.rudder-project.org/redmine/issues/4770.
Now, we should clean up things and normalize services and data structure around Rudder.
Retargeting in 2.12.
Updated by Matthieu CERDA about 10 years ago
- Target version changed from 140 to 3.0.0~beta1
Updated by Jonathan CLARKE almost 10 years ago
- Target version changed from 3.0.0~beta1 to 3.0.0~beta2
Updated by François ARMAND almost 10 years ago
- Status changed from 8 to Rejected
This ticket is no longer needed since it was done along with the change-only refactoring. Closing as "no more relevant".