# new Rules(props) → {React.Component}
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | |
objectGlobalName |
string | The global visible object name used by all tabs as reference. |
onDataUploaded |
function | Callback fired when tab receives information that new data was uploaded. |
onRulesUploaded |
function | Callback fired when tab receives information that rule set was uploaded. |
onTabChange |
function | Callback fired when a tab is changed and there are unsaved changes in this tab. |
project |
Object | Current project. |
serverBase |
string | The host and port in the URL of an API call. |
showAlert |
function | Callback fired when results in this tab are based on outdated information table. |
value |
number | The index of a selected tab. |
Methods
# static getRules()
Overview
Makes an API call on rules to receive current copy of rule set from server. Then, updates state and makes necessary changes in display.# static onCalculateClick()
Overview
Makes an API call on rules to generate new rule set from current information table and parameters. Then, updates state and makes necessary changes in display.# static onFilterChange(event)
Overview
Filters items fromRules
' state and then sorts them if any order was declared.
Method uses filterFunction
to filter items.
Parameters:
Name | Type | Description |
---|---|---|
event |
Object | Represents an event that takes place in DOM. |
# static onSaveRulesToTXTClick()
Overview
Makes an API call to download current rule set in TXT format.# static onSaveRulesToXMLClick()
Overview
Makes an API call to download current rules set in XML format.# static onSortChange(items)
Overview
Sorts provided items and saves results inRules
' state.
Method uses simpleSort
function to sort items.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<Object> | A list of objects that will be sorted. |
# static onUploadFileChanged(event)
Overview
Makes an API call on rules to upload user's rule set. Then, updates states and makes necessary changes in display.Parameters:
Name | Type | Description |
---|---|---|
event |
Object | Represents an event that takes place in DOM. |
# static updateAlerts(validityRulesContainer)
Overview
Used when changes inRules
had an impact on results in Unions
or Classification
.
Updates classification and unions in current project, makes necessary changes in display.
Parameters:
Name | Type | Description |
---|---|---|
validityRulesContainer |
Object | The part of response from server |
# componentDidMount()
Overview
A component's lifecycle method. Fired once when component was mounted.Goal
Method callsgetRules
.
# componentDidUpdate(prevProps, prevState, snapshot)
Overview
A component's lifecycle method. Fired after a component was updated.Goal
If type of unions was changed tomonotonic
and consistency threshold is equal to 1,
method changes value of threshold to 0.
If type of rules was changed to
possible
, method changes consistency threshold to 0.
If project was changed, method saves changes from previous project and calls
getRules
to receive the latest copy of rule set.
Parameters:
Name | Type | Description |
---|---|---|
prevProps |
Object | Old props that were already replaced. |
prevState |
Object | Old state that was already replaced. |
snapshot |
Object | Returned from another lifecycle method |