Skip to content

Commit 006c8aa

Browse files
committed
Change cloud code tips
1 parent 25f6f17 commit 006c8aa

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/components/B4ACodeTree/B4ACodeTree.react.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ import B4ATreeActions from 'components/B4ACodeTree/B4ATreeActions';
99
import 'jstree/dist/themes/default/style.css'
1010
import 'components/B4ACodeTree/B4AJsTree.css'
1111

12+
const cloudFolderPlaceholder = "// The first deployed file must be named main.js and must be placed on the root of the cloud folder.\n" +
13+
"// The example below shows you how a cloud code function looks like.\n\n" +
14+
"/*\n* Parse.Cloud.define(\"hello\", function(request, response){\n" +
15+
"* \tresponse.success(\"Hello world!\");\n" +
16+
"* });\n*/\n" +
17+
"\n// If you have set a function in another cloud code file, called \"test.js\" (for example)\n" +
18+
"// you need to refer it in your main.js, as you can see below:\n" +
19+
"\n/* require(\"./test.js\"); */"
20+
21+
const publicFolderPlaceholder = "// Public folder can be used to deploy public static content as html, images, css, etc.\n" +
22+
"\n" +
23+
"// You have to setup a custom domain or subdomain at Back4App to access the public static content"
24+
1225
export default class B4ACodeTree extends React.Component {
1326
constructor(props){
1427
super(props);
@@ -72,6 +85,9 @@ export default class B4ACodeTree extends React.Component {
7285
selectedFile = selected.text
7386
nodeId = selected.id
7487
extension = B4ATreeActions.getExtension(selectedFile)
88+
} else {
89+
if (selected.text === 'cloud') source = cloudFolderPlaceholder
90+
else if (selected.text === 'public') source = publicFolderPlaceholder
7591
}
7692
}
7793
this.setState({ source, selectedFile, nodeId, extension, isImage })

src/components/B4ACodeTree/B4ATreeActions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ const customMenu = node => {
159159

160160
// Return the jstree config
161161
const getConfig = (files) => {
162+
if (files[0] && files[0].state) files[0].state.selected = true
162163
return {
163164
plugins: ['contextmenu', 'dnd', 'sort', 'types', 'unique', 'changed'],
164165
core: {

src/dashboard/Data/CloudCode/B4ACloudCode.react.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ class B4ACloudCode extends CloudCode {
195195
let alertTips = null;
196196

197197
let alertTipsMessage = <div>
198-
<p><b></b> Using the Cloud Code tool you can deploy and run your Node.js functions on the Back4App cloud via SDK or calling the <a href="https://www.back4app.com/docs/platform/command-line-tool/how-to-use" target="_blank">REST API</a></p>
199-
<p><b></b> To upload your code you should first click on <b>ADD</b> button and choose what files and folders you want to upload.</p>
200-
<p><b></b> The first file MUST BE called <b>main.js</b> and any other file or folder MUST BE referenced more in this file.</p>
201-
<p><b></b> After ADD and REMOVE all files you want, click on the <b>DEPLOY</b> button and commit your operation;</p>
198+
<p><b></b> To deploy your Cloud Code Functions you can use the Dashboard bellow or the <a href="https://www.back4app.com/docs/platform/command-line-tool/parse-server-setup" target="_blank">Back4App CLI.</a></p>
199+
<p><b></b> To upload your code you should first click on ADD button and choose what files you want to upload.</p>
200+
<p><b></b> The first file MUST BE called main.js and any other file or folder MUST BE referenced more in this file.</p>
201+
<p><b></b> After ADD and REMOVE all files you want, click on the DEPLOY button and commit your operation;</p>
202202
</div>
203203

204204
let alertWhatIsMessage = <div>
205-
<p>To make long short, Cloud code isn’t anything else than a script that runs on the server side instead of the device that is running your app. It is more commonly used on Apps that need of a little more of complexity to its execution but isn’t mandatory.</p>
205+
<p>Cloud code functions is a tool that lets you run a NodeJS function in Back4App Cloud. Back4App executes your code only when you call the function via API or via SDK. It is also possible to create functions that are triggered by your app events. When you update your Cloud Code Functions, it becomes available to all mobile/web/IoT environments instantly. You don’t have to wait for a new release of your application. This lets you change app behavior on the fly and add new features faster.</p>
206206
</div>
207207

208208
// Show loading page before fetch data

0 commit comments

Comments
 (0)