@lowdefy/docs 4.0.0-alpha.7 → 4.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/operators/client/filter_default_value.js +55 -0
  2. package/{public/modules/connectDocsearch.js → dist/operatorsClient.js} +1 -19
  3. package/{templates/blocks/schemaTransformer.js → dist/types.js} +5 -10
  4. package/package.json +19 -3
  5. package/404.yaml +0 -26
  6. package/CHANGELOG.md +0 -697
  7. package/actions/CallMethod.yaml +0 -57
  8. package/actions/JsAction.yaml +0 -281
  9. package/actions/Link.yaml +0 -120
  10. package/actions/Login.yaml +0 -123
  11. package/actions/Logout.yaml +0 -44
  12. package/actions/Message.yaml +0 -68
  13. package/actions/Notification.yaml +0 -84
  14. package/actions/Request.yaml +0 -70
  15. package/actions/Reset.yaml +0 -42
  16. package/actions/ResetValidation.yaml +0 -102
  17. package/actions/ScrollTo.yaml +0 -100
  18. package/actions/SetGlobal.yaml +0 -78
  19. package/actions/SetState.yaml +0 -85
  20. package/actions/Throw.yaml +0 -89
  21. package/actions/Validate.yaml +0 -104
  22. package/actions/Wait.yaml +0 -40
  23. package/blocks/all_icons.yaml +0 -803
  24. package/blocks/container/Affix.yaml +0 -26
  25. package/blocks/container/Alert.yaml +0 -27
  26. package/blocks/container/Badge.yaml +0 -27
  27. package/blocks/container/Box.yaml +0 -27
  28. package/blocks/container/Card.yaml +0 -29
  29. package/blocks/container/Collapse.yaml +0 -38
  30. package/blocks/container/Comment.yaml +0 -43
  31. package/blocks/container/ConfirmModal.yaml +0 -36
  32. package/blocks/container/Descriptions.yaml +0 -51
  33. package/blocks/container/Drawer.yaml +0 -46
  34. package/blocks/container/Label.yaml +0 -28
  35. package/blocks/container/Modal.yaml +0 -46
  36. package/blocks/container/PageHCF.yaml +0 -28
  37. package/blocks/container/PageHCSF.yaml +0 -29
  38. package/blocks/container/PageHSCF.yaml +0 -29
  39. package/blocks/container/PageHeaderMenu.yaml +0 -52
  40. package/blocks/container/PageSHCF.yaml +0 -29
  41. package/blocks/container/PageSiderMenu.yaml +0 -53
  42. package/blocks/container/Result.yaml +0 -34
  43. package/blocks/container/Span.yaml +0 -27
  44. package/blocks/container/Spin.yaml +0 -27
  45. package/blocks/container/Tabs.yaml +0 -41
  46. package/blocks/container/Tooltip.yaml +0 -38
  47. package/blocks/display/Anchor.yaml +0 -25
  48. package/blocks/display/Avatar.yaml +0 -23
  49. package/blocks/display/Breadcrumb.yaml +0 -28
  50. package/blocks/display/Button.yaml +0 -43
  51. package/blocks/display/DangerousHtml.yaml +0 -62
  52. package/blocks/display/DangerousMarkdown.yaml +0 -46
  53. package/blocks/display/Divider.yaml +0 -23
  54. package/blocks/display/EChart.yaml +0 -53
  55. package/blocks/display/Html.yaml +0 -50
  56. package/blocks/display/Icon.yaml +0 -23
  57. package/blocks/display/Img.yaml +0 -40
  58. package/blocks/display/Markdown.yaml +0 -31
  59. package/blocks/display/MarkdownWithCode.yaml +0 -46
  60. package/blocks/display/Menu.yaml +0 -48
  61. package/blocks/display/Message.yaml +0 -34
  62. package/blocks/display/MobileMenu.yaml +0 -47
  63. package/blocks/display/Notification.yaml +0 -34
  64. package/blocks/display/Paragraph.yaml +0 -30
  65. package/blocks/display/Progress.yaml +0 -52
  66. package/blocks/display/Skeleton.yaml +0 -27
  67. package/blocks/display/Statistic.yaml +0 -35
  68. package/blocks/display/Title.yaml +0 -32
  69. package/blocks/input/AutoComplete.yaml +0 -30
  70. package/blocks/input/ButtonSelector.yaml +0 -36
  71. package/blocks/input/CheckboxSelector.yaml +0 -36
  72. package/blocks/input/CheckboxSwitch.yaml +0 -56
  73. package/blocks/input/ChromeColorSelector.yaml +0 -24
  74. package/blocks/input/CircleColorSelector.yaml +0 -24
  75. package/blocks/input/ColorSelector.yaml +0 -24
  76. package/blocks/input/CompactColorSelector.yaml +0 -24
  77. package/blocks/input/DateRangeSelector.yaml +0 -26
  78. package/blocks/input/DateSelector.yaml +0 -26
  79. package/blocks/input/DateTimeSelector.yaml +0 -28
  80. package/blocks/input/GithubColorSelector.yaml +0 -24
  81. package/blocks/input/MonthSelector.yaml +0 -26
  82. package/blocks/input/MultipleSelector.yaml +0 -117
  83. package/blocks/input/NumberInput.yaml +0 -24
  84. package/blocks/input/Pagination.yaml +0 -33
  85. package/blocks/input/ParagraphInput.yaml +0 -32
  86. package/blocks/input/PasswordInput.yaml +0 -48
  87. package/blocks/input/RadioSelector.yaml +0 -36
  88. package/blocks/input/RatingSlider.yaml +0 -24
  89. package/blocks/input/S3UploadButton.yaml +0 -28
  90. package/blocks/input/Selector.yaml +0 -98
  91. package/blocks/input/SliderColorSelector.yaml +0 -24
  92. package/blocks/input/SwatchesColorSelector.yaml +0 -24
  93. package/blocks/input/Switch.yaml +0 -24
  94. package/blocks/input/TextArea.yaml +0 -27
  95. package/blocks/input/TextInput.yaml +0 -59
  96. package/blocks/input/TitleInput.yaml +0 -32
  97. package/blocks/input/TwitterColorSelector.yaml +0 -24
  98. package/blocks/input/WeekSelector.yaml +0 -26
  99. package/blocks/list/ControlledList.yaml +0 -191
  100. package/blocks/list/List.yaml +0 -157
  101. package/blocks/list/TimelineList.yaml +0 -136
  102. package/body.html +0 -1
  103. package/concepts/blocks.yaml +0 -249
  104. package/concepts/cli.yaml +0 -173
  105. package/concepts/connections-and-requests.yaml +0 -114
  106. package/concepts/context-and-state.yaml +0 -82
  107. package/concepts/custom-blocks.yaml +0 -190
  108. package/concepts/custom-code.yaml +0 -197
  109. package/concepts/events-and-actions.yaml +0 -224
  110. package/concepts/hosting-files.yaml +0 -50
  111. package/concepts/layout.yaml +0 -1464
  112. package/concepts/lists.yaml +0 -162
  113. package/concepts/lowdefy-schema.yaml +0 -245
  114. package/concepts/operators.yaml +0 -66
  115. package/concepts/overview.yaml +0 -48
  116. package/concepts/secrets.yaml +0 -56
  117. package/connections/AWSS3.yaml +0 -228
  118. package/connections/AmazonRedshift.yaml +0 -75
  119. package/connections/AxiosHttp.yaml +0 -194
  120. package/connections/Elasticsearch.yaml +0 -378
  121. package/connections/GoogleSheet.yaml +0 -332
  122. package/connections/Knex.yaml +0 -181
  123. package/connections/KnexRequests.md +0 -121
  124. package/connections/MSSQL.yaml +0 -90
  125. package/connections/MariaDB.yaml +0 -77
  126. package/connections/MongoDB.yaml +0 -581
  127. package/connections/MySQL.yaml +0 -92
  128. package/connections/OracleDB.yaml +0 -73
  129. package/connections/PostgreSQL.yaml +0 -99
  130. package/connections/Redis.yaml +0 -147
  131. package/connections/SQLite.yaml +0 -94
  132. package/connections/SendGridMail.yaml +0 -113
  133. package/connections/Stripe.yaml +0 -139
  134. package/deployment/aws-lambda.yaml +0 -128
  135. package/deployment/docker.yaml +0 -118
  136. package/deployment/netlify.yaml +0 -69
  137. package/deployment/node-server.yaml +0 -111
  138. package/head.html +0 -7
  139. package/howto/generate-csv.yaml.njk +0 -252
  140. package/howto/generate-pdf.yaml.njk +0 -651
  141. package/howto/generateCsv/lowdefy.yaml +0 -64
  142. package/howto/generateCsv/public/csvMake.js +0 -27
  143. package/howto/generatePdf/inv_template.yaml +0 -200
  144. package/howto/generatePdf/lowdefy.yaml +0 -117
  145. package/howto/generatePdf/my_header.html +0 -1
  146. package/howto/generatePdf/public/logo_example.png +0 -0
  147. package/howto/generatePdf/public/modules/importUmd.js +0 -7
  148. package/howto/generatePdf/public/modules/pdfMake.js +0 -7
  149. package/howto/generatePdf/public/modules/vfs_fonts.js +0 -12
  150. package/howto/use-refrences.md +0 -5
  151. package/introduction.yaml +0 -100
  152. package/lowdefy.yaml +0 -66
  153. package/menus.yaml +0 -832
  154. package/operators/_actions.yaml +0 -123
  155. package/operators/_and.yaml +0 -90
  156. package/operators/_args.yaml +0 -79
  157. package/operators/_array.yaml +0 -326
  158. package/operators/_base64.yaml +0 -56
  159. package/operators/_change_case.yaml +0 -347
  160. package/operators/_date.yaml +0 -71
  161. package/operators/_diff.yaml +0 -75
  162. package/operators/_divide.yaml +0 -46
  163. package/operators/_eq.yaml +0 -67
  164. package/operators/_event.yaml +0 -103
  165. package/operators/_format.yaml +0 -209
  166. package/operators/_function.yaml +0 -66
  167. package/operators/_get.yaml +0 -108
  168. package/operators/_global.yaml +0 -107
  169. package/operators/_gt.yaml +0 -65
  170. package/operators/_gte.yaml +0 -65
  171. package/operators/_hash.yaml +0 -109
  172. package/operators/_if.yaml +0 -44
  173. package/operators/_if_none.yaml +0 -61
  174. package/operators/_index.yaml +0 -65
  175. package/operators/_input.yaml +0 -114
  176. package/operators/_js.yaml +0 -189
  177. package/operators/_json.yaml +0 -128
  178. package/operators/_list_contexts.yaml +0 -37
  179. package/operators/_location.yaml +0 -59
  180. package/operators/_log.yaml +0 -36
  181. package/operators/_lt.yaml +0 -65
  182. package/operators/_lte.yaml +0 -65
  183. package/operators/_math.yaml +0 -374
  184. package/operators/_media.yaml +0 -86
  185. package/operators/_menu.yaml +0 -81
  186. package/operators/_mql.yaml +0 -101
  187. package/operators/_ne.yaml +0 -77
  188. package/operators/_not.yaml +0 -47
  189. package/operators/_number.yaml +0 -157
  190. package/operators/_nunjucks.yaml +0 -73
  191. package/operators/_object.yaml +0 -193
  192. package/operators/_operator.yaml +0 -47
  193. package/operators/_or.yaml +0 -81
  194. package/operators/_product.yaml +0 -59
  195. package/operators/_random.yaml +0 -104
  196. package/operators/_ref.yaml +0 -266
  197. package/operators/_regex.yaml +0 -83
  198. package/operators/_request.yaml +0 -50
  199. package/operators/_secret.yaml +0 -74
  200. package/operators/_state.yaml +0 -114
  201. package/operators/_string.yaml +0 -283
  202. package/operators/_subtract.yaml +0 -38
  203. package/operators/_sum.yaml +0 -59
  204. package/operators/_switch.yaml +0 -51
  205. package/operators/_type.yaml +0 -92
  206. package/operators/_uri.yaml +0 -56
  207. package/operators/_url_query.yaml +0 -120
  208. package/operators/_user.yaml +0 -107
  209. package/operators/_uuid.yaml +0 -114
  210. package/operators/_var.yaml +0 -105
  211. package/operators/_yaml.yaml +0 -107
  212. package/pages.yaml +0 -227
  213. package/public/images/authors/gervwyk.jpeg +0 -0
  214. package/public/images/authors/sandile.jpeg +0 -0
  215. package/public/images/howto/header_generate_csv.jpg +0 -0
  216. package/public/images/howto/header_generate_pdf.jpg +0 -0
  217. package/public/logo_example.png +0 -0
  218. package/public/lowdefy_app_schema.png +0 -0
  219. package/public/modules/csvMake.js +0 -27
  220. package/public/modules/filterDefaultValue.js +0 -48
  221. package/public/modules/importUmd.js +0 -7
  222. package/public/modules/index.js +0 -5
  223. package/public/modules/pdfMake.js +0 -7
  224. package/public/modules/test/filterDefaultValue.test.js +0 -91
  225. package/public/modules/vfs_fonts.js +0 -12
  226. package/public/sitemap.xml +0 -1024
  227. package/templates/actions.yaml.njk +0 -68
  228. package/templates/blocks/defaultValueTransformer.js +0 -53
  229. package/templates/blocks/exampleTransformer.js +0 -81
  230. package/templates/blocks/layout.yaml +0 -114
  231. package/templates/blocks/propertiesFormTransformer.js +0 -419
  232. package/templates/blocks/propertiesGetterTransformer.js +0 -132
  233. package/templates/blocks/schema.yaml.njk +0 -42
  234. package/templates/blocks/style.yaml +0 -26
  235. package/templates/blocks/template.yaml.njk +0 -495
  236. package/templates/blog.yaml.njk +0 -221
  237. package/templates/cli_command.yaml.njk +0 -37
  238. package/templates/footer.yaml.njk +0 -604
  239. package/templates/general.yaml.njk +0 -124
  240. package/templates/generateSitemap.js +0 -41
  241. package/templates/header.yaml +0 -138
  242. package/templates/navigation_buttons.yaml +0 -68
  243. package/templates/operators.yaml.njk +0 -82
  244. package/templates/operatorsMethodTransformer.js +0 -119
  245. package/templates/test/array.test.js +0 -1335
  246. package/templates/test/boolean.test.js +0 -98
  247. package/templates/test/button.test.js +0 -166
  248. package/templates/test/color.test.js +0 -126
  249. package/templates/test/enum.test.js +0 -105
  250. package/templates/test/icon.test.js +0 -109
  251. package/templates/test/integer.test.js +0 -99
  252. package/templates/test/manual.test.js +0 -238
  253. package/templates/test/number.test.js +0 -99
  254. package/templates/test/object.test.js +0 -434
  255. package/templates/test/oneOf.test.js +0 -794
  256. package/templates/test/string.test.js +0 -98
  257. package/templates/test/yaml.test.js +0 -605
  258. package/tutorial/next-steps.yaml +0 -83
  259. package/tutorial/tutorial-actions-operators-config.yaml +0 -142
  260. package/tutorial/tutorial-actions-operators.yaml +0 -436
  261. package/tutorial/tutorial-add-blocks-config.yaml +0 -109
  262. package/tutorial/tutorial-add-blocks.yaml +0 -195
  263. package/tutorial/tutorial-create-page-config.yaml +0 -77
  264. package/tutorial/tutorial-create-page.yaml +0 -196
  265. package/tutorial/tutorial-deploy.yaml +0 -146
  266. package/tutorial/tutorial-requests-config.yaml +0 -186
  267. package/tutorial/tutorial-requests.yaml +0 -338
  268. package/tutorial/tutorial-start.yaml +0 -282
  269. package/users/login-and-logout.yaml +0 -164
  270. package/users/openid-connect.yaml +0 -84
  271. package/users/protected-pages.yaml +0 -67
  272. package/users/roles.yaml +0 -70
  273. package/users/user-object.yaml +0 -73
  274. package/users/users-introduction.yaml +0 -80
  275. package/version.yaml +0 -1
@@ -1,146 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/general.yaml.njk
17
- vars:
18
- pageId: tutorial-deploy
19
- pageTitle: 6. Deploy to Netlify
20
- section: Tutorial
21
- filePath: tutorial/tutorial-deploy.yaml
22
- prefetchPages:
23
- - next-steps
24
- content:
25
- - id: tutorial_video
26
- type: DangerousMarkdown
27
- properties:
28
- DOMPurifyOptions:
29
- ADD_TAGS:
30
- - iframe
31
- ADD_ATTR:
32
- - allowfullscreen
33
- - allow
34
- - frameborder
35
- content: |
36
- <iframe
37
- width="800"
38
- height="470"
39
- src="https://www.youtube.com/embed/VPUYzywryuQ" frameborder="0"
40
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
41
- </iframe>
42
- - id: body_requirements
43
- type: MarkdownWithCode
44
- properties:
45
- content: |
46
- [Netlify](https://www.netlify.com) is a web app hosting service that is a great match for Lowdefy. They have great integrations with GitHub, GitLab, and Bitbucket, which make it easy to set up a continuous deployment process to deploy your apps.
47
-
48
- ### Requirements
49
-
50
- You will need to have the following:
51
-
52
- - A Github account. You can create one [here](https://github.com/join).
53
- - A Netlify account. You can create one [here](https://app.netlify.com/signup). It is easiest if you sign up with your Github account.
54
- - [`git`](https://git-scm.com/downloads) version control installed on your computer.
55
-
56
- #### Step 6.1 - Create a Github repository
57
-
58
- Create a new Github repository. You can do that [here](https://github.com/new). Do not initialize the repository with a `.gitignore`, `README`, or licence file.
59
-
60
- #### Step 6.2 - Add your files to the repository
61
-
62
- Run the `git` commands to create a new repository on the command line:
63
-
64
- ```bash
65
- git init
66
- git add .
67
- git commit -m "Initial commit"
68
- git branch -M main
69
- git remote add origin https://github.com/__GITHUB_USERNAME__/__REPO_NAME__.git
70
- git push -u origin main
71
- ```
72
-
73
- If you refresh your browser, you should see the `lowdefy.yaml` and `.gitignore` files in the repository.
74
-
75
- #### Step 6.3 - Link your Github project to Netlify.
76
-
77
- - Once logged in to Netlify, click the "New site from git" button.
78
- - Choose Github, and authorize Netlify to access your repositories.
79
- - Select your repository.
80
-
81
- - id: info_configure_repo
82
- type: Alert
83
- properties:
84
- type: info
85
- icon: AiFilledInfoCircle
86
- description: If your repository isn't found, click "Configure Netlify on Github", and give Netlify access to your repository.
87
-
88
- - id: body_configure_netlify
89
- type: MarkdownWithCode
90
- properties:
91
- content: |
92
- #### Step 6.4 - Configure your Netlify deployment.
93
-
94
- - Set your build command to `npx lowdefy@latest build-netlify`.
95
- - Set your publish directory to `.lowdefy/publish`.
96
- - Review the other settings, and deploy your site
97
-
98
- - id: warning_configure_functions
99
- type: Alert
100
- properties:
101
- type: warning
102
- icon: AiFilledWarning
103
- description: Your site won't work yet. You first need to configure the Lowdefy server in the next step.
104
-
105
- - id: body_configure_functions
106
- type: MarkdownWithCode
107
- properties:
108
- content: |
109
- #### Step 6.5 - Configure the Lowdefy server.
110
-
111
- - Click the "Site settings" button.
112
- - Choose the "Functions" section in the left menu.
113
- - Edit the settings and set your functions directory to `.lowdefy/functions`.
114
-
115
- #### Step 6.6 - Add your Google Sheets credentials
116
-
117
- Go to "Site settings", then "Build and deploy" in the left menu. Scroll down and select "Edit variables" in the "Environment" section.
118
-
119
- Set the variables `LOWDEFY_SECRET_SHEETS_CLIENT_EMAIL` and `LOWDEFY_SECRET_SHEETS_PRIVATE_KEY` to the same values as in your `.env` file.
120
-
121
- #### Step 6.7 - Redeploy your site
122
-
123
- - Go to the "Deploys" tab.
124
- - Click the "Trigger deploy" button and deploy your site.
125
- - Wait for you site to finish deploying.
126
-
127
- #### Step 6.8 - Enjoy your app
128
-
129
- Go to your shiny new app. On the "Site overview" tab you will find your site url. Go to this url and you should see your app.
130
-
131
- #### Step 6.9 - Try out Netlify's deploy preview.
132
-
133
- Edit the `lowdefy.yaml` file on Github. Commit the changes on a new branch, and create a pull request. Netlify will run checks on your pull request, and generate a deploy preview. Once the deploy preview has finished building, you can click on the "details" link and this will take you to preview of your changes.
134
-
135
- ### Up next
136
-
137
- This is the end of the tutorial. If you have any feedback or suggestions, we would greatly appreciate that. You can start a new discussion [here](https://github.com/lowdefy/lowdefy/discussions).
138
-
139
- Our next steps will show you some of the things you could do next.
140
- - _ref:
141
- path: templates/navigation_buttons.yaml
142
- vars:
143
- previous_page_title: Requests
144
- previous_page_id: tutorial-requests
145
- next_page_title: Next steps
146
- next_page_id: next-steps
@@ -1,186 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/general.yaml.njk
17
- vars:
18
- pageId: tutorial-requests-config
19
- pageTitle: Requests config
20
- section: Tutorial
21
- filePath: tutorial/tutorial-requests-config.yaml
22
- content:
23
- - id: body_config
24
- type: MarkdownWithCode
25
- properties:
26
- content: |
27
- ##### `.env`
28
- ```
29
- LOWDEFY_SECRET_SHEETS_CLIENT_EMAIL=__YOUR_CLIENT_EMAIL__
30
- LOWDEFY_SECRET_SHEETS_PRIVATE_KEY=__YOUR_ENCODED_PRIVATE_KEY__
31
- ```
32
-
33
- ##### `lowdefy.yaml`
34
- ```yaml
35
- name: lowdefy-project-template
36
- version: CURRENT_LOWDEFY_VERSION
37
-
38
- connections:
39
- - id: google_sheet
40
- type: GoogleSheet
41
- properties:
42
- client_email:
43
- _secret: SHEETS_CLIENT_EMAIL
44
- private_key:
45
- _base64.decode:
46
- _secret: SHEETS_PRIVATE_KEY
47
- sheetIndex: 0
48
- spreadsheetId: __YOUR_SPREADSHEET_ID__
49
- write: true
50
-
51
- menus:
52
- - id: default
53
- links:
54
- - id: new-ticket
55
- type: MenuLink
56
- properties:
57
- icon: AiOutlinedAlert
58
- title: New ticket
59
- pageId: new-ticket
60
- - id: welcome
61
- type: MenuLink
62
- properties:
63
- icon: AiOutlinedHome
64
- title: Home
65
- pageId: welcome
66
-
67
- pages:
68
- - _ref: new-ticket.yaml
69
- - id: welcome
70
- type: PageHeaderMenu
71
- #...
72
- ```
73
-
74
- ##### `new-ticket.yaml`
75
- ```yaml
76
- id: new-ticket
77
- type: PageHeaderMenu
78
-
79
- requests:
80
- - id: save_data
81
- type: GoogleSheetAppendOne
82
- connectionId: google_sheet
83
- properties:
84
- row:
85
- # Get all the values to save from state
86
- ticket_title:
87
- _state: ticket_title
88
- ticket_type:
89
- _state: ticket_type
90
- ticket_description:
91
- _state: ticket_description
92
- confirm_restart:
93
- _state: confirm_restart
94
- # Add the date the row was created using the `_date.now` operator.
95
- created_date:
96
- _date: now
97
-
98
- properties:
99
- title: New ticket # The title in the browser tab.
100
- layout:
101
- contentJustify: center # Center the contents of the page.
102
- blocks:
103
- - id: content_card
104
- type: Card
105
- layout:
106
- size: 800 # Set the size of the card so it does not fill the full screen.
107
- contentGutter: 16 # Make a 16px gap between all blocks in this card.
108
- blocks:
109
- - id: page_heading
110
- type: Title
111
- required: true
112
- properties:
113
- content: Log a ticket # Change the title on the page.
114
- level: 3 # Make the title a little smaller (an html `<h3>`).
115
- - id: ticket_title
116
- type: TextInput
117
- required: true
118
- properties:
119
- title: Title
120
- - id: ticket_type
121
- type: ButtonSelector
122
- required: true
123
- properties:
124
- title: Ticket type
125
- options: # Set the allowed options
126
- - Feature request
127
- - Bug report
128
- - Question
129
- - id: ticket_description
130
- type: TextArea
131
- properties:
132
- title: Description
133
- - id: confirm_restart
134
- type: ButtonSelector
135
- visible: # Test if block should be visible to the user
136
- _eq: # Equals operator
137
- - _state: ticket_type # Get the ticket_type value from state.
138
- - Bug report
139
- validate:
140
- # Show a warning that shows before validate is called
141
- # and does not block Validate action.
142
- - status: warning
143
- message: If you did not restart your device, we will ask you to restart it.
144
- pass:
145
- _eq:
146
- - _state: confirm_restart
147
- - Yes
148
- properties:
149
- title: Did you restart your device?
150
- label:
151
- colon: false # Hide the label colon
152
- options:
153
- - Yes
154
- - No
155
- - id: reset_button
156
- type: Button
157
- layout:
158
- span: 12 # Set the size of the button (span 12 of 24 columns)
159
- properties:
160
- title: Reset
161
- block: true # Make the button fill all the space available to it
162
- type: default # Make the button a plain button
163
- icon: AiOutlinedClear
164
- events:
165
- onClick:
166
- - id: reset
167
- type: Reset
168
- - id: submit_button
169
- type: Button
170
- layout:
171
- span: 12
172
- properties:
173
- title: Submit
174
- block: true
175
- type: primary # Make the button a primary button with color
176
- icon: AiOutlinedSave
177
- events:
178
- onClick:
179
- - id: validate
180
- type: Validate
181
- - id: save_data # Make a request to Google Sheets
182
- type: Request
183
- params: save_data
184
- - id: reset # Reset the form once data has been submitted
185
- type: Reset
186
- ```
@@ -1,338 +0,0 @@
1
- # Copyright 2020-2021 Lowdefy, Inc
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
-
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- _ref:
16
- path: templates/general.yaml.njk
17
- vars:
18
- pageId: tutorial-requests
19
- pageTitle: 5. Requests
20
- section: Tutorial
21
- filePath: tutorial/tutorial-requests.yaml
22
- prefetchPages:
23
- - tutorial-deploy
24
- content:
25
- - id: body_google_cloud
26
- type: MarkdownWithCode
27
- properties:
28
- content: |
29
- We will be saving the data from our form in a Google Sheet, using the [`GoogleSheet`](/GoogleSheet) connection. To do this, we will first need to set up a Google Cloud Platform project to get credentials to access the API.
30
-
31
- ### Creating a Google Sheet and getting credentials
32
-
33
- #### Step 5.1
34
-
35
- Go to [Google Sheets](https://docs.google.com/spreadsheets) and create a new Google Sheet.
36
-
37
- #### Step 5.2
38
-
39
- Go to [console.cloud.google.com](https://console.cloud.google.com) and sign in.
40
-
41
- #### Step 5.3
42
-
43
- Click on the "Select a project" dropdown at the top left, and then choose "NEW PROJECT". Give your project a name and click "Create".
44
-
45
- #### Step 5.4
46
-
47
- Go to the "APIs and Services" section, and the click "ENABLE APIS AND SERVICES" button.
48
-
49
- #### Step 5.5
50
-
51
- Search for "Sheets" and select the Google Sheets API.
52
-
53
- #### Step 5.6
54
-
55
- Click "Enable".
56
-
57
- #### Step 5.7
58
-
59
- Click "CREATE CREDENTIALS".
60
-
61
- #### Step 5.8
62
-
63
- Choose the following:
64
- - **Which API are you using?**: Google Sheets API
65
- - **Where will you be calling the API from?** : Web server (e.g. node.js, Tomcat)
66
- - **What data will you be accessing?**: Application data
67
- - **Are you planning to use this API with App Engine or Compute Engine?**: No, I'm not using them
68
-
69
- Then click "What credentials do I need?"
70
-
71
- #### Step 5.9
72
-
73
- Choose the following:
74
- - Give the account a name.
75
- - Chose "Project > Editor" as the role.
76
- - Choose JSON as the key type.
77
-
78
- Click continue.
79
-
80
- #### Step 5.10
81
-
82
- You will be asked to save a file. This file contains the credentials to access your sheet, so make sure to handle it securely. Download the file. Do not commit it to source control.
83
-
84
- #### Step 5.11
85
-
86
- In the next section we will be deploying our app using Netlify. To use the private key on Netlify, we need to base64 encode it, since the new-line characters cause problems when used in an environment variable.
87
-
88
- You can use the converter below to convert your key. This will output a long stream of characters that are your encoded key.
89
-
90
- > The base64 conversion happens on the web client. We won't store your key. You can look at how the key is encoded [here](https://github.com/lowdefy/lowdefy/blob/main/packages/docs/tutorial/tutorial-requests.yaml) or convert your key in the browser console using [btoa()](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa).
91
-
92
- # Because of weird layout with flex
93
- - id: base_64_box
94
- type: Box
95
- layout:
96
- contentGutter: 16
97
- blocks:
98
- - id: base64_input
99
- type: TextInput
100
- layout:
101
- flex: 1 1 auto
102
- properties:
103
- label:
104
- disabled: true
105
- placeholder: Paste your key here (without quotes)
106
-
107
- - id: base64_encode_button
108
- type: Button
109
- layout:
110
- flex: 0 1 auto
111
- properties:
112
- title: Encode
113
- events:
114
- onClick:
115
- - id: convert_key
116
- type: SetState
117
- params:
118
- base64_ouput:
119
- _base64.encode:
120
- _string.replace:
121
- on:
122
- _state: base64_input
123
- regex: "\\\\n"
124
- newSubstr: "\n"
125
- regexFlags: g
126
-
127
- - id: base64_output
128
- type: Paragraph
129
- style:
130
- maxWidth: 600px
131
- visible:
132
- _not:
133
- _eq:
134
- - _state: base64_ouput
135
- - null
136
- properties:
137
- code: true
138
- copyable: true
139
- content:
140
- _state: base64_ouput
141
-
142
- - id: warning_base64
143
- type: Alert
144
- properties:
145
- type: warning
146
- icon: AiFilledWarning
147
- description: By base64 encoding your credentials you have not encrypted them. They are still just as sensitive as before.
148
-
149
- - id: body_env
150
- type: MarkdownWithCode
151
- properties:
152
- content: |
153
- #### Step 5.12
154
-
155
- Create a file called `.env` in your project directory with the following:
156
-
157
- ##### `.env`
158
- ```
159
- LOWDEFY_SECRET_SHEETS_CLIENT_EMAIL=__YOUR_CLIENT_EMAIL__
160
- LOWDEFY_SECRET_SHEETS_PRIVATE_KEY=__YOUR_ENCODED_PRIVATE_KEY__
161
- ```
162
-
163
- Fill in the client email from the credentials file and your encoded private key values (without quotes). This will give the development server access to these secrets.
164
-
165
- - id: warning_dont_commit
166
- type: Alert
167
- properties:
168
- type: warning
169
- icon: AiFilledWarning
170
- description: The .env file contains your credentials. Do not commit this file to git. It should be listed in your .gitignore file if you used the CLI init command.
171
-
172
- - id: body_use_connection
173
- type: MarkdownWithCode
174
- properties:
175
- content: |
176
- #### Step 5.13
177
-
178
- Because we changed the environment variables, we need to restart the dev server. Run `npx lowdefy@latest dev` again to restart the server.
179
-
180
- #### Step 5.14
181
-
182
- We need to give our service account access to our Google Sheet. Go to your Google Sheet and click the "Share" button. Share the sheet with the client email of the service account we just created, with the "Editor" role.
183
-
184
- ### What happened
185
-
186
- We created a Google Cloud Platform (GCP) project, and created a service account in that project that we can use to access Google sheets. This gave us the credentials we need for the [`GoogleSheet`](/GoogleSheet) connection.
187
-
188
- We set up these credentials for our local dev environment using a `.env` file. The `.env` file sets [environment variables](https://en.wikipedia.org/wiki/Environment_variable) in the process the server is running in.
189
-
190
- Because we set environment variables that start with `LOWDEFY_SECRET_`, these values become part of the [`secrets`](/Secrets) object, and can be accessed using the [`_secret`](/_secret) operator.
191
-
192
- ### Using the Google Sheets connection
193
-
194
- #### Step 5.15
195
-
196
- To use a Google Sheet with the Lowdefy connection, we first need to define the columns in the sheet. This will be the same fields as the data we will be saving later.
197
-
198
- In the first row of your sheet, add the following column headers:
199
-
200
- - ticket_title
201
- - ticket_type
202
- - ticket_description
203
- - confirm_restart
204
- - created_date
205
-
206
- #### Step 5.16
207
-
208
- In your `lowdefy.yaml` file, add the following:
209
-
210
- ##### `lowdefy.yaml`
211
-
212
- ```yaml
213
- name: lowdefy-project-template
214
- version: CURRENT_LOWDEFY_VERSION
215
-
216
- ################ -------- Copy from here -------- ################
217
- connections:
218
- - id: google_sheet
219
- type: GoogleSheet
220
- properties:
221
- client_email:
222
- _secret: SHEETS_CLIENT_EMAIL
223
- private_key:
224
- _base64.decode:
225
- _secret: SHEETS_PRIVATE_KEY
226
- sheetIndex: 0
227
- spreadsheetId: __YOUR_SPREADSHEET_ID__
228
- write: true
229
- ################ ------- Copy to here ----------- ################
230
-
231
- menus:
232
- # ...
233
- ```
234
-
235
- #### Step 5.17
236
-
237
- Note down your spreadsheetId. You can find this by looking at the url in your browser when you are looking at your sheet. It should look something like:
238
-
239
- `https://docs.google.com/spreadsheets/d/{spreadsheetId}/edit#gid=0`
240
-
241
- where the spreadsheetId is a 44 character random string. Fill in your spreadsheetId in the spreadsheet connection.
242
-
243
- #### Step 5.18
244
-
245
- In your `new-ticket.yaml` file, add the following request:
246
-
247
- ##### `pages/new-ticket.yaml`
248
-
249
- ```yaml
250
- id: new-ticket
251
- type: PageHeaderMenu
252
- ################ -------- Copy from here -------- ################
253
- requests:
254
- - id: save_data
255
- type: GoogleSheetAppendOne
256
- connectionId: google_sheet
257
- properties:
258
- row:
259
- # Get all the values to save from state
260
- ticket_title:
261
- _state: ticket_title
262
- ticket_type:
263
- _state: ticket_type
264
- ticket_description:
265
- _state: ticket_description
266
- confirm_restart:
267
- _state: confirm_restart
268
- # Add the date the row was created using the `_date.now` operator.
269
- created_date:
270
- _date: now
271
- ################ ------- Copy to here ----------- ################
272
-
273
- properties:
274
- title: New ticket # The title in the browser tab.
275
- layout:
276
- contentJustify: center # Center the contents of the page
277
- blocks:
278
- # ...
279
- ```
280
-
281
- #### Step 5.19
282
-
283
- In your `new-ticket.yaml` file, add the following action to the submit button:
284
-
285
- ##### `pages/new-ticket.yaml`
286
-
287
- ```yaml
288
- id: new-ticket
289
- # ...
290
- blocks:
291
- - id: content_card
292
- # ...
293
- blocks:
294
- - id: page_heading
295
- # ...
296
- # ...
297
- # ...
298
- - id: submit_button
299
- type: Button
300
- #...
301
- events:
302
- onClick:
303
- - id: validate
304
- type: Validate
305
- ################ -------- Copy from here -------- ################
306
- - id: save_data # Make a request to Google Sheets
307
- type: Request
308
- params: save_data
309
- - id: reset # Reset the form once data has been submitted
310
- type: Reset
311
- ################ ------- Copy to here ----------- ################
312
- ```
313
-
314
- #### Step 5.20
315
-
316
- If you click the submit button, you should see your data submitted to your Google Sheet.
317
-
318
- ### What happened
319
-
320
- We set up the column names we will be using in our Google Sheet. We need to do this to use the `GoogleSheet` connection.
321
-
322
- We defined the `GoogleSheet` connection we will be using in our app, using the credentials we obtained earlier.
323
-
324
- We also defined a `GoogleSheetAppendOne` request, to save the data to our sheet, and called that request when clicking the submit button.
325
-
326
- > You can find the final configuration files for this section [here](tutorial-requests-config).
327
-
328
- ### Up next
329
-
330
- Up next we will be deploying our app using Netlify. Then it will be live, on the internet, for anyone to see 🚀.
331
-
332
- - _ref:
333
- path: templates/navigation_buttons.yaml
334
- vars:
335
- previous_page_title: Interactive pages
336
- previous_page_id: tutorial-actions-operators
337
- next_page_title: Deploy to Netlify
338
- next_page_id: tutorial-deploy