Class

ProjectTabs

ProjectTabs(props) → {React.PureComponent}

Overview

The Project section in RuLeStudio. Allows a user to choose between tabs. If necessary, displays information about outdated results shown in currently selected tab.
Constructor

# new ProjectTabs(props) → {React.PureComponent}

Parameters:
Name Type Description
props Object
deleting boolean

If true the project was requested to be deleted.

objectGlobalName string

The global visible object name used by all tabs as reference.

onSnackbarOpen function

Callback fired when the component request to display an error.

project Object

Current project.

serverBase string

The host and port in the URL of an API call.

updateProject function

Callback fired when a part of current project was changed.

View Source Body/Project/ProjectTabs.js, line 33

React.PureComponent

Methods

# static onDataChange(informationTable, isUpdateNecessary)

Overview

Forwarded to the Data tab. Fired when a user makes changes in the information table. Saves modified project in the component's state.
Parameters:
Name Type Description
informationTable Object

Modified information table from the Data tab.

isUpdateNecessary boolean

If true information table will be sent to server on exit.

View Source Body/Project/ProjectTabs.js, line 362

# static onDataUploaded(isExternal)

Overview

Forwarded to the Rules and Classification tabs. Fired when a user uploads information table. Saves this information in the component's state.
Parameters:
Name Type Description
isExternal boolean

If true alert will be displayed that external data was classified.

View Source Body/Project/ProjectTabs.js, line 416

# static onRulesUploaded(isExternal)

Overview

Forwarded to the Rules tab. Fired when a user uploads rule set. Saves this information in the component's state.
Parameters:
Name Type Description
isExternal boolean

If true alert will be displayed that rule set was uploaded.

View Source Body/Project/ProjectTabs.js, line 401

# static onTabChange(event, newValue)

Overview

Fired when a tab is changed. If user had unsaved changes in Data tab, method calls updateProjectOnServer to save them on server.
Parameters:
Name Type Description
event Object

Represents an event that takes place in DOM.

newValue number

The id of tab that was selected.

View Source Body/Project/ProjectTabs.js, line 328

# static showAlert(index, show, messagesopt)

Overview

Forwarded to all tabs. Fired when a tab receives information from the server that current results are outdated.
Parameters:
Name Type Attributes Description
index number

The index of a selected tab.

show boolean

If true an alert about outdated results in tab will be displayed.

messages Array.<string> <optional>

Optional messages displayed in alert.

View Source Body/Project/ProjectTabs.js, line 380

# static updateAlerts(result)

Overview

Updates alerts based on the response from server.
Parameters:
Name Type Description
result Object

The response from the server.

View Source Body/Project/ProjectTabs.js, line 58

# static updateProjectOnServer(projectId, informationTable, finallyCallbackopt)

Overview

Utilizes fetchData to perform an API call with POST method and information table in body.

Goal

The goal of this function is to save user's changes made in information table.
Parameters:
Name Type Attributes Description
projectId string

The identifier of a selected project.

informationTable Object

The local copy of an information table that will be sent to server.

finallyCallback function <optional>

The callback fired in finally part of the fetch function.

View Source Body/Project/ProjectTabs.js, line 201

# componentDidMount()

Overview

A component's lifecycle method. Fired once when component was mounted.

Goal

Method calls updateAlerts.

View Source Body/Project/ProjectTabs.js, line 232

# componentDidUpdate(prevProps, prevState, snapshot)

Overview

A component's lifecycle method. Fired after a component was updated.

Goal

Checks if project was changed. If a new project was forwarded, method makes an API call to retrieve that project and saves changes from old project if necessary.
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 getSnapshotBeforeUpdate. Usually undefined.

View Source Body/Project/ProjectTabs.js, line 256

# componentWillUnmount()

Overview

A component's lifecycle method. Fired when component was requested to be unmounted.

Goal

If there were any unsaved changes, method calls updateProjectOnServer.

View Source Body/Project/ProjectTabs.js, line 301