ezii-postgres 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +7 -0
  2. data/ezii-postgres.gemspec +13 -0
  3. data/natural-backend/Capfile +50 -0
  4. data/natural-backend/Gemfile +63 -0
  5. data/natural-backend/Gemfile.lock +233 -0
  6. data/natural-backend/LICENSE +21 -0
  7. data/natural-backend/Procfile +2 -0
  8. data/natural-backend/README.md +51 -0
  9. data/natural-backend/Rakefile +6 -0
  10. data/natural-backend/app.json +28 -0
  11. data/natural-backend/app/channels/application_cable/channel.rb +4 -0
  12. data/natural-backend/app/channels/application_cable/connection.rb +4 -0
  13. data/natural-backend/app/commands/base_command.rb +31 -0
  14. data/natural-backend/app/commands/create_new_or_authenticate_user.rb +60 -0
  15. data/natural-backend/app/commands/create_project_authentication_token_command.rb +25 -0
  16. data/natural-backend/app/commands/decode_authentication_command.rb +50 -0
  17. data/natural-backend/app/commands/decode_project_authentication_token_command.rb +51 -0
  18. data/natural-backend/app/controllers/application_controller.rb +3 -0
  19. data/natural-backend/app/controllers/authentication_controller.rb +17 -0
  20. data/natural-backend/app/controllers/columns_controller.rb +51 -0
  21. data/natural-backend/app/controllers/concerns/token_authenticatable.rb +26 -0
  22. data/natural-backend/app/controllers/databases_controller.rb +51 -0
  23. data/natural-backend/app/controllers/ember_controller.rb +6 -0
  24. data/natural-backend/app/controllers/projects_controller.rb +51 -0
  25. data/natural-backend/app/controllers/queries_controller.rb +59 -0
  26. data/natural-backend/app/controllers/row_values_controller.rb +51 -0
  27. data/natural-backend/app/controllers/rows_controller.rb +56 -0
  28. data/natural-backend/app/controllers/tables_controller.rb +55 -0
  29. data/natural-backend/app/jobs/application_job.rb +2 -0
  30. data/natural-backend/app/jobs/create_column_job.rb +10 -0
  31. data/natural-backend/app/jobs/create_database_job.rb +11 -0
  32. data/natural-backend/app/jobs/create_database_user_job.rb +8 -0
  33. data/natural-backend/app/jobs/create_table_job.rb +21 -0
  34. data/natural-backend/app/jobs/delete_row_job.rb +12 -0
  35. data/natural-backend/app/jobs/delete_value_job.rb +10 -0
  36. data/natural-backend/app/jobs/destroy_column_job.rb +10 -0
  37. data/natural-backend/app/jobs/destroy_database_job.rb +8 -0
  38. data/natural-backend/app/jobs/destroy_database_user_job.rb +8 -0
  39. data/natural-backend/app/jobs/destroy_table_job.rb +9 -0
  40. data/natural-backend/app/jobs/insert_value_job.rb +11 -0
  41. data/natural-backend/app/jobs/run_query_job.rb +35 -0
  42. data/natural-backend/app/jobs/sync_db_job.rb +80 -0
  43. data/natural-backend/app/jobs/update_column_type_job.rb +10 -0
  44. data/natural-backend/app/jobs/update_value_job.rb +10 -0
  45. data/natural-backend/app/mailers/application_mailer.rb +4 -0
  46. data/natural-backend/app/models/application_record.rb +3 -0
  47. data/natural-backend/app/models/column.rb +43 -0
  48. data/natural-backend/app/models/database.rb +37 -0
  49. data/natural-backend/app/models/project.rb +31 -0
  50. data/natural-backend/app/models/query.rb +20 -0
  51. data/natural-backend/app/models/row.rb +15 -0
  52. data/natural-backend/app/models/row_value.rb +30 -0
  53. data/natural-backend/app/models/table.rb +32 -0
  54. data/natural-backend/app/models/user.rb +10 -0
  55. data/natural-backend/app/serializers/column_serializer.rb +5 -0
  56. data/natural-backend/app/serializers/database_serializer.rb +6 -0
  57. data/natural-backend/app/serializers/project_serializer.rb +4 -0
  58. data/natural-backend/app/serializers/query_serializer.rb +3 -0
  59. data/natural-backend/app/serializers/row_serializer.rb +5 -0
  60. data/natural-backend/app/serializers/row_value_serializer.rb +5 -0
  61. data/natural-backend/app/serializers/table_serializer.rb +8 -0
  62. data/natural-backend/app/services/jwt_service.rb +17 -0
  63. data/natural-backend/app/views/layouts/mailer.html.erb +13 -0
  64. data/natural-backend/app/views/layouts/mailer.text.erb +1 -0
  65. data/natural-backend/bin/bundle +3 -0
  66. data/natural-backend/bin/rails +9 -0
  67. data/natural-backend/bin/rake +9 -0
  68. data/natural-backend/bin/run_migrations.sh +3 -0
  69. data/natural-backend/bin/setup +35 -0
  70. data/natural-backend/bin/spring +17 -0
  71. data/natural-backend/bin/update +29 -0
  72. data/natural-backend/config.ru +5 -0
  73. data/natural-backend/config/application.rb +33 -0
  74. data/natural-backend/config/boot.rb +3 -0
  75. data/natural-backend/config/cable.yml +10 -0
  76. data/natural-backend/config/database.yml +21 -0
  77. data/natural-backend/config/deploy.rb +36 -0
  78. data/natural-backend/config/deploy/production.rb +61 -0
  79. data/natural-backend/config/deploy/staging.rb +61 -0
  80. data/natural-backend/config/environment.rb +5 -0
  81. data/natural-backend/config/environments/development.rb +47 -0
  82. data/natural-backend/config/environments/production.rb +83 -0
  83. data/natural-backend/config/environments/test.rb +42 -0
  84. data/natural-backend/config/initializers/application_controller_renderer.rb +8 -0
  85. data/natural-backend/config/initializers/backtrace_silencers.rb +7 -0
  86. data/natural-backend/config/initializers/bugsnag.rb +3 -0
  87. data/natural-backend/config/initializers/cors.rb +16 -0
  88. data/natural-backend/config/initializers/filter_parameter_logging.rb +4 -0
  89. data/natural-backend/config/initializers/inflections.rb +16 -0
  90. data/natural-backend/config/initializers/json_api.rb +5 -0
  91. data/natural-backend/config/initializers/load_commands.rb +4 -0
  92. data/natural-backend/config/initializers/load_lib.rb +6 -0
  93. data/natural-backend/config/initializers/mime_types.rb +4 -0
  94. data/natural-backend/config/initializers/redis_classy.rb +1 -0
  95. data/natural-backend/config/initializers/sidekiq.rb +1 -0
  96. data/natural-backend/config/initializers/wrap_parameters.rb +14 -0
  97. data/natural-backend/config/locales/en.yml +33 -0
  98. data/natural-backend/config/puma.rb +56 -0
  99. data/natural-backend/config/routes.rb +14 -0
  100. data/natural-backend/config/schedule.rb +18 -0
  101. data/natural-backend/config/secrets.yml +32 -0
  102. data/natural-backend/config/spring.rb +6 -0
  103. data/natural-backend/db/migrate/20180408155000_create_projects.rb +9 -0
  104. data/natural-backend/db/migrate/20180408155011_create_databases.rb +10 -0
  105. data/natural-backend/db/migrate/20180409174859_create_tables.rb +9 -0
  106. data/natural-backend/db/migrate/20180409174916_create_columns.rb +11 -0
  107. data/natural-backend/db/migrate/20180409175800_create_rows.rb +9 -0
  108. data/natural-backend/db/migrate/20180409214650_create_row_values.rb +11 -0
  109. data/natural-backend/db/migrate/20180411110745_add_db_username_to_projects.rb +5 -0
  110. data/natural-backend/db/migrate/20180411145722_add_dbpw_to_projects.rb +5 -0
  111. data/natural-backend/db/migrate/20180411185924_add_database_identifier_to_databases.rb +6 -0
  112. data/natural-backend/db/migrate/20180412002908_add_dbid_to_rows.rb +5 -0
  113. data/natural-backend/db/migrate/20180412012433_create_queries.rb +11 -0
  114. data/natural-backend/db/migrate/20180429151758_create_users.rb +10 -0
  115. data/natural-backend/db/migrate/20180430094604_add_user_ref_to_projects.rb +5 -0
  116. data/natural-backend/db/migrate/20180430102945_add_user_ref_to_databases.rb +5 -0
  117. data/natural-backend/db/migrate/20180430102955_add_user_ref_to_tables.rb +5 -0
  118. data/natural-backend/db/migrate/20180430103004_add_user_ref_to_rows.rb +5 -0
  119. data/natural-backend/db/migrate/20180430103015_add_user_ref_to_columns.rb +5 -0
  120. data/natural-backend/db/migrate/20180430103024_add_user_ref_to_row_values.rb +5 -0
  121. data/natural-backend/db/migrate/20180430141537_add_api_token_projects.rb +5 -0
  122. data/natural-backend/db/schema.rb +112 -0
  123. data/natural-backend/db/seeds.rb +7 -0
  124. data/natural-backend/lib/database_manager/database_manager.rb +59 -0
  125. data/natural-backend/lib/database_manager/lib/connection.rb +49 -0
  126. data/natural-backend/lib/database_manager/lib/database.rb +65 -0
  127. data/natural-backend/lib/database_manager/lib/database_user.rb +46 -0
  128. data/natural-backend/lib/database_manager/lib/table.rb +129 -0
  129. data/natural-backend/public/assets/natural-frontend-598145a86019fc7faa2e0386ec6cb276.css +6 -0
  130. data/natural-backend/public/assets/natural-frontend-8e453ff9db7fc3a47e6d9e3de45aa19e.js +31 -0
  131. data/natural-backend/public/assets/vendor-7ffaee0528b64f886e9d1860fc719b5a.js +7359 -0
  132. data/natural-backend/public/assets/vendor-8bd8fa913b4f7f8b27f086c7bfd98b7f.css +1 -0
  133. data/natural-backend/public/index.html +26 -0
  134. data/natural-backend/public/robots.txt +3 -0
  135. data/natural-backend/roadmap.md +25 -0
  136. data/natural-backend/test/controllers/authentication_controller_test.rb +7 -0
  137. data/natural-backend/test/controllers/columns_controller_test.rb +38 -0
  138. data/natural-backend/test/controllers/databases_controller_test.rb +38 -0
  139. data/natural-backend/test/controllers/ember_controller_test.rb +7 -0
  140. data/natural-backend/test/controllers/projects_controller_test.rb +38 -0
  141. data/natural-backend/test/controllers/queries_controller_test.rb +38 -0
  142. data/natural-backend/test/controllers/row_values_controller_test.rb +38 -0
  143. data/natural-backend/test/controllers/rows_controller_test.rb +38 -0
  144. data/natural-backend/test/controllers/tables_controller_test.rb +38 -0
  145. data/natural-backend/test/fixtures/columns.yml +11 -0
  146. data/natural-backend/test/fixtures/databases.yml +9 -0
  147. data/natural-backend/test/fixtures/projects.yml +7 -0
  148. data/natural-backend/test/fixtures/queries.yml +9 -0
  149. data/natural-backend/test/fixtures/row_values.yml +11 -0
  150. data/natural-backend/test/fixtures/rows.yml +7 -0
  151. data/natural-backend/test/fixtures/tables.yml +7 -0
  152. data/natural-backend/test/fixtures/users.yml +9 -0
  153. data/natural-backend/test/jobs/add_column_job_test.rb +7 -0
  154. data/natural-backend/test/jobs/create_database_job_test.rb +7 -0
  155. data/natural-backend/test/jobs/create_database_user_job_test.rb +7 -0
  156. data/natural-backend/test/jobs/create_table_job_test.rb +7 -0
  157. data/natural-backend/test/jobs/delete_row_job_test.rb +7 -0
  158. data/natural-backend/test/jobs/delete_value_job_test.rb +7 -0
  159. data/natural-backend/test/jobs/destroy_database_job_test.rb +7 -0
  160. data/natural-backend/test/jobs/destroy_database_user_job_test.rb +7 -0
  161. data/natural-backend/test/jobs/destroy_table_job_test.rb +7 -0
  162. data/natural-backend/test/jobs/insert_value_job_test.rb +7 -0
  163. data/natural-backend/test/jobs/run_query_job_test.rb +7 -0
  164. data/natural-backend/test/jobs/sync_db_job_test.rb +7 -0
  165. data/natural-backend/test/jobs/update_value_job_test.rb +7 -0
  166. data/natural-backend/test/lib/database_manager/database_manager_test.rb +21 -0
  167. data/natural-backend/test/lib/database_manager/lib/database_test.rb +28 -0
  168. data/natural-backend/test/lib/database_manager/lib/database_user_test.rb +43 -0
  169. data/natural-backend/test/lib/database_manager/lib/table_test.rb +46 -0
  170. data/natural-backend/test/models/column_test.rb +7 -0
  171. data/natural-backend/test/models/database_test.rb +7 -0
  172. data/natural-backend/test/models/project_test.rb +7 -0
  173. data/natural-backend/test/models/query_test.rb +7 -0
  174. data/natural-backend/test/models/row_test.rb +7 -0
  175. data/natural-backend/test/models/row_value_test.rb +7 -0
  176. data/natural-backend/test/models/table_test.rb +7 -0
  177. data/natural-backend/test/models/user_test.rb +7 -0
  178. data/natural-backend/test/test_helper.rb +10 -0
  179. data/natural-frontend/LICENSE +21 -0
  180. data/natural-frontend/README.md +3 -0
  181. data/natural-frontend/app/adapters/application.js +33 -0
  182. data/natural-frontend/app/app.js +18 -0
  183. data/natural-frontend/app/components/column-editor.js +41 -0
  184. data/natural-frontend/app/components/row-editor.js +21 -0
  185. data/natural-frontend/app/components/row-value-editor.js +49 -0
  186. data/natural-frontend/app/controllers/application.js +11 -0
  187. data/natural-frontend/app/controllers/authenticate.js +16 -0
  188. data/natural-frontend/app/controllers/databases.js +22 -0
  189. data/natural-frontend/app/controllers/projects.js +18 -0
  190. data/natural-frontend/app/controllers/table.js +12 -0
  191. data/natural-frontend/app/controllers/table/rows.js +23 -0
  192. data/natural-frontend/app/controllers/tables.js +22 -0
  193. data/natural-frontend/app/helpers/plus-one.js +8 -0
  194. data/natural-frontend/app/index.html +25 -0
  195. data/natural-frontend/app/mixins/application-route-auth-mixin.js +8 -0
  196. data/natural-frontend/app/mixins/authenticated-route-mixin.js +10 -0
  197. data/natural-frontend/app/models/column.js +9 -0
  198. data/natural-frontend/app/models/database.js +9 -0
  199. data/natural-frontend/app/models/project.js +8 -0
  200. data/natural-frontend/app/models/row-value.js +8 -0
  201. data/natural-frontend/app/models/row.js +8 -0
  202. data/natural-frontend/app/models/table.js +9 -0
  203. data/natural-frontend/app/resolver.js +4 -0
  204. data/natural-frontend/app/router.js +22 -0
  205. data/natural-frontend/app/routes/application.js +5 -0
  206. data/natural-frontend/app/routes/authenticate.js +4 -0
  207. data/natural-frontend/app/routes/databases.js +15 -0
  208. data/natural-frontend/app/routes/function.js +20 -0
  209. data/natural-frontend/app/routes/functions.js +22 -0
  210. data/natural-frontend/app/routes/index.js +9 -0
  211. data/natural-frontend/app/routes/projects.js +8 -0
  212. data/natural-frontend/app/routes/table.js +17 -0
  213. data/natural-frontend/app/routes/table/rows.js +19 -0
  214. data/natural-frontend/app/routes/tables.js +16 -0
  215. data/natural-frontend/app/serializers/application.js +10 -0
  216. data/natural-frontend/app/services/authentication.js +38 -0
  217. data/natural-frontend/app/styles/app.scss +58 -0
  218. data/natural-frontend/app/templates/application.hbs +32 -0
  219. data/natural-frontend/app/templates/authenticate.hbs +7 -0
  220. data/natural-frontend/app/templates/components/api-usage-documentation.hbs +36 -0
  221. data/natural-frontend/app/templates/components/column-editor.hbs +37 -0
  222. data/natural-frontend/app/templates/components/row-editor.hbs +21 -0
  223. data/natural-frontend/app/templates/components/row-value-editor.hbs +1 -0
  224. data/natural-frontend/app/templates/databases.hbs +37 -0
  225. data/natural-frontend/app/templates/function.hbs +9 -0
  226. data/natural-frontend/app/templates/functions.hbs +30 -0
  227. data/natural-frontend/app/templates/index.hbs +15 -0
  228. data/natural-frontend/app/templates/projects.hbs +37 -0
  229. data/natural-frontend/app/templates/table.hbs +10 -0
  230. data/natural-frontend/app/templates/table/rows.hbs +23 -0
  231. data/natural-frontend/app/templates/tables.hbs +32 -0
  232. data/natural-frontend/config/environment.js +61 -0
  233. data/natural-frontend/config/targets.js +19 -0
  234. data/natural-frontend/deploy_rails_public.sh +6 -0
  235. data/natural-frontend/ember-cli-build.js +42 -0
  236. data/natural-frontend/package-lock.json +13288 -0
  237. data/natural-frontend/package.json +59 -0
  238. data/natural-frontend/public/robots.txt +3 -0
  239. data/natural-frontend/testem.js +20 -0
  240. data/natural-frontend/tests/index.html +33 -0
  241. data/natural-frontend/tests/integration/components/column-editor-test.js +27 -0
  242. data/natural-frontend/tests/integration/components/row-editor-test.js +27 -0
  243. data/natural-frontend/tests/integration/components/row-value-editor-test.js +27 -0
  244. data/natural-frontend/tests/integration/helpers/humanization-test.js +18 -0
  245. data/natural-frontend/tests/test-helper.js +9 -0
  246. data/natural-frontend/tests/unit/controllers/databases-test.js +13 -0
  247. data/natural-frontend/tests/unit/controllers/projects-test.js +13 -0
  248. data/natural-frontend/tests/unit/controllers/table-test.js +13 -0
  249. data/natural-frontend/tests/unit/controllers/table/rows-test.js +12 -0
  250. data/natural-frontend/tests/unit/controllers/tables-test.js +13 -0
  251. data/natural-frontend/tests/unit/models/column-test.js +15 -0
  252. data/natural-frontend/tests/unit/models/database-test.js +15 -0
  253. data/natural-frontend/tests/unit/models/project-test.js +15 -0
  254. data/natural-frontend/tests/unit/models/row-test.js +15 -0
  255. data/natural-frontend/tests/unit/models/rwo-value-test.js +15 -0
  256. data/natural-frontend/tests/unit/models/table-test.js +15 -0
  257. data/natural-frontend/tests/unit/routes/authenticate-test.js +11 -0
  258. data/natural-frontend/tests/unit/routes/databases-test.js +12 -0
  259. data/natural-frontend/tests/unit/routes/projects-test.js +12 -0
  260. data/natural-frontend/tests/unit/routes/table-test.js +12 -0
  261. data/natural-frontend/tests/unit/routes/table/rows-test.js +11 -0
  262. data/natural-frontend/tests/unit/routes/tables-test.js +12 -0
  263. metadata +303 -0
@@ -0,0 +1,8 @@
1
+ import Route from '@ember/routing/route';
2
+ import AuthenticatedRouteMixin from '../mixins/authenticated-route-mixin';
3
+
4
+ export default Route.extend(AuthenticatedRouteMixin, {
5
+ model() {
6
+ return this.get('store').findAll('project');
7
+ }
8
+ });
@@ -0,0 +1,17 @@
1
+
2
+ import Route from '@ember/routing/route';
3
+ import AuthenticatedRouteMixin from '../mixins/authenticated-route-mixin';
4
+
5
+ export default Route.extend(AuthenticatedRouteMixin, {
6
+ model(params) {
7
+ return this.get('store').findRecord('table', params.table_id);
8
+ },
9
+ setupController: function(controller, model) {
10
+ this._super(controller, model);
11
+ this.controllerFor('application').set('fullscreen', true);
12
+ },
13
+
14
+ deactivate: function() {
15
+ this.controllerFor('application').set('fullscreen', false);
16
+ }
17
+ });
@@ -0,0 +1,19 @@
1
+ import Route from '@ember/routing/route';
2
+ import { inject as service } from '@ember/service';
3
+
4
+ export default Route.extend({
5
+ infinity: service(),
6
+
7
+ model() {
8
+ let table = this.modelFor('table');
9
+ return Ember.RSVP.hash({
10
+ table: table,
11
+ rows: this.infinity.model('row', {
12
+ perPage: 12,
13
+ startingPage: 1,
14
+ table_id: table.id,
15
+ totalPagesParam: 'meta.total-pages'
16
+ })
17
+ });
18
+ }
19
+ });
@@ -0,0 +1,16 @@
1
+
2
+ import Route from '@ember/routing/route';
3
+ import AuthenticatedRouteMixin from '../mixins/authenticated-route-mixin';
4
+ import RSVP from 'rsvp';
5
+
6
+ export default Route.extend(AuthenticatedRouteMixin, {
7
+ model(params) {
8
+ return this.get('store').findRecord('database', params.database_id)
9
+ .then((database) => {
10
+ return RSVP.hash({
11
+ tables: database.get('tables'),
12
+ database: database
13
+ })
14
+ });
15
+ }
16
+ });
@@ -0,0 +1,10 @@
1
+
2
+ import DS from 'ember-data';
3
+ import { singularize } from "ember-inflector";
4
+ import { capitalize } from "@ember/string";
5
+
6
+ export default DS.JSONAPISerializer.extend({
7
+ payloadKeyFromModelName(modelName) {
8
+ return singularize(capitalize(modelName));
9
+ }
10
+ });
@@ -0,0 +1,38 @@
1
+ import ENV from "../config/environment";
2
+ import { inject as service } from '@ember/service';
3
+ import { computed } from '@ember/object';
4
+
5
+
6
+ // TODO: make cookie authentication work (computed property is shit, when used in combination with cookies)
7
+ export default Ember.Service.extend({
8
+ cookies: service(),
9
+ accessToken: null,
10
+
11
+ authenticate(email, password) {
12
+ return Ember.$.ajax({
13
+ method: "POST",
14
+ url: ENV.apiHost === '/' ? '/token' : ENV.apiHost + "/token",
15
+ data: { email: email, password: password }
16
+ }).then((result) => {
17
+ this.set('accessToken', result.token);
18
+
19
+ let cookieService = this.get('cookies');
20
+ cookieService.write('accessToken', result.token);
21
+ });
22
+ },
23
+
24
+ loadFromCookie() {
25
+ let cookieService = this.get('cookies');
26
+ let token = cookieService.read('accessToken');
27
+ this.set('accessToken', token);
28
+ },
29
+
30
+ invalidate() {
31
+ this.set('accessToken', null);
32
+
33
+ let cookieService = this.get('cookies');
34
+ cookieService.write('accessToken', null);
35
+ },
36
+
37
+ isAuthenticated: Ember.computed.bool('accessToken')
38
+ });
@@ -0,0 +1,58 @@
1
+ @import "ember-bootstrap/bootstrap";
2
+
3
+ .redesign {
4
+ body {
5
+ background-color: $blue;
6
+ color: white;
7
+
8
+ .btn {
9
+ background-color: $orange;
10
+ }
11
+ }
12
+
13
+ footer {
14
+ padding: 20px;
15
+ background-color: $indigo;
16
+
17
+ .btn {
18
+ background-color: white;
19
+ }
20
+
21
+ .simple-link {
22
+ color: white;
23
+ }
24
+ }
25
+ }
26
+
27
+ .push-down {
28
+ margin-top: 70px;
29
+ }
30
+
31
+ .push-down-xl {
32
+ margin-top: 150px;
33
+ }
34
+
35
+ .push-left-sm {
36
+ margin-left: 10px;
37
+ }
38
+
39
+ .push-left-m {
40
+ margin-left: 20px;
41
+ }
42
+
43
+ .quarter-width {
44
+ width: 25% !important;
45
+ }
46
+
47
+ .inline-block {
48
+ display: inline-block !important;
49
+ }
50
+
51
+ .margin-sm {
52
+ margin: 10px;
53
+ }
54
+
55
+ .dropdown-menu {
56
+ width: 300px;
57
+ height: auto;
58
+ }
@@ -0,0 +1,32 @@
1
+ <div class='{{if fullscreen 'container-fluid' 'container push-down'}}'>
2
+ {{outlet}}
3
+
4
+ <footer class='push-down-xl'>
5
+ {{#if authentication.isAuthenticated}}
6
+ <a href='#' {{action "logOut"}} class='float-right'>Log out</a>
7
+ {{/if}}
8
+
9
+ <p>
10
+ <a class='btn' href="https://www.betterplace.org/en">
11
+ <b>
12
+ Donate to make the world a better place.
13
+ </b>
14
+ </a>
15
+ </p>
16
+
17
+ <a class='btn' href='https://github.com/MangoSmoothie101010/natural-backend'>
18
+ Api source code (MIT license)
19
+ </a>
20
+
21
+ <a class='btn' href='https://github.com/MangoSmoothie101010/natural-frontend'>
22
+ Ember frontend source code (MIT license)
23
+ </a>
24
+
25
+ <br />
26
+ <br />
27
+
28
+ <p>
29
+ <a class='btn' href="https://www.patreon.com/user?u=11252699">Support ongoing development (My Patreon)</a>
30
+ </p>
31
+ </footer>
32
+ </div>
@@ -0,0 +1,7 @@
1
+ <h2>Authenticate</h2>
2
+
3
+ <form {{action 'authenticate' on='submit'}}>
4
+ {{input value=email placeholder='Username' class='form-control'}}<br>
5
+ {{input value=password placeholder='Password' type='password' class='form-control'}}<br>
6
+ <button class='btn btn-primary' type="submit">Login</button>
7
+ </form>
@@ -0,0 +1,36 @@
1
+ <h4>How to query {{database.name}} Database programatically</h4>
2
+ <p>
3
+ Use the following url to query the database:
4
+ <br />
5
+ <br />
6
+
7
+ <input class='form-control' value='https://api.natural-db.com/databases/{{database.id}}/queries' disabled/>
8
+ <br />
9
+ <!-- <ol>
10
+ <li>Synchronous, providing an instant response.</li>
11
+ <li>Asynchronous, providing a query id, which allows for obtaining the result after the query has run. Provide the 'async' url parameter with value '1'.</li>
12
+ </ol>
13
+
14
+ <br />
15
+ <input class='form-control' value='https://api.natural-db.com/databases/{{database.id}}/queries/(query-id)' disabled/>
16
+ <br /> -->
17
+
18
+ Provide the 'Authentication' header with the following value to access this database:
19
+ <br />
20
+ <br />
21
+
22
+ <input value='{{database.project.apiToken}}' disabled class='form-control'/>
23
+ <br />
24
+ The actual SQL query will be passed via the "sql" form-data parameter in the body of the post request.
25
+
26
+
27
+ <br />
28
+ <br />
29
+ OR
30
+ <br />
31
+ <br />
32
+
33
+ connect to the database via the postgres protocol
34
+
35
+ <input value='{{database.postgresUrl}}' disabled class='form-control'/>
36
+ </p>
@@ -0,0 +1,37 @@
1
+
2
+ <tr>
3
+ <th>
4
+ #
5
+ </th>
6
+ {{#each table.columns as |column|}}
7
+ <th>
8
+ <span>
9
+ {{column.name}}
10
+ </span>
11
+
12
+
13
+ {{#bs-button onClick=(action "deleteColumn" column.id) type="danger push-left-sm"}}
14
+ Delete
15
+ {{/bs-button}}
16
+
17
+ {{#bs-dropdown class='inline-block push-left-sm' as |dd|}}
18
+ {{#dd.toggle}}{{svg-jar "tools" class="octicon"}}
19
+
20
+ <span class="caret"></span>{{/dd.toggle}}
21
+ {{#dd.menu as |ddm|}}
22
+ <div class="px-3 py-3">
23
+ <div class='form-group'>
24
+ <label>Type</label>
25
+ {{select-light value=column.type options=columnTypes change=(action 'updateColumnType' column) class='form-control'}}
26
+ </div>
27
+ </div>
28
+ {{/dd.menu}}
29
+ {{/bs-dropdown}}
30
+ </th>
31
+ {{/each}}
32
+ <th>
33
+ {{#bs-button type="primary" onClick=(action "addColumn")}}
34
+ Add field
35
+ {{/bs-button}}
36
+ </th>
37
+ </tr>
@@ -0,0 +1,21 @@
1
+ {{!-- {{#each table.rows as |row|}}
2
+ <tr>
3
+ <td>
4
+ {{row.dbId}}
5
+ </td>
6
+ {{#each table.columns as |column|}}
7
+ <td>
8
+ {{row-value-editor row=row column=column}}
9
+ </td>
10
+ {{/each}}
11
+ <td>
12
+ {{#bs-button onClick=(action "deleteRow" row.id) type="danger"}} Delete {{/bs-button}}
13
+ </td>
14
+ </tr>
15
+ {{/each}}
16
+ <tr>
17
+ <td>
18
+ {{#bs-button type="primary" onClick=(action "addRow")}} Add row {{/bs-button}}
19
+ </td>
20
+ <td colspan={{plus-one table.columns.length}}></td>
21
+ </tr> --}}
@@ -0,0 +1 @@
1
+ {{input input=(action "triggerUpdate") value=rowValue.value type='text' class='form-control'}}
@@ -0,0 +1,37 @@
1
+
2
+ <h1>Databases</h1>
3
+
4
+ <table class='table'>
5
+ <thead>
6
+ <tr>
7
+ <th>Name</th>
8
+ <th></th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ {{#each model.databases as |database|}}
13
+ <tr>
14
+ <td>
15
+ {{database.name}}
16
+ </td>
17
+ <td>
18
+ {{#link-to 'tables' database.id class='btn btn-primary'}}
19
+ Tables
20
+ {{/link-to}}
21
+ {{#bs-button type="danger" onClick=(action "deleteDatabase" database.id) class='push-left-sm'}}
22
+ Delete
23
+ {{/bs-button}}
24
+ </td>
25
+ </tr>
26
+ {{/each}}
27
+ </tbody>
28
+ </table>
29
+ <div class='float-right'>
30
+ {{#bs-button type="primary" onClick=(action "addDatabase")}}
31
+ Add database
32
+ {{/bs-button}}
33
+
34
+ {{#bs-button onClick=(action 'transitionBack')}}
35
+ Back
36
+ {{/bs-button}}
37
+ </div>
@@ -0,0 +1,9 @@
1
+ <div class='push-down'>
2
+ <h1>{{model.function.name}}</h1>
3
+ {{ivy-codemirror value="class YourPostProcessor < Natural::Functions::PostProcessor
4
+ def each_row(row)
5
+ row.chomp
6
+ end
7
+ end"
8
+ options=(hash lineNumbers=true mode="ruby")}}
9
+ </div>
@@ -0,0 +1,30 @@
1
+ <div class='push-down'>
2
+ <h1>Functions</h1>
3
+
4
+ <table class='table'>
5
+ <thead>
6
+ <tr>
7
+ <th colspan='1'>Name</th>
8
+ <th colspan='1'>Type</th>
9
+ <th></th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ {{#each model.functions as |function|}}
14
+ <tr>
15
+ <td>
16
+ <span>{{function.name}}</span>
17
+ </td>
18
+ <td>
19
+ <span>{{function.type}}</span>
20
+ </td>
21
+ <td>
22
+ {{#link-to 'function' function.id class='btn btn-primary'}}
23
+ Show
24
+ {{/link-to}}
25
+ </td>
26
+ </tr>
27
+ {{/each}}
28
+ </tbody>
29
+ </table>
30
+ </div>
@@ -0,0 +1,15 @@
1
+ <h1>NaturalDB</h1>
2
+
3
+ <p>Welcome to NaturalDB. Design databases visually and query them programatically using a simple
4
+ SQL interface.
5
+ </p>
6
+
7
+ {{#if model.isAuthenticated}}
8
+ {{#link-to 'projects' class='btn btn-primary'}}
9
+ Projects
10
+ {{/link-to}}
11
+ {{else}}
12
+ {{#link-to 'authenticate' class='btn btn-primary'}}
13
+ Register or Login
14
+ {{/link-to}}
15
+ {{/if}}
@@ -0,0 +1,37 @@
1
+ <h1>Projects</h1>
2
+
3
+ <table class='table'>
4
+ <thead>
5
+ <tr>
6
+ <th>Name</th>
7
+ <th></th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ {{#each model as |project|}}
12
+ <tr>
13
+ <td>
14
+ {{project.name}}
15
+ </td>
16
+ <td>
17
+ {{#link-to 'databases' project.id class='btn btn-primary'}}
18
+ Databases
19
+ {{/link-to}}
20
+ {{#bs-button type="danger" onClick=(action "deleteProject" project.id) class='push-left-sm'}}
21
+ Delete
22
+ {{/bs-button}}
23
+ </td>
24
+ </tr>
25
+ {{/each}}
26
+ </tbody>
27
+ </table>
28
+
29
+ <div class='float-right'>
30
+ {{#bs-button type="primary" onClick=(action "addProject")}}
31
+ Add project
32
+ {{/bs-button}}
33
+
34
+ {{#link-to 'index' class='btn btn-secondary'}}
35
+ Back
36
+ {{/link-to}}
37
+ </div>