Translation
Handles the translation process, checkbox tree, saving and opening translation file
- Source:
Extends
- React.Component
Methods
checkedToTranslation(parts, translationFile)
Convert the checkbox tree checked nodes to the translation file
Parameters:
| Name | Type | Description |
|---|---|---|
parts |
Array | Array containing strings that leads to this node |
translationFile |
Object | object representing translation file |
- Source:
componentDidMount()
Called after this component is mounted
- Source:
contextMenuListener(event)
Event listener for context menu
Parameters:
| Name | Type | Description |
|---|---|---|
event |
Event | context menu listener |
- Source:
getCheckboxPath(node)
Get the array of nodes that lead to the selected element
Parameters:
| Name | Type | Description |
|---|---|---|
node |
HTMLElement | HTML element that user has just edited |
- Source:
Returns:
array of nodes
getNewEndpointCheckbox(elements, nodes, value)
Create new node in the checkbox tree after user adds a new endpoint
Parameters:
| Name | Type | Description |
|---|---|---|
elements |
Object | object containing data for the endpoint |
nodes |
Array | array containing the nodes for the checkbox tree |
value |
String | name of the path |
- Source:
getNodeElement(el)
Get the node
Parameters:
| Name | Type | Description |
|---|---|---|
el |
HTMLElement | HTML element node |
- Source:
Returns:
HTML element node
getParent(path, nodes)
Get the node's parent
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Array | array containing nodes leading to the targeted checkbox |
nodes |
Object | all checkbox nodes |
- Source:
Returns:
the parent
handleNewDescription(description)
Handle a new description specified from the text area
Parameters:
| Name | Type | Description |
|---|---|---|
description |
String | Description |
- Source:
handleNewEndpoint(endpoint, endpointName, path)
Handle a new endpoint
Parameters:
| Name | Type | Description |
|---|---|---|
endpoint |
String | Endpoint from the swagger |
endpointName |
String | User created endpoint name |
path |
Object | nodes that lead to endpoint |
- Source:
handleNewLink(newLinkName, targetEndpoint, parameterName, value)
Handle adding a new link
Parameters:
| Name | Type | Description |
|---|---|---|
newLinkName |
String | Name of new link |
targetEndpoint |
String | Name of the target endpoint |
parameterName |
String | Name of parameter |
value |
String | Name of the value |
- Source:
handleOnContextMenu(nodeElement)
Handle context menu interaction
Parameters:
| Name | Type | Description |
|---|---|---|
nodeElement |
HTMLElement | HTML element node |
- Source:
initCheckedFromTranslation(translationFile, leafNodes, path)
Read in existing translation file and intialize the checked nodes in the checkbox tree
based off translation file
Parameters:
| Name | Type | Description |
|---|---|---|
translationFile |
Object | the translation file |
leafNodes |
Array | array of checked leaf nodes |
path |
string | string value stored in leafNodes array |
- Source:
labelToValue(path)
Converts the node's label to a value
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Array | array containing every node |
- Source:
Returns:
array containing every node's value
newTranslationFile()
Handle creation of a new translation file
- Source:
onCheckHandler(newChecked)
Handle new checked nodes
Parameters:
| Name | Type | Description |
|---|---|---|
newChecked |
Array | array of the newly checked nodes |
- Source:
onOpenTranslation(event)
Handling opening of swagger file button
Parameters:
| Name | Type | Description |
|---|---|---|
event |
ChangeEvent.<HTMLInputElement> | event containing name of the swagger file |
- Source:
saveTranslation()
Save the translation file to file system
- Source:
searchCheckboxNode(path, nodes, searchValue)
Search for the checkbox node recursively
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Array | array containing nodes that lead to targeted checked node |
nodes |
Array | array of all checkbox nodes |
searchValue |
String | search for the checkbox through the searchValue |
- Source:
textAreaListener(event)
Listener for text area events
Parameters:
| Name | Type | Description |
|---|---|---|
event |
Event | event for text area |
- Source:
updateCheckboxNode(path, nodes, value)
Update the checkbox
Parameters:
| Name | Type | Description |
|---|---|---|
path |
Array | array containing nodes that lead to targeted checked node |
nodes |
Array | array of all checkbox nodes |
value |
String | search for the checkbox through the value |
- Source: