forked from ToolJet/ToolJet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for running JavaScript as a query ( client-side execution ) (T…
…oolJet#1507) * Custom js feature * Disable transformations * Fix * Fix * Fix * Icon * Rename variable OthetSources to OtherSources * Fix * Fix Co-authored-by: Sherfin Shamsudeen <sherfin94@gmail.com>
- Loading branch information
1 parent
a610bd6
commit 3477f7f
Showing
12 changed files
with
177 additions
and
30 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
frontend/src/Editor/DataSourceManager/SourceComponents/Api/Runjs.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"$schema": "https://json-schema.org/", | ||
"$id": "https://tooljet.io/Runjs.schema.json", | ||
"title": "Runjs datasource", | ||
"description": "A schema defining runjs datasource", | ||
"type": "object", | ||
"source": { | ||
"name": "Run JavaScript", | ||
"kind": "runjs", | ||
"exposedVariables": { | ||
"isLoading": {}, | ||
"data": {}, | ||
"rawData": {} | ||
}, | ||
"customTesting": true, | ||
"disableTransformations": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import { CodeHinter } from '../../CodeBuilder/CodeHinter'; | ||
import { changeOption } from './utils'; | ||
import { defaults } from 'lodash'; | ||
|
||
class Runjs extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
const options = defaults({ ...props.options }, { code: '//Type your JavaScript code here' }); | ||
this.state = { | ||
options, | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
} | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<CodeHinter | ||
currentState={this.props.currentState} | ||
initialValue={this.props.options.code} | ||
mode="javascript" | ||
theme={this.props.darkMode ? 'monokai' : 'base16-light'} | ||
lineNumbers={true} | ||
height={400} | ||
className="query-hinter" | ||
ignoreBraces={true} | ||
onChange={(value) => changeOption(this, 'code', value)} | ||
isMultiLineJs={false} | ||
enablePreview={false} | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export { Runjs }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.